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
TencentClassroomwith 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; checkresult.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
| Capability | Description |
|---|---|
| Audio & Video | Camera/mic/screen share, automatic remote rendering, smart RTC/Live switching |
| Instant Messaging | Group chat, direct messages, image/file messages, revocation, unread management |
| Interactive Whiteboard | Multi-user collaboration, PPT/PDF/video courseware, drawing tools |
| Classroom Management | Start/end class, mute all, layout switching, raise hand, stage loop |
| Member Management | Roster, stage on/off, kick, mute individual, whiteboard permissions |
| Quiz | Create quiz, submit answers, view statistics |
| Media Playback | Video-on-demand, background music (synced playback) |
| Subtitles | Real-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 quickly | Quick Start |
| Learn about audio/video | Audio & Video Guide |
| Implement chat | IM Chat Guide |
| Integrate the whiteboard | Whiteboard Guide |
| Support multiple languages | Internationalization |
| Understand error handling | Error Handling |
| Browse the full method list | API Reference - Lifecycle |
| View global state signals | API Reference - State |
| View events list | API Reference - Events |
| View enums and types | API 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