trtc-sdk-v5 5.9.1-beta.6 → 5.9.2-beta.1

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