Skip to content

SDK Overview

@tencent-classroom/sdk is the client non-UI SDK for Tencent Cloud Low-Code Interactive Classroom. It enables you to quickly build interactive classroom features in web applications, including real-time audio/video, interactive whiteboard, instant messaging, and classroom management.

Features

  • Pure TypeScript — Type-safe with full editor autocompletion
  • Zero framework dependencies — Works with Vue, React, Angular, vanilla JS, or any stack
  • Flat API — Single entry point TencentClassroom with 60+ methods, no sub-module access needed
  • Reactive state — Subscribe to any state change via classroom.state.xxx$.subscribe()
  • Unified error handling — All methods return TResult<T>, never throw; check result.ok
  • Built-in i18n — Supports 9 languages out of the box (zh-CN/zh-TW/en/ja/ko/vi/ar/id/es)
  • Multi-role — Teacher, student, assistant, supervisor — each with auto-adapted behaviors

Quick Preview

typescript
import { TencentClassroom, TEvent, StreamType } from '@tencent-classroom/sdk';

// 1. Create instance
const classroom = new TencentClassroom({ language: 'en', debug: true });

// 2. Initialize
await classroom.init();

// 3. Join a classroom
await classroom.joinClass({ classId: 123456, userId: 'user_001', token: 'your-token' });

// 4. Start audio/video
await classroom.startCamera(document.getElementById('local-video')!);
await classroom.startMicrophone();

// 5. Render remote user video
classroom.bindRemoteView('teacher_001', document.getElementById('remote-video')!, StreamType.Camera);

// 6. Subscribe to state changes
classroom.state.classStatus$.subscribe(status => {
  console.log('Class status:', status); // 'notStarted' | 'started' | 'ended'
});

// 7. Leave
await classroom.leaveClass();
await classroom.destroy();

Core Capabilities

CapabilityDescription
Audio & VideoCamera/mic/screen share, automatic remote rendering, smart RTC/Live switching
Instant MessagingGroup chat, direct messages, image/file messages, revocation, unread management
Interactive WhiteboardMulti-user collaboration, PPT/PDF/video courseware, drawing tools
Classroom ManagementStart/end class, mute all, layout switching, raise hand, stage loop
Member ManagementRoster, stage on/off, kick, mute individual, whiteboard permissions
QuizCreate quiz, submit answers, view statistics
Media PlaybackVideo-on-demand, background music (synced playback)
SubtitlesReal-time speech-to-text transcription

Getting Started

New users: Start with the Quick Start Guide — get up and running in 5 minutes.

Find What You Need

I want to…Go to
Get started quicklyQuick Start
Learn about audio/videoAudio & Video Guide
Implement chatIM Chat Guide
Integrate the whiteboardWhiteboard Guide
Support multiple languagesInternationalization
Understand error handlingError Handling
Browse the full method listAPI Reference - Lifecycle
View global state signalsAPI Reference - State
View events listAPI Reference - Events
View enums and typesAPI Reference - Enums & Types

Requirements

  • Node.js >= 16
  • Chrome 85+ / Edge 86+ / Safari 15+ / Firefox 80+
  • WebRTC support required for audio/video features

Installation

bash
pnpm add @tencent-classroom/sdk
# or
npm install @tencent-classroom/sdk