trtc-sdk-v5 5.9.2-beta.4 → 5.9.2-beta.6

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