trtc-sdk-v5 5.10.0-beta.1 → 5.10.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/README-zh_CN.md +1 -2
  2. package/README.md +1 -2
  3. package/index.d.ts +1796 -1823
  4. package/package.json +1 -1
  5. package/{assets → plugins/ai-denoiser}/denoiser-wasm.js +1 -1
  6. package/plugins/cdn-streaming/cdn-streaming.esm.js +1 -1
  7. package/plugins/cdn-streaming/cdn-streaming.iife.js +1 -0
  8. package/plugins/cdn-streaming/package.json +2 -1
  9. package/plugins/cross-room/cross-room.esm.js +1 -1
  10. package/plugins/cross-room/cross-room.iife.js +1 -0
  11. package/plugins/cross-room/package.json +2 -1
  12. package/plugins/device-detector/device-detector.esm.js +1234 -93
  13. package/plugins/device-detector/device-detector.iife.js +1472 -0
  14. package/plugins/device-detector/package.json +2 -1
  15. package/plugins/video-decoder/package.json +1 -1
  16. package/plugins/video-decoder/video-decoder.esm.d.ts +20 -20
  17. package/plugins/video-decoder/video-decoder.esm.js +43 -1
  18. package/plugins/video-decoder/video-decoder.iife.js +43 -0
  19. package/plugins/video-effect/basic-beauty/basic-beauty.esm.js +2 -1
  20. package/plugins/video-effect/basic-beauty/basic-beauty.iife.js +2 -0
  21. package/plugins/video-effect/basic-beauty/package.json +2 -1
  22. package/plugins/video-effect/beauty/beauty.esm.js +2954 -1
  23. package/plugins/video-effect/beauty/beauty.iife.js +2954 -0
  24. package/plugins/video-effect/beauty/package.json +2 -1
  25. package/plugins/video-effect/virtual-background/package.json +2 -1
  26. package/plugins/video-effect/virtual-background/virtual-background.esm.js +60 -1
  27. package/plugins/video-effect/virtual-background/virtual-background.iife.js +60 -0
  28. package/plugins/video-effect/watermark/package.json +2 -1
  29. package/plugins/video-effect/watermark/watermark.esm.d.ts +2 -10
  30. package/plugins/video-effect/watermark/watermark.esm.js +1 -1
  31. package/plugins/video-effect/watermark/watermark.iife.js +1 -0
  32. package/trtc.esm.js +28 -28
  33. package/trtc.js +1 -1
  34. package/assets/debug-dialog.js +0 -1
  35. package/assets/selfie_segmentation/package.json +0 -27
  36. package/assets/selfie_segmentation/selfie_segmentation.binarypb +0 -0
  37. package/assets/selfie_segmentation/selfie_segmentation.tflite +0 -0
  38. package/assets/selfie_segmentation/selfie_segmentation_landscape.tflite +0 -0
  39. package/assets/selfie_segmentation/selfie_segmentation_solution_simd_wasm_bin.data +0 -0
  40. package/assets/selfie_segmentation/selfie_segmentation_solution_simd_wasm_bin.wasm +0 -0
  41. package/assets/selfie_segmentation/selfie_segmentation_solution_wasm_bin.wasm +0 -0
  42. package/assets/videodec.wasm +0 -0
  43. package/assets/videodec_simd.wasm +0 -0
  44. package/plugins/cdn-streaming/cdn-streaming.umd.js +0 -1
  45. package/plugins/cross-room/cross-room.umd.js +0 -1
  46. package/plugins/custom-encryption/custom-encryption.esm.d.ts +0 -31
  47. package/plugins/custom-encryption/custom-encryption.esm.js +0 -1
  48. package/plugins/custom-encryption/custom-encryption.umd.js +0 -1
  49. package/plugins/custom-encryption/package.json +0 -7
  50. package/plugins/device-detector/device-detector.umd.js +0 -39
  51. package/plugins/video-decoder/video-decoder.umd.js +0 -1
  52. package/plugins/video-effect/basic-beauty/basic-beauty.umd.js +0 -1
  53. package/plugins/video-effect/beauty/beauty.umd.js +0 -1
  54. package/plugins/video-effect/virtual-background/virtual-background.umd.js +0 -1
  55. package/plugins/video-effect/watermark/watermark.umd.js +0 -1
  56. package/plugins/voice-changer/package.json +0 -9
  57. package/plugins/voice-changer/voice-changer.esm.d.ts +0 -20
  58. package/plugins/voice-changer/voice-changer.esm.js +0 -1
  59. package/plugins/voice-changer/voice-changer.umd.js +0 -1
package/index.d.ts CHANGED
@@ -5,96 +5,94 @@ import { Watermark, WatermarkOptions } from './plugins/video-effect/watermark';
5
5
  import { Beauty, BeautyOptions, UpdateBeautyOptions } from './plugins/video-effect/beauty';
6
6
  import { BasicBeauty, BasicBeautyOptions } from './plugins/video-effect/basic-beauty';
7
7
  import { CrossRoom, StartCrossRoomOption, UpdateCrossRoomOption, StopCrossRoomOption } from './plugins/cross-room';
8
- import { EncryptionOptions } from './plugins/custom-encryption';
8
+ import { Debug, DebugOptions } from './plugins/debug';
9
9
 
10
- export { CDNStreamingOptions, DeviceDetectorOptions, VirtualBackgroundOptions, UpdateVirtualBackgroundOptions, WatermarkOptions, BeautyOptions, UpdateBeautyOptions, BasicBeautyOptions, StartCrossRoomOption, UpdateCrossRoomOption, StopCrossRoomOption };
11
- type TRTCPlugin = typeof CrossRoom | typeof CDNStreaming | typeof DeviceDetector | typeof VirtualBackground | typeof Watermark | typeof Beauty | typeof BasicBeauty;
10
+ export { CDNStreamingOptions, DeviceDetectorOptions, VirtualBackgroundOptions, UpdateVirtualBackgroundOptions, WatermarkOptions, BeautyOptions, UpdateBeautyOptions, BasicBeautyOptions, StartCrossRoomOption, UpdateCrossRoomOption, StopCrossRoomOption, DebugOptions };
11
+ type TRTCPlugin = typeof CrossRoom | typeof CDNStreaming | typeof DeviceDetector | typeof VirtualBackground | typeof Watermark | typeof Beauty | typeof BasicBeauty | typeof Debug;
12
12
 
13
13
  export declare type PluginStartOptionsMap = {
14
- 'AudioMixer': AudioMixerOptions;
15
- 'AIDenoiser': AIDenoiserOptions;
16
- 'CDNStreaming': CDNStreamingOptions;
17
- 'VirtualBackground': VirtualBackgroundOptions;
18
- 'Watermark': WatermarkOptions;
19
- 'Beauty': BeautyOptions;
20
- 'BasicBeauty': BasicBeautyOptions;
21
- 'DeviceDetector': DeviceDetectorOptions;
22
- 'Debug': undefined;
23
- 'CrossRoom': StartCrossRoomOption;
24
- 'CustomEncryption': EncryptionOptions;
14
+ 'AudioMixer': AudioMixerOptions;
15
+ 'AIDenoiser': AIDenoiserOptions;
16
+ 'CDNStreaming': CDNStreamingOptions;
17
+ 'VirtualBackground': VirtualBackgroundOptions;
18
+ 'Watermark': WatermarkOptions;
19
+ 'Beauty': BeautyOptions;
20
+ 'BasicBeauty': BasicBeautyOptions;
21
+ 'DeviceDetector': DeviceDetectorOptions;
22
+ 'Debug': undefined;
23
+ 'CrossRoom': StartCrossRoomOption;
25
24
  };
26
-
27
25
  export declare type PluginUpdateOptionsMap = {
28
- 'AudioMixer': UpdateAudioMixerOptions;
29
- 'CDNStreaming': CDNStreamingOptions;
30
- 'VirtualBackground': UpdateVirtualBackgroundOptions;
31
- 'Beauty': UpdateBeautyOptions;
32
- 'BasicBeauty': BasicBeautyOptions;
33
- 'CrossRoom': UpdateCrossRoomOption;
26
+ 'AudioMixer': UpdateAudioMixerOptions;
27
+ 'CDNStreaming': CDNStreamingOptions;
28
+ 'VirtualBackground': UpdateVirtualBackgroundOptions;
29
+ 'Beauty': UpdateBeautyOptions;
30
+ 'BasicBeauty': BasicBeautyOptions;
31
+ 'CrossRoom': UpdateCrossRoomOption;
34
32
  };
35
33
 
36
34
  export declare type PluginStopOptionsMap = {
37
- 'AudioMixer': StopAudioMixerOptions;
38
- 'AIDenoiser': undefined;
39
- 'CDNStreaming': CDNStreamingOptions;
40
- 'VirtualBackground': undefined;
41
- 'Watermark': undefined;
42
- 'Beauty': undefined;
43
- 'BasicBeauty': undefined;
44
- 'DeviceDetector': undefined;
45
- 'Debug': undefined;
46
- 'CrossRoom': StopCrossRoomOption | undefined;
35
+ 'AudioMixer': StopAudioMixerOptions;
36
+ 'AIDenoiser': undefined;
37
+ 'CDNStreaming': CDNStreamingOptions;
38
+ 'VirtualBackground': undefined;
39
+ 'Watermark': undefined;
40
+ 'Beauty': undefined;
41
+ 'BasicBeauty': undefined;
42
+ 'DeviceDetector': undefined;
43
+ 'Debug': undefined;
44
+ 'CrossRoom': StopCrossRoomOption | undefined;
47
45
  };
48
46
 
49
47
  export declare class RtcError extends Error implements RTCErrorInterface {
50
48
  name: string;
51
49
  /**
52
- *
53
- * Error code
54
- * @see Detailed error code list: {@link module:ERROR_CODE ErrorCode}
55
- * @readonly
56
- * @memberof RtcError
57
- */
50
+ *
51
+ * Error code
52
+ * @see Detailed error code list: {@link module:ERROR_CODE ErrorCode}
53
+ * @readonly
54
+ * @memberof RtcError
55
+ */
58
56
  code: number;
59
57
  /**
60
- *
61
- * Extended error code
62
- * @see Detailed error code list: {@link module:ERROR_CODE ErrorCode}
63
- * @readonly
64
- * @memberof RtcError
65
- */
58
+ *
59
+ * Extended error code
60
+ * @see Detailed error code list: {@link module:ERROR_CODE ErrorCode}
61
+ * @readonly
62
+ * @memberof RtcError
63
+ */
66
64
  extraCode?: number;
67
65
  /**
68
- *
69
- * The name of the function that throws the error
70
- * @readonly
71
- * @memberof RtcError
72
- */
66
+ *
67
+ * The name of the function that throws the error
68
+ * @readonly
69
+ * @memberof RtcError
70
+ */
73
71
  functionName: string;
74
72
  /**
75
- *
76
- * Error message
77
- * @readonly
78
- * @memberof RtcError
79
- */
73
+ *
74
+ * Error message
75
+ * @readonly
76
+ * @memberof RtcError
77
+ */
80
78
  message: string;
81
79
  /**
82
- * Error handler. For the following errors, you can call error.handler() for recovering.
83
- *
84
- * - {@link module:ERROR_CODE.DEVICE_ERROR ErrorCode.DEVICE_ERROR} extraCode: 5302
85
- * ```js
86
- * trtc.startLocalAudio().catch(error => {
87
- * if (error.extraCode === 5302 && typeof error.handler === 'function') {
88
- * // Prompt the user the browser permission(camera/microphone/screen sharing) has been denied by system. The browser will jump to the System Settings APP, please enable the relevant permissions!
89
- * // Available in Windows and MacOS.
90
- * error.handler();
91
- * }
92
- * })
93
- * ```
94
- * @since v5.2.0
95
- * @readonly
96
- * @memberof RtcError
97
- */
80
+ * Error handler. For the following errors, you can call error.handler() for recovering.
81
+ *
82
+ * - {@link module:ERROR_CODE.DEVICE_ERROR ErrorCode.DEVICE_ERROR} extraCode: 5302
83
+ * ```js
84
+ * trtc.startLocalAudio().catch(error => {
85
+ * if (error.extraCode === 5302 && typeof error.handler === 'function') {
86
+ * // Prompt the user the browser permission(camera/microphone/screen sharing) has been denied by system. The browser will jump to the System Settings APP, please enable the relevant permissions!
87
+ * // Available in Windows and MacOS.
88
+ * error.handler();
89
+ * }
90
+ * })
91
+ * ```
92
+ * @since v5.2.0
93
+ * @readonly
94
+ * @memberof RtcError
95
+ */
98
96
  handler?: () => void;
99
97
  originError?: Error | DOMException | RtcError;
100
98
  constructor({ code, extraCode, message, messageParams, fnName, originError }: RTCErrorParams);
@@ -102,177 +100,177 @@ export declare class RtcError extends Error implements RTCErrorInterface {
102
100
  }
103
101
 
104
102
  export declare enum LOG_LEVEL {
105
- /**
106
- * 输出所有日志
107
- */
108
- TRACE = 0,
109
- /**
110
- * 输出 DEBUG、INFO、WARN、ERROR 等级日志
111
- */
112
- DEBUG = 1,
113
- /**
114
- * 输出 INFO、WARN、ERROR 等级日志
115
- */
116
- INFO = 2,
117
- /**
118
- * 输出 WARN、ERROR 等级日志
119
- */
120
- WARN = 3,
121
- /**
122
- * 输出 ERROR 等级日志
123
- */
124
- ERROR = 4,
125
- /**
126
- * 不输出任何日志
127
- */
128
- NONE = 5
103
+ /**
104
+ * 输出所有日志
105
+ */
106
+ TRACE = 0,
107
+ /**
108
+ * 输出 DEBUG、INFO、WARN、ERROR 等级日志
109
+ */
110
+ DEBUG = 1,
111
+ /**
112
+ * 输出 INFO、WARN、ERROR 等级日志
113
+ */
114
+ INFO = 2,
115
+ /**
116
+ * 输出 WARN、ERROR 等级日志
117
+ */
118
+ WARN = 3,
119
+ /**
120
+ * 输出 ERROR 等级日志
121
+ */
122
+ ERROR = 4,
123
+ /**
124
+ * 不输出任何日志
125
+ */
126
+ NONE = 5
129
127
  }
130
128
  export declare const audioProfileMap: {
131
- readonly standard: {
132
- readonly sampleRate: 48000;
133
- readonly channelCount: 1;
134
- readonly bitrate: 40;
135
- };
136
- readonly 'standard-stereo': {
137
- readonly sampleRate: 48000;
138
- readonly channelCount: 2;
139
- readonly bitrate: 64;
140
- };
141
- readonly high: {
142
- readonly sampleRate: 48000;
143
- readonly channelCount: 1;
144
- readonly bitrate: 192;
145
- };
146
- readonly 'high-stereo': {
147
- readonly sampleRate: 48000;
148
- readonly channelCount: 2;
149
- readonly bitrate: 192;
150
- };
129
+ readonly standard: {
130
+ readonly sampleRate: 48000;
131
+ readonly channelCount: 1;
132
+ readonly bitrate: 40;
133
+ };
134
+ readonly 'standard-stereo': {
135
+ readonly sampleRate: 48000;
136
+ readonly channelCount: 2;
137
+ readonly bitrate: 64;
138
+ };
139
+ readonly high: {
140
+ readonly sampleRate: 48000;
141
+ readonly channelCount: 1;
142
+ readonly bitrate: 192;
143
+ };
144
+ readonly 'high-stereo': {
145
+ readonly sampleRate: 48000;
146
+ readonly channelCount: 2;
147
+ readonly bitrate: 192;
148
+ };
151
149
  };
152
150
  export declare const videoProfileMap: {
153
- readonly '120p': {
154
- readonly width: 160;
155
- readonly height: 120;
156
- readonly frameRate: 15;
157
- readonly bitrate: 200;
158
- };
159
- readonly '180p': {
160
- readonly width: 320;
161
- readonly height: 180;
162
- readonly frameRate: 15;
163
- readonly bitrate: 350;
164
- };
165
- readonly '240p': {
166
- readonly width: 320;
167
- readonly height: 240;
168
- readonly frameRate: 15;
169
- readonly bitrate: 400;
170
- };
171
- readonly '360p': {
172
- readonly width: 640;
173
- readonly height: 360;
174
- readonly frameRate: 15;
175
- readonly bitrate: 800;
176
- };
177
- readonly '480p': {
178
- readonly width: 640;
179
- readonly height: 480;
180
- readonly frameRate: 15;
181
- readonly bitrate: 900;
182
- };
183
- readonly '720p': {
184
- readonly width: 1280;
185
- readonly height: 720;
186
- readonly frameRate: 15;
187
- readonly bitrate: 1500;
188
- };
189
- readonly '1080p': {
190
- readonly width: 1920;
191
- readonly height: 1080;
192
- readonly frameRate: 15;
193
- readonly bitrate: 2000;
194
- };
195
- readonly '1440p': {
196
- readonly width: 2560;
197
- readonly height: 1440;
198
- readonly frameRate: 30;
199
- readonly bitrate: 4860;
200
- };
201
- readonly '4K': {
202
- readonly width: 3840;
203
- readonly height: 2160;
204
- readonly frameRate: 30;
205
- readonly bitrate: 9000;
206
- };
151
+ readonly '120p': {
152
+ readonly width: 160;
153
+ readonly height: 120;
154
+ readonly frameRate: 15;
155
+ readonly bitrate: 200;
156
+ };
157
+ readonly '180p': {
158
+ readonly width: 320;
159
+ readonly height: 180;
160
+ readonly frameRate: 15;
161
+ readonly bitrate: 350;
162
+ };
163
+ readonly '240p': {
164
+ readonly width: 320;
165
+ readonly height: 240;
166
+ readonly frameRate: 15;
167
+ readonly bitrate: 400;
168
+ };
169
+ readonly '360p': {
170
+ readonly width: 640;
171
+ readonly height: 360;
172
+ readonly frameRate: 15;
173
+ readonly bitrate: 800;
174
+ };
175
+ readonly '480p': {
176
+ readonly width: 640;
177
+ readonly height: 480;
178
+ readonly frameRate: 15;
179
+ readonly bitrate: 900;
180
+ };
181
+ readonly '720p': {
182
+ readonly width: 1280;
183
+ readonly height: 720;
184
+ readonly frameRate: 15;
185
+ readonly bitrate: 1500;
186
+ };
187
+ readonly '1080p': {
188
+ readonly width: 1920;
189
+ readonly height: 1080;
190
+ readonly frameRate: 15;
191
+ readonly bitrate: 2000;
192
+ };
193
+ readonly '1440p': {
194
+ readonly width: 2560;
195
+ readonly height: 1440;
196
+ readonly frameRate: 30;
197
+ readonly bitrate: 4860;
198
+ };
199
+ readonly '4K': {
200
+ readonly width: 3840;
201
+ readonly height: 2160;
202
+ readonly frameRate: 30;
203
+ readonly bitrate: 9000;
204
+ };
207
205
  };
208
206
  export declare const screenProfileMap: {
209
- readonly '480p': {
210
- readonly width: 640;
211
- readonly height: 480;
212
- readonly frameRate: 5;
213
- readonly bitrate: 900;
214
- };
215
- readonly '480p_2': {
216
- readonly width: 640;
217
- readonly height: 480;
218
- readonly frameRate: 30;
219
- readonly bitrate: 1000;
220
- };
221
- readonly '720p': {
222
- readonly width: 1280;
223
- readonly height: 720;
224
- readonly frameRate: 5;
225
- readonly bitrate: 1200;
226
- };
227
- readonly '720p_2': {
228
- readonly width: 1280;
229
- readonly height: 720;
230
- readonly frameRate: 30;
231
- readonly bitrate: 3000;
232
- };
233
- readonly '1080p': {
234
- readonly width: 1920;
235
- readonly height: 1080;
236
- readonly frameRate: 5;
237
- readonly bitrate: 1600;
238
- };
239
- readonly '1080p_2': {
240
- readonly width: 1920;
241
- readonly height: 1080;
242
- readonly frameRate: 30;
243
- readonly bitrate: 4000;
244
- };
207
+ readonly '480p': {
208
+ readonly width: 640;
209
+ readonly height: 480;
210
+ readonly frameRate: 5;
211
+ readonly bitrate: 900;
212
+ };
213
+ readonly '480p_2': {
214
+ readonly width: 640;
215
+ readonly height: 480;
216
+ readonly frameRate: 30;
217
+ readonly bitrate: 1000;
218
+ };
219
+ readonly '720p': {
220
+ readonly width: 1280;
221
+ readonly height: 720;
222
+ readonly frameRate: 5;
223
+ readonly bitrate: 1200;
224
+ };
225
+ readonly '720p_2': {
226
+ readonly width: 1280;
227
+ readonly height: 720;
228
+ readonly frameRate: 30;
229
+ readonly bitrate: 3000;
230
+ };
231
+ readonly '1080p': {
232
+ readonly width: 1920;
233
+ readonly height: 1080;
234
+ readonly frameRate: 5;
235
+ readonly bitrate: 1600;
236
+ };
237
+ readonly '1080p_2': {
238
+ readonly width: 1920;
239
+ readonly height: 1080;
240
+ readonly frameRate: 30;
241
+ readonly bitrate: 4000;
242
+ };
245
243
  };
246
244
  export declare const enum Scene {
247
- LIVE = 'live',
248
- RTC = 'rtc'
245
+ LIVE = 'live',
246
+ RTC = 'rtc'
249
247
  }
250
248
 
251
249
  export declare const enum NetworkQualityValue {
252
- UNKNOWN,
253
- EXCELLENT,
254
- GOOD,
255
- POOR,
256
- BAD,
257
- VERY_BAD,
258
- DISCONNECTED
250
+ UNKNOWN,
251
+ EXCELLENT,
252
+ GOOD,
253
+ POOR,
254
+ BAD,
255
+ VERY_BAD,
256
+ DISCONNECTED
259
257
  }
260
258
 
261
259
  export declare const enum PlayerState {
262
- PAUSED = 'PAUSED',
263
- PLAYING = 'PLAYING',
264
- STOPPED = 'STOPPED'
260
+ PAUSED = 'PAUSED',
261
+ PLAYING = 'PLAYING',
262
+ STOPPED = 'STOPPED'
265
263
  }
266
264
  export declare const enum UserRole {
267
- ANCHOR = 'anchor',
268
- AUDIENCE = 'audience'
265
+ ANCHOR = 'anchor',
266
+ AUDIENCE = 'audience'
269
267
  }
270
268
  export declare const enum ConnectionState {
271
- CONNECTED = 'CONNECTED',
272
- DISCONNECTED = 'DISCONNECTED',
273
- CONNECTING = 'CONNECTING',
274
- RECONNECTED = 'RECONNECTED',
275
- RECONNECTING = 'RECONNECTING'
269
+ CONNECTED = 'CONNECTED',
270
+ DISCONNECTED = 'DISCONNECTED',
271
+ CONNECTING = 'CONNECTING',
272
+ RECONNECTED = 'RECONNECTED',
273
+ RECONNECTING = 'RECONNECTING'
276
274
  }
277
275
  export declare interface PingResult {
278
276
  domain: string;
@@ -284,48 +282,47 @@ export declare interface PingResults {
284
282
  data?: PingResult[];
285
283
  }
286
284
  export declare interface NetworkQuality {
287
- uplinkNetworkQuality: NetworkQualityValue;
288
- downlinkNetworkQuality: NetworkQualityValue;
289
- uplinkRTT: number;
290
- uplinkLoss: number;
291
- downlinkRTT: number;
292
- downlinkLoss: number;
293
- pingResults?: PingResults;
285
+ uplinkNetworkQuality: NetworkQualityValue;
286
+ downlinkNetworkQuality: NetworkQualityValue;
287
+ uplinkRTT: number;
288
+ uplinkLoss: number;
289
+ downlinkRTT: number;
290
+ downlinkLoss: number;
291
+ pingResults?: PingResults;
294
292
  }
295
293
  export declare const enum BannedReason {
296
- BANNED = 'banned',
297
- KICK = 'kick',
298
- USER_TIME_OUT = 'user_time_out',
299
- ROOM_DISBAND = 'room_disband'
294
+ BANNED = 'banned',
295
+ KICK = 'kick',
296
+ USER_TIME_OUT = 'user_time_out',
297
+ ROOM_DISBAND = 'room_disband'
300
298
  }
301
299
 
302
300
  export declare type PluginWithAssets = {
303
- plugin: TRTCPlugin;
304
- assetsPath?: string;
301
+ plugin: TRTCPlugin;
302
+ assetsPath?: string;
305
303
  };
306
304
  export declare interface TRTCOptions {
307
- plugins?: Array<TRTCPlugin>;
308
- enableSEI?: boolean;
309
- assetsPath?: string;
310
- volumeType?: number;
305
+ plugins?: Array<TRTCPlugin>;
306
+ enableSEI?: boolean;
307
+ assetsPath?: string;
308
+ volumeType?: number;
311
309
  }
312
310
  export interface VideoProfile { width: number, height: number, frameRate: number, bitrate: number; }
313
311
  export interface AudioProfile { sampleRate: number, channelCount: number, bitrate: number; }
314
312
  export declare interface LocalVideoConfig {
315
- view?: string | HTMLElement | HTMLElement[] | null;
316
- publish?: boolean;
317
- mute?: boolean | string;
318
- option?: {
319
- cameraId?: string;
320
- useFrontCamera?: boolean;
321
- profile?: keyof typeof videoProfileMap | VideoProfile;
322
- fillMode?: 'contain' | 'cover' | 'fill';
323
- mirror?: boolean | string;
324
- small?: keyof typeof videoProfileMap | VideoProfile | boolean;
325
- qosPreference?: typeof TRTCType.QOS_PREFERENCE_SMOOTH | typeof TRTCType.QOS_PREFERENCE_CLEAR;
326
- videoTrack?: MediaStreamTrack;
327
- avoidCrop?: boolean;
328
- };
313
+ view?: string | HTMLElement | HTMLElement[] | null;
314
+ publish?: boolean;
315
+ mute?: boolean | string;
316
+ option?: {
317
+ cameraId?: string;
318
+ useFrontCamera?: boolean;
319
+ profile?: keyof typeof videoProfileMap | VideoProfile;
320
+ fillMode?: 'contain' | 'cover' | 'fill';
321
+ mirror?: boolean | string;
322
+ small?: keyof typeof videoProfileMap | VideoProfile | boolean;
323
+ qosPreference?: typeof TRTCType.QOS_PREFERENCE_SMOOTH | typeof TRTCType.QOS_PREFERENCE_CLEAR;
324
+ videoTrack?: MediaStreamTrack;
325
+ };
329
326
  }
330
327
  export interface TurnServerOptions {
331
328
  url: string;
@@ -334,144 +331,137 @@ export interface TurnServerOptions {
334
331
  credentialType?: 'password';
335
332
  }
336
333
  export declare interface ProxyServer {
337
- websocketProxy?: string;
338
- loggerProxy?: string;
339
- turnServer?: TurnServerOptions | TurnServerOptions[];
340
- iceTransportPolicy?: RTCIceTransportPolicy;
341
- webtransportProxy?: string;
342
- scheduleProxy?: string;
343
- unifiedProxy?: string;
334
+ websocketProxy?: string;
335
+ loggerProxy?: string;
336
+ turnServer?: TurnServerOptions | TurnServerOptions[];
337
+ iceTransportPolicy?: RTCIceTransportPolicy;
338
+ webtransportProxy?: string;
339
+ scheduleProxy?: string;
340
+ unifiedProxy?: string;
344
341
  }
345
342
  export declare interface EnterRoomConfig {
346
- sdkAppId: number;
347
- userId: string;
348
- userSig: string;
349
- roomId?: number;
350
- strRoomId?: string;
351
- role?: UserRole;
352
- autoReceiveAudio?: boolean;
353
- autoReceiveVideo?: boolean;
354
- privateMapKey?: string;
355
- latencyLevel?: number;
356
- businessInfo?: string;
357
- enableAutoPlayDialog?: boolean;
358
- proxy?: ProxyServer | string;
359
- scene?: Scene;
360
- userDefineRecordId?: string;
361
- playoutDelay?: PlayoutDelay;
362
- }
363
-
364
- export interface PlayoutDelay {
365
- min: number;
366
- max: number;
343
+ sdkAppId: number;
344
+ userId: string;
345
+ userSig: string;
346
+ roomId?: number;
347
+ strRoomId?: string;
348
+ role?: UserRole;
349
+ autoReceiveAudio?: boolean;
350
+ autoReceiveVideo?: boolean;
351
+ privateMapKey?: string;
352
+ latencyLevel?: number;
353
+ businessInfo?: string;
354
+ enableAutoPlayDialog?: boolean;
355
+ proxy?: ProxyServer | string;
356
+ scene?: Scene;
357
+ userDefineRecordId?: string;
367
358
  }
368
-
369
359
  export declare interface ScreenShareConfig {
370
- view?: string | HTMLElement | HTMLElement[] | null;
371
- publish?: boolean;
372
- option?: {
373
- profile?: keyof typeof screenProfileMap | VideoProfile;
374
- fillMode?: 'contain' | 'cover' | 'fill';
375
- systemAudio?: boolean;
376
- echoCancellation?: boolean;
377
- autoGainControl?: boolean;
378
- noiseSuppression?: boolean;
379
- audioTrack?: MediaStreamTrack;
380
- videoTrack?: MediaStreamTrack;
381
- captureElement?: HTMLElement;
382
- preferDisplaySurface?: 'current-tab' | 'tab' | 'window' | 'monitor';
383
- qosPreference?: typeof TRTCType.QOS_PREFERENCE_SMOOTH | typeof TRTCType.QOS_PREFERENCE_CLEAR;
384
- };
360
+ view?: string | HTMLElement | HTMLElement[] | null;
361
+ publish?: boolean;
362
+ option?: {
363
+ profile?: keyof typeof screenProfileMap | VideoProfile;
364
+ fillMode?: 'contain' | 'cover' | 'fill';
365
+ systemAudio?: boolean;
366
+ echoCancellation?: boolean;
367
+ autoGainControl?: boolean;
368
+ noiseSuppression?: boolean;
369
+ audioTrack?: MediaStreamTrack;
370
+ videoTrack?: MediaStreamTrack;
371
+ captureElement?: HTMLElement;
372
+ preferDisplaySurface?: 'current-tab' | 'tab' | 'window' | 'monitor';
373
+ qosPreference?: typeof TRTCType.QOS_PREFERENCE_SMOOTH | typeof TRTCType.QOS_PREFERENCE_CLEAR;
374
+ };
385
375
  }
386
376
  export declare interface UpdateScreenShareConfig extends ScreenShareConfig {
387
- option?: {
388
- fillMode?: 'contain' | 'cover' | 'fill';
389
- qosPreference?: typeof TRTCType.QOS_PREFERENCE_SMOOTH | typeof TRTCType.QOS_PREFERENCE_CLEAR;
390
- };
377
+ option?: {
378
+ fillMode?: 'contain' | 'cover' | 'fill';
379
+ qosPreference?: typeof TRTCType.QOS_PREFERENCE_SMOOTH | typeof TRTCType.QOS_PREFERENCE_CLEAR;
380
+ };
391
381
  }
392
382
  export declare interface RemoteVideoConfig {
393
- view?: string | HTMLElement | HTMLElement[] | null;
394
- userId: string;
395
- streamType: TRTCStreamType;
396
- option?: {
397
- fillMode?: 'contain' | 'cover' | 'fill';
398
- mirror?: boolean;
399
- small?: boolean;
400
- receiveWhenViewVisible?: boolean;
401
- viewRoot?: HTMLElement;
402
- canvasRender?: boolean;
383
+ view?: string | HTMLElement | HTMLElement[] | null;
384
+ userId: string;
385
+ streamType: TRTCStreamType;
386
+ option?: {
387
+ fillMode?: 'contain' | 'cover' | 'fill';
388
+ mirror?: boolean;
389
+ small?: boolean;
390
+ receiveWhenViewVisible?: boolean;
391
+ viewRoot?: HTMLElement;
392
+ canvasRender?: boolean;
403
393
  poster?: string;
404
- };
394
+ };
405
395
  }
406
396
  export declare interface StopRemoteVideoConfig {
407
- userId: string;
408
- streamType?: TRTCStreamType;
397
+ userId: string;
398
+ streamType?: TRTCStreamType;
409
399
  }
410
400
  export declare interface LocalAudioConfig {
411
- publish?: boolean;
412
- mute?: boolean;
413
- option?: {
414
- microphoneId?: string;
415
- profile?: keyof typeof audioProfileMap;
416
- audioTrack?: MediaStreamTrack;
417
- captureVolume?: number;
418
- earMonitorVolume?: number;
419
- echoCancellation?: boolean;
420
- autoGainControl?: boolean;
421
- noiseSuppression?: boolean;
422
- };
401
+ publish?: boolean;
402
+ mute?: boolean;
403
+ option?: {
404
+ microphoneId?: string;
405
+ profile?: keyof typeof audioProfileMap;
406
+ audioTrack?: MediaStreamTrack;
407
+ captureVolume?: number;
408
+ earMonitorVolume?: number;
409
+ echoCancellation?: boolean;
410
+ autoGainControl?: boolean;
411
+ noiseSuppression?: boolean;
412
+ };
423
413
  }
424
414
  export declare interface UpdateLocalAudioConfig extends LocalAudioConfig {
425
- mute?: boolean;
426
- option?: {
427
- microphoneId?: string;
428
- audioTrack?: MediaStreamTrack;
429
- captureVolume?: number;
430
- earMonitorVolume?: number;
431
- echoCancellation?: boolean;
432
- autoGainControl?: boolean;
433
- noiseSuppression?: boolean;
434
- };
415
+ mute?: boolean;
416
+ option?: {
417
+ microphoneId?: string;
418
+ audioTrack?: MediaStreamTrack;
419
+ captureVolume?: number;
420
+ earMonitorVolume?: number;
421
+ echoCancellation?: boolean;
422
+ autoGainControl?: boolean;
423
+ noiseSuppression?: boolean;
424
+ };
435
425
  }
436
426
  export declare interface RemoteAudioConfig {
437
- userId: string;
438
- option?: {
439
- volume?: number;
440
- };
427
+ userId: string;
428
+ option?: {
429
+ volume?: number;
430
+ };
441
431
  }
442
432
  export declare interface StopRemoteAudioConfig {
443
- userId: string;
433
+ userId: string;
444
434
  }
445
435
  export declare const enum TRTCStreamType {
446
- Main = 'main',
447
- Sub = 'sub'
436
+ Main = 'main',
437
+ Sub = 'sub'
448
438
  }
449
439
  export declare enum TRTCDeviceType {
450
- Camera = 'camera',
451
- Microphone = 'microphone',
452
- Speaker = 'speaker'
440
+ Camera = 'camera',
441
+ Microphone = 'microphone',
442
+ Speaker = 'speaker'
453
443
  }
454
444
  export declare enum TRTCDeviceAction {
455
- Remove = 'remove',
456
- Add = 'add',
457
- Active = 'active'
445
+ Remove = 'remove',
446
+ Add = 'add',
447
+ Active = 'active'
458
448
  }
459
449
  export declare interface RTCErrorParams {
460
- code: number;
461
- extraCode?: number;
462
- functionName?: string;
463
- fnName?: string;
464
- message?: string;
465
- messageParams?: any;
466
- originError?: Error | DOMException;
450
+ code: number;
451
+ extraCode?: number;
452
+ functionName?: string;
453
+ fnName?: string;
454
+ message?: string;
455
+ messageParams?: any;
456
+ originError?: Error | DOMException;
467
457
  }
468
458
  export declare interface RTCErrorInterface {
469
- readonly name: string;
470
- readonly code: number;
471
- readonly extraCode?: number;
472
- readonly functionName?: string;
473
- readonly message?: string;
474
- readonly originError?: Error | DOMException;
459
+ readonly name: string;
460
+ readonly code: number;
461
+ readonly extraCode?: number;
462
+ readonly functionName?: string;
463
+ readonly message?: string;
464
+ readonly originError?: Error | DOMException;
475
465
  }
476
466
  /**
477
467
  * **TRTC Constants**<br>
@@ -481,190 +471,190 @@ export declare interface RTCErrorInterface {
481
471
  * TRTC.TYPE.SCENE_LIVE
482
472
  */
483
473
  export declare const TRTCType: {
484
- /**
485
- * Live streaming scene
486
- * @default 'live'
487
- * @memberof module:TYPE
488
- */
489
- readonly SCENE_LIVE: Scene.LIVE;
490
- /**
491
- * RTC scene
492
- * @default 'rtc'
493
- * @memberof module:TYPE
494
- */
495
- readonly SCENE_RTC: Scene.RTC;
496
- /**
497
- * Anchor role
498
- * @default 'anchor'
499
- * @memberof module:TYPE
500
- */
501
- readonly ROLE_ANCHOR: UserRole.ANCHOR;
502
- /**
503
- * Audience role
504
- * @default 'audience'
505
- * @memberof module:TYPE
506
- */
507
- readonly ROLE_AUDIENCE: UserRole.AUDIENCE;
508
- /**
509
- * Main stream
510
- *
511
- * - TRTC has a main video stream (main stream) and an sub video stream (sub stream)
512
- * - The camera is published through the main stream, and the screen sharing is published through the sub stream.
513
- * - The main video stream includes: high-definition large picture and low-definition small picture. By default, {@link TRTC#startRemoteVideo TRTC.startRemoteVideo} plays the high-definition large picture, and the low-definition small picture can be played through the small parameter. Refer to: [Enable small stream function](./tutorial-27-advanced-small-stream.html).
514
- * @default 'main'
515
- * @memberof module:TYPE
516
- */
517
- readonly STREAM_TYPE_MAIN: TRTCStreamType.Main;
518
- /**
519
- * Sub stream
520
- * @default 'sub'
521
- * @memberof module:TYPE
522
- */
523
- readonly STREAM_TYPE_SUB: TRTCStreamType.Sub;
524
- /**
525
- * Standard audio quality
526
- * | Audio Profile | Sampling Rate | Channel | Bitrate (kbps) |
527
- * | :--- | :--- | :--- | :--- |
528
- * | TRTC.TYPE.AUDIO_PROFILE_STANDARD | 48000 | Mono| 40 |
529
- * | TRTC.TYPE.AUDIO_PROFILE_HIGH | 48000 | Mono| 128 |
530
- * | TRTC.TYPE.AUDIO_PROFILE_STANDARD_STEREO | 48000 | Stereo| 64 |
531
- * | TRTC.TYPE.AUDIO_PROFILE_HIGH_STEREO | 48000 | Stereo| 192 |
532
- * @default 'standard'
533
- * @memberof module:TYPE
534
- */
535
- readonly AUDIO_PROFILE_STANDARD: 'standard';
536
- /**
537
- * Standard stereo audio quality
538
- * | Audio Profile | Sampling Rate | Channel | Bitrate (kbps) |
539
- * | :--- | :--- | :--- | :--- |
540
- * | TRTC.TYPE.AUDIO_PROFILE_STANDARD | 48000 | Mono| 40 |
541
- * | TRTC.TYPE.AUDIO_PROFILE_HIGH | 48000 | Mono| 128 |
542
- * | TRTC.TYPE.AUDIO_PROFILE_STANDARD_STEREO | 48000 | Stereo| 64 |
543
- * | TRTC.TYPE.AUDIO_PROFILE_HIGH_STEREO | 48000 | Stereo| 192 |
544
- * @default 'standard-stereo'
545
- * @memberof module:TYPE
546
- */
547
- readonly AUDIO_PROFILE_STANDARD_STEREO: 'standard-stereo';
548
- /**
549
- * High audio quality
550
- * | Audio Profile | Sampling Rate | Channel | Bitrate (kbps) |
551
- * | :--- | :--- | :--- | :--- |
552
- * | TRTC.TYPE.AUDIO_PROFILE_STANDARD | 48000 | Mono| 40 |
553
- * | TRTC.TYPE.AUDIO_PROFILE_HIGH | 48000 | Mono| 128 |
554
- * | TRTC.TYPE.AUDIO_PROFILE_STANDARD_STEREO | 48000 | Stereo| 64 |
555
- * | TRTC.TYPE.AUDIO_PROFILE_HIGH_STEREO | 48000 | Stereo| 192 |
556
- * @default 'high'
557
- * @memberof module:TYPE
558
- */
559
- readonly AUDIO_PROFILE_HIGH: 'high';
560
- /**
561
- * High-quality stereo audio
562
- * | Audio Profile | Sampling Rate | Channel | Bitrate (kbps) |
563
- * | :--- | :--- | :--- | :--- |
564
- * | TRTC.TYPE.AUDIO_PROFILE_STANDARD | 48000 | Mono| 40 |
565
- * | TRTC.TYPE.AUDIO_PROFILE_HIGH | 48000 | Mono| 128 |
566
- * | TRTC.TYPE.AUDIO_PROFILE_STANDARD_STEREO | 48000 | Stereo| 64 |
567
- * | TRTC.TYPE.AUDIO_PROFILE_HIGH_STEREO | 48000 | Stereo| 192 |
568
- * @default 'high-stereo'
474
+ /**
475
+ * Live streaming scene
476
+ * @default 'live'
477
+ * @memberof module:TYPE
478
+ */
479
+ readonly SCENE_LIVE: Scene.LIVE;
480
+ /**
481
+ * RTC scene
482
+ * @default 'rtc'
483
+ * @memberof module:TYPE
484
+ */
485
+ readonly SCENE_RTC: Scene.RTC;
486
+ /**
487
+ * Anchor role
488
+ * @default 'anchor'
489
+ * @memberof module:TYPE
490
+ */
491
+ readonly ROLE_ANCHOR: UserRole.ANCHOR;
492
+ /**
493
+ * Audience role
494
+ * @default 'audience'
495
+ * @memberof module:TYPE
496
+ */
497
+ readonly ROLE_AUDIENCE: UserRole.AUDIENCE;
498
+ /**
499
+ * Main stream
500
+ *
501
+ * - TRTC has a main video stream (main stream) and an sub video stream (sub stream)
502
+ * - The camera is published through the main stream, and the screen sharing is published through the sub stream.
503
+ * - The main video stream includes: high-definition large picture and low-definition small picture. By default, {@link TRTC#startRemoteVideo TRTC.startRemoteVideo} plays the high-definition large picture, and the low-definition small picture can be played through the small parameter. Refer to: [Enable small stream function](./tutorial-27-advanced-small-stream.html).
504
+ * @default 'main'
505
+ * @memberof module:TYPE
506
+ */
507
+ readonly STREAM_TYPE_MAIN: TRTCStreamType.Main;
508
+ /**
509
+ * Sub stream
510
+ * @default 'sub'
511
+ * @memberof module:TYPE
512
+ */
513
+ readonly STREAM_TYPE_SUB: TRTCStreamType.Sub;
514
+ /**
515
+ * Standard audio quality
516
+ * | Audio Profile | Sampling Rate | Channel | Bitrate (kbps) |
517
+ * | :--- | :--- | :--- | :--- |
518
+ * | TRTC.TYPE.AUDIO_PROFILE_STANDARD | 48000 | Mono| 40 |
519
+ * | TRTC.TYPE.AUDIO_PROFILE_HIGH | 48000 | Mono| 128 |
520
+ * | TRTC.TYPE.AUDIO_PROFILE_STANDARD_STEREO | 48000 | Stereo| 64 |
521
+ * | TRTC.TYPE.AUDIO_PROFILE_HIGH_STEREO | 48000 | Stereo| 192 |
522
+ * @default 'standard'
523
+ * @memberof module:TYPE
524
+ */
525
+ readonly AUDIO_PROFILE_STANDARD: 'standard';
526
+ /**
527
+ * Standard stereo audio quality
528
+ * | Audio Profile | Sampling Rate | Channel | Bitrate (kbps) |
529
+ * | :--- | :--- | :--- | :--- |
530
+ * | TRTC.TYPE.AUDIO_PROFILE_STANDARD | 48000 | Mono| 40 |
531
+ * | TRTC.TYPE.AUDIO_PROFILE_HIGH | 48000 | Mono| 128 |
532
+ * | TRTC.TYPE.AUDIO_PROFILE_STANDARD_STEREO | 48000 | Stereo| 64 |
533
+ * | TRTC.TYPE.AUDIO_PROFILE_HIGH_STEREO | 48000 | Stereo| 192 |
534
+ * @default 'standard-stereo'
535
+ * @memberof module:TYPE
536
+ */
537
+ readonly AUDIO_PROFILE_STANDARD_STEREO: 'standard-stereo';
538
+ /**
539
+ * High audio quality
540
+ * | Audio Profile | Sampling Rate | Channel | Bitrate (kbps) |
541
+ * | :--- | :--- | :--- | :--- |
542
+ * | TRTC.TYPE.AUDIO_PROFILE_STANDARD | 48000 | Mono| 40 |
543
+ * | TRTC.TYPE.AUDIO_PROFILE_HIGH | 48000 | Mono| 128 |
544
+ * | TRTC.TYPE.AUDIO_PROFILE_STANDARD_STEREO | 48000 | Stereo| 64 |
545
+ * | TRTC.TYPE.AUDIO_PROFILE_HIGH_STEREO | 48000 | Stereo| 192 |
546
+ * @default 'high'
547
+ * @memberof module:TYPE
548
+ */
549
+ readonly AUDIO_PROFILE_HIGH: 'high';
550
+ /**
551
+ * High-quality stereo audio
552
+ * | Audio Profile | Sampling Rate | Channel | Bitrate (kbps) |
553
+ * | :--- | :--- | :--- | :--- |
554
+ * | TRTC.TYPE.AUDIO_PROFILE_STANDARD | 48000 | Mono| 40 |
555
+ * | TRTC.TYPE.AUDIO_PROFILE_HIGH | 48000 | Mono| 128 |
556
+ * | TRTC.TYPE.AUDIO_PROFILE_STANDARD_STEREO | 48000 | Stereo| 64 |
557
+ * | TRTC.TYPE.AUDIO_PROFILE_HIGH_STEREO | 48000 | Stereo| 192 |
558
+ * @default 'high-stereo'
569
559
 
570
- * @memberof module:TYPE
571
- */
572
- readonly AUDIO_PROFILE_HIGH_STEREO: 'high-stereo';
573
- /**
574
- * When the network is weak, the video encoding strategy takes 'smooth' first, i.e., the priority is to preserve frame rate.
575
- * <br>
576
- * Default 'smooth' first for camera, 'default' clear first for screen sharing
577
- * @default 'smooth'
578
- * @memberof module:TYPE
579
- */
580
- readonly QOS_PREFERENCE_SMOOTH: 'smooth';
581
- /**
582
- * When the network is weak, the video encoding strategy takes 'clear' first, i.e., the priority is to preserve resolution.
583
- * <br>
584
- * Default 'smooth' first for camera, 'default' clear first for screen sharing
585
- * @default 'clear'
586
- * @memberof module:TYPE
587
- */
588
- readonly QOS_PREFERENCE_CLEAR: 'clear';
589
- /**
560
+ * @memberof module:TYPE
561
+ */
562
+ readonly AUDIO_PROFILE_HIGH_STEREO: 'high-stereo';
563
+ /**
564
+ * When the network is weak, the video encoding strategy takes 'smooth' first, i.e., the priority is to preserve frame rate.
565
+ * <br>
566
+ * Default 'smooth' first for camera, 'default' clear first for screen sharing
567
+ * @default 'smooth'
568
+ * @memberof module:TYPE
569
+ */
570
+ readonly QOS_PREFERENCE_SMOOTH: 'smooth';
571
+ /**
572
+ * When the network is weak, the video encoding strategy takes 'clear' first, i.e., the priority is to preserve resolution.
573
+ * <br>
574
+ * Default 'smooth' first for camera, 'default' clear first for screen sharing
575
+ * @default 'clear'
576
+ * @memberof module:TYPE
577
+ */
578
+ readonly QOS_PREFERENCE_CLEAR: 'clear';
579
+ /**
590
580
  * Audio output device types in Android. Specify this device when capture microphone, and the sound will come out of the speaker.
591
581
  */
592
582
  readonly SPEAKER: 'Speakerphone',
593
583
  /**
594
584
  * Audio output device types in Android. Specify this device when capture microphone, and the sound will come out of the headset.
595
585
  */
596
- readonly HEADSET: 'Headset earpiece';
586
+ readonly HEADSET: 'Headset earpiece'
597
587
  };
598
588
  export declare interface AudioMixerOptions {
599
- id: string;
600
- url: string;
601
- loop?: boolean;
602
- volume?: number;
589
+ id: string;
590
+ url: string;
591
+ loop?: boolean;
592
+ volume?: number;
603
593
  }
604
594
  export declare interface UpdateAudioMixerOptions {
605
- id: string;
606
- loop?: boolean;
607
- volume?: number;
608
- seekFrom?: number;
609
- operation?: 'pause' | 'resume' | 'stop';
595
+ id: string;
596
+ loop?: boolean;
597
+ volume?: number;
598
+ seekFrom?: number;
599
+ operation?: 'pause' | 'resume' | 'stop';
610
600
  }
611
601
  export declare interface StopAudioMixerOptions {
612
- id: string;
602
+ id: string;
613
603
  }
614
604
  export declare interface AIDenoiserOptions {
615
- assetsPath: string;
616
- sdkAppId: number;
617
- userId: string;
618
- userSig: string;
605
+ assetsPath: string;
606
+ sdkAppId: number;
607
+ userId: string;
608
+ userSig: string;
619
609
  }
620
610
 
621
611
  export declare interface TRTCStatistics {
622
- rtt: number;
623
- downLoss: number;
624
- upLoss: number;
625
- bytesSent: number;
626
- bytesReceived: number;
627
- localStatistics: LocalStatistic;
628
- remoteStatistics: RemoteStatistic[];
612
+ rtt: number;
613
+ downLoss: number;
614
+ upLoss: number;
615
+ bytesSent: number;
616
+ bytesReceived: number;
617
+ localStatistics: LocalStatistic;
618
+ remoteStatistics: RemoteStatistic[];
629
619
  }
630
620
  export declare interface LocalStatistic {
631
- audio: {
632
- bitrate: number;
633
- audioLevel: number;
634
- };
635
- video: {
636
- width: number;
637
- height: number;
638
- frameRate: number;
639
- bitrate: number;
640
- videoType: TRTCVideoType;
641
- }[];
621
+ audio: {
622
+ bitrate: number;
623
+ audioLevel: number;
624
+ };
625
+ video: {
626
+ width: number;
627
+ height: number;
628
+ frameRate: number;
629
+ bitrate: number;
630
+ videoType: TRTCVideoType;
631
+ }[];
642
632
  }
643
633
  export declare enum TRTCVideoType {
644
- Big = 'big',
645
- Small = 'small',
646
- Sub = 'sub'
634
+ Big = 'big',
635
+ Small = 'small',
636
+ Sub = 'sub'
647
637
  }
648
638
  export declare interface RemoteStatistic {
649
- audio: {
650
- bitrate: number;
651
- audioLevel: number;
652
- };
653
- video: {
654
- width: number;
655
- height: number;
656
- frameRate: number;
657
- bitrate: number;
658
- videoType: TRTCVideoType;
659
- }[];
660
- userId: string;
639
+ audio: {
640
+ bitrate: number;
641
+ audioLevel: number;
642
+ };
643
+ video: {
644
+ width: number;
645
+ height: number;
646
+ frameRate: number;
647
+ bitrate: number;
648
+ videoType: TRTCVideoType;
649
+ }[];
650
+ userId: string;
661
651
  }
662
652
  export declare interface VideoFrameConfig {
663
- userId?: string;
664
- streamType?: TRTCStreamType;
653
+ userId?: string;
654
+ streamType?: TRTCStreamType;
665
655
  }
666
656
  export declare enum AutoStartPluginName {
667
- Debug = 'Debug'
657
+ Debug = 'Debug'
668
658
  }
669
659
 
670
660
  /**
@@ -716,407 +706,393 @@ export declare enum AutoStartPluginName {
716
706
  * trtc.on(TRTC.EVENT.ERROR, () => {});
717
707
  */
718
708
  export declare const TRTCEvent: {
719
- /**
720
- * Error event, non-API call error, SDK throws when an unrecoverable error occurs during operation.
721
- *
722
- * - Error code (error.code): {@link module:ERROR_CODE.OPERATION_FAILED ErrorCode.OPERATION_FAILED}
723
- * - Possible extended error codes (error.extraCode): 5501, 5502
724
- * @default 'error'
725
- * @memberof module:EVENT
726
- * @see {@link RtcError RtcError}
727
- * @e
728
- * @example
729
- *
730
- * trtc.on(TRTC.EVENT.ERROR, error => {
731
- * console.error('trtc error observed: ' + error);
732
- * const errorCode = error.code;
733
- * const extraCode = error.extraCode;
734
- * });
735
- */
736
- readonly ERROR: 'error';
737
- /**
738
- * @description Automatic playback failed, refer to {@tutorial 21-advanced-auto-play-policy}
739
- * @default 'autoplay-failed'
740
- * @memberof module:EVENT
741
- * @example
742
- * trtc.on(TRTC.EVENT.AUTOPLAY_FAILED, event => {
743
- * // Guide user to click the page, SDK will resume playback automatically when user click the page.
744
- * // Since v5.1.3+, you can get userId on this event.
745
- * console.log(event.userId);
746
- * // Since v5.9.0+, you can call the `resume` method to restore playback of the stream corresponding to event.userId.
747
- * event.resume();
748
- * });
749
- */
750
- readonly AUTOPLAY_FAILED: 'autoplay-failed';
751
- /**
752
- * @description Kicked out of the room for some reason, including:<br>
753
- * - kick: The same user with same userId enters same room. The user who enters the room first will be kicked out of the room by the user who enters later.
754
- * - Entering a room with the same userId is not allowed behavior, which may lead to abnormal audio/video calls between the two parties, and should be avoided on the business side.
755
- * - Users with the same userId who enter the same room with the same audience role may not receive this event.
756
- * - banned: kicked out by the administrator using [Server API - RemoveUser](https://trtc.io/document/34267/34268).
757
- * - room_disband: kicked out by the administrator using [Server API - DismissRoom](https://trtc.io/document/34267/34269).
758
- * @default 'kicked-out'
759
- * @memberof module:EVENT
760
- * @example
761
- *
762
- * trtc.on(TRTC.EVENT.KICKED_OUT, event => {
763
- * console.log(event.reason)
764
- * });
765
- */
766
- readonly KICKED_OUT: 'kicked-out';
767
- /**
768
- * Remote user enters the room event.
769
- *
770
- * - In `rtc` mode, all users will receive the notification of entering and exiting the room of the other user.
771
- * - In `live` mode, only the anchor has the notification of entering and exiting the room, and the audience does not have the notification of entering and exiting the room. The audience can receive the notification of entering and exiting the room of the anchor.
772
- * @default 'remote-user-enter'
773
- * @memberof module:EVENT
774
- * @example
775
- *
776
- * trtc.on(TRTC.EVENT.REMOTE_USER_ENTER, event => {
777
- * const userId = event.userId;
778
- * });
779
- */
780
- readonly REMOTE_USER_ENTER: 'remote-user-enter';
781
- /**
782
- * Remote user exits the room event.
783
- *
784
- * - In `rtc` mode, all users will receive the notification of entering and exiting the room of the other user.
785
- * - In `live` mode, only the anchor has the notification of entering and exiting the room, and the audience does not have the notification of entering and exiting the room. The audience can receive the notification of entering and exiting the room of the anchor.
786
- * @default 'remote-user-exit'
787
- * @memberof module:EVENT
788
- * @example
789
- *
790
- * trtc.on(TRTC.EVENT.REMOTE_USER_EXIT, event => {
791
- * const userId = event.userId;
792
- * });
793
- */
794
- readonly REMOTE_USER_EXIT: 'remote-user-exit';
795
- /**
796
- * Remote user publishes audio. You will receive this notification when the remote user turns on the microphone. Refer to: [Turn on/off camera and microphone](./tutorial-15-basic-dynamic-add-video.html)
797
- *
798
- * - By default, the SDK automatically plays remote audio, and you do not need to call the API to play remote audio. You can listen for this event and {@link module:EVENT.REMOTE_AUDIO_UNAVAILABLE REMOTE_AUDIO_UNAVAILABLE} to update the UI icon for "whether the remote microphone is turned on".
799
- * - Note: If the user has not interacted with the page before entering the room, automatic audio playback may fail due to the [browser's automatic playback policy restrictions](./tutorial-21-advanced-auto-play-policy.html). You need to refer to the [suggestions for handling automatic playback restrictions](./tutorial-21-advanced-auto-play-policy.html) for processing.
800
- * - If you do not want the SDK to automatically play audio, you can set `autoReceiveAudio` to `false` to turn off automatic audio playback when calling {@link TRTC#enterRoom trtc.enterRoom()}.
801
- * - Listen for the {@link module:EVENT.REMOTE_AUDIO_AVAILABLE TRTC.EVENT.REMOTE_AUDIO_AVAILABLE} event, record the userId with remote audio, and call the {@link TRTC#muteRemoteAudio trtc.muteRemoteAudio(userId, false)} method when you need to play audio.
802
- * @default 'remote-audio-available'
803
- * @memberof module:EVENT
804
- * @example
805
- * // Listen before entering the room
806
- * trtc.on(TRTC.EVENT.REMOTE_AUDIO_AVAILABLE, event => {
807
- * const userId = event.userId;
808
- * });
809
- */
810
- readonly REMOTE_AUDIO_AVAILABLE: 'remote-audio-available';
811
- /**
812
- * Remote user stops publishing audio. You will receive this notification when the remote user turns off the microphone.
813
- *
814
- * @default 'remote-audio-unavailable'
815
- * @memberof module:EVENT
816
- * @example
817
- * // Listen before entering the room
818
- * trtc.on(TRTC.EVENT.REMOTE_AUDIO_UNAVAILABLE, event => {
819
- * const userId = event.userId;
820
- *
821
- * });
822
- */
823
- readonly REMOTE_AUDIO_UNAVAILABLE: 'remote-audio-unavailable';
824
- /**
825
- * Remote user publishes video. You will receive this notification when the remote user turns on the camera. Refer to: [Turn on/off camera and microphone](./tutorial-15-basic-dynamic-add-video.html)
826
- *
827
- * - You can listen for this event and {@link module:EVENT.REMOTE_VIDEO_UNAVAILABLE REMOTE_VIDEO_UNAVAILABLE} to update the UI icon for "whether the remote camera is turned on".
828
- * @see {@link module:TYPE.STREAM_TYPE_MAIN STREAM_TYPE_MAIN}
829
- * @see {@link module:TYPE.STREAM_TYPE_SUB STREAM_TYPE_SUB}
830
- * @default 'remote-video-available'
831
- * @memberof module:EVENT
832
- * @example
833
- * // Listen before entering the room
834
- * trtc.on(TRTC.EVENT.REMOTE_VIDEO_AVAILABLE, event => {
835
- * const userId = event.userId;
836
- * const streamType = event.streamType;
837
- * trtc.startRemoteVideo({userId, streamType, view});
838
- * });
839
- */
840
- readonly REMOTE_VIDEO_AVAILABLE: 'remote-video-available';
841
- /**
842
- * Remote user stops publishing video. You will receive this notification when the remote user turns off the camera.
843
- * @default 'remote-video-unavailable'
844
- * @memberof module:EVENT
845
- * @example
846
- * // Listen before entering the room
847
- * trtc.on(TRTC.EVENT.REMOTE_VIDEO_UNAVAILABLE, event => {
848
- * const userId = event.userId;
849
- * const streamType = event.streamType;
850
- * // At this point, the SDK will automatically stop playing, and there is no need to call stopRemoteVideo.
851
- * });
852
- */
853
- readonly REMOTE_VIDEO_UNAVAILABLE: 'remote-video-unavailable';
854
- /**
855
- * @description Volume event<br>
856
- * After calling the {@link TRTC#enableAudioVolumeEvaluation enableAudioVolumeEvaluation} interface to enable the volume callback, the SDK will throw this event regularly to notify the volume of each userId.<br>
857
- * **Note**
858
- * - The callback contains the volume of the local microphone and the volume of the remote user. The callback will be triggered regardless of whether anyone is speaking.
859
- * - The event.result will be sorted from large to small according to the volume size.
860
- * - When userId is an empty string, it represents the volume of the local microphone.
861
- * - volume is a positive integer with a value of 0-100.
862
- * @default 'audio-volume'
863
- * @memberof module:EVENT
864
- * @example
865
- * trtc.on(TRTC.EVENT.AUDIO_VOLUME, event => {
866
- * event.result.forEach(({ userId, volume }) => {
867
- * const isMe = userId === ''; // When userId is an empty string, it represents the volume of the local microphone.
868
- * if (isMe) {
869
- * console.log(`my volume: ${volume}`);
870
- * } else {
871
- * console.log(`user: ${userId} volume: ${volume}`);
872
- * }
873
- * })
874
- * });
875
- *
876
- * // Enable volume callback and trigger the event every 1000ms
877
- * trtc.enableAudioVolumeEvaluation(1000);
878
- */
879
- readonly AUDIO_VOLUME: 'audio-volume';
880
- /**
881
- * @since v5.8.3
882
- * @description Microphone pcm event, the pcm data can be used to do ASR.<br>
883
- * **Note**
884
- * - When start listen this event, will get 40ms pcm(float32) from microphone every time.
885
- * @default 'audio-frame'
886
- * @memberof module:EVENT
887
- * @example
888
- * trtc.on(TRTC.EVENT.AUDIO_FRAME, event => {
889
- * console.log(event.data)
890
- * });
891
- *
892
- */
893
- readonly AUDIO_FRAME: 'audio-frame';
894
- /**
895
- * @description Network quality statistics data event, which starts to be counted after entering the room and triggers every two seconds. This data reflects the network quality of your local uplink and downlink.
896
- * - The uplink network quality (uplinkNetworkQuality) refers to the network situation of uploading local streams (uplink connection network quality from SDK to Tencent Cloud)
897
- * - The downlink network quality (downlinkNetworkQuality) refers to the average network situation of downloading all streams (average network quality of all downlink connections from Tencent Cloud to SDK)
898
- *
899
- * The enumeration values and meanings are shown in the following table:
900
- * | Value | Meaning |
901
- * | :--- | :---- |
902
- * | 0 | Network state is unknown, indicating that the current trtc instance has not established an uplink/downlink connection |
903
- * | 1 | Network state is excellent |
904
- * | 2 | Network state is good |
905
- * | 3 | Network state is average |
906
- * | 4 | Network state is poor |
907
- * | 5 | Network state is very poor |
908
- * | 6 | Network connection is disconnected<br/>Note: If the downlink network quality is this value, it means that all downlink connections have been disconnected |
909
- * - uplinkRTT, uplinkLoss are the uplink RTT (ms) and uplink packet loss rate.
910
- * - downlinkRTT, downlinkLoss are the average RTT (ms) and average packet loss rate of all downlink connections.
911
- *
912
- * **Note**
913
- * - If you want to know the uplink and downlink network conditions of the other party, you need to broadcast the other party's network quality through IM.
914
- *
915
- * @default 'network-quality'
916
- * @memberof module:EVENT
917
- * @example
918
- * trtc.on(TRTC.EVENT.NETWORK_QUALITY, event => {
919
- * console.log(`network-quality, uplinkNetworkQuality:${event.uplinkNetworkQuality}, downlinkNetworkQuality: ${event.downlinkNetworkQuality}`)
920
- * console.log(`uplink rtt:${event.uplinkRTT} loss:${event.uplinkLoss}`)
921
- * console.log(`downlink rtt:${event.downlinkRTT} loss:${event.downlinkLoss}`)
922
- * })
923
- */
924
- readonly NETWORK_QUALITY: 'network-quality';
925
- /**
926
- * @description SDK and Tencent Cloud connection state change event, you can use this event to listen to the overall connection state of the SDK and Tencent Cloud.<br>
927
- * - 'DISCONNECTED': Connection disconnected
928
- * - 'CONNECTING': Connecting
929
- * - 'CONNECTED': Connected
930
- *
931
- * Meanings of different state changes:
932
- *
933
- * - DISCONNECTED -> CONNECTING: Trying to establish a connection, triggered when calling the enter room interface or when the SDK automatically reconnects.
934
- * - CONNECTING -> DISCONNECTED: Connection establishment failed, triggered when calling the exit room interface to interrupt the connection or when the connection fails after SDK retries.
935
- * - CONNECTING -> CONNECTED: Connection established successfully, triggered when the connection is successful.
936
- * - CONNECTED -> DISCONNECTED: Connection interrupted, triggered when calling the exit room interface or when the connection is disconnected due to network anomalies.
937
- *
938
- * Suggestion: You can listen to this event and display different UIs in different states to remind users of the current connection state.
939
- *
940
- * @default 'connection-state-changed'
941
- * @memberof module:EVENT
942
- * @example
943
- * trtc.on(TRTC.EVENT.CONNECTION_STATE_CHANGED, event => {
944
- * const prevState = event.prevState;
945
- * const curState = event.state;
946
- * });
947
- */
948
- readonly CONNECTION_STATE_CHANGED: 'connection-state-changed';
949
- /**
950
- * @description Audio playback state change event
951
- *
952
- * event.userId When userId is an empty string, it represents the local user, and when it is a non-empty string, it represents a remote user.
953
- *
954
- * event.state The value is as follows:
955
- * - 'PLAYING': start playing
956
- * - event.reason is 'playing' or 'unmute'.
957
- * - 'PAUSED': pause playback
958
- * - When event.reason is 'pause', it is triggered by the pause event of the \<audio\> element. The following situations will trigger:
959
- * - Call the HTMLMediaElement.pause interface.
960
- * - When event.reason is 'mute'. See event {@link https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack/mute_event | MediaStreamTrack.mute_event}
961
- * - When userId is oneself, this event is triggered, indicating that audio collection is paused, usually caused by device abnormalities, such as being preempted by other applications on the device, at this time, the user needs to be guided to recollect.
962
- * - When userId is others, this event is triggered, indicating that the received audio data is not enough to play. Usually caused by network jitter, no processing is required on the access side. When the received data is sufficient to play, it will automatically resume.
963
- * - 'STOPPED': stop playing
964
- * - event.reason is 'ended'.
965
- *
966
- * event.reason The reason for the state change, the value is as follows:
967
- * - 'playing': start playing, see event {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/playing_event | HTMLMediaElement.playing_event}
968
- * - 'mute': The audio track cannot provide data temporarily, see event {@link https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack/mute_event | MediaStreamTrack.mute_event}
969
- * - 'unmute': The audio track resumes providing data, see event {@link https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack/unmute_event | MediaStreamTrack.unmute_event}
970
- * - 'ended': The audio track has been closed
971
- * - 'pause': Playback paused
972
- * @default 'audio-play-state-changed'
973
- * @memberof module:EVENT
974
- * @example
975
- * trtc.on(TRTC.EVENT.AUDIO_PLAY_STATE_CHANGED, event => {
976
- * console.log(`${event.userId} player is ${event.state} because of ${event.reason}`);
977
- * });
978
- */
979
- readonly AUDIO_PLAY_STATE_CHANGED: 'audio-play-state-changed';
980
- /**
981
- * @description Video playback state change event
982
- *
983
- * event.userId When userId is an empty string, it represents the local user, and when it is a non-empty string, it represents a remote user.
984
- *
985
- * event.streamType Stream type, value: {@link module:TYPE.STREAM_TYPE_MAIN TRTC.TYPE.STREAM_TYPE_MAIN} {@link module:TYPE.STREAM_TYPE_SUB TRTC.TYPE.STREAM_TYPE_SUB}
986
- *
987
- * event.state The value is as follows:
988
- * - 'PLAYING': start playing
989
- * - event.reason is 'playing' or 'unmute'.
990
- * - 'PAUSED': pause playback
991
- * - When event.reason is 'pause', it is triggered by the pause event of the \<video\> element. The following situations will trigger:
992
- * - Call the HTMLMediaElement.pause interface.
993
- * - After successful playback, the view container for playing the video is removed from the DOM.
994
- * - When event.reason is 'mute'. See event {@link https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack/mute_event | MediaStreamTrack.mute_event}
995
- * - When userId is oneself, this event is triggered, indicating that video collection is paused, usually caused by device abnormalities, such as being preempted by other applications on the device, at this time, the user needs to be guided to recollect.
996
- * - When userId is others, this event is triggered, indicating that the received video data is not enough to play. Usually caused by network jitter, no processing is required on the access side. When the received data is sufficient to play, it will automatically resume.
997
- * - 'STOPPED': stop playing
998
- * - event.reason is 'ended'.
999
- *
1000
- * event.reason The reason for the state change, the value is as follows:
1001
- * - 'playing': start playing, see event {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/playing_event | HTMLMediaElement.playing_event}
1002
- * - 'mute': The video track cannot provide data temporarily, see event {@link https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack/mute_event | MediaStreamTrack.mute_event}
1003
- * - 'unmute': The video track resumes providing data, see event {@link https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack/unmute_event | MediaStreamTrack.unmute_event}
1004
- * - 'ended': The video track has been closed
1005
- * - 'pause': Playback paused
1006
- * @default 'video-play-state-changed'
1007
- * @memberof module:EVENT
1008
- * @example
1009
- * trtc.on(TRTC.EVENT.VIDEO_PLAY_STATE_CHANGED, event => {
1010
- * console.log(`${event.userId} ${event.streamType} video player is ${event.state} because of ${event.reason}`);
1011
- * });
1012
- */
1013
- readonly VIDEO_PLAY_STATE_CHANGED: 'video-play-state-changed';
1014
- /**
1015
- * @description Notification event for local screen sharing stop, only valid for local screen sharing streams.
1016
- * @default 'screen-share-stopped'
1017
- * @memberof module:EVENT
1018
- * @example
1019
- * trtc.on(TRTC.EVENT.SCREEN_SHARE_STOPPED, () => {
1020
- * console.log('screen sharing was stopped');
1021
- * });
1022
- */
1023
- readonly SCREEN_SHARE_STOPPED: 'screen-share-stopped';
1024
- /**
1025
- * @description Notification event for device changes such as camera and microphone.
1026
- * - event.device is a [MediaDeviceInfo](https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo) object with properties:
1027
- * - deviceId: device ID
1028
- * - label: device description information
1029
- * - groupId: device group ID
1030
- * - event.type value: `'camera'|'microphone'|'speaker'`
1031
- * - event.action value:
1032
- * - 'add' device has been added.
1033
- * - 'remove' device has been removed.
1034
- * - 'active' device has been activated, for example: after startLocalVideo is successful, this event will be triggered.
1035
- * @default 'device-changed'
1036
- * @memberof module:EVENT
1037
- * @example
1038
- * trtc.on(TRTC.EVENT.DEVICE_CHANGED, (event) => {
1039
- * console.log(`${event.type}(${event.device.label}) ${event.action}`);
1040
- * });
1041
- */
1042
- readonly DEVICE_CHANGED: 'device-changed';
1043
- /**
1044
- * @description Publish state change event.
1045
- * - event.mediaType media type, value: `'audio'|'video'|'screen'`.
1046
- * - event.state current publish state, value:
1047
- * - `'starting'` trying to publish stream
1048
- * - `'started'` publish stream succeeded
1049
- * - `'stopped'` publish stream stopped, see event.reason field for the reason
1050
- * - event.prevState the publish state at the last event trigger, with the same type as event.state.
1051
- * - event.reason the reason for the publish state to become `'stopped'`, value:
1052
- * - `'timeout'` publish stream timeout, usually caused by network jitter or firewall interception. The SDK will keep retrying, and the business side can guide the user to check the network or change the network at this time.
1053
- * - `'error'` publish stream error, at this time, you can get the specific error information from event.error, usually caused by the browser not supporting H264 encoding.
1054
- * - `'api-call'` publish stream stopped due to business side API call, for example, stopLocalVideo was called to stop the publish stream before startLocalVideo was successful, which is a normal behavior and the business side does not need to pay attention to it.
1055
- * - event.error error information when event.reason is `'error'`.
1056
- * @default 'publish-state-changed'
1057
- * @memberof module:EVENT
1058
- * @example
1059
- * trtc.on(TRTC.EVENT.PUBLISH_STATE_CHANGED, (event) => {
1060
- * console.log(`${event.mediaType} ${event.state} ${event.reason}`);
1061
- * });
1062
- */
1063
- readonly PUBLISH_STATE_CHANGED: 'publish-state-changed';
1064
- /**
1065
- * @since v5.3.0
1066
- * @description a new MediaStreamTrack object received.
1067
- * @default 'track'
1068
- * @memberof module:EVENT
1069
- * @example
1070
- * trtc.on(TRTC.EVENT.TRACK, event => {
1071
- * // userId === '' means event.track is a local track, otherwise it's a remote track
1072
- * const isLocal = event.userId === '';
1073
- * // Usually the sub stream is a screen-sharing video stream.
1074
- * const isSubStream = event.streamType === TRTC.TYPE.STREAM_TYPE_SUB;
1075
- * const mediaStreamTrack = event.track;
1076
- * const kind = event.track.kind; // audio or video
1077
- * })
1078
- */
1079
- readonly TRACK: 'track';
1080
- /**
1081
- * @description TRTC statistics.<br>
1082
- *
1083
- * - SDK will fires this event once every 2s.
1084
- * - You can get the network quality, statistics of audio and video from this event. For detailed parameter description, please refer to {@link TRTCStatistics}.
1085
- * @default 'statistics'
1086
- * @since v5.2.0
1087
- * @memberof module:EVENT
1088
- * @example
1089
- * trtc.on(TRTC.EVENT.STATISTICS, statistics => {
1090
- * console.warn(statistics.rtt, statistics.upLoss, statistics.downLoss);
1091
- * })
1092
- */
1093
- readonly STATISTICS: 'statistics';
1094
- /**
1095
- * @since v5.3.0
1096
- * @description SEI message received<br>
1097
- * @default 'sei-message'
1098
- * @memberof module:EVENT
1099
- * @example
1100
- * trtc.on(TRTC.EVENT.SEI_MESSAGE, event => {
1101
- * console.log(`received sei message from ${event.userId}, data: ${event.data}, streamType: ${event.streamType}`)
1102
- * })
1103
- */
1104
- readonly SEI_MESSAGE: 'sei-message';
1105
- /**
1106
- * @since v5.6.0
1107
- * @description received a new custom message.
1108
- * @default 'custom-message'
1109
- * @memberof module:EVENT
1110
- * @example
1111
- * trtc.on(TRTC.EVENT.CUSTOM_MESSAGE, event => {
1112
- * // event.userId: remote userId.
1113
- * // event.cmdId: message cmdId.
1114
- * // event.seq: message sequence number.
1115
- * // event.data: custom message data, type is ArrayBuffer.
1116
- * })
1117
- */
1118
- readonly CUSTOM_MESSAGE: 'custom-message';
1119
- /**
709
+ /**
710
+ * Error event, non-API call error, SDK throws when an unrecoverable error occurs during operation.
711
+ *
712
+ * - Error code (error.code): {@link module:ERROR_CODE.OPERATION_FAILED ErrorCode.OPERATION_FAILED}
713
+ * - Possible extended error codes (error.extraCode): 5501, 5502
714
+ * @default 'error'
715
+ * @memberof module:EVENT
716
+ * @see {@link RtcError RtcError}
717
+ * @e
718
+ * @example
719
+ *
720
+ * trtc.on(TRTC.EVENT.ERROR, error => {
721
+ * console.error('trtc error observed: ' + error);
722
+ * const errorCode = error.code;
723
+ * const extraCode = error.extraCode;
724
+ * });
725
+ */
726
+ readonly ERROR: 'error';
727
+ /**
728
+ * @description Automatic playback failed, refer to {@tutorial 21-advanced-auto-play-policy}
729
+ * @default 'autoplay-failed'
730
+ * @memberof module:EVENT
731
+ * @example
732
+ * trtc.on(TRTC.EVENT.AUTOPLAY_FAILED, event => {
733
+ * // Guide user to click the page, SDK will resume playback automatically when user click the page.
734
+ * // Since v5.1.3+, you can get userId on this event.
735
+ * console.log(event.userId);
736
+ * // Since v5.9.0+, you can call the `resume` method to restore playback of the stream corresponding to event.userId.
737
+ * event.resume();
738
+ * });
739
+ */
740
+ readonly AUTOPLAY_FAILED: 'autoplay-failed';
741
+ /**
742
+ * @description Kicked out of the room for some reason, including:<br>
743
+ * - kick: The same user with same userId enters same room. The user who enters the room first will be kicked out of the room by the user who enters later.
744
+ * - Entering a room with the same userId is not allowed behavior, which may lead to abnormal audio/video calls between the two parties, and should be avoided on the business side.
745
+ * - Users with the same userId who enter the same room with the same audience role may not receive this event.
746
+ * - banned: kicked out by the administrator using [Server API - RemoveUser](https://trtc.io/document/34267/34268).
747
+ * - room_disband: kicked out by the administrator using [Server API - DismissRoom](https://trtc.io/document/34267/34269).
748
+ * @default 'kicked-out'
749
+ * @memberof module:EVENT
750
+ * @example
751
+ *
752
+ * trtc.on(TRTC.EVENT.KICKED_OUT, event => {
753
+ * console.log(event.reason)
754
+ * });
755
+ */
756
+ readonly KICKED_OUT: 'kicked-out';
757
+ /**
758
+ * Remote user enters the room event.
759
+ *
760
+ * - In `rtc` mode, all users will receive the notification of entering and exiting the room of the other user.
761
+ * - In `live` mode, only the anchor has the notification of entering and exiting the room, and the audience does not have the notification of entering and exiting the room. The audience can receive the notification of entering and exiting the room of the anchor.
762
+ * @default 'remote-user-enter'
763
+ * @memberof module:EVENT
764
+ * @example
765
+ *
766
+ * trtc.on(TRTC.EVENT.REMOTE_USER_ENTER, event => {
767
+ * const userId = event.userId;
768
+ * });
769
+ */
770
+ readonly REMOTE_USER_ENTER: 'remote-user-enter';
771
+ /**
772
+ * Remote user exits the room event.
773
+ *
774
+ * - In `rtc` mode, all users will receive the notification of entering and exiting the room of the other user.
775
+ * - In `live` mode, only the anchor has the notification of entering and exiting the room, and the audience does not have the notification of entering and exiting the room. The audience can receive the notification of entering and exiting the room of the anchor.
776
+ * @default 'remote-user-exit'
777
+ * @memberof module:EVENT
778
+ * @example
779
+ *
780
+ * trtc.on(TRTC.EVENT.REMOTE_USER_EXIT, event => {
781
+ * const userId = event.userId;
782
+ * });
783
+ */
784
+ readonly REMOTE_USER_EXIT: 'remote-user-exit';
785
+ /**
786
+ * Remote user publishes audio. You will receive this notification when the remote user turns on the microphone. Refer to: [Turn on/off camera and microphone](./tutorial-15-basic-dynamic-add-video.html)
787
+ *
788
+ * - By default, the SDK automatically plays remote audio, and you do not need to call the API to play remote audio. You can listen for this event and {@link module:EVENT.REMOTE_AUDIO_UNAVAILABLE REMOTE_AUDIO_UNAVAILABLE} to update the UI icon for "whether the remote microphone is turned on".
789
+ * - Note: If the user has not interacted with the page before entering the room, automatic audio playback may fail due to the [browser's automatic playback policy restrictions](./tutorial-21-advanced-auto-play-policy.html). You need to refer to the [suggestions for handling automatic playback restrictions](./tutorial-21-advanced-auto-play-policy.html) for processing.
790
+ * - If you do not want the SDK to automatically play audio, you can set `autoReceiveAudio` to `false` to turn off automatic audio playback when calling {@link TRTC#enterRoom trtc.enterRoom()}.
791
+ * - Listen for the {@link module:EVENT.REMOTE_AUDIO_AVAILABLE TRTC.EVENT.REMOTE_AUDIO_AVAILABLE} event, record the userId with remote audio, and call the {@link TRTC#muteRemoteAudio trtc.muteRemoteAudio(userId, false)} method when you need to play audio.
792
+ * @default 'remote-audio-available'
793
+ * @memberof module:EVENT
794
+ * @example
795
+ * // Listen before entering the room
796
+ * trtc.on(TRTC.EVENT.REMOTE_AUDIO_AVAILABLE, event => {
797
+ * const userId = event.userId;
798
+ * });
799
+ */
800
+ readonly REMOTE_AUDIO_AVAILABLE: 'remote-audio-available';
801
+ /**
802
+ * Remote user stops publishing audio. You will receive this notification when the remote user turns off the microphone.
803
+ *
804
+ * @default 'remote-audio-unavailable'
805
+ * @memberof module:EVENT
806
+ * @example
807
+ * // Listen before entering the room
808
+ * trtc.on(TRTC.EVENT.REMOTE_AUDIO_UNAVAILABLE, event => {
809
+ * const userId = event.userId;
810
+ *
811
+ * });
812
+ */
813
+ readonly REMOTE_AUDIO_UNAVAILABLE: 'remote-audio-unavailable';
814
+ /**
815
+ * Remote user publishes video. You will receive this notification when the remote user turns on the camera. Refer to: [Turn on/off camera and microphone](./tutorial-15-basic-dynamic-add-video.html)
816
+ *
817
+ * - You can listen for this event and {@link module:EVENT.REMOTE_VIDEO_UNAVAILABLE REMOTE_VIDEO_UNAVAILABLE} to update the UI icon for "whether the remote camera is turned on".
818
+ * @see {@link module:TYPE.STREAM_TYPE_MAIN STREAM_TYPE_MAIN}
819
+ * @see {@link module:TYPE.STREAM_TYPE_SUB STREAM_TYPE_SUB}
820
+ * @default 'remote-video-available'
821
+ * @memberof module:EVENT
822
+ * @example
823
+ * // Listen before entering the room
824
+ * trtc.on(TRTC.EVENT.REMOTE_VIDEO_AVAILABLE, event => {
825
+ * const userId = event.userId;
826
+ * const streamType = event.streamType;
827
+ * trtc.startRemoteVideo({userId, streamType, view});
828
+ * });
829
+ */
830
+ readonly REMOTE_VIDEO_AVAILABLE: 'remote-video-available';
831
+ /**
832
+ * Remote user stops publishing video. You will receive this notification when the remote user turns off the camera.
833
+ * @default 'remote-video-unavailable'
834
+ * @memberof module:EVENT
835
+ * @example
836
+ * // Listen before entering the room
837
+ * trtc.on(TRTC.EVENT.REMOTE_VIDEO_UNAVAILABLE, event => {
838
+ * const userId = event.userId;
839
+ * const streamType = event.streamType;
840
+ * // At this point, the SDK will automatically stop playing, and there is no need to call stopRemoteVideo.
841
+ * });
842
+ */
843
+ readonly REMOTE_VIDEO_UNAVAILABLE: 'remote-video-unavailable';
844
+ /**
845
+ * @description Volume event<br>
846
+ * After calling the {@link TRTC#enableAudioVolumeEvaluation enableAudioVolumeEvaluation} interface to enable the volume callback, the SDK will throw this event regularly to notify the volume of each userId.<br>
847
+ * **Note**
848
+ * - The callback contains the volume of the local microphone and the volume of the remote user. The callback will be triggered regardless of whether anyone is speaking.
849
+ * - The event.result will be sorted from large to small according to the volume size.
850
+ * - When userId is an empty string, it represents the volume of the local microphone.
851
+ * - volume is a positive integer with a value of 0-100.
852
+ * @default 'audio-volume'
853
+ * @memberof module:EVENT
854
+ * @example
855
+ * trtc.on(TRTC.EVENT.AUDIO_VOLUME, event => {
856
+ * event.result.forEach(({ userId, volume }) => {
857
+ * const isMe = userId === ''; // When userId is an empty string, it represents the volume of the local microphone.
858
+ * if (isMe) {
859
+ * console.log(`my volume: ${volume}`);
860
+ * } else {
861
+ * console.log(`user: ${userId} volume: ${volume}`);
862
+ * }
863
+ * })
864
+ * });
865
+ *
866
+ * // Enable volume callback and trigger the event every 1000ms
867
+ * trtc.enableAudioVolumeEvaluation(1000);
868
+ */
869
+ readonly AUDIO_VOLUME: 'audio-volume';
870
+ /**
871
+ * @description Network quality statistics data event, which starts to be counted after entering the room and triggers every two seconds. This data reflects the network quality of your local uplink and downlink.
872
+ * - The uplink network quality (uplinkNetworkQuality) refers to the network situation of uploading local streams (uplink connection network quality from SDK to Tencent Cloud)
873
+ * - The downlink network quality (downlinkNetworkQuality) refers to the average network situation of downloading all streams (average network quality of all downlink connections from Tencent Cloud to SDK)
874
+ *
875
+ * The enumeration values and meanings are shown in the following table:
876
+ * | Value | Meaning |
877
+ * | :--- | :---- |
878
+ * | 0 | Network state is unknown, indicating that the current trtc instance has not established an uplink/downlink connection |
879
+ * | 1 | Network state is excellent |
880
+ * | 2 | Network state is good |
881
+ * | 3 | Network state is average |
882
+ * | 4 | Network state is poor |
883
+ * | 5 | Network state is very poor |
884
+ * | 6 | Network connection is disconnected<br/>Note: If the downlink network quality is this value, it means that all downlink connections have been disconnected |
885
+ * - uplinkRTT, uplinkLoss are the uplink RTT (ms) and uplink packet loss rate.
886
+ * - downlinkRTT, downlinkLoss are the average RTT (ms) and average packet loss rate of all downlink connections.
887
+ *
888
+ * **Note**
889
+ * - If you want to know the uplink and downlink network conditions of the other party, you need to broadcast the other party's network quality through IM.
890
+ *
891
+ * @default 'network-quality'
892
+ * @memberof module:EVENT
893
+ * @example
894
+ * trtc.on(TRTC.EVENT.NETWORK_QUALITY, event => {
895
+ * console.log(`network-quality, uplinkNetworkQuality:${event.uplinkNetworkQuality}, downlinkNetworkQuality: ${event.downlinkNetworkQuality}`)
896
+ * console.log(`uplink rtt:${event.uplinkRTT} loss:${event.uplinkLoss}`)
897
+ * console.log(`downlink rtt:${event.downlinkRTT} loss:${event.downlinkLoss}`)
898
+ * })
899
+ */
900
+ readonly NETWORK_QUALITY: 'network-quality';
901
+ /**
902
+ * @description SDK and Tencent Cloud connection state change event, you can use this event to listen to the overall connection state of the SDK and Tencent Cloud.<br>
903
+ * - 'DISCONNECTED': Connection disconnected
904
+ * - 'CONNECTING': Connecting
905
+ * - 'CONNECTED': Connected
906
+ *
907
+ * Meanings of different state changes:
908
+ *
909
+ * - DISCONNECTED -> CONNECTING: Trying to establish a connection, triggered when calling the enter room interface or when the SDK automatically reconnects.
910
+ * - CONNECTING -> DISCONNECTED: Connection establishment failed, triggered when calling the exit room interface to interrupt the connection or when the connection fails after SDK retries.
911
+ * - CONNECTING -> CONNECTED: Connection established successfully, triggered when the connection is successful.
912
+ * - CONNECTED -> DISCONNECTED: Connection interrupted, triggered when calling the exit room interface or when the connection is disconnected due to network anomalies.
913
+ *
914
+ * Suggestion: You can listen to this event and display different UIs in different states to remind users of the current connection state.
915
+ *
916
+ * @default 'connection-state-changed'
917
+ * @memberof module:EVENT
918
+ * @example
919
+ * trtc.on(TRTC.EVENT.CONNECTION_STATE_CHANGED, event => {
920
+ * const prevState = event.prevState;
921
+ * const curState = event.state;
922
+ * });
923
+ */
924
+ readonly CONNECTION_STATE_CHANGED: 'connection-state-changed';
925
+ /**
926
+ * @description Audio playback state change event
927
+ *
928
+ * event.userId When userId is an empty string, it represents the local user, and when it is a non-empty string, it represents a remote user.
929
+ *
930
+ * event.state The value is as follows:
931
+ * - 'PLAYING': start playing
932
+ * - event.reason is 'playing' or 'unmute'.
933
+ * - 'PAUSED': pause playback
934
+ * - When event.reason is 'pause', it is triggered by the pause event of the \<audio\> element. The following situations will trigger:
935
+ * - Call the HTMLMediaElement.pause interface.
936
+ * - When event.reason is 'mute'. See event {@link https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack/mute_event | MediaStreamTrack.mute_event}
937
+ * - When userId is oneself, this event is triggered, indicating that audio collection is paused, usually caused by device abnormalities, such as being preempted by other applications on the device, at this time, the user needs to be guided to recollect.
938
+ * - When userId is others, this event is triggered, indicating that the received audio data is not enough to play. Usually caused by network jitter, no processing is required on the access side. When the received data is sufficient to play, it will automatically resume.
939
+ * - 'STOPPED': stop playing
940
+ * - event.reason is 'ended'.
941
+ *
942
+ * event.reason The reason for the state change, the value is as follows:
943
+ * - 'playing': start playing, see event {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/playing_event | HTMLMediaElement.playing_event}
944
+ * - 'mute': The audio track cannot provide data temporarily, see event {@link https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack/mute_event | MediaStreamTrack.mute_event}
945
+ * - 'unmute': The audio track resumes providing data, see event {@link https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack/unmute_event | MediaStreamTrack.unmute_event}
946
+ * - 'ended': The audio track has been closed
947
+ * - 'pause': Playback paused
948
+ * @default 'audio-play-state-changed'
949
+ * @memberof module:EVENT
950
+ * @example
951
+ * trtc.on(TRTC.EVENT.AUDIO_PLAY_STATE_CHANGED, event => {
952
+ * console.log(`${event.userId} player is ${event.state} because of ${event.reason}`);
953
+ * });
954
+ */
955
+ readonly AUDIO_PLAY_STATE_CHANGED: 'audio-play-state-changed';
956
+ /**
957
+ * @description Video playback state change event
958
+ *
959
+ * event.userId When userId is an empty string, it represents the local user, and when it is a non-empty string, it represents a remote user.
960
+ *
961
+ * event.streamType Stream type, value: {@link module:TYPE.STREAM_TYPE_MAIN TRTC.TYPE.STREAM_TYPE_MAIN} {@link module:TYPE.STREAM_TYPE_SUB TRTC.TYPE.STREAM_TYPE_SUB}
962
+ *
963
+ * event.state The value is as follows:
964
+ * - 'PLAYING': start playing
965
+ * - event.reason is 'playing' or 'unmute'.
966
+ * - 'PAUSED': pause playback
967
+ * - When event.reason is 'pause', it is triggered by the pause event of the \<video\> element. The following situations will trigger:
968
+ * - Call the HTMLMediaElement.pause interface.
969
+ * - After successful playback, the view container for playing the video is removed from the DOM.
970
+ * - When event.reason is 'mute'. See event {@link https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack/mute_event | MediaStreamTrack.mute_event}
971
+ * - When userId is oneself, this event is triggered, indicating that video collection is paused, usually caused by device abnormalities, such as being preempted by other applications on the device, at this time, the user needs to be guided to recollect.
972
+ * - When userId is others, this event is triggered, indicating that the received video data is not enough to play. Usually caused by network jitter, no processing is required on the access side. When the received data is sufficient to play, it will automatically resume.
973
+ * - 'STOPPED': stop playing
974
+ * - event.reason is 'ended'.
975
+ *
976
+ * event.reason The reason for the state change, the value is as follows:
977
+ * - 'playing': start playing, see event {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/playing_event | HTMLMediaElement.playing_event}
978
+ * - 'mute': The video track cannot provide data temporarily, see event {@link https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack/mute_event | MediaStreamTrack.mute_event}
979
+ * - 'unmute': The video track resumes providing data, see event {@link https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack/unmute_event | MediaStreamTrack.unmute_event}
980
+ * - 'ended': The video track has been closed
981
+ * - 'pause': Playback paused
982
+ * @default 'video-play-state-changed'
983
+ * @memberof module:EVENT
984
+ * @example
985
+ * trtc.on(TRTC.EVENT.VIDEO_PLAY_STATE_CHANGED, event => {
986
+ * console.log(`${event.userId} ${event.streamType} video player is ${event.state} because of ${event.reason}`);
987
+ * });
988
+ */
989
+ readonly VIDEO_PLAY_STATE_CHANGED: 'video-play-state-changed';
990
+ /**
991
+ * @description Notification event for local screen sharing stop, only valid for local screen sharing streams.
992
+ * @default 'screen-share-stopped'
993
+ * @memberof module:EVENT
994
+ * @example
995
+ * trtc.on(TRTC.EVENT.SCREEN_SHARE_STOPPED, () => {
996
+ * console.log('screen sharing was stopped');
997
+ * });
998
+ */
999
+ readonly SCREEN_SHARE_STOPPED: 'screen-share-stopped';
1000
+ /**
1001
+ * @description Notification event for device changes such as camera and microphone.
1002
+ * - event.device is a [MediaDeviceInfo](https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo) object with properties:
1003
+ * - deviceId: device ID
1004
+ * - label: device description information
1005
+ * - groupId: device group ID
1006
+ * - event.type value: `'camera'|'microphone'|'speaker'`
1007
+ * - event.action value:
1008
+ * - 'add' device has been added.
1009
+ * - 'remove' device has been removed.
1010
+ * - 'active' device has been activated, for example: after startLocalVideo is successful, this event will be triggered.
1011
+ * @default 'device-changed'
1012
+ * @memberof module:EVENT
1013
+ * @example
1014
+ * trtc.on(TRTC.EVENT.DEVICE_CHANGED, (event) => {
1015
+ * console.log(`${event.type}(${event.device.label}) ${event.action}`);
1016
+ * });
1017
+ */
1018
+ readonly DEVICE_CHANGED: 'device-changed';
1019
+ /**
1020
+ * @description Publish state change event.
1021
+ * - event.mediaType media type, value: `'audio'|'video'|'screen'`.
1022
+ * - event.state current publish state, value:
1023
+ * - `'starting'` trying to publish stream
1024
+ * - `'started'` publish stream succeeded
1025
+ * - `'stopped'` publish stream stopped, see event.reason field for the reason
1026
+ * - event.prevState the publish state at the last event trigger, with the same type as event.state.
1027
+ * - event.reason the reason for the publish state to become `'stopped'`, value:
1028
+ * - `'timeout'` publish stream timeout, usually caused by network jitter or firewall interception. The SDK will keep retrying, and the business side can guide the user to check the network or change the network at this time.
1029
+ * - `'error'` publish stream error, at this time, you can get the specific error information from event.error, usually caused by the browser not supporting H264 encoding.
1030
+ * - `'api-call'` publish stream stopped due to business side API call, for example, stopLocalVideo was called to stop the publish stream before startLocalVideo was successful, which is a normal behavior and the business side does not need to pay attention to it.
1031
+ * - event.error error information when event.reason is `'error'`.
1032
+ * @default 'publish-state-changed'
1033
+ * @memberof module:EVENT
1034
+ * @example
1035
+ * trtc.on(TRTC.EVENT.PUBLISH_STATE_CHANGED, (event) => {
1036
+ * console.log(`${event.mediaType} ${event.state} ${event.reason}`);
1037
+ * });
1038
+ */
1039
+ readonly PUBLISH_STATE_CHANGED: 'publish-state-changed';
1040
+ /**
1041
+ * @since v5.3.0
1042
+ * @description a new MediaStreamTrack object received.
1043
+ * @default 'track'
1044
+ * @memberof module:EVENT
1045
+ * @example
1046
+ * trtc.on(TRTC.EVENT.TRACK, event => {
1047
+ * // userId === '' means event.track is a local track, otherwise it's a remote track
1048
+ * const isLocal = event.userId === '';
1049
+ * // Usually the sub stream is a screen-sharing video stream.
1050
+ * const isSubStream = event.streamType === TRTC.TYPE.STREAM_TYPE_SUB;
1051
+ * const mediaStreamTrack = event.track;
1052
+ * const kind = event.track.kind; // audio or video
1053
+ * })
1054
+ */
1055
+ readonly TRACK: 'track';
1056
+ /**
1057
+ * @description TRTC statistics.<br>
1058
+ *
1059
+ * - SDK will fires this event once every 2s.
1060
+ * - You can get the network quality, statistics of audio and video from this event. For detailed parameter description, please refer to {@link TRTCStatistics}.
1061
+ * @default 'statistics'
1062
+ * @since v5.2.0
1063
+ * @memberof module:EVENT
1064
+ * @example
1065
+ * trtc.on(TRTC.EVENT.STATISTICS, statistics => {
1066
+ * console.warn(statistics.rtt, statistics.upLoss, statistics.downLoss);
1067
+ * })
1068
+ */
1069
+ readonly STATISTICS: 'statistics';
1070
+ /**
1071
+ * @since v5.3.0
1072
+ * @description SEI message received<br>
1073
+ * @default 'sei-message'
1074
+ * @memberof module:EVENT
1075
+ * @example
1076
+ * trtc.on(TRTC.EVENT.SEI_MESSAGE, event => {
1077
+ * console.log(`received sei message from ${event.userId}, data: ${event.data}, streamType: ${event.streamType}`)
1078
+ * })
1079
+ */
1080
+ readonly SEI_MESSAGE: 'sei-message';
1081
+ /**
1082
+ * @since v5.6.0
1083
+ * @description received a new custom message.
1084
+ * @default 'custom-message'
1085
+ * @memberof module:EVENT
1086
+ * @example
1087
+ * trtc.on(TRTC.EVENT.CUSTOM_MESSAGE, event => {
1088
+ * // event.userId: remote userId.
1089
+ * // event.cmdId: message cmdId.
1090
+ * // event.seq: message sequence number.
1091
+ * // event.data: custom message data, type is ArrayBuffer.
1092
+ * })
1093
+ */
1094
+ readonly CUSTOM_MESSAGE: 'custom-message';
1095
+ /**
1120
1096
  * @since v5.9.0
1121
1097
  * @description started rendering the first video frame of the local or a remote user.
1122
1098
  * @default 'first-video-frame'
@@ -1129,91 +1105,88 @@ export declare const TRTCEvent: {
1129
1105
  * // event.userId: The user ID of the local or a remote user. If it is empty, it indicates that the first local video frame is available; if it is not empty, it indicates that the first video frame of a remote user is available.
1130
1106
  * })
1131
1107
  */
1132
- readonly FIRST_VIDEO_FRAME: 'first-video-frame';
1108
+ readonly FIRST_VIDEO_FRAME: 'first-video-frame';
1133
1109
  };
1134
1110
  export declare interface TRTCEventTypes {
1135
- [TRTCEvent.ERROR]: [RtcError];
1136
- [TRTCEvent.AUTOPLAY_FAILED]: [{
1137
- userId: string;
1138
- resume: () => Promise<void>;
1139
- }];
1140
- [TRTCEvent.KICKED_OUT]: [{
1141
- reason: Exclude<BannedReason, 'user_time_out'>;
1142
- }];
1143
- [TRTCEvent.REMOTE_USER_ENTER]: [{
1144
- userId: string;
1145
- }];
1146
- [TRTCEvent.REMOTE_USER_EXIT]: [{
1147
- userId: string;
1148
- }];
1149
- [TRTCEvent.REMOTE_AUDIO_AVAILABLE]: [{
1150
- userId: string;
1151
- }];
1152
- [TRTCEvent.REMOTE_AUDIO_UNAVAILABLE]: [{
1153
- userId: string;
1154
- }];
1155
- [TRTCEvent.REMOTE_VIDEO_AVAILABLE]: [{
1156
- userId: string;
1157
- streamType: TRTCStreamType;
1158
- }];
1159
- [TRTCEvent.REMOTE_VIDEO_UNAVAILABLE]: [{
1160
- userId: string;
1161
- streamType: TRTCStreamType;
1162
- }];
1163
- [TRTCEvent.AUDIO_VOLUME]: [{
1164
- result: {
1165
- userId: string;
1166
- volume: number;
1167
- }[];
1168
- }];
1169
- [TRTCEvent.AUDIO_FRAME]: [{
1170
- data: Float32Array;
1171
- }];
1172
- [TRTCEvent.NETWORK_QUALITY]: [NetworkQuality];
1173
- [TRTCEvent.CONNECTION_STATE_CHANGED]: [{
1174
- prevState: ConnectionState;
1175
- state: ConnectionState;
1176
- }];
1177
- [TRTCEvent.AUDIO_PLAY_STATE_CHANGED]: [{
1178
- userId: string;
1179
- state: PlayerState;
1180
- reason: string;
1181
- }];
1182
- [TRTCEvent.VIDEO_PLAY_STATE_CHANGED]: [{
1183
- userId: string;
1184
- streamType: TRTCStreamType;
1185
- state: PlayerState;
1186
- reason: string;
1187
- }];
1188
- [TRTCEvent.SCREEN_SHARE_STOPPED]: [];
1189
- [TRTCEvent.DEVICE_CHANGED]: [{
1190
- type: TRTCDeviceType;
1191
- action: TRTCDeviceAction;
1192
- device: MediaDeviceInfo;
1193
- }];
1194
- [TRTCEvent.PUBLISH_STATE_CHANGED]: [
1195
- {
1196
- mediaType: 'audio' | 'video' | 'screen';
1197
- state: 'started' | 'stopped' | 'starting';
1198
- prevState: 'started' | 'stopped' | 'starting';
1199
- reason?: 'timeout' | 'error' | 'api-call';
1200
- error?: RtcError;
1201
- }
1202
- ];
1203
- [TRTCEvent.SEI_MESSAGE]: [{
1204
- data: ArrayBuffer;
1205
- userId: string;
1206
- streamType: TRTCStreamType;
1207
- seiPayloadType: number;
1208
- }];
1209
- [TRTCEvent.STATISTICS]: [statistics: TRTCStatistics];
1210
- [TRTCEvent.TRACK]: [{
1211
- userId: string;
1212
- streamType?: TRTCStreamType;
1213
- track: MediaStreamTrack;
1214
- sourceTrack: MediaStreamTrack;
1215
- }];
1216
- [TRTCEvent.CUSTOM_MESSAGE]: [CustomMessage];
1111
+ [TRTCEvent.ERROR]: [RtcError];
1112
+ [TRTCEvent.AUTOPLAY_FAILED]: [{
1113
+ userId: string;
1114
+ resume: () => Promise<void>;
1115
+ }];
1116
+ [TRTCEvent.KICKED_OUT]: [{
1117
+ reason: Exclude<BannedReason, 'user_time_out'>;
1118
+ }];
1119
+ [TRTCEvent.REMOTE_USER_ENTER]: [{
1120
+ userId: string;
1121
+ }];
1122
+ [TRTCEvent.REMOTE_USER_EXIT]: [{
1123
+ userId: string;
1124
+ }];
1125
+ [TRTCEvent.REMOTE_AUDIO_AVAILABLE]: [{
1126
+ userId: string;
1127
+ }];
1128
+ [TRTCEvent.REMOTE_AUDIO_UNAVAILABLE]: [{
1129
+ userId: string;
1130
+ }];
1131
+ [TRTCEvent.REMOTE_VIDEO_AVAILABLE]: [{
1132
+ userId: string;
1133
+ streamType: TRTCStreamType;
1134
+ }];
1135
+ [TRTCEvent.REMOTE_VIDEO_UNAVAILABLE]: [{
1136
+ userId: string;
1137
+ streamType: TRTCStreamType;
1138
+ }];
1139
+ [TRTCEvent.AUDIO_VOLUME]: [{
1140
+ result: {
1141
+ userId: string;
1142
+ volume: number;
1143
+ }[];
1144
+ }];
1145
+ [TRTCEvent.NETWORK_QUALITY]: [NetworkQuality];
1146
+ [TRTCEvent.CONNECTION_STATE_CHANGED]: [{
1147
+ prevState: ConnectionState;
1148
+ state: ConnectionState;
1149
+ }];
1150
+ [TRTCEvent.AUDIO_PLAY_STATE_CHANGED]: [{
1151
+ userId: string;
1152
+ state: PlayerState;
1153
+ reason: string;
1154
+ }];
1155
+ [TRTCEvent.VIDEO_PLAY_STATE_CHANGED]: [{
1156
+ userId: string;
1157
+ streamType: TRTCStreamType;
1158
+ state: PlayerState;
1159
+ reason: string;
1160
+ }];
1161
+ [TRTCEvent.SCREEN_SHARE_STOPPED]: [];
1162
+ [TRTCEvent.DEVICE_CHANGED]: [{
1163
+ type: TRTCDeviceType;
1164
+ action: TRTCDeviceAction;
1165
+ device: MediaDeviceInfo;
1166
+ }];
1167
+ [TRTCEvent.PUBLISH_STATE_CHANGED]: [
1168
+ {
1169
+ mediaType: 'audio' | 'video' | 'screen';
1170
+ state: 'started' | 'stopped' | 'starting';
1171
+ prevState: 'started' | 'stopped' | 'starting';
1172
+ reason?: 'timeout' | 'error' | 'api-call';
1173
+ error?: RtcError;
1174
+ }
1175
+ ];
1176
+ [TRTCEvent.SEI_MESSAGE]: [{
1177
+ data: ArrayBuffer;
1178
+ userId: string;
1179
+ streamType: TRTCStreamType;
1180
+ seiPayloadType: number;
1181
+ }];
1182
+ [TRTCEvent.STATISTICS]: [statistics: TRTCStatistics];
1183
+ [TRTCEvent.TRACK]: [{
1184
+ userId: string;
1185
+ streamType?: TRTCStreamType;
1186
+ track: MediaStreamTrack;
1187
+ sourceTrack: MediaStreamTrack;
1188
+ }];
1189
+ [TRTCEvent.CUSTOM_MESSAGE]: [CustomMessage];
1217
1190
  }
1218
1191
 
1219
1192
  export declare interface CustomMessageData {
@@ -1226,577 +1199,577 @@ export declare interface CustomMessage extends CustomMessageData {
1226
1199
  }
1227
1200
  export declare class TRTC {
1228
1201
  /**
1229
- * Create a TRTC object for implementing functions such as entering a room, previewing, publishing, and subscribing streams.<br>
1230
- *
1231
- * **Note:**
1232
- * - You must create a TRTC object first and call its methods and listen to its events to implement various functions required by the business.
1233
- * @example
1234
- * // Create a TRTC object
1235
- * const trtc = TRTC.create();
1236
- *
1237
- * @returns {TRTC} TRTC object
1238
- */
1202
+ * Create a TRTC object for implementing functions such as entering a room, previewing, publishing, and subscribing streams.<br>
1203
+ *
1204
+ * **Note:**
1205
+ * - You must create a TRTC object first and call its methods and listen to its events to implement various functions required by the business.
1206
+ * @example
1207
+ * // Create a TRTC object
1208
+ * const trtc = TRTC.create();
1209
+ *
1210
+ * @returns {TRTC} TRTC object
1211
+ */
1239
1212
  static create(options?: TRTCOptions): TRTC;
1240
1213
  /**
1241
- * @private
1242
- * register plugin <br>
1243
- *
1244
- * @example
1245
- * import { VirtualBackground } from 'trtc-sdk-v5/plugins/video-effect/virtual-background';
1246
- * trtc.use({ plugin: VirtualBackground });
1247
- *
1248
- * @example
1249
- * import { VirtualBackground } from 'trtc-sdk-v5/plugins/video-effect/virtual-background';
1250
- * trtc.use({ plugin: VirtualBackground, assetsPath: './js/assets/' });
1251
- *
1252
- * @example
1253
- * // 简写使用
1254
- * import { VirtualBackground } from 'trtc-sdk-v5/plugins/video-effect/virtual-background';
1255
- * trtc.use(VirtualBackground);
1256
- */
1214
+ * @private
1215
+ * regi <br>
1216
+ *
1217
+ * @example
1218
+ * import { VirtualBackground } from 'trtc-sdk-v5/plugins/video-effect/virtual-background';
1219
+ * trtc.use({ plugin: VirtualBackground });
1220
+ *
1221
+ * @example
1222
+ * import { VirtualBackground } from 'trtc-sdk-v5/plugins/video-effect/virtual-background';
1223
+ * trtc.use({ plugin: VirtualBackground, assetsPath: './js/assets/' });
1224
+ *
1225
+ * @example
1226
+ * // 简写使用
1227
+ * import { VirtualBackground } from 'trtc-sdk-v5/plugins/video-effect/virtual-background';
1228
+ * trtc.use(VirtualBackground);
1229
+ */
1257
1230
  use(pluginObject: PluginWithAssets | TRTCPlugin): void;
1258
1231
  /**
1259
- * @typedef TurnServer
1260
- * @property {string} url TURN server url
1261
- * @property {string=} username TURN server auth user name
1262
- * @property {string=} credential TURN server password
1263
- * @property {string=} [credentialType=password] TURN server verify password type
1264
- */
1265
- /**
1266
- * @typedef ProxyServer
1267
- * @property {string} [websocketProxy] websocket service proxy
1268
- * @property {string} [loggerProxy] log service agent
1269
- * @property {TurnServer[]} [turnServer] media data transmission agent
1270
- * @property {'all'|'relay'} [iceTransportPolicy='all'] 'all' gives priority to directly connecting to TRTC, and tries to go to the turn server if the connection fails.<br>
1271
- * 'relay' forces the connection through the TURN server.
1272
- */
1273
- /**
1274
- * Enter a video call room.<br>
1275
- * - Entering a room means starting a video call session. Only after entering the room successfully can you make audio and video calls with other users in the room.
1276
- * - You can publish local audio and video streams through {@link TRTC#startLocalVideo startLocalVideo()} and {@link TRTC#startLocalAudio startLocalAudio()} respectively. After successful publishing, other users in the room will receive the {@link module:EVENT.REMOTE_AUDIO_AVAILABLE REMOTE_AUDIO_AVAILABLE} and {@link module:EVENT.REMOTE_VIDEO_AVAILABLE REMOTE_VIDEO_AVAILABLE} event notifications.
1277
- * - By default, the SDK automatically plays remote audio. You need to call {@link TRTC#startRemoteVideo startRemoteVideo()} to play remote video.
1278
- *
1279
- * @param {object} options Enter room parameters
1280
- * @param {number} options.sdkAppId sdkAppId <br>
1281
- * You can obtain the sdkAppId information in the **Application Information** section after creating a new application by clicking **Application Management** > **Create Application** in the [TRTC Console](https://console.intl.cloud.tencent.com/trtc).
1282
- * @param {string} options.userId User ID <br>
1283
- * It is recommended to limit the length to 32 bytes, and only allow uppercase and lowercase English letters (a-zA-Z), numbers (0-9), underscores, and hyphens.
1284
- * @param {string} options.userSig UserSig signature <br>
1285
- * Please refer to [UserSig related](https://www.tencentcloud.com/document/product/647/35166) for the calculation method of userSig.
1286
- * @param {number=} options.roomId
1287
- * the value must be an integer between 1 and 4294967294<br>
1288
- * <font color="red">If you need to use a string type room id, please use the strRoomId parameter. One of roomId and strRoomId must be passed in. If both are passed in, the roomId will be selected first.</font>
1289
- * @param {string=} options.strRoomId
1290
- * String type room id, the length is limited to 64 bytes, and only supports the following characters:
1291
- * - Uppercase and lowercase English letters (a-zA-Z)
1292
- * - Numbers (0-9)
1293
- * - Space ! # $ % & ( ) + - : ; < = . > ? @ [ ] ^ _ { } | ~ ,
1294
- * <font color="red">Note: It is recommended to use a numeric type roomId. The string type room id "123" is not the same room as the numeric type room id 123.</font>
1295
- * @param {string} [options.scene] Application scene, currently supports the following two scenes:
1296
- * - {@link module:TYPE.SCENE_RTC TRTC.TYPE.SCENE_RTC} (default) Real-time call scene, which is suitable for 1-to-1 audio and video calls, or online meetings with up to 300 participants. {@tutorial 04-info-uplink-limits}.
1297
- * - {@link module:TYPE.SCENE_LIVE TRTC.TYPE.SCENE_LIVE} Interactive live streaming scene, which is suitable for online live streaming scenes with up to 100,000 people, but you need to specify the role field in the options parameter introduced next.
1298
- * @param {string=} [options.role] User role, only meaningful in the {@link module:TYPE.SCENE_LIVE TRTC.TYPE.SCENE_LIVE} scene, and the {@link module:TYPE.SCENE_RTC TRTC.TYPE.SCENE_RTC} scene does not need to specify the role. Currently supports two roles:
1299
- * - {@link module:TYPE.ROLE_ANCHOR TRTC.TYPE.ROLE_ANCHOR} (default) Anchor
1300
- * - {@link module:TYPE.ROLE_AUDIENCE TRTC.TYPE.ROLE_AUDIENCE} Audience
1301
- * Note: The audience role does not have the permission to publish local audio and video, only the permission to watch remote streams. If the audience wants to interact with the anchor by connecting to the microphone, please switch the role to the anchor through {@link TRTC#switchRole switchRole()} before publishing local audio and video.
1302
- * @param {boolean} [options.autoReceiveAudio=true] Whether to automatically receive audio. When a remote user publishes audio, the SDK automatically plays the remote user's audio.
1303
- * @param {boolean} [options.autoReceiveVideo=false] Whether to automatically receive video. When a remote user publishes video, the SDK automatically subscribes and decodes the remote video. You need to call {@link TRTC#startRemoteVideo startRemoteVideo} to play the remote video.
1304
- * - The default value was changed to `false` since v5.6.0. Refer to [Breaking Changed for v5.6.0](https://web.sdk.qcloud.com/trtc/webrtc/v5/doc/en/tutorial-00-info-update-guideline.html).
1305
- * @param {boolean} [options.enableAutoPlayDialog] Whether to enable the SDK's automatic playback failure dialog box, default: true.
1306
- * - Enabled by default. When automatic playback fails, the SDK will pop up a dialog box to guide the user to click the page to restore audio and video playback.
1307
- * - Can be set to false in order to turn off. Refer to {@tutorial 21-advanced-auto-play-policy}.
1308
- * @param {string|ProxyServer} [options.proxy] proxy config. Refer to {@tutorial 34-advanced-proxy}.
1309
- * @param {boolean} [options.privateMapKey] Key for entering a room. If permission control is required, please carry this parameter (empty or incorrect value will cause a failure in entering the room).<br>[privateMapKey permission configuration](https://www.tencentcloud.com/document/product/647/35157?lang=en&pg=).
1310
- * @throws
1311
- * - {@link module:ERROR_CODE.INVALID_PARAMETER INVALID_PARAMETER}
1312
- * - {@link module:ERROR_CODE.OPERATION_FAILED OPERATION_FAILED}
1313
- * - {@link module:ERROR_CODE.OPERATION_ABORT OPERATION_ABORT}
1314
- * - {@link module:ERROR_CODE.ENV_NOT_SUPPORTED ENV_NOT_SUPPORTED}
1315
- * - {@link module:ERROR_CODE.SERVER_ERROR SERVER_ERROR}
1316
- * @example
1317
- * const trtc = TRTC.create();
1318
- * await trtc.enterRoom({ roomId: 8888, sdkAppId, userId, userSig });
1319
- */
1232
+ * @typedef TurnServer
1233
+ * @property {string} url TURN server url
1234
+ * @property {string=} username TURN server auth user name
1235
+ * @property {string=} credential TURN server password
1236
+ * @property {string=} [credentialType=password] TURN server verify password type
1237
+ */
1238
+ /**
1239
+ * @typedef ProxyServer
1240
+ * @property {string} [websocketProxy] websocket service proxy
1241
+ * @property {string} [loggerProxy] log service agent
1242
+ * @property {TurnServer[]} [turnServer] media data transmission agent
1243
+ * @property {'all'|'relay'} [iceTransportPolicy='all'] 'all' gives priority to directly connecting to TRTC, and tries to go to the turn server if the connection fails.<br>
1244
+ * 'relay' forces the connection through the TURN server.
1245
+ */
1246
+ /**
1247
+ * Enter a video call room.<br>
1248
+ * - Entering a room means starting a video call session. Only after entering the room successfully can you make audio and video calls with other users in the room.
1249
+ * - You can publish local audio and video streams through {@link TRTC#startLocalVideo startLocalVideo()} and {@link TRTC#startLocalAudio startLocalAudio()} respectively. After successful publishing, other users in the room will receive the {@link module:EVENT.REMOTE_AUDIO_AVAILABLE REMOTE_AUDIO_AVAILABLE} and {@link module:EVENT.REMOTE_VIDEO_AVAILABLE REMOTE_VIDEO_AVAILABLE} event notifications.
1250
+ * - By default, the SDK automatically plays remote audio. You need to call {@link TRTC#startRemoteVideo startRemoteVideo()} to play remote video.
1251
+ *
1252
+ * @param {object} options Enter room parameters
1253
+ * @param {number} options.sdkAppId sdkAppId <br>
1254
+ * You can obtain the sdkAppId information in the **Application Information** section after creating a new application by clicking **Application Management** > **Create Application** in the [TRTC Console](https://console.intl.cloud.tencent.com/trtc).
1255
+ * @param {string} options.userId User ID <br>
1256
+ * It is recommended to limit the length to 32 bytes, and only allow uppercase and lowercase English letters (a-zA-Z), numbers (0-9), underscores, and hyphens.
1257
+ * @param {string} options.userSig UserSig signature <br>
1258
+ * Please refer to [UserSig related](https://www.tencentcloud.com/document/product/647/35166) for the calculation method of userSig.
1259
+ * @param {number=} options.roomId
1260
+ * the value must be an integer between 1 and 4294967294<br>
1261
+ * <font color="red">If you need to use a string type room id, please use the strRoomId parameter. One of roomId and strRoomId must be passed in. If both are passed in, the roomId will be selected first.</font>
1262
+ * @param {string=} options.strRoomId
1263
+ * String type room id, the length is limited to 64 bytes, and only supports the following characters:
1264
+ * - Uppercase and lowercase English letters (a-zA-Z)
1265
+ * - Numbers (0-9)
1266
+ * - Space ! # $ % & ( ) + - : ; < = . > ? @ [ ] ^ _ { } | ~ ,
1267
+ * <font color="red">Note: It is recommended to use a numeric type roomId. The string type room id "123" is not the same room as the numeric type room id 123.</font>
1268
+ * @param {string} [options.scene] Application scene, currently supports the following two scenes:
1269
+ * - {@link module:TYPE.SCENE_RTC TRTC.TYPE.SCENE_RTC} (default) Real-time call scene, which is suitable for 1-to-1 audio and video calls, or online meetings with up to 300 participants. {@tutorial 04-info-uplink-limits}.
1270
+ * - {@link module:TYPE.SCENE_LIVE TRTC.TYPE.SCENE_LIVE} Interactive live streaming scene, which is suitable for online live streaming scenes with up to 100,000 people, but you need to specify the role field in the options parameter introduced next.
1271
+ * @param {string=} [options.role] User role, only meaningful in the {@link module:TYPE.SCENE_LIVE TRTC.TYPE.SCENE_LIVE} scene, and the {@link module:TYPE.SCENE_RTC TRTC.TYPE.SCENE_RTC} scene does not need to specify the role. Currently supports two roles:
1272
+ * - {@link module:TYPE.ROLE_ANCHOR TRTC.TYPE.ROLE_ANCHOR} (default) Anchor
1273
+ * - {@link module:TYPE.ROLE_AUDIENCE TRTC.TYPE.ROLE_AUDIENCE} Audience
1274
+ * Note: The audience role does not have the permission to publish local audio and video, only the permission to watch remote streams. If the audience wants to interact with the anchor by connecting to the microphone, please switch the role to the anchor through {@link TRTC#switchRole switchRole()} before publishing local audio and video.
1275
+ * @param {boolean} [options.autoReceiveAudio=true] Whether to automatically receive audio. When a remote user publishes audio, the SDK automatically plays the remote user's audio.
1276
+ * @param {boolean} [options.autoReceiveVideo=false] Whether to automatically receive video. When a remote user publishes video, the SDK automatically subscribes and decodes the remote video. You need to call {@link TRTC#startRemoteVideo startRemoteVideo} to play the remote video.
1277
+ * - The default value was changed to `false` since v5.6.0. Refer to [Breaking Changed for v5.6.0](https://web.sdk.qcloud.com/trtc/webrtc/v5/doc/en/tutorial-00-info-update-guideline.html).
1278
+ * @param {boolean} [options.enableAutoPlayDialog] Whether to enable the SDK's automatic playback failure dialog box, default: true.
1279
+ * - Enabled by default. When automatic playback fails, the SDK will pop up a dialog box to guide the user to click the page to restore audio and video playback.
1280
+ * - Can be set to false in order to turn off. Refer to {@tutorial 21-advanced-auto-play-policy}.
1281
+ * @param {string|ProxyServer} [options.proxy] proxy config. Refer to {@tutorial 34-advanced-proxy}.
1282
+ * @param {boolean} [options.privateMapKey] Key for entering a room. If permission control is required, please carry this parameter (empty or incorrect value will cause a failure in entering the room).<br>[privateMapKey permission configuration](https://www.tencentcloud.com/document/product/647/35157?lang=en&pg=).
1283
+ * @throws
1284
+ * - {@link module:ERROR_CODE.INVALID_PARAMETER INVALID_PARAMETER}
1285
+ * - {@link module:ERROR_CODE.OPERATION_FAILED OPERATION_FAILED}
1286
+ * - {@link module:ERROR_CODE.OPERATION_ABORT OPERATION_ABORT}
1287
+ * - {@link module:ERROR_CODE.ENV_NOT_SUPPORTED ENV_NOT_SUPPORTED}
1288
+ * - {@link module:ERROR_CODE.SERVER_ERROR SERVER_ERROR}
1289
+ * @example
1290
+ * const trtc = TRTC.create();
1291
+ * await trtc.enterRoom({ roomId: 8888, sdkAppId, userId, userSig });
1292
+ */
1320
1293
  enterRoom(params: EnterRoomConfig): Promise<void>;
1321
1294
  /**
1322
- * Exit the current audio and video call room.
1323
- * - After exiting the room, the connection with remote users will be closed, and remote audio and video will no longer be received and played, and the publishing of local audio and video will be stopped.
1324
- * - The capture and preview of the local camera and microphone will not stop. You can call {@link TRTC#stopLocalVideo stopLocalVideo()} and {@link TRTC#stopLocalAudio stopLocalAudio()} to stop capturing local microphone and camera.
1325
- * @throws {@link module:ERROR_CODE.OPERATION_ABORT OPERATION_ABORT}
1326
- * @memberof TRTC
1327
- * @example
1328
- * await trtc.exitRoom();
1329
- */
1295
+ * Exit the current audio and video call room.
1296
+ * - After exiting the room, the connection with remote users will be closed, and remote audio and video will no longer be received and played, and the publishing of local audio and video will be stopped.
1297
+ * - The capture and preview of the local camera and microphone will not stop. You can call {@link TRTC#stopLocalVideo stopLocalVideo()} and {@link TRTC#stopLocalAudio stopLocalAudio()} to stop capturing local microphone and camera.
1298
+ * @throws {@link module:ERROR_CODE.OPERATION_ABORT OPERATION_ABORT}
1299
+ * @memberof TRTC
1300
+ * @example
1301
+ * await trtc.exitRoom();
1302
+ */
1330
1303
  exitRoom(): Promise<void>;
1331
1304
  /**
1332
- * Switches the user role, only effective in TRTC.TYPE.SCENE_LIVE interactive live streaming mode.
1333
- *
1334
- * In interactive live streaming mode, a user may need to switch between "audience" and "anchor".
1335
- * You can determine the role through the role field in {@link TRTC#enterRoom enterRoom()}, or switch roles after entering the room through switchRole.
1336
- * - Audience switches to anchor, call trtc.switchRole(TRTC.TYPE.ROLE_ANCHOR) to convert the user role to TRTC.TYPE.ROLE_ANCHOR anchor role, and then call {@link TRTC#startLocalVideo startLocalVideo()} and {@link TRTC#startLocalAudio startLocalAudio()} to publish local audio and video as needed.
1337
- * - Anchor switches to audience, call trtc.switchRole(TRTC.TYPE.ROLE_AUDIENCE) to convert the user role to TRTC.TYPE.ROLE_AUDIENCE audience role. If there is already published local audio and video, the SDK will cancel the publishing of local audio and video.
1338
- * > !
1339
- * > - This interface can only be called after entering the room successfully.
1340
- * > - After closing the camera and microphone, it is recommended to switch to the audience role in time to avoid the anchor role occupying the resources of 50 upstreams.
1341
- * @param {string} role User role
1342
- * - TRTC.TYPE.ROLE_ANCHOR anchor, can publish local audio and video, up to 50 anchors can publish local audio and video in a single room at the same time.
1343
- * - TRTC.TYPE.ROLE_AUDIENCE audience, cannot publish local audio and video, can only watch remote streams, and there is no upper limit on the number of audience members in a single room.
1344
- * @param {object} [option]
1345
- * @param {string} [option.privateMapKey] `Since v5.3.0+` <br>
1346
- * The privateMapKey may expire after a timeout, so you can use this parameter to update the privateMapKey.
1347
- * @throws
1348
- * - {@link module:ERROR_CODE.INVALID_PARAMETER INVALID_PARAMETER}
1349
- * - {@link module:ERROR_CODE.INVALID_OPERATION INVALID_OPERATION}
1350
- * - {@link module:ERROR_CODE.OPERATION_FAILED OPERATION_FAILED}
1351
- * - {@link module:ERROR_CODE.OPERATION_ABORT OPERATION_ABORT}
1352
- * - {@link module:ERROR_CODE.SERVER_ERROR SERVER_ERROR}
1353
- * @memberof TRTC
1354
- * @example
1355
- * // After entering the room successfully
1356
- * // TRTC.TYPE.SCENE_LIVE interactive live streaming mode, audience switches to anchor
1357
- * await trtc.switchRole(TRTC.TYPE.ROLE_ANCHOR);
1358
- * // Switch from audience role to anchor role and start streaming
1359
- * await trtc.startLocalVideo();
1360
- *
1361
- * // TRTC.TYPE.SCENE_LIVE interactive live streaming mode, anchor switches to audience
1362
- * await trtc.switchRole(TRTC.TYPE.ROLE_AUDIENCE);
1363
- * @example
1364
- * // Since v5.3.0+
1365
- * await trtc.switchRole(TRTC.TYPE.ROLE_ANCHOR, { privateMapKey: 'your new privateMapKey' });
1366
- */
1305
+ * Switches the user role, only effective in TRTC.TYPE.SCENE_LIVE interactive live streaming mode.
1306
+ *
1307
+ * In interactive live streaming mode, a user may need to switch between "audience" and "anchor".
1308
+ * You can determine the role through the role field in {@link TRTC#enterRoom enterRoom()}, or switch roles after entering the room through switchRole.
1309
+ * - Audience switches to anchor, call trtc.switchRole(TRTC.TYPE.ROLE_ANCHOR) to convert the user role to TRTC.TYPE.ROLE_ANCHOR anchor role, and then call {@link TRTC#startLocalVideo startLocalVideo()} and {@link TRTC#startLocalAudio startLocalAudio()} to publish local audio and video as needed.
1310
+ * - Anchor switches to audience, call trtc.switchRole(TRTC.TYPE.ROLE_AUDIENCE) to convert the user role to TRTC.TYPE.ROLE_AUDIENCE audience role. If there is already published local audio and video, the SDK will cancel the publishing of local audio and video.
1311
+ * > !
1312
+ * > - This interface can only be called after entering the room successfully.
1313
+ * > - After closing the camera and microphone, it is recommended to switch to the audience role in time to avoid the anchor role occupying the resources of 50 upstreams.
1314
+ * @param {string} role User role
1315
+ * - TRTC.TYPE.ROLE_ANCHOR anchor, can publish local audio and video, up to 50 anchors can publish local audio and video in a single room at the same time.
1316
+ * - TRTC.TYPE.ROLE_AUDIENCE audience, cannot publish local audio and video, can only watch remote streams, and there is no upper limit on the number of audience members in a single room.
1317
+ * @param {object} [option]
1318
+ * @param {string} [option.privateMapKey] `Since v5.3.0+` <br>
1319
+ * The privateMapKey may expire after a timeout, so you can use this parameter to update the privateMapKey.
1320
+ * @throws
1321
+ * - {@link module:ERROR_CODE.INVALID_PARAMETER INVALID_PARAMETER}
1322
+ * - {@link module:ERROR_CODE.INVALID_OPERATION INVALID_OPERATION}
1323
+ * - {@link module:ERROR_CODE.OPERATION_FAILED OPERATION_FAILED}
1324
+ * - {@link module:ERROR_CODE.OPERATION_ABORT OPERATION_ABORT}
1325
+ * - {@link module:ERROR_CODE.SERVER_ERROR SERVER_ERROR}
1326
+ * @memberof TRTC
1327
+ * @example
1328
+ * // After entering the room successfully
1329
+ * // TRTC.TYPE.SCENE_LIVE interactive live streaming mode, audience switches to anchor
1330
+ * await trtc.switchRole(TRTC.TYPE.ROLE_ANCHOR);
1331
+ * // Switch from audience role to anchor role and start streaming
1332
+ * await trtc.startLocalVideo();
1333
+ *
1334
+ * // TRTC.TYPE.SCENE_LIVE interactive live streaming mode, anchor switches to audience
1335
+ * await trtc.switchRole(TRTC.TYPE.ROLE_AUDIENCE);
1336
+ * @example
1337
+ * // Since v5.3.0+
1338
+ * await trtc.switchRole(TRTC.TYPE.ROLE_ANCHOR, { privateMapKey: 'your new privateMapKey' });
1339
+ */
1367
1340
  switchRole(role: UserRole, option?: {
1368
- privateMapKey?: string;
1369
- latencyLevel?: number;
1370
- }): Promise<void>;
1371
- /**
1372
- * Destroy the TRTC instance <br/>
1373
- *
1374
- * After exiting the room, if the business side no longer needs to use trtc, you need to call this interface to destroy the trtc instance in time and release related resources.
1375
- *
1376
- * Note:
1377
- * - The trtc instance after destruction cannot be used again.
1378
- * - If you have entered the room, you need to call the {@link TRTC#exitRoom TRTC.exitRoom} interface to exit the room successfully before calling this interface to destroy trtc.
1379
- *
1380
- * @example
1381
- * // When the call is over
1382
- * await trtc.exitRoom();
1383
- * // If the trtc is no longer needed, destroy the trtc and release the reference.
1384
- * trtc.destroy();
1385
- * trtc = null;
1386
- * @throws {@link module:ERROR_CODE.OPERATION_FAILED OPERATION_FAILED}
1387
- * @memberof TRTC
1388
- */
1341
+ privateMapKey?: string;
1342
+ latencyLevel?: number;
1343
+ }): Promise<void>;
1344
+ /**
1345
+ * Destroy the TRTC instance <br/>
1346
+ *
1347
+ * After exiting the room, if the business side no longer needs to use trtc, you need to call this interface to destroy the trtc instance in time and release related resources.
1348
+ *
1349
+ * Note:
1350
+ * - The trtc instance after destruction cannot be used again.
1351
+ * - If you have entered the room, you need to call the {@link TRTC#exitRoom TRTC.exitRoom} interface to exit the room successfully before calling this interface to destroy trtc.
1352
+ *
1353
+ * @example
1354
+ * // When the call is over
1355
+ * await trtc.exitRoom();
1356
+ * // If the trtc is no longer needed, destroy the trtc and release the reference.
1357
+ * trtc.destroy();
1358
+ * trtc = null;
1359
+ * @throws {@link module:ERROR_CODE.OPERATION_FAILED OPERATION_FAILED}
1360
+ * @memberof TRTC
1361
+ */
1389
1362
  destroy(): void;
1390
1363
  /**
1391
- * Start collecting audio from the local microphone and publish it to the current room.
1392
- * - When to call: can be called before or after entering the room, cannot be called repeatedly.
1393
- * - Only one microphone can be opened for a trtc instance. If you need to open another microphone for testing in the case of already opening one microphone, you can create multiple trtc instances to achieve it.
1394
- *
1395
- * @param {object} [config] - Configuration item
1396
- * @param {boolean} [config.publish] - Whether to publish local audio to the room, default is true. If you call this interface before entering the room and publish = true, the SDK will automatically publish after entering the room. You can get the publish state by listening this event {@link module:EVENT.PUBLISH_STATE_CHANGED PUBLISH_STATE_CHANGED}.
1397
- * @param {boolean} [config.mute] - Whether to mute microphone. Refer to: {@tutorial 15-basic-dynamic-add-video}.
1398
- * @param {object} [config.option] - Local audio options
1399
- * @param {string} [config.option.microphoneId]- Specify which microphone to use
1400
- * @param {MediaStreamTrack} [config.option.audioTrack] - Custom audioTrack. {@tutorial 20-advanced-customized-capture-rendering}.
1401
- * @param {number} [config.option.captureVolume] - Set the capture volume of microphone. The default value is 100. Setting above 100 enlarges the capture volume. Since v5.2.1+.
1402
- * @param {number} [config.option.earMonitorVolume] - Set the ear return volume, value range [0, 100], the local microphone is muted by default.
1403
- * @param {string} [config.option.profile] - Audio encoding configuration, default {@link module:TYPE.AUDIO_PROFILE_STANDARD TRTC.TYPE.AUDIO_PROFILE_STANDARD}
1404
- * @throws
1405
- * - {@link module:ERROR_CODE.ENV_NOT_SUPPORTED ENV_NOT_SUPPORTED}
1406
- * - {@link module:ERROR_CODE.INVALID_PARAMETER INVALID_PARAMETER}
1407
- * - {@link module:ERROR_CODE.DEVICE_ERROR DEVICE_ERROR}
1408
- * - {@link module:ERROR_CODE.OPERATION_FAILED OPERATION_FAILED}
1409
- * - {@link module:ERROR_CODE.OPERATION_ABORT OPERATION_ABORT}
1410
- * - {@link module:ERROR_CODE.SERVER_ERROR SERVER_ERROR}
1411
- * @example
1412
- * // Collect the default microphone and publish
1413
- * await trtc.startLocalAudio();
1414
- * @example
1415
- * // The following is a code example for testing microphone volume, which can be used for microphone volume detection.
1416
- * trtc.enableAudioVolumeEvaluation();
1417
- * trtc.on(TRTC.EVENT.AUDIO_VOLUME, event => { });
1418
- * // No need to publish audio for testing microphone
1419
- * await trtc.startLocalAudio({ publish: false });
1420
- * // After the test is completed, turn off the microphone
1421
- * await trtc.stopLocalAudio();
1422
- * @memberof TRTC
1423
- */
1364
+ * Start collecting audio from the local microphone and publish it to the current room.
1365
+ * - When to call: can be called before or after entering the room, cannot be called repeatedly.
1366
+ * - Only one microphone can be opened for a trtc instance. If you need to open another microphone for testing in the case of already opening one microphone, you can create multiple trtc instances to achieve it.
1367
+ *
1368
+ * @param {object} [config] - Configuration item
1369
+ * @param {boolean} [config.publish] - Whether to publish local audio to the room, default is true. If you call this interface before entering the room and publish = true, the SDK will automatically publish after entering the room. You can get the publish state by listening this event {@link module:EVENT.PUBLISH_STATE_CHANGED PUBLISH_STATE_CHANGED}.
1370
+ * @param {boolean} [config.mute] - Whether to mute microphone. Refer to: {@tutorial 15-basic-dynamic-add-video}.
1371
+ * @param {object} [config.option] - Local audio options
1372
+ * @param {string} [config.option.microphoneId]- Specify which microphone to use
1373
+ * @param {MediaStreamTrack} [config.option.audioTrack] - Custom audioTrack. {@tutorial 20-advanced-customized-capture-rendering}.
1374
+ * @param {number} [config.option.captureVolume] - Set the capture volume of microphone. The default value is 100. Setting above 100 enlarges the capture volume. Since v5.2.1+.
1375
+ * @param {number} [config.option.earMonitorVolume] - Set the ear return volume, value range [0, 100], the local microphone is muted by default.
1376
+ * @param {string} [config.option.profile] - Audio encoding configuration, default {@link module:TYPE.AUDIO_PROFILE_STANDARD TRTC.TYPE.AUDIO_PROFILE_STANDARD}
1377
+ * @throws
1378
+ * - {@link module:ERROR_CODE.ENV_NOT_SUPPORTED ENV_NOT_SUPPORTED}
1379
+ * - {@link module:ERROR_CODE.INVALID_PARAMETER INVALID_PARAMETER}
1380
+ * - {@link module:ERROR_CODE.DEVICE_ERROR DEVICE_ERROR}
1381
+ * - {@link module:ERROR_CODE.OPERATION_FAILED OPERATION_FAILED}
1382
+ * - {@link module:ERROR_CODE.OPERATION_ABORT OPERATION_ABORT}
1383
+ * - {@link module:ERROR_CODE.SERVER_ERROR SERVER_ERROR}
1384
+ * @example
1385
+ * // Collect the default microphone and publish
1386
+ * await trtc.startLocalAudio();
1387
+ * @example
1388
+ * // The following is a code example for testing microphone volume, which can be used for microphone volume detection.
1389
+ * trtc.enableAudioVolumeEvaluation();
1390
+ * trtc.on(TRTC.EVENT.AUDIO_VOLUME, event => { });
1391
+ * // No need to publish audio for testing microphone
1392
+ * await trtc.startLocalAudio({ publish: false });
1393
+ * // After the test is completed, turn off the microphone
1394
+ * await trtc.stopLocalAudio();
1395
+ * @memberof TRTC
1396
+ */
1424
1397
  startLocalAudio(config?: LocalAudioConfig): Promise<void>;
1425
1398
  /**
1426
- * Update the configuration of the local microphone.
1427
- * - When to call: This interface needs to be called after {@link TRTC#startLocalAudio startLocalAudio()} is successful and can be called multiple times.
1428
- * - This method uses incremental update: only update the passed parameters, and keep the parameters that are not passed unchanged.
1429
- * @param {object} [config]
1430
- * @param {boolean} [config.publish] - Whether to publish local audio to the room. You can get the publish state by listening this event {@link module:EVENT.PUBLISH_STATE_CHANGED PUBLISH_STATE_CHANGED}.
1431
- * @param {boolean} [config.mute] - Whether to mute microphone. Refer to: {@tutorial 15-basic-dynamic-add-video}.
1432
- * @param {object} [config.option] - Local audio configuration
1433
- * @param {string} [config.option.microphoneId] - Specify which microphone to use to switch microphones.
1434
- * @param {MediaStreamTrack} [config.option.audioTrack] - Custom audioTrack. {@tutorial 20-advanced-customized-capture-rendering}.
1435
- * @param {number} [config.option.captureVolume] - Set the capture volume of microphone. The default value is 100. Setting above 100 enlarges the capture volume. Since v5.2.1+.
1436
- * @param {number} [config.option.earMonitorVolume] - Set the ear return volume, value range [0, 100], the local microphone is muted by default.
1437
- * @throws
1438
- * - {@link module:ERROR_CODE.INVALID_PARAMETER INVALID_PARAMETER}
1439
- * - {@link module:ERROR_CODE.DEVICE_ERROR DEVICE_ERROR}
1440
- * - {@link module:ERROR_CODE.OPERATION_FAILED OPERATION_FAILED}
1441
- * - {@link module:ERROR_CODE.OPERATION_ABORT OPERATION_ABORT}
1442
- * @example
1443
- * // Switch microphone
1444
- * const microphoneList = await TRTC.getMicrophoneList();
1445
- * if (microphoneList[1]) {
1446
- * await trtc.updateLocalAudio({ option: { microphoneId: microphoneList[1].deviceId }});
1447
- * }
1448
- * @memberof TRTC
1449
- */
1399
+ * Update the configuration of the local microphone.
1400
+ * - When to call: This interface needs to be called after {@link TRTC#startLocalAudio startLocalAudio()} is successful and can be called multiple times.
1401
+ * - This method uses incremental update: only update the passed parameters, and keep the parameters that are not passed unchanged.
1402
+ * @param {object} [config]
1403
+ * @param {boolean} [config.publish] - Whether to publish local audio to the room. You can get the publish state by listening this event {@link module:EVENT.PUBLISH_STATE_CHANGED PUBLISH_STATE_CHANGED}.
1404
+ * @param {boolean} [config.mute] - Whether to mute microphone. Refer to: {@tutorial 15-basic-dynamic-add-video}.
1405
+ * @param {object} [config.option] - Local audio configuration
1406
+ * @param {string} [config.option.microphoneId] - Specify which microphone to use to switch microphones.
1407
+ * @param {MediaStreamTrack} [config.option.audioTrack] - Custom audioTrack. {@tutorial 20-advanced-customized-capture-rendering}.
1408
+ * @param {number} [config.option.captureVolume] - Set the capture volume of microphone. The default value is 100. Setting above 100 enlarges the capture volume. Since v5.2.1+.
1409
+ * @param {number} [config.option.earMonitorVolume] - Set the ear return volume, value range [0, 100], the local microphone is muted by default.
1410
+ * @throws
1411
+ * - {@link module:ERROR_CODE.INVALID_PARAMETER INVALID_PARAMETER}
1412
+ * - {@link module:ERROR_CODE.DEVICE_ERROR DEVICE_ERROR}
1413
+ * - {@link module:ERROR_CODE.OPERATION_FAILED OPERATION_FAILED}
1414
+ * - {@link module:ERROR_CODE.OPERATION_ABORT OPERATION_ABORT}
1415
+ * @example
1416
+ * // Switch microphone
1417
+ * const microphoneList = await TRTC.getMicrophoneList();
1418
+ * if (microphoneList[1]) {
1419
+ * await trtc.updateLocalAudio({ option: { microphoneId: microphoneList[1].deviceId }});
1420
+ * }
1421
+ * @memberof TRTC
1422
+ */
1450
1423
  updateLocalAudio(config: UpdateLocalAudioConfig): Promise<void>;
1451
1424
  /**
1452
- * Stop collecting and publishing the local microphone.
1453
- * - If you just want to mute the microphone, please use updateLocalAudio({ mute: true }). Refer to: {@tutorial 15-basic-dynamic-add-video}.
1454
- * @throws {@link module:ERROR_CODE.OPERATION_ABORT OPERATION_ABORT}
1455
- * @example
1456
- * await trtc.stopLocalAudio();
1457
- */
1425
+ * Stop collecting and publishing the local microphone.
1426
+ * - If you just want to mute the microphone, please use updateLocalAudio({ mute: true }). Refer to: {@tutorial 15-basic-dynamic-add-video}.
1427
+ * @throws {@link module:ERROR_CODE.OPERATION_ABORT OPERATION_ABORT}
1428
+ * @example
1429
+ * await trtc.stopLocalAudio();
1430
+ */
1458
1431
  stopLocalAudio(): Promise<void>;
1459
1432
  /**
1460
- * @typedef {object|string} VideoProfile - Configuration for local video stream
1461
- *
1462
- * Video configuration parameters, can use preset values in string format or custom resolution and other parameters
1463
- * | Video Profile | Resolution (Width x Height) | Frame Rate (fps) | Bitrate (kbps) | Remarks |
1464
- * | :--- | :--- | :--- | :--- | :--- |
1465
- * | 120p | 160 x 120 | 15 | 200 ||
1466
- * | 180p | 320 x 180 | 15 | 350 ||
1467
- * | 240p | 320 x 240 | 15 | 400 ||
1468
- * | 360p | 640 x 360 | 15 | 800 ||
1469
- * | 480p | 640 x 480 | 15 | 900 ||
1470
- * | 720p | 1280 x 720 | 15 | 1500 ||
1471
- * | 1080p | 1920 x 1080 | 15 | 2000 ||
1472
- * | 1440p | 2560 x 1440 | 30 | 4860 ||
1473
- * | 4K | 3840 x 2160 | 30 | 9000 ||
1474
- * @property {number} width - Video width
1475
- * @property {number} height - Video height
1476
- * @property {number} frameRate - Video frame rate
1477
- * @property {number} bitrate - Video bitrate
1478
- * @example
1479
- * const config = {
1480
- * option: {
1481
- * profile: '480p',
1482
- * },
1483
- * }
1484
- * await trtc.startLocalVideo(config);
1485
- * @example
1486
- * const config = {
1487
- * option: {
1488
- * profile: {
1489
- * width: 640,
1490
- * height: 480,
1491
- * frameRate: 15,
1492
- * bitrate: 900,
1493
- * }
1494
- * }
1495
- * }
1496
- * await trtc.startLocalVideo(config);
1497
- */
1498
- /**
1499
- * Start collecting video from the local camera, play the camera's video on the specified HTMLElement tag, and publish the camera's video to the current room.
1500
- * - When to call: can be called before or after entering the room, but cannot be called repeatedly.
1501
- * - Only one camera can be started per trtc instance. If you need to start another camera for testing while one camera is already started, you can create multiple trtc instances to achieve this.
1433
+ * @typedef {object|string} VideoProfile - Configuration for local video stream
1434
+ *
1435
+ * Video configuration parameters, can use preset values in string format or custom resolution and other parameters
1436
+ * | Video Profile | Resolution (Width x Height) | Frame Rate (fps) | Bitrate (kbps) | Remarks |
1437
+ * | :--- | :--- | :--- | :--- | :--- |
1438
+ * | 120p | 160 x 120 | 15 | 200 ||
1439
+ * | 180p | 320 x 180 | 15 | 350 ||
1440
+ * | 240p | 320 x 240 | 15 | 400 ||
1441
+ * | 360p | 640 x 360 | 15 | 800 ||
1442
+ * | 480p | 640 x 480 | 15 | 900 ||
1443
+ * | 720p | 1280 x 720 | 15 | 1500 ||
1444
+ * | 1080p | 1920 x 1080 | 15 | 2000 ||
1445
+ * | 1440p | 2560 x 1440 | 30 | 4860 ||
1446
+ * | 4K | 3840 x 2160 | 30 | 9000 ||
1447
+ * @property {number} width - Video width
1448
+ * @property {number} height - Video height
1449
+ * @property {number} frameRate - Video frame rate
1450
+ * @property {number} bitrate - Video bitrate
1451
+ * @example
1452
+ * const config = {
1453
+ * option: {
1454
+ * profile: '480p',
1455
+ * },
1456
+ * }
1457
+ * await trtc.startLocalVideo(config);
1458
+ * @example
1459
+ * const config = {
1460
+ * option: {
1461
+ * profile: {
1462
+ * width: 640,
1463
+ * height: 480,
1464
+ * frameRate: 15,
1465
+ * bitrate: 900,
1466
+ * }
1467
+ * }
1468
+ * }
1469
+ * await trtc.startLocalVideo(config);
1470
+ */
1471
+ /**
1472
+ * Start collecting video from the local camera, play the camera's video on the specified HTMLElement tag, and publish the camera's video to the current room.
1473
+ * - When to call: can be called before or after entering the room, but cannot be called repeatedly.
1474
+ * - Only one camera can be started per trtc instance. If you need to start another camera for testing while one camera is already started, you can create multiple trtc instances to achieve this.
1502
1475
 
1503
- * @param {object} [config]
1504
- * @param {string | HTMLElement | HTMLElement[] | null} [config.view] - The HTMLElement instance or ID for local video preview. If not passed or passed as null, the video will not be played.
1505
- * @param {boolean} [config.publish] - Whether to publish the local video to the room. If you call this interface before entering the room and publish = true, the SDK will automatically publish after entering the room. You can get the publish state by listening this event {@link module:EVENT.PUBLISH_STATE_CHANGED PUBLISH_STATE_CHANGED}.
1506
- * @param {boolean | string} [config.mute] - Whether to mute camera. Supports passing in image url string, the image will be published instead of origin camera stream, Other users in the room will receive the REMOTE_AUDIO_AVAILABLE event. It does not support calling when the camera is turned off. More information: {@tutorial 15-basic-dynamic-add-video}.
1507
- * @param {object} [config.option] - Local video configuration
1508
- * @param {string} [config.option.cameraId] - Specify which camera to use for switching cameras.
1509
- * @param {boolean} [config.option.useFrontCamera] - Whether to use the front camera.
1510
- * @param {MediaStreamTrack} [config.option.videoTrack] - Custom videoTrack. {@tutorial 20-advanced-customized-capture-rendering}.
1511
- * @param {'view' | 'publish' | 'both' | boolean} [config.option.mirror] - Video mirroring mode, default is 'view'.
1512
- * - 'view': You see yourself as a mirror image, and the other person sees you as a non-mirror image.
1513
- * - 'publish': The other person sees you as a mirror image, and you see yourself as a non-mirror image.
1514
- * - 'both': You see yourself as a mirror image, and the other person sees you as a mirror image.
1515
- * - false: Boolean value, represents no mirroring.
1516
- *
1517
- * <font color="orange"> Note: Before version 5.3.2, only boolean can be passed, where true represents local preview mirroring, and false represents no mirroring.</font>
1518
- * @param {'contain' | 'cover' | 'fill'} [config.option.fillMode] - Video fill mode. The default is `cover`. Refer to the {@link https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit CSS object-fit} property.
1519
- * @param {string | VideoProfile} [config.option.profile] - Video encoding parameters for the main video.
1520
- * @param {string | boolean | VideoProfile} [config.option.small] - Video encoding parameters for the small video. Refer to {@tutorial 27-advanced-small-stream}
1521
- * @param {QOS_PREFERENCE_SMOOTH|QOS_PREFERENCE_CLEAR} [config.option.qosPreference] - Set the video encoding strategy for weak networks. Smooth first(default) ({@link module:TYPE.QOS_PREFERENCE_SMOOTH QOS_PREFERENCE_SMOOTH}) or Clear first ({@link module:TYPE.QOS_PREFERENCE_CLEAR QOS_ PREFERENCE_SMOOTH})
1522
- * @throws
1523
- * - {@link module:ERROR_CODE.ENV_NOT_SUPPORTED ENV_NOT_SUPPORTED}
1524
- * - {@link module:ERROR_CODE.INVALID_PARAMETER INVALID_PARAMETER}
1525
- * - {@link module:ERROR_CODE.DEVICE_ERROR DEVICE_ERROR}
1526
- * - {@link module:ERROR_CODE.OPERATION_FAILED OPERATION_FAILED}
1527
- * - {@link module:ERROR_CODE.OPERATION_ABORT OPERATION_ABORT}
1528
- * - {@link module:ERROR_CODE.SERVER_ERROR SERVER_ERROR}
1529
- * @example
1530
- * // Preview and publish the camera
1531
- * await trtc.startLocalVideo({
1532
- * view: document.getElementById('localVideo'), // Preview the video on the element with the DOM elementId of localVideo.
1533
- * });
1534
- * @example
1535
- * // Preview the camera without publishing. Can be used for camera testing.
1536
- * const config = {
1537
- * view: document.getElementById('localVideo'), // Preview the video on the element with the DOM elementId of localVideo.
1538
- * publish: false // Do not publish the camera
1539
- * }
1540
- * await trtc.startLocalVideo(config);
1541
- * // Call updateLocalVideo when you need to publish the video
1542
- * await trtc.updateLocalVideo({ publish:true });
1543
- * @example
1544
- * // Use a specified camera.
1545
- * const cameraList = await TRTC.getCameraList();
1546
- * if (cameraList[0]) {
1547
- * await trtc.startLocalVideo({
1548
- * view: document.getElementById('localVideo'), // Preview the video on the element with the DOM elementId of localVideo.
1549
- * option: {
1550
- * cameraId: cameraList[0].deviceId,
1551
- * }
1552
- * });
1553
- * }
1554
- *
1555
- * // use front camera on mobile device.
1556
- * await trtc.startLocalVideo({ view, option: { useFrontCamera: true }});
1557
- * // use rear camera on mobile device.
1558
- * await trtc.startLocalVideo({ view, option: { useFrontCamera: false }});
1559
- * @memberof TRTC
1560
- */
1476
+ * @param {object} [config]
1477
+ * @param {string | HTMLElement | HTMLElement[] | null} [config.view] - The HTMLElement instance or ID for local video preview. If not passed or passed as null, the video will not be played.
1478
+ * @param {boolean} [config.publish] - Whether to publish the local video to the room. If you call this interface before entering the room and publish = true, the SDK will automatically publish after entering the room. You can get the publish state by listening this event {@link module:EVENT.PUBLISH_STATE_CHANGED PUBLISH_STATE_CHANGED}.
1479
+ * @param {boolean | string} [config.mute] - Whether to mute camera. Supports passing in image url string, the image will be published instead of origin camera stream, Other users in the room will receive the REMOTE_AUDIO_AVAILABLE event. It does not support calling when the camera is turned off. More information: {@tutorial 15-basic-dynamic-add-video}.
1480
+ * @param {object} [config.option] - Local video configuration
1481
+ * @param {string} [config.option.cameraId] - Specify which camera to use for switching cameras.
1482
+ * @param {boolean} [config.option.useFrontCamera] - Whether to use the front camera.
1483
+ * @param {MediaStreamTrack} [config.option.videoTrack] - Custom videoTrack. {@tutorial 20-advanced-customized-capture-rendering}.
1484
+ * @param {'view' | 'publish' | 'both' | boolean} [config.option.mirror] - Video mirroring mode, default is 'view'.
1485
+ * - 'view': You see yourself as a mirror image, and the other person sees you as a non-mirror image.
1486
+ * - 'publish': The other person sees you as a mirror image, and you see yourself as a non-mirror image.
1487
+ * - 'both': You see yourself as a mirror image, and the other person sees you as a mirror image.
1488
+ * - false: Boolean value, represents no mirroring.
1489
+ *
1490
+ * <font color="orange"> Note: Before version 5.3.2, only boolean can be passed, where true represents local preview mirroring, and false represents no mirroring.</font>
1491
+ * @param {'contain' | 'cover' | 'fill'} [config.option.fillMode] - Video fill mode. The default is `cover`. Refer to the {@link https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit CSS object-fit} property.
1492
+ * @param {string | VideoProfile} [config.option.profile] - Video encoding parameters for the main video.
1493
+ * @param {string | boolean | VideoProfile} [config.option.small] - Video encoding parameters for the small video. Refer to {@tutorial 27-advanced-small-stream}
1494
+ * @param {QOS_PREFERENCE_SMOOTH|QOS_PREFERENCE_CLEAR} [config.option.qosPreference] - Set the video encoding strategy for weak networks. Smooth first(default) ({@link module:TYPE.QOS_PREFERENCE_SMOOTH QOS_PREFERENCE_SMOOTH}) or Clear first ({@link module:TYPE.QOS_PREFERENCE_CLEAR QOS_ PREFERENCE_SMOOTH})
1495
+ * @throws
1496
+ * - {@link module:ERROR_CODE.ENV_NOT_SUPPORTED ENV_NOT_SUPPORTED}
1497
+ * - {@link module:ERROR_CODE.INVALID_PARAMETER INVALID_PARAMETER}
1498
+ * - {@link module:ERROR_CODE.DEVICE_ERROR DEVICE_ERROR}
1499
+ * - {@link module:ERROR_CODE.OPERATION_FAILED OPERATION_FAILED}
1500
+ * - {@link module:ERROR_CODE.OPERATION_ABORT OPERATION_ABORT}
1501
+ * - {@link module:ERROR_CODE.SERVER_ERROR SERVER_ERROR}
1502
+ * @example
1503
+ * // Preview and publish the camera
1504
+ * await trtc.startLocalVideo({
1505
+ * view: document.getElementById('localVideo'), // Preview the video on the element with the DOM elementId of localVideo.
1506
+ * });
1507
+ * @example
1508
+ * // Preview the camera without publishing. Can be used for camera testing.
1509
+ * const config = {
1510
+ * view: document.getElementById('localVideo'), // Preview the video on the element with the DOM elementId of localVideo.
1511
+ * publish: false // Do not publish the camera
1512
+ * }
1513
+ * await trtc.startLocalVideo(config);
1514
+ * // Call updateLocalVideo when you need to publish the video
1515
+ * await trtc.updateLocalVideo({ publish:true });
1516
+ * @example
1517
+ * // Use a specified camera.
1518
+ * const cameraList = await TRTC.getCameraList();
1519
+ * if (cameraList[0]) {
1520
+ * await trtc.startLocalVideo({
1521
+ * view: document.getElementById('localVideo'), // Preview the video on the element with the DOM elementId of localVideo.
1522
+ * option: {
1523
+ * cameraId: cameraList[0].deviceId,
1524
+ * }
1525
+ * });
1526
+ * }
1527
+ *
1528
+ * // use front camera on mobile device.
1529
+ * await trtc.startLocalVideo({ view, option: { useFrontCamera: true }});
1530
+ * // use rear camera on mobile device.
1531
+ * await trtc.startLocalVideo({ view, option: { useFrontCamera: false }});
1532
+ * @memberof TRTC
1533
+ */
1561
1534
  startLocalVideo(config?: LocalVideoConfig): Promise<void>;
1562
1535
  /**
1563
- * Update the local camera configuration.
1564
- * - This interface needs to be called after {@link TRTC#startLocalVideo startLocalVideo()} is successful.
1565
- * - This interface can be called multiple times.
1566
- * - This method uses incremental update: only updates the passed-in parameters, and keeps the parameters that are not passed in unchanged.
1567
- * @param {object} [config]
1568
- * @param {string | HTMLElement | HTMLElement[] | null} [config.view] - The HTMLElement instance or Id of the preview camera. If not passed in or passed in null, the video will not be rendered, but the container that consumes bandwidth will still be pushed.
1569
- * @param {boolean} [config.publish] - Whether to publish the local video to the room. You can get the publish state by listening this event {@link module:EVENT.PUBLISH_STATE_CHANGED PUBLISH_STATE_CHANGED}.
1570
- * @param {boolean | string} [config.mute] - Whether to mute camera. Supports passing in image url string, the image will be published instead of origin camera stream, Other users in the room will receive the REMOTE_AUDIO_AVAILABLE event. It does not support calling when the camera is turned off. More information: {@tutorial 15-basic-dynamic-add-video}.
1571
- * @param {object} [config.option] - Local video configuration
1572
- * @param {string} [config.option.cameraId] - Specify which camera to use
1573
- * @param {boolean} [config.option.useFrontCamera] - Whether to use the front camera
1574
- * @param {MediaStreamTrack} [config.option.videoTrack] - Custom videoTrack. {@tutorial 20-advanced-customized-capture-rendering}.
1575
- * @param {'view' | 'publish' | 'both' | boolean} [config.option.mirror] - Video mirroring mode, default is 'view'.
1576
- * - 'view': You see yourself as a mirror image, and the other person sees you as a non-mirror image.
1577
- * - 'publish': The other person sees you as a mirror image, and you see yourself as a non-mirror image.
1578
- * - 'both': You see yourself as a mirror image, and the other person sees you as a mirror image.
1579
- * - false: Boolean value, represents no mirroring.
1580
- * @param {'contain' | 'cover' | 'fill'} [config.option.fillMode] - Video fill mode. Refer to the {@link https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit| CSS object-fit} property
1581
- * @param {string | VideoProfile} [config.option.profile] - Video encoding parameters for the main stream
1582
- * @param {string | boolean | VideoProfile} [config.option.small] - Video encoding parameters for the small video. Refer to {@tutorial 27-advanced-small-stream}
1583
- * @param {QOS_PREFERENCE_SMOOTH|QOS_PREFERENCE_CLEAR} [config.option.qosPreference] - Set the video encoding strategy for weak networks. Smooth first ({@link module:TYPE.QOS_PREFERENCE_SMOOTH QOS_PREFERENCE_SMOOTH}) or Clear first ({@link module:TYPE.QOS_PREFERENCE_CLEAR QOS_ PREFERENCE_SMOOTH})
1584
- * @throws
1585
- * - {@link module:ERROR_CODE.INVALID_PARAMETER INVALID_PARAMETER}
1586
- * - {@link module:ERROR_CODE.DEVICE_ERROR DEVICE_ERROR}
1587
- * - {@link module:ERROR_CODE.OPERATION_FAILED OPERATION_FAILED}
1588
- * - {@link module:ERROR_CODE.OPERATION_ABORT OPERATION_ABORT}
1589
- * @example
1590
- * // Switch camera
1591
- * const cameraList = await TRTC.getCameraList();
1592
- * if (cameraList[1]) {
1593
- * await trtc.updateLocalVideo({ option: { cameraId: cameraList[1].deviceId }});
1594
- * }
1595
- * @example
1596
- * // Stop publishing video, but keep local preview
1597
- * await trtc.updateLocalVideo({ publish:false });
1598
- * @memberof TRTC
1599
- */
1536
+ * Update the local camera configuration.
1537
+ * - This interface needs to be called after {@link TRTC#startLocalVideo startLocalVideo()} is successful.
1538
+ * - This interface can be called multiple times.
1539
+ * - This method uses incremental update: only updates the passed-in parameters, and keeps the parameters that are not passed in unchanged.
1540
+ * @param {object} [config]
1541
+ * @param {string | HTMLElement | HTMLElement[] | null} [config.view] - The HTMLElement instance or Id of the preview camera. If not passed in or passed in null, the video will not be rendered, but the container that consumes bandwidth will still be pushed.
1542
+ * @param {boolean} [config.publish] - Whether to publish the local video to the room. You can get the publish state by listening this event {@link module:EVENT.PUBLISH_STATE_CHANGED PUBLISH_STATE_CHANGED}.
1543
+ * @param {boolean | string} [config.mute] - Whether to mute camera. Supports passing in image url string, the image will be published instead of origin camera stream, Other users in the room will receive the REMOTE_AUDIO_AVAILABLE event. It does not support calling when the camera is turned off. More information: {@tutorial 15-basic-dynamic-add-video}.
1544
+ * @param {object} [config.option] - Local video configuration
1545
+ * @param {string} [config.option.cameraId] - Specify which camera to use
1546
+ * @param {boolean} [config.option.useFrontCamera] - Whether to use the front camera
1547
+ * @param {MediaStreamTrack} [config.option.videoTrack] - Custom videoTrack. {@tutorial 20-advanced-customized-capture-rendering}.
1548
+ * @param {'view' | 'publish' | 'both' | boolean} [config.option.mirror] - Video mirroring mode, default is 'view'.
1549
+ * - 'view': You see yourself as a mirror image, and the other person sees you as a non-mirror image.
1550
+ * - 'publish': The other person sees you as a mirror image, and you see yourself as a non-mirror image.
1551
+ * - 'both': You see yourself as a mirror image, and the other person sees you as a mirror image.
1552
+ * - false: Boolean value, represents no mirroring.
1553
+ * @param {'contain' | 'cover' | 'fill'} [config.option.fillMode] - Video fill mode. Refer to the {@link https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit| CSS object-fit} property
1554
+ * @param {string | VideoProfile} [config.option.profile] - Video encoding parameters for the main stream
1555
+ * @param {string | boolean | VideoProfile} [config.option.small] - Video encoding parameters for the small video. Refer to {@tutorial 27-advanced-small-stream}
1556
+ * @param {QOS_PREFERENCE_SMOOTH|QOS_PREFERENCE_CLEAR} [config.option.qosPreference] - Set the video encoding strategy for weak networks. Smooth first ({@link module:TYPE.QOS_PREFERENCE_SMOOTH QOS_PREFERENCE_SMOOTH}) or Clear first ({@link module:TYPE.QOS_PREFERENCE_CLEAR QOS_ PREFERENCE_SMOOTH})
1557
+ * @throws
1558
+ * - {@link module:ERROR_CODE.INVALID_PARAMETER INVALID_PARAMETER}
1559
+ * - {@link module:ERROR_CODE.DEVICE_ERROR DEVICE_ERROR}
1560
+ * - {@link module:ERROR_CODE.OPERATION_FAILED OPERATION_FAILED}
1561
+ * - {@link module:ERROR_CODE.OPERATION_ABORT OPERATION_ABORT}
1562
+ * @example
1563
+ * // Switch camera
1564
+ * const cameraList = await TRTC.getCameraList();
1565
+ * if (cameraList[1]) {
1566
+ * await trtc.updateLocalVideo({ option: { cameraId: cameraList[1].deviceId }});
1567
+ * }
1568
+ * @example
1569
+ * // Stop publishing video, but keep local preview
1570
+ * await trtc.updateLocalVideo({ publish:false });
1571
+ * @memberof TRTC
1572
+ */
1600
1573
  updateLocalVideo(config: LocalVideoConfig): Promise<void>;
1601
1574
  /**
1602
- * Stop capturing, previewing, and publishing the local camera.
1603
- * - If you only want to stop publishing video but keep the local camera preview, you can use the {@link TRTC#updateLocalVideo updateLocalVideo({ publish:false })} method.<br>
1604
- * @throws {@link module:ERROR_CODE.OPERATION_ABORT OPERATION_ABORT}
1605
- * @example
1606
- * await trtc.stopLocalVideo();
1607
- */
1575
+ * Stop capturing, previewing, and publishing the local camera.
1576
+ * - If you only want to stop publishing video but keep the local camera preview, you can use the {@link TRTC#updateLocalVideo updateLocalVideo({ publish:false })} method.<br>
1577
+ * @throws {@link module:ERROR_CODE.OPERATION_ABORT OPERATION_ABORT}
1578
+ * @example
1579
+ * await trtc.stopLocalVideo();
1580
+ */
1608
1581
  stopLocalVideo(): Promise<void>;
1609
1582
  /**
1610
- * @typedef {object|string} ScreenShareProfile - Screen sharing resolution, bit rate, and frame rate configuration
1611
- * Screen sharing configuration parameters, can use preset values or custom resolution and other parameters
1612
- * | Screen Profile | Resolution (width x height) | Frame Rate (fps) | Bitrate (kbps) |
1613
- * | :--- | :--- | :--- | :--- |
1614
- * | 480p | 640 x 480 | 5 | 900 |
1615
- * | 480p_2 | 640 x 480 | 30 | 1000 |
1616
- * | 720p | 1280 x 720 | 5 | 1200 |
1617
- * | 720p_2 | 1280 x 720 | 30 | 3000 |
1618
- * | 1080p | 1920 x 1080 | 5 | 1600 |
1619
- * | 1080p_2 | 1920 x 1080 | 30 | 4000 |
1620
- * - The default resolution for screen sharing is `1080p`.
1621
- * - If the above profiles do not meet your business needs, you can also specify custom resolution, frame rate, and bitrate.
1583
+ * @typedef {object|string} ScreenShareProfile - Screen sharing resolution, bit rate, and frame rate configuration
1584
+ * Screen sharing configuration parameters, can use preset values or custom resolution and other parameters
1585
+ * | Screen Profile | Resolution (width x height) | Frame Rate (fps) | Bitrate (kbps) |
1586
+ * | :--- | :--- | :--- | :--- |
1587
+ * | 480p | 640 x 480 | 5 | 900 |
1588
+ * | 480p_2 | 640 x 480 | 30 | 1000 |
1589
+ * | 720p | 1280 x 720 | 5 | 1200 |
1590
+ * | 720p_2 | 1280 x 720 | 30 | 3000 |
1591
+ * | 1080p | 1920 x 1080 | 5 | 1600 |
1592
+ * | 1080p_2 | 1920 x 1080 | 30 | 4000 |
1593
+ * - The default resolution for screen sharing is `1080p`.
1594
+ * - If the above profiles do not meet your business needs, you can also specify custom resolution, frame rate, and bitrate.
1622
1595
 
1623
- * @property {number} width - Screen sharing width
1624
- * @property {number} height - Screen sharing height
1625
- * @property {number} frameRate - Screen sharing frame rate
1626
- * @property {number} bitrate - Screen sharing bitrate
1627
- * @example
1628
- * const config = {
1629
- * option: {
1630
- * profile: '720p',
1631
- * },
1632
- * }
1633
- * await trtc.startScreenShare(config);
1634
- */
1635
- /**
1636
- * Start screen sharing.
1637
- *
1638
- * - After starting screen sharing, other users in the room will receive the {@link module:EVENT.REMOTE_VIDEO_AVAILABLE REMOTE_VIDEO_AVAILABLE} event, with streamType as {@link module:TYPE.STREAM_TYPE_SUB STREAM_TYPE_SUB}, and other users can play screen sharing through {@link TRTC#startRemoteVideo startRemoteVideo}.
1639
- * @param {object} [config]
1640
- * @param {string | HTMLElement | HTMLElement[] | null} [config.view] - The HTMLElement instance or Id for previewing local screen sharing. If not passed or passed as null, local screen sharing will not be rendered.
1641
- * @param {boolean} [config.publish] - Whether to publish screen sharing to the room. The default is true. If you call this interface before entering the room and publish = true, the SDK will automatically publish after entering the room. You can get the publish state by listening this event {@link module:EVENT.PUBLISH_STATE_CHANGED PUBLISH_STATE_CHANGED}.
1642
- * @param {object} [config.option] - Screen sharing configuration
1643
- * @param {boolean} [config.option.systemAudio] - Whether to capture system audio. The default is false.
1644
- * @param {'contain' | 'cover' | 'fill'} [config.option.fillMode] - Video fill mode. The default is `contain`, refer to {@link https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit CSS object-fit} property.
1645
- * @param {ScreenShareProfile} [config.option.profile] - Screen sharing encoding configuration.
1646
- * @param {QOS_PREFERENCE_SMOOTH|QOS_PREFERENCE_CLEAR} [config.option.qosPreference] - Set the video encoding strategy for weak networks. Smooth first ({@link module:TYPE.QOS_PREFERENCE_SMOOTH QOS_PREFERENCE_SMOOTH}) or Clear first(default) ({@link module:TYPE.QOS_PREFERENCE_CLEAR QOS_ PREFERENCE_SMOOTH})
1647
- * @param {HTMLElement} [config.option.captureElement] - Capture screen from the specified element of current tab. Available on Chrome 104+.
1648
- * @param {'current-tab' | 'tab' | 'window' | 'monitor'} [config.option.preferDisplaySurface='monitor'] - The prefer display surface for screen sharing. Available on Chrome 94+.
1649
- * - The default is monitor, which means that monitor capture will be displayed first in the Screen Sharing Capture pre-checkbox.
1650
- * - If you fill in 'current-tab', the pre-checkbox will only show the current page.
1651
- * @throws
1652
- * - {@link module:ERROR_CODE.ENV_NOT_SUPPORTED ENV_NOT_SUPPORTED}
1653
- * - {@link module:ERROR_CODE.INVALID_PARAMETER INVALID_PARAMETER}
1654
- * - {@link module:ERROR_CODE.DEVICE_ERROR DEVICE_ERROR}
1655
- * - {@link module:ERROR_CODE.OPERATION_FAILED OPERATION_FAILED}
1656
- * - {@link module:ERROR_CODE.OPERATION_ABORT OPERATION_ABORT}
1657
- * - {@link module:ERROR_CODE.SERVER_ERROR SERVER_ERROR}
1658
- * @example
1659
- * // Start screen sharing
1660
- * await trtc.startScreenShare();
1661
- * @memberof TRTC
1662
- */
1596
+ * @property {number} width - Screen sharing width
1597
+ * @property {number} height - Screen sharing height
1598
+ * @property {number} frameRate - Screen sharing frame rate
1599
+ * @property {number} bitrate - Screen sharing bitrate
1600
+ * @example
1601
+ * const config = {
1602
+ * option: {
1603
+ * profile: '720p',
1604
+ * },
1605
+ * }
1606
+ * await trtc.startScreenShare(config);
1607
+ */
1608
+ /**
1609
+ * Start screen sharing.
1610
+ *
1611
+ * - After starting screen sharing, other users in the room will receive the {@link module:EVENT.REMOTE_VIDEO_AVAILABLE REMOTE_VIDEO_AVAILABLE} event, with streamType as {@link module:TYPE.STREAM_TYPE_SUB STREAM_TYPE_SUB}, and other users can play screen sharing through {@link TRTC#startRemoteVideo startRemoteVideo}.
1612
+ * @param {object} [config]
1613
+ * @param {string | HTMLElement | HTMLElement[] | null} [config.view] - The HTMLElement instance or Id for previewing local screen sharing. If not passed or passed as null, local screen sharing will not be rendered.
1614
+ * @param {boolean} [config.publish] - Whether to publish screen sharing to the room. The default is true. If you call this interface before entering the room and publish = true, the SDK will automatically publish after entering the room. You can get the publish state by listening this event {@link module:EVENT.PUBLISH_STATE_CHANGED PUBLISH_STATE_CHANGED}.
1615
+ * @param {object} [config.option] - Screen sharing configuration
1616
+ * @param {boolean} [config.option.systemAudio] - Whether to capture system audio. The default is false.
1617
+ * @param {'contain' | 'cover' | 'fill'} [config.option.fillMode] - Video fill mode. The default is `contain`, refer to {@link https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit CSS object-fit} property.
1618
+ * @param {ScreenShareProfile} [config.option.profile] - Screen sharing encoding configuration.
1619
+ * @param {QOS_PREFERENCE_SMOOTH|QOS_PREFERENCE_CLEAR} [config.option.qosPreference] - Set the video encoding strategy for weak networks. Smooth first ({@link module:TYPE.QOS_PREFERENCE_SMOOTH QOS_PREFERENCE_SMOOTH}) or Clear first(default) ({@link module:TYPE.QOS_PREFERENCE_CLEAR QOS_ PREFERENCE_SMOOTH})
1620
+ * @param {HTMLElement} [config.option.captureElement] - Capture screen from the specified element of current tab. Available on Chrome 104+.
1621
+ * @param {'current-tab' | 'tab' | 'window' | 'monitor'} [config.option.preferDisplaySurface='monitor'] - The prefer display surface for screen sharing. Available on Chrome 94+.
1622
+ * - The default is monitor, which means that monitor capture will be displayed first in the Screen Sharing Capture pre-checkbox
1623
+ * - If you fill in 'current-tab', the pre-checkbox will only show the current page.
1624
+ * @throws
1625
+ * - {@link module:ERROR_CODE.ENV_NOT_SUPPORTED ENV_NOT_SUPPORTED}
1626
+ * - {@link module:ERROR_CODE.INVALID_PARAMETER INVALID_PARAMETER}
1627
+ * - {@link module:ERROR_CODE.DEVICE_ERROR DEVICE_ERROR}
1628
+ * - {@link module:ERROR_CODE.OPERATION_FAILED OPERATION_FAILED}
1629
+ * - {@link module:ERROR_CODE.OPERATION_ABORT OPERATION_ABORT}
1630
+ * - {@link module:ERROR_CODE.SERVER_ERROR SERVER_ERROR}
1631
+ * @example
1632
+ * // Start screen sharing
1633
+ * await trtc.startScreenShare();
1634
+ * @memberof TRTC
1635
+ */
1663
1636
  startScreenShare(config?: ScreenShareConfig): Promise<void>;
1664
1637
  /**
1665
- * Update screen sharing configuration
1666
- * - This interface needs to be called after {@link TRTC#startScreenShare startScreenShare()} is successful.
1667
- * - This interface can be called multiple times.
1668
- * - This method uses incremental update: only update the passed-in parameters, and keep the parameters that are not passed-in unchanged.
1669
- * @param {object} [config]
1670
- * @param {string | HTMLElement | HTMLElement[] | null} [config.view] - The HTMLElement instance or Id for screen sharing preview. If not passed in or passed in null, the screen sharing will not be rendered.
1671
- * @param {boolean} [config.publish=true] - Whether to publish screen sharing to the room
1672
- * @param {object} [config.option] - Screen sharing configuration
1673
- * @param {'contain' | 'cover' | 'fill'} [config.option.fillMode] - Video fill mode. The default is `contain`, refer to {@link https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit CSS object-fit} property.
1674
- * @param {QOS_PREFERENCE_SMOOTH|QOS_PREFERENCE_CLEAR} [config.option.qosPreference] - Set the video encoding strategy for weak networks. Smooth first ({@link module:TYPE.QOS_PREFERENCE_SMOOTH QOS_PREFERENCE_SMOOTH}) or Clear first ({@link module:TYPE.QOS_PREFERENCE_CLEAR QOS_ PREFERENCE_SMOOTH})
1675
- * @throws
1676
- * - {@link module:ERROR_CODE.INVALID_PARAMETER INVALID_PARAMETER}
1677
- * - {@link module:ERROR_CODE.DEVICE_ERROR DEVICE_ERROR}
1678
- * - {@link module:ERROR_CODE.OPERATION_FAILED OPERATION_FAILED}
1679
- * - {@link module:ERROR_CODE.OPERATION_ABORT OPERATION_ABORT}
1680
- * - {@link module:ERROR_CODE.SERVER_ERROR SERVER_ERROR}
1681
- * @example
1682
- * // Stop screen sharing, but keep the local preview of screen sharing
1683
- * await trtc.updateScreenShare({ publish:false });
1684
- * @memberof TRTC
1685
- */
1638
+ * Update screen sharing configuration
1639
+ * - This interface needs to be called after {@link TRTC#startScreenShare startScreenShare()} is successful.
1640
+ * - This interface can be called multiple times.
1641
+ * - This method uses incremental update: only update the passed-in parameters, and keep the parameters that are not passed-in unchanged.
1642
+ * @param {object} [config]
1643
+ * @param {string | HTMLElement | HTMLElement[] | null} [config.view] - The HTMLElement instance or Id for screen sharing preview. If not passed in or passed in null, the screen sharing will not be rendered.
1644
+ * @param {boolean} [config.publish=true] - Whether to publish screen sharing to the room
1645
+ * @param {object} [config.option] - Screen sharing configuration
1646
+ * @param {'contain' | 'cover' | 'fill'} [config.option.fillMode] - Video fill mode. The default is `contain`, refer to {@link https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit CSS object-fit} property.
1647
+ * @param {QOS_PREFERENCE_SMOOTH|QOS_PREFERENCE_CLEAR} [config.option.qosPreference] - Set the video encoding strategy for weak networks. Smooth first ({@link module:TYPE.QOS_PREFERENCE_SMOOTH QOS_PREFERENCE_SMOOTH}) or Clear first ({@link module:TYPE.QOS_PREFERENCE_CLEAR QOS_ PREFERENCE_SMOOTH})
1648
+ * @throws
1649
+ * - {@link module:ERROR_CODE.INVALID_PARAMETER INVALID_PARAMETER}
1650
+ * - {@link module:ERROR_CODE.DEVICE_ERROR DEVICE_ERROR}
1651
+ * - {@link module:ERROR_CODE.OPERATION_FAILED OPERATION_FAILED}
1652
+ * - {@link module:ERROR_CODE.OPERATION_ABORT OPERATION_ABORT}
1653
+ * - {@link module:ERROR_CODE.SERVER_ERROR SERVER_ERROR}
1654
+ * @example
1655
+ * // Stop screen sharing, but keep the local preview of screen sharing
1656
+ * await trtc.updateScreenShare({ publish:false });
1657
+ * @memberof TRTC
1658
+ */
1686
1659
  updateScreenShare(config: UpdateScreenShareConfig): Promise<void>;
1687
1660
  /**
1688
- * Stop screen sharing.
1661
+ * Stop screen sharing.
1689
1662
 
1690
- * @throws {@link module:ERROR_CODE.OPERATION_ABORT OPERATION_ABORT}
1691
- * @example
1692
- * await trtc.stopScreenShare();
1693
- */
1663
+ * @throws {@link module:ERROR_CODE.OPERATION_ABORT OPERATION_ABORT}
1664
+ * @example
1665
+ * await trtc.stopScreenShare();
1666
+ */
1694
1667
  stopScreenShare(): Promise<void>;
1695
1668
  /**
1696
- * Play remote video
1697
- *
1698
- * - When to call: Call after receiving the {@link module:EVENT.REMOTE_VIDEO_AVAILABLE TRTC.on(TRTC.EVENT.REMOTE_VIDEO_AVAILABLE)} event.
1699
- * @param {object} [config]
1700
- * @param {string | HTMLElement | HTMLElement[] | null} [config.view] - The HTMLElement instance or Id used to play remote video. If not passed or passed null, the video will not be rendered, but the bandwidth will still be consumed.
1701
- * @param {string} config.userId - Remote user ID
1702
- * @param {TRTC.TYPE.STREAM_TYPE_MAIN|TRTC.TYPE.STREAM_TYPE_SUB} config.streamType - Remote stream type
1703
- * - {@link module:TYPE.STREAM_TYPE_MAIN TRTC.TYPE.STREAM_TYPE_MAIN}: Main stream (remote user's camera)
1704
- * - {@link module:TYPE.STREAM_TYPE_SUB TRTC.TYPE.STREAM_TYPE_SUB}: Sub stream (remote user's screen sharing)
1705
- * @param {object} [config.option] - Remote video configuration
1706
- * @param {boolean} [config.option.small] - Whether to subscribe small streams
1707
- * @param {boolean} [config.option.mirror] - Whether to enable mirror
1708
- * @param {'contain' | 'cover' | 'fill'} [config.option.fillMode] - Video fill mode. Refer to the {@link https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit CSS object-fit} property.
1709
- * @param {boolean} [config.option.receiveWhenViewVisible] - Since v5.4.0 <br>Subscribe video only when view is visible. Refer to: {@tutorial 27-advanced-small-stream}.
1710
- * @param {HTMLElement} [config.option.viewRoot=document.body] - Since v5.4.0 <br>The root element is the parent element of the view and is used to calculate whether the view is visible relative to the root. The default value is document.body, and it is recommended that you use the first-level parent of the video view list. Refer to: {@tutorial 27-advanced-small-stream}.
1711
- * @throws
1712
- * - {@link module:ERROR_CODE.INVALID_PARAMETER INVALID_PARAMETER}
1713
- * - {@link module:ERROR_CODE.INVALID_OPERATION INVALID_OPERATION}
1714
- * - {@link module:ERROR_CODE.OPERATION_FAILED OPERATION_FAILED}
1715
- * - {@link module:ERROR_CODE.OPERATION_ABORT OPERATION_ABORT}
1716
- * - {@link module:ERROR_CODE.SERVER_ERROR SERVER_ERROR}
1717
- * @example
1718
- * trtc.on(TRTC.EVENT.REMOTE_VIDEO_AVAILABLE, ({ userId, streamType }) => {
1719
- * // You need to place the video container in the DOM in advance, and it is recommended to use `${userId}_${streamType}` as the element id.
1720
- * trtc.startRemoteVideo({ userId, streamType, view: `${userId}_${streamType}` });
1721
- * })
1722
- * @memberof TRTC
1723
- */
1669
+ * Play remote video
1670
+ *
1671
+ * - When to call: Call after receiving the {@link module:EVENT.REMOTE_VIDEO_AVAILABLE TRTC.on(TRTC.EVENT.REMOTE_VIDEO_AVAILABLE)} event.
1672
+ * @param {object} [config]
1673
+ * @param {string | HTMLElement | HTMLElement[] | null} [config.view] - The HTMLElement instance or Id used to play remote video. If not passed or passed null, the video will not be rendered, but the bandwidth will still be consumed.
1674
+ * @param {string} config.userId - Remote user ID
1675
+ * @param {TRTC.TYPE.STREAM_TYPE_MAIN|TRTC.TYPE.STREAM_TYPE_SUB} config.streamType - Remote stream type
1676
+ * - {@link module:TYPE.STREAM_TYPE_MAIN TRTC.TYPE.STREAM_TYPE_MAIN}: Main stream (remote user's camera)
1677
+ * - {@link module:TYPE.STREAM_TYPE_SUB TRTC.TYPE.STREAM_TYPE_SUB}: Sub stream (remote user's screen sharing)
1678
+ * @param {object} [config.option] - Remote video configuration
1679
+ * @param {boolean} [config.option.small] - Whether to subscribe small streams
1680
+ * @param {boolean} [config.option.mirror] - Whether to enable mirror
1681
+ * @param {'contain' | 'cover' | 'fill'} [config.option.fillMode] - Video fill mode. Refer to the {@link https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit CSS object-fit} property.
1682
+ * @param {boolean} [config.option.receiveWhenViewVisible] - Since v5.4.0 <br>Subscribe video only when view is visible. Refer to: {@tutorial 27-advanced-small-stream}.
1683
+ * @param {HTMLElement} [config.option.viewRoot=document.body] - Since v5.4.0 <br>The root element is the parent element of the view and is used to calculate whether the view is visible relative to the root. The default value is document.body, and it is recommended that you use the first-level parent of the video view list. Refer to: {@tutorial 27-advanced-small-stream}.
1684
+ * @throws
1685
+ * - {@link module:ERROR_CODE.INVALID_PARAMETER INVALID_PARAMETER}
1686
+ * - {@link module:ERROR_CODE.INVALID_OPERATION INVALID_OPERATION}
1687
+ * - {@link module:ERROR_CODE.OPERATION_FAILED OPERATION_FAILED}
1688
+ * - {@link module:ERROR_CODE.OPERATION_ABORT OPERATION_ABORT}
1689
+ * - {@link module:ERROR_CODE.SERVER_ERROR SERVER_ERROR}
1690
+ * @example
1691
+ * trtc.on(TRTC.EVENT.REMOTE_VIDEO_AVAILABLE, ({ userId, streamType }) => {
1692
+ * // You need to place the video container in the DOM in advance, and it is recommended to use `${userId}_${streamType}` as the element id.
1693
+ * trtc.startRemoteVideo({ userId, streamType, view: `${userId}_${streamType}` });
1694
+ * })
1695
+ * @memberof TRTC
1696
+ */
1724
1697
  startRemoteVideo(config: RemoteVideoConfig): Promise<void>;
1725
1698
  /**
1726
- * Update remote video playback configuration<br>
1727
- * - This method should be called after {@link TRTC#startRemoteVideo startRemoteVideo} is successful.
1728
- * - This method can be called multiple times.
1729
- * - This method uses incremental updates, so only the configuration items that need to be updated need to be passed in.
1730
- * @param {object} [config]
1731
- * @param {string | HTMLElement | HTMLElement[] | null} [config.view] - The HTMLElement instance or Id used to play remote video. If not passed or passed null, the video will not be rendered, but the bandwidth will still be consumed.
1732
- * @param {string} config.userId - Remote user ID
1733
- * @param {TRTC.TYPE.STREAM_TYPE_MAIN|TRTC.TYPE.STREAM_TYPE_SUB} config.streamType - Remote stream type
1734
- * - {@link module:TYPE.STREAM_TYPE_MAIN TRTC.TYPE.STREAM_TYPE_MAIN}: Main stream (remote user's camera)
1735
- * - {@link module:TYPE.STREAM_TYPE_SUB TRTC.TYPE.STREAM_TYPE_SUB}: Sub stream (remote user's screen sharing)
1736
- * @param {object} [config.option] - Remote video configuration
1737
- * @param {boolean} [config.option.small] - Whether to subscribe small streams. Refer to: {@tutorial 27-advanced-small-stream}.
1738
- * @param {boolean} [config.option.mirror] - Whether to enable mirror
1739
- * @param {'contain' | 'cover' | 'fill'} [config.option.fillMode] - Video fill mode. Refer to the {@link https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit CSS object-fit} property.
1740
- * @param {boolean} [config.option.receiveWhenViewVisible] - Since v5.4.0 <br>Subscribe video only when view is visible. Refer to: {@tutorial 27-advanced-small-stream}.
1741
- * @param {HTMLElement} [config.option.viewRoot=document.body] - Since v5.4.0 <br>The root element is the parent element of the view and is used to calculate whether the view is visible relative to the root. The default value is document.body, and it is recommended that you use the first-level parent of the video view list. Refer to: {@tutorial 27-advanced-small-stream}.
1742
- * @throws
1743
- * - {@link module:ERROR_CODE.INVALID_PARAMETER INVALID_PARAMETER}
1744
- * - {@link module:ERROR_CODE.INVALID_OPERATION INVALID_OPERATION}
1745
- * - {@link module:ERROR_CODE.OPERATION_FAILED OPERATION_FAILED}
1746
- * - {@link module:ERROR_CODE.OPERATION_ABORT OPERATION_ABORT}
1747
- * @example
1748
- * const config = {
1749
- * view: document.getElementById(userId), // you can use a new view to update the position of video.
1750
- * userId,
1751
- * streamType: TRTC.TYPE.STREAM_TYPE_MAIN
1752
- * }
1753
- * await trtc.updateRemoteVideo(config);
1754
- * @memberof TRTC
1755
- */
1699
+ * Update remote video playback configuration<br>
1700
+ * - This method should be called after {@link TRTC#startRemoteVideo startRemoteVideo} is successful.
1701
+ * - This method can be called multiple times.
1702
+ * - This method uses incremental updates, so only the configuration items that need to be updated need to be passed in.
1703
+ * @param {object} [config]
1704
+ * @param {string | HTMLElement | HTMLElement[] | null} [config.view] - The HTMLElement instance or Id used to play remote video. If not passed or passed null, the video will not be rendered, but the bandwidth will still be consumed.
1705
+ * @param {string} config.userId - Remote user ID
1706
+ * @param {TRTC.TYPE.STREAM_TYPE_MAIN|TRTC.TYPE.STREAM_TYPE_SUB} config.streamType - Remote stream type
1707
+ * - {@link module:TYPE.STREAM_TYPE_MAIN TRTC.TYPE.STREAM_TYPE_MAIN}: Main stream (remote user's camera)
1708
+ * - {@link module:TYPE.STREAM_TYPE_SUB TRTC.TYPE.STREAM_TYPE_SUB}: Sub stream (remote user's screen sharing)
1709
+ * @param {object} [config.option] - Remote video configuration
1710
+ * @param {boolean} [config.option.small] - Whether to subscribe small streams. Refer to: {@tutorial 27-advanced-small-stream}.
1711
+ * @param {boolean} [config.option.mirror] - Whether to enable mirror
1712
+ * @param {'contain' | 'cover' | 'fill'} [config.option.fillMode] - Video fill mode. Refer to the {@link https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit CSS object-fit} property.
1713
+ * @param {boolean} [config.option.receiveWhenViewVisible] - Since v5.4.0 <br>Subscribe video only when view is visible. Refer to: {@tutorial 27-advanced-small-stream}.
1714
+ * @param {HTMLElement} [config.option.viewRoot=document.body] - Since v5.4.0 <br>The root element is the parent element of the view and is used to calculate whether the view is visible relative to the root. The default value is document.body, and it is recommended that you use the first-level parent of the video view list. Refer to: {@tutorial 27-advanced-small-stream}.
1715
+ * @throws
1716
+ * - {@link module:ERROR_CODE.INVALID_PARAMETER INVALID_PARAMETER}
1717
+ * - {@link module:ERROR_CODE.INVALID_OPERATION INVALID_OPERATION}
1718
+ * - {@link module:ERROR_CODE.OPERATION_FAILED OPERATION_FAILED}
1719
+ * - {@link module:ERROR_CODE.OPERATION_ABORT OPERATION_ABORT}
1720
+ * @example
1721
+ * const config = {
1722
+ * view: document.getElementById(userId), // you can use a new view to update the position of video.
1723
+ * userId,
1724
+ * streamType: TRTC.TYPE.STREAM_TYPE_MAIN
1725
+ * }
1726
+ * await trtc.updateRemoteVideo(config);
1727
+ * @memberof TRTC
1728
+ */
1756
1729
  updateRemoteVideo(config: RemoteVideoConfig): Promise<void>;
1757
1730
  /**
1758
- * Used to stop remote video playback.<br>
1759
- * @param {object} config - Remote video configuration
1760
- * @param {string} config.userId - Remote user ID, '*' represents all users.
1761
- * @param {TRTC.TYPE.STREAM_TYPE_MAIN|TRTC.TYPE.STREAM_TYPE_SUB} [config.streamType] - Remote stream type. This field is required when userId is not '*'.
1762
- * - {@link module:TYPE.STREAM_TYPE_MAIN TRTC.TYPE.STREAM_TYPE_MAIN}: Main stream (remote user's camera)
1763
- * - {@link module:TYPE.STREAM_TYPE_SUB TRTC.TYPE.STREAM_TYPE_SUB}: Sub stream (remote user's screen sharing)
1764
- * @throws {@link module:ERROR_CODE.OPERATION_ABORT OPERATION_ABORT}
1765
- * @example
1766
- * // Stop playing all remote users
1767
- * await trtc.stopRemoteVideo({ userId: '*' });
1768
- */
1731
+ * Used to stop remote video playback.<br>
1732
+ * @param {object} config - Remote video configuration
1733
+ * @param {string} config.userId - Remote user ID, '*' represents all users.
1734
+ * @param {TRTC.TYPE.STREAM_TYPE_MAIN|TRTC.TYPE.STREAM_TYPE_SUB} [config.streamType] - Remote stream type. This field is required when userId is not '*'.
1735
+ * - {@link module:TYPE.STREAM_TYPE_MAIN TRTC.TYPE.STREAM_TYPE_MAIN}: Main stream (remote user's camera)
1736
+ * - {@link module:TYPE.STREAM_TYPE_SUB TRTC.TYPE.STREAM_TYPE_SUB}: Sub stream (remote user's screen sharing)
1737
+ * @throws {@link module:ERROR_CODE.OPERATION_ABORT OPERATION_ABORT}
1738
+ * @example
1739
+ * // Stop playing all remote users
1740
+ * await trtc.stopRemoteVideo({ userId: '*' });
1741
+ */
1769
1742
  stopRemoteVideo(config: StopRemoteVideoConfig): Promise<void>;
1770
1743
  /**
1771
- * Mute a remote user and stop subscribing audio data from that user. Only effective for the current user, other users in the room can still hear the muted user's voice.<br>
1772
- *
1773
- * Note:
1774
- * - By default, after entering the room, the SDK will automatically play remote audio. You can call this interface to mute or unmute remote users.
1775
- * - If the parameter autoReceiveAudio = false is passed in when entering the room, remote audio will not be played automatically. When audio playback is required, you need to call this method (mute is passed in false) to play remote audio.
1776
- * - This interface is effective before or after entering the room (enterRoom), and the mute state will be reset to false after exiting the room (exitRoom).
1777
- * - If you want to continue subscribing audio data from the user but not play it, you can call setRemoteAudioVolume(userId, 0)
1778
- * @param {string} userId - Remote user ID, '*' represents all users.
1779
- * @param {boolean} mute - Whether to mute
1780
- * @throws
1781
- * - {@link module:ERROR_CODE.INVALID_PARAMETER INVALID_PARAMETER}
1782
- * - {@link module:ERROR_CODE.INVALID_OPERATION INVALID_OPERATION}
1783
- * - {@link module:ERROR_CODE.OPERATION_FAILED OPERATION_FAILED}
1784
- * - {@link module:ERROR_CODE.OPERATION_ABORT OPERATION_ABORT}
1785
- * @example
1786
- * // Mute all remote users
1787
- * await trtc.muteRemoteAudio('*', true);
1788
- */
1744
+ * Mute a remote user and stop subscribing audio data from that user. Only effective for the current user, other users in the room can still hear the muted user's voice.<br>
1745
+ *
1746
+ * Note:
1747
+ * - By default, after entering the room, the SDK will automatically play remote audio. You can call this interface to mute or unmute remote users.
1748
+ * - If the parameter autoReceiveAudio = false is passed in when entering the room, remote audio will not be played automatically. When audio playback is required, you need to call this method (mute is passed in false) to play remote audio.
1749
+ * - This interface is effective before or after entering the room (enterRoom), and the mute state will be reset to false after exiting the room (exitRoom).
1750
+ * - If you want to continue subscribing audio data from the user but not play it, you can call setRemoteAudioVolume(userId, 0)
1751
+ * @param {string} userId - Remote user ID, '*' represents all users.
1752
+ * @param {boolean} mute - Whether to mute
1753
+ * @throws
1754
+ * - {@link module:ERROR_CODE.INVALID_PARAMETER INVALID_PARAMETER}
1755
+ * - {@link module:ERROR_CODE.INVALID_OPERATION INVALID_OPERATION}
1756
+ * - {@link module:ERROR_CODE.OPERATION_FAILED OPERATION_FAILED}
1757
+ * - {@link module:ERROR_CODE.OPERATION_ABORT OPERATION_ABORT}
1758
+ * @example
1759
+ * // Mute all remote users
1760
+ * await trtc.muteRemoteAudio('*', true);
1761
+ */
1789
1762
  muteRemoteAudio(userId: string, mute: boolean): Promise<void>;
1790
1763
  /**
1791
- * Used to control the playback volume of remote audio.<br>
1792
- *
1793
- * - Since `v5.9.0`, iOS Safari is supported
1794
- * @param {string} userId - Remote user ID。'*' represents all remote users.
1795
- * @param {number} volume - Volume, ranging from 0 to 100. The default value is 100.<br>
1796
- * Since `v5.1.3+`, the volume can be set higher than 100.
1797
- * @example
1798
- * await trtc.setRemoteAudioVolume('123', 90);
1799
- */
1764
+ * Used to control the playback volume of remote audio.<br>
1765
+ *
1766
+ * - Since `v5.9.0`, iOS Safari is supported
1767
+ * @param {string} userId - Remote user ID。'*' represents all remote users.
1768
+ * @param {number} volume - Volume, ranging from 0 to 100. The default value is 100.<br>
1769
+ * Since `v5.1.3+`, the volume can be set higher than 100.
1770
+ * @example
1771
+ * await trtc.setRemoteAudioVolume('123', 90);
1772
+ */
1800
1773
  setRemoteAudioVolume(userId: string, volume: number): void;
1801
1774
  startPlugin<T extends keyof PluginStartOptionsMap, O extends PluginStartOptionsMap[T]>(plugin: O extends undefined ? never : T, options: O): Promise<any>;
1802
1775
  startPlugin<T extends keyof PluginStartOptionsMap, O extends PluginStartOptionsMap[T]>(plugin: O extends undefined ? T : never): Promise<any>;
@@ -1805,328 +1778,328 @@ export declare class TRTC {
1805
1778
  stopPlugin<T extends keyof PluginStopOptionsMap, O extends PluginStopOptionsMap[T]>(plugin: O extends undefined ? never : T, options: O): Promise<any>;
1806
1779
  stopPlugin<T extends keyof PluginStopOptionsMap, O extends PluginStopOptionsMap[T]>(plugin: O extends undefined ? T : never): Promise<any>;
1807
1780
  /**
1808
- * Enables or disables the volume callback.<br>
1809
- *
1810
- * - After enabling this function, whether someone is speaking in the room or not, the SDK will regularly throw the {@link module:EVENT.AUDIO_VOLUME TRTC.on(TRTC.EVENT.AUDIO_VOLUME)} event, which feedbacks the volume evaluation value of each user.<br>
1811
- *
1812
- * @param {number} [interval=2000] Used to set the time interval for triggering the volume callback event. The default is 2000(ms), and the minimum value is 100(ms). If set to less than or equal to 0, the volume callback will be turned off.
1813
- * @param {boolean} [enableInBackground=false] For performance reasons, when the page switches to the background, the SDK will not throw volume callback events. If you need to receive volume callback events when the page is switched to the background, you can set this parameter to true.
1814
- * @memberof TRTC
1815
- * @example
1816
- * trtc.on(TRTC.EVENT.AUDIO_VOLUME, event => {
1817
- * event.result.forEach(({ userId, volume }) => {
1818
- * const isMe = userId === ''; // When userId is an empty string, it represents the local microphone volume.
1819
- * if (isMe) {
1820
- * console.log(`my volume: ${volume}`);
1821
- * } else {
1822
- * console.log(`user: ${userId} volume: ${volume}`);
1823
- * }
1824
- * })
1825
- * });
1826
- *
1827
- * // Enable volume callback and trigger the event every 1000ms
1828
- * trtc.enableAudioVolumeEvaluation(1000);
1829
- *
1830
- * // To turn off the volume callback, pass in an interval value less than or equal to 0
1831
- * trtc.enableAudioVolumeEvaluation(-1);
1832
- */
1781
+ * Enables or disables the volume callback.<br>
1782
+ *
1783
+ * - After enabling this function, whether someone is speaking in the room or not, the SDK will regularly throw the {@link module:EVENT.AUDIO_VOLUME TRTC.on(TRTC.EVENT.AUDIO_VOLUME)} event, which feedbacks the volume evaluation value of each user.<br>
1784
+ *
1785
+ * @param {number} [interval=2000] Used to set the time interval for triggering the volume callback event. The default is 2000(ms), and the minimum value is 100(ms). If set to less than or equal to 0, the volume callback will be turned off.
1786
+ * @param {boolean} [enableInBackground=false] For performance reasons, when the page switches to the background, the SDK will not throw volume callback events. If you need to receive volume callback events when the page is switched to the background, you can set this parameter to true.
1787
+ * @memberof TRTC
1788
+ * @example
1789
+ * trtc.on(TRTC.EVENT.AUDIO_VOLUME, event => {
1790
+ * event.result.forEach(({ userId, volume }) => {
1791
+ * const isMe = userId === ''; // When userId is an empty string, it represents the local microphone volume.
1792
+ * if (isMe) {
1793
+ * console.log(`my volume: ${volume}`);
1794
+ * } else {
1795
+ * console.log(`user: ${userId} volume: ${volume}`);
1796
+ * }
1797
+ * })
1798
+ * });
1799
+ *
1800
+ * // Enable volume callback and trigger the event every 1000ms
1801
+ * trtc.enableAudioVolumeEvaluation(1000);
1802
+ *
1803
+ * // To turn off the volume callback, pass in an interval value less than or equal to 0
1804
+ * trtc.enableAudioVolumeEvaluation(-1);
1805
+ */
1833
1806
  enableAudioVolumeEvaluation(interval?: number, enableInBackground?: boolean): void;
1834
1807
  /**
1835
- * Listen to TRTC events<br><br>
1836
- * For a detailed list of events, please refer to: {@link module:EVENT TRTC.EVENT}
1837
- *
1838
- * @param {string} eventName Event name
1839
- * @param {function} handler Event callback function
1840
- * @param {context} context Context
1841
- * @memberof TRTC
1842
- * @example
1843
- * trtc.on(TRTC.EVENT.REMOTE_VIDEO_AVAILABLE, event => {
1844
- * // REMOTE_VIDEO_AVAILABLE event handler
1845
- * });
1846
- */
1808
+ * Listen to TRTC events<br><br>
1809
+ * For a detailed list of events, please refer to: {@link module:EVENT TRTC.EVENT}
1810
+ *
1811
+ * @param {string} eventName Event name
1812
+ * @param {function} handler Event callback function
1813
+ * @param {context} context Context
1814
+ * @memberof TRTC
1815
+ * @example
1816
+ * trtc.on(TRTC.EVENT.REMOTE_VIDEO_AVAILABLE, event => {
1817
+ * // REMOTE_VIDEO_AVAILABLE event handler
1818
+ * });
1819
+ */
1847
1820
  on<T extends keyof TRTCEventTypes>(event: T, handler: (...args: TRTCEventTypes[T]) => void, context?: any): this;
1848
1821
  /**
1849
- * Remove event listener<br>
1850
- *
1851
- * @param {string} eventName Event name. Passing in the wildcard '*' will remove all event listeners.
1852
- * @param {function} handler Event callback function
1853
- * @param {context} context Context
1854
- * @memberof TRTC
1855
- * @example
1856
- * trtc.on(TRTC.EVENT.REMOTE_USER_ENTER, function peerJoinHandler(event) {
1857
- * // REMOTE_USER_ENTER event handler
1858
- * console.log('remote user enter');
1859
- *
1860
- * trtc.off(TRTC.EVENT.REMOTE_USER_ENTER, peerJoinHandler);
1861
- * });
1862
- *
1863
- * // Remove all event listeners
1864
- * trtc.off('*');
1865
- */
1822
+ * Remove event listener<br>
1823
+ *
1824
+ * @param {string} eventName Event name. Passing in the wildcard '*' will remove all event listeners.
1825
+ * @param {function} handler Event callback function
1826
+ * @param {context} context Context
1827
+ * @memberof TRTC
1828
+ * @example
1829
+ * trtc.on(TRTC.EVENT.REMOTE_USER_ENTER, function peerJoinHandler(event) {
1830
+ * // REMOTE_USER_ENTER event handler
1831
+ * console.log('remote user enter');
1832
+ *
1833
+ * trtc.off(TRTC.EVENT.REMOTE_USER_ENTER, peerJoinHandler);
1834
+ * });
1835
+ *
1836
+ * // Remove all event listeners
1837
+ * trtc.off('*');
1838
+ */
1866
1839
  off<T extends keyof TRTCEventTypes>(event: T | '*', handler: T extends '*' ? never : (...args: TRTCEventTypes[T]) => void, context?: any): this;
1867
1840
  /**
1868
- * Get audio track
1869
- *
1870
- * @returns {MediaStreamTrack?} Audio track
1871
- * @param {Object|string} [config] If not passed, get the local microphone audioTrack
1872
- * @param {string} [config.userId] If not passed or passed an empty string, get the local audioTrack. Pass the userId of the remote user to get the remote user's audioTrack.
1873
- * @param {STREAM_TYPE_MAIN|STREAM_TYPE_SUB} [config.streamType] - stream type:
1874
- * - {@link module:TYPE.STREAM_TYPE_MAIN TRTC.TYPE.STREAM_TYPE_MAIN}: Main stream (user's microphone)(default)
1875
- * - {@link module:TYPE.STREAM_TYPE_SUB TRTC.TYPE.STREAM_TYPE_SUB}: Sub stream (user's screen sharing audio). Only works for local screen sharing audio because there is only one remote audioTrack, and there is no distinction between Main and Sub for remote audioTrack.
1876
- * @param {boolean} [config.processed=false] - Whether to get the processed audioTrack. The processed audioTrack is the audioTrack after the SDK processes the audio frame, such as AI Denoiser, gain, mix. The default value is false.
1877
- * @memberof TRTC
1878
- * @example
1879
- * // Version before v5.4.3
1880
- * trtc.getAudioTrack(); // Get local microphone audioTrack, captured by trtc.startLocalAudio()
1881
- * trtc.getAudioTrack('remoteUserId'); // Get remote audioTrack
1882
- *
1883
- * // Since v5.4.3+, you can get local screen audioTrack by passing the streamType = TRTC.STREAM_TYPE_SUB
1884
- * trtc.getAudioTrack({ streamType: TRTC.STREAM_TYPE_SUB });
1841
+ * Get audio track
1842
+ *
1843
+ * @returns {MediaStreamTrack?} Audio track
1844
+ * @param {Object|string} [config] If not passed, get the local microphone audioTrack
1845
+ * @param {string} [config.userId] If not passed or passed an empty string, get the local audioTrack. Pass the userId of the remote user to get the remote user's audioTrack.
1846
+ * @param {STREAM_TYPE_MAIN|STREAM_TYPE_SUB} [config.streamType] - stream type:
1847
+ * - {@link module:TYPE.STREAM_TYPE_MAIN TRTC.TYPE.STREAM_TYPE_MAIN}: Main stream (user's microphone)(default)
1848
+ * - {@link module:TYPE.STREAM_TYPE_SUB TRTC.TYPE.STREAM_TYPE_SUB}: Sub stream (user's screen sharing audio). Only works for local screen sharing audio because there is only one remote audioTrack, and there is no distinction between Main and Sub for remote audioTrack.
1849
+ * @param {boolean} [config.processed=false] - Whether to get the processed audioTrack. The processed audioTrack is the audioTrack after the SDK processes the audio frame, such as ai-denose, gain, mix. The default value is false.
1850
+ * @memberof TRTC
1851
+ * @example
1852
+ * // Version before v5.4.3
1853
+ * trtc.getAudioTrack(); // Get local microphone audioTrack, captured by trtc.startLocalAudio()
1854
+ * trtc.getAudioTrack('remoteUserId'); // Get remote audioTrack
1855
+ *
1856
+ * // Since v5.4.3+, you can get local screen audioTrack by passing the streamType = TRTC.STREAM_TYPE_SUB
1857
+ * trtc.getAudioTrack({ streamType: TRTC.STREAM_TYPE_SUB });
1885
1858
  *
1886
1859
  * // Since v5.8.2+, you can get the processed audioTrack by passing processed = true
1887
1860
  * trtc.getAudioTrack({ processed: true });
1888
- */
1861
+ */
1889
1862
  getAudioTrack(configOrUserId?: {
1890
- userId?: string;
1891
- streamType?: TRTCStreamType;
1892
- processed?: boolean;
1893
- } | string): MediaStreamTrack | null;
1894
- /**
1895
- * Get video track
1896
- *
1897
- * @param {string} [config] If not passed, get the local camera videoTrack
1898
- * @param {string} [config.userId] If not passed or passed an empty string, get the local videoTrack. Pass the userId of the remote user to get the remote user's videoTrack.
1899
- * @param {STREAM_TYPE_MAIN|STREAM_TYPE_SUB} [config.streamType] - stream type:
1900
- * - {@link module:TYPE.STREAM_TYPE_MAIN TRTC.TYPE.STREAM_TYPE_MAIN}: Main stream (user's camera)(default)
1901
- * - {@link module:TYPE.STREAM_TYPE_SUB TRTC.TYPE.STREAM_TYPE_SUB}: Sub stream (user's screen sharing)
1902
- * @param {boolean} [config.processed=false] - Whether to get the processed videoTrack. The processed videoTrack is the videoTrack after the SDK processes the video frame, such as virtual background, mirror, watermark. The default value is false.
1903
- * @returns {MediaStreamTrack|null} Video track
1904
- * @memberof TRTC
1905
- * @example
1906
- * // Get local camera videoTrack
1907
- * const videoTrack = trtc.getVideoTrack();
1908
- * // Get local screen sharing videoTrack
1909
- * const screenVideoTrack = trtc.getVideoTrack({ streamType: TRTC.TYPE.STREAM_TYPE_SUB });
1910
- * // Get remote user's main stream videoTrack
1911
- * const remoteMainVideoTrack = trtc.getVideoTrack({ userId: 'test', streamType: TRTC.TYPE.STREAM_TYPE_MAIN });
1912
- * // Get remote user's sub stream videoTrack
1913
- * const remoteSubVideoTrack = trtc.getVideoTrack({ userId: 'test', streamType: TRTC.TYPE.STREAM_TYPE_SUB });
1863
+ userId?: string;
1864
+ streamType?: TRTCStreamType;
1865
+ processed?: boolean;
1866
+ } | string): MediaStreamTrack | null;
1867
+ /**
1868
+ * Get video track
1869
+ *
1870
+ * @param {string} [config] If not passed, get the local camera videoTrack
1871
+ * @param {string} [config.userId] If not passed or passed an empty string, get the local videoTrack. Pass the userId of the remote user to get the remote user's videoTrack.
1872
+ * @param {STREAM_TYPE_MAIN|STREAM_TYPE_SUB} [config.streamType] - stream type:
1873
+ * - {@link module:TYPE.STREAM_TYPE_MAIN TRTC.TYPE.STREAM_TYPE_MAIN}: Main stream (user's camera)(default)
1874
+ * - {@link module:TYPE.STREAM_TYPE_SUB TRTC.TYPE.STREAM_TYPE_SUB}: Sub stream (user's screen sharing)
1875
+ * @param {boolean} [config.processed=false] - Whether to get the processed videoTrack. The processed videoTrack is the videoTrack after the SDK processes the video frame, such as visualbackground, mirror, watermark. The default value is false.
1876
+ * @returns {MediaStreamTrack|null} Video track
1877
+ * @memberof TRTC
1878
+ * @example
1879
+ * // Get local camera videoTrack
1880
+ * const videoTrack = trtc.getVideoTrack();
1881
+ * // Get local screen sharing videoTrack
1882
+ * const screenVideoTrack = trtc.getVideoTrack({ streamType: TRTC.TYPE.STREAM_TYPE_SUB });
1883
+ * // Get remote user's main stream videoTrack
1884
+ * const remoteMainVideoTrack = trtc.getVideoTrack({ userId: 'test', streamType: TRTC.TYPE.STREAM_TYPE_MAIN });
1885
+ * // Get remote user's sub stream videoTrack
1886
+ * const remoteSubVideoTrack = trtc.getVideoTrack({ userId: 'test', streamType: TRTC.TYPE.STREAM_TYPE_SUB });
1914
1887
  * // Since v5.8.2+, you can get the processed videoTrack by passing processed = true
1915
1888
  * const processedVideoTrack = trtc.getVideoTrack({ processed: true });
1916
- */
1889
+ */
1917
1890
  getVideoTrack(config?: {
1918
- userId?: string;
1919
- streamType?: TRTCStreamType;
1920
- processed?: boolean;
1921
- }): MediaStreamTrack | null;
1922
- /**
1923
- * Get video snapshot <br>
1924
- * Notice: must play the video before it can obtain the snapshot. If there is no playback, an empty string will be returned.
1925
- * @param {string} config.userId - Remote user ID
1926
- * @param {TRTC.TYPE.STREAM_TYPE_MAIN|TRTC.TYPE.STREAM_TYPE_SUB} config.streamType
1927
- * - {@link module:TYPE.STREAM_TYPE_MAIN TRTC.TYPE.STREAM_TYPE_MAIN}: Main stream
1928
- * - {@link module:TYPE.STREAM_TYPE_SUB TRTC.TYPE.STREAM_TYPE_SUB}: Sub stream
1929
- * @since 5.4.0
1930
- * @example
1931
- * // get self main stream video frame
1932
- * trtc.getVideoSnapshot()
1933
- * // get self sub stream video frame
1934
- * trtc.getVideoSnapshot({streamType:TRTC.TYPE.STREAM_TYPE_SUB})
1935
- * // get remote user main stream video frame
1936
- * trtc.getVideoSnapshot({userId: 'remote userId', streamType:TRTC.TYPE.STREAM_TYPE_MAIN})
1937
- * @memberof TRTC
1938
- */
1891
+ userId?: string;
1892
+ streamType?: TRTCStreamType;
1893
+ processed?: boolean;
1894
+ }): MediaStreamTrack | null;
1895
+ /**
1896
+ * Get video snapshot <br>
1897
+ * Notice: must play the video before it can obtain the snapshot. If there is no playback, an empty string will be returned.
1898
+ * @param {string} config.userId - Remote user ID
1899
+ * @param {TRTC.TYPE.STREAM_TYPE_MAIN|TRTC.TYPE.STREAM_TYPE_SUB} config.streamType
1900
+ * - {@link module:TYPE.STREAM_TYPE_MAIN TRTC.TYPE.STREAM_TYPE_MAIN}: Main stream
1901
+ * - {@link module:TYPE.STREAM_TYPE_SUB TRTC.TYPE.STREAM_TYPE_SUB}: Sub stream
1902
+ * @since 5.4.0
1903
+ * @example
1904
+ * // get self main stream video frame
1905
+ * trtc.getVideoSnapshot()
1906
+ * // get self sub stream video frame
1907
+ * trtc.getVideoSnapshot({streamType:TRTC.TYPE.STREAM_TYPE_SUB})
1908
+ * // get remote user main stream video frame
1909
+ * trtc.getVideoSnapshot({userId: 'remote userId', streamType:TRTC.TYPE.STREAM_TYPE_MAIN})
1910
+ * @memberof TRTC
1911
+ */
1939
1912
  getVideoSnapshot(config?: VideoFrameConfig): string;
1940
1913
  /**
1941
- * Send SEI Message <br>
1942
- *
1943
- * > The header of a video frame has a header block called SEI.
1944
- * > The principle of this interface is to use the SEI to embed the custom data you want to send along with the video frame.
1945
- * > SEI messages can accompany video frames all the way to the live CDN.
1946
- *
1947
- * Applicable scenarios: synchronization of lyrics, live answering questions, etc.
1948
- *
1949
- * When to call: call after {@link TRTC#startLocalVideo trtc.startLocalVideo} or {@link TRTC#startLocalScreen trtc.startLocalScreen} when set 'toSubStream' option to true successfully.
1950
- *
1951
- * Note:
1952
- * 1. Maximum 1KB(Byte) sent in a single call, maximum 30 calls per second, maximum 8KB sent per second.
1953
- * 2. Currently only support Chrome 86+, Edge 86+, Opera 72+ browsers.
1954
- * 3. Since SEI is sent along with video frames, there is a possibility that video frames may be lost, and therefore SEI may be lost as well. The number of times it can be sent can be increased within the frequency limit, and the business side needs to do message de-duplication on the receiving side.
1955
- * 4. SEI cannot be sent without trtc.startLocalVideo(or trtc.startLocalScreen when set 'toSubStream' option to true); SEI cannot be received without startRemoteVideo.
1956
- * 5. Only H264 encoder is supported to send SEI.
1957
- * 6. SEI sending and receiving is not supported for small streams for the time being.
1958
- * @see {@link module:EVENT.SEI_MESSAGE TRTC.EVENT.SEI_MESSAGE}
1959
- * @since v5.3.0
1960
- * @param {ArrayBuffer} buffer SEI data to be sent
1961
- * @param {Object=} options
1962
- * @param {Number} options.seiPayloadType Set the SEI payload type. SDK uses the custom payloadType 243 by default, the business side can use this parameter to set the payloadType to the standard 5. When the business side uses the 5 payloadType, you need to follow the specification to make sure that the first 16 bytes of the `buffer` are the business side's customized uuid.
1963
- * @param {Boolean} [options.toSubStream=false] Send SEI data to substream. Need call trtc.startLocalScreen first. Since v5.7.0+.
1964
- * @example
1965
- * // 1. enable SEI
1966
- * const trtc = TRTC.create({
1967
- * enableSEI: true
1968
- * })
1969
- *
1970
- * // 2. send SEI
1971
- * try {
1972
- * await trtc.enterRoom({
1973
- * userId: 'user_1',
1974
- * roomId: 12345,
1975
- * })
1976
- * await trtc.startLocalVideo();
1977
- * const unit8Array = new Uint8Array([1, 2, 3]);
1978
- * trtc.sendSEIMessage(unit8Array.buffer);
1979
- * } catch(error) {
1980
- * console.warn(error);
1981
- * }
1982
- *
1983
- * // 3. receive SEI
1984
- * trtc.on(TRTC.EVENT.SEI_MESSAGE, event => {
1985
- * console.warn(`sei ${event.data} from ${event.userId}`);
1986
- * })
1987
- */
1914
+ * Send SEI Message <br>
1915
+ *
1916
+ * > The header of a video frame has a header block called SEI.
1917
+ * > The principle of this interface is to use the SEI to embed the custom data you want to send along with the video frame.
1918
+ * > SEI messages can accompany video frames all the way to the live CDN.
1919
+ *
1920
+ * Applicable scenarios: synchronization of lyrics, live answering questions, etc.
1921
+ *
1922
+ * When to call: call after {@link TRTC#startLocalVideo trtc.startLocalVideo} or {@link TRTC#startLocalScreen trtc.startLocalScreen} when set 'toSubStream' option to true successfully.
1923
+ *
1924
+ * Note:
1925
+ * 1. Maximum 1KB(Byte) sent in a single call, maximum 30 calls per second, maximum 8KB sent per second.
1926
+ * 2. Currently only support Chrome 86+, Edge 86+, Opera 72+ browsers.
1927
+ * 3. Since SEI is sent along with video frames, there is a possibility that video frames may be lost, and therefore SEI may be lost as well. The number of times it can be sent can be increased within the frequency limit, and the business side needs to do message de-duplication on the receiving side.
1928
+ * 4. SEI cannot be sent without trtc.startLocalVideo(or trtc.startLocalScreen when set 'toSubStream' option to true); SEI cannot be received without startRemoteVideo.
1929
+ * 5. Only H264 encoder is supported to send SEI.
1930
+ * 6. SEI sending and receiving is not supported for small streams for the time being.
1931
+ * @see {@link module:EVENT.SEI_MESSAGE TRTC.EVENT.SEI_MESSAGE}
1932
+ * @since v5.3.0
1933
+ * @param {ArrayBuffer} buffer SEI data to be sent
1934
+ * @param {Object=} options
1935
+ * @param {Number} options.seiPayloadType Set the SEI payload type. SDK uses the custom payloadType 243 by default, the business side can use this parameter to set the payloadType to the standard 5. When the business side uses the 5 payloadType, you need to follow the specification to make sure that the first 16 bytes of the `buffer` are the business side's customized uuid.
1936
+ * @param {Boolean} [options.toSubStream=false] Send SEI data to substream. Need call trtc.startLocalScreen first. Since v5.7.0+.
1937
+ * @example
1938
+ * // 1. enable SEI
1939
+ * const trtc = TRTC.create({
1940
+ * enableSEI: true
1941
+ * })
1942
+ *
1943
+ * // 2. send SEI
1944
+ * try {
1945
+ * await trtc.enterRoom({
1946
+ * userId: 'user_1',
1947
+ * roomId: 12345,
1948
+ * })
1949
+ * await trtc.startLocalVideo();
1950
+ * const unit8Array = new Uint8Array([1, 2, 3]);
1951
+ * trtc.sendSEIMessage(unit8Array.buffer);
1952
+ * } catch(error) {
1953
+ * console.warn(error);
1954
+ * }
1955
+ *
1956
+ * // 3. receive SEI
1957
+ * trtc.on(TRTC.EVENT.SEI_MESSAGE, event => {
1958
+ * console.warn(`sei ${event.data} from ${event.userId}`);
1959
+ * })
1960
+ */
1988
1961
  sendSEIMessage(buffer: ArrayBuffer, options?: {
1989
- seiPayloadType?: number;
1990
- toSubStream?: boolean;
1991
- }): void;
1992
- /**
1993
- * Send Custom Message to all remote users in the room. <br>
1994
- *
1995
- * Note:
1996
- *
1997
- * 1. Only {@link module:TYPE.ROLE_ANCHOR TRTC.TYPE.ROLE_ANCHOR} can call sendCustomMessage.
1998
- * 2. You should call this api after {@link TRTC#enterRoom TRTC.enterRoom} successfully.
1999
- * 3. The custom message will be sent in order and as reliably as possible, but it's possible to loss messages in a very bad network. The receiver will also receive the message in order.
2000
- * @since v5.6.0
2001
- * @see Listen for the event {@link module:EVENT.CUSTOM_MESSAGE TRTC.EVENT.CUSTOM_MESSAGE} to receive custom message.
2002
- * @param {object} message
2003
- * @param {number} message.cmdId message Id. Integer, range [1, 10]. You can set different cmdId for different types of messages to reduce the delay of transferring message.
2004
- * @param {ArrayBuffer} message.data - message content. <br/>
2005
- * - Maximum 1KB(Byte) sent in a single call.
2006
- * - Maximum 30 calls per second
2007
- * - Maximum 8KB sent per second.
2008
- * @example
2009
- * // send custom message
2010
- * trtc.sendCustomMessage({
2011
- * cmdId: 1,
2012
- * data: new TextEncoder().encode('hello').buffer
2013
- * });
2014
- *
2015
- * // receive custom message
2016
- * trtc.on(TRTC.EVENT.CUSTOM_MESSAGE, event => {
2017
- * // event.userId: remote userId.
2018
- * // event.cmdId: message cmdId.
2019
- * // event.seq: message sequence number.
2020
- * // event.data: custom message data, type is ArrayBuffer.
2021
- * console.log(`received custom msg from ${event.userId}, message: ${new TextDecoder().decode(event.data)}`)
2022
- * })
2023
- */
1962
+ seiPayloadType?: number;
1963
+ toSubStream?: boolean;
1964
+ }): void;
1965
+ /**
1966
+ * Send Custom Message to all remote users in the room. <br>
1967
+ *
1968
+ * Note:
1969
+ *
1970
+ * 1. Only {@link module:TYPE.ROLE_ANCHOR TRTC.TYPE.ROLE_ANCHOR} can call sendCustomMessage.
1971
+ * 2. You should call this api after {@link TRTC#enterRoom TRTC.enterRoom} successfully.
1972
+ * 3. The custom message will be sent in order and as reliably as possible, but it's possible to loss messages in a very bad network. The receiver will also receive the message in order.
1973
+ * @since v5.6.0
1974
+ * @see Listen for the event {@link module:EVENT.CUSTOM_MESSAGE TRTC.EVENT.CUSTOM_MESSAGE} to receive custom message.
1975
+ * @param {object} message
1976
+ * @param {number} message.cmdId message Id. Integer, range [1, 10]. You can set different cmdId for different types of messages to reduce the delay of transferring message.
1977
+ * @param {ArrayBuffer} message.data - message content. <br/>
1978
+ * - Maximum 1KB(Byte) sent in a single call.
1979
+ * - Maximum 30 calls per second
1980
+ * - Maximum 8KB sent per second.
1981
+ * @example
1982
+ * // send custom message
1983
+ * trtc.sendCustomMessage({
1984
+ * cmdId: 1,
1985
+ * data: new TextEncoder().encode('hello').buffer
1986
+ * });
1987
+ *
1988
+ * // receive custom message
1989
+ * trtc.on(TRTC.EVENT.CUSTOM_MESSAGE, event => {
1990
+ * // event.userId: remote userId.
1991
+ * // event.cmdId: message cmdId.
1992
+ * // event.seq: message sequence number.
1993
+ * // event.data: custom message data, type is ArrayBuffer.
1994
+ * console.log(`received custom msg from ${event.userId}, message: ${new TextDecoder().decode(event.data)}`)
1995
+ * })
1996
+ */
2024
1997
  sendCustomMessage(message: CustomMessageData): void;
2025
1998
  static EVENT: typeof TRTCEvent;
2026
1999
  static ERROR_CODE: {
2027
- INVALID_PARAMETER: number;
2028
- INVALID_OPERATION: number;
2029
- ENV_NOT_SUPPORTED: number;
2030
- DEVICE_ERROR: number;
2031
- SERVER_ERROR: number;
2032
- OPERATION_FAILED: number;
2033
- OPERATION_ABORT: number;
2034
- UNKNOWN_ERROR: number;
2035
- };
2000
+ INVALID_PARAMETER: number;
2001
+ INVALID_OPERATION: number;
2002
+ ENV_NOT_SUPPORTED: number;
2003
+ DEVICE_ERROR: number;
2004
+ SERVER_ERROR: number;
2005
+ OPERATION_FAILED: number;
2006
+ OPERATION_ABORT: number;
2007
+ UNKNOWN_ERROR: number;
2008
+ };
2036
2009
  static TYPE: typeof TRTCType;
2037
2010
  static frameWorkType: number;
2038
2011
  /**
2039
- * Set the log output level
2040
- * <br>
2041
- * It is recommended to set the DEBUG level during development and testing, which includes detailed prompt information.
2042
- * The default output level is INFO, which includes the log information of the main functions of the SDK.
2043
- *
2044
- * @param {0-5} [level] Log output level 0: TRACE 1: DEBUG 2: INFO 3: WARN 4: ERROR 5: NONE
2045
- * @param {boolean} [enableUploadLog=true] Whether to enable log upload, which is enabled by default. It is not recommended to turn it off, which will affect problem troubleshooting.
2046
- * @example
2047
- * // Output log levels above DEBUG
2048
- * TRTC.setLogLevel(1);
2049
- */
2012
+ * Set the log output level
2013
+ * <br>
2014
+ * It is recommended to set the DEBUG level during development and testing, which includes detailed prompt information.
2015
+ * The default output level is INFO, which includes the log information of the main functions of the SDK.
2016
+ *
2017
+ * @param {0-5} [level] Log output level 0: TRACE 1: DEBUG 2: INFO 3: WARN 4: ERROR 5: NONE
2018
+ * @param {boolean} [enableUploadLog=true] Whether to enable log upload, which is enabled by default. It is not recommended to turn it off, which will affect problem troubleshooting.
2019
+ * @example
2020
+ * // Output log levels above DEBUG
2021
+ * TRTC.setLogLevel(1);
2022
+ */
2050
2023
  static setLogLevel(level: LOG_LEVEL, enableUploadLog?: boolean): void;
2051
2024
  /**
2052
- * Check if the TRTC Web SDK is supported by the current browser
2053
- *
2054
- * - Reference: {@tutorial 05-info-browser}.
2055
- * @example
2056
- * TRTC.isSupported().then((checkResult) => {
2057
- * if(!checkResult.result) {
2058
- * console.log('checkResult', checkResult.result, 'checkDetail', checkResult.detail);
2059
- * // The SDK is not supported by the current browser, guide the user to use the latest version of Chrome browser.
2060
- * }
2061
- * });
2062
- *
2063
- * @returns {Promise.<object>} Promise returns the detection result
2064
- * | Property | Type | Description |
2065
- * |--------------------------------------------|---------|-------------------------------------|
2066
- * | checkResult.result | boolean | Detection result |
2067
- * | checkResult.detail.isBrowserSupported | boolean | Whether the current browser is supported by the SDK |
2068
- * | checkResult.detail.isWebRTCSupported | boolean | Whether the current browser supports WebRTC |
2069
- * | checkResult.detail.isWebCodecsSupported | boolean | Whether the current browser supports WebCodecs |
2070
- * | checkResult.detail.isMediaDevicesSupported | boolean | Whether the current browser supports obtaining media devices and media streams |
2071
- * | checkResult.detail.isScreenShareSupported | boolean | Whether the current browser supports screen sharing |
2072
- * | checkResult.detail.isSmallStreamSupported | boolean | Whether the current browser supports small streams |
2073
- * | checkResult.detail.isH264EncodeSupported | boolean | Whether the current browser supports H264 encoding for uplink |
2074
- * | checkResult.detail.isH264DecodeSupported | boolean | Whether the current browser supports H264 decoding for downlink |
2075
- * | checkResult.detail.isVp8EncodeSupported | boolean | Whether the current browser supports VP8 encoding for uplink |
2076
- * | checkResult.detail.isVp8DecodeSupported | boolean | Whether the current browser supports VP8 decoding for downlink |
2077
- */
2025
+ * Check if the TRTC Web SDK is supported by the current browser
2026
+ *
2027
+ * - Reference: {@tutorial 05-info-browser}.
2028
+ * @example
2029
+ * TRTC.isSupported().then((checkResult) => {
2030
+ * if(!checkResult.result) {
2031
+ * console.log('checkResult', checkResult.result, 'checkDetail', checkResult.detail);
2032
+ * // The SDK is not supported by the current browser, guide the user to use the latest version of Chrome browser.
2033
+ * }
2034
+ * });
2035
+ *
2036
+ * @returns {Promise.<object>} Promise returns the detection result
2037
+ * | Property | Type | Description |
2038
+ * |--------------------------------------------|---------|-------------------------------------|
2039
+ * | checkResult.result | boolean | Detection result |
2040
+ * | checkResult.detail.isBrowserSupported | boolean | Whether the current browser is supported by the SDK |
2041
+ * | checkResult.detail.isWebRTCSupported | boolean | Whether the current browser supports WebRTC |
2042
+ * | checkResult.detail.isWebCodecsSupported | boolean | Whether the current browser supports WebCodecs |
2043
+ * | checkResult.detail.isMediaDevicesSupported | boolean | Whether the current browser supports obtaining media devices and media streams |
2044
+ * | checkResult.detail.isScreenShareSupported | boolean | Whether the current browser supports screen sharing |
2045
+ * | checkResult.detail.isSmallStreamSupported | boolean | Whether the current browser supports small streams |
2046
+ * | checkResult.detail.isH264EncodeSupported | boolean | Whether the current browser supports H264 encoding for uplink |
2047
+ * | checkResult.detail.isH264DecodeSupported | boolean | Whether the current browser supports H264 decoding for downlink |
2048
+ * | checkResult.detail.isVp8EncodeSupported | boolean | Whether the current browser supports VP8 encoding for uplink |
2049
+ * | checkResult.detail.isVp8DecodeSupported | boolean | Whether the current browser supports VP8 decoding for downlink |
2050
+ */
2078
2051
  static isSupported(): Promise<any>;
2079
2052
  /**
2080
- * Returns the list of camera devices
2081
- * <br>
2082
- * **Note**
2083
- * - This interface does not support use under the http protocol, please use the https protocol to deploy your website. {@link https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia#Privacy_and_security Privacy and security}
2084
- * - You can call the browser's native interface [getCapabilities](https://developer.mozilla.org/en-US/docs/Web/API/InputDeviceInfo/getCapabilities) to get the maximum resolutions supported by the camera, frame rate, mobile devices to distinguish between front and rear cameras, etc. This interface supports Chrome 67+, Edge 79+, Safari 17+, Opera 54+.
2085
- * @param {boolean} [requestPermission=true] `Since v5.6.3`. Whether to request permission to use the camera. If requestPermission is true, calling this method may temporarily open the camera to ensure that the camera list can be normally obtained, and the SDK will automatically stop the camera capture later.
2086
- * @example
2087
- * const cameraList = await TRTC.getCameraList();
2088
- * if (cameraList[0] && cameraList[0].getCapabilities) {
2089
- * const { width, height, frameRate, facingMode } = cameraList[0].getCapabilities();
2090
- * console.log(width.max, height.max, frameRate.max);
2091
- * if (facingMode) {
2092
- * if (facingMode[0] === 'user') {
2093
- * // front camera
2094
- * } else if (facingMode[0] === 'environment') {
2095
- * // rear camera
2096
- * }
2097
- * }
2098
- * }
2099
- * @returns {Promise.<MediaDeviceInfo[]>} Promise returns an array of {@link https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo|MediaDeviceInfo}
2100
- */
2053
+ * Returns the list of camera devices
2054
+ * <br>
2055
+ * **Note**
2056
+ * - This interface does not support use under the http protocol, please use the https protocol to deploy your website. {@link https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia#Privacy_and_security Privacy and security}
2057
+ * - You can call the browser's native interface [getCapabilities](https://developer.mozilla.org/en-US/docs/Web/API/InputDeviceInfo/getCapabilities) to get the maximum resolutions supported by the camera, frame rate, mobile devices to distinguish between front and rear cameras, etc. This interface supports Chrome 67+, Edge 79+, Safari 17+, Opera 54+.
2058
+ * @param {boolean} [requestPermission=true] `Since v5.6.3`. Whether to request permission to use the camera. If requestPermission is true, calling this method may temporarily open the camera to ensure that the camera list can be normally obtained, and the SDK will automatically stop the camera capture later.
2059
+ * @example
2060
+ * const cameraList = await TRTC.getCameraList();
2061
+ * if (cameraList[0] && cameraList[0].getCapabilities) {
2062
+ * const { width, height, frameRate, facingMode } = cameraList[0].getCapabilities();
2063
+ * console.log(width.max, height.max, frameRate.max);
2064
+ * if (facingMode) {
2065
+ * if (facingMode[0] === 'user') {
2066
+ * // front camera
2067
+ * } else if (facingMode[0] === 'environment') {
2068
+ * // rear camera
2069
+ * }
2070
+ * }
2071
+ * }
2072
+ * @returns {Promise.<MediaDeviceInfo[]>} Promise returns an array of {@link https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo|MediaDeviceInfo}
2073
+ */
2101
2074
  static getCameraList(requestPermission?: boolean): Promise<MediaDeviceInfo[]>;
2102
2075
  /**
2103
- * Returns the list of microphone devices
2104
- * <br>
2105
- * **Note**
2106
- * - This interface does not support use under the http protocol, please use the https protocol to deploy your website. {@link https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia#Privacy_and_security Privacy and security}
2107
- * - You can call the browser's native interface [getCapabilities](https://developer.mozilla.org/en-US/docs/Web/API/InputDeviceInfo/getCapabilities) to get information about the microphone's capabilities, e.g. the maximum number of channels supported, etc. This interface supports Chrome 67+, Edge 79+, Safari 17+, Opera 54+.
2108
- * @param {boolean} [requestPermission=true] `Since v5.6.3`. Whether to request permission to use the microphone. If requestPermission is true, calling this method may temporarily open the microphone to ensure that the microphone list can be normally obtained, and the SDK will automatically stop the microphone capture later.
2109
- * @example
2110
- * const microphoneList = await TRTC.getMicrophoneList();
2111
- * if (microphoneList[0] && microphoneList[0].getCapabilities) {
2112
- * const { channelCount } = microphoneList[0].getCapabilities();
2113
- * console.log(channelCount.max);
2114
- * }
2115
- * @returns {Promise.<MediaDeviceInfo[]>} Promise returns an array of {@link https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo|MediaDeviceInfo}
2116
- */
2076
+ * Returns the list of microphone devices
2077
+ * <br>
2078
+ * **Note**
2079
+ * - This interface does not support use under the http protocol, please use the https protocol to deploy your website. {@link https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia#Privacy_and_security Privacy and security}
2080
+ * - You can call the browser's native interface [getCapabilities](https://developer.mozilla.org/en-US/docs/Web/API/InputDeviceInfo/getCapabilities) to get information about the microphone's capabilities, e.g. the maximum number of channels supported, etc. This interface supports Chrome 67+, Edge 79+, Safari 17+, Opera 54+.
2081
+ * @param {boolean} [requestPermission=true] `Since v5.6.3`. Whether to request permission to use the microphone. If requestPermission is true, calling this method may temporarily open the microphone to ensure that the microphone list can be normally obtained, and the SDK will automatically stop the microphone capture later.
2082
+ * @example
2083
+ * const microphoneList = await TRTC.getMicrophoneList();
2084
+ * if (microphoneList[0] && microphoneList[0].getCapabilities) {
2085
+ * const { channelCount } = microphoneList[0].getCapabilities();
2086
+ * console.log(channelCount.max);
2087
+ * }
2088
+ * @returns {Promise.<MediaDeviceInfo[]>} Promise returns an array of {@link https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo|MediaDeviceInfo}
2089
+ */
2117
2090
  static getMicrophoneList(requestPermission?: boolean): Promise<MediaDeviceInfo[]>;
2118
2091
  /**
2119
- * Returns the list of speaker devices. Only support PC browser, not support mobile browser.
2120
- * <br>
2121
- * @param {boolean} [requestPermission=true] `Since v5.6.3`. Whether to request permission to use the microphone. If requestPermission is true, calling this method may temporarily open the microphone to ensure that the microphone list can be normally obtained, and the SDK will automatically stop the microphone capture later.
2122
- * @returns {Promise.<MediaDeviceInfo[]>} Promise returns an array of {@link https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo|MediaDeviceInfo}
2123
- */
2092
+ * Returns the list of speaker devices. Only support PC browser, not support mobile browser.
2093
+ * <br>
2094
+ * @param {boolean} [requestPermission=true] `Since v5.6.3`. Whether to request permission to use the microphone. If requestPermission is true, calling this method may temporarily open the microphone to ensure that the microphone list can be normally obtained, and the SDK will automatically stop the microphone capture later.
2095
+ * @returns {Promise.<MediaDeviceInfo[]>} Promise returns an array of {@link https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo|MediaDeviceInfo}
2096
+ */
2124
2097
  static getSpeakerList(requestPermission?: boolean): Promise<MediaDeviceInfo[]>;
2125
2098
  /**
2126
- * Set the current speaker for audio playback
2127
- *
2128
- * @param {string} speakerId Speaker ID
2129
- */
2099
+ * Set the current speaker for audio playback
2100
+ *
2101
+ * @param {string} speakerId Speaker ID
2102
+ */
2130
2103
  static setCurrentSpeaker(speakerId: string): Promise<void>;
2131
2104
  }
2132
2105
  export default TRTC;