@byteplus/rtc 4.36.0-rc.0 → 4.36.0-rc.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.
- package/LICENSE +26 -0
- package/NOTICE.md +70 -0
- package/README.md +19 -0
- package/index.d.ts +3036 -0
- package/index.esm.min.js +6 -0
- package/index.min.js +6 -0
- package/package.json +1 -1
- package/readme.md +0 -0
package/index.d.ts
ADDED
|
@@ -0,0 +1,3036 @@
|
|
|
1
|
+
// Generated by dts-bundle-generator v6.4.0
|
|
2
|
+
|
|
3
|
+
import { EventArgs, EventEmitter, EventNames, ValidEventTypes } from 'eventemitter3';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @list 104477
|
|
7
|
+
* @detail 104478
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* @list 104477
|
|
11
|
+
* @detail 104478
|
|
12
|
+
*/
|
|
13
|
+
export interface IAudioMixingManager {
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Start playing audio files and mixes. <br>
|
|
17
|
+
* This method can be called many times by passing in different IDs and filepath to realize simultaneous playback of multiple mixing files and mixing overlay.
|
|
18
|
+
* @param id Mix ID. For identifying the mix, please ensure that the mix ID is unique. <br>
|
|
19
|
+
* If this method is repeatedly called with the same ID, the previous mix stops and the next mix starts.
|
|
20
|
+
* @param filePath Specify the file path either the absolute path of a local file or the url of online audio. Files with the extension of mp3 and aac are supported.
|
|
21
|
+
* @param config Mix Sound configuration <br>
|
|
22
|
+
* You can set the number of times the mix is played, whether the mix is played locally, and whether the mix is sent to the remote end. For details.
|
|
23
|
+
* @return
|
|
24
|
+
* @notes <br>
|
|
25
|
+
* + If you have already loaded the sound effect into memory through preloadAudioMixing{@link #preloadAudioMixing}, make sure that the ID here is the same as the ID set by preloadAudioMixing{@link #preloadAudioMixing}. <br>
|
|
26
|
+
* + After you start playing the audio file and mixing, you can call the stopAudioMixing{@link #stopAudioMixing} method to stop playing the audio file. <br>
|
|
27
|
+
* + The mixing data of this method comes from an external file, while the mixing data of enableAudioMixingFrame{@link #enableAudioMixingFrame} comes from an external cache and the audio format is PCM. These two mixing methods can coexist.
|
|
28
|
+
* @region Advanced Feature
|
|
29
|
+
*/
|
|
30
|
+
startAudioMixing(id: number, filePath: string, options: MixOption): Promise<void>;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Stop playing audio files and mixes
|
|
34
|
+
* @param id ID of the mixing
|
|
35
|
+
* @notes <br>
|
|
36
|
+
* + After calling startAudioMixing{@link #startAudioMixing} method to start playing audio files and mixes, you can call this method to stop playing audio files and mixes. <br>
|
|
37
|
+
* + After calling this method to stop playing the audio file, the audio file will be automatically uninstalled.
|
|
38
|
+
* @region Advanced Feature
|
|
39
|
+
*/
|
|
40
|
+
stopAudioMixing(id: number): void;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Pause playing audio files and mixes
|
|
44
|
+
* @param id ID of the mixing
|
|
45
|
+
* @notes <br>
|
|
46
|
+
* + After calling startAudioMixing{@link #startAudioMixing} method to start playing audio files and mixes, you can call this method to pause playing audio files and mixes. <br>
|
|
47
|
+
* + After calling this method to pause playing audio files and mixing, you can call the resumeAudioMixing{@link #resumeAudioMixing} method to resume playing and mixing. <br>
|
|
48
|
+
* @region Advanced Feature
|
|
49
|
+
*/
|
|
50
|
+
pauseAudioMixing(id: number): void;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Resume playing audio files and mixing
|
|
54
|
+
* @param id Mixing ID
|
|
55
|
+
* @notes After calling the pauseAudioMixing{@link #pauseAudioMixing} method to pause playing audio files and mixing, you can resume playing and mixing by calling this method. <br>
|
|
56
|
+
* @region Advanced Feature
|
|
57
|
+
*/
|
|
58
|
+
resumeAudioMixing(id: number): void;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Preload the specified audio file into memory
|
|
62
|
+
* @param id Mix ID. For identifying the mix, please ensure that the mix ID is unique. <br>
|
|
63
|
+
* If this method is called repeatedly with the same ID, the latter overrides the previous. <br>
|
|
64
|
+
* If you call startAudioMixing{@link #startAudioMixing} and then call this method with the same ID, the previous mix stopped, and then the next mix was loaded. <br>
|
|
65
|
+
* After calling this method with an ID to preload A.mp3, if you need to call startAudioMixing{@link #startAudioMixing} to play B.mp3 with the same ID, please call unloadAudioMixing{@link #unloadAudioMixing} to uninstall A.mp3 first, otherwise you will report an error AUDIO_MIXING_ERROR_LOAD_CONFLICT.
|
|
66
|
+
* @param filePath Used for mixing file paths. It can be the absolute path of the local file or the url of the online audio. <br>
|
|
67
|
+
* @return
|
|
68
|
+
* @notes <br>
|
|
69
|
+
* + When you need to play an audio file frequently, call this method to preload the file. When playing, you can only load the file once to reduce CPU usage. <br>
|
|
70
|
+
* + This method pre-loads the specified audio file, and only calling startAudioMixing{@link #startAudioMixing} API can you start playing the specified audio file. <br>
|
|
71
|
+
* + The specified audio file preloaded by calling this method can be unloaded through unloadAudioMixing{@link #unloadAudioMixing}.
|
|
72
|
+
* @region Advanced Feature
|
|
73
|
+
*/
|
|
74
|
+
preloadAudioMixing(id: number, filePath: string): Promise<void>;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Uninstall the specified audio file
|
|
78
|
+
* @param id Mix ID
|
|
79
|
+
* @region Advanced Feature
|
|
80
|
+
*/
|
|
81
|
+
unloadAudioMixing(id: number): void;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Adjust the volume of audio mixing, including audio files and PCM data.
|
|
85
|
+
* @param id Mixing ID
|
|
86
|
+
* @param volume The ratio of the mixing volume to the original volume. The range is `[0, 400]`. The recommended range is `[0, 100]`. <br>
|
|
87
|
+
* + 0: Mute <br>
|
|
88
|
+
* + 100: Original volume <br>
|
|
89
|
+
* + 400: Maximum volume (with overflow protection)
|
|
90
|
+
* @region Advanced Feature
|
|
91
|
+
*/
|
|
92
|
+
setAudioMixingVolume(id: number, volume: number): void;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Get volume of the audio files.
|
|
96
|
+
* @param id Audio mix id
|
|
97
|
+
* @return <br>
|
|
98
|
+
* + `0`: Failure<br>
|
|
99
|
+
* + `>0`: Successful. Volume<br>
|
|
100
|
+
* @region Advanced Feature
|
|
101
|
+
*/
|
|
102
|
+
getAudioMixingVolume(id: number): number;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Get audio file duration
|
|
106
|
+
* @param id Mix ID
|
|
107
|
+
* @return <br>
|
|
108
|
+
* + > 0: Success, audio file duration, in milliseconds. <br>
|
|
109
|
+
* + < 0: Failure
|
|
110
|
+
* @notes Before calling this method to obtain the length of the audio file, you need to call preloadAudioMixing{@link #preloadAudioMixing} or startAudioMixing{@link #startAudioMixing}.
|
|
111
|
+
* @region Advanced Feature
|
|
112
|
+
*/
|
|
113
|
+
getAudioMixingDuration(id: number): number;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Get audio file playback progress
|
|
117
|
+
* @param id Mix ID
|
|
118
|
+
* @return <br>
|
|
119
|
+
* + > 0: Success, audio file playback progress, in milliseconds. <br>
|
|
120
|
+
* + < 0: Failed
|
|
121
|
+
* @notes Before calling this method to get the audio file playback progress, you need to call startAudioMixing{@link #startAudioMixing} to start playing the audio file.
|
|
122
|
+
* @region Advanced Feature
|
|
123
|
+
*/
|
|
124
|
+
getAudioMixingCurrentPosition(id: number): number;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Set the starting playback position of the audio file
|
|
128
|
+
* @param id Mixing ID
|
|
129
|
+
* @param position The starting playback position of the audio file in milliseconds.
|
|
130
|
+
* @notes <br>
|
|
131
|
+
* + This method allows you to play an audio file from a specified position as appropriate, without having to play an audio file in its entirety from the beginning to finish. <br>
|
|
132
|
+
* + Before calling this method to set the playback position of the audio file, you need to call startAudioMixing{@link #startAudioMixing} to start playing the audio file.
|
|
133
|
+
* @region Advanced Feature
|
|
134
|
+
*/
|
|
135
|
+
setAudioMixingPosition(id: number, position: number): void;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Start PCM mixing. <br>
|
|
139
|
+
* To mix multiple PCM audio data, call this API multiple times with different ids.
|
|
140
|
+
* @param type Mixing type <br>
|
|
141
|
+
* Whether the PCM data is mixed locally and sent to the remotes.
|
|
142
|
+
* @notes <br>
|
|
143
|
+
* + After this API, you must call pushAudioMixingFrame{@link #pushAudioMixingFrame} to start mixing. <br>
|
|
144
|
+
* + To end PCM mixing, use disableAudioMixingFrame{@link #disableAudioMixingFrame}.
|
|
145
|
+
* @region Advanced Feature
|
|
146
|
+
*/
|
|
147
|
+
enableAudioMixingBuffer(type: AudioMixingType): void;
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Disable PCM mixing.
|
|
151
|
+
* @region Advanced Feature
|
|
152
|
+
*/
|
|
153
|
+
disableAudioMixingBuffer(): void;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Push PCM audio frame data for mixing
|
|
157
|
+
* @param buffer Refer to [Browser documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer)
|
|
158
|
+
* @notes Before calling this method, you must start the external audio stream mixing through enableAudioMixingFrame{@link #enableAudioMixingFrame}. <br>
|
|
159
|
+
* @region Advanced Feature
|
|
160
|
+
*/
|
|
161
|
+
pushAudioMixingBuffer(buffer: AudioBuffer): void;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* @type keytype
|
|
166
|
+
* Mix playback channel type
|
|
167
|
+
*/
|
|
168
|
+
export declare enum AudioMixingDualMonoMode {
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Consistent with audio files
|
|
172
|
+
*/
|
|
173
|
+
AUTO = 0,
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Only the left channel audio in the audio file can be heard
|
|
177
|
+
*/
|
|
178
|
+
MODE_L = 1,
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Only the right channel audio in the audio file can be heard
|
|
182
|
+
*/
|
|
183
|
+
MODE_R = 2,
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Can hear the left and right audio channels in the audio file at the same time
|
|
187
|
+
*/
|
|
188
|
+
MODE_MIX = 3
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* @type keytype
|
|
193
|
+
* Mixing type
|
|
194
|
+
*/
|
|
195
|
+
export declare enum AudioMixingType {
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Played at the local device only
|
|
199
|
+
*/
|
|
200
|
+
PLAYOUT = 0,
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Sent to the remote devices only
|
|
204
|
+
*/
|
|
205
|
+
PUBLISH = 1,
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Played at the local device and sent to the remote devices.
|
|
209
|
+
*/
|
|
210
|
+
PLAYOUT_AND_PUBLISH = 2
|
|
211
|
+
}
|
|
212
|
+
declare enum AudioMixingState {
|
|
213
|
+
|
|
214
|
+
AUDIO_MIXING_STATE_PRELOADED = 0,
|
|
215
|
+
|
|
216
|
+
AUDIO_MIXING_STATE_PLAYING = 1,
|
|
217
|
+
|
|
218
|
+
AUDIO_MIXING_STATE_PAUSED = 2,
|
|
219
|
+
|
|
220
|
+
AUDIO_MIXING_STATE_STOPPED = 3,
|
|
221
|
+
|
|
222
|
+
AUDIO_MIXING_STATE_FAILED = 4,
|
|
223
|
+
|
|
224
|
+
AUDIO_MIXING_STATE_FINISHED = 5,
|
|
225
|
+
|
|
226
|
+
AUDIO_MIXING_STATE_PCM_ENABLED = 6,
|
|
227
|
+
|
|
228
|
+
AUDIO_MIXING_STATE_PCM_DISABLED = 7
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* @type keytype
|
|
233
|
+
* Mixing configuration
|
|
234
|
+
*/
|
|
235
|
+
export interface MixOption {
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Mix playback times
|
|
239
|
+
* @notes <br>
|
|
240
|
+
* + Play_count < = 0: Infinite loop <br>
|
|
241
|
+
* + Play_count == 1: Play once (default) <br>
|
|
242
|
+
* + Play_count > 1: Play play_count times
|
|
243
|
+
*/
|
|
244
|
+
playCount: number;
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* For mixing playback types. Refer to [AudioMixingType](#audiomixingtype).
|
|
248
|
+
*/
|
|
249
|
+
type?: AudioMixingType;
|
|
250
|
+
}
|
|
251
|
+
declare class EnhancedEventEmitter<EventTypes extends ValidEventTypes = string | symbol> extends EventEmitter<EventTypes> {
|
|
252
|
+
constructor();
|
|
253
|
+
safeEmit<T extends EventNames<EventTypes>>(event: T, ...args: EventArgs<EventTypes, T>): boolean;
|
|
254
|
+
safeEmitAsPromise(event: string, ...args: any[]): Promise<any>;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Information of media device
|
|
259
|
+
*/
|
|
260
|
+
export interface RTCDevice {
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Device ID
|
|
264
|
+
* Refer to the [browser documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo)
|
|
265
|
+
*/
|
|
266
|
+
deviceId: MediaDeviceInfo["deviceId"];
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Device type
|
|
270
|
+
* Refer to the [browser documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo)
|
|
271
|
+
*/
|
|
272
|
+
deviceType: MediaDeviceInfo["kind"];
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* Device information
|
|
276
|
+
* Refer to the [browser documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo)
|
|
277
|
+
*/
|
|
278
|
+
deviceInfo: MediaDeviceInfo;
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Device label
|
|
282
|
+
* Refer to the [browser documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo)
|
|
283
|
+
*/
|
|
284
|
+
deviceName: MediaDeviceInfo["label"];
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Device state
|
|
288
|
+
*/
|
|
289
|
+
deviceState: "active" | "inactive";
|
|
290
|
+
}
|
|
291
|
+
declare enum ErrorCode {
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* Invalid argument of the `engine` object for calling destroyEngine
|
|
295
|
+
*/
|
|
296
|
+
INVALID_ENGINE = "INVALID_ENGINE",
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Invalid argument
|
|
300
|
+
*/
|
|
301
|
+
INVALID_PARAMS = "INVALID_PARAMS",
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* Token is invalid or has expired.
|
|
305
|
+
*/
|
|
306
|
+
INVALID_TOKEN = "INVALID_TOKEN",
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Failure of joining room
|
|
310
|
+
*/
|
|
311
|
+
JOIN_ROOM_FAILED = "JOIN_ROOM_FAILED",
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Join the same room repeatedly.
|
|
315
|
+
*/
|
|
316
|
+
REPEAT_JOIN = "REPEAT_JOIN",
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* Publish media stream repeatedly.
|
|
320
|
+
*/
|
|
321
|
+
REPEAT_PUBLISH = "REPEAT_PUBLISH",
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* Publish before joining a room.
|
|
325
|
+
*/
|
|
326
|
+
PUBLISH_BEFORE_JOIN = "PUBLISH_BEFORE_JOIN",
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* Un-publish before joining a room.
|
|
330
|
+
*/
|
|
331
|
+
UNPUBLISH_BEFORE_JOIN = "UNPUBLISH_BEFORE_JOIN",
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* Subscribe before joining a room.
|
|
335
|
+
*/
|
|
336
|
+
SUBSCRIBE_BEFORE_JOIN = "SUBSCRIBE_BEFORE_JOIN",
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* Unsubscribe before joining a room.
|
|
340
|
+
*/
|
|
341
|
+
UNSUBSCRIBE_BEFORE_JOIN = "UNSUBSCRIBE_BEFORE_JOIN",
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Request to publish media stream as an invisible user.
|
|
345
|
+
*/
|
|
346
|
+
NO_PUBLISH_PERMISSION = "NO_PUBLISH_PERMISSION",
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* Request to subscribe or unsubscribe a stream that doesn't exist.
|
|
350
|
+
*/
|
|
351
|
+
STREAM_NOT_EXIST = "STREAM_NOT_EXIST",
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* Request to publish an empty stream.
|
|
355
|
+
*/
|
|
356
|
+
EMPTY_STREAM = "EMPTY_STREAM",
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* Network disconnected. RTC SDk will emit this error code if you call publish, subscribe or the other related methods while the user has not joined a room.
|
|
360
|
+
*/
|
|
361
|
+
NOT_CONNECTED_YET = "NOT_CONNECTED_YET",
|
|
362
|
+
|
|
363
|
+
/**
|
|
364
|
+
* Request to send message before the user has joined a room.
|
|
365
|
+
*/
|
|
366
|
+
IM_BEFORE_JOIN = "IM_BEFORE_JOIN",
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* The user does not exist.
|
|
370
|
+
*/
|
|
371
|
+
USER_NOT_EXIST = "USER_NOT_EXIST",
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* The user has joined the room.
|
|
375
|
+
*/
|
|
376
|
+
ALREADY_IN_ROOM = "ALREADY_IN_ROOM",
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
* The user is kicked out because a user with the same userId joined the room.
|
|
380
|
+
*/
|
|
381
|
+
DUPLICATE_LOGIN = "DUPLICATE_LOGIN",
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* Enable capture repeatedly.
|
|
385
|
+
*/
|
|
386
|
+
REPEAT_CAPTURE = "REPEAT_CAPTURE",
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* Failure of video capture
|
|
390
|
+
*/
|
|
391
|
+
GET_VIDEO_TRACK_FAILED = "GET_VIDEO_TRACK_FAILED",
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* Failure of getting audio track
|
|
395
|
+
*/
|
|
396
|
+
GET_AUDIO_TRACK_FAILED = "GET_AUDIO_TRACK_FAILED",
|
|
397
|
+
|
|
398
|
+
/**
|
|
399
|
+
* Failure of getting screen track
|
|
400
|
+
*/
|
|
401
|
+
GET_SCREEN_TRACK_FAILED = "GET_SCREEN_TRACK_FAILED",
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* Stream type mismatched. RTC SDK will emit this error code when you enable the local media device after enabling the custom video module.
|
|
405
|
+
*/
|
|
406
|
+
STREAM_TYPE_NOT_MATCH = "STREAM_TYPE_NOT_MATCH",
|
|
407
|
+
|
|
408
|
+
/**
|
|
409
|
+
* Cannot find the DOM specified to play the video.
|
|
410
|
+
*/
|
|
411
|
+
CANT_FIND_DOM = "CANT_FIND_DOM",
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* Invalid device ID
|
|
415
|
+
*/
|
|
416
|
+
INVALID_DEVICE_ID = "INVALID_DEVICE_ID",
|
|
417
|
+
|
|
418
|
+
/**
|
|
419
|
+
* No permission for capture
|
|
420
|
+
*/
|
|
421
|
+
NO_PERMISSION = "NO_PERMISSION",
|
|
422
|
+
|
|
423
|
+
/**
|
|
424
|
+
* The browser does not support capture.
|
|
425
|
+
*/
|
|
426
|
+
NOT_SUPPORTED = "NOT_SUPPORTED",
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* Failure of requesting an ICE node
|
|
430
|
+
*/
|
|
431
|
+
ICE_SERVER_WRONG = "ICE_SERVER_WRONG",
|
|
432
|
+
|
|
433
|
+
/**
|
|
434
|
+
* Failure of establishing a datachannel
|
|
435
|
+
*/
|
|
436
|
+
ESTABLISH_DATACHANNEL_FAILED = "ESTABLISH_DATACHANNEL_FAILED",
|
|
437
|
+
|
|
438
|
+
/**
|
|
439
|
+
* Failure of loading network resource
|
|
440
|
+
*/
|
|
441
|
+
LOAD_RESOURCES_FAILED = "LOAD_RESOURCES_FAILED",
|
|
442
|
+
|
|
443
|
+
/**
|
|
444
|
+
* Failure of building the signal channel
|
|
445
|
+
*/
|
|
446
|
+
SIGNALING_CHANNEL_NOT_OPEN = "SIGNALING_CHANNEL_NOT_OPEN",
|
|
447
|
+
|
|
448
|
+
/**
|
|
449
|
+
* Request timeout
|
|
450
|
+
*/
|
|
451
|
+
TIME_OUT = "TIME_OUT",
|
|
452
|
+
|
|
453
|
+
/**
|
|
454
|
+
* Request is denied for the reason of network disconnected.
|
|
455
|
+
*/
|
|
456
|
+
REFUSE_OPERATION_IN_DISCONNECT = "REFUSE_OPERATION_IN_DISCONNECT",
|
|
457
|
+
|
|
458
|
+
/**
|
|
459
|
+
* Failure of building a peer-connection to the signal server for the failure of building transceiver
|
|
460
|
+
*/
|
|
461
|
+
ADD_TRANSCEIVER_FAILED = "ADD_TRANSCEIVER_FAILED",
|
|
462
|
+
|
|
463
|
+
/**
|
|
464
|
+
* Failure of updating media track
|
|
465
|
+
*/
|
|
466
|
+
UPDATE_TRACK_FAILED = "UPDATE_TRACK_FAILED",
|
|
467
|
+
|
|
468
|
+
/**
|
|
469
|
+
* Failure of publishing a media stream
|
|
470
|
+
*/
|
|
471
|
+
PUBLISH_FAILED = "PUBLISH_FAILED",
|
|
472
|
+
|
|
473
|
+
/**
|
|
474
|
+
* Failure of un-publishing a media stream
|
|
475
|
+
*/
|
|
476
|
+
UNPUBLISH_FAILED = "UNPUBLISH_FAILED",
|
|
477
|
+
|
|
478
|
+
/**
|
|
479
|
+
* Failure of subscribing a media stream
|
|
480
|
+
*/
|
|
481
|
+
SUBSCRIBE_FAILED = "SUBSCRIBE_FAILED",
|
|
482
|
+
|
|
483
|
+
/**
|
|
484
|
+
* Failure of unsubscribing a media stream
|
|
485
|
+
*/
|
|
486
|
+
UNSUBSCRIBE_FAILED = "UNSUBSCRIBE_FAILED",
|
|
487
|
+
|
|
488
|
+
/**
|
|
489
|
+
* Call [leaveRoom](#leaveroom)Process of publishing and subscribing will
|
|
490
|
+
* RTC SDK will emit this error code when you call the [leaveRoom](#leaveroom) during the process of publishing or subscribing.
|
|
491
|
+
*/
|
|
492
|
+
OPERATION_CANCEL = "OPERATION_CANCEL",
|
|
493
|
+
|
|
494
|
+
/**
|
|
495
|
+
* Unknown error
|
|
496
|
+
*/
|
|
497
|
+
UNEXPECTED_ERROR = "UNEXPECTED_ERROR"
|
|
498
|
+
}
|
|
499
|
+
declare enum AudioMixingError {
|
|
500
|
+
|
|
501
|
+
/**
|
|
502
|
+
* Normal
|
|
503
|
+
*/
|
|
504
|
+
AUDIO_MIXING_ERROR_OK = 0,
|
|
505
|
+
|
|
506
|
+
/**
|
|
507
|
+
* Pre-load fails because of missing audio file or the length of the audio file exceeding 20s.
|
|
508
|
+
*/
|
|
509
|
+
AUDIO_MIXING_ERROR_PRELOAD_FAILED = 1,
|
|
510
|
+
|
|
511
|
+
/**
|
|
512
|
+
* Audio mixing starts fails because of missing audio file or failure of reading the audio file.
|
|
513
|
+
*/
|
|
514
|
+
AUDIO_MIXING_ERROR_START_FAILED = 2,
|
|
515
|
+
|
|
516
|
+
/**
|
|
517
|
+
* Invalid audio mixing ID
|
|
518
|
+
*/
|
|
519
|
+
AUDIO_MIXING_ERROR_ID_NOT_FOUND = 3,
|
|
520
|
+
|
|
521
|
+
/**
|
|
522
|
+
* Invalid start position
|
|
523
|
+
*/
|
|
524
|
+
AUDIO_MIXING_ERROR_SET_POSITION_FAILED = 4,
|
|
525
|
+
|
|
526
|
+
/**
|
|
527
|
+
* Invalid volume argument. The volume value ranges [0, 400].
|
|
528
|
+
*/
|
|
529
|
+
AUDIO_MIXING_ERROR_INVALID_VOLUME = 5,
|
|
530
|
+
|
|
531
|
+
/**
|
|
532
|
+
* The audio file to be played does not match to the preload one. Call `unloadAudioMixing` to unload file and proceed.
|
|
533
|
+
*/
|
|
534
|
+
AUDIO_MIXING_ERROR_LOAD_CONFLICT = 6,
|
|
535
|
+
|
|
536
|
+
/**
|
|
537
|
+
* Type of the audio file to be played is not supported.
|
|
538
|
+
*/
|
|
539
|
+
AUDIO_MIXING_ERROR_ID_TYPE_NOT_MATCH = 7,
|
|
540
|
+
|
|
541
|
+
/**
|
|
542
|
+
* Invalid audio pitch
|
|
543
|
+
*/
|
|
544
|
+
AUDIO_MIXING_ERROR_ID_TYPE_INVALID_PITCH = 8,
|
|
545
|
+
|
|
546
|
+
/**
|
|
547
|
+
* Invalid audio track
|
|
548
|
+
*/
|
|
549
|
+
AUDIO_MIXING_ERROR_INVALID_AUDIO_TRACK = 9
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
/**
|
|
553
|
+
* A user joins the room
|
|
554
|
+
*/
|
|
555
|
+
export interface onUserJoinedEvent {
|
|
556
|
+
|
|
557
|
+
/**
|
|
558
|
+
* userId of the user who is joining the room
|
|
559
|
+
*/
|
|
560
|
+
userInfo: UserInfo;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
/**
|
|
564
|
+
* A user leaves the room
|
|
565
|
+
*/
|
|
566
|
+
export interface onUserLeaveEvent {
|
|
567
|
+
|
|
568
|
+
/**
|
|
569
|
+
* User information, refer to [UserInfo](#userinfo) for more details.
|
|
570
|
+
*/
|
|
571
|
+
userInfo: UserInfo;
|
|
572
|
+
|
|
573
|
+
/**
|
|
574
|
+
* The reason the user left the room:
|
|
575
|
+
* 0: The remote user calls leaveRoom to actively exit the room
|
|
576
|
+
* 1: The remote user is disconnected due to network problems, or switches to an invisible state
|
|
577
|
+
*/
|
|
578
|
+
reason: 0 | 1;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
/**
|
|
582
|
+
* A User in the room publishes a media stream.
|
|
583
|
+
*/
|
|
584
|
+
export interface onStreamAddEvent {
|
|
585
|
+
|
|
586
|
+
/**
|
|
587
|
+
* Stream properties
|
|
588
|
+
*/
|
|
589
|
+
stream: RTCStream;
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
/**
|
|
593
|
+
* A User in the room un-publishes the media stream.
|
|
594
|
+
*/
|
|
595
|
+
export interface onStreamRemoveEvent {
|
|
596
|
+
|
|
597
|
+
/**
|
|
598
|
+
* Stream properties
|
|
599
|
+
*/
|
|
600
|
+
stream: RTCStream;
|
|
601
|
+
|
|
602
|
+
/**
|
|
603
|
+
* Reason of un-publishing
|
|
604
|
+
*/
|
|
605
|
+
reason: StreamRemoveReason;
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
/**
|
|
609
|
+
* Events related to the connection state of the SDK and the signal server
|
|
610
|
+
*/
|
|
611
|
+
export interface onConnectionStateEvent {
|
|
612
|
+
|
|
613
|
+
/**
|
|
614
|
+
* Events related to the connection state of the SDK and the signal server
|
|
615
|
+
*/
|
|
616
|
+
state: ConnectionState;
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
/**
|
|
620
|
+
* The first video frame shown on the screen
|
|
621
|
+
*/
|
|
622
|
+
export interface onVideoFirstFrameRenderedEvent {
|
|
623
|
+
|
|
624
|
+
/**
|
|
625
|
+
* userId of the user published the video stream
|
|
626
|
+
*/
|
|
627
|
+
userId: string;
|
|
628
|
+
|
|
629
|
+
/**
|
|
630
|
+
* Height
|
|
631
|
+
*/
|
|
632
|
+
height: number;
|
|
633
|
+
|
|
634
|
+
/**
|
|
635
|
+
* Width
|
|
636
|
+
*/
|
|
637
|
+
width: number;
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
/**
|
|
641
|
+
* Event related to the decoder of the first video frame
|
|
642
|
+
*/
|
|
643
|
+
export interface onVideoFirstFrameDecodedEvent {
|
|
644
|
+
|
|
645
|
+
/**
|
|
646
|
+
* userId of the user published the video stream
|
|
647
|
+
*/
|
|
648
|
+
userId: string;
|
|
649
|
+
|
|
650
|
+
/**
|
|
651
|
+
* Height
|
|
652
|
+
*/
|
|
653
|
+
height: number;
|
|
654
|
+
|
|
655
|
+
/**
|
|
656
|
+
* Width
|
|
657
|
+
*/
|
|
658
|
+
width: number;
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
/**
|
|
662
|
+
* Event related to the decoder of the first audio frame
|
|
663
|
+
*/
|
|
664
|
+
export interface onAudioFirstFrameDecodedEvent {
|
|
665
|
+
|
|
666
|
+
/**
|
|
667
|
+
* userId of the user published the video stream
|
|
668
|
+
*/
|
|
669
|
+
userId: string;
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
/**
|
|
673
|
+
* State of the media devices which including audio capture device. audio playback device, and video capture device.
|
|
674
|
+
*/
|
|
675
|
+
export interface onMediaDeviceStateChangeEvent {
|
|
676
|
+
|
|
677
|
+
/**
|
|
678
|
+
* Device identification
|
|
679
|
+
*/
|
|
680
|
+
device_id: string;
|
|
681
|
+
|
|
682
|
+
/**
|
|
683
|
+
* Device type, including audio capture device. audio playback device, and video capture device.
|
|
684
|
+
*/
|
|
685
|
+
device_type: string;
|
|
686
|
+
|
|
687
|
+
/**
|
|
688
|
+
* Device state
|
|
689
|
+
*/
|
|
690
|
+
device_state: "ACTIVE" | "INACTIVE";
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
/**
|
|
694
|
+
* Receiving video frames carrying SEI message
|
|
695
|
+
*/
|
|
696
|
+
export interface onSEIMessageEvent {
|
|
697
|
+
|
|
698
|
+
/**
|
|
699
|
+
* Including userId of the user who sent the message, roomId of the current room, and the media stream carrying this SEI message. Refer to [RemoteStreamKey](#remotestreamkey) for more information.
|
|
700
|
+
*/
|
|
701
|
+
remoteStreamKey: RemoteStreamKey;
|
|
702
|
+
|
|
703
|
+
/**
|
|
704
|
+
* SEI message received
|
|
705
|
+
*/
|
|
706
|
+
sei: Uint8Array;
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
/**
|
|
710
|
+
* State of the local audio stream
|
|
711
|
+
*/
|
|
712
|
+
export interface LocalAudioStats {
|
|
713
|
+
|
|
714
|
+
/**
|
|
715
|
+
* Audio loss rate
|
|
716
|
+
*/
|
|
717
|
+
audioLossRate: number;
|
|
718
|
+
|
|
719
|
+
/**
|
|
720
|
+
* Bitrate of sending, unit: kbps
|
|
721
|
+
*/
|
|
722
|
+
sendKBitrate: number;
|
|
723
|
+
|
|
724
|
+
/**
|
|
725
|
+
* Sample rate of audio capturing
|
|
726
|
+
*/
|
|
727
|
+
recordSampleRate: number;
|
|
728
|
+
|
|
729
|
+
/**
|
|
730
|
+
* Interval of each states
|
|
731
|
+
*/
|
|
732
|
+
statsInterval: number;
|
|
733
|
+
|
|
734
|
+
/**
|
|
735
|
+
* Round trip time, unit: ms
|
|
736
|
+
*/
|
|
737
|
+
rtt: number;
|
|
738
|
+
|
|
739
|
+
/**
|
|
740
|
+
* number of the signal channels
|
|
741
|
+
*/
|
|
742
|
+
numChannels: number;
|
|
743
|
+
|
|
744
|
+
/**
|
|
745
|
+
* Sample rate of sending
|
|
746
|
+
*/
|
|
747
|
+
sentSampleRate?: number;
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
/**
|
|
751
|
+
* Local video states
|
|
752
|
+
*/
|
|
753
|
+
export interface LocalVideoStats {
|
|
754
|
+
|
|
755
|
+
/**
|
|
756
|
+
* Bitrate of sending, unit: kbps
|
|
757
|
+
*/
|
|
758
|
+
sentKBitrate: number;
|
|
759
|
+
|
|
760
|
+
/**
|
|
761
|
+
* Frame rate of the source video
|
|
762
|
+
*/
|
|
763
|
+
inputFrameRate?: number;
|
|
764
|
+
|
|
765
|
+
/**
|
|
766
|
+
* Frame rate of sending
|
|
767
|
+
*/
|
|
768
|
+
sentFrameRate: number;
|
|
769
|
+
|
|
770
|
+
/**
|
|
771
|
+
* Frame rate of encoding
|
|
772
|
+
*/
|
|
773
|
+
encoderOutputFrameRate: number;
|
|
774
|
+
|
|
775
|
+
/**
|
|
776
|
+
* Frame rate of rendering
|
|
777
|
+
*/
|
|
778
|
+
rendererOutputFrameRate?: number;
|
|
779
|
+
|
|
780
|
+
/**
|
|
781
|
+
* Target bitrate
|
|
782
|
+
*/
|
|
783
|
+
targetKBitrate?: number;
|
|
784
|
+
|
|
785
|
+
/**
|
|
786
|
+
* Target frame rate
|
|
787
|
+
*/
|
|
788
|
+
targetFrameRate?: number;
|
|
789
|
+
|
|
790
|
+
/**
|
|
791
|
+
* Interval of each states
|
|
792
|
+
*/
|
|
793
|
+
statsInterval: number;
|
|
794
|
+
|
|
795
|
+
/**
|
|
796
|
+
* Loss rate of video package
|
|
797
|
+
*/
|
|
798
|
+
videoLossRate: number;
|
|
799
|
+
|
|
800
|
+
/**
|
|
801
|
+
* Round trip time, unit: ms
|
|
802
|
+
*/
|
|
803
|
+
rtt: number;
|
|
804
|
+
|
|
805
|
+
/**
|
|
806
|
+
* Bitrate of encoding
|
|
807
|
+
*/
|
|
808
|
+
encodedBitrate?: number;
|
|
809
|
+
|
|
810
|
+
/**
|
|
811
|
+
* Frame rate of encoding
|
|
812
|
+
*/
|
|
813
|
+
encodedFrameWidth: number;
|
|
814
|
+
|
|
815
|
+
/**
|
|
816
|
+
* Height of the encoded video frame
|
|
817
|
+
*/
|
|
818
|
+
encodedFrameHeight: number;
|
|
819
|
+
|
|
820
|
+
/**
|
|
821
|
+
* Number of encoded frames
|
|
822
|
+
*/
|
|
823
|
+
encodedFrameCount: number;
|
|
824
|
+
|
|
825
|
+
/**
|
|
826
|
+
* Encoding type
|
|
827
|
+
*/
|
|
828
|
+
codecType: string;
|
|
829
|
+
|
|
830
|
+
/**
|
|
831
|
+
* Whether it is a screen-sharing stream
|
|
832
|
+
*/
|
|
833
|
+
isScreen: boolean;
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
/**
|
|
837
|
+
* State of the local media stream
|
|
838
|
+
*/
|
|
839
|
+
export interface LocalStreamStats {
|
|
840
|
+
|
|
841
|
+
/**
|
|
842
|
+
* State of the local audio stream
|
|
843
|
+
*/
|
|
844
|
+
audioStats: LocalAudioStats;
|
|
845
|
+
|
|
846
|
+
/**
|
|
847
|
+
* State of the local video stream
|
|
848
|
+
*/
|
|
849
|
+
videoStats: LocalVideoStats;
|
|
850
|
+
|
|
851
|
+
/**
|
|
852
|
+
* Whether it is a screen-sharing stream
|
|
853
|
+
*/
|
|
854
|
+
isScreen: boolean;
|
|
855
|
+
|
|
856
|
+
/**
|
|
857
|
+
* @hidden
|
|
858
|
+
* Quality of the uplink network
|
|
859
|
+
*/
|
|
860
|
+
txQuality?: number;
|
|
861
|
+
|
|
862
|
+
/**
|
|
863
|
+
* @hidden
|
|
864
|
+
* Quality of the downlink network
|
|
865
|
+
*/
|
|
866
|
+
rxQuality?: number;
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
/**
|
|
870
|
+
* State of the remote audio stream
|
|
871
|
+
*/
|
|
872
|
+
export interface RemoteAudioStats {
|
|
873
|
+
|
|
874
|
+
/**
|
|
875
|
+
* Loss rate of the audio packages
|
|
876
|
+
*/
|
|
877
|
+
audioLossRate: number;
|
|
878
|
+
|
|
879
|
+
/**
|
|
880
|
+
* Bitrate of receiving
|
|
881
|
+
*/
|
|
882
|
+
receivedKBitrate: number;
|
|
883
|
+
|
|
884
|
+
/**
|
|
885
|
+
* Number of video stalls
|
|
886
|
+
*/
|
|
887
|
+
stallCount?: number;
|
|
888
|
+
|
|
889
|
+
/**
|
|
890
|
+
* Duration of a video stall
|
|
891
|
+
*/
|
|
892
|
+
stallDuration?: number;
|
|
893
|
+
|
|
894
|
+
/**
|
|
895
|
+
* End-to-end delay, unit: ms
|
|
896
|
+
*/
|
|
897
|
+
e2eDelay: number;
|
|
898
|
+
|
|
899
|
+
/**
|
|
900
|
+
* Sample rate of the playback
|
|
901
|
+
*/
|
|
902
|
+
playoutSampleRate?: number;
|
|
903
|
+
|
|
904
|
+
/**
|
|
905
|
+
* Interval of each report of states
|
|
906
|
+
*/
|
|
907
|
+
statsInterval: number;
|
|
908
|
+
|
|
909
|
+
/**
|
|
910
|
+
* Round trip time, unit: ms
|
|
911
|
+
*/
|
|
912
|
+
rtt: number;
|
|
913
|
+
|
|
914
|
+
/**
|
|
915
|
+
* @hidden
|
|
916
|
+
* Quality of the media stream
|
|
917
|
+
*/
|
|
918
|
+
quality?: number;
|
|
919
|
+
|
|
920
|
+
/**
|
|
921
|
+
* Jitter buffer delay, unit: ms
|
|
922
|
+
*/
|
|
923
|
+
jitterBufferDelay: number;
|
|
924
|
+
|
|
925
|
+
/**
|
|
926
|
+
* Number of channels
|
|
927
|
+
*/
|
|
928
|
+
numChannels: number;
|
|
929
|
+
|
|
930
|
+
/**
|
|
931
|
+
* Sample rate of the received stream
|
|
932
|
+
*/
|
|
933
|
+
receivedSampleRate: number;
|
|
934
|
+
|
|
935
|
+
/**
|
|
936
|
+
* Video frozen rate
|
|
937
|
+
*/
|
|
938
|
+
frozenRate?: number;
|
|
939
|
+
|
|
940
|
+
/**
|
|
941
|
+
* Concealed samples
|
|
942
|
+
*/
|
|
943
|
+
concealedSamples: number;
|
|
944
|
+
|
|
945
|
+
/**
|
|
946
|
+
* Concealment events
|
|
947
|
+
*/
|
|
948
|
+
concealmentEvent: number;
|
|
949
|
+
|
|
950
|
+
/**
|
|
951
|
+
* Sample rate of decoding
|
|
952
|
+
*/
|
|
953
|
+
decSampleRate?: number;
|
|
954
|
+
|
|
955
|
+
/**
|
|
956
|
+
* Decoding duration, unit: s
|
|
957
|
+
*/
|
|
958
|
+
decDuration?: number;
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
/**
|
|
962
|
+
* Information of the remote video stream
|
|
963
|
+
*/
|
|
964
|
+
export interface RemoteVideoStats {
|
|
965
|
+
|
|
966
|
+
/**
|
|
967
|
+
* Width
|
|
968
|
+
*/
|
|
969
|
+
width: number;
|
|
970
|
+
|
|
971
|
+
/**
|
|
972
|
+
* Height
|
|
973
|
+
*/
|
|
974
|
+
height: number;
|
|
975
|
+
|
|
976
|
+
/**
|
|
977
|
+
* Loss rate of the video packages
|
|
978
|
+
*/
|
|
979
|
+
videoLossRate: number;
|
|
980
|
+
|
|
981
|
+
/**
|
|
982
|
+
* Bitrate of the received video stream
|
|
983
|
+
*/
|
|
984
|
+
receivedKBitrate: number;
|
|
985
|
+
|
|
986
|
+
/**
|
|
987
|
+
* Frame rate of decoding
|
|
988
|
+
*/
|
|
989
|
+
decoderOutputFrameRate: number;
|
|
990
|
+
|
|
991
|
+
/**
|
|
992
|
+
* Frame rate of rendering
|
|
993
|
+
*/
|
|
994
|
+
rendererOutputFrameRate?: number;
|
|
995
|
+
|
|
996
|
+
/**
|
|
997
|
+
* Number of video stalls
|
|
998
|
+
*/
|
|
999
|
+
stallCount?: number;
|
|
1000
|
+
|
|
1001
|
+
/**
|
|
1002
|
+
* Duration of a video stall
|
|
1003
|
+
*/
|
|
1004
|
+
stallDuration?: number;
|
|
1005
|
+
|
|
1006
|
+
/**
|
|
1007
|
+
* End-to-end delay, unit: ms
|
|
1008
|
+
*/
|
|
1009
|
+
e2eDelay: number;
|
|
1010
|
+
|
|
1011
|
+
/**
|
|
1012
|
+
* Whether it is a screen-sharing stream
|
|
1013
|
+
*/
|
|
1014
|
+
isScreen: boolean;
|
|
1015
|
+
|
|
1016
|
+
/**
|
|
1017
|
+
* Interval of each states
|
|
1018
|
+
*/
|
|
1019
|
+
statsInterval: number;
|
|
1020
|
+
|
|
1021
|
+
/**
|
|
1022
|
+
* Round trip time, unit: ms
|
|
1023
|
+
*/
|
|
1024
|
+
rtt: number;
|
|
1025
|
+
|
|
1026
|
+
/**
|
|
1027
|
+
* Video frozen rate
|
|
1028
|
+
*/
|
|
1029
|
+
frozenRate?: number;
|
|
1030
|
+
|
|
1031
|
+
/**
|
|
1032
|
+
* Video index
|
|
1033
|
+
*/
|
|
1034
|
+
videoIndex?: number;
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
/**
|
|
1038
|
+
* Information of the remote media stream
|
|
1039
|
+
*/
|
|
1040
|
+
export interface RemoteStreamStats {
|
|
1041
|
+
|
|
1042
|
+
/**
|
|
1043
|
+
* userId of the user who is joining the room
|
|
1044
|
+
*/
|
|
1045
|
+
userId?: string;
|
|
1046
|
+
|
|
1047
|
+
/**
|
|
1048
|
+
* State of the remote audio stream
|
|
1049
|
+
*/
|
|
1050
|
+
audioStats: RemoteAudioStats;
|
|
1051
|
+
|
|
1052
|
+
/**
|
|
1053
|
+
* State of the remote video stream
|
|
1054
|
+
*/
|
|
1055
|
+
videoStats: RemoteVideoStats;
|
|
1056
|
+
|
|
1057
|
+
/**
|
|
1058
|
+
* Whether it is a screen-sharing stream
|
|
1059
|
+
*/
|
|
1060
|
+
isScreen: boolean;
|
|
1061
|
+
|
|
1062
|
+
/**
|
|
1063
|
+
* Quality of the transmitting stream
|
|
1064
|
+
*/
|
|
1065
|
+
txQuality?: number;
|
|
1066
|
+
|
|
1067
|
+
/**
|
|
1068
|
+
* Quality of the receiving stream
|
|
1069
|
+
*/
|
|
1070
|
+
rxQuality?: number;
|
|
1071
|
+
}
|
|
1072
|
+
declare enum EngineEventsTypes {
|
|
1073
|
+
|
|
1074
|
+
/**
|
|
1075
|
+
* The media track ends.
|
|
1076
|
+
*/
|
|
1077
|
+
onTrackEnded = "onTrackEnded",
|
|
1078
|
+
|
|
1079
|
+
/**
|
|
1080
|
+
* Player event
|
|
1081
|
+
*/
|
|
1082
|
+
onPlayerEvent = "onPlayerEvent",
|
|
1083
|
+
|
|
1084
|
+
/**
|
|
1085
|
+
* Streams fails to play automatically.
|
|
1086
|
+
*/
|
|
1087
|
+
onAutoplayFailed = "onAutoplayFailed",
|
|
1088
|
+
|
|
1089
|
+
/**
|
|
1090
|
+
* A user joins the room.
|
|
1091
|
+
*/
|
|
1092
|
+
onUserJoined = "onUserJoined",
|
|
1093
|
+
|
|
1094
|
+
/**
|
|
1095
|
+
* A user leaves the room.
|
|
1096
|
+
*/
|
|
1097
|
+
onUserLeave = "onUserLeave",
|
|
1098
|
+
|
|
1099
|
+
/**
|
|
1100
|
+
* Connection state changes.
|
|
1101
|
+
*/
|
|
1102
|
+
onConnectionStateChanged = "onConnectionStateChanged",
|
|
1103
|
+
|
|
1104
|
+
/**
|
|
1105
|
+
* A new media stream in the room
|
|
1106
|
+
*/
|
|
1107
|
+
onStreamAdd = "onStreamAdd",
|
|
1108
|
+
|
|
1109
|
+
/**
|
|
1110
|
+
* A media stream in the room has been stopped.
|
|
1111
|
+
*/
|
|
1112
|
+
onStreamRemove = "onStreamRemove",
|
|
1113
|
+
|
|
1114
|
+
/**
|
|
1115
|
+
* Receiving a broadcasting message in the room
|
|
1116
|
+
*/
|
|
1117
|
+
onRoomMessageReceived = "onRoomMessageReceived",
|
|
1118
|
+
|
|
1119
|
+
/**
|
|
1120
|
+
* Receiving a broadcasting binary message in the room
|
|
1121
|
+
*/
|
|
1122
|
+
onRoomBinaryMessageReceived = "onRoomBinaryMessageReceived",
|
|
1123
|
+
|
|
1124
|
+
/**
|
|
1125
|
+
* Receiving a point-to-point text message
|
|
1126
|
+
*/
|
|
1127
|
+
onUserMessageReceived = "onUserMessageReceived",
|
|
1128
|
+
|
|
1129
|
+
/**
|
|
1130
|
+
* Receiving a point-to-point binary message
|
|
1131
|
+
*/
|
|
1132
|
+
onUserBinaryMessageReceived = "onUserBinaryMessageReceived",
|
|
1133
|
+
|
|
1134
|
+
/**
|
|
1135
|
+
* A visible user in the room mutes his/her audio.
|
|
1136
|
+
*/
|
|
1137
|
+
onUserMuteAudio = "onUserMuteAudio",
|
|
1138
|
+
|
|
1139
|
+
/**
|
|
1140
|
+
* A visible user in the room mutes his/her video.
|
|
1141
|
+
*/
|
|
1142
|
+
onUserMuteVideo = "onUserMuteVideo",
|
|
1143
|
+
|
|
1144
|
+
/**
|
|
1145
|
+
* The first video frame has been rendered successfully.
|
|
1146
|
+
*/
|
|
1147
|
+
onVideoFirstFrameRendered = "onVideoFirstFrameRendered",
|
|
1148
|
+
|
|
1149
|
+
/**
|
|
1150
|
+
* The first video frame has been decoded successfully.
|
|
1151
|
+
*/
|
|
1152
|
+
onVideoFirstFrameDecoded = "onVideoFirstFrameDecoded",
|
|
1153
|
+
|
|
1154
|
+
/**
|
|
1155
|
+
* The first audio frame has been decoded successfully.
|
|
1156
|
+
*/
|
|
1157
|
+
onAudioFirstFrameDecoded = "onAudioFirstFrameDecoded",
|
|
1158
|
+
|
|
1159
|
+
/**
|
|
1160
|
+
* The state of the media device changes.
|
|
1161
|
+
*/
|
|
1162
|
+
onMediaDeviceStateChanged = "onMediaDeviceStateChanged",
|
|
1163
|
+
|
|
1164
|
+
/**
|
|
1165
|
+
* Callback including the state of the remote media stream
|
|
1166
|
+
*/
|
|
1167
|
+
onRemoteStreamStats = "onRemoteStreamStats",
|
|
1168
|
+
|
|
1169
|
+
/**
|
|
1170
|
+
* Callback including the state of the local media stream
|
|
1171
|
+
*/
|
|
1172
|
+
onLocalStreamStats = "onLocalStreamStats",
|
|
1173
|
+
|
|
1174
|
+
/**
|
|
1175
|
+
* Indication of audio volume
|
|
1176
|
+
*/
|
|
1177
|
+
onAudioVolumeIndication = "onAudioVolumeIndication",
|
|
1178
|
+
|
|
1179
|
+
/**
|
|
1180
|
+
* Callback of the state changing of audio playback devices
|
|
1181
|
+
*/
|
|
1182
|
+
onAudioPlaybackDeviceChanged = "onAudioPlaybackDeviceChanged",
|
|
1183
|
+
|
|
1184
|
+
/**
|
|
1185
|
+
* A publisher starts video capture.
|
|
1186
|
+
*/
|
|
1187
|
+
onUserStartVideoCapture = "onUserStartVideoCapture",
|
|
1188
|
+
|
|
1189
|
+
/**
|
|
1190
|
+
* A publisher stops video capture.
|
|
1191
|
+
*/
|
|
1192
|
+
onUserStopVideoCapture = "onUserStopVideoCapture",
|
|
1193
|
+
|
|
1194
|
+
/**
|
|
1195
|
+
* A publisher starts audio capture.
|
|
1196
|
+
*/
|
|
1197
|
+
onUserStartAudioCapture = "onUserStartAudioCapture",
|
|
1198
|
+
|
|
1199
|
+
/**
|
|
1200
|
+
* A publisher stops audio capture.
|
|
1201
|
+
*/
|
|
1202
|
+
onUserStopAudioCapture = "onUserStopAudioCapture",
|
|
1203
|
+
onAutoPublishResult = "onAutoPublishResult",
|
|
1204
|
+
onAutoSubscribeResult = "onAutoSubscribeResult",
|
|
1205
|
+
|
|
1206
|
+
/**
|
|
1207
|
+
* The state of pushing streams to CDN
|
|
1208
|
+
*/
|
|
1209
|
+
onLiveTranscodingResult = "onLiveTranscodingResult",
|
|
1210
|
+
onSEIMessageReceived = "onSEIMessageReceived",
|
|
1211
|
+
onError = "onError",
|
|
1212
|
+
onAudioMixingStateChanged = "onAudioMixingStateChanged"
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
/**
|
|
1216
|
+
* Event of user connections
|
|
1217
|
+
*/
|
|
1218
|
+
export interface UserConnectionEvent {
|
|
1219
|
+
|
|
1220
|
+
/**
|
|
1221
|
+
* User information, refer to [UserInfo](#userinfo) for more details.
|
|
1222
|
+
*/
|
|
1223
|
+
userInfo: UserInfo;
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1226
|
+
/**
|
|
1227
|
+
* Event of user disconnections
|
|
1228
|
+
*/
|
|
1229
|
+
export interface UserDisconnectionEvent {
|
|
1230
|
+
|
|
1231
|
+
/**
|
|
1232
|
+
* User information, refer to [UserInfo](#userinfo) for more details.
|
|
1233
|
+
*/
|
|
1234
|
+
userInfo: UserInfo;
|
|
1235
|
+
|
|
1236
|
+
/**
|
|
1237
|
+
* Reason of disconnection
|
|
1238
|
+
*/
|
|
1239
|
+
reason: string;
|
|
1240
|
+
}
|
|
1241
|
+
|
|
1242
|
+
/**
|
|
1243
|
+
* Receiving video frames carrying SEI message
|
|
1244
|
+
*/
|
|
1245
|
+
export interface onSEIMessageReceivedEvent {
|
|
1246
|
+
|
|
1247
|
+
/**
|
|
1248
|
+
* Including userId of the user who sent the message, roomId of the current room, and the media stream carrying this SEI message. Refer to RemoteStreamKey{@link RemoteStreamKey} for more details.
|
|
1249
|
+
*/
|
|
1250
|
+
remoteStreamKey: RemoteStreamKey;
|
|
1251
|
+
}
|
|
1252
|
+
|
|
1253
|
+
/**
|
|
1254
|
+
* User mutes audio or video.
|
|
1255
|
+
*/
|
|
1256
|
+
export interface UserMuteEvent {
|
|
1257
|
+
|
|
1258
|
+
/**
|
|
1259
|
+
* User information, refer to [UserInfo](#userinfo) for more details.
|
|
1260
|
+
*/
|
|
1261
|
+
userInfo: UserInfo;
|
|
1262
|
+
|
|
1263
|
+
/**
|
|
1264
|
+
* Details of disabling audio or video.
|
|
1265
|
+
*/
|
|
1266
|
+
muteState: MuteState;
|
|
1267
|
+
}
|
|
1268
|
+
|
|
1269
|
+
/**
|
|
1270
|
+
* The connection state changes.
|
|
1271
|
+
*/
|
|
1272
|
+
export interface ConnectionStateChangeEvent {
|
|
1273
|
+
|
|
1274
|
+
/**
|
|
1275
|
+
* The internal connection state
|
|
1276
|
+
*/
|
|
1277
|
+
state: ConnectionState;
|
|
1278
|
+
}
|
|
1279
|
+
|
|
1280
|
+
/**
|
|
1281
|
+
* Event related to the player
|
|
1282
|
+
*/
|
|
1283
|
+
export interface PlayerEvent {
|
|
1284
|
+
|
|
1285
|
+
/**
|
|
1286
|
+
* Type of the player
|
|
1287
|
+
*/
|
|
1288
|
+
type: "video" | "audio";
|
|
1289
|
+
|
|
1290
|
+
/**
|
|
1291
|
+
* Event name
|
|
1292
|
+
*/
|
|
1293
|
+
eventName: string;
|
|
1294
|
+
|
|
1295
|
+
/**
|
|
1296
|
+
* Play event. Refer to the [official documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/play_event) for more details.
|
|
1297
|
+
*/
|
|
1298
|
+
rawEvent: Event;
|
|
1299
|
+
|
|
1300
|
+
/**
|
|
1301
|
+
* userId of the user who is joining the room
|
|
1302
|
+
*/
|
|
1303
|
+
userId: string;
|
|
1304
|
+
|
|
1305
|
+
/**
|
|
1306
|
+
* Readies state of the medias. Refer to the [official documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/readyState)
|
|
1307
|
+
*/
|
|
1308
|
+
readyState: number;
|
|
1309
|
+
|
|
1310
|
+
/**
|
|
1311
|
+
* The current time
|
|
1312
|
+
*/
|
|
1313
|
+
currentTime: number;
|
|
1314
|
+
|
|
1315
|
+
/**
|
|
1316
|
+
* Whether it is a screen-sharing stream
|
|
1317
|
+
*/
|
|
1318
|
+
isScreen?: boolean;
|
|
1319
|
+
}
|
|
1320
|
+
|
|
1321
|
+
/**
|
|
1322
|
+
* Event of the state change of audio mixing
|
|
1323
|
+
*/
|
|
1324
|
+
export interface AudioMixingStateChangedEvent {
|
|
1325
|
+
|
|
1326
|
+
/**
|
|
1327
|
+
* Audio mixing ID
|
|
1328
|
+
*/
|
|
1329
|
+
mixId: number;
|
|
1330
|
+
|
|
1331
|
+
/**
|
|
1332
|
+
* State of the audio mixing
|
|
1333
|
+
*/
|
|
1334
|
+
state: AudioMixingState;
|
|
1335
|
+
|
|
1336
|
+
/**
|
|
1337
|
+
* Error of the audio mixing
|
|
1338
|
+
*/
|
|
1339
|
+
error: AudioMixingError;
|
|
1340
|
+
}
|
|
1341
|
+
|
|
1342
|
+
/**
|
|
1343
|
+
* @list 104477
|
|
1344
|
+
* @detail 104479
|
|
1345
|
+
*/
|
|
1346
|
+
export interface IEngineEvents {
|
|
1347
|
+
|
|
1348
|
+
/**
|
|
1349
|
+
* Player event
|
|
1350
|
+
* @param event
|
|
1351
|
+
* @region Video Management Event
|
|
1352
|
+
*/
|
|
1353
|
+
[EngineEventsTypes.onPlayerEvent]: (event: PlayerEvent) => void;
|
|
1354
|
+
|
|
1355
|
+
/**
|
|
1356
|
+
* The user joined.
|
|
1357
|
+
* @param event
|
|
1358
|
+
* @region Room Management Event
|
|
1359
|
+
*/
|
|
1360
|
+
[EngineEventsTypes.onUserJoined]: (event: onUserJoinedEvent) => void;
|
|
1361
|
+
|
|
1362
|
+
/**
|
|
1363
|
+
* The user leaved.
|
|
1364
|
+
* @param event
|
|
1365
|
+
* @region Room Management Event
|
|
1366
|
+
*/
|
|
1367
|
+
[EngineEventsTypes.onUserLeave]: (event: onUserLeaveEvent) => void;
|
|
1368
|
+
|
|
1369
|
+
/**
|
|
1370
|
+
* Connection state changed
|
|
1371
|
+
* @param event
|
|
1372
|
+
* @region Network Event
|
|
1373
|
+
*/
|
|
1374
|
+
[EngineEventsTypes.onConnectionStateChanged]: (event: ConnectionStateChangeEvent) => void;
|
|
1375
|
+
|
|
1376
|
+
/**
|
|
1377
|
+
* A new stream added into the room.
|
|
1378
|
+
* @param event `stream` object. Refer to RTCStream{@link #ref#RTCStream} for more details.
|
|
1379
|
+
* @region Room Management Event
|
|
1380
|
+
*/
|
|
1381
|
+
[EngineEventsTypes.onStreamAdd]: (event: {
|
|
1382
|
+
stream: RTCStream;
|
|
1383
|
+
}) => void;
|
|
1384
|
+
|
|
1385
|
+
/**
|
|
1386
|
+
* Users will receive this event when a user in the room pauses/ resumes publishing audio stream.
|
|
1387
|
+
* @param event
|
|
1388
|
+
* @region Room Management Event
|
|
1389
|
+
*/
|
|
1390
|
+
[EngineEventsTypes.onUserMuteAudio]: (event: UserMuteEvent) => void;
|
|
1391
|
+
|
|
1392
|
+
/**
|
|
1393
|
+
* Users will receive this event when a user in the room pauses/ resumes publishing video stream.
|
|
1394
|
+
* @region Room Management Event
|
|
1395
|
+
* @param event
|
|
1396
|
+
*/
|
|
1397
|
+
[EngineEventsTypes.onUserMuteVideo]: (event: UserMuteEvent) => void;
|
|
1398
|
+
|
|
1399
|
+
/**
|
|
1400
|
+
* Users will receive this event when a user in the room pauses/ resumes publishing audio stream.
|
|
1401
|
+
* @param event <li>stream: RTCStream{@link #ref#RTCStream}</li><li>reason: Refer to StreamRemoveReason{@link #ref#StreamRemoveReason}</li>.
|
|
1402
|
+
* @region Room Management Event
|
|
1403
|
+
*/
|
|
1404
|
+
[EngineEventsTypes.onStreamRemove]: (event: {
|
|
1405
|
+
stream: RTCStream;
|
|
1406
|
+
reason: StreamRemoveReason;
|
|
1407
|
+
}) => void;
|
|
1408
|
+
|
|
1409
|
+
/**
|
|
1410
|
+
* Rendering of the first video frame
|
|
1411
|
+
* @param event
|
|
1412
|
+
* @region Video Management Event
|
|
1413
|
+
*/
|
|
1414
|
+
[EngineEventsTypes.onVideoFirstFrameRendered]: (event: onVideoFirstFrameRenderedEvent) => void;
|
|
1415
|
+
|
|
1416
|
+
/**
|
|
1417
|
+
* Decoding of the first video frame
|
|
1418
|
+
* @param event
|
|
1419
|
+
* @region Video Management Event
|
|
1420
|
+
*/
|
|
1421
|
+
[EngineEventsTypes.onVideoFirstFrameDecoded]: (event: onVideoFirstFrameDecodedEvent) => void;
|
|
1422
|
+
|
|
1423
|
+
/**
|
|
1424
|
+
* Decoding of the first audio frame
|
|
1425
|
+
* @param event
|
|
1426
|
+
* @region Audio Management Event
|
|
1427
|
+
*/
|
|
1428
|
+
[EngineEventsTypes.onAudioFirstFrameDecoded]: (event: onAudioFirstFrameDecodedEvent) => void;
|
|
1429
|
+
|
|
1430
|
+
/**
|
|
1431
|
+
* Event of device state changing
|
|
1432
|
+
* @param event Device and its state
|
|
1433
|
+
* @region Engine Management Event
|
|
1434
|
+
*/
|
|
1435
|
+
[EngineEventsTypes.onMediaDeviceStateChanged]: (event: RTCDevice) => void;
|
|
1436
|
+
/**
|
|
1437
|
+
|
|
1438
|
+
/**
|
|
1439
|
+
* Failure of automatically playing
|
|
1440
|
+
* @param event
|
|
1441
|
+
* @region Video Management Event
|
|
1442
|
+
*/
|
|
1443
|
+
[EngineEventsTypes.onAutoplayFailed]: (event: PlayerEvent) => void;
|
|
1444
|
+
|
|
1445
|
+
/**
|
|
1446
|
+
* Event of media track ending
|
|
1447
|
+
* @param event <li>kind: string Type of the track</li><li>isScreen: boolean Whether it is a screen-sharing stream</li>
|
|
1448
|
+
* @region Video Management Event
|
|
1449
|
+
*/
|
|
1450
|
+
[EngineEventsTypes.onTrackEnded]: (event: {
|
|
1451
|
+
kind: string;
|
|
1452
|
+
isScreen: boolean;
|
|
1453
|
+
}) => void;
|
|
1454
|
+
|
|
1455
|
+
/**
|
|
1456
|
+
* Event of receiving a broadcast text message in the room
|
|
1457
|
+
* @param event <li>userId: string userID of the message sender</li><li>message: Contents of the message</li>
|
|
1458
|
+
* @region Message Event
|
|
1459
|
+
*/
|
|
1460
|
+
[EngineEventsTypes.onRoomMessageReceived]: (event: {
|
|
1461
|
+
userId: string;
|
|
1462
|
+
message: any;
|
|
1463
|
+
}) => void;
|
|
1464
|
+
|
|
1465
|
+
/**
|
|
1466
|
+
* Event of receiving a broadcast binary message in the room
|
|
1467
|
+
* @param event <li>userId: string userID of the message sender</li><li>message: any Contents of the message</li>
|
|
1468
|
+
* @region Message Event
|
|
1469
|
+
*/
|
|
1470
|
+
[EngineEventsTypes.onRoomBinaryMessageReceived]: (event: {
|
|
1471
|
+
userId: string;
|
|
1472
|
+
message: ArrayBuffer;
|
|
1473
|
+
}) => void;
|
|
1474
|
+
|
|
1475
|
+
/**
|
|
1476
|
+
* Receiving a point-to-point text message from one of the users in the room by calling [sendUserMessage](104478#sendUserMessage)
|
|
1477
|
+
* @param event
|
|
1478
|
+
* @region Message Event
|
|
1479
|
+
*/
|
|
1480
|
+
[EngineEventsTypes.onUserMessageReceived]: (event: UserMessageEvent) => void;
|
|
1481
|
+
|
|
1482
|
+
/**
|
|
1483
|
+
* Receiving a point-to-point binary message from one of the users in the room
|
|
1484
|
+
* @param event
|
|
1485
|
+
* @region Message Event
|
|
1486
|
+
*/
|
|
1487
|
+
[EngineEventsTypes.onUserBinaryMessageReceived]: (event: UserBinaryMessageEvent) => void;
|
|
1488
|
+
|
|
1489
|
+
/**
|
|
1490
|
+
* Statistics of subscribed media streams and network states in a cycle of 2s
|
|
1491
|
+
* @param stats
|
|
1492
|
+
* @region Room Event
|
|
1493
|
+
*/
|
|
1494
|
+
[EngineEventsTypes.onRemoteStreamStats]: (stats: RemoteStreamStats) => void;
|
|
1495
|
+
|
|
1496
|
+
/**
|
|
1497
|
+
* Statistics of local media streams and network states in a cycle of 2s
|
|
1498
|
+
* @param stats
|
|
1499
|
+
* @region Room Event
|
|
1500
|
+
*/
|
|
1501
|
+
[EngineEventsTypes.onLocalStreamStats]: (stats: LocalStreamStats) => void;
|
|
1502
|
+
|
|
1503
|
+
/**
|
|
1504
|
+
* Volume of each of the users in the room
|
|
1505
|
+
* If the user has not joined a room, the list will only include volume of `local_user`.
|
|
1506
|
+
* @param event Active user in the room and his/her volume. Refer to AudioVolumeInfo{@link #ref#AudioVolumeInfo}.
|
|
1507
|
+
* @region Room Event
|
|
1508
|
+
*/
|
|
1509
|
+
[EngineEventsTypes.onAudioVolumeIndication]: (event: {
|
|
1510
|
+
speakers: AudioVolumeInfo[];
|
|
1511
|
+
}) => void;
|
|
1512
|
+
|
|
1513
|
+
/**
|
|
1514
|
+
* The current playback device has been changed successfully by calling [setAudioPlaybackDevice](104478#setAudioPlaybackDevice).
|
|
1515
|
+
* @param event Information of the media devices. Refer to the [official documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo) for more details.
|
|
1516
|
+
* @region Audio Management Event
|
|
1517
|
+
*/
|
|
1518
|
+
[EngineEventsTypes.onAudioPlaybackDeviceChanged]: (event: RTCDevice) => void;
|
|
1519
|
+
|
|
1520
|
+
/**
|
|
1521
|
+
* The remote clients in the room will be informed of the state change via this event after the publisher starts audio capture by calling [startAudioCapture](104478#startAudioCapture).
|
|
1522
|
+
* @param event `userId: string` The publisher who starts the internal audio capture
|
|
1523
|
+
* @region Audio Management Event
|
|
1524
|
+
*/
|
|
1525
|
+
[EngineEventsTypes.onUserStartAudioCapture]: (event: {
|
|
1526
|
+
userId: string;
|
|
1527
|
+
}) => void;
|
|
1528
|
+
|
|
1529
|
+
/**
|
|
1530
|
+
* The remote clients in the room will be informed of the state change via this event after the publisher stops audio capture by calling [stopAudioCapture](104478#stopAudioCapture).
|
|
1531
|
+
* @param event `userId: string` userId of the publisher who stops the internal audio capture
|
|
1532
|
+
* @region Room Management Event
|
|
1533
|
+
*/
|
|
1534
|
+
[EngineEventsTypes.onUserStopAudioCapture]: (event: {
|
|
1535
|
+
userId: string;
|
|
1536
|
+
}) => void;
|
|
1537
|
+
|
|
1538
|
+
/**
|
|
1539
|
+
* The remote clients in the room will be informed of the state change via this event after the publisher starts video capture by calling [startVideoCapture](104478#startVideoCapture).
|
|
1540
|
+
* @param event `userId: string` userId of the publisher who starts the internal video capture
|
|
1541
|
+
* @region Room Management Event
|
|
1542
|
+
*/
|
|
1543
|
+
[EngineEventsTypes.onUserStartVideoCapture]: (event: {
|
|
1544
|
+
userId: string;
|
|
1545
|
+
}) => void;
|
|
1546
|
+
|
|
1547
|
+
/**
|
|
1548
|
+
The remote clients in the room will be informed of the state change via this event after the publisher stops video capture by calling [stopVideoCapture](104478#stopVideoCapture).
|
|
1549
|
+
* @param event `userId: string` userId of the publisher who stops the internal video capture
|
|
1550
|
+
* @region Room Management Event
|
|
1551
|
+
*/
|
|
1552
|
+
[EngineEventsTypes.onUserStopVideoCapture]: (event: {
|
|
1553
|
+
userId: string;
|
|
1554
|
+
}) => void;
|
|
1555
|
+
|
|
1556
|
+
/**
|
|
1557
|
+
* Event of receiving SEI data from video frames
|
|
1558
|
+
* @param event Event of receiving SEI data
|
|
1559
|
+
* @region Message Event
|
|
1560
|
+
*/
|
|
1561
|
+
[EngineEventsTypes.onSEIMessageReceived]: (event: onSEIMessageEvent) => void;
|
|
1562
|
+
|
|
1563
|
+
/**
|
|
1564
|
+
* Result of the Auto-Subscription
|
|
1565
|
+
* @param event <li>`userId: string` userId of the publisher to be subscribed</li><li>`isScreen: boolean` Wether it is a screen-sharing stream</li><li>`state: SubscribeState` Refer to SubscribeState{@link #ref#SubscribeState} for more details.</li>
|
|
1566
|
+
* @region Room Management Event
|
|
1567
|
+
*/
|
|
1568
|
+
[EngineEventsTypes.onAutoSubscribeResult]: (event: {
|
|
1569
|
+
userId: string;
|
|
1570
|
+
isScreen: boolean;
|
|
1571
|
+
state: SubscribeState;
|
|
1572
|
+
}) => void;
|
|
1573
|
+
|
|
1574
|
+
/**
|
|
1575
|
+
* Result of Auto-publishing. You will receive this event if you enable Auto-publish when calling `joinRoom`
|
|
1576
|
+
* @param event <li>`isScreen: boolean` Wether it is a screen-sharing stream </li><li>`state: PublishState` Refer to PublishState{@link #ref#PublishState} for more details.</li>
|
|
1577
|
+
* @region Room Management Event
|
|
1578
|
+
*/
|
|
1579
|
+
[EngineEventsTypes.onAutoPublishResult]: (event: {
|
|
1580
|
+
isScreen: boolean;
|
|
1581
|
+
state: PublishState;
|
|
1582
|
+
}) => void;
|
|
1583
|
+
|
|
1584
|
+
/**
|
|
1585
|
+
* Auto-play fails.
|
|
1586
|
+
* @param event Event related to the player
|
|
1587
|
+
* @region Room Management Event
|
|
1588
|
+
*/
|
|
1589
|
+
[EngineEventsTypes.onAutoplayFailed]: (event: PlayerEvent) => void;
|
|
1590
|
+
|
|
1591
|
+
/**
|
|
1592
|
+
* Result of the Pushing stream to CDN
|
|
1593
|
+
* @param event
|
|
1594
|
+
* @region Advanced Feature Event
|
|
1595
|
+
*/
|
|
1596
|
+
[EngineEventsTypes.onLiveTranscodingResult]: (event: LiveTranscodingResultEvent) => void;
|
|
1597
|
+
|
|
1598
|
+
/**
|
|
1599
|
+
* event of error
|
|
1600
|
+
* @param event Error code: `DUPLICATE_LOGIN`. A user with the same userId has joined the room. The current user is kicked out.
|
|
1601
|
+
* @region Room Management Event
|
|
1602
|
+
*/
|
|
1603
|
+
[EngineEventsTypes.onError]: (event: {
|
|
1604
|
+
errorCode: ErrorCode.DUPLICATE_LOGIN;
|
|
1605
|
+
}) => void;
|
|
1606
|
+
|
|
1607
|
+
/**
|
|
1608
|
+
* Event of the state change of audio mixing
|
|
1609
|
+
* @param event
|
|
1610
|
+
* @region Advanced Feature
|
|
1611
|
+
*/
|
|
1612
|
+
[EngineEventsTypes.onAudioMixingStateChanged]: (event: AudioMixingStateChangedEvent) => void;
|
|
1613
|
+
}
|
|
1614
|
+
|
|
1615
|
+
/**
|
|
1616
|
+
* @list 104477
|
|
1617
|
+
* @detail 104478
|
|
1618
|
+
*/
|
|
1619
|
+
export interface IRTCEngine extends EnhancedEventEmitter<IEngineEvents> {
|
|
1620
|
+
|
|
1621
|
+
/**
|
|
1622
|
+
* Join the room. <br>
|
|
1623
|
+
* Call this method to join the room and make audio & video calls with other users in the room. <br>
|
|
1624
|
+
* @param token Dynamic key. It is used for authentication and verification of users entering the room. <br>
|
|
1625
|
+
* You need to bring Token to enter the room. When testing, you can use the console to generate temporary tokens. The official launch requires the use of the key SDK to generate and issue tokens at your server level. <br>
|
|
1626
|
+
* Apps with different AppIDs are not interoperable. <br>
|
|
1627
|
+
* Make sure that the AppID used to generate the Token is the same as the AppID used to create the engine, otherwise it will cause the join room to fail. <br>
|
|
1628
|
+
* @param roomId The ID of the room to be added. <br>
|
|
1629
|
+
* The room ID is a non-empty string with a length of less than 128 bytes, and the following character set ranges are supported: <br>
|
|
1630
|
+
* 1. 26 capital letters A~ Z. <br>
|
|
1631
|
+
* 2. 26 lowercase letters a~ z. <br>
|
|
1632
|
+
* 3. 10 numbers 0~ 9. <br>
|
|
1633
|
+
* 4. Underscore "_", the at sign "@", and the minus sign "-". <br>
|
|
1634
|
+
* @param userInfo User information.
|
|
1635
|
+
* @param roomConfig Room parameter configuration, set the room mode and whether to automatically publish or subscribe to the flow.
|
|
1636
|
+
* @return
|
|
1637
|
+
* @notes <br>
|
|
1638
|
+
* + In the same room with the same App ID, the user ID of each user must be unique. The user will be kicked out of the room when a user with the same userID joins the room with the error of `REPEAT_JOIN`.
|
|
1639
|
+
* + Remote users will receive [[EngineEventsTypes.onUserJoined]](104479#engineeventstypes-onuserjoined) callback when a visible user joins the room. Call setUserVisibility{@link #setUserVisibility} to switch the visibility of the user. <br>
|
|
1640
|
+
* + RTC SDK will try reconnect after losing connection to the server caused by a poor network connection. The remote user will receive [[EngineEventsTypes.onUserJoined]](104479#engineeventstypes-onuserjoined) if a visible user reconnected successfully. <br>
|
|
1641
|
+
* @region Room Management
|
|
1642
|
+
*/
|
|
1643
|
+
joinRoom(token: string | null, roomId: string, userInfo: UserInfo, roomConfig: RoomConfig): Promise<void>;
|
|
1644
|
+
|
|
1645
|
+
/**
|
|
1646
|
+
* Leave the room. <br>
|
|
1647
|
+
* The user calls this API to leave the room, end the call process, and release all call-related resources. <br>
|
|
1648
|
+
* @notes <br>
|
|
1649
|
+
* + After visible users leave the room, other users in the room will receive [[EngineEventsTypes.onUserLeave]](104479#engineeventstypes-onuserleave) callback notification. <br>
|
|
1650
|
+
* + You must call this API to end the call, after calling the [joinRoom](#joinroom) method to join the room. Otherwise you cannot start the next call. Repeatedly call this method have no negative impact. <br>
|
|
1651
|
+
* @region Room Management
|
|
1652
|
+
*/
|
|
1653
|
+
leaveRoom(): void;
|
|
1654
|
+
|
|
1655
|
+
/**
|
|
1656
|
+
* Destroy engine
|
|
1657
|
+
* Destroy the engine instances created by calling [createEngine](#createengine) and release all related resources <br>
|
|
1658
|
+
* @notes
|
|
1659
|
+
* + Make sure that the business scenarios related to the RTCEngine{@link #RTCEngine} instances that need to be destroyed are all finished before calling this API. <br>
|
|
1660
|
+
* + Calling this API will destroy all memory related to this RTCEngine{@link #RTCEngine} instance, and stop any interaction with the media server. <br>
|
|
1661
|
+
* + This API is a blocking call which will block the current thread until the SDK completes the exit logic. Therefore, do NOT to call this API directly in the callback thread. Besides do NOT wait for the execution of the main thread including this API in any callback, thus causing a deadlock. <br>
|
|
1662
|
+
* @region Engine Management
|
|
1663
|
+
*/
|
|
1664
|
+
destroy(): void;
|
|
1665
|
+
|
|
1666
|
+
/**
|
|
1667
|
+
* Start publishing media streams.
|
|
1668
|
+
* @return
|
|
1669
|
+
* @notes <br>
|
|
1670
|
+
* + Call this API to publish media streams only when you have disabled Auto-Publish when calling [joinRoom](#joinroom).
|
|
1671
|
+
* + An invisible user can not publish media streams. Call setUserVisibility{@link #setUserVisibility} to change the visibility of a user.
|
|
1672
|
+
* + Users can only publish media streams in one room at the same time. Call publishScreen{@link #publishScreen} to start screen sharing.
|
|
1673
|
+
* + After publishing media streams by calling this API, other users in the room will be informed via [[EngineEventsTypes.onStreamAdd]](104479#engineeventstypes-onstreamadd).
|
|
1674
|
+
* @region Media Transmission
|
|
1675
|
+
*/
|
|
1676
|
+
publish(): Promise<void>;
|
|
1677
|
+
|
|
1678
|
+
/**
|
|
1679
|
+
* Stops publishing local media streams in the room.
|
|
1680
|
+
* @return
|
|
1681
|
+
* @notes <br>
|
|
1682
|
+
* + Call this API to stop publishing either started by calling publish{@link #publish} or enabling Auto-Publish.
|
|
1683
|
+
* + After stopping publishing media streams by calling this API, other users in the room will be informed via [[EngineEventsTypes.onStreamRemove]](104479#engineeventstypes-onstreamremove).
|
|
1684
|
+
* @region Media Transmission
|
|
1685
|
+
*/
|
|
1686
|
+
unpublish(): Promise<void>;
|
|
1687
|
+
|
|
1688
|
+
/**
|
|
1689
|
+
* Subscribe to media streams in the room. <br>
|
|
1690
|
+
* Call this API to subscribe to media streams in the room regardless of subscription mode, either Auto or Manual. <br>
|
|
1691
|
+
* Call this API to update the properties and configurations of the stream you have already subscribed to.
|
|
1692
|
+
* @param userId User ID of the publisher of the subscribed media stream
|
|
1693
|
+
* @param mediaType Mainstream or screen-sharing stream.
|
|
1694
|
+
* @param streamType Media stream type to be subscribed to.
|
|
1695
|
+
* @param configure Subscription configuration of video streams.
|
|
1696
|
+
* @return
|
|
1697
|
+
* @notes <br>
|
|
1698
|
+
* + Get the media stream information in the room from [[EngineEventsTypes.onStreamAdd]](104479#engineeventstypes-onstreamadd) and [[EngineEventsTypes.onStreamRemove]](104479#engineeventstypes-onstreamremove). <br>
|
|
1699
|
+
* + You can update the subscription configuration by calling the API even after calling pauseAllSubscribedStream{@link #pauseAllSubscribedStream} to pause streaming. . Call resumeAllSubscribedStream{@link #resumeAllSubscribedStream} to resume streaming and apply the changes.
|
|
1700
|
+
* @region Media Transmission
|
|
1701
|
+
*/
|
|
1702
|
+
subscribeUserStream(userId: string, mediaType: SubscribeMediaType, streamType?: StreamIndex, configure?: SubscribeVideoConfig): Promise<void>;
|
|
1703
|
+
|
|
1704
|
+
/**
|
|
1705
|
+
* Stop subscribing to media streams in the room. <br>
|
|
1706
|
+
* You can call this API to unsubscribe to media streams regardless of automatic or manual subscription mode. <br>
|
|
1707
|
+
* @param userId User ID of the publisher of the subscribed media stream
|
|
1708
|
+
* @param isScreen Whether the stream unsubscribed is a screen-sharing stream. <br>
|
|
1709
|
+
* @return
|
|
1710
|
+
* @notes Call this API regardless of whether the media stream is subscribed to or not. When the `userId` is invalid or unsubscribed, the SDK will ignore the request without any negative effect.
|
|
1711
|
+
* @region Media Transmission
|
|
1712
|
+
*/
|
|
1713
|
+
unSubscribe(userId: string, isScreen: boolean): Promise<void>;
|
|
1714
|
+
|
|
1715
|
+
/**
|
|
1716
|
+
* Update Token. <br>
|
|
1717
|
+
* Call this API to update the Token information of the room when the Token expires <br>
|
|
1718
|
+
* @param token A valid token <br>
|
|
1719
|
+
* @notes <br>
|
|
1720
|
+
* + If you call [joinRoom](#joinroom) with an expired token, the joining will fail with an error code `INVALID_TOKEN`. And you need to obtain a valid token and call this API to update the token. <br>
|
|
1721
|
+
* + If joining a room failed because the token expired, call this API with an updated token. And then RTC SDK will automatically rejoin the room without calling [joinRoom](#joinroom) again. <br>
|
|
1722
|
+
* + You have no need to worry about the token expiration after the user joining successfully. Because RTC SDK only verifies the token when the user joins.
|
|
1723
|
+
* @region Room Management
|
|
1724
|
+
*/
|
|
1725
|
+
updateToken(token: string): void;
|
|
1726
|
+
|
|
1727
|
+
/**
|
|
1728
|
+
* Switch the microphone used for internal audio capture <br>
|
|
1729
|
+
* @param deviceId
|
|
1730
|
+
* @region Device Management
|
|
1731
|
+
* @notes If the internal audio capturing is on, the switch is effective once you call this API. If the internal audio capturing is off, the setting will be effective when capture starts.
|
|
1732
|
+
*/
|
|
1733
|
+
switchMicrophone(deviceId: string): Promise<void>;
|
|
1734
|
+
|
|
1735
|
+
/**
|
|
1736
|
+
* Switch the camera used for internal video capture <br>
|
|
1737
|
+
* The default camera to be used depends on the web browser.
|
|
1738
|
+
* @param deviceId ID of the device need to enable which you can call getDevices{@link #getdevices} to obtain.
|
|
1739
|
+
* @return
|
|
1740
|
+
* @notes If the internal video capturing is on, the switch is effective once you call this API. If the internal video capturing is off, the setting will be effective when capture starts.
|
|
1741
|
+
* @region Device Management
|
|
1742
|
+
*/
|
|
1743
|
+
switchCamera(deviceId: string): Promise<void>;
|
|
1744
|
+
|
|
1745
|
+
/**
|
|
1746
|
+
* Enable internal video capture. The default state is off. <br>
|
|
1747
|
+
* Internal video capture refers to: capturing video using the built-in module.
|
|
1748
|
+
* The remote clients in the room will be informed of the state change via [[EngineEventsTypes.onUserStartVideoCapture]](104479#engineeventstypes-onuserstartvideocapture) after the publisher starts video capture by calling this API.<br>
|
|
1749
|
+
* @param deviceId ID of the device need to enable which you can call getDevices{@link #getdevices} to obtain.
|
|
1750
|
+
* @return
|
|
1751
|
+
* @notes <br>
|
|
1752
|
+
* + Call stopVideoCapture{@link #stopVideoCapture} to stop the internal video capture. Otherwise, the internal video capture will sustain until you destroy the engine instance.<br>
|
|
1753
|
+
* + Once you create the engine instance, you can start internal video capture regardless of the video publishing state. The video stream will start publishing only after the video capture starts. <br>
|
|
1754
|
+
* + Call switchCamera{@link #switchCamera} to switch the camera used by the internal video capture module.<br>
|
|
1755
|
+
* @region Video Management
|
|
1756
|
+
*/
|
|
1757
|
+
startVideoCapture(deviceId?: string): Promise<void>;
|
|
1758
|
+
|
|
1759
|
+
/**
|
|
1760
|
+
* Enable internal video capture immediately. The default setting is off. <br>
|
|
1761
|
+
* Internal video capture refers to: capturing video using the built-in module.
|
|
1762
|
+
* The remote clients in the room will be informed of the state change via [[EngineEventsTypes.onUserStopVideoCapture]](104479#engineeventstypes-onuserstopvideocapture) after the publisher stops video capture by calling this API.<br>
|
|
1763
|
+
* @return
|
|
1764
|
+
* @notes <br>
|
|
1765
|
+
* + Call [startVideoCapture](#startvideocapture) to enable the internal video capture. <br>
|
|
1766
|
+
* + Without calling this API the internal video capture will sustain until you destroy the engine instance.<br>
|
|
1767
|
+
* @region Video Management
|
|
1768
|
+
*/
|
|
1769
|
+
stopVideoCapture(): Promise<void>;
|
|
1770
|
+
|
|
1771
|
+
/**
|
|
1772
|
+
* Start internal audio capture. The default is off.
|
|
1773
|
+
* Internal audio capture refers to: capturing audio using the built-in module.
|
|
1774
|
+
* The remote clients in the room will be informed of the state change via [[EngineEventsTypes.onUserStartAudioCapture]](104479#engineeventstypes-onuserstartaudiocapture) after the publisher starts audio capture by calling this API.
|
|
1775
|
+
* @param deviceId ID of the device need to enable which you can call getDevices{@link #getdevices} to obtain.
|
|
1776
|
+
* @return
|
|
1777
|
+
* @notes <br>
|
|
1778
|
+
* + Call stopAudioCapture{@link #stopAudioCapture} to stop the internal audio capture. Otherwise, the internal audio capture will sustain until you destroy the engine instance. <br>
|
|
1779
|
+
* + Once you create the engine instance, you can start internal audio capture regardless of the audio publishing state. The audio stream will start publishing only after the audio capture starts. <br>
|
|
1780
|
+
* @region Audio Management
|
|
1781
|
+
*/
|
|
1782
|
+
startAudioCapture(deviceId?: string): Promise<void>;
|
|
1783
|
+
|
|
1784
|
+
/**
|
|
1785
|
+
* Stop internal audio capture. The default is off. <br>
|
|
1786
|
+
* Internal audio capture refers to: capturing audio using the built-in module.
|
|
1787
|
+
* The remote clients in the room will be informed of the state change via [[EngineEventsTypes.onUserStopAudioCapture]](104479#engineeventstypes-onuserstopaudiocapture) after stopping audio capture by calling this API.<br>
|
|
1788
|
+
* @return
|
|
1789
|
+
* @notes <br>
|
|
1790
|
+
* + Call [startAudioCapture](#startaudiocapture) to enable the internal audio capture. <br>
|
|
1791
|
+
* + Without calling this API the internal audio capture will sustain until you destroy the engine instance.<br>
|
|
1792
|
+
* @region Audio Management
|
|
1793
|
+
*/
|
|
1794
|
+
stopAudioCapture(): Promise<void>;
|
|
1795
|
+
|
|
1796
|
+
/**
|
|
1797
|
+
* Use the capture module provided by the RTC SDK to capture the current screen stream for sharing.
|
|
1798
|
+
* @param screenConfig Specify properties for the sharing screen.
|
|
1799
|
+
* @return
|
|
1800
|
+
* @notes <br>
|
|
1801
|
+
* + Call this API will start screen stream video capture but will not publish the captured video. Publishing a screen-sharing stream by calling publishScreen{@link #publishScreen}. <br>
|
|
1802
|
+
* + To turn off screen video source capture, call stopScreenCapture{@link #stopScreenCapture}. <br>
|
|
1803
|
+
* + Before calling this API, you can call [setVideoEncoderConfig](#setvideoencoderconfig) to set the capture frame rate and encoding resolution of the screen video stream. <br>
|
|
1804
|
+
* @region Advanced Feature
|
|
1805
|
+
*/
|
|
1806
|
+
startScreenCapture(screenConfig?: ScreenConfig): Promise<void>;
|
|
1807
|
+
|
|
1808
|
+
/**
|
|
1809
|
+
* Stop screen sharing.
|
|
1810
|
+
* @return
|
|
1811
|
+
* @notes If the stream has been published, the other users in the room will receive the [[EngineEventsTypes.onStreamRemove]](104479#engineeventstypes-onstreamremove) event after the user stop screen sharing by calling this API.
|
|
1812
|
+
* @region Advanced Feature
|
|
1813
|
+
*/
|
|
1814
|
+
stopScreenCapture(): Promise<void>;
|
|
1815
|
+
|
|
1816
|
+
/**
|
|
1817
|
+
* Publish screen-sharing streams.
|
|
1818
|
+
* @return
|
|
1819
|
+
* @notes <br>
|
|
1820
|
+
* + You must join the room before you can call this API. <br>
|
|
1821
|
+
* + This API is only available to visible users.
|
|
1822
|
+
* + After the call, the remote receives the [[EngineEventsTypes.onStreamAdd]](104479#engineeventstypes-onstreamadd) callback. <br>
|
|
1823
|
+
* + Call unpublishScreen{@link #unpublishScreen} to unpublish.
|
|
1824
|
+
* @region Advanced Feature
|
|
1825
|
+
*/
|
|
1826
|
+
publishScreen(): Promise<void>;
|
|
1827
|
+
|
|
1828
|
+
/**
|
|
1829
|
+
* Stop publishing screen-sharing streams.
|
|
1830
|
+
* @return
|
|
1831
|
+
* @notes <br>
|
|
1832
|
+
* + To start publishing, call publishScreen{@link #publishScreen}. <br>
|
|
1833
|
+
* + After the call, the remote receives the [[EngineEventsTypes.onStreamRemove]](104479#engineeventstypes-onstreamremove) callback.
|
|
1834
|
+
* @region Advanced Feature
|
|
1835
|
+
*/
|
|
1836
|
+
unpublishScreen(): Promise<void>;
|
|
1837
|
+
|
|
1838
|
+
/**
|
|
1839
|
+
* Bind a view to the local media stream and set the rendering mode for the rendering of the local stream
|
|
1840
|
+
* Listen to `onPlayerEvent` for the state after binding a view to the local video stream.
|
|
1841
|
+
* Call this API again with a blank view to unbind the view from the local video stream.
|
|
1842
|
+
* @param streamIndex Video stream properties
|
|
1843
|
+
* @param videoPlayerOption View information and rendering mode
|
|
1844
|
+
* @notes You should bind the view after the user joins a room. This setting will sustain when the user leaves the room.
|
|
1845
|
+
* @region Video Management
|
|
1846
|
+
*/
|
|
1847
|
+
setLocalVideoPlayer(streamIndex: StreamIndex, videoPlayerOption: VideoPlayerOption): void;
|
|
1848
|
+
|
|
1849
|
+
/**
|
|
1850
|
+
* Bind a view to the remote media stream and set the rendering mode for the rendering of the remote stream
|
|
1851
|
+
* It's recommended to call this API and bind a view once the event of `onVideoFirstFrameRendered` is triggered.
|
|
1852
|
+
* Call this API again with a blank view to unbind the view from the remote video stream.
|
|
1853
|
+
* @param streamIndex Video stream properties
|
|
1854
|
+
* @param videoPlayer View information and rendering mode
|
|
1855
|
+
* @notes You should bind the view after the user joins a room. This setting will sustain when the user leaves the room.
|
|
1856
|
+
* @region Video Management
|
|
1857
|
+
*/
|
|
1858
|
+
setRemoteVideoPlayer(streamIndex: StreamIndex, videoPlayerOption: VideoPlayerOption): void;
|
|
1859
|
+
|
|
1860
|
+
/**
|
|
1861
|
+
* Enable or disable the mirror mode for the local video stream. <br>
|
|
1862
|
+
* @param mirrorType Whether to turn on mirror mode.
|
|
1863
|
+
* @region Media Processing
|
|
1864
|
+
*/
|
|
1865
|
+
setLocalVideoMirrorType(mirrorType: MirrorType): void;
|
|
1866
|
+
|
|
1867
|
+
/**
|
|
1868
|
+
* Sets the speaker or the earpiece as the audio playback device. The audio playback device defaults to the speaker. <br>
|
|
1869
|
+
* @param deviceId ID of the audio playback device. Call getDevices{@link #getDevices} to get device ID.
|
|
1870
|
+
* @return
|
|
1871
|
+
* @notes You can call this API before or after the user joins a room.
|
|
1872
|
+
* @region Audio Management
|
|
1873
|
+
*/
|
|
1874
|
+
setAudioPlaybackDevice(deviceId: string): Promise<void>;
|
|
1875
|
+
|
|
1876
|
+
/**
|
|
1877
|
+
* Play audio and video stream manually.
|
|
1878
|
+
* Call this API when user need to take part in the audio and video reaction after calling [joinRoom](#joinroom) and set to autoPlay to False.
|
|
1879
|
+
* @param userId
|
|
1880
|
+
* @return
|
|
1881
|
+
* @region Room Management
|
|
1882
|
+
*/
|
|
1883
|
+
play(userId: string): Promise<void>;
|
|
1884
|
+
|
|
1885
|
+
/**
|
|
1886
|
+
* Enable/ Disable the transmission of the local audio stream.
|
|
1887
|
+
* Remote users in the room will be informed via [[EngineEventsTypes.onUserMuteAudio]](104479#engineeventstypes-onusermuteaudio) after the visible user changes the transmission state of the audio streams by calling this API.
|
|
1888
|
+
* @param muteState An identifier denoting whether the local audio stream is sending.
|
|
1889
|
+
* @return
|
|
1890
|
+
* @notes <br>
|
|
1891
|
+
* + Calling this API toggles the transmission state of the local audio streams instead of the capture state.
|
|
1892
|
+
* + You can enable audio transmission regardless of the audio capture state. Enable the transmission before capture, thus the audio stream can be sent once the capture starts.
|
|
1893
|
+
* @region Media Transmission
|
|
1894
|
+
*/
|
|
1895
|
+
muteLocalAudio(muteState: MuteState): Promise<boolean>;
|
|
1896
|
+
|
|
1897
|
+
/**
|
|
1898
|
+
* Enable/ Disable the transmission of the local video stream. The video stream is not sending by default.
|
|
1899
|
+
* Call this API to start sending local video streams when using either internal capture module or custom video source. <br>
|
|
1900
|
+
* Remote users in the room will be informed via [[EngineEventsTypes.onUserMuteAudio]](104479#engineeventstypes-onusermuteaudio) after the visible user changes the transmission state of the video streams by calling this API.
|
|
1901
|
+
* @param muteState An identifier denoting whether the local video stream is sending
|
|
1902
|
+
* @return Sending state of the local video stream
|
|
1903
|
+
* @notes <br>
|
|
1904
|
+
* + This API only controls the sending state of the local video stream and does not affect the local video acquisition state.
|
|
1905
|
+
* + You can enable video transmission regardless of the video capture state. Enable the transmission before capture, thus the video stream can be sent once the capture starts.
|
|
1906
|
+
* @region Media Transmission
|
|
1907
|
+
*/
|
|
1908
|
+
muteLocalVideo(muteState: MuteState): Promise<boolean>;
|
|
1909
|
+
|
|
1910
|
+
/**
|
|
1911
|
+
* Pause receiving remote media streams.
|
|
1912
|
+
* @param mediaType Media stream type subscribed to.
|
|
1913
|
+
* @return
|
|
1914
|
+
* @notes <br>
|
|
1915
|
+
* + Calling this API does not change the capture state and the transmission state of the remote clients. <br>
|
|
1916
|
+
* + Calling this API does not cancel the subscription or change any subscription configuration. <br>
|
|
1917
|
+
* + To resume, call resumeAllSubscribedStream{@link #resumeAllSubscribedStream}.
|
|
1918
|
+
* @region Media Stream Transmission
|
|
1919
|
+
*/
|
|
1920
|
+
pauseAllSubscribedStream(mediaType: PauseResumeControlMediaType): Promise<void>;
|
|
1921
|
+
|
|
1922
|
+
/**
|
|
1923
|
+
* Resume receiving remote media streams
|
|
1924
|
+
* @param mediaType Media stream type subscribed to
|
|
1925
|
+
* @return
|
|
1926
|
+
* @notes <br>
|
|
1927
|
+
* + Calling this API does not change the capture state and the transmission state of the remote clients.
|
|
1928
|
+
* + Calling this API does not change any subscription configuration.
|
|
1929
|
+
* @region Media Transmission
|
|
1930
|
+
*/
|
|
1931
|
+
resumeAllSubscribedStream(mediaType: PauseResumeControlMediaType): Promise<void>;
|
|
1932
|
+
|
|
1933
|
+
/**
|
|
1934
|
+
* Send point-to-point text messages to a specified user in the room.<br>
|
|
1935
|
+
* The recipient receives the message via [[EngineEventsTypes.onUserMessageReceived]](104479#engineeventstypes-onusermessagereceived) once the message is sent successfully.
|
|
1936
|
+
* @param userId User ID of the recipient
|
|
1937
|
+
* @param message Text to be sent within 62KB<br>
|
|
1938
|
+
* @return
|
|
1939
|
+
* @notes Call [joinRoom](#joinroom) to join the room before calling this API. <br>
|
|
1940
|
+
* @region Message
|
|
1941
|
+
*/
|
|
1942
|
+
sendUserMessage(userId: string, message: string): Promise<unknown> | undefined;
|
|
1943
|
+
|
|
1944
|
+
/**
|
|
1945
|
+
* Send point-to-point binary messages to a specified user in the room.<br>
|
|
1946
|
+
* The recipient receives the message via [[EngineEventsTypes.onUserBinaryMessageReceived]](104479#engineeventstypes-onuserbinarymessagereceived) once the message is sent successfully.
|
|
1947
|
+
* @param userId User ID of the recipient
|
|
1948
|
+
* @param message Binary to be sent within 62KB<br>
|
|
1949
|
+
* @return
|
|
1950
|
+
* @notes Call joinRoom {@link # RTCEngine #joinRoom} to join the room before calling this API. <br>
|
|
1951
|
+
* @region Message
|
|
1952
|
+
*/
|
|
1953
|
+
sendUserBinaryMessage(userId: string, message: ArrayBuffer): Promise<unknown>;
|
|
1954
|
+
|
|
1955
|
+
/**
|
|
1956
|
+
* Send text messaging to all other users in the room.<br>
|
|
1957
|
+
* Users in the room will receive message via [[EngineEventsTypes.onRoomMessageReceived]](104479#engineeventstypes-onroommessagereceived) once the message is sent successfully.
|
|
1958
|
+
* @param message Text to be sent within 62KB<br>
|
|
1959
|
+
* @return
|
|
1960
|
+
* @region Message
|
|
1961
|
+
*/
|
|
1962
|
+
sendRoomMessage(message: string): Promise<any> | undefined;
|
|
1963
|
+
|
|
1964
|
+
/**
|
|
1965
|
+
* Send binary messaging to all other users in the room.<br>
|
|
1966
|
+
* Users in the room will receive binary message via [[EngineEventsTypes.onRoomBinaryMessageReceived]](104479#engineeventstypes-onroombinarymessagereceived) once the message is sent successfully.
|
|
1967
|
+
* @param message Binary message to be sent within 62KB<br>
|
|
1968
|
+
* @return
|
|
1969
|
+
* @region Message
|
|
1970
|
+
*/
|
|
1971
|
+
sendRoomBinaryMessage(message: ArrayBuffer): Promise<any> | undefined;
|
|
1972
|
+
|
|
1973
|
+
/**
|
|
1974
|
+
* Send SEI message carried by video frames
|
|
1975
|
+
* @param streamIndex
|
|
1976
|
+
* @param message SEI message within 4kb. Empty message or message exceeding this size will not be sent with respective error prompt.
|
|
1977
|
+
* @param repeatCount Number of message sending repetitions. The value range is [0,30]. <br>
|
|
1978
|
+
* Calling this API to add SEI data to consecutive `repeatCount` video frames starting from the current one.
|
|
1979
|
+
* @notes <br>
|
|
1980
|
+
* + Call this API to add SEI message to the video frame captured by the internal video capture module.
|
|
1981
|
+
* + SDK will abandon the SEI message if no video frame in 2s after you call this API.
|
|
1982
|
+
* + Users receiving the stream will receive the SEI message via onSEIMessageReceived{@link #onSEIMessageReceived} once the SEI message is sent successfully.
|
|
1983
|
+
* @region Message
|
|
1984
|
+
*/
|
|
1985
|
+
sendSEIMessage(streamIndex: StreamIndex, message: Uint8Array | string, repeatCount: number): void;
|
|
1986
|
+
|
|
1987
|
+
/**
|
|
1988
|
+
* Sets the video encoder configuration of each individual stream for simulcasting, including resolution, frame rate, bitrate, scale mode, fallback strategy under poor network conditions.
|
|
1989
|
+
* @param streamIndex
|
|
1990
|
+
* @param descriptions Video parameters of each individual stream for simulcasting.
|
|
1991
|
+
* The length of `videoStreamDescriptions` is no more than 3. The resolutions must be in descending sort.
|
|
1992
|
+
* The maximum resolution is 4096px * 4096px. If the resolution exceeds the limit or the video cannot be encoded, the simulcasting will fail.
|
|
1993
|
+
* @notes <br>
|
|
1994
|
+
* + When using the internal capture, the resolution and frame rate will be adapted to the maximum resolution and frame rate for encoding. <br>
|
|
1995
|
+
* + The video streams are encoded by default with a bitrate of 500bps. <br>
|
|
1996
|
+
* + When you call this API, it will take effect immediately, which may cause the camera to restart. <br>
|
|
1997
|
+
* + The screen stream takes the first set of parameters. <br>
|
|
1998
|
+
* @region Media Transmission
|
|
1999
|
+
*/
|
|
2000
|
+
setVideoEncoderConfig(streamIndex: StreamIndex, descriptions: VideoStreamDescription[]): Promise<void>;
|
|
2001
|
+
|
|
2002
|
+
/**
|
|
2003
|
+
* Turn on/off volume prompts. Off by default. <br>
|
|
2004
|
+
* Call this API to set the report period of the volume information of local user and each subscribed user.
|
|
2005
|
+
* Local client will get informed of the the volume of local user and each subscribed users via [[EngineEventsTypes.onAudioVolumeIndication]](104479#engineeventstypes-onaudiovolumeindication).
|
|
2006
|
+
* @param interval The time interval for receiving a volume prompt callback <br>
|
|
2007
|
+
* It is recommended to set to greater than or equal to 200 milliseconds; when less than 10 milliseconds, the behavior is undefined. <br>
|
|
2008
|
+
* + ≤ 0: Disable the volume prompt function. <br>
|
|
2009
|
+
* + > 0: Enable the volume prompt function and set the time interval for receiving the volume prompt callback. In milliseconds.
|
|
2010
|
+
* @region Room Management
|
|
2011
|
+
*/
|
|
2012
|
+
setAudioVolumeIndicationInterval(interval?: number): void;
|
|
2013
|
+
|
|
2014
|
+
/**
|
|
2015
|
+
* Starts pushing media streams to CDN and sets the relevant configurations.
|
|
2016
|
+
* @param transcode configuration for push media streams to CDN.
|
|
2017
|
+
* @return
|
|
2018
|
+
* @notes <br>
|
|
2019
|
+
* + After calling this API, you will be informed of the result and errors during the pushing process via [[engineeventstypes.onLiveTransCodingResult]](104479#engineeventstypes-onlivetranscodingresult).
|
|
2020
|
+
* + Call stopLiveTranscoding{@link #stopLiveTranscoding} to stop pushing stream to CDN.
|
|
2021
|
+
* @region Advanced Feature
|
|
2022
|
+
*/
|
|
2023
|
+
startLiveTranscoding(transcode: LiveTranscodeConfig): Promise<void>;
|
|
2024
|
+
|
|
2025
|
+
/**
|
|
2026
|
+
* Update configuration needed when pushing media streams to CDN. <br>
|
|
2027
|
+
* After calling [startLiveTranscoding](#startlivetranscoding) to enable the function of pushing streams to CDN, you can call this API to update the relevant configurations.
|
|
2028
|
+
* @param transcode Configurations that you want to update.
|
|
2029
|
+
* @region Advanced Feature
|
|
2030
|
+
*/
|
|
2031
|
+
updateLiveTranscoding(transcode: Partial<LiveTranscodeConfig>): Promise<void>;
|
|
2032
|
+
|
|
2033
|
+
/**
|
|
2034
|
+
* Stop pushing media streams to CDN
|
|
2035
|
+
* For starting pushing media streams to CDN. Refer to [startLiveTranscoding](#startlivetranscoding).
|
|
2036
|
+
* @return
|
|
2037
|
+
* @region Advanced Feature
|
|
2038
|
+
*/
|
|
2039
|
+
stopLiveTranscoding(): Promise<void>;
|
|
2040
|
+
|
|
2041
|
+
/**
|
|
2042
|
+
* Set the business ID. <br>
|
|
2043
|
+
* You can use businessId to distinguish different business scenarios. You can customize your businessId to serve as a sub AppId, which can share and refine the function of the AppId, but it does not need authentication.
|
|
2044
|
+
* @param businessId Your customized businessId
|
|
2045
|
+
* BusinessId is a tag, and you can customize its granularity.
|
|
2046
|
+
* @notes You must call this API before the [joinRoom](#joinroom) API, otherwise it will be invalid. <br>
|
|
2047
|
+
* @region Engine Management
|
|
2048
|
+
*/
|
|
2049
|
+
setBusinessId(businessId: string): void;
|
|
2050
|
+
|
|
2051
|
+
/**
|
|
2052
|
+
* Set user visibility. Visible by default. <br>
|
|
2053
|
+
* @param enable Visibility of the user in the room:
|
|
2054
|
+
* + `true`: The user can publish media streams. And the other users in the room get informed of the behaviors of the user, such as Joining room, starting video capture, and Leaving room.<br>
|
|
2055
|
+
* + `false`: The user cannot publish media streams. And the other users in the room do not get informed of the behaviors of the user, such as joining, starting video capture, or leaving.
|
|
2056
|
+
* @return
|
|
2057
|
+
* @notes <br>
|
|
2058
|
+
* + You can call this API whether the user is in a room or not. <br>
|
|
2059
|
+
* + When you call this API, the other users in the room will be informed via the related callback:
|
|
2060
|
+
* - Switch from `false` to `true`: [[EngineEventsTypes.onUserJoined]](104479#engineeventstypes-onuserjoined)<br>
|
|
2061
|
+
* - Switch from `true` to `false`: [[engineeventstypes.onUserLeave]](104479#engineeventstypes-onuserleave) <br>
|
|
2062
|
+
* @region Room Management
|
|
2063
|
+
*/
|
|
2064
|
+
setUserVisibility(enable: boolean): Promise<void>;
|
|
2065
|
+
|
|
2066
|
+
/**
|
|
2067
|
+
* Bind a custom videoTrack object.
|
|
2068
|
+
* @param index specify a stream index
|
|
2069
|
+
* @param track specify a video track
|
|
2070
|
+
* @return
|
|
2071
|
+
* @region Video Management
|
|
2072
|
+
*/
|
|
2073
|
+
setExternalVideoTrack(index: StreamIndex, track: MediaStreamTrack): Promise<void>;
|
|
2074
|
+
|
|
2075
|
+
/**
|
|
2076
|
+
* Bind a custom audioTrack object.
|
|
2077
|
+
* @param index specify a stream index
|
|
2078
|
+
* @param track specify a audio track
|
|
2079
|
+
* @return
|
|
2080
|
+
* @region Audio Management
|
|
2081
|
+
*/
|
|
2082
|
+
setExternalAudioTrack(index: StreamIndex, track: MediaStreamTrack): Promise<void>;
|
|
2083
|
+
|
|
2084
|
+
/**
|
|
2085
|
+
* Switch the source from the internal to custom video capture.
|
|
2086
|
+
* Internal video capture refers to using built-in video capture video.
|
|
2087
|
+
* @param index audio stream index
|
|
2088
|
+
* @param videoSourceType Type of the module for video capture
|
|
2089
|
+
* @return
|
|
2090
|
+
* @region Video Management
|
|
2091
|
+
*/
|
|
2092
|
+
setVideoSourceType(index: StreamIndex, videoSourceType: VideoSourceType): Promise<void>;
|
|
2093
|
+
|
|
2094
|
+
/**
|
|
2095
|
+
* Switch the source from the internal to custom audio capture.
|
|
2096
|
+
* Internal audio capture refers to using built-in audio capture.
|
|
2097
|
+
* @param index audio stream index
|
|
2098
|
+
* @param audioSourceType Type of the module for video capture
|
|
2099
|
+
* @return
|
|
2100
|
+
* @region Audio Management
|
|
2101
|
+
*/
|
|
2102
|
+
setAudioSourceType(index: StreamIndex, audioSourceType: AudioSourceType): Promise<void>;
|
|
2103
|
+
|
|
2104
|
+
/**
|
|
2105
|
+
* Create an audio mixing manager object
|
|
2106
|
+
* @return audio mixing manager object
|
|
2107
|
+
* @region Advanced Feature
|
|
2108
|
+
*/
|
|
2109
|
+
getAudioMixingManager(): IAudioMixingManager;
|
|
2110
|
+
|
|
2111
|
+
/**
|
|
2112
|
+
* Configure the internal audio capture. Different browser has its own default settings.
|
|
2113
|
+
* @param config Configuration of the internal audio capture such as, disabling audio 3A processing
|
|
2114
|
+
* @return
|
|
2115
|
+
* @note You can call this API after creating the engine. We recommend to call this API before [startAudioCapture](#startaudiocapture).
|
|
2116
|
+
* @region Audio Management
|
|
2117
|
+
*/
|
|
2118
|
+
setAudioCaptureConfig(config: TrackCaptureConfig): Promise<void>;
|
|
2119
|
+
|
|
2120
|
+
/**
|
|
2121
|
+
* Configure the internal video capture. Different browser has its own default settings.
|
|
2122
|
+
* @param config Configuration of the internal video capture
|
|
2123
|
+
* @return
|
|
2124
|
+
* @note You can call this API after creating the engine. We recommend to call this API before [startVideoCapture](#startvideocapture).
|
|
2125
|
+
* @region Video Management
|
|
2126
|
+
*/
|
|
2127
|
+
setVideoCaptureConfig(config: TrackCaptureConfig): Promise<void>;
|
|
2128
|
+
}
|
|
2129
|
+
|
|
2130
|
+
/**
|
|
2131
|
+
* Video source type
|
|
2132
|
+
*/
|
|
2133
|
+
export declare enum VideoSourceType {
|
|
2134
|
+
|
|
2135
|
+
/**
|
|
2136
|
+
* Custom video source
|
|
2137
|
+
*/
|
|
2138
|
+
VIDEO_SOURCE_TYPE_EXTERNAL = 0,
|
|
2139
|
+
|
|
2140
|
+
/**
|
|
2141
|
+
* Internal audio capture, referring to capture video using the built-in module (the default)
|
|
2142
|
+
*/
|
|
2143
|
+
VIDEO_SOURCE_TYPE_INTERNAL = 1
|
|
2144
|
+
}
|
|
2145
|
+
|
|
2146
|
+
/**
|
|
2147
|
+
* Audio source type
|
|
2148
|
+
*/
|
|
2149
|
+
export declare enum AudioSourceType {
|
|
2150
|
+
|
|
2151
|
+
/**
|
|
2152
|
+
* Custom audio source
|
|
2153
|
+
*/
|
|
2154
|
+
AUDIO_SOURCE_TYPE_EXTERNAL = 0,
|
|
2155
|
+
|
|
2156
|
+
/**
|
|
2157
|
+
* Internal audio capture, referring to capture audio using the built-in module (the default)
|
|
2158
|
+
*/
|
|
2159
|
+
AUDIO_SOURCE_TYPE_INTERNAL = 1
|
|
2160
|
+
}
|
|
2161
|
+
|
|
2162
|
+
/**
|
|
2163
|
+
* User information
|
|
2164
|
+
*/
|
|
2165
|
+
export interface UserInfo {
|
|
2166
|
+
|
|
2167
|
+
/**
|
|
2168
|
+
* User ID, a non-empty string within 128 bytes.
|
|
2169
|
+
*/
|
|
2170
|
+
userId: string;
|
|
2171
|
+
|
|
2172
|
+
/**
|
|
2173
|
+
* ExtraInfo Additional information passed by the user, with a maximum length of 200 bytes. Callback to remote user in [[EngineEventsTypes.onUserJoined]](104479#engineeventstypes-onuserjoined).
|
|
2174
|
+
* @notes Supports the following character set ranges <br>
|
|
2175
|
+
* + 26 uppercase letters A~ Z
|
|
2176
|
+
* + 26 lowercase letters a~ z
|
|
2177
|
+
* + 10 numbers 0~ 9
|
|
2178
|
+
* + underscore "_", at character "@", minus, number "-"
|
|
2179
|
+
*/
|
|
2180
|
+
extraInfo?: string;
|
|
2181
|
+
}
|
|
2182
|
+
|
|
2183
|
+
/**
|
|
2184
|
+
* @private
|
|
2185
|
+
*/
|
|
2186
|
+
export declare enum ChannelProfile {
|
|
2187
|
+
CHANNEL_PROFILE_COMMUNICATION = 0,
|
|
2188
|
+
CHANNEL_PROFILE_LIVE_BROADCASTING = 1
|
|
2189
|
+
}
|
|
2190
|
+
|
|
2191
|
+
/**
|
|
2192
|
+
* Room configure
|
|
2193
|
+
*/
|
|
2194
|
+
export interface RoomConfig {
|
|
2195
|
+
|
|
2196
|
+
/**
|
|
2197
|
+
* Enable/disable auto-subscribe audio. Enable by default.
|
|
2198
|
+
*/
|
|
2199
|
+
isAutoPublish: boolean;
|
|
2200
|
+
|
|
2201
|
+
/**
|
|
2202
|
+
* Enable/disable auto-subscribe audio. Enable by default.
|
|
2203
|
+
* Call subscribeUserStream, unsubscribe to revise the subscription.
|
|
2204
|
+
*/
|
|
2205
|
+
isAutoSubscribeAudio: boolean;
|
|
2206
|
+
|
|
2207
|
+
/**
|
|
2208
|
+
* Enable/disable auto-subscribe video. Enable by default.
|
|
2209
|
+
* Call subscribeUserStream, unsubscribe to revise the subscription.
|
|
2210
|
+
*/
|
|
2211
|
+
isAutoSubscribeVideo: boolean;
|
|
2212
|
+
}
|
|
2213
|
+
|
|
2214
|
+
/**
|
|
2215
|
+
* Subscription mode
|
|
2216
|
+
*/
|
|
2217
|
+
export declare enum SubscribeMode {
|
|
2218
|
+
|
|
2219
|
+
/**
|
|
2220
|
+
* Auto. Subscribe every stream in the room automatically.
|
|
2221
|
+
*/
|
|
2222
|
+
AUTO_SUBSCRIBE_MODE = 0,
|
|
2223
|
+
|
|
2224
|
+
/**
|
|
2225
|
+
* Manual. User can subscribe the stream in the room manually by calling subscribe{@link #subscribe}.
|
|
2226
|
+
*/
|
|
2227
|
+
MANUAL_SUBSCRIBE_MODE = 1
|
|
2228
|
+
}
|
|
2229
|
+
|
|
2230
|
+
/**
|
|
2231
|
+
* Subscribe configuration
|
|
2232
|
+
*/
|
|
2233
|
+
export interface SubscribeConfig {
|
|
2234
|
+
|
|
2235
|
+
/**
|
|
2236
|
+
* Specify whether to subscribe the video stream.
|
|
2237
|
+
*/
|
|
2238
|
+
isScreen: boolean;
|
|
2239
|
+
|
|
2240
|
+
/**
|
|
2241
|
+
* Specify whether to subscribe the audio stream.
|
|
2242
|
+
*/
|
|
2243
|
+
subVideo: boolean;
|
|
2244
|
+
|
|
2245
|
+
/**
|
|
2246
|
+
* Specify whether to subscribe the screen-sharing stream.
|
|
2247
|
+
*/
|
|
2248
|
+
subAudio: boolean;
|
|
2249
|
+
}
|
|
2250
|
+
|
|
2251
|
+
/**
|
|
2252
|
+
* Transmission/Playback state of the media stream
|
|
2253
|
+
*/
|
|
2254
|
+
export declare enum MuteState {
|
|
2255
|
+
|
|
2256
|
+
/**
|
|
2257
|
+
* Enable
|
|
2258
|
+
*/
|
|
2259
|
+
MUTE_STATE_OFF = 0,
|
|
2260
|
+
|
|
2261
|
+
/**
|
|
2262
|
+
* Disable
|
|
2263
|
+
*/
|
|
2264
|
+
MUTE_STATE_ON = 1
|
|
2265
|
+
}
|
|
2266
|
+
|
|
2267
|
+
/**
|
|
2268
|
+
* Result of updating subscription
|
|
2269
|
+
*/
|
|
2270
|
+
export declare enum SubscribeState {
|
|
2271
|
+
|
|
2272
|
+
/**
|
|
2273
|
+
* Update subscription successfully.
|
|
2274
|
+
*/
|
|
2275
|
+
SUBSCRIBE_SUCC = 0,
|
|
2276
|
+
|
|
2277
|
+
/**
|
|
2278
|
+
* Update subscription failed.
|
|
2279
|
+
*/
|
|
2280
|
+
SUBSCRIBE_FAIL = 1
|
|
2281
|
+
}
|
|
2282
|
+
|
|
2283
|
+
/**
|
|
2284
|
+
* Result of publishing
|
|
2285
|
+
*/
|
|
2286
|
+
export declare enum PublishState {
|
|
2287
|
+
|
|
2288
|
+
/**
|
|
2289
|
+
* Publish successfully.
|
|
2290
|
+
*/
|
|
2291
|
+
PUBLISH_SUCC = 0,
|
|
2292
|
+
|
|
2293
|
+
/**
|
|
2294
|
+
* Publish failed.
|
|
2295
|
+
*/
|
|
2296
|
+
PUBLISH_FAIL = 1
|
|
2297
|
+
}
|
|
2298
|
+
|
|
2299
|
+
/**
|
|
2300
|
+
* State of Mirror mode
|
|
2301
|
+
*/
|
|
2302
|
+
export declare enum MirrorMode {
|
|
2303
|
+
|
|
2304
|
+
/**
|
|
2305
|
+
* Disable
|
|
2306
|
+
*/
|
|
2307
|
+
MIRROR_MODE_OFF = 0,
|
|
2308
|
+
|
|
2309
|
+
/**
|
|
2310
|
+
* Enable
|
|
2311
|
+
*/
|
|
2312
|
+
MIRROR_MODE_ON = 1
|
|
2313
|
+
}
|
|
2314
|
+
|
|
2315
|
+
/**
|
|
2316
|
+
* Media stream type
|
|
2317
|
+
*/
|
|
2318
|
+
export declare enum PauseResumeControlMediaType {
|
|
2319
|
+
|
|
2320
|
+
/**
|
|
2321
|
+
* Audio
|
|
2322
|
+
*/
|
|
2323
|
+
RTC_PAUSE_RESUME_CONTROL_AUDIO = 0,
|
|
2324
|
+
|
|
2325
|
+
/**
|
|
2326
|
+
* Video
|
|
2327
|
+
*/
|
|
2328
|
+
RTC_PAUSE_RESUME_CONTROL_VIDEO = 1,
|
|
2329
|
+
|
|
2330
|
+
/**
|
|
2331
|
+
* Both video and audio
|
|
2332
|
+
*/
|
|
2333
|
+
RTC_PAUSE_RESUME_CONTROL_AUDIO_AND_VIDEO = 2
|
|
2334
|
+
}
|
|
2335
|
+
|
|
2336
|
+
/**
|
|
2337
|
+
* Player information and rendering mode
|
|
2338
|
+
*/
|
|
2339
|
+
export interface VideoPlayerOption {
|
|
2340
|
+
|
|
2341
|
+
/** Dom
|
|
2342
|
+
*
|
|
2343
|
+
*/
|
|
2344
|
+
renderDom?: string | HTMLElement;
|
|
2345
|
+
|
|
2346
|
+
/**
|
|
2347
|
+
* Rendering modes: optional `RENDER_MODE_HIDDEN`, `RENDER_MODE_FIT` and `RENDER_MODE_ADAPTIVE`.
|
|
2348
|
+
*/
|
|
2349
|
+
renderMode?: VideoRenderMode;
|
|
2350
|
+
|
|
2351
|
+
/**
|
|
2352
|
+
* User ID, a non-empty string within 128 bytes. Use the following character set ranges <br>
|
|
2353
|
+
* + 26 uppercase letters A~ Z
|
|
2354
|
+
* + 26 lowercase letters a~ z
|
|
2355
|
+
* + 10 numbers 0~ 9
|
|
2356
|
+
* + underscore "_", at character "@", minus, number "-"
|
|
2357
|
+
*/
|
|
2358
|
+
userId: string;
|
|
2359
|
+
}
|
|
2360
|
+
|
|
2361
|
+
/**
|
|
2362
|
+
* Rendering modes
|
|
2363
|
+
*/
|
|
2364
|
+
export declare enum VideoRenderMode {
|
|
2365
|
+
|
|
2366
|
+
/**
|
|
2367
|
+
* Windows fill priority. <br>
|
|
2368
|
+
* Scale the video frame at the original equal ratio until the window is filled with video. If the video frame aspect ratio is different from that of the window, the over-brims of the video frame will not be displayed. <br>
|
|
2369
|
+
*/
|
|
2370
|
+
RENDER_MODE_HIDDEN = 0,
|
|
2371
|
+
|
|
2372
|
+
/**
|
|
2373
|
+
* All video frame contents are fit to display in the window. <br>
|
|
2374
|
+
* Scale the video frame at the original equal ratio until the whole video frame has been displayed in the window. If the video frame aspect ratio is different from that of the window, the area on the window that is not filled by the video frame will be blacked out. <br>
|
|
2375
|
+
*/
|
|
2376
|
+
RENDER_MODE_FIT = 1
|
|
2377
|
+
}
|
|
2378
|
+
|
|
2379
|
+
/**
|
|
2380
|
+
* Audio player information
|
|
2381
|
+
*/
|
|
2382
|
+
export interface AudioPlayerOption {
|
|
2383
|
+
|
|
2384
|
+
/**
|
|
2385
|
+
* User ID
|
|
2386
|
+
*/
|
|
2387
|
+
userId: string;
|
|
2388
|
+
|
|
2389
|
+
/**
|
|
2390
|
+
* DOM
|
|
2391
|
+
*/
|
|
2392
|
+
renderDom?: string;
|
|
2393
|
+
}
|
|
2394
|
+
|
|
2395
|
+
/**
|
|
2396
|
+
* Stream specification
|
|
2397
|
+
*/
|
|
2398
|
+
export declare enum StreamIndex {
|
|
2399
|
+
|
|
2400
|
+
/**
|
|
2401
|
+
* A mainstream is a media stream either captured by the internal module or from the custom source.
|
|
2402
|
+
*/
|
|
2403
|
+
STREAM_INDEX_MAIN = 0,
|
|
2404
|
+
|
|
2405
|
+
/**
|
|
2406
|
+
* Screen-sharing stream, including screen-sharing video streams and/ or audio streams from sound cards
|
|
2407
|
+
*/
|
|
2408
|
+
STREAM_INDEX_SCREEN = 1
|
|
2409
|
+
}
|
|
2410
|
+
|
|
2411
|
+
/**
|
|
2412
|
+
* Type of the media stream subscribed to
|
|
2413
|
+
*/
|
|
2414
|
+
export declare enum SubscribeMediaType {
|
|
2415
|
+
|
|
2416
|
+
/**
|
|
2417
|
+
* Audio only
|
|
2418
|
+
*/
|
|
2419
|
+
AUDIO_ONLY = 0,
|
|
2420
|
+
|
|
2421
|
+
/**
|
|
2422
|
+
* Video only
|
|
2423
|
+
*/
|
|
2424
|
+
VIDEO_ONLY = 1,
|
|
2425
|
+
|
|
2426
|
+
/**
|
|
2427
|
+
* Both video and audio
|
|
2428
|
+
*/
|
|
2429
|
+
AUDIO_AND_VIDEO = 2,
|
|
2430
|
+
|
|
2431
|
+
/**
|
|
2432
|
+
* Neither audio nor video
|
|
2433
|
+
*/
|
|
2434
|
+
NONE = 3
|
|
2435
|
+
}
|
|
2436
|
+
|
|
2437
|
+
/**
|
|
2438
|
+
* Subscription configuration of video streams
|
|
2439
|
+
*/
|
|
2440
|
+
export interface SubscribeVideoConfig {
|
|
2441
|
+
|
|
2442
|
+
/**
|
|
2443
|
+
* videoIndex Quality level of the video stream subscribed to. <br>
|
|
2444
|
+
* In Simulcast mode, use a number to specify the expected quality of the video stream to be subscribed to. In Simulcast mode, a video has a diversity of encoded qualities that ranking from 0 to 3. Call [setVideoEncoderConfig](#setvideoencoderconfig) to enable Simulcast mode on the publisher's clients. <br>
|
|
2445
|
+
*/
|
|
2446
|
+
videoIndex: number;
|
|
2447
|
+
}
|
|
2448
|
+
|
|
2449
|
+
/**
|
|
2450
|
+
* Stream property. <br>
|
|
2451
|
+
*/
|
|
2452
|
+
export interface RTCStream {
|
|
2453
|
+
|
|
2454
|
+
/**
|
|
2455
|
+
* User ID
|
|
2456
|
+
*/
|
|
2457
|
+
userId: string;
|
|
2458
|
+
|
|
2459
|
+
/**
|
|
2460
|
+
* Whether it is a screen-sharing stream
|
|
2461
|
+
*/
|
|
2462
|
+
isScreen: boolean;
|
|
2463
|
+
|
|
2464
|
+
/**
|
|
2465
|
+
* Whether it includes a video stream
|
|
2466
|
+
*/
|
|
2467
|
+
hasVideo: boolean;
|
|
2468
|
+
|
|
2469
|
+
/**
|
|
2470
|
+
* Whether it includes a audio stream
|
|
2471
|
+
*/
|
|
2472
|
+
hasAudio: boolean;
|
|
2473
|
+
|
|
2474
|
+
/**
|
|
2475
|
+
* Properties of the video stream. <br>
|
|
2476
|
+
* When a remote user calls the [setVideoEncoderConfig](#setvideoencoderconfig) API to publish multiple configured video streams, this will contain attribute information for all video streams published by the user. <br>
|
|
2477
|
+
* See VideoStreamDescription{@link #VideoStreamDescription}.
|
|
2478
|
+
*/
|
|
2479
|
+
videoStreamDescriptions?: VideoStreamDescription[];
|
|
2480
|
+
}
|
|
2481
|
+
|
|
2482
|
+
/**
|
|
2483
|
+
* The reason for the removal of the remote stream in the room. <br>
|
|
2484
|
+
*
|
|
2485
|
+
*/
|
|
2486
|
+
export declare enum StreamRemoveReason {
|
|
2487
|
+
|
|
2488
|
+
/**
|
|
2489
|
+
* The remote user stops publishing the stream. <br>
|
|
2490
|
+
*/
|
|
2491
|
+
STREAM_REMOVE_REASON_UNPUBLISH = 0,
|
|
2492
|
+
|
|
2493
|
+
/**
|
|
2494
|
+
* The remote user failed to publish the stream. <br>
|
|
2495
|
+
*/
|
|
2496
|
+
STREAM_REMOVE_REASON_PUBLISH_FAILED = 1,
|
|
2497
|
+
|
|
2498
|
+
/**
|
|
2499
|
+
* Keep alive failed. <br>
|
|
2500
|
+
*/
|
|
2501
|
+
STREAM_REMOVE_REASON_KEEP_LIVE_FAILED = 2,
|
|
2502
|
+
|
|
2503
|
+
/**
|
|
2504
|
+
* The remote user is disconnected. <br>
|
|
2505
|
+
*/
|
|
2506
|
+
STREAM_REMOVE_REASON_CLIENT_DISCONNECTED = 3,
|
|
2507
|
+
|
|
2508
|
+
/**
|
|
2509
|
+
* The remote user republishes the stream. <br>
|
|
2510
|
+
*/
|
|
2511
|
+
STREAM_REMOVE_REASON_REPUBLISH = 4,
|
|
2512
|
+
|
|
2513
|
+
/**
|
|
2514
|
+
* Other reasons. <br>
|
|
2515
|
+
*/
|
|
2516
|
+
STREAM_REMOVE_REASON_OTHER = 5
|
|
2517
|
+
}
|
|
2518
|
+
|
|
2519
|
+
/**
|
|
2520
|
+
* @type keytype
|
|
2521
|
+
* SDK Connection state with the signaling server.
|
|
2522
|
+
*/
|
|
2523
|
+
export declare enum ConnectionState {
|
|
2524
|
+
|
|
2525
|
+
/**
|
|
2526
|
+
* Occupy related resource and get ready to start connecting.
|
|
2527
|
+
*/
|
|
2528
|
+
CONNECTION_START = 0,
|
|
2529
|
+
|
|
2530
|
+
/**
|
|
2531
|
+
* Disconnected.
|
|
2532
|
+
*/
|
|
2533
|
+
CONNECTION_STATE_DISCONNECTED = 1,
|
|
2534
|
+
|
|
2535
|
+
/**
|
|
2536
|
+
* Connecting of the first connection
|
|
2537
|
+
*/
|
|
2538
|
+
CONNECTION_STATE_CONNECTING = 2,
|
|
2539
|
+
|
|
2540
|
+
/**
|
|
2541
|
+
* Completion of the first connection
|
|
2542
|
+
*/
|
|
2543
|
+
CONNECTION_STATE_CONNECTED = 3,
|
|
2544
|
+
|
|
2545
|
+
/**
|
|
2546
|
+
* Reconnecting after a disconnection
|
|
2547
|
+
*/
|
|
2548
|
+
CONNECTION_STATE_RECONNECTING = 4,
|
|
2549
|
+
|
|
2550
|
+
/**
|
|
2551
|
+
* Completion of the reconnecting
|
|
2552
|
+
*/
|
|
2553
|
+
CONNECTION_STATE_RECONNECTED = 5
|
|
2554
|
+
}
|
|
2555
|
+
|
|
2556
|
+
/**
|
|
2557
|
+
* Video parameters of each individual stream for simulcasting
|
|
2558
|
+
*/
|
|
2559
|
+
export interface VideoStreamDescription {
|
|
2560
|
+
|
|
2561
|
+
/**
|
|
2562
|
+
* Width
|
|
2563
|
+
*/
|
|
2564
|
+
width?: number;
|
|
2565
|
+
|
|
2566
|
+
/**
|
|
2567
|
+
* Height
|
|
2568
|
+
*/
|
|
2569
|
+
height?: number;
|
|
2570
|
+
|
|
2571
|
+
/**
|
|
2572
|
+
* Video frame rate
|
|
2573
|
+
*/
|
|
2574
|
+
frameRate?: number;
|
|
2575
|
+
|
|
2576
|
+
/**
|
|
2577
|
+
* Max bitrate
|
|
2578
|
+
*/
|
|
2579
|
+
maxKbps?: number;
|
|
2580
|
+
}
|
|
2581
|
+
|
|
2582
|
+
/**
|
|
2583
|
+
* Volume information. Contains user id and volume information for each speaker
|
|
2584
|
+
*/
|
|
2585
|
+
export interface AudioVolumeInfo {
|
|
2586
|
+
|
|
2587
|
+
/**
|
|
2588
|
+
* Speaker's user id
|
|
2589
|
+
*/
|
|
2590
|
+
userId: string;
|
|
2591
|
+
|
|
2592
|
+
/**
|
|
2593
|
+
* Speaker's volume, ranging from 0 (lowest) - 255 (highest)
|
|
2594
|
+
*/
|
|
2595
|
+
volume: number;
|
|
2596
|
+
}
|
|
2597
|
+
|
|
2598
|
+
/**
|
|
2599
|
+
* Configuration for screen-sharing stream
|
|
2600
|
+
*/
|
|
2601
|
+
export interface ScreenConfig {
|
|
2602
|
+
|
|
2603
|
+
/**
|
|
2604
|
+
* Set `true` for capturing the system audio when the user is using Chrome on Windows.
|
|
2605
|
+
*/
|
|
2606
|
+
enableAudio?: boolean;
|
|
2607
|
+
}
|
|
2608
|
+
|
|
2609
|
+
/**
|
|
2610
|
+
* Video encoding configuration
|
|
2611
|
+
*/
|
|
2612
|
+
export interface VideoEncoderConfig {
|
|
2613
|
+
|
|
2614
|
+
/**
|
|
2615
|
+
* The max bitrate, unit: kbps
|
|
2616
|
+
*/
|
|
2617
|
+
maxKbps: number;
|
|
2618
|
+
}
|
|
2619
|
+
|
|
2620
|
+
/**
|
|
2621
|
+
* Internal capture configuration for video & audio. Refer to [browser documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackConstraints) for more details.
|
|
2622
|
+
*/
|
|
2623
|
+
export declare type TrackCaptureConfig = Omit<MediaTrackConstraints, "deviceId">;
|
|
2624
|
+
|
|
2625
|
+
/**
|
|
2626
|
+
* The mirror type
|
|
2627
|
+
*/
|
|
2628
|
+
export declare enum MirrorType {
|
|
2629
|
+
|
|
2630
|
+
/**
|
|
2631
|
+
* No mirroring effect
|
|
2632
|
+
*/
|
|
2633
|
+
MIRROR_TYPE_NONE = 0,
|
|
2634
|
+
|
|
2635
|
+
/**
|
|
2636
|
+
* Enable mirror effect for the local video only. RTC SDK will not add mirror effect on the video to encode and transmit to the other
|
|
2637
|
+
*/
|
|
2638
|
+
MIRROR_TYPE_RENDER = 1
|
|
2639
|
+
}
|
|
2640
|
+
|
|
2641
|
+
/**
|
|
2642
|
+
* Configurations to be set when pushing media streams to CDN
|
|
2643
|
+
*/
|
|
2644
|
+
export interface LiveTranscodeConfig {
|
|
2645
|
+
|
|
2646
|
+
/**
|
|
2647
|
+
* CDN url where the mixed stream is supposed to be pushed.
|
|
2648
|
+
*/
|
|
2649
|
+
url: string;
|
|
2650
|
+
|
|
2651
|
+
/**
|
|
2652
|
+
* Audio transcoding related configurations. Refer to [LiveTranscodeVideoConfig](#LiveTranscodeVideoConfig) for more details.
|
|
2653
|
+
*/
|
|
2654
|
+
audio?: LiveTranscodeAudioConfig;
|
|
2655
|
+
|
|
2656
|
+
/**
|
|
2657
|
+
* Video transcoding related configurations. Refer to [LiveTranscodeVideoConfig](#LiveTranscodeVideoConfig) for more details.
|
|
2658
|
+
*/
|
|
2659
|
+
video?: LiveTranscodeVideoConfig;
|
|
2660
|
+
|
|
2661
|
+
/**
|
|
2662
|
+
* User layout information. Refer to [LiveTranscodeLayoutConfig](#LiveTranscodeLayoutConfig) for more details.
|
|
2663
|
+
*/
|
|
2664
|
+
layout?: LiveTranscodeLayoutConfig;
|
|
2665
|
+
}
|
|
2666
|
+
export declare enum LogChannel {
|
|
2667
|
+
|
|
2668
|
+
/**
|
|
2669
|
+
* domestic
|
|
2670
|
+
*/
|
|
2671
|
+
domestic = 0,
|
|
2672
|
+
|
|
2673
|
+
/**
|
|
2674
|
+
* overseas
|
|
2675
|
+
*/
|
|
2676
|
+
overseas = 1
|
|
2677
|
+
}
|
|
2678
|
+
|
|
2679
|
+
/**
|
|
2680
|
+
* Video transcoding related configurations
|
|
2681
|
+
*/
|
|
2682
|
+
export interface LiveTranscodeVideoConfig {
|
|
2683
|
+
|
|
2684
|
+
/**
|
|
2685
|
+
* Width
|
|
2686
|
+
*/
|
|
2687
|
+
width?: number;
|
|
2688
|
+
|
|
2689
|
+
/**
|
|
2690
|
+
* Height
|
|
2691
|
+
*/
|
|
2692
|
+
height?: number;
|
|
2693
|
+
|
|
2694
|
+
/**
|
|
2695
|
+
* The video encoding format to be set
|
|
2696
|
+
*/
|
|
2697
|
+
codec?: string;
|
|
2698
|
+
|
|
2699
|
+
/**
|
|
2700
|
+
* The frame rate to be set
|
|
2701
|
+
*/
|
|
2702
|
+
fps?: number;
|
|
2703
|
+
|
|
2704
|
+
/**
|
|
2705
|
+
* Number of frames between two I-frames.
|
|
2706
|
+
*/
|
|
2707
|
+
gop?: number;
|
|
2708
|
+
|
|
2709
|
+
/**
|
|
2710
|
+
* Whether to push streams with low latency.
|
|
2711
|
+
*/
|
|
2712
|
+
lowLatency?: boolean;
|
|
2713
|
+
|
|
2714
|
+
/**
|
|
2715
|
+
* Bitrate (kbps) of the mixed video stream
|
|
2716
|
+
*/
|
|
2717
|
+
kBitRate?: number;
|
|
2718
|
+
}
|
|
2719
|
+
|
|
2720
|
+
/**
|
|
2721
|
+
* Audio transcoding related configurations
|
|
2722
|
+
*/
|
|
2723
|
+
export interface LiveTranscodeAudioConfig {
|
|
2724
|
+
codec?: string;
|
|
2725
|
+
|
|
2726
|
+
/**
|
|
2727
|
+
* The bitrate (kbps) to be set. The value must be 16, 32, or 64.
|
|
2728
|
+
*/
|
|
2729
|
+
kBitRate?: number;
|
|
2730
|
+
|
|
2731
|
+
/**
|
|
2732
|
+
* The sample rate (kHz) to be set. The value must be 16, 32, 44.1, or 48.
|
|
2733
|
+
*/
|
|
2734
|
+
sampleRate?: number;
|
|
2735
|
+
|
|
2736
|
+
/**
|
|
2737
|
+
* The number of sound channels to be set. The value must be 1 or 2.
|
|
2738
|
+
*/
|
|
2739
|
+
channels?: number;
|
|
2740
|
+
|
|
2741
|
+
/**
|
|
2742
|
+
* The AAC profile to be set
|
|
2743
|
+
*/
|
|
2744
|
+
AACProfile?: "LC" | "MAIN" | "HEv1" | "HEv2";
|
|
2745
|
+
}
|
|
2746
|
+
|
|
2747
|
+
/**
|
|
2748
|
+
* User layout information
|
|
2749
|
+
*/
|
|
2750
|
+
export interface LiveTranscodeLayoutConfig {
|
|
2751
|
+
|
|
2752
|
+
/**
|
|
2753
|
+
* User layout information list
|
|
2754
|
+
*/
|
|
2755
|
+
regions?: LiveTranscodeLayoutRegion[];
|
|
2756
|
+
|
|
2757
|
+
/**
|
|
2758
|
+
* Data passed through from the App
|
|
2759
|
+
*/
|
|
2760
|
+
appData?: string;
|
|
2761
|
+
|
|
2762
|
+
/**
|
|
2763
|
+
* Background color of the canvas
|
|
2764
|
+
*/
|
|
2765
|
+
backgroundColor?: string;
|
|
2766
|
+
}
|
|
2767
|
+
|
|
2768
|
+
/**
|
|
2769
|
+
* Layout information for one of the video streams to be mixed
|
|
2770
|
+
*/
|
|
2771
|
+
export interface LiveTranscodeLayoutRegion {
|
|
2772
|
+
|
|
2773
|
+
/**
|
|
2774
|
+
* Transparency to be set. The range is [0.0, 1.0].
|
|
2775
|
+
*/
|
|
2776
|
+
alpha: number;
|
|
2777
|
+
|
|
2778
|
+
/**
|
|
2779
|
+
* ID of the user who published the stream
|
|
2780
|
+
*/
|
|
2781
|
+
userId: string;
|
|
2782
|
+
|
|
2783
|
+
/**
|
|
2784
|
+
* The normalization ratio of the x-coordinate against the whole image which ranging from [0.0,1.0)
|
|
2785
|
+
*/
|
|
2786
|
+
x: number;
|
|
2787
|
+
|
|
2788
|
+
/**
|
|
2789
|
+
* The normalized horizontal coordinate value of the top left end vertex of the user's view, ranging within [0.0, 1.0)
|
|
2790
|
+
*/
|
|
2791
|
+
y: number;
|
|
2792
|
+
|
|
2793
|
+
/**
|
|
2794
|
+
* The normalized vertical coordinate value of the top left end vertex of the user's view, ranging within [0.0, 1.0)
|
|
2795
|
+
*/
|
|
2796
|
+
zorder: number;
|
|
2797
|
+
|
|
2798
|
+
/**
|
|
2799
|
+
* The normalized width of the user's view, ranging within (0.0, 1.0]
|
|
2800
|
+
*/
|
|
2801
|
+
w: number;
|
|
2802
|
+
|
|
2803
|
+
/**
|
|
2804
|
+
* The normalized height of the user's view, ranging within (0.0, 1.0]
|
|
2805
|
+
*/
|
|
2806
|
+
h: number;
|
|
2807
|
+
|
|
2808
|
+
/**
|
|
2809
|
+
* The view mode to be set. See the following options: <br>
|
|
2810
|
+
* + 1: Fill and Crop. The video is enlarged or shrunk with fixed aspect ratio, and completely fills the windows. The region of the video which exceeds the window will be cropped. <br>
|
|
2811
|
+
* + 2: Fit. The video is enlarged or shrunk with fixed aspect ratio, and is shown completely in the windows. The region of the window, which is not filled with video, is filled with black background. <br>
|
|
2812
|
+
* + 3: Stretch. The video's aspect ratio is changed as it's automatically stretched to completely fill the bounding box it's contained in, but the whole image is visible.
|
|
2813
|
+
*/
|
|
2814
|
+
renderMode?: number;
|
|
2815
|
+
|
|
2816
|
+
/**
|
|
2817
|
+
* The content to be set. The default value is 0. See the following options: <br>
|
|
2818
|
+
* + 0: Push both audio and video stream. <br>
|
|
2819
|
+
* + 1: Push audio stream only. <br>
|
|
2820
|
+
* + 2: Push video stream only.
|
|
2821
|
+
*/
|
|
2822
|
+
contentControl?: number;
|
|
2823
|
+
|
|
2824
|
+
/**
|
|
2825
|
+
* Whether the stream comes from screen sharing
|
|
2826
|
+
*/
|
|
2827
|
+
isScreenStream: boolean;
|
|
2828
|
+
|
|
2829
|
+
/**
|
|
2830
|
+
* Whether the source user of the stream is a local user.
|
|
2831
|
+
*/
|
|
2832
|
+
isLocalUser: boolean;
|
|
2833
|
+
}
|
|
2834
|
+
|
|
2835
|
+
/**
|
|
2836
|
+
* Information of the remote stream
|
|
2837
|
+
*/
|
|
2838
|
+
export interface RemoteStreamKey {
|
|
2839
|
+
|
|
2840
|
+
/**
|
|
2841
|
+
* Room identification
|
|
2842
|
+
*/
|
|
2843
|
+
roomId: string;
|
|
2844
|
+
|
|
2845
|
+
/**
|
|
2846
|
+
* User identification
|
|
2847
|
+
*/
|
|
2848
|
+
userId: string;
|
|
2849
|
+
|
|
2850
|
+
/**
|
|
2851
|
+
* Mainstream or screen-sharing stream. Refer to [StreamIndex](#streamIndex) for details.
|
|
2852
|
+
*/
|
|
2853
|
+
streamIndex: StreamIndex;
|
|
2854
|
+
}
|
|
2855
|
+
|
|
2856
|
+
/**
|
|
2857
|
+
* Point-to-point text message
|
|
2858
|
+
*/
|
|
2859
|
+
export interface UserMessageEvent {
|
|
2860
|
+
|
|
2861
|
+
/**
|
|
2862
|
+
* The user who sent the message
|
|
2863
|
+
*/
|
|
2864
|
+
userId: string;
|
|
2865
|
+
|
|
2866
|
+
/**
|
|
2867
|
+
* Point-to-point text message
|
|
2868
|
+
*/
|
|
2869
|
+
message: Object | string;
|
|
2870
|
+
}
|
|
2871
|
+
|
|
2872
|
+
/**
|
|
2873
|
+
* Point-to-point binary message
|
|
2874
|
+
*/
|
|
2875
|
+
export interface UserBinaryMessageEvent {
|
|
2876
|
+
|
|
2877
|
+
/**
|
|
2878
|
+
* The user who sent the message
|
|
2879
|
+
*/
|
|
2880
|
+
userId: string;
|
|
2881
|
+
|
|
2882
|
+
/**
|
|
2883
|
+
* Point-to-point binary message
|
|
2884
|
+
*/
|
|
2885
|
+
message: ArrayBuffer;
|
|
2886
|
+
}
|
|
2887
|
+
|
|
2888
|
+
/**
|
|
2889
|
+
* Event during pushing stream to CDN
|
|
2890
|
+
*/
|
|
2891
|
+
export interface LiveTranscodingResultEvent {
|
|
2892
|
+
|
|
2893
|
+
/**
|
|
2894
|
+
* Event number during pushing stream to CDN
|
|
2895
|
+
*/
|
|
2896
|
+
code: number;
|
|
2897
|
+
|
|
2898
|
+
/**
|
|
2899
|
+
* Event details during pushing stream to CDN
|
|
2900
|
+
*/
|
|
2901
|
+
message: string;
|
|
2902
|
+
}
|
|
2903
|
+
declare const Config: {
|
|
2904
|
+
VERSION: string;
|
|
2905
|
+
ICE_CONFIG_REQUEST_URLS_INTERNAL: string[];
|
|
2906
|
+
ICE_CONFIG_REQUEST_URLS: never[];
|
|
2907
|
+
EXPECTED_ADDR: string;
|
|
2908
|
+
LOG_SERVER_URL: string;
|
|
2909
|
+
};
|
|
2910
|
+
declare function setParameter(key: keyof typeof Config, value: any): void;
|
|
2911
|
+
declare function getParameter(key: keyof typeof Config): string | string[] | never[];
|
|
2912
|
+
/**
|
|
2913
|
+
* @list 104477
|
|
2914
|
+
* @detail 104478
|
|
2915
|
+
*/
|
|
2916
|
+
/**
|
|
2917
|
+
* @list 104477
|
|
2918
|
+
* @detail 104478
|
|
2919
|
+
*/
|
|
2920
|
+
export interface IVERTC {
|
|
2921
|
+
|
|
2922
|
+
/**
|
|
2923
|
+
* Call this API to create an IRTCEngine instance that provides RTC service. <br>
|
|
2924
|
+
* Call this API before calling any other APIs within the RTC SDK.<br>
|
|
2925
|
+
* Calling this API repeatedly will create multiple IRTCEngine instances.
|
|
2926
|
+
* @param appId A unique identifier for each application. You can apply appIDs on the RTC console. <br>
|
|
2927
|
+
* Instances generated by different AppIDs are independent in RTC service. Users served by one AppID cannot communicate with users served by another AppID.
|
|
2928
|
+
* @return Return an IRTCEngine{@link #IRTCEngine} instance if you call this API successfully.
|
|
2929
|
+
* @notes <br>
|
|
2930
|
+
* + Call destroyEngine{@link #destroyEngine} respectively to destroy each IRTCEngine instance.
|
|
2931
|
+
* + As each IRTCEngine instance is resource consuming, we recommend creating no more than 2 engine instances on each device at the same time.
|
|
2932
|
+
* @region Engine Management
|
|
2933
|
+
*/
|
|
2934
|
+
createEngine(appId: string): IRTCEngine;
|
|
2935
|
+
|
|
2936
|
+
/**
|
|
2937
|
+
* Call this API to destroy the IRTCEngine instance created by [createEngine](#createengine).
|
|
2938
|
+
* @notes <br>
|
|
2939
|
+
* + Before calling this API, ensure all business scenarios related to the IRTCEngine{@link #IRTCEngine} instance have ended. <br>
|
|
2940
|
+
* + By calling this API, this IRTCEngine{@link #IRTCEngine} instance and resource related will be wiped from memory. And any interaction with the media server will end. <br>
|
|
2941
|
+
* + Calling this API will block the main thread until it completes the exiting process. Therefore, do not include this API in a callback. Nor wait in a callback for the execution of this API in the main thread, thus causing a deadlock.
|
|
2942
|
+
* @region Engine Management
|
|
2943
|
+
*/
|
|
2944
|
+
destroyEngine(engine: IRTCEngine): void;
|
|
2945
|
+
|
|
2946
|
+
/**
|
|
2947
|
+
* Get the current version of the SDK.
|
|
2948
|
+
* @return The current SDK version.
|
|
2949
|
+
* @region Engine Management
|
|
2950
|
+
*/
|
|
2951
|
+
getSdkVersion(): string;
|
|
2952
|
+
|
|
2953
|
+
/**
|
|
2954
|
+
* Call this API to enumerate media devices and their IDs, such as microphone, camera, and headset.
|
|
2955
|
+
* Call this API to get deviceIds used to specify the device when calling [setAudioPlaybackDevice](#setaudioplaybackdevice), [startVideoCapture](#startvideocapture), and [startAudioCapture](#startaudiocapture).
|
|
2956
|
+
* @return A list of all media devices Refer to RTCDevice{@link ref#RCTDevice} for more details.
|
|
2957
|
+
* @region Device Management
|
|
2958
|
+
*/
|
|
2959
|
+
getDevices(): Promise<RTCDevice[]>;
|
|
2960
|
+
|
|
2961
|
+
/**
|
|
2962
|
+
* Call this API to request for access to video and audio devices.
|
|
2963
|
+
* @param options The device type you need
|
|
2964
|
+
* <li>`video: boolean` Video devices<li>`audio:boolean` Audio devices</li>
|
|
2965
|
+
* @return <li>`video: boolean` Video devices<li>`audio:boolean` Audio devices</li>
|
|
2966
|
+
* @region Device Management
|
|
2967
|
+
*/
|
|
2968
|
+
enableDevices: (options?: {
|
|
2969
|
+
video: boolean;
|
|
2970
|
+
audio: boolean;
|
|
2971
|
+
}) => Promise<{
|
|
2972
|
+
video: boolean;
|
|
2973
|
+
audio: boolean;
|
|
2974
|
+
}>;
|
|
2975
|
+
|
|
2976
|
+
/**
|
|
2977
|
+
* Call this API to enumerate microphone devices.
|
|
2978
|
+
* Call this API to get Device IDs used to specify the device when calling [startAudioCapture](#startaudiocapture).
|
|
2979
|
+
* @return A list including all microphone devices Refer to RTCDevice{@link ref#RCTDevice} for more details.
|
|
2980
|
+
* @region Device Management
|
|
2981
|
+
*/
|
|
2982
|
+
getMicrophones: () => Promise<RTCDevice[]>;
|
|
2983
|
+
|
|
2984
|
+
/**
|
|
2985
|
+
* Call this API to enumerate audio and video devices and their IDs, such as microphone, camera, and headset.
|
|
2986
|
+
* Call this API to get Device IDs used to specify the device when calling [startVideoCapture](#startvideocapture).
|
|
2987
|
+
* @return A list including all camera devices. Refer to RTCDevice{@link ref#RCTDevice} for more details.
|
|
2988
|
+
* @region Device Management
|
|
2989
|
+
*/
|
|
2990
|
+
getCameras: () => Promise<RTCDevice[]>;
|
|
2991
|
+
|
|
2992
|
+
/**
|
|
2993
|
+
* Call this API to enumerate audio playback devices and their IDs, such as speakers and headsets.
|
|
2994
|
+
* Call this API to get Device IDs used to specify the device when calling [setAudioPlaybackDevice](#setaudioplaybackdevice).
|
|
2995
|
+
* @return A list including all audio playback devices. Refer to RTCDevice{@link ref#RCTDevice} for more details.
|
|
2996
|
+
* @region Device Management
|
|
2997
|
+
*/
|
|
2998
|
+
getAudioPlayback: () => Promise<RTCDevice[]>;
|
|
2999
|
+
|
|
3000
|
+
/**
|
|
3001
|
+
* Call this API to check whether the browser is supported.
|
|
3002
|
+
* @return
|
|
3003
|
+
* + `True`: Supported
|
|
3004
|
+
* - `False`: Not Supported
|
|
3005
|
+
* @region Engine Management
|
|
3006
|
+
*/
|
|
3007
|
+
isSupported: () => boolean;
|
|
3008
|
+
}
|
|
3009
|
+
declare class VERTC implements IVERTC {
|
|
3010
|
+
getSdkVersion: () => string;
|
|
3011
|
+
createEngine: (appId: string) => IRTCEngine;
|
|
3012
|
+
destroyEngine: (engine: IRTCEngine) => void;
|
|
3013
|
+
getDevices: () => Promise<RTCDevice[]>;
|
|
3014
|
+
enableDevices: (options?: {
|
|
3015
|
+
video: boolean;
|
|
3016
|
+
audio: boolean;
|
|
3017
|
+
}) => Promise<{
|
|
3018
|
+
video: boolean;
|
|
3019
|
+
audio: boolean;
|
|
3020
|
+
}>;
|
|
3021
|
+
getMicrophones: () => Promise<RTCDevice[]>;
|
|
3022
|
+
getCameras: () => Promise<RTCDevice[]>;
|
|
3023
|
+
getAudioPlayback: () => Promise<RTCDevice[]>;
|
|
3024
|
+
getParameter: typeof getParameter;
|
|
3025
|
+
setParameter: typeof setParameter;
|
|
3026
|
+
isSupported: () => boolean;
|
|
3027
|
+
events: typeof EngineEventsTypes;
|
|
3028
|
+
ErrorCode: typeof ErrorCode;
|
|
3029
|
+
platform: string;
|
|
3030
|
+
}
|
|
3031
|
+
declare const _default: VERTC;
|
|
3032
|
+
export default _default;
|
|
3033
|
+
|
|
3034
|
+
export as namespace RTC;
|
|
3035
|
+
|
|
3036
|
+
export {};
|