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