@agora-js/media 4.20.2-300 → 4.21.0
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/AgoraRTC_N-media.esm.mjs +2 -2
- package/AgoraRTC_N-media.js +3 -2
- package/media.d.ts +3855 -413
- package/package.json +7 -6
- package/rtc-sdk-media_en.d.ts +2211 -152
package/media.d.ts
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { AgoraRTCError } from '@agora-js/shared';
|
|
2
2
|
import { CheckVisibleResult } from '@agora-js/shared';
|
|
3
|
+
import { ElectronDesktopCapturerSource } from '@agora-js/shared';
|
|
3
4
|
import { EventEmitter } from '@agora-js/shared';
|
|
4
5
|
import { IAudioProcessor } from 'agora-rte-extension';
|
|
5
6
|
import type { IAudioProcessorContext } from 'agora-rte-extension';
|
|
6
7
|
import { IBaseProcessor } from 'agora-rte-extension';
|
|
7
8
|
import type { IProcessorContext } from 'agora-rte-extension';
|
|
9
|
+
import { isElectron } from '@agora-js/shared';
|
|
8
10
|
import type { Kind } from 'agora-rte-extension';
|
|
9
11
|
import type { NetworkQuality } from '@agora-js/shared';
|
|
10
12
|
import type { ProcessorStats } from 'agora-rte-extension';
|
|
11
13
|
import { PromiseMutex } from '@agora-js/shared';
|
|
14
|
+
import { RequiredOnlyOneOf } from '@agora-js/shared';
|
|
12
15
|
import { SDKStore } from '@agora-js/shared';
|
|
13
16
|
import { UID } from '@agora-js/shared';
|
|
14
17
|
import { Usage } from 'agora-rte-extension';
|
|
@@ -53,6 +56,10 @@ export declare interface AgoraRTCCompatibility {
|
|
|
53
56
|
supportWebRTCEncodedTransform: boolean;
|
|
54
57
|
/** 是否支持WebRTC Insertable Stream */
|
|
55
58
|
supportWebRTCInsertableStream: boolean;
|
|
59
|
+
/** 是否支持requestVideoFrameCallback, 用于计算卡顿率 */
|
|
60
|
+
supportRequestVideoFrameCallback: boolean;
|
|
61
|
+
/** 是否支持WebCrypto */
|
|
62
|
+
supportWebCrypto: boolean;
|
|
56
63
|
}
|
|
57
64
|
|
|
58
65
|
/**
|
|
@@ -156,6 +163,83 @@ export declare enum AUDIO_CONTEXT_EVENT {
|
|
|
156
163
|
STATE_CHANGE = "state-change"
|
|
157
164
|
}
|
|
158
165
|
|
|
166
|
+
/** @en
|
|
167
|
+
* @ignore
|
|
168
|
+
*/
|
|
169
|
+
export declare const AUDIO_ENCODER_CONFIG_SETTINGS: {
|
|
170
|
+
speech_low_quality: AudioEncoderConfiguration;
|
|
171
|
+
speech_standard: AudioEncoderConfiguration;
|
|
172
|
+
music_standard: AudioEncoderConfiguration;
|
|
173
|
+
standard_stereo: AudioEncoderConfiguration;
|
|
174
|
+
high_quality: AudioEncoderConfiguration;
|
|
175
|
+
high_quality_stereo: AudioEncoderConfiguration;
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
export declare enum AUDIO_TRACK_EVENT {
|
|
179
|
+
UPDATE_TRACK_SOURCE = "update-track-source"
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
declare class AudioBufferSource extends AudioSource {
|
|
183
|
+
private audioBuffer;
|
|
184
|
+
protected sourceNode?: AudioBufferSourceNode;
|
|
185
|
+
/**
|
|
186
|
+
* 开始播放的时间(context 时间)
|
|
187
|
+
*/
|
|
188
|
+
private startPlayTime;
|
|
189
|
+
/**
|
|
190
|
+
* 开始播放的时间 (buffer 时间)
|
|
191
|
+
*/
|
|
192
|
+
private startPlayOffset;
|
|
193
|
+
/**
|
|
194
|
+
* 暂停播放的时间 (buffer 时间)
|
|
195
|
+
*/
|
|
196
|
+
private pausePlayTime;
|
|
197
|
+
private options;
|
|
198
|
+
private currentLoopCount;
|
|
199
|
+
private currentPlaybackSpeed;
|
|
200
|
+
set currentState(state: AudioSourceState);
|
|
201
|
+
get currentState(): AudioSourceState;
|
|
202
|
+
private _currentState;
|
|
203
|
+
constructor(buffer: AudioBuffer, options?: AudioSourceOptions);
|
|
204
|
+
createWebAudioDiagram(): GainNode;
|
|
205
|
+
get duration(): number;
|
|
206
|
+
get playbackSpeed(): number;
|
|
207
|
+
/**
|
|
208
|
+
* 计算当前播放时间的公式是
|
|
209
|
+
* ((当前时间 - 开始播放时间) * 当前播放速度 + 开始播放的 offset)% 总时长
|
|
210
|
+
* 如果发现播放被暂停了,返回暂停那一刻记录的 currentTime
|
|
211
|
+
* 如果发现播放还没开始,返回 0
|
|
212
|
+
*/
|
|
213
|
+
get currentTime(): number;
|
|
214
|
+
updateOptions(options: AudioSourceOptions): void;
|
|
215
|
+
startProcessAudioBuffer(): void;
|
|
216
|
+
/**
|
|
217
|
+
* AudioSourceNode 并没有提供 pause 方法
|
|
218
|
+
* 一个 AudioSourceNode stop 后也不能再 start 了
|
|
219
|
+
* 所以只能删掉这个 AudioSourceNode 创建新的来实现
|
|
220
|
+
*/
|
|
221
|
+
pauseProcessAudioBuffer(): void;
|
|
222
|
+
/**
|
|
223
|
+
* 同 pause,需要重新创建 AudioSourceNode
|
|
224
|
+
* @time 单位是秒
|
|
225
|
+
*/
|
|
226
|
+
seekAudioBuffer(time: number): void;
|
|
227
|
+
/**
|
|
228
|
+
* 会从暂停的位置开始播放
|
|
229
|
+
*/
|
|
230
|
+
resumeProcessAudioBuffer(): void;
|
|
231
|
+
stopProcessAudioBuffer(): void;
|
|
232
|
+
destroy(): void;
|
|
233
|
+
/**
|
|
234
|
+
* 与native setAudioMixingPlaybackSpeed对齐,推荐范围[50-400]
|
|
235
|
+
*/
|
|
236
|
+
setAudioBufferPlaybackSpeed(speed: number): void;
|
|
237
|
+
private startSourceNode;
|
|
238
|
+
private createSourceNode;
|
|
239
|
+
private handleSourceNodeEnded;
|
|
240
|
+
private reset;
|
|
241
|
+
}
|
|
242
|
+
|
|
159
243
|
export declare const audioContextState: AudioState;
|
|
160
244
|
|
|
161
245
|
/**
|
|
@@ -191,6 +275,109 @@ declare class AudioElementPlayCenter {
|
|
|
191
275
|
|
|
192
276
|
export declare const audioElementPlayCenter: AudioElementPlayCenter;
|
|
193
277
|
|
|
278
|
+
/**
|
|
279
|
+
* 定义音频编码配置的对象。
|
|
280
|
+
*
|
|
281
|
+
* 用于创建音频流时指定自定义的编码配置。
|
|
282
|
+
*
|
|
283
|
+
* 你可以在 [AgoraRTC.createCustomAudioTrack]{@link IAgoraRTC.createCustomAudioTrack}、
|
|
284
|
+
* [AgoraRTC.createMicrophoneAudioTrack]{@link IAgoraRTC.createMicrophoneAudioTrack} 或
|
|
285
|
+
* [AgoraRTC.createBufferSourceAudioTrack]{@link IAgoraRTC.createBufferSourceAudioTrack} 方法中传入该配置对象来自定义本地音频的编码配置。
|
|
286
|
+
*/
|
|
287
|
+
/** @en
|
|
288
|
+
*
|
|
289
|
+
* `AudioEncoderConfiguration` is the interface that defines the audio encoder configurations.
|
|
290
|
+
*
|
|
291
|
+
* You can customize the audio encoder configurations when calling [AgoraRTC.createCustomAudioTrack]{@link IAgoraRTC.createCustomAudioTrack}, [AgoraRTC.createMicrophoneAudioTrack]{@link IAgoraRTC.createMicrophoneAudioTrack} or [AgoraRTC.createBufferSourceAudioTrack]{@link IAgoraRTC.createBufferSourceAudioTrack}.
|
|
292
|
+
*/
|
|
293
|
+
export declare interface AudioEncoderConfiguration {
|
|
294
|
+
/**
|
|
295
|
+
* 音频采样率,单位为 Hz。
|
|
296
|
+
*/
|
|
297
|
+
/** @en
|
|
298
|
+
* Sample rate of the audio (Hz).
|
|
299
|
+
*/
|
|
300
|
+
sampleRate?: number;
|
|
301
|
+
/**
|
|
302
|
+
* 音频采样大小。
|
|
303
|
+
*/
|
|
304
|
+
/** @en
|
|
305
|
+
* Sample size of the audio.
|
|
306
|
+
*/
|
|
307
|
+
sampleSize?: number;
|
|
308
|
+
/**
|
|
309
|
+
* 是否开启立体声。
|
|
310
|
+
*/
|
|
311
|
+
/** @en
|
|
312
|
+
* Whether to enable stereo.
|
|
313
|
+
*/
|
|
314
|
+
stereo?: boolean;
|
|
315
|
+
/**
|
|
316
|
+
* 音频码率,单位为 Kbps。
|
|
317
|
+
*/
|
|
318
|
+
/** @en
|
|
319
|
+
* Bitrate of the audio (Kbps).
|
|
320
|
+
*/
|
|
321
|
+
bitrate?: number;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* SDK 预设的 [AudioEncoderConfiguration]{@link AudioEncoderConfiguration} 配置。
|
|
326
|
+
*
|
|
327
|
+
* 你可以在以下方法中传入预设值来控制本地音频的编码配置:
|
|
328
|
+
* - [AgoraRTC.createCustomAudioTrack]{@link IAgoraRTC.createCustomAudioTrack}
|
|
329
|
+
* - [AgoraRTC.createMicrophoneAudioTrack]{@link IAgoraRTC.createMicrophoneAudioTrack}
|
|
330
|
+
* - [AgoraRTC.createBufferSourceAudioTrack]{@link IAgoraRTC.createBufferSourceAudioTrack}
|
|
331
|
+
*
|
|
332
|
+
* 下表列出了 SDK 所有内置的音频属性配置,SDK 默认使用 `"music_standard"`。
|
|
333
|
+
*
|
|
334
|
+
* | 音频属性 | 配置 |
|
|
335
|
+
* | -------- | --------------- |
|
|
336
|
+
* |`"speech_low_quality"`|16 kHz 采样率,单声道,编码码率约 24 Kbps|
|
|
337
|
+
* |`"speech_standard"`|32 kHz 采样率,单声道,编码码率约 24 Kbps|
|
|
338
|
+
* |`"music_standard"`|48 kHz 采样率,单声道,编码码率约 32 Kbps|
|
|
339
|
+
* |`"standard_stereo"`|48 kHz 采样率,双声道,编码码率约 64 Kbps|
|
|
340
|
+
* |`"high_quality"`|48 kHz 采样率,单声道, 编码码率约 128 Kbps|
|
|
341
|
+
* |`"high_quality_stereo"`|48 kHz 采样率,双声道,编码码率约 192 Kbps|
|
|
342
|
+
* @public
|
|
343
|
+
*/
|
|
344
|
+
/** @en
|
|
345
|
+
* The preset audio encoder configurations.
|
|
346
|
+
*
|
|
347
|
+
* You can pass the preset video encoder configurations when calling the following methods:
|
|
348
|
+
* - [AgoraRTC.createCustomAudioTrack]{@link IAgoraRTC.createCustomAudioTrack}
|
|
349
|
+
* - [AgoraRTC.createMicrophoneAudioTrack]{@link IAgoraRTC.createMicrophoneAudioTrack}
|
|
350
|
+
* - [AgoraRTC.createBufferSourceAudioTrack]{@link IAgoraRTC.createBufferSourceAudioTrack}
|
|
351
|
+
*
|
|
352
|
+
* The following table lists all the preset audio profiles. The SDK uses `"music_standard"` by default.
|
|
353
|
+
*
|
|
354
|
+
* | Audio Profile | Configurations |
|
|
355
|
+
* | -------- | --------------- |
|
|
356
|
+
* |`"speech_low_quality"`|Sample rate 16 kHz, mono, encoding bitrate 24 Kbps|
|
|
357
|
+
* |`"speech_standard"`|Sample rate 32 kHz, mono, encoding bitrate 24 Kbps|
|
|
358
|
+
* |`"music_standard"`|Sample rate 48 kHz, mono, encoding bitrate 32 Kbps|
|
|
359
|
+
* |`"standard_stereo"`|Sample rate 48 kHz, stereo, encoding bitrate 64 Kbps|
|
|
360
|
+
* |`"high_quality"`|Sample rate 48 kHz, mono, encoding bitrate 128 Kbps|
|
|
361
|
+
* |`"high_quality_stereo"`|Sample rate 48 kHz, stereo, encoding bitrate 192 Kbps| Kbps.
|
|
362
|
+
* @public
|
|
363
|
+
*/
|
|
364
|
+
export declare type AudioEncoderConfigurationPreset = keyof typeof AUDIO_ENCODER_CONFIG_SETTINGS;
|
|
365
|
+
|
|
366
|
+
export declare interface AudioPlaybackOptions {
|
|
367
|
+
/**
|
|
368
|
+
* 控制人声是否要被播放,默认为 `true`
|
|
369
|
+
*/
|
|
370
|
+
origin?: boolean;
|
|
371
|
+
/**
|
|
372
|
+
* 控制混音背景音乐是否要被播放,默认为 `true`
|
|
373
|
+
*/
|
|
374
|
+
mixing?: boolean;
|
|
375
|
+
/**
|
|
376
|
+
* 控制音效是否要被播放,默认为 `true`
|
|
377
|
+
*/
|
|
378
|
+
effect?: boolean;
|
|
379
|
+
}
|
|
380
|
+
|
|
194
381
|
export declare class AudioProcessorContext extends EventEmitter implements IAudioProcessorContext {
|
|
195
382
|
private constraintsMap;
|
|
196
383
|
private statsRegistry;
|
|
@@ -301,6 +488,36 @@ export declare enum AudioSourceEvents {
|
|
|
301
488
|
UPDATE_SOURCE = "update_source"
|
|
302
489
|
}
|
|
303
490
|
|
|
491
|
+
/**
|
|
492
|
+
* 音频数据源处理的设置。用于 [startProcessAudioBuffer]{@link IBufferSourceAudioTrack.startProcessAudioBuffer}。
|
|
493
|
+
*/
|
|
494
|
+
/** @en
|
|
495
|
+
* Options for processing the audio buffer. You need to set the options for processing the audio buffer when calling [startProcessAudioBuffer]{@link IBufferSourceAudioTrack.startProcessAudioBuffer}.
|
|
496
|
+
*/
|
|
497
|
+
export declare interface AudioSourceOptions {
|
|
498
|
+
/**
|
|
499
|
+
* 设置循环播放的次数。
|
|
500
|
+
*/
|
|
501
|
+
/** @en
|
|
502
|
+
* How many times the audio loops.
|
|
503
|
+
*/
|
|
504
|
+
cycle?: number;
|
|
505
|
+
/**
|
|
506
|
+
* 设置是否无限循环。
|
|
507
|
+
*/
|
|
508
|
+
/** @en
|
|
509
|
+
* Whether to loop the audio infinitely.
|
|
510
|
+
*/
|
|
511
|
+
loop?: boolean;
|
|
512
|
+
/**
|
|
513
|
+
* 设置开始播放的时间。
|
|
514
|
+
*/
|
|
515
|
+
/** @en
|
|
516
|
+
* The playback position (seconds).
|
|
517
|
+
*/
|
|
518
|
+
startPlayTime?: number;
|
|
519
|
+
}
|
|
520
|
+
|
|
304
521
|
/**
|
|
305
522
|
* 音频源数据处理状态,通过 [BufferSourceAudioTrack.on("source-state-change")]{@link IBufferSourceAudioTrack.event_source_state_change} 获取。
|
|
306
523
|
*
|
|
@@ -326,7 +543,18 @@ declare class AudioState extends EventEmitter {
|
|
|
326
543
|
curState: AudioContextState | "interrupted" | undefined;
|
|
327
544
|
currentTime?: number;
|
|
328
545
|
currentTimeStuckAt?: number;
|
|
546
|
+
private interruptDetectorTrack?;
|
|
329
547
|
get duringInterruption(): boolean;
|
|
548
|
+
private onLocalAudioTrackMute;
|
|
549
|
+
private onLocalAudioTrackUnmute;
|
|
550
|
+
/**
|
|
551
|
+
* only be called on iOS 15, 16
|
|
552
|
+
* */
|
|
553
|
+
bindInterruptDetectorTrack(track: MicrophoneAudioTrack): void;
|
|
554
|
+
/**
|
|
555
|
+
* only be called on iOS 15, 16
|
|
556
|
+
* */
|
|
557
|
+
unbindInterruptDetectorTrack(track: MicrophoneAudioTrack): void;
|
|
330
558
|
}
|
|
331
559
|
|
|
332
560
|
export declare function audioTimerLoop(callback: (time: number) => any, frequency: number): () => void;
|
|
@@ -361,14 +589,288 @@ declare class AutoPlayGestureEventEmitter extends EventEmitter {
|
|
|
361
589
|
|
|
362
590
|
export declare const autoPlayGestureEventEmitter: AutoPlayGestureEventEmitter;
|
|
363
591
|
|
|
592
|
+
/**
|
|
593
|
+
* @ignore
|
|
594
|
+
*
|
|
595
|
+
* 美颜选项,用于 [setBeautyEffect]{@link ILocalVideoTrack.setBeautyEffect}。
|
|
596
|
+
* @public
|
|
597
|
+
*/
|
|
598
|
+
/** @en
|
|
599
|
+
* @ignore
|
|
600
|
+
*
|
|
601
|
+
* Image enhancement options. You need to set the image enhancement options when calling [setBeautyEffect]{@link ILocalVideoTrack.setBeautyEffect}.
|
|
602
|
+
*/
|
|
603
|
+
export declare interface BeautyEffectOptions {
|
|
604
|
+
/**
|
|
605
|
+
* 平滑度。
|
|
606
|
+
*
|
|
607
|
+
* 取值范围为 [0.0, 1.0],其中 0.0 表示原始平滑等级,默认值为 0.5。可用来实现祛痘、磨皮等视觉效果。
|
|
608
|
+
*/
|
|
609
|
+
/** @en
|
|
610
|
+
*
|
|
611
|
+
* The smoothness level.
|
|
612
|
+
*
|
|
613
|
+
* The value range is [0.0, 1.0]. The original smoothness level is 0.0. The default value is 0.5. This parameter is usually used to remove blemishes.
|
|
614
|
+
*/
|
|
615
|
+
smoothnessLevel?: number;
|
|
616
|
+
/**
|
|
617
|
+
* 亮度。
|
|
618
|
+
*
|
|
619
|
+
* 取值范围为 [0.0, 1.0],其中 0.0 表示原始亮度,默认值为 0.7。可用来实现美白等视觉效果。
|
|
620
|
+
*/
|
|
621
|
+
/** @en
|
|
622
|
+
* The brightness level.
|
|
623
|
+
*
|
|
624
|
+
* The value range is [0.0, 1.0]. The original brightness level is 0.0. The default value is 0.7.
|
|
625
|
+
*/
|
|
626
|
+
lighteningLevel?: number;
|
|
627
|
+
/**
|
|
628
|
+
* 红色度。
|
|
629
|
+
*
|
|
630
|
+
* 取值范围为 [0.0, 1.0],其中 0.0 表示原始红色度,默认值为 0.1。可用来实现红润肤色等视觉效果。
|
|
631
|
+
*/
|
|
632
|
+
/** @en
|
|
633
|
+
* The redness level.
|
|
634
|
+
*
|
|
635
|
+
* The value range is [0.0, 1.0]. The original redness level is 0.0. The default value is 0.1. This parameter adjusts the red saturation level.
|
|
636
|
+
*/
|
|
637
|
+
rednessLevel?: number;
|
|
638
|
+
/**
|
|
639
|
+
* 亮度明暗对比度,与 {@link lighteningLevel} 参数搭配使用。可设为:
|
|
640
|
+
* - 0: 明暗对比弱。
|
|
641
|
+
* - 1: (默认) 原始明暗对比度。
|
|
642
|
+
* - 2: 明暗对比强。
|
|
643
|
+
*/
|
|
644
|
+
/** @en
|
|
645
|
+
* The contrast level. Use this together with {@link lighteningLevel}.
|
|
646
|
+
* - 0: Low contrast level.
|
|
647
|
+
* - 1: (Default) The original contrast level.
|
|
648
|
+
* - 2: High contrast level.
|
|
649
|
+
*/
|
|
650
|
+
lighteningContrastLevel?: 0 | 1 | 2;
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
export declare interface BeautyWebGLParameters {
|
|
654
|
+
denoiseLevel?: number;
|
|
655
|
+
lightLevel?: number;
|
|
656
|
+
rednessLevel?: number;
|
|
657
|
+
lighteningContrastLevel?: number;
|
|
658
|
+
}
|
|
659
|
+
|
|
364
660
|
export declare const blob2Uint8Array: (blob: Blob) => Promise<Uint8Array>;
|
|
365
661
|
|
|
662
|
+
export declare class BufferSourceAudioTrack extends LocalAudioTrack implements IBufferSourceAudioTrack {
|
|
663
|
+
source: string | File | AudioBuffer | null;
|
|
664
|
+
private _bufferSource;
|
|
665
|
+
get __className__(): string;
|
|
666
|
+
constructor(source: string | File | AudioBuffer, bufferSource: AudioBufferSource, encodingConfig?: AudioEncoderConfiguration, trackId?: string);
|
|
667
|
+
get currentState(): AudioSourceState;
|
|
668
|
+
get duration(): number;
|
|
669
|
+
get playbackSpeed(): number;
|
|
670
|
+
getCurrentTime(): number;
|
|
671
|
+
startProcessAudioBuffer(options?: AudioSourceOptions): void;
|
|
672
|
+
pauseProcessAudioBuffer(): void;
|
|
673
|
+
seekAudioBuffer(time: number): void;
|
|
674
|
+
resumeProcessAudioBuffer(): void;
|
|
675
|
+
stopProcessAudioBuffer(): void;
|
|
676
|
+
close(): void;
|
|
677
|
+
setAudioBufferPlaybackSpeed(speed: number): void;
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
/**
|
|
681
|
+
* 通过本地音频文件/在线音频文件/`AudioBuffer`方式创建音频流时的配置参数,用于 [AgoraRTC.createBufferSourceAudioTrack]{@link IAgoraRTC.createBufferSourceAudioTrack}。
|
|
682
|
+
*/
|
|
683
|
+
/** @en
|
|
684
|
+
* Configurations for the audio track from an audio file or `AudioBuffer` object. Set these configurations when calling [AgoraRTC.createBufferSourceAudioTrack]{@link IAgoraRTC.createBufferSourceAudioTrack}.
|
|
685
|
+
*/
|
|
686
|
+
export declare interface BufferSourceAudioTrackInitConfig {
|
|
687
|
+
/**
|
|
688
|
+
* 音频数据源,支持 3 种类型:
|
|
689
|
+
* - `File`: 浏览器标准的 [File](https://developer.mozilla.org/en-US/docs/Web/API/File) 对象,表示一个本地文件。
|
|
690
|
+
* - `string`: 表示从线上 HTTPS 地址获取在线音频文件(请确保音频在线地址支持 HTTPS 和 CORS)。
|
|
691
|
+
* - `AudioBuffer`: 浏览器标准的 [AudioBuffer](https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer) 对象表示 PCM 原始数据。
|
|
692
|
+
*/
|
|
693
|
+
/** @en
|
|
694
|
+
* The type of the audio source:
|
|
695
|
+
* - `File`: An [File](https://developer.mozilla.org/en-US/docs/Web/API/File) object, representing a local audio file.
|
|
696
|
+
* - `string`: The online audio file retrieved from an HTTPS address. Ensure the address supports HTTPS and CORS.
|
|
697
|
+
* - `AudioBuffer`: An [AudioBuffer](https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer) object, representing the raw data in PCM format.
|
|
698
|
+
*/
|
|
699
|
+
source: File | string | AudioBuffer;
|
|
700
|
+
/**
|
|
701
|
+
* 是否缓存线上文件:
|
|
702
|
+
* - `true`: 缓存线上文件。
|
|
703
|
+
* - `false`: (默认)不缓存线上文件。
|
|
704
|
+
*/
|
|
705
|
+
/** @en
|
|
706
|
+
* Whether to cache the online file:
|
|
707
|
+
* - `true`: Cache the online file.
|
|
708
|
+
* - `false`: (default) Do not cache the online file.
|
|
709
|
+
*/
|
|
710
|
+
cacheOnlineFile?: boolean;
|
|
711
|
+
/**
|
|
712
|
+
* 控制音频的编码配置。
|
|
713
|
+
*
|
|
714
|
+
* 你可以通过 [[AudioEncoderConfigurationPreset]] 传入 SDK 内置的编码配置;也可以通过传入一个 [[AudioEncoderConfiguration]] 来自定义音频编码配置。
|
|
715
|
+
*
|
|
716
|
+
* > Firefox 不支持设置音频编码码率。
|
|
717
|
+
*/
|
|
718
|
+
/** @en
|
|
719
|
+
* The audio encoder configurations.
|
|
720
|
+
*
|
|
721
|
+
* You can set the audio encoder configurations in either of the following ways:
|
|
722
|
+
* - Pass the preset audio encoder configurations by using [[AudioEncoderConfigurationPreset]].
|
|
723
|
+
* - Pass your customized audio encoder configurations by using [[AudioEncoderConfiguration]].
|
|
724
|
+
*
|
|
725
|
+
* > Firefox does not support setting the audio encoding rate.
|
|
726
|
+
*/
|
|
727
|
+
encoderConfig?: AudioEncoderConfiguration | AudioEncoderConfigurationPreset;
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
export declare class CameraVideoTrack extends LocalVideoTrack implements ICameraVideoTrack {
|
|
731
|
+
private _config;
|
|
732
|
+
private _originalConstraints;
|
|
733
|
+
private _constraints;
|
|
734
|
+
_enabled: boolean;
|
|
735
|
+
_deviceName: string;
|
|
736
|
+
get __className__(): string;
|
|
737
|
+
constructor(track: MediaStreamTrack, config: CameraVideoTrackInitConfig, constraints: MediaTrackConstraints, scalabilityConfig?: SVCConfiguration, optimizationMode?: OptimizationMode | "balanced", trackId?: string);
|
|
738
|
+
setDevice(deviceId: string | RequiredOnlyOneOf<{
|
|
739
|
+
facingMode: VideoFacingModeEnum;
|
|
740
|
+
deviceId: string;
|
|
741
|
+
}>): Promise<void>;
|
|
742
|
+
private _setDeviceById;
|
|
743
|
+
/**
|
|
744
|
+
* 通过 facingMode 设置设备
|
|
745
|
+
* @param facingMode https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackSettings/facingMode
|
|
746
|
+
*/
|
|
747
|
+
private _setDeviceByFacingModel;
|
|
748
|
+
setEnabled(enabled: boolean, skipChangeState?: boolean): Promise<void>;
|
|
749
|
+
setEncoderConfiguration(config: VideoEncoderConfiguration | VideoEncoderConfigurationPreset, doNotRenegoation?: boolean): Promise<void>;
|
|
750
|
+
protected _getDefaultPlayerConfig(): Partial<PlayerConfig>;
|
|
751
|
+
protected onTrackEnded(): void;
|
|
752
|
+
renewMediaStreamTrack(newConstraints?: MediaTrackConstraints): Promise<void>;
|
|
753
|
+
tryResumeVideoForIOS15_16WeChat: () => Promise<void>;
|
|
754
|
+
close(): void;
|
|
755
|
+
clone(config?: VideoEncoderConfiguration | VideoEncoderConfigurationPreset, cloneTrack?: boolean): CameraVideoTrack;
|
|
756
|
+
bindProcessorContextEvents(): void;
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
/**
|
|
760
|
+
* 创建摄像头视频流时的配置对象,用于 [AgoraRTC.createCameraVideoTrack]{@link IAgoraRTC.createCameraVideoTrack}。
|
|
761
|
+
*/
|
|
762
|
+
/** @en
|
|
763
|
+
* Configurations for the video track from the video captured by a camera. Set these configurations when calling [AgoraRTC.createCameraVideoTrack]{@link IAgoraRTC.createCameraVideoTrack}.
|
|
764
|
+
*/
|
|
765
|
+
export declare interface CameraVideoTrackInitConfig {
|
|
766
|
+
/**
|
|
767
|
+
* 控制视频的编码配置。
|
|
768
|
+
*
|
|
769
|
+
* 你可以通过以下方式设置该属性:
|
|
770
|
+
* - 通过 [[VideoEncoderConfigurationPreset]] 传入 SDK 内置的编码配置。
|
|
771
|
+
* - 通过传入一个 [[VideoEncoderConfiguration]] 对象来自定义视频编码配置。
|
|
772
|
+
* - 不传或留空,使用 SDK 的默认值 `"480p_1"`(分辨率 640 × 480、帧率 15 fps、码率 500 Kbps)。
|
|
773
|
+
*/
|
|
774
|
+
/** @en
|
|
775
|
+
* The video encoder configurations.
|
|
776
|
+
*
|
|
777
|
+
* You can set the video encoder configurations in either of the following ways:
|
|
778
|
+
* - Pass the preset video encoder configurations by using [[VideoEncoderConfigurationPreset]].
|
|
779
|
+
* - Pass your customized video encoder configurations by using [[VideoEncoderConfiguration]].
|
|
780
|
+
* - Leave this property empty to use the SDK's default value, `"480p_1"` (resolution: 640 × 480, frame rate: 15 fps, bitrate: 500 Kbps).
|
|
781
|
+
*/
|
|
782
|
+
encoderConfig?: VideoEncoderConfiguration | VideoEncoderConfigurationPreset;
|
|
783
|
+
/**
|
|
784
|
+
* 指定使用前置/后置摄像头来采集视频。
|
|
785
|
+
*
|
|
786
|
+
* 在移动设备上,可以设置该参数选择使用前置或后置摄像头:
|
|
787
|
+
* - `"user"`: 前置摄像头
|
|
788
|
+
* - `"environment"`: 后置摄像头
|
|
789
|
+
*/
|
|
790
|
+
/** @en
|
|
791
|
+
* Whether to user the front camera or the rear camera.
|
|
792
|
+
*
|
|
793
|
+
* You can use this parameter to choose between the front camera and the rear camera on a mobile device:
|
|
794
|
+
* - `"user"`: The front camera.
|
|
795
|
+
* - `"environment"`: The rear camera.
|
|
796
|
+
*/
|
|
797
|
+
facingMode?: VideoFacingModeEnum;
|
|
798
|
+
/**
|
|
799
|
+
* 指定摄像头的设备 ID。
|
|
800
|
+
*
|
|
801
|
+
* 你可以通过 [AgoraRTC.getCameras]{@link IAgoraRTC.getCameras} 来获取当前的摄像头设备列表。
|
|
802
|
+
*/
|
|
803
|
+
/** @en
|
|
804
|
+
* Specifies the camera ID.
|
|
805
|
+
*
|
|
806
|
+
* You can get a list of the available cameras by calling [AgoraRTC.getCameras]{@link IAgoraRTC.getCameras}.
|
|
807
|
+
*/
|
|
808
|
+
cameraId?: string;
|
|
809
|
+
/**
|
|
810
|
+
* @自从
|
|
811
|
+
* <br>   *4.0.0*
|
|
812
|
+
*
|
|
813
|
+
* 传输优化模式。设置该值后,SDK 会自动调整码率配置以及使用不同的回退策略。
|
|
814
|
+
* - `"detail"`: 清晰优先。
|
|
815
|
+
* - SDK 会自动根据你的采集分辨率和帧率设定一个最小码率。即使遭遇网络波动,发送码率也不会低于这个值,从而确保清晰的视频画面。
|
|
816
|
+
* - 大部分情况下,SDK 不会降低发送分辨率,但是可能会降低帧率。
|
|
817
|
+
* - `"motion"`: 流畅优先。
|
|
818
|
+
* - SDK 不会启用最小码率策略。遭遇网络波动时,发送端会降低码率来确保接收端的视频画面不会出现中断和卡顿。
|
|
819
|
+
* - 大部分情况下,SDK 不会降低帧率,但是可能会降低发送分辨率。
|
|
820
|
+
* - 留空: 默认优化策略,兼顾清晰和流畅,也就是说弱网条件下,帧率和分辨率都会被调整。
|
|
821
|
+
*
|
|
822
|
+
* > 注意事项:该方法只支持 Chrome 浏览器。
|
|
823
|
+
*/
|
|
824
|
+
/** @en
|
|
825
|
+
* @since
|
|
826
|
+
* <br>   *4.0.0*
|
|
827
|
+
*
|
|
828
|
+
* Transmission optimization mode. Whether to prioritize video quality or smoothness:
|
|
829
|
+
* - `"detail"`: Prioritizes video quality.
|
|
830
|
+
* - The SDK ensures high-quality images by automatically calculating a minimum bitrate based on the capturing resolution and frame rate. No matter how poor the network condition is, the sending bitrate will never be lower than the minimum value.
|
|
831
|
+
* - In most cases, the SDK does not reduce the sending resolution, but may reduce the frame rate.
|
|
832
|
+
* - `"motion"`: Prioritizes video smoothness.
|
|
833
|
+
* - In poor network conditions, the SDK reduces the sending bitrate to minimize video freezes.
|
|
834
|
+
* - In most cases, the SDK does not reduce the frame rate, but may reduce the sending resolution.
|
|
835
|
+
* - Empty: Uses the default transmission optimization mode. The SDK may reduce the frame rate or the sending resolution in poor network conditions.
|
|
836
|
+
*
|
|
837
|
+
* > Note: This method is only supported on Chrome.
|
|
838
|
+
*/
|
|
839
|
+
optimizationMode?: OptimizationMode;
|
|
840
|
+
/**
|
|
841
|
+
* @ignore
|
|
842
|
+
* @自从
|
|
843
|
+
* <br>   *4.18.0*
|
|
844
|
+
*
|
|
845
|
+
* SVC (可伸缩视频编码)配置。
|
|
846
|
+
*
|
|
847
|
+
* 你可以通过 {@link SVCConfigurationPreset} 传入 SDK 预设的 SVC 编码配置,也可以通过 {@link SVCConfiguration} 传入自定义的 SVC 编码配置。
|
|
848
|
+
*/
|
|
849
|
+
/** @en
|
|
850
|
+
* @ignore
|
|
851
|
+
*
|
|
852
|
+
* @since
|
|
853
|
+
* <br>   *4.18.0*
|
|
854
|
+
*
|
|
855
|
+
* Configurations for Scalable Video Coding (SVC).
|
|
856
|
+
*
|
|
857
|
+
* You can set the configurations using one of the following options:
|
|
858
|
+
* - Use the preset SVC configurations provided by the SDK through {@link SVCConfigurationPreset}.
|
|
859
|
+
* - Use your custom SVC configurations through {@link SVCConfiguration}.
|
|
860
|
+
*/
|
|
861
|
+
scalabiltyMode?: SVCConfiguration | SVCConfigurationPreset;
|
|
862
|
+
}
|
|
863
|
+
|
|
366
864
|
export declare function checkMediaStreamTrackResolution(track: MediaStreamTrack): Promise<[number, number]>;
|
|
367
865
|
|
|
866
|
+
export declare function checkTrackState(): (target: any, propertyKey: any, descriptor: PropertyDescriptor) => TypedPropertyDescriptor<any> | undefined;
|
|
867
|
+
|
|
368
868
|
/**
|
|
369
869
|
* `<video>` 标签的可见状态信息。
|
|
370
870
|
*
|
|
371
871
|
* 可通过以下方法或事件获取:
|
|
872
|
+
* - [localVideoTrack.on("video-element-visible-status")]{@link ILocalVideoTrack.event_video_element_visible_status}
|
|
873
|
+
* - [localVideoTrack.getVideoElementVisibleStatus]{@link ILocalVideoTrack.getVideoElementVisibleStatus}
|
|
372
874
|
* - [remoteVideoTrack.on("video-element-visible-status")]{@link IRemoteVideoTrack.event_video_element_visible_status}
|
|
373
875
|
* - [remoteVideoTrack.getVideoElementVisibleStatus]{@link IRemoteVideoTrack.getVideoElementVisibleStatus}
|
|
374
876
|
*
|
|
@@ -384,6 +886,8 @@ export declare function checkMediaStreamTrackResolution(track: MediaStreamTrack)
|
|
|
384
886
|
* The visibility of the `<video>` tag.
|
|
385
887
|
*
|
|
386
888
|
* Get the visibility of the `<video>` tag through the following methods and events:
|
|
889
|
+
* - [localVideoTrack.on("video-element-visible-status")]{@link ILocalVideoTrack.event_video_element_visible_status}
|
|
890
|
+
* - [localVideoTrack.getVideoElementVisibleStatus]{@link ILocalVideoTrack.getVideoElementVisibleStatus}
|
|
387
891
|
* - [remoteVideoTrack.on("video-element-visible-status")]{@link IRemoteVideoTrack.event_video_element_visible_status}
|
|
388
892
|
* - [remoteVideoTrack.getVideoElementVisibleStatus]{@link IRemoteVideoTrack.getVideoElementVisibleStatus}
|
|
389
893
|
*
|
|
@@ -397,82 +901,377 @@ export declare function checkMediaStreamTrackResolution(track: MediaStreamTrack)
|
|
|
397
901
|
*/
|
|
398
902
|
export declare type CheckVideoVisibleResult = CheckVisibleResult;
|
|
399
903
|
|
|
400
|
-
export declare function decodeAudioData(buffer: ArrayBuffer): Promise<AudioBuffer>;
|
|
401
|
-
|
|
402
|
-
export declare const DEFAULT_NETWORK_QUALITY_STATS: NetworkQuality;
|
|
403
|
-
|
|
404
|
-
export declare const DEFAULT_REMOTE_AUDIO_TRACK_STATS: RemoteAudioTrackStats;
|
|
405
|
-
|
|
406
|
-
export declare const DEFAULT_REMOTE_VIDEO_TRACK_STATS: RemoteVideoTrackStats;
|
|
407
|
-
|
|
408
|
-
export declare interface DenoiserStats {
|
|
409
|
-
ns: number;
|
|
410
|
-
ebn: number;
|
|
411
|
-
ean: number;
|
|
412
|
-
vl: number;
|
|
413
|
-
}
|
|
414
|
-
|
|
415
904
|
/**
|
|
416
|
-
*
|
|
417
|
-
*
|
|
418
|
-
* - 音频采集设备信息可通过 [onMicrophoneChanged]{@link onMicrophoneChanged} 获取。
|
|
419
|
-
* - 视频采集设备信息可通过 [onCameraChanged]{@link onCameraChanged} 获取。
|
|
420
|
-
* - 音频播放设备信息可通过 [onPlaybackDeviceChanged]{@link onPlaybackDeviceChanged} 获取。
|
|
421
|
-
* @public
|
|
905
|
+
* 约束对象,一般用于在 [[VideoEncoderConfiguration]] 中指定采集分辨率/帧率的范围。
|
|
422
906
|
*/
|
|
423
907
|
/** @en
|
|
424
|
-
*
|
|
425
|
-
*
|
|
426
|
-
* - You can get the audio sampling device information through [onMicrophoneChanged]{@link onMicrophoneChanged}.
|
|
427
|
-
* - You can get the video capture device information through [onCameraChanged]{@link onCameraChanged}.
|
|
428
|
-
* - You can get the audio playback device information through [onPlaybackDeviceChanged]{@link onPlaybackDeviceChanged}.
|
|
908
|
+
* Specifies a constraint for a property, such as the resolution or bitrate for video capture in [[VideoEncoderConfiguration]].
|
|
429
909
|
*/
|
|
430
|
-
export declare interface
|
|
910
|
+
export declare interface ConstrainLong {
|
|
431
911
|
/**
|
|
432
|
-
*
|
|
912
|
+
* 采集设备最终输出的值下限。
|
|
433
913
|
*/
|
|
434
914
|
/** @en
|
|
435
|
-
* The
|
|
436
|
-
*
|
|
437
|
-
* A Unix timestamp in milliseconds.
|
|
915
|
+
* The lower limit of the property.
|
|
438
916
|
*/
|
|
439
|
-
|
|
917
|
+
min?: number;
|
|
440
918
|
/**
|
|
441
|
-
*
|
|
919
|
+
* 采集设备最终输出的值上限。
|
|
442
920
|
*/
|
|
443
921
|
/** @en
|
|
444
|
-
* The
|
|
445
|
-
*
|
|
446
|
-
* A Unix timestamp in milliseconds.
|
|
922
|
+
* The upper limit of the property.
|
|
447
923
|
*/
|
|
448
|
-
|
|
924
|
+
max?: number;
|
|
449
925
|
/**
|
|
450
|
-
*
|
|
926
|
+
* 期望采集设备最终输出的值,如果设备不支持指定的值,会尽量输出一个最靠近的值。
|
|
451
927
|
*/
|
|
452
928
|
/** @en
|
|
453
|
-
*
|
|
929
|
+
* An ideal value of a property. If the video capture device cannot output this value, it outputs the closest value instead.
|
|
454
930
|
*/
|
|
455
|
-
|
|
931
|
+
ideal?: number;
|
|
456
932
|
/**
|
|
457
|
-
*
|
|
933
|
+
* 严格指定采集设备最终输出的值,如果设备不支持指定的值,采集会失败。
|
|
458
934
|
*/
|
|
459
935
|
/** @en
|
|
460
|
-
*
|
|
936
|
+
* A required value of a property. If the video capture device cannot output this value, the video capture fails.
|
|
461
937
|
*/
|
|
462
|
-
|
|
938
|
+
exact?: number;
|
|
463
939
|
}
|
|
464
940
|
|
|
465
|
-
export declare
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
941
|
+
export declare function createBufferSourceAudioTrack(config: BufferSourceAudioTrackInitConfig): Promise<BufferSourceAudioTrack>;
|
|
942
|
+
|
|
943
|
+
export declare function createCameraVideoTrack(config?: CameraVideoTrackInitConfig): Promise<CameraVideoTrack>;
|
|
944
|
+
|
|
945
|
+
export declare function createCustomAudioTrack(config: CustomAudioTrackInitConfig): LocalAudioTrack;
|
|
946
|
+
|
|
947
|
+
export declare function createCustomVideoTrack(config: CustomVideoTrackInitConfig): LocalVideoTrack;
|
|
948
|
+
|
|
949
|
+
export declare function createMicrophoneAndCameraTracks(audioConfig?: MicrophoneAudioTrackInitConfig, videoConfig?: CameraVideoTrackInitConfig): Promise<[MicrophoneAudioTrack, CameraVideoTrack]>;
|
|
950
|
+
|
|
951
|
+
export declare function createMicrophoneAudioTrack(config?: MicrophoneAudioTrackInitConfig): Promise<MicrophoneAudioTrack>;
|
|
952
|
+
|
|
953
|
+
export declare function createMixingAudioTrack(trackList: LocalAudioTrack[]): MixingAudioTrack;
|
|
954
|
+
|
|
955
|
+
export declare function createScreenVideoTrack(config: ScreenVideoTrackInitConfig, withAudio: "enable"): Promise<[LocalVideoTrack, LocalAudioTrack]>;
|
|
956
|
+
|
|
957
|
+
export declare function createScreenVideoTrack(config?: ScreenVideoTrackInitConfig, withAudio?: "disable"): Promise<LocalVideoTrack>;
|
|
958
|
+
|
|
959
|
+
export declare function createScreenVideoTrack(config: ScreenVideoTrackInitConfig, withAudio: "auto"): Promise<[LocalVideoTrack, LocalAudioTrack] | LocalVideoTrack>;
|
|
960
|
+
|
|
961
|
+
/**
|
|
962
|
+
* 创建自定义音频轨道时的配置参数,用于 [AgoraRTC.createCustomAudioTrack]{@link IAgoraRTC.createCustomAudioTrack}。
|
|
963
|
+
*/
|
|
964
|
+
/** @en
|
|
965
|
+
* Configurations for the custom audio track. Set these configurations when calling [AgoraRTC.createCustomAudioTrack]{@link IAgoraRTC.createCustomAudioTrack}.
|
|
966
|
+
*/
|
|
967
|
+
export declare interface CustomAudioTrackInitConfig {
|
|
968
|
+
/**
|
|
969
|
+
* 你自己维护的 [MediaStreamTrack](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack) 对象。
|
|
970
|
+
*/
|
|
971
|
+
/** @en
|
|
972
|
+
* Your [MediaStreamTrack](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack) object.
|
|
973
|
+
*/
|
|
974
|
+
mediaStreamTrack: MediaStreamTrack;
|
|
975
|
+
/**
|
|
976
|
+
* 控制音频的编码配置。
|
|
977
|
+
*
|
|
978
|
+
* 你可以通过 [[AudioEncoderConfigurationPreset]] 传入 SDK 内置的编码配置;也可以通过传入一个 [[AudioEncoderConfiguration]] 来自定义音频编码配置。
|
|
979
|
+
*
|
|
980
|
+
* > Firefox 不支持设置音频编码码率。
|
|
981
|
+
*/
|
|
982
|
+
/** @en
|
|
983
|
+
* The audio encoder configurations.
|
|
984
|
+
*
|
|
985
|
+
* You can set the audio encoder configurations in either of the following ways:
|
|
986
|
+
* - Pass the preset audio encoder configurations by using [[AudioEncoderConfigurationPreset]].
|
|
987
|
+
* - Pass your customized audio encoder configurations by using [[AudioEncoderConfiguration]].
|
|
988
|
+
*
|
|
989
|
+
* > Firefox does not support setting the audio encoding rate.
|
|
990
|
+
*/
|
|
991
|
+
encoderConfig?: AudioEncoderConfiguration | AudioEncoderConfigurationPreset;
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
/**
|
|
995
|
+
* 创建自定义视频轨道时的配置参数,用于 [AgoraRTC.createCustomVideoTrack]{@link IAgoraRTC.createCustomVideoTrack}。
|
|
996
|
+
*/
|
|
997
|
+
/** @en
|
|
998
|
+
* Configurations for the custom video track. Set these configurations when calling [AgoraRTC.createCustomVideoTrack]{@link IAgoraRTC.createCustomVideoTrack}.
|
|
999
|
+
*/
|
|
1000
|
+
export declare interface CustomVideoTrackInitConfig {
|
|
1001
|
+
/**
|
|
1002
|
+
* 这里填写您自己维护的 [MediaStreamTrack](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack) 对象
|
|
1003
|
+
*/
|
|
1004
|
+
/** @en
|
|
1005
|
+
* Your [MediaStreamTrack](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack) object.
|
|
1006
|
+
*/
|
|
1007
|
+
mediaStreamTrack: MediaStreamTrack;
|
|
1008
|
+
/**
|
|
1009
|
+
* @自从
|
|
1010
|
+
* <br>   *4.17.1*
|
|
1011
|
+
*
|
|
1012
|
+
* 视频的分辨率宽。
|
|
1013
|
+
*
|
|
1014
|
+
* 支持传入 `number`,或一个约束对象,如 `{ max: 1280, min: 720 }`。
|
|
1015
|
+
*
|
|
1016
|
+
* 关于约束对象的详细说明可以参考 [ConstrainLong]{@link ConstrainLong}。
|
|
1017
|
+
*/
|
|
1018
|
+
/** @en
|
|
1019
|
+
* @since
|
|
1020
|
+
* <br>   *4.17.1*
|
|
1021
|
+
*
|
|
1022
|
+
* Width of the video.
|
|
1023
|
+
*
|
|
1024
|
+
* You can pass a `number`, or a constraint such as `{ max: 1280, min: 720 }`.
|
|
1025
|
+
*
|
|
1026
|
+
* For more details about the constraint, see [ConstrainLong]{@link ConstrainLong}.
|
|
1027
|
+
*/
|
|
1028
|
+
width?: number | ConstrainLong;
|
|
1029
|
+
/**
|
|
1030
|
+
* @自从
|
|
1031
|
+
* <br>   *4.17.1*
|
|
1032
|
+
*
|
|
1033
|
+
* 视频的分辨率高。
|
|
1034
|
+
*
|
|
1035
|
+
* 支持传入 `number`,或一个约束对象,如 `{ max: 1280, min: 720 }`。
|
|
1036
|
+
*
|
|
1037
|
+
* 关于约束对象的详细说明可以参考 [ConstrainLong]{@link ConstrainLong}。
|
|
1038
|
+
*/
|
|
1039
|
+
/** @en
|
|
1040
|
+
* @since
|
|
1041
|
+
* <br>   *4.17.1*
|
|
1042
|
+
*
|
|
1043
|
+
* Height of the video.
|
|
1044
|
+
*
|
|
1045
|
+
* You can pass a `number`, or a constraint such as `{ max: 1280, min: 720 }`.
|
|
1046
|
+
*
|
|
1047
|
+
* For more details about the constraint, see [ConstrainLong]{@link ConstrainLong}.
|
|
1048
|
+
*/
|
|
1049
|
+
height?: number | ConstrainLong;
|
|
1050
|
+
/**
|
|
1051
|
+
* @自从
|
|
1052
|
+
* <br>   *4.17.1*
|
|
1053
|
+
*
|
|
1054
|
+
* 视频帧率,单位为 fps。
|
|
1055
|
+
*
|
|
1056
|
+
* 支持传入 `number`,或一个约束对象,如 `{ max: 30, min: 5 }`。
|
|
1057
|
+
*
|
|
1058
|
+
* 关于约束对象的详细说明可以参考 [ConstrainLong]{@link ConstrainLong}。
|
|
1059
|
+
*/
|
|
1060
|
+
/** @en
|
|
1061
|
+
* @since
|
|
1062
|
+
* <br>   *4.17.1*
|
|
1063
|
+
*
|
|
1064
|
+
* Frame rate of the video (fps).
|
|
1065
|
+
*
|
|
1066
|
+
* You can pass a `number`, or a constraint such as `{ max: 30, min: 5 }`.
|
|
1067
|
+
*
|
|
1068
|
+
* For details about the constraint, see [ConstrainLong]{@link ConstrainLong}.
|
|
1069
|
+
*/
|
|
1070
|
+
frameRate?: number | ConstrainLong;
|
|
1071
|
+
/**
|
|
1072
|
+
* 指定发送这个视频轨道时的最小码率,单位为 Kbps。
|
|
1073
|
+
*/
|
|
1074
|
+
/** @en
|
|
1075
|
+
* The minimum bitrate of sending the video track (Kbps).
|
|
1076
|
+
*/
|
|
1077
|
+
bitrateMin?: number;
|
|
1078
|
+
/**
|
|
1079
|
+
* 指定发送这个视频轨道时的最大码率,单位为 Kbps。
|
|
1080
|
+
*/
|
|
1081
|
+
/** @en
|
|
1082
|
+
* The maximum bitrate of sending the video track (Kbps).
|
|
1083
|
+
*/
|
|
1084
|
+
bitrateMax?: number;
|
|
1085
|
+
/**
|
|
1086
|
+
* @自从
|
|
1087
|
+
* <br>   *4.0.0*
|
|
1088
|
+
*
|
|
1089
|
+
* 传输优化模式。设置该值后,SDK 会自动调整码率配置以及使用不同的回退策略。
|
|
1090
|
+
* - `"detail"`: 清晰优先。
|
|
1091
|
+
* - SDK 会自动根据你的采集分辨率和帧率设定一个最小码率。即使遭遇网络波动,发送码率也不会低于这个值,从而确保清晰的视频画面。
|
|
1092
|
+
* - 大部分情况下,SDK 不会降低发送分辨率,但是可能会降低帧率。
|
|
1093
|
+
* - `"motion"`: 流畅优先。
|
|
1094
|
+
* - SDK 不会启用最小码率策略。遭遇网络波动时,发送端会降低码率来确保接收端的视频画面不会出现中断和卡顿。
|
|
1095
|
+
* - 大部分情况下,SDK 不会降低帧率,但是可能会降低发送分辨率。
|
|
1096
|
+
* - 留空: 默认优化策略,兼顾清晰和流畅,也就是说弱网条件下,帧率和分辨率都会被调整。
|
|
1097
|
+
*
|
|
1098
|
+
* > 注意事项:该方法只支持 Chrome 浏览器。
|
|
1099
|
+
*/
|
|
1100
|
+
/** @en
|
|
1101
|
+
* @since
|
|
1102
|
+
* <br>   *4.0.0*
|
|
1103
|
+
*
|
|
1104
|
+
* Transmission optimization mode. Whether to prioritize video quality or smoothness:
|
|
1105
|
+
* - `"detail"`: Prioritizes video quality.
|
|
1106
|
+
* - The SDK ensures high-quality images by automatically calculating a minimum bitrate based on the capturing resolution and frame rate. No matter how poor the network condition is, the sending bitrate will never be lower than the minimum value.
|
|
1107
|
+
* - In most cases, the SDK does not reduce the sending resolution, but may reduce the frame rate.
|
|
1108
|
+
* - `"motion"`: Prioritizes video smoothness.
|
|
1109
|
+
* - In poor network conditions, the SDK reduces the sending bitrate to minimize video freezes.
|
|
1110
|
+
* - In most cases, the SDK does not reduce the frame rate, but may reduce the sending resolution.
|
|
1111
|
+
* - Empty: Uses the default transmission optimization mode. The SDK may reduce the frame rate or the sending resolution in poor network conditions.
|
|
1112
|
+
*
|
|
1113
|
+
* > Note: This method is only supported on Chrome.
|
|
1114
|
+
*/
|
|
1115
|
+
optimizationMode?: "motion" | "detail";
|
|
1116
|
+
/**
|
|
1117
|
+
* @ignore
|
|
1118
|
+
* @自从
|
|
1119
|
+
* <br>   *4.18.0*
|
|
1120
|
+
*
|
|
1121
|
+
* SVC (可伸缩视频编码)配置。
|
|
1122
|
+
*
|
|
1123
|
+
* 你可以通过 {@link SVCConfigurationPreset} 传入 SDK 预设的 SVC 编码配置,也可以通过 {@link SVCConfiguration} 传入自定义的 SVC 编码配置。
|
|
1124
|
+
*/
|
|
1125
|
+
/** @en
|
|
1126
|
+
* @ignore
|
|
1127
|
+
*
|
|
1128
|
+
* @since
|
|
1129
|
+
* <br>   *4.18.0*
|
|
1130
|
+
*
|
|
1131
|
+
* Configurations for Scalable Video Coding (SVC).
|
|
1132
|
+
*
|
|
1133
|
+
* You can set `scalabiltyMode` using one of the following options:
|
|
1134
|
+
* - Use the preset SVC configurations provided by the SDK through {@link SVCConfigurationPreset}.
|
|
1135
|
+
* - Use your custom SVC configurations through {@link SVCConfiguration}.
|
|
1136
|
+
*/
|
|
1137
|
+
scalabiltyMode?: SVCConfiguration | SVCConfigurationPreset;
|
|
1138
|
+
}
|
|
1139
|
+
|
|
1140
|
+
export declare abstract class DataChannel extends EventEmitter implements IDataChannel {
|
|
1141
|
+
private _version;
|
|
1142
|
+
private _type;
|
|
1143
|
+
_config: IDataChannelConfig;
|
|
1144
|
+
/** 原始的 DataChannel 对象 */
|
|
1145
|
+
_originDataChannel?: RTCDataChannel;
|
|
1146
|
+
protected _dataStreamPacketHeader: ArrayBuffer;
|
|
1147
|
+
protected _dataStreamPacketHandler: DataStream;
|
|
1148
|
+
private _datachannelEventMap;
|
|
1149
|
+
constructor(config: IDataChannelConfig, datachannel?: RTCDataChannel);
|
|
1150
|
+
get id(): number;
|
|
1151
|
+
get ordered(): boolean;
|
|
1152
|
+
get maxRetransmits(): number;
|
|
1153
|
+
get metadata(): string;
|
|
1154
|
+
get readyState(): RTCDataChannelState;
|
|
1155
|
+
get _originDataChannelId(): number | null;
|
|
1156
|
+
getChannelId(): number;
|
|
1157
|
+
getConfig(): IDataChannelConfig;
|
|
1158
|
+
_close(): void;
|
|
1159
|
+
_waitTillOpen(): Promise<void>;
|
|
1160
|
+
_updateOriginDataChannel(datachannel: RTCDataChannel): void;
|
|
1161
|
+
private _initPacketHeader;
|
|
1162
|
+
private _bandDataChannelEvents;
|
|
1163
|
+
private _unbindDataChannelEvents;
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1166
|
+
export declare enum DataChannelEvents {
|
|
1167
|
+
OPEN = "open",
|
|
1168
|
+
MESSAGE = "message",
|
|
1169
|
+
CLOSE = "close",
|
|
1170
|
+
CLOSING = "closing",
|
|
1171
|
+
ERROR = "error"
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
declare class DataStream {
|
|
1175
|
+
private _sequence;
|
|
1176
|
+
private _startTime;
|
|
1177
|
+
private isUseOneByte;
|
|
1178
|
+
private get startTime();
|
|
1179
|
+
private get sequence();
|
|
1180
|
+
serialize(payload: ArrayBuffer): ArrayBuffer;
|
|
1181
|
+
deserialize(packet: ArrayBuffer): ArrayBuffer;
|
|
1182
|
+
private serializeExtension;
|
|
1183
|
+
private deserializeExtension;
|
|
1184
|
+
private decompress;
|
|
1185
|
+
private compress;
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
export declare function decodeAudioData(buffer: ArrayBuffer): Promise<AudioBuffer>;
|
|
1189
|
+
|
|
1190
|
+
export declare const DEFAULT_LOCAL_AUDIO_TRACK_STATS: LocalAudioTrackStats;
|
|
1191
|
+
|
|
1192
|
+
export declare const DEFAULT_LOCAL_VIDEO_TRACK_STATS: LocalVideoTrackStats;
|
|
1193
|
+
|
|
1194
|
+
export declare const DEFAULT_NETWORK_QUALITY_STATS: NetworkQuality;
|
|
1195
|
+
|
|
1196
|
+
export declare const DEFAULT_REMOTE_AUDIO_TRACK_STATS: RemoteAudioTrackStats;
|
|
1197
|
+
|
|
1198
|
+
export declare const DEFAULT_REMOTE_VIDEO_TRACK_STATS: RemoteVideoTrackStats;
|
|
1199
|
+
|
|
1200
|
+
export declare interface DenoiserStats {
|
|
1201
|
+
ns: number;
|
|
1202
|
+
ebn: number;
|
|
1203
|
+
ean: number;
|
|
1204
|
+
vl: number;
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1207
|
+
/**
|
|
1208
|
+
* 是否支持Audio标签 setSinkId
|
|
1209
|
+
* Firefox 116 以上也支持此接口,但是会出现回声问题
|
|
1210
|
+
* 仅支持PC 端 Chrome / Edge,且不支持移动端
|
|
1211
|
+
*/
|
|
1212
|
+
export declare function detectSupportAudioElementSetSinkId(): boolean;
|
|
1213
|
+
|
|
1214
|
+
/**
|
|
1215
|
+
* 音视频采集设备的信息。
|
|
1216
|
+
*
|
|
1217
|
+
* - 音频采集设备信息可通过 [onMicrophoneChanged]{@link onMicrophoneChanged} 获取。
|
|
1218
|
+
* - 视频采集设备信息可通过 [onCameraChanged]{@link onCameraChanged} 获取。
|
|
1219
|
+
* - 音频播放设备信息可通过 [onPlaybackDeviceChanged]{@link onPlaybackDeviceChanged} 获取。
|
|
1220
|
+
* @public
|
|
1221
|
+
*/
|
|
1222
|
+
/** @en
|
|
1223
|
+
* Information of the media input device.
|
|
1224
|
+
*
|
|
1225
|
+
* - You can get the audio sampling device information through [onMicrophoneChanged]{@link onMicrophoneChanged}.
|
|
1226
|
+
* - You can get the video capture device information through [onCameraChanged]{@link onCameraChanged}.
|
|
1227
|
+
* - You can get the audio playback device information through [onPlaybackDeviceChanged]{@link onPlaybackDeviceChanged}.
|
|
1228
|
+
*/
|
|
1229
|
+
export declare interface DeviceInfo {
|
|
1230
|
+
/**
|
|
1231
|
+
* 采集设备的插拔状态更新时间,UNIX 时间戳,单位为 ms。
|
|
1232
|
+
*/
|
|
1233
|
+
/** @en
|
|
1234
|
+
* The latest time when the state of the media input device was updated.
|
|
1235
|
+
*
|
|
1236
|
+
* A Unix timestamp in milliseconds.
|
|
1237
|
+
*/
|
|
1238
|
+
updateAt: number;
|
|
1239
|
+
/**
|
|
1240
|
+
* SDK 首次检测到采集设备的时间,UNIX 时间戳,单位为 ms。
|
|
1241
|
+
*/
|
|
1242
|
+
/** @en
|
|
1243
|
+
* The time when the SDK first detects the media input device.
|
|
1244
|
+
*
|
|
1245
|
+
* A Unix timestamp in milliseconds.
|
|
1246
|
+
*/
|
|
1247
|
+
initAt: number;
|
|
1248
|
+
/**
|
|
1249
|
+
* 采集设备当前的插拔状态。
|
|
1250
|
+
*/
|
|
1251
|
+
/** @en
|
|
1252
|
+
* The state of the capture device.
|
|
1253
|
+
*/
|
|
1254
|
+
state: DeviceState;
|
|
1255
|
+
/**
|
|
1256
|
+
* 采集设备的设备信息,详见 [MediaDeviceInfo](https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo)。
|
|
1257
|
+
*/
|
|
1258
|
+
/** @en
|
|
1259
|
+
* Device information of the media input device. See [MediaDeviceInfo](https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo) for details.
|
|
1260
|
+
*/
|
|
1261
|
+
device: MediaDeviceInfo;
|
|
1262
|
+
}
|
|
1263
|
+
|
|
1264
|
+
export declare class DeviceManager extends EventEmitter {
|
|
1265
|
+
private _state;
|
|
1266
|
+
get state(): DeviceManagerState;
|
|
1267
|
+
set state(state: DeviceManagerState);
|
|
1268
|
+
private isAccessMicrophonePermission;
|
|
1269
|
+
private isAccessCameraPermission;
|
|
1270
|
+
private lastAccessMicrophonePermission;
|
|
1271
|
+
private lastAccessCameraPermission;
|
|
1272
|
+
private checkdeviceMatched;
|
|
1273
|
+
/**
|
|
1274
|
+
* 记录所有枚举到的设备和这些设备最后出现的时间
|
|
476
1275
|
*/
|
|
477
1276
|
private deviceInfoMap;
|
|
478
1277
|
constructor();
|
|
@@ -518,6 +1317,40 @@ export declare type DeviceState = "ACTIVE" | "INACTIVE";
|
|
|
518
1317
|
|
|
519
1318
|
export declare const emptyImage2TypedArray: (type: string) => Promise<ImageTypedData>;
|
|
520
1319
|
|
|
1320
|
+
/**
|
|
1321
|
+
* @ignore
|
|
1322
|
+
*
|
|
1323
|
+
* 通过 [setBeautyEffect]{@link ILocalVideoTrack.setBeautyEffect} 开启美颜后,如果检测到美颜对设备性能消耗过大就会触发该事件。
|
|
1324
|
+
*
|
|
1325
|
+
* 你可以监听这个事件提示用户美颜过载,并关闭美颜。
|
|
1326
|
+
*
|
|
1327
|
+
* ```javascript
|
|
1328
|
+
* localVideoTrack.on("beauty-effect-overload", () => {
|
|
1329
|
+
* console.log("beauty effect overload, disable beauty effect");
|
|
1330
|
+
* localVideoTrack.setBeautyEffect(false);
|
|
1331
|
+
* });
|
|
1332
|
+
* ```
|
|
1333
|
+
* @event
|
|
1334
|
+
* @asMemberOf ILocalVideoTrack
|
|
1335
|
+
*/
|
|
1336
|
+
/** @en
|
|
1337
|
+
* @ignore
|
|
1338
|
+
*
|
|
1339
|
+
* Occurs when the device is overloaded after you call [setBeautyEffect]{@link ILocalVideoTrack.setBeautyEffect} to enable image enhancement.
|
|
1340
|
+
*
|
|
1341
|
+
* You can listen for this event to notify users of the device overload and disable image enhancement.
|
|
1342
|
+
*
|
|
1343
|
+
* ```javascript
|
|
1344
|
+
* localVideoTrack.on("beauty-effect-overload", () => {
|
|
1345
|
+
* console.log("beauty effect overload, disable beauty effect");
|
|
1346
|
+
* localVideoTrack.setBeautyEffect(false);
|
|
1347
|
+
* });
|
|
1348
|
+
* ```
|
|
1349
|
+
* @event
|
|
1350
|
+
* @asMemberOf ILocalVideoTrack
|
|
1351
|
+
*/
|
|
1352
|
+
declare function event_beauty_effect_overload(): void;
|
|
1353
|
+
|
|
521
1354
|
/**
|
|
522
1355
|
* 首帧音频或视频解码时触发。
|
|
523
1356
|
*
|
|
@@ -555,61 +1388,207 @@ declare function event_first_frame_decoded(): void;
|
|
|
555
1388
|
declare function event_sei_received(sei: Uint8Array): void;
|
|
556
1389
|
|
|
557
1390
|
/**
|
|
558
|
-
*
|
|
1391
|
+
* 当 [BufferSourceAudioTrack]{@link IBufferSourceAudioTrack} 的音频数据源处理状态变化时,会触发此事件。
|
|
559
1392
|
*
|
|
560
|
-
* @param
|
|
1393
|
+
* @param currentState 当前音频数据处理状态:
|
|
1394
|
+
* - `"stopped"`: 音频源数据处理停止。可能是因为数据处理完毕,也可能是手动触发了停止。
|
|
1395
|
+
* - `"paused"`: 音频源数据暂停处理。
|
|
1396
|
+
* - `"playing"`: 音频源数据正在处理。
|
|
561
1397
|
*
|
|
562
1398
|
* @event
|
|
563
|
-
* @asMemberOf
|
|
1399
|
+
* @asMemberOf IBufferSourceAudioTrack
|
|
564
1400
|
*/
|
|
565
1401
|
/** @en
|
|
566
|
-
* Occurs when the
|
|
1402
|
+
* Occurs when the state of processing the audio buffer in [BufferSourceAudioTrack]{@link IBufferSourceAudioTrack} changes.
|
|
1403
|
+
*
|
|
1404
|
+
* @param currentState The state of processing the audio buffer:
|
|
1405
|
+
* - `"stopped"`: The SDK stops processing the audio buffer. Reasons may include:
|
|
1406
|
+
* - The SDK finishes processing the audio buffer.
|
|
1407
|
+
* - The user manually stops the processing of the audio buffer.
|
|
1408
|
+
* - `"paused"`: The SDK pauses the processing of the audio buffer.
|
|
1409
|
+
* - `"playing"`: The SDK is processing the audio buffer.
|
|
567
1410
|
*
|
|
568
|
-
* @param transceiver The new `RTCRtpTransceiver` instance.
|
|
569
1411
|
* @event
|
|
570
|
-
* @asMemberOf
|
|
1412
|
+
* @asMemberOf IBufferSourceAudioTrack
|
|
571
1413
|
*/
|
|
572
|
-
declare function
|
|
1414
|
+
declare function event_source_state_change(currentState: AudioSourceState): void;
|
|
573
1415
|
|
|
574
1416
|
/**
|
|
575
|
-
*
|
|
576
|
-
*
|
|
577
|
-
*
|
|
578
|
-
*
|
|
579
|
-
*
|
|
580
|
-
*
|
|
1417
|
+
* 音频或视频轨道被终止,终止的原因可能是:
|
|
1418
|
+
* - 摄像头被拔出
|
|
1419
|
+
* - 麦克风被拔出
|
|
1420
|
+
* - 用户主动停止了屏幕共享
|
|
1421
|
+
* - 用户主动关闭了底层的 `MediaStreamTrack`
|
|
1422
|
+
* - 媒体设备故障
|
|
1423
|
+
* - 正在使用中的媒体设备的权限被收回
|
|
581
1424
|
*
|
|
582
|
-
* @param data `<video>` 标签的可见状态信息。
|
|
583
|
-
* @asMemberOf IRemoteVideoTrack
|
|
584
1425
|
* @event
|
|
1426
|
+
* @asMemberOf ILocalTrack
|
|
585
1427
|
*/
|
|
586
1428
|
/** @en
|
|
587
|
-
*
|
|
588
|
-
* <br>   *4.8.0*
|
|
589
|
-
*
|
|
590
|
-
* Indicates the visibility of the `<video>` HTML tag.
|
|
591
|
-
*
|
|
592
|
-
* The SDK triggers this event every 30 seconds.
|
|
1429
|
+
* Occurs when a audio or video track ends.
|
|
593
1430
|
*
|
|
594
|
-
*
|
|
1431
|
+
* Reasons may include:
|
|
1432
|
+
* - Camera is unplugged.
|
|
1433
|
+
* - Microphone is unplugged.
|
|
1434
|
+
* - The local user stops screen sharing.
|
|
1435
|
+
* - The local user closes the underlying `MediaStreamTrack`.
|
|
1436
|
+
* - A local media device malfunctions.
|
|
1437
|
+
* - The device permission is revoked.
|
|
595
1438
|
*
|
|
596
|
-
* @param data The visibility of the `<video>` tag.
|
|
597
|
-
* @asMemberOf IRemoteVideoTrack
|
|
598
1439
|
* @event
|
|
1440
|
+
* @asMemberOf ILocalTrack
|
|
599
1441
|
*/
|
|
600
|
-
declare function
|
|
1442
|
+
declare function event_track_ended(): void;
|
|
601
1443
|
|
|
602
1444
|
/**
|
|
603
|
-
*
|
|
1445
|
+
* 媒体轨道有更新时触发。
|
|
1446
|
+
* @param track 媒体轨道。详见 [MediaStreamTrack](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack)。
|
|
1447
|
+
* @event
|
|
1448
|
+
*/
|
|
1449
|
+
/** @en
|
|
1450
|
+
* Triggers when a media track is updated.
|
|
1451
|
+
* @param track The media stream track. See [MediaStreamTrack](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack).
|
|
1452
|
+
* @event
|
|
1453
|
+
*/
|
|
1454
|
+
export declare function event_track_updated(track: MediaStreamTrack): void;
|
|
1455
|
+
|
|
1456
|
+
/**
|
|
1457
|
+
* 当前轨道的 `RTCRtpTransceiver` 实例更新回调。
|
|
1458
|
+
*
|
|
1459
|
+
* @param transceiver 新的 `RTCRtpTransceiver` 实例。
|
|
1460
|
+
* @param type 当前轨道所属视频流的类型。详见 {@link StreamType}。
|
|
604
1461
|
*
|
|
605
1462
|
* @event
|
|
606
|
-
* @asMemberOf
|
|
1463
|
+
* @asMemberOf ILocalTrack
|
|
607
1464
|
*/
|
|
608
1465
|
/** @en
|
|
609
|
-
* Occurs when the
|
|
1466
|
+
* Occurs when the `RTCRtpTransceiver` instance of the current track is updated.
|
|
1467
|
+
*
|
|
1468
|
+
* @param transceiver The new `RTCRtpTransceiver` instance.
|
|
1469
|
+
* @param type The type of the video stream to which the current track belongs. See {@link StreamType}.
|
|
610
1470
|
*
|
|
611
1471
|
* @event
|
|
612
|
-
* @asMemberOf
|
|
1472
|
+
* @asMemberOf ILocalTrack
|
|
1473
|
+
*/
|
|
1474
|
+
declare function event_transceiver_updated(transceiver: RTCRtpTransceiver, type?: StreamType): void;
|
|
1475
|
+
|
|
1476
|
+
/**
|
|
1477
|
+
* 当前轨道的 `RTCRtpTransceiver` 实例更新回调。
|
|
1478
|
+
*
|
|
1479
|
+
* @param transceiver 新的 `RTCRtpTransceiver` 实例。
|
|
1480
|
+
*
|
|
1481
|
+
* @event
|
|
1482
|
+
* @asMemberOf IRemoteTrack
|
|
1483
|
+
*/
|
|
1484
|
+
/** @en
|
|
1485
|
+
* Occurs when the `RTCRtpTransceiver` instance of the current track is updated.
|
|
1486
|
+
*
|
|
1487
|
+
* @param transceiver The new `RTCRtpTransceiver` instance.
|
|
1488
|
+
* @event
|
|
1489
|
+
* @asMemberOf IRemoteTrack
|
|
1490
|
+
*/
|
|
1491
|
+
declare function event_transceiver_updated_2(transceiver: RTCRtpTransceiver): void;
|
|
1492
|
+
|
|
1493
|
+
/**
|
|
1494
|
+
* @ignore
|
|
1495
|
+
*/
|
|
1496
|
+
/** @en
|
|
1497
|
+
* @ignore
|
|
1498
|
+
*/
|
|
1499
|
+
declare function event_user_datachannel_close(): void;
|
|
1500
|
+
|
|
1501
|
+
/**
|
|
1502
|
+
* @ignore
|
|
1503
|
+
*/
|
|
1504
|
+
/** @en
|
|
1505
|
+
* @ignore
|
|
1506
|
+
*/
|
|
1507
|
+
declare function event_user_datachannel_error(ev: Event): void;
|
|
1508
|
+
|
|
1509
|
+
/**
|
|
1510
|
+
* @ignore
|
|
1511
|
+
*/
|
|
1512
|
+
/** @en
|
|
1513
|
+
* @ignore
|
|
1514
|
+
*/
|
|
1515
|
+
declare function event_user_datachannel_message(data: ArrayBuffer): void;
|
|
1516
|
+
|
|
1517
|
+
/**
|
|
1518
|
+
* @ignore
|
|
1519
|
+
*/
|
|
1520
|
+
/** @en
|
|
1521
|
+
* @ignore
|
|
1522
|
+
*/
|
|
1523
|
+
declare function event_user_datachannel_open(): void;
|
|
1524
|
+
|
|
1525
|
+
/**
|
|
1526
|
+
* @自从
|
|
1527
|
+
* <br>   *4.8.0*
|
|
1528
|
+
*
|
|
1529
|
+
* 提示 HTML `<video>` 标签的可见状态和不可见原因。SDK 每 30 秒触发一次该事件。
|
|
1530
|
+
*
|
|
1531
|
+
* 调用 `localVideoTrack.play` 后 SDK 会创建 [HTML `<video>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video) 标签用于播放视频轨道。当 `localVideoTrack.isPlaying` 为 `true` 却看不到图像时,你可通过此事件来进行问题排查。
|
|
1532
|
+
*
|
|
1533
|
+
* @param data `<video>` 标签的可见状态信息。
|
|
1534
|
+
* @asMemberOf ILocalVideoTrack
|
|
1535
|
+
* @event
|
|
1536
|
+
*/
|
|
1537
|
+
/** @en
|
|
1538
|
+
* @since
|
|
1539
|
+
* <br>   *4.8.0*
|
|
1540
|
+
*
|
|
1541
|
+
* Indicates the visibility of the `<video>` HTML tag.
|
|
1542
|
+
*
|
|
1543
|
+
* The SDK triggers this event every 30 seconds.
|
|
1544
|
+
*
|
|
1545
|
+
* After you call `localVideoTrack.play`, the SDK creates an [`<video>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video) tag for playing video tracks. When `localVideoTrack.isPlaying` is `true` but you cannot see any video, this event helps you check whether the `<video>` tag is visible or not and learn the reason when the `<video>` tag is invisible.
|
|
1546
|
+
*
|
|
1547
|
+
* @param data The visibility of the `<video>` tag.
|
|
1548
|
+
* @asMemberOf ILocalVideoTrack
|
|
1549
|
+
* @event
|
|
1550
|
+
*/
|
|
1551
|
+
declare function event_video_element_visible_status(data?: CheckVideoVisibleResult): void;
|
|
1552
|
+
|
|
1553
|
+
/**
|
|
1554
|
+
* @自从
|
|
1555
|
+
* <br>   *4.8.0*
|
|
1556
|
+
*
|
|
1557
|
+
* 提示 HTML `<video>` 标签的可见状态和不可见原因。SDK 每 30 秒触发一次该事件。
|
|
1558
|
+
*
|
|
1559
|
+
* 调用 `remoteVideoTrack.play` 后 SDK 会创建 [HTML `<video>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video) 标签用于播放视频轨道。当 `remoteVideoTrack.isPlaying` 为 `true` 却看不到图像时,你可通过此事件来进行问题排查。
|
|
1560
|
+
*
|
|
1561
|
+
* @param data `<video>` 标签的可见状态信息。
|
|
1562
|
+
* @asMemberOf IRemoteVideoTrack
|
|
1563
|
+
* @event
|
|
1564
|
+
*/
|
|
1565
|
+
/** @en
|
|
1566
|
+
* @since
|
|
1567
|
+
* <br>   *4.8.0*
|
|
1568
|
+
*
|
|
1569
|
+
* Indicates the visibility of the `<video>` HTML tag.
|
|
1570
|
+
*
|
|
1571
|
+
* The SDK triggers this event every 30 seconds.
|
|
1572
|
+
*
|
|
1573
|
+
* After you call `remoteVideoTrack.play`, the SDK creates an [`<video>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video) tag for playing video tracks. When `remoteVideoTrack.isPlaying` is `true` but you cannot see any video, this event helps you check whether the `<video>` tag is visible or not and learn the reason when the `<video>` tag is invisible.
|
|
1574
|
+
*
|
|
1575
|
+
* @param data The visibility of the `<video>` tag.
|
|
1576
|
+
* @asMemberOf IRemoteVideoTrack
|
|
1577
|
+
* @event
|
|
1578
|
+
*/
|
|
1579
|
+
declare function event_video_element_visible_status_2(data?: CheckVideoVisibleResult): void;
|
|
1580
|
+
|
|
1581
|
+
/**
|
|
1582
|
+
* 视频状态发生变化时触发。
|
|
1583
|
+
*
|
|
1584
|
+
* @event
|
|
1585
|
+
* @asMemberOf IRemoteTrack
|
|
1586
|
+
*/
|
|
1587
|
+
/** @en
|
|
1588
|
+
* Occurs when the video state changes.
|
|
1589
|
+
*
|
|
1590
|
+
* @event
|
|
1591
|
+
* @asMemberOf IRemoteTrack
|
|
613
1592
|
*/
|
|
614
1593
|
declare function event_video_state_changed(videoState: VideoState): void;
|
|
615
1594
|
|
|
@@ -650,10 +1629,58 @@ declare class FakeTrackSource extends EventEmitter {
|
|
|
650
1629
|
createMediaStreamSourceNode(): undefined;
|
|
651
1630
|
}
|
|
652
1631
|
|
|
1632
|
+
export declare const frameData2CryptoBuffer: (imageData: ImageTypedData, appid: string, channelName: string) => Promise<Uint8Array>;
|
|
1633
|
+
|
|
653
1634
|
export declare function getAudioContext(): AudioContext;
|
|
654
1635
|
|
|
1636
|
+
export declare function getAudioEncoderConfiguration(profile: AudioEncoderConfigurationPreset | AudioEncoderConfiguration): AudioEncoderConfiguration;
|
|
1637
|
+
|
|
1638
|
+
export declare function getBitrateConstrainRange(width: number, height: number, frameRate: number, bitrateMin?: number, bitrateMax?: number): DoubleRange;
|
|
1639
|
+
|
|
1640
|
+
/**
|
|
1641
|
+
* get bitrate, use STANDARD_BITRATE to make sure the response
|
|
1642
|
+
* @param width
|
|
1643
|
+
* @param height
|
|
1644
|
+
* @param fps
|
|
1645
|
+
*/
|
|
1646
|
+
export declare function getBitrateFromResAndFps(width: number, height: number, fps: number): Required<DoubleRange>;
|
|
1647
|
+
|
|
655
1648
|
export declare function getCompatibility(): AgoraRTCCompatibility;
|
|
656
1649
|
|
|
1650
|
+
export declare function getConstraintsFromCameraConfig(config: CameraVideoTrackInitConfig): MediaTrackConstraints;
|
|
1651
|
+
|
|
1652
|
+
export declare function getConstraintsFromMicrophoneConfig(config: MicrophoneAudioTrackInitConfig): MediaTrackConstraints;
|
|
1653
|
+
|
|
1654
|
+
export declare function getConstraintsFromScreenConfig(config: ScreenVideoTrackInitConfig): ScreenConstraintsWithElectron;
|
|
1655
|
+
|
|
1656
|
+
export declare function getElectronScreenSources(type?: ScreenSourceType): Promise<ElectronDesktopCapturerSource[]>;
|
|
1657
|
+
|
|
1658
|
+
export declare function getElectronScreenStream(sourceId: string, config: ScreenConstraintsWithElectron, captureAudio?: boolean): Promise<MediaStream>;
|
|
1659
|
+
|
|
1660
|
+
export declare function getElectronScreenStreamByUserSelect(config: ScreenConstraintsWithElectron, captureAudio?: boolean): Promise<MediaStream>;
|
|
1661
|
+
|
|
1662
|
+
export declare function getLocalStream(config: GetUserMediaConfig, id: string): Promise<MediaStream>;
|
|
1663
|
+
|
|
1664
|
+
/**
|
|
1665
|
+
* 获取初始配置
|
|
1666
|
+
* 分辨率:track.getMediaStreamTrackSettings > 客户设置
|
|
1667
|
+
* 帧率: track.getMediaStreamTrackSettings > 客户设置
|
|
1668
|
+
* 码率: 客户设置 > 根据分辨率计算
|
|
1669
|
+
*
|
|
1670
|
+
* ⚠️:理论上不存在没有分辨率的情况,如果出现不足任何处理
|
|
1671
|
+
*/
|
|
1672
|
+
export declare const getOriginSenderConfig: (track: LocalVideoTrack) => {
|
|
1673
|
+
frameRate: number;
|
|
1674
|
+
bitrateMax: number;
|
|
1675
|
+
bitrateMin: number;
|
|
1676
|
+
scaleResolutionDownBy: number;
|
|
1677
|
+
scale: number;
|
|
1678
|
+
};
|
|
1679
|
+
|
|
1680
|
+
export declare function getScalabilityConfiguration(profile: SVCConfiguration | SVCConfigurationPreset): SVCConfiguration;
|
|
1681
|
+
|
|
1682
|
+
export declare function getScreenEncoderConfiguration(profile: VideoEncoderConfiguration | ScreenEncoderConfigurationPreset | string): VideoEncoderConfiguration;
|
|
1683
|
+
|
|
657
1684
|
export declare function getSilenceAudioTrack(): MediaStreamTrack;
|
|
658
1685
|
|
|
659
1686
|
/**
|
|
@@ -664,339 +1691,826 @@ export declare function getSilenceAudioTrack(): MediaStreamTrack;
|
|
|
664
1691
|
*/
|
|
665
1692
|
export declare function getSilenceSamplesDuration(buffer: AudioBuffer): number;
|
|
666
1693
|
|
|
1694
|
+
/**
|
|
1695
|
+
* 获取一个稳定流,缓存一帧数据,当流停止超过1s时,会不断发送上一帧数据
|
|
1696
|
+
*/
|
|
1697
|
+
export declare function getStaticTrackStream(track: MediaStreamTrack, interval?: number): MediaStreamTrack | void;
|
|
1698
|
+
|
|
1699
|
+
export declare interface GetUserMediaConfig {
|
|
1700
|
+
video?: MediaTrackConstraints;
|
|
1701
|
+
audio?: MediaTrackConstraints;
|
|
1702
|
+
screen?: ScreenConstraintsWithElectron;
|
|
1703
|
+
videoSource?: MediaStreamTrack;
|
|
1704
|
+
audioSource?: MediaStreamTrack;
|
|
1705
|
+
/** 是否采集屏幕共享的音频 */
|
|
1706
|
+
screenAudio?: boolean;
|
|
1707
|
+
}
|
|
1708
|
+
|
|
1709
|
+
export declare function getVideoEncoderConfiguration(profile: VideoEncoderConfigurationPreset | VideoEncoderConfiguration | undefined): VideoEncoderConfiguration;
|
|
1710
|
+
|
|
667
1711
|
/**
|
|
668
1712
|
* 将原生的 DomException 转成对应的 AgoraRTCError
|
|
669
1713
|
*/
|
|
670
1714
|
export declare function handleGetUserMediaError(errorName: string, message?: string): AgoraRTCError;
|
|
671
1715
|
|
|
672
|
-
export declare
|
|
1716
|
+
export declare let HAS_GUM_AUDIO: boolean;
|
|
673
1717
|
|
|
674
|
-
export declare
|
|
1718
|
+
export declare let HAS_GUM_VIDEO: boolean;
|
|
675
1719
|
|
|
676
1720
|
export declare function hasAudioContext(): boolean;
|
|
677
1721
|
|
|
678
|
-
export declare interface ImageTypedData {
|
|
679
|
-
buffer: Uint8Array;
|
|
680
|
-
width: number;
|
|
681
|
-
height: number;
|
|
682
|
-
}
|
|
683
|
-
|
|
684
1722
|
/**
|
|
685
|
-
*
|
|
1723
|
+
* 直接通过音频数据源创建的音频轨道,继承于 [LocalAudioTrack]{@link ILocalAudioTrack}, 在此之上提供了控制音频数据处理流程的功能(开始/暂停/跳转等等)。
|
|
1724
|
+
*
|
|
1725
|
+
* 可以通过 [AgoraRTC.createBufferSourceAudioTrack]{@link IAgoraRTC.createBufferSourceAudioTrack} 来获取。
|
|
686
1726
|
*/
|
|
687
1727
|
/** @en
|
|
688
|
-
* `
|
|
1728
|
+
* Inherited from [LocalAudioTrack]{@link ILocalAudioTrack}, `BufferSourceAudioTrack` is an interface for the audio from a local audio file and adds several functions for controlling the processing of the audio buffer, such as starting processing, stopping processing, and seeking a specified time location.
|
|
689
1729
|
*
|
|
690
|
-
* You can
|
|
1730
|
+
* You can create an audio track from an audio file by calling [AgoraRTC.createBufferSourceAudioTrack]{@link IAgoraRTC.createBufferSourceAudioTrack}.
|
|
691
1731
|
*/
|
|
692
|
-
export declare interface
|
|
1732
|
+
export declare interface IBufferSourceAudioTrack extends ILocalAudioTrack {
|
|
693
1733
|
/**
|
|
694
|
-
*
|
|
695
|
-
*
|
|
696
|
-
* **不推荐使用** 请使用 [AgoraRTCClient.getRemoteAudioStats]{@link IAgoraRTCClient.getRemoteAudioStats} 获取远端音频轨道相关信息。
|
|
697
|
-
*
|
|
698
|
-
* @return 一个 [[RemoteAudioTrackStats]] 对象。
|
|
1734
|
+
* 创建时指定的 [source]{@link BufferSourceAudioTrackInitConfig.source} 值。
|
|
699
1735
|
*/
|
|
700
1736
|
/** @en
|
|
701
|
-
*
|
|
702
|
-
*
|
|
703
|
-
* @return An [[RemoteAudioTrackStats]] object.
|
|
1737
|
+
* The [source]{@link BufferSourceAudioTrackInitConfig.source} specified when creating an audio track.
|
|
704
1738
|
*/
|
|
705
|
-
|
|
1739
|
+
source: string | File | AudioBuffer | null;
|
|
706
1740
|
/**
|
|
707
|
-
*
|
|
708
|
-
*
|
|
709
|
-
* > 播放音频时 SDK 不会创建任何 DOM 元素,所以无需像视频一样提供 DOM 元素。
|
|
1741
|
+
* 当前音频数据源的处理状态(开始/暂停/停止)。
|
|
710
1742
|
*/
|
|
711
1743
|
/** @en
|
|
712
|
-
*
|
|
713
|
-
*
|
|
714
|
-
* > When playing the audio track, you do not need to pass any DOM element.
|
|
1744
|
+
* The current state of audio processing, such as start, pause, or stop.
|
|
715
1745
|
*/
|
|
716
|
-
|
|
1746
|
+
currentState: AudioSourceState;
|
|
1747
|
+
/**
|
|
1748
|
+
* 音频总时长,单位为秒。
|
|
1749
|
+
*/
|
|
1750
|
+
/** @en
|
|
1751
|
+
* The total duration of the audio (seconds).
|
|
1752
|
+
*/
|
|
1753
|
+
duration: number;
|
|
717
1754
|
/**
|
|
718
1755
|
* @自从
|
|
719
|
-
* <br>   *4.
|
|
1756
|
+
* <br>   *4.18.0*
|
|
720
1757
|
*
|
|
721
|
-
*
|
|
722
|
-
*
|
|
723
|
-
*
|
|
724
|
-
*
|
|
1758
|
+
* 当前音频文件的播放速度。取值范围为 [50,400],其中:
|
|
1759
|
+
* - `50`: 0.5 倍速。
|
|
1760
|
+
* - `100`: (默认)原始速度。
|
|
1761
|
+
* - `400`: 4 倍速。
|
|
725
1762
|
*/
|
|
726
1763
|
/** @en
|
|
727
1764
|
* @since
|
|
728
|
-
* <br>   *4.
|
|
1765
|
+
* <br>   *4.18.0*
|
|
729
1766
|
*
|
|
730
|
-
*
|
|
731
|
-
*
|
|
732
|
-
*
|
|
733
|
-
*
|
|
1767
|
+
* The playback speed of the current audio file. Valid range is [50, 400], where:
|
|
1768
|
+
* - `50`: Half the original speed.
|
|
1769
|
+
* - `100`: (Default) The original speed.
|
|
1770
|
+
* - `400`: Four times the original speed.
|
|
734
1771
|
*/
|
|
735
|
-
|
|
1772
|
+
playbackSpeed: number;
|
|
736
1773
|
/**
|
|
737
|
-
*
|
|
738
|
-
*
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
*
|
|
742
|
-
*
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
*
|
|
747
|
-
*
|
|
748
|
-
*
|
|
749
|
-
|
|
750
|
-
|
|
1774
|
+
* @param event 事件名称。
|
|
1775
|
+
* @param listener 详见 [source-state-change]{@link event_source_state_change}。
|
|
1776
|
+
*/
|
|
1777
|
+
/** @en
|
|
1778
|
+
* @param event The event name.
|
|
1779
|
+
* @param listener See [source-state-change]{@link event_source_state_change}.
|
|
1780
|
+
*/
|
|
1781
|
+
on(event: "source-state-change", listener: typeof event_source_state_change): void;
|
|
1782
|
+
/**
|
|
1783
|
+
* 当指定的事件触发时,会调用传入的回调函数。
|
|
1784
|
+
* @param event 事件名称。
|
|
1785
|
+
* @param listener 回调函数。
|
|
1786
|
+
*/
|
|
1787
|
+
/** @en
|
|
1788
|
+
* When the specified event happens, the SDK triggers the callback that you pass.
|
|
751
1789
|
*
|
|
752
|
-
*
|
|
753
|
-
*
|
|
754
|
-
|
|
755
|
-
|
|
1790
|
+
* @param event The event name.
|
|
1791
|
+
* @param listener The callback function.
|
|
1792
|
+
*/
|
|
1793
|
+
on(event: string, listener: Function): void;
|
|
1794
|
+
/**
|
|
1795
|
+
* 获取当前的音频处理的进度,单位为秒。
|
|
756
1796
|
*
|
|
757
|
-
* @
|
|
758
|
-
* @param frameSize 每次回调的 `AudioBuffer` 中每个声道包含的采样数据个数,只能设为下列值:256, 512, 1024, 2048, 4096, 8192, 16384。默认为 4096。
|
|
1797
|
+
* @returns 当前音频处理的进度。
|
|
759
1798
|
*/
|
|
760
1799
|
/** @en
|
|
761
|
-
*
|
|
1800
|
+
* Gets the progress (seconds) of the audio buffer processing.
|
|
762
1801
|
*
|
|
763
|
-
*
|
|
1802
|
+
* @returns The progress (seconds) of the audio buffer processing.
|
|
1803
|
+
*/
|
|
1804
|
+
getCurrentTime(): number;
|
|
1805
|
+
/**
|
|
1806
|
+
* 开始处理音频数据源。
|
|
764
1807
|
*
|
|
765
|
-
* >
|
|
1808
|
+
* > 开始处理音频数据源说明我们已经将音频数据送入 SDK 的处理节点。如果此时该音频轨道已发布,远端可以听到该音源的声音。
|
|
1809
|
+
* > 只有在调用 [[play]] 之后,音频数据才会送入声卡,此时本地才能听到该音源的声音。
|
|
766
1810
|
*
|
|
767
|
-
*
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
*
|
|
771
|
-
* const currentChannelData = buffer.getChannelData(channel);
|
|
772
|
-
* console.log("PCM data in channel", channel, currentChannelData);
|
|
773
|
-
* }
|
|
774
|
-
* }, 2048);
|
|
1811
|
+
* @param options 音频数据源处理的相关设置,包括是否需要循环播放/开始播放的位置。详见 [[AudioSourceOptions]]。
|
|
1812
|
+
*/
|
|
1813
|
+
/** @en
|
|
1814
|
+
* Starts processing the audio buffer.
|
|
775
1815
|
*
|
|
776
|
-
*
|
|
777
|
-
*
|
|
778
|
-
* track.setAudioFrameCallback(null);
|
|
779
|
-
* ```
|
|
1816
|
+
* > Starting processing the audio buffer means that the processing unit in the SDK has received the audio data. If the audio track has been published, the remote user can hear the audio.
|
|
1817
|
+
* > Whether the local user can hear the audio depends on whether the SDK calls the [[play]] method and sends the audio data to the sound card.
|
|
780
1818
|
*
|
|
781
|
-
* @param
|
|
782
|
-
* @param frameSize The number of samples of each audio channel that an `AudioBuffer` object contains. You can set `frameSize` as 256, 512, 1024, 2048, 4096, 8192, or 16384. The default value is 4096.
|
|
1819
|
+
* @param options Options for processing the audio buffer. See [[AudioSourceOptions]].
|
|
783
1820
|
*/
|
|
784
|
-
|
|
1821
|
+
startProcessAudioBuffer(options?: AudioSourceOptions): void;
|
|
785
1822
|
/**
|
|
786
|
-
*
|
|
787
|
-
* @param volume 音量值,范围 [0, 100],0 代表静音,100 代表原始音量。
|
|
1823
|
+
* 暂停处理音频数据。
|
|
788
1824
|
*/
|
|
789
1825
|
/** @en
|
|
790
|
-
*
|
|
791
|
-
*
|
|
792
|
-
* @param volume The volume. The value ranges from 0 (mute) to 100 (maximum). A value of 100 is the current volume.
|
|
1826
|
+
* Pauses processing the audio buffer.
|
|
793
1827
|
*/
|
|
794
|
-
|
|
1828
|
+
pauseProcessAudioBuffer(): void;
|
|
795
1829
|
/**
|
|
796
|
-
*
|
|
1830
|
+
* 跳转到指定时间。
|
|
797
1831
|
*
|
|
798
|
-
* @
|
|
1832
|
+
* @param time 指定的音频时间,单位为秒。
|
|
799
1833
|
*/
|
|
800
1834
|
/** @en
|
|
801
|
-
*
|
|
1835
|
+
* Jumps to a specified time point.
|
|
802
1836
|
*
|
|
803
|
-
* @
|
|
804
|
-
* Usually a user with audio level above 0.6 is a speaking user.
|
|
1837
|
+
* @param time The specified time point (seconds).
|
|
805
1838
|
*/
|
|
806
|
-
|
|
1839
|
+
seekAudioBuffer(time: number): void;
|
|
1840
|
+
/**
|
|
1841
|
+
* 恢复被暂停的音频数据处理。
|
|
1842
|
+
*/
|
|
1843
|
+
/** @en
|
|
1844
|
+
* Resumes processing the audio buffer.
|
|
1845
|
+
*/
|
|
1846
|
+
resumeProcessAudioBuffer(): void;
|
|
1847
|
+
/**
|
|
1848
|
+
* 停止处理音频数据。
|
|
1849
|
+
*/
|
|
1850
|
+
/** @en
|
|
1851
|
+
* Stops processing the audio buffer.
|
|
1852
|
+
*/
|
|
1853
|
+
stopProcessAudioBuffer(): void;
|
|
807
1854
|
/**
|
|
808
1855
|
* @自从
|
|
809
|
-
* <br>   *4.
|
|
1856
|
+
* <br>   *4.18.0*
|
|
810
1857
|
*
|
|
811
|
-
*
|
|
1858
|
+
* 设置当前音频文件的播放速度。
|
|
812
1859
|
*
|
|
813
|
-
*
|
|
1860
|
+
* 在加入频道前和加入频道后,你都可以调用该方法。
|
|
814
1861
|
*
|
|
815
|
-
* @
|
|
1862
|
+
* @param speed 播放速度。取值范围为 [50,400],其中:
|
|
1863
|
+
* - `50`: 0.5 倍速。
|
|
1864
|
+
* - `100`: (默认)原始速度。
|
|
1865
|
+
* - `400`: 4 倍速。
|
|
816
1866
|
*/
|
|
817
1867
|
/** @en
|
|
818
1868
|
* @since
|
|
819
|
-
* <br>   *4.
|
|
1869
|
+
* <br>   *4.18.0*
|
|
820
1870
|
*
|
|
821
|
-
*
|
|
1871
|
+
* Sets the playback speed for the current audio file.
|
|
822
1872
|
*
|
|
823
|
-
*
|
|
1873
|
+
* You can call this method before or after joining a channel.
|
|
824
1874
|
*
|
|
825
|
-
* @
|
|
1875
|
+
* @param speed The playback speed. Valid range is [50, 400], where:
|
|
1876
|
+
* - `50`: Half the original speed.
|
|
1877
|
+
* - `100`: (Default) The original speed.
|
|
1878
|
+
* - `400`: Four times the original speed.
|
|
826
1879
|
*/
|
|
827
|
-
|
|
1880
|
+
setAudioBufferPlaybackSpeed(speed: number): void;
|
|
1881
|
+
}
|
|
1882
|
+
|
|
1883
|
+
/**
|
|
1884
|
+
* 本地摄像头视频轨道,继承于 [LocalVideoTrack]{@link ILocalVideoTrack},并在此基础上提供了更换采集设备/调整编码参数的功能。
|
|
1885
|
+
*
|
|
1886
|
+
* 可以通过 [AgoraRTC.createCameraVideoTrack]{@link IAgoraRTC.createCameraVideoTrack} 来获取。
|
|
1887
|
+
*/
|
|
1888
|
+
/** @en
|
|
1889
|
+
*
|
|
1890
|
+
* Inherited from [LocalVideoTrack]{@link ILocalVideoTrack}, `CameraVideoTrack` is an interface for the video captured by a local camera and adds functions such as switching devices and adjusting video encoder configurations.
|
|
1891
|
+
*
|
|
1892
|
+
* You can create a local camera video track by calling [AgoraRTC.createCameraVideoTrack]{@link IAgoraRTC.createCameraVideoTrack}.
|
|
1893
|
+
*/
|
|
1894
|
+
export declare interface ICameraVideoTrack extends ILocalVideoTrack {
|
|
1895
|
+
/**
|
|
1896
|
+
* 设置负责采集视频数据的摄像头设备。
|
|
1897
|
+
*
|
|
1898
|
+
* > 在发布前和发布后均可调用此方法。
|
|
1899
|
+
*
|
|
1900
|
+
* @param deviceId 设备 ID,支持通过以下方式传入:
|
|
1901
|
+
* - 传入字符串:传入通过 [AgoraRTC.getCameras]{@link IAgoraRTC.getCameras} 获取的 `deviceId`。
|
|
1902
|
+
* - 传入对象:自 4.19.0 起,你可以传入一个包含 `facingMode` 或 `deviceId` 的对象,但只能指定其中一个属性的值。其中 `deviceId` 通过 [AgoraRTC.getCameras]{@link IAgoraRTC.getCameras} 获取,`facingMode` 支持设为以下值:
|
|
1903
|
+
* - `"environment"`: 使用后置摄像头。
|
|
1904
|
+
* - `"user"`: 使用前置摄像头。
|
|
1905
|
+
*/
|
|
1906
|
+
/** @en
|
|
1907
|
+
* Sets the device for capturing video.
|
|
1908
|
+
*
|
|
1909
|
+
* > You can call this method either before or after publishing the video track.
|
|
1910
|
+
*
|
|
1911
|
+
* @param deviceId Device ID, which can be passed in using the following ways:
|
|
1912
|
+
* - Pass a string: Pass the `deviceId` obtained using [AgoraRTC.getCameras]{@link IAgoraRTC.getCameras}.
|
|
1913
|
+
* - Pass an object: Starting from version 4.19.0, you can pass an object
|
|
1914
|
+
* containing `facingMode` or `deviceId`, but only one of these properties
|
|
1915
|
+
* can be specified. `deviceId` can be obtained through [AgoraRTC.getCameras]{@link IAgoraRTC.getCameras}, and `facingMode` supports the following values:
|
|
1916
|
+
* - `"environment"`: Use the rear camera.
|
|
1917
|
+
* - `"user"`: Use the front camera.
|
|
1918
|
+
*/
|
|
1919
|
+
setDevice(deviceId: string | RequiredOnlyOneOf<{
|
|
1920
|
+
facingMode: VideoFacingModeEnum;
|
|
1921
|
+
deviceId: string;
|
|
1922
|
+
}>): Promise<void>;
|
|
828
1923
|
/**
|
|
829
1924
|
* @自从
|
|
830
|
-
* <br>   *4.
|
|
1925
|
+
* <br>   *4.0.0*
|
|
831
1926
|
*
|
|
832
|
-
*
|
|
1927
|
+
* 启用/禁用该轨道。
|
|
1928
|
+
*
|
|
1929
|
+
* 轨道禁用后,播放和发布都将被停止。
|
|
1930
|
+
*
|
|
1931
|
+
* > - 禁用轨道不会触发 [LocalTrack.on("track-ended")]{@link event_track_ended} 事件。
|
|
1932
|
+
* > - 如果该轨道已发布,禁用轨道后,远端会触发 [user-unpublished]{@link IAgoraRTCClient.event_user_unpublished} 事件。重新启用后,远端会触发 [user-published]{@link IAgoraRTCClient.event_user_published} 事件。
|
|
1933
|
+
* > - `setEnabled` 和 `setMuted` 不能同时调用。
|
|
1934
|
+
*
|
|
1935
|
+
* @param enabled 是否启用该轨道:
|
|
1936
|
+
* - `true`: 启用该轨道.
|
|
1937
|
+
* - `false`: 禁用该轨道.
|
|
833
1938
|
*/
|
|
834
1939
|
/** @en
|
|
835
1940
|
* @since
|
|
836
|
-
* <br>   *4.
|
|
1941
|
+
* <br>   *4.0.0*
|
|
837
1942
|
*
|
|
838
|
-
*
|
|
1943
|
+
* Enables/Disables the track.
|
|
1944
|
+
*
|
|
1945
|
+
* After a track is disabled, the SDK stops playing and publishing the track.
|
|
1946
|
+
*
|
|
1947
|
+
* > - Disabling a track does not trigger the [LocalTrack.on("track-ended")]{@link event_track_ended} event.
|
|
1948
|
+
* > - If a track is published, disabling this track triggers the [user-unpublished]{@link IAgoraRTCClient.event_user_unpublished} event on the remote client, and re-enabling this track triggers the [user-published]{@link IAgoraRTCClient.event_user_published} event.
|
|
1949
|
+
* > - Do not call `setEnabled` and `setMuted` together.
|
|
1950
|
+
*
|
|
1951
|
+
* @param enabled Whether to enable the track:
|
|
1952
|
+
* - `true`: Enable the track.
|
|
1953
|
+
* - `false`: Disable the track.
|
|
839
1954
|
*/
|
|
840
|
-
|
|
1955
|
+
setEnabled(enabled: boolean): Promise<void>;
|
|
841
1956
|
/**
|
|
842
1957
|
* @自从
|
|
843
|
-
* <br>   *4.
|
|
1958
|
+
* <br>   *4.19.0*
|
|
844
1959
|
*
|
|
845
|
-
*
|
|
1960
|
+
* 复制当前的视频轨道对象,生成一个新的视频轨道。
|
|
1961
|
+
*
|
|
1962
|
+
* 在视频会议、在线教育等场景中,你可以用该方法实现同一视频流的两路显示,并为每路显示设置不同的分辨率、帧率、码率等参数。
|
|
1963
|
+
*
|
|
1964
|
+
* @param config 新生成视频轨道的编码配置。你可以通过 [[VideoEncoderConfiguration]] 传入 SDK 内置的编码配置;也可以通过传入一个 [[VideoEncoderConfigurationPreset]] 来自定义视频编码配置。
|
|
1965
|
+
* @param cloneTrack 是否克隆当前轨道。默认为 `true`。
|
|
1966
|
+
* @returns 新生成的视频轨道。
|
|
846
1967
|
*/
|
|
847
1968
|
/** @en
|
|
848
1969
|
* @since
|
|
849
|
-
* <br>   *4.
|
|
1970
|
+
* <br>   *4.19.0*
|
|
850
1971
|
*
|
|
851
|
-
*
|
|
1972
|
+
* Clones the current video track to create a new video track.
|
|
1973
|
+
*
|
|
1974
|
+
* In scenarios such as video conferencing and online education, you can use this method to display the same video stream with two sets of display parameters, including resolution, frame rate, and bitrate. For example, you can have one display set to high-definition and the other to low-definition.
|
|
1975
|
+
*
|
|
1976
|
+
* @param config The encoding configuration for the new video track. You can pass in the SDK's built-in encoding configuration through [[VideoEncoderConfiguration]], or customize the video encoding configuration by passing in a [[VideoEncoderConfigurationPreset]].
|
|
1977
|
+
* @param cloneTrack Whether to clone the current track. Default is `true`.
|
|
1978
|
+
* @returns The newly generated video track.
|
|
852
1979
|
*/
|
|
853
|
-
|
|
1980
|
+
clone(config?: VideoEncoderConfiguration | VideoEncoderConfigurationPreset, cloneTrack?: boolean): ICameraVideoTrack;
|
|
1981
|
+
}
|
|
1982
|
+
|
|
1983
|
+
/** @ignore */
|
|
1984
|
+
/** @en
|
|
1985
|
+
* @ignore
|
|
1986
|
+
*/
|
|
1987
|
+
export declare interface IDataChannel extends EventEmitter {
|
|
1988
|
+
readonly id: number;
|
|
1989
|
+
readonly maxRetransmits: number | null;
|
|
1990
|
+
readonly ordered: boolean;
|
|
1991
|
+
readonly readyState: RTCDataChannelState;
|
|
1992
|
+
readonly metadata: string;
|
|
1993
|
+
getChannelId(): number;
|
|
1994
|
+
getConfig(): IDataChannelConfig;
|
|
1995
|
+
}
|
|
1996
|
+
|
|
1997
|
+
/** @ignore */
|
|
1998
|
+
/** @en
|
|
1999
|
+
* @ignore
|
|
2000
|
+
*/
|
|
2001
|
+
export declare interface IDataChannelConfig {
|
|
2002
|
+
id: number;
|
|
2003
|
+
/**
|
|
2004
|
+
* 表示通过 RTCDataChannel 的信息的到达顺序需要和发送顺序一致 (true), 或者到达顺序不需要和发送顺序一致 (false). 默认:true.
|
|
2005
|
+
*/
|
|
2006
|
+
ordered: boolean;
|
|
2007
|
+
/**
|
|
2008
|
+
* 0~512
|
|
2009
|
+
*/
|
|
2010
|
+
metadata: string;
|
|
854
2011
|
}
|
|
855
2012
|
|
|
856
2013
|
/**
|
|
857
|
-
*
|
|
2014
|
+
* 基础本地音频轨道,提供了本地音频轨道的主要功能。
|
|
2015
|
+
*
|
|
2016
|
+
* 可以通过 [AgoraRTC.createCustomAudioTrack]{@link IAgoraRTC.createCustomAudioTrack} 来获取。
|
|
2017
|
+
*
|
|
2018
|
+
* - 通过麦克风采集到的本地音频轨道对象 [MicrophoneAudioTrack]{@link IMicrophoneAudioTrack} 继承于此接口,并在本接口的基础上提供了一些麦克风独有的功能。
|
|
2019
|
+
* - 通过音频文件获取到的本地音频轨道对象 [BufferSourceAudioTrack]{@link IBufferSourceAudioTrack} 继承于此接口,并在本接口的基础上提供了一些音频文件独有的功能。
|
|
858
2020
|
*/
|
|
859
2021
|
/** @en
|
|
860
|
-
* `
|
|
2022
|
+
* `LocalAudioTrack` is the basic interface for local audio tracks, providing main methods of local audio tracks.
|
|
2023
|
+
*
|
|
2024
|
+
* You can create a local audio track by calling [AgoraRTC.createCustomAudioTrack]{@link IAgoraRTC.createCustomAudioTrack}.
|
|
2025
|
+
*
|
|
2026
|
+
* The following interfaces are inherited from `LocalAudioTrack`:
|
|
2027
|
+
* - [MicrophoneAudioTrack]{@link IMicrophoneAudioTrack}, the interface for the audio sampled by a local microphone, which adds several microphone-related functions.
|
|
2028
|
+
* - [BufferSourceAudioTrack]{@link IBufferSourceAudioTrack}, the interface for the audio from a local audio file, which adds several audio-file-related functions.
|
|
861
2029
|
*/
|
|
862
|
-
export declare interface
|
|
2030
|
+
export declare interface ILocalAudioTrack extends ILocalTrack {
|
|
863
2031
|
/**
|
|
864
|
-
*
|
|
865
|
-
* @param
|
|
2032
|
+
* 设置本地音频轨道的音量。
|
|
2033
|
+
* @param volume 音量值,范围 [0, 1000], 0 代表静音,100 代表原始音量。100 以上会使用 WebAudio 进行音量增益。如果本地音频轨道已经发布,修改音量会影响远端听到的音量大小。
|
|
866
2034
|
*/
|
|
867
2035
|
/** @en
|
|
868
|
-
*
|
|
869
|
-
*
|
|
2036
|
+
* Sets the volume of a local audio track.
|
|
2037
|
+
*
|
|
2038
|
+
* @param volume The volume. The value ranges from 0 (mute) to 1000 (maximum). A value of 100 is the original volume。 The volume change may not be obvious to human ear. If local track has been published, setting volume will affect the volume heard by remote users.
|
|
870
2039
|
*/
|
|
871
|
-
|
|
2040
|
+
setVolume(volume: number): void;
|
|
872
2041
|
/**
|
|
873
|
-
*
|
|
874
|
-
*
|
|
875
|
-
* @
|
|
2042
|
+
* 获取本地音频轨道的音量等级。
|
|
2043
|
+
*
|
|
2044
|
+
* @returns 音量等级值,范围 [0, 1],1 代表理论最大音量。通常该值大于 0.6 代表用户在持续说话。
|
|
876
2045
|
*/
|
|
877
2046
|
/** @en
|
|
878
|
-
*
|
|
879
|
-
*
|
|
880
|
-
* @
|
|
2047
|
+
* Gets the audio level of a local audio track.
|
|
2048
|
+
*
|
|
2049
|
+
* @returns The audio level. The value range is [0,1]. 1 is the highest audio level.
|
|
2050
|
+
* Usually a user with audio level above 0.6 is a speaking user.
|
|
2051
|
+
*
|
|
881
2052
|
*/
|
|
882
|
-
|
|
2053
|
+
getVolumeLevel(): number;
|
|
883
2054
|
/**
|
|
884
|
-
*
|
|
2055
|
+
* 设置原始音频数据(PCM)回调。
|
|
885
2056
|
*
|
|
886
|
-
*
|
|
2057
|
+
* 设置成功后,SDK 会不断地将本地音频轨道的音频帧以 [AudioBuffer](https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer) 的形式通过回调返回。
|
|
2058
|
+
*
|
|
2059
|
+
* > 你可以通过 `frameSize` 来设置每次回调中音频帧的大小。该设置也会影响回调的间隔,`frameSize` 越大,每次回调的音频数据越多,回调间隔越长。
|
|
2060
|
+
*
|
|
2061
|
+
* ```js
|
|
2062
|
+
* track.setAudioFrameCallback((buffer) => {
|
|
2063
|
+
* for (let channel = 0; channel < buffer.numberOfChannels; channel += 1) {
|
|
2064
|
+
* // Float32Array with PCM data
|
|
2065
|
+
* const currentChannelData = buffer.getChannelData(channel);
|
|
2066
|
+
* console.log("PCM data in channel", channel, currentChannelData);
|
|
2067
|
+
* }
|
|
2068
|
+
* }, 2048);
|
|
2069
|
+
*
|
|
2070
|
+
* // ....
|
|
2071
|
+
* // Stop getting the raw audio data
|
|
2072
|
+
* track.setAudioFrameCallback(null);
|
|
2073
|
+
* ```
|
|
2074
|
+
*
|
|
2075
|
+
* @param audioFrameCallback 用于接收 [AudioBuffer](https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer) 的回调函数。设为 `null` 后,SDK 就会停止获取音频原始数据。
|
|
2076
|
+
* @param frameSize 每次回调的 `AudioBuffer` 中每个声道包含的采样数据个数,只能设为下列值:256, 512, 1024, 2048, 4096, 8192, 16384。默认为 4096。
|
|
887
2077
|
*/
|
|
888
2078
|
/** @en
|
|
889
|
-
*
|
|
2079
|
+
* Sets the callback for getting raw audio data in PCM format.
|
|
890
2080
|
*
|
|
891
|
-
*
|
|
2081
|
+
* After you successfully set the callback, the SDK constantly returns the audio frames of a local audio track in this callback by using [AudioBuffer](https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer).
|
|
2082
|
+
*
|
|
2083
|
+
* > You can set the `frameSize` parameter to determine the frame size in each callback, which affects the interval between the callbacks. The larger the frame size, the longer the interval between them.
|
|
2084
|
+
*
|
|
2085
|
+
* ```js
|
|
2086
|
+
* track.setAudioFrameCallback((buffer) => {
|
|
2087
|
+
* for (let channel = 0; channel < buffer.numberOfChannels; channel += 1) {
|
|
2088
|
+
* // Float32Array with PCM data
|
|
2089
|
+
* const currentChannelData = buffer.getChannelData(channel);
|
|
2090
|
+
* console.log("PCM data in channel", channel, currentChannelData);
|
|
2091
|
+
* }
|
|
2092
|
+
* }, 2048);
|
|
2093
|
+
*
|
|
2094
|
+
* // ....
|
|
2095
|
+
* // Stop getting the raw audio data
|
|
2096
|
+
* track.setAudioFrameCallback(null);
|
|
2097
|
+
* ```
|
|
2098
|
+
*
|
|
2099
|
+
* @param audioFrameCallback The callback function for receiving the [AudioBuffer](https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer) object. If you set `audioBufferCallback` as `null`, the SDK stops getting raw audio data.
|
|
2100
|
+
* @param frameSize The number of samples of each audio channel that an `AudioBuffer` object contains. You can set `frameSize` as 256, 512, 1024, 2048, 4096, 8192, or 16384. The default value is 4096.
|
|
892
2101
|
*/
|
|
893
|
-
|
|
2102
|
+
setAudioFrameCallback(audioFrameCallback: null | ((buffer: AudioBuffer) => void), frameSize?: number): void;
|
|
894
2103
|
/**
|
|
895
|
-
*
|
|
2104
|
+
* 播放本地音频轨道。
|
|
2105
|
+
*
|
|
2106
|
+
* > 播放音频时 SDK 不会创建任何 DOM 元素,所以无需像视频一样提供 DOM 元素。
|
|
2107
|
+
*/
|
|
2108
|
+
/** @en
|
|
2109
|
+
* Plays a local audio track.
|
|
2110
|
+
*
|
|
2111
|
+
* > When playing a audio track, you do not need to pass any DOM element.
|
|
2112
|
+
*/
|
|
2113
|
+
play(): void;
|
|
2114
|
+
/**
|
|
2115
|
+
* @自从
|
|
2116
|
+
* <br>   *4.1.0*
|
|
2117
|
+
*
|
|
2118
|
+
* > 注意事项:
|
|
2119
|
+
* > - 自 v4.7.0 起,该方法不再生效。请改用 [IRemoteAudioTrack.setPlaybackDevice]{@link IRemoteAudioTrack.setPlaybackDevice}。
|
|
2120
|
+
*
|
|
2121
|
+
* 设置本地播放远端音频流的设备(扬声器)。
|
|
2122
|
+
*
|
|
2123
|
+
* @param deviceId 设备 ID,可以通过 [[getPlaybackDevices]] 方法获取。
|
|
2124
|
+
*/
|
|
2125
|
+
/** @en
|
|
2126
|
+
* @since
|
|
2127
|
+
* <br>   *4.1.0*
|
|
2128
|
+
*
|
|
2129
|
+
* > Note:
|
|
2130
|
+
* > - As of v4.7.0, this method no longer takes effect. Use [IRemoteAudioTrack.setPlaybackDevice]{@link IRemoteAudioTrack.setPlaybackDevice} instead.
|
|
2131
|
+
*
|
|
2132
|
+
* Sets the playback device (speaker) for the remote audio stream.
|
|
2133
|
+
*
|
|
2134
|
+
* @param deviceId The device ID, which can be retrieved by calling [[getPlaybackDevices]].
|
|
2135
|
+
*/
|
|
2136
|
+
setPlaybackDevice(deviceId: string): Promise<void>;
|
|
2137
|
+
/**
|
|
2138
|
+
* 获取本地音频轨道的质量相关信息。
|
|
896
2139
|
*
|
|
897
2140
|
* @deprecated
|
|
2141
|
+
* 自 v4.1.0 起废弃,请使用 [AgoraRTCClient.getLocalVideoStats]{@link IAgoraRTCClient.getLocalVideoStats} 和 [AgoraRTCClient.getLocalAudioStats]{@link IAgoraRTCClient.getLocalAudioStats}。
|
|
2142
|
+
*/
|
|
2143
|
+
/** @en
|
|
2144
|
+
* Gets the statistics of a local audio track.
|
|
898
2145
|
*
|
|
899
|
-
*
|
|
900
|
-
|
|
2146
|
+
* @deprecated from v4.1.0. Use [AgoraRTCClient.getLocalVideoStats]{@link IAgoraRTCClient.getLocalVideoStats} and [AgoraRTCClient.getLocalAudioStats]{@link IAgoraRTCClient.getLocalAudioStats} instead.
|
|
2147
|
+
*/
|
|
2148
|
+
getStats(): LocalAudioTrackStats;
|
|
2149
|
+
/**
|
|
2150
|
+
* @自从
|
|
2151
|
+
* <br>   *4.10.0*
|
|
2152
|
+
*
|
|
2153
|
+
* 将 `Processor` 注入本地音频轨道。
|
|
2154
|
+
* @param processor `Processor` 实例。每个插件均有对应类型的 `Processor`。
|
|
2155
|
+
*
|
|
2156
|
+
* @returns `Processor` 实例。
|
|
901
2157
|
*/
|
|
902
2158
|
/** @en
|
|
903
|
-
*
|
|
2159
|
+
* Inserts a `Processor` to the local audio track.
|
|
904
2160
|
*
|
|
905
|
-
* @
|
|
906
|
-
*
|
|
2161
|
+
* @param processor The `Processor` instance. Each extension has a corresponding type of `Processor`.
|
|
2162
|
+
*
|
|
2163
|
+
* @returns The `Processor` instance.
|
|
907
2164
|
*/
|
|
908
|
-
|
|
2165
|
+
pipe(processor: IAudioProcessor): IAudioProcessor;
|
|
2166
|
+
/**
|
|
2167
|
+
* @自从
|
|
2168
|
+
* <br>   *4.10.0*
|
|
2169
|
+
*
|
|
2170
|
+
* 取消本地音频轨道上注入的 `Processor`。
|
|
2171
|
+
*/
|
|
2172
|
+
/** @en
|
|
2173
|
+
* @since
|
|
2174
|
+
* <br>   *4.10.0*
|
|
2175
|
+
*
|
|
2176
|
+
* Removes the `Processor` inserted to the local audio track.
|
|
2177
|
+
*/
|
|
2178
|
+
unpipe(): void;
|
|
2179
|
+
/**
|
|
2180
|
+
* @自从
|
|
2181
|
+
* <br>   *4.10.0*
|
|
2182
|
+
*
|
|
2183
|
+
* 本地音频轨道上当前媒体处理链路的最终节点。
|
|
2184
|
+
*/
|
|
2185
|
+
/** @en
|
|
2186
|
+
* @since
|
|
2187
|
+
* <br>   *4.10.0*
|
|
2188
|
+
*
|
|
2189
|
+
* The destination of the current processing pipeline on the local audio track.
|
|
2190
|
+
*/
|
|
2191
|
+
processorDestination: IAudioProcessor;
|
|
2192
|
+
}
|
|
2193
|
+
|
|
2194
|
+
/** @ignore */
|
|
2195
|
+
/** @en
|
|
2196
|
+
* @ignore
|
|
2197
|
+
*/
|
|
2198
|
+
export declare interface ILocalDataChannel extends IDataChannel {
|
|
2199
|
+
send(data: ArrayBuffer): void;
|
|
2200
|
+
/** @internal */
|
|
2201
|
+
on(event: "open", listener: typeof event_user_datachannel_open): void;
|
|
2202
|
+
/** @internal */
|
|
2203
|
+
on(event: "close", listener: typeof event_user_datachannel_close): void;
|
|
2204
|
+
/** @internal */
|
|
2205
|
+
on(event: "error", listener: typeof event_user_datachannel_error): void;
|
|
909
2206
|
}
|
|
910
2207
|
|
|
911
2208
|
/**
|
|
912
|
-
*
|
|
2209
|
+
* `LocalTrack` 为本地轨道的基础类,为音频轨道 [LocalAudioTrack]{@link ILocalAudioTrack} 和视频轨道 [LocalVideoTrack]{@link ILocalVideoTrack} 提供一些公共的方法。
|
|
913
2210
|
*
|
|
914
|
-
* 调用 [subscribe]{@link IAgoraRTCClient.subscribe} 后通过 [AgoraRTCRemoteUser.videoTrack]{@link IAgoraRTCRemoteUser.videoTrack} 对象获取。
|
|
915
2211
|
*/
|
|
916
2212
|
/** @en
|
|
917
|
-
* `
|
|
918
|
-
*
|
|
919
|
-
* You can get create a remote video track by the [AgoraRTCRemoteUser.videoTrack]{@link IAgoraRTCRemoteUser.videoTrack} object after calling [subscribe]{@link IAgoraRTCClient.subscribe}.
|
|
2213
|
+
* `LocalTrack` is the basic interface for local tracks, providing public methods for [LocalAudioTrack]{@link ILocalAudioTrack} and [LocalVideoTrack]{@link ILocalVideoTrack}.
|
|
920
2214
|
*/
|
|
921
|
-
export declare interface
|
|
922
|
-
/**
|
|
923
|
-
* @param event 事件名称。
|
|
924
|
-
* @param listener 详见 [video-state-changed]{@link event_video_state_changed}。
|
|
925
|
-
*/
|
|
926
|
-
/** @en
|
|
927
|
-
* @param event The event name.
|
|
928
|
-
* @param listener See [video-state-changed]{@link event_video_state_changed}.
|
|
929
|
-
*/
|
|
930
|
-
on(event: "video-state-changed", listener: typeof event_video_state_changed): void;
|
|
2215
|
+
export declare interface ILocalTrack extends ITrack {
|
|
931
2216
|
/**
|
|
932
2217
|
* @param event 事件名称。
|
|
933
|
-
* @param listener 详见 [
|
|
2218
|
+
* @param listener 详见 [track-updated]{@link event_track_updated}。
|
|
934
2219
|
*/
|
|
935
2220
|
/** @en
|
|
936
2221
|
* @param event The event name.
|
|
937
|
-
* @param listener See [
|
|
2222
|
+
* @param listener See [track-updated]{@link event_track_updated}.
|
|
938
2223
|
*/
|
|
939
|
-
on(event: "
|
|
2224
|
+
on(event: "track-updated", listener: typeof event_track_updated): void;
|
|
940
2225
|
/**
|
|
941
2226
|
* @param event 事件名称。
|
|
942
|
-
* @param listener 详见 [
|
|
2227
|
+
* @param listener 详见 [track-ended]{@link event_track_ended}。
|
|
943
2228
|
*/
|
|
944
2229
|
/** @en
|
|
945
2230
|
* @param event The event name.
|
|
946
|
-
* @param listener See [
|
|
2231
|
+
* @param listener See [track-ended]{@link event_track_ended}.
|
|
947
2232
|
*/
|
|
948
|
-
on(event: "
|
|
2233
|
+
on(event: "track-ended", listener: typeof event_track_ended): void;
|
|
949
2234
|
/**
|
|
950
2235
|
* 添加事件监听器。
|
|
951
2236
|
* @param event 事件名称。
|
|
952
|
-
* @param listener 详见 [
|
|
2237
|
+
* @param listener 详见 [ILocalTrack.transceiver-updated]{@link event_transceiver_updated}。
|
|
953
2238
|
*/
|
|
954
2239
|
/** @en
|
|
955
2240
|
* Adds an event listener.
|
|
956
2241
|
* @param event The event name.
|
|
957
|
-
* @param listener See [
|
|
2242
|
+
* @param listener See [ILocalTrack.transceiver-updated]{@link event_transceiver_updated}.
|
|
958
2243
|
*/
|
|
959
2244
|
on(event: "transceiver-updated", listener: typeof event_transceiver_updated): void;
|
|
960
2245
|
/**
|
|
961
|
-
*
|
|
962
|
-
*
|
|
963
|
-
*
|
|
2246
|
+
* @自从
|
|
2247
|
+
* <br>   *4.0.0*
|
|
2248
|
+
*
|
|
2249
|
+
* 启用/禁用该轨道。
|
|
2250
|
+
*
|
|
2251
|
+
* 轨道禁用后,播放和发布都将被停止。
|
|
2252
|
+
*
|
|
2253
|
+
* > - 禁用轨道不会触发 [LocalTrack.on("track-ended")]{@link event_track_ended} 事件。
|
|
2254
|
+
* > - 如果该轨道已发布,禁用轨道后,远端会触发 [user-unpublished]{@link IAgoraRTCClient.event_user_unpublished} 事件。重新启用后,远端会触发 [user-published]{@link IAgoraRTCClient.event_user_published} 事件。
|
|
2255
|
+
* > - `setEnabled` 和 `setMuted` 不能同时调用。
|
|
2256
|
+
*
|
|
2257
|
+
* @param enabled 是否启用该轨道:
|
|
2258
|
+
* - `true`: 启用该轨道。
|
|
2259
|
+
* - `false`: 禁用该轨道。
|
|
964
2260
|
*/
|
|
965
2261
|
/** @en
|
|
966
|
-
*
|
|
967
|
-
*
|
|
968
|
-
*
|
|
2262
|
+
* @since
|
|
2263
|
+
* <br>   *4.0.0*
|
|
2264
|
+
*
|
|
2265
|
+
* Enables/Disables the track.
|
|
2266
|
+
*
|
|
2267
|
+
* After a track is disabled, the SDK stops playing and publishing the track.
|
|
2268
|
+
*
|
|
2269
|
+
* > - Disabling a track does not trigger the [LocalTrack.on("track-ended")]{@link event_track_ended} event.
|
|
2270
|
+
* > - If a track is published, disabling this track triggers the [user-unpublished]{@link IAgoraRTCClient.event_user_unpublished} event on the remote client, and re-enabling this track triggers the [user-published]{@link IAgoraRTCClient.event_user_published} event.
|
|
2271
|
+
* > - Do not call `setEnabled` and `setMuted` together.
|
|
2272
|
+
*
|
|
2273
|
+
* @param enabled Whether to enable the track:
|
|
2274
|
+
* - `true`: Enable the track.
|
|
2275
|
+
* - `false`: Disable the track.
|
|
969
2276
|
*/
|
|
970
|
-
|
|
2277
|
+
setEnabled(enabled: boolean): Promise<void>;
|
|
971
2278
|
/**
|
|
972
|
-
*
|
|
2279
|
+
* @deprecated
|
|
2280
|
+
* 自 v4.1.0 起废弃,请使用 [AgoraRTCClient.getLocalVideoStats]{@link IAgoraRTCClient.getLocalVideoStats} 和 [AgoraRTCClient.getLocalAudioStats]{@link IAgoraRTCClient.getLocalAudioStats}。
|
|
973
2281
|
*
|
|
974
|
-
*
|
|
2282
|
+
* 获取本地轨道相关信息。
|
|
975
2283
|
*
|
|
976
|
-
*
|
|
2284
|
+
* > 注意事项:获取本地视频轨道数据时,iOS 上无法获取到 `encodeDelay` 字段。
|
|
977
2285
|
*/
|
|
978
2286
|
/** @en
|
|
979
|
-
*
|
|
2287
|
+
* @deprecated from v4.1.0. Use [AgoraRTCClient.getLocalVideoStats]{@link IAgoraRTCClient.getLocalVideoStats} and [AgoraRTCClient.getLocalAudioStats]{@link IAgoraRTCClient.getLocalAudioStats} instead.
|
|
980
2288
|
*
|
|
981
|
-
*
|
|
2289
|
+
* Gets the statistics of a local track.
|
|
2290
|
+
*
|
|
2291
|
+
* > Note: When getting the statistics of a local video track, you cannot get the `encodeDelay` property on iOS.
|
|
982
2292
|
*/
|
|
983
|
-
getStats():
|
|
2293
|
+
getStats(): LocalVideoTrackStats | LocalAudioTrackStats;
|
|
984
2294
|
/**
|
|
985
|
-
*
|
|
986
|
-
*
|
|
987
|
-
*
|
|
988
|
-
* - `
|
|
989
|
-
*
|
|
2295
|
+
* 获取本地轨道的来源描述。
|
|
2296
|
+
*
|
|
2297
|
+
* @return 可能返回以下值:
|
|
2298
|
+
* - 如果是通过 `createMicrophoneAudioTrack` 或 `createCameraVideoTrack` 创建的轨道,返回 [MediaDeviceInfo.label](https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo/label) 字段。
|
|
2299
|
+
* - 如果是通过 `createScreenVideoTrack` 创建的轨道,返回屏幕共享的 `sourceId`。
|
|
2300
|
+
* - 如果是 `createCustomAudioTrack` 或 `createCustomVideoTrack` 创建的轨道,返回 [MediaStreamTrack.label](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack/label) 字段。
|
|
990
2301
|
*/
|
|
991
2302
|
/** @en
|
|
992
|
-
*
|
|
2303
|
+
* Gets the label of a local track.
|
|
993
2304
|
*
|
|
994
|
-
* @
|
|
995
|
-
* -
|
|
996
|
-
* - `
|
|
2305
|
+
* @return The label that the SDK returns may include:
|
|
2306
|
+
* - The [MediaDeviceInfo.label](https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo/label) property, if the track is created by calling `createMicrophoneAudioTrack` or `createCameraVideoTrack`.
|
|
2307
|
+
* - The `sourceId` property, if the track is created by calling `createScreenVideoTrack`.
|
|
2308
|
+
* - The [MediaStreamTrack.label](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack/label) property, if the track is created by calling `createCustomAudioTrack` or `createCustomVideoTrack`.
|
|
2309
|
+
*/
|
|
2310
|
+
getTrackLabel(): string;
|
|
2311
|
+
/**
|
|
2312
|
+
* 发送或暂停发送该轨道的媒体数据。
|
|
2313
|
+
*
|
|
2314
|
+
* @自从
|
|
2315
|
+
* <br>   *4.6.0*
|
|
2316
|
+
*
|
|
2317
|
+
* 如果该轨道已发布,调用 `setMuted(true)` 后,远端会触发 [user-unpublished]{@link IAgoraRTCClient.event_user_unpublished} 事件。再调用 `setMuted(false)` 后,远端会触发 [user-published]{@link IAgoraRTCClient.event_user_published} 事件。
|
|
2318
|
+
*
|
|
2319
|
+
* > - 与 {@link setEnabled} 相比,调用该方法响应速度更快且不影响视频采集状态,详见 [setEnabled 和 setMuted 有什么区别?](http://doc.shengwang.cn/faq/integration-issues/diff-setenabled-setmuted)。
|
|
2320
|
+
* > - `setEnabled` 和 `setMuted` 不能同时调用。
|
|
2321
|
+
*
|
|
2322
|
+
* @param muted 是否发送该轨道的媒体数据:
|
|
2323
|
+
* - `true`: 暂停发送该轨道的媒体数据。
|
|
2324
|
+
* - `false`: 恢复发送该轨道的媒体数据。
|
|
2325
|
+
*/
|
|
2326
|
+
/** @en
|
|
2327
|
+
* Sends or stops sending the media data of the track.
|
|
2328
|
+
*
|
|
2329
|
+
* @since
|
|
2330
|
+
* <br>   *4.6.0*
|
|
2331
|
+
*
|
|
2332
|
+
* If the track is published, a successful call of `setMuted(true)` triggers the [user-unpublished]{@link IAgoraRTCClient.event_user_unpublished} event on the remote client, and a successful call of `setMuted(false)` triggers the [user-published]{@link IAgoraRTCClient.event_user_published} event.
|
|
2333
|
+
*
|
|
2334
|
+
* > - Calling `setMuted(true)` does not stop capturing audio or video and takes shorter time to take effect than [[setEnabled]]. For details, see [What are the differences between setEnabled and setMuted?](https://docs.agora.io/en/interactive-live-streaming/develop/product-workflow?platform=web#setenabled-and-setmuted).
|
|
2335
|
+
* > - Do not call `setEnabled` and `setMuted` together.
|
|
2336
|
+
*
|
|
2337
|
+
* @param muted Whether to stop sending the media data of the track:
|
|
2338
|
+
* - `true`: Stop sending the media data of the track.
|
|
2339
|
+
* - `false`: Resume sending the media data of the track.
|
|
2340
|
+
*/
|
|
2341
|
+
setMuted(muted: boolean): Promise<void>;
|
|
2342
|
+
/**
|
|
2343
|
+
* 关闭本地轨道,并释放相关采集设备。
|
|
2344
|
+
*
|
|
2345
|
+
* 一旦本地轨道被关闭,就无法再次使用。如需再次使用本地轨道,需要重新创建。
|
|
2346
|
+
*/
|
|
2347
|
+
/** @en
|
|
2348
|
+
* Closes a local track and releases the audio and video resources that it occupies.
|
|
2349
|
+
*
|
|
2350
|
+
* Once you close a local track, you can no longer reuse it.
|
|
2351
|
+
*/
|
|
2352
|
+
close(): void;
|
|
2353
|
+
/**
|
|
2354
|
+
* 本地媒体轨道当前的静音状态。
|
|
2355
|
+
*/
|
|
2356
|
+
muted: boolean;
|
|
2357
|
+
/**
|
|
2358
|
+
* 本地轨道当前的启用状态。
|
|
2359
|
+
*/
|
|
2360
|
+
enabled: boolean;
|
|
2361
|
+
}
|
|
2362
|
+
|
|
2363
|
+
/**
|
|
2364
|
+
* `LocalVideoTrack` 为本地视频轨道的基础类,提供了本地视频轨道的主要功能。
|
|
2365
|
+
*
|
|
2366
|
+
* 你可以通过 [AgoraRTC.createCustomVideoTrack]{@link IAgoraRTC.createCustomVideoTrack} 或者 [AgoraRTC.createScreenVideoTrack]{@link IAgoraRTC.createScreenVideoTrack} 来获取 `LocalVideoTrack`。
|
|
2367
|
+
*
|
|
2368
|
+
* 通过摄像头采集到的本地视频轨道对象 [CameraVideoTrack]{@link ICameraVideoTrack} 继承于此接口,并在本接口的基础上提供了一些摄像头独有的功能。
|
|
2369
|
+
*/
|
|
2370
|
+
/** @en
|
|
2371
|
+
* `LocalVideoTrack` is the basic interface for local video tracks, providing the main methods for local video tracks.
|
|
2372
|
+
*
|
|
2373
|
+
* You can get create a local video track by calling [AgoraRTC.createCustomVideoTrack]{@link IAgoraRTC.createCustomVideoTrack} or [AgoraRTC.createScreenVideoTrack]{@link IAgoraRTC.createScreenVideoTrack} method.
|
|
2374
|
+
*
|
|
2375
|
+
* Inherited from `LocalVideoTrack`, [CameraVideoTrack]{@link ICameraVideoTrack} is an interface for the video captured by a local camera and adds several camera-related functions.
|
|
2376
|
+
*/
|
|
2377
|
+
export declare interface ILocalVideoTrack extends ILocalTrack {
|
|
2378
|
+
/**
|
|
2379
|
+
* @param event 事件名称。
|
|
2380
|
+
* @param listener 详见 [track-updated]{@link event_track_updated}。
|
|
2381
|
+
*/
|
|
2382
|
+
/** @en
|
|
2383
|
+
* @param event The event name.
|
|
2384
|
+
* @param listener See [track-updated]{@link event_track_updated}.
|
|
2385
|
+
*/
|
|
2386
|
+
on(event: "track-updated", listener: typeof event_track_updated): void;
|
|
2387
|
+
/** @internal */
|
|
2388
|
+
on(event: "beauty-effect-overload", listener: typeof event_beauty_effect_overload): void;
|
|
2389
|
+
/**
|
|
2390
|
+
* @param event 事件名称。
|
|
2391
|
+
* @param listener 详见 [track-ended]{@link event_track_ended}。
|
|
2392
|
+
*/
|
|
2393
|
+
/** @en
|
|
2394
|
+
* @param event The event name.
|
|
2395
|
+
* @param listener See [track-ended]{@link event_track_ended}.
|
|
2396
|
+
*/
|
|
2397
|
+
on(event: "track-ended", listener: typeof event_track_ended): void;
|
|
2398
|
+
/**
|
|
2399
|
+
* @param event 事件名称。
|
|
2400
|
+
* @param listener 详见 [video-element-visible-status]{@link event_video_element_visible_status}。
|
|
2401
|
+
*/
|
|
2402
|
+
/** @en
|
|
2403
|
+
* @param event The event name.
|
|
2404
|
+
* @param listener See [video-element-visible-status]{@link event_video_element_visible_status}.
|
|
2405
|
+
*/
|
|
2406
|
+
on(event: "video-element-visible-status", listener: typeof event_video_element_visible_status): void;
|
|
2407
|
+
/**
|
|
2408
|
+
* 添加事件监听器。
|
|
2409
|
+
* @param event 事件名称。
|
|
2410
|
+
* @param listener 详见 [ILocalTrack.transceiver-updated]{@link event_transceiver_updated}。
|
|
2411
|
+
*/
|
|
2412
|
+
/** @en
|
|
2413
|
+
* Adds an event listener.
|
|
2414
|
+
* @param event The event name.
|
|
2415
|
+
* @param listener See [ILocalTrack.transceiver-updated]{@link event_transceiver_updated}.
|
|
2416
|
+
*/
|
|
2417
|
+
on(event: "transceiver-updated", listener: typeof event_transceiver_updated): void;
|
|
2418
|
+
/**
|
|
2419
|
+
* 在页面上播放远端视频轨道。
|
|
2420
|
+
*
|
|
2421
|
+
* @param element 指定一个 DOM 元素,SDK 将在这个元素下创建 `<video>` 元素播放视频轨道,支持 2 种类型:
|
|
2422
|
+
* - `string`: 指定该 DOM 元素的 ID 值。
|
|
2423
|
+
* - `HTMLElement`: 直接传入一个 DOM 元素对象。
|
|
2424
|
+
* @param config 设置播放参数(镜像/显示模式)。详见 [[VideoPlayerConfig]]。对于本地视频轨道,镜像模式默认开启。
|
|
2425
|
+
*/
|
|
2426
|
+
/** @en
|
|
2427
|
+
* Plays a remote video track on the web page.
|
|
2428
|
+
*
|
|
2429
|
+
* @param element Specifies a DOM element. The SDK will create a `<video>` element under the specified DOM element to play the video track. You can specify a DOM element in either of the following ways:
|
|
2430
|
+
* - `string`: Specify the ID of the DOM element.
|
|
2431
|
+
* - `HTMLElement`: Pass a DOM object.
|
|
997
2432
|
* @param config Sets the playback configurations, such as display mode and mirror mode. See [[VideoPlayerConfig]]. By default, the SDK enables mirror mode for a local video track.
|
|
998
2433
|
*/
|
|
999
2434
|
play(element: string | HTMLElement, config?: VideoPlayerConfig): void;
|
|
2435
|
+
/**
|
|
2436
|
+
* 获取本地视频轨道的相关信息。
|
|
2437
|
+
*
|
|
2438
|
+
* @deprecated
|
|
2439
|
+
* 自 v4.1.0 起废弃,请使用 [AgoraRTCClient.getLocalVideoStats]{@link IAgoraRTCClient.getLocalVideoStats} 和 [AgoraRTCClient.getLocalAudioStats]{@link IAgoraRTCClient.getLocalAudioStats}。
|
|
2440
|
+
*
|
|
2441
|
+
*/
|
|
2442
|
+
/** @en
|
|
2443
|
+
* Gets the statistics of a local video track.
|
|
2444
|
+
*
|
|
2445
|
+
* @deprecated from v4.1.0. Use [AgoraRTCClient.getLocalVideoStats]{@link IAgoraRTCClient.getLocalVideoStats} and [AgoraRTCClient.getLocalAudioStats]{@link IAgoraRTCClient.getLocalAudioStats} instead.
|
|
2446
|
+
*/
|
|
2447
|
+
getStats(): LocalVideoTrackStats;
|
|
2448
|
+
/**
|
|
2449
|
+
* @自从
|
|
2450
|
+
* <br>   *4.19.0*
|
|
2451
|
+
*
|
|
2452
|
+
* 复制当前的视频轨道对象,生成一个新的视频轨道。
|
|
2453
|
+
*
|
|
2454
|
+
* 在视频会议、在线教育等场景中,你可以用该方法实现同一视频流的两路显示,并为每路显示设置不同的分辨率、帧率、码率等参数。
|
|
2455
|
+
*
|
|
2456
|
+
* @param config 新生成视频轨道的编码配置。你可以通过 [[VideoEncoderConfiguration]] 传入 SDK 内置的编码配置;也可以通过传入一个 [[VideoEncoderConfigurationPreset]] 来自定义视频编码配置。
|
|
2457
|
+
* @param cloneTrack 是否克隆当前轨道。默认为 `true`。
|
|
2458
|
+
* @returns 新生成的视频轨道。
|
|
2459
|
+
*/
|
|
2460
|
+
/** @en
|
|
2461
|
+
* @since
|
|
2462
|
+
* <br>   *4.19.0*
|
|
2463
|
+
*
|
|
2464
|
+
* Clones the current video track to create a new video track.
|
|
2465
|
+
*
|
|
2466
|
+
* In scenarios such as video conferencing and online education, you can use this method to display the same video stream with two sets of display parameters, including resolution, frame rate, and bitrate. For example, you can have one display set to high-definition and the other to low-definition.
|
|
2467
|
+
*
|
|
2468
|
+
* @param config The encoding configuration for the new video track. You can pass in the SDK's built-in encoding configuration through [[VideoEncoderConfiguration]], or customize the video encoding configuration by passing in a [[VideoEncoderConfigurationPreset]].
|
|
2469
|
+
* @param cloneTrack Whether to clone the current track. Default is `true`.
|
|
2470
|
+
* @returns The newly generated video track.
|
|
2471
|
+
*/
|
|
2472
|
+
clone(config?: VideoEncoderConfiguration | VideoEncoderConfigurationPreset, cloneTrack?: boolean): ILocalVideoTrack;
|
|
2473
|
+
/**
|
|
2474
|
+
* @ignore
|
|
2475
|
+
*
|
|
2476
|
+
* 开启或关闭美颜。
|
|
2477
|
+
*
|
|
2478
|
+
* > 注意事项:
|
|
2479
|
+
* > - 该功能是 SDK 内置的美颜功能,将逐步停止更新。你可以改用升级的美颜插件,详见[使用美颜插件](https://docs.agora.io/cn/Video/beauty_effect_web_ng?platform=Web)。
|
|
2480
|
+
* > - 该方法支持以下浏览器:
|
|
2481
|
+
* > - Safari 12 及以上版本。
|
|
2482
|
+
* > - Chrome 65 及以上版本。
|
|
2483
|
+
* > - Firefox 70.0.1 及以上版本。
|
|
2484
|
+
* > - 该功能不支持移动端设备。
|
|
2485
|
+
* > - 如果开启了双流模式,美颜选项仅对大流生效。
|
|
2486
|
+
*
|
|
2487
|
+
* @param enabled 是否开启本地美颜功能:
|
|
2488
|
+
* - `true`: 开启本地美颜。
|
|
2489
|
+
* - `false`: 关闭本地美颜。
|
|
2490
|
+
* @param options 美颜效果选项。详见 [[BeautyEffectOptions]]。
|
|
2491
|
+
*/
|
|
2492
|
+
/** @en
|
|
2493
|
+
* @ignore
|
|
2494
|
+
*
|
|
2495
|
+
* Enables/Disables image enhancement and sets the options.
|
|
2496
|
+
*
|
|
2497
|
+
* > Notes:
|
|
2498
|
+
* > - Agora is planning to sunset this built-in image enhancement feature.
|
|
2499
|
+
* You can use the upgraded Image Enhancement Extension instead. For details, see
|
|
2500
|
+
* [Use the Image Enhancement Extension](https://docs.agora.io/en/Video/beauty_effect_web_ng?platform=Web).
|
|
2501
|
+
* > - This method supports the following browsers:
|
|
2502
|
+
* > - Safari 12 or later.
|
|
2503
|
+
* > - Chrome 65 or later.
|
|
2504
|
+
* > - Firefox 70.0.1 or later.
|
|
2505
|
+
* > - This function is not supported on mobile devices.
|
|
2506
|
+
* > - If you enable dual-stream mode, the image enhancement options only apply to the high-quality video stream.
|
|
2507
|
+
*
|
|
2508
|
+
* @param enabled Whether to enable image enhancement:
|
|
2509
|
+
* - `true`: Enable image enhancement.
|
|
2510
|
+
* - `false`: Disable image enhancement.
|
|
2511
|
+
* @param options Sets image enhancement options. See [[BeautyEffectOptions]].
|
|
2512
|
+
*/
|
|
2513
|
+
setBeautyEffect(enabled: boolean, options?: BeautyEffectOptions): Promise<void>;
|
|
1000
2514
|
/**
|
|
1001
2515
|
* @自从
|
|
1002
2516
|
* <br>   *4.1.0*
|
|
@@ -1018,16 +2532,67 @@ export declare interface IRemoteVideoTrack extends IRemoteTrack {
|
|
|
1018
2532
|
* @returns An `ImageData` object that stores RGBA data. `ImageData` is a web API supported by the browser. For details, see [ImageData](https://developer.mozilla.org/en-US/docs/Web/API/ImageData).
|
|
1019
2533
|
*/
|
|
1020
2534
|
getCurrentFrameData(): ImageData;
|
|
2535
|
+
/**
|
|
2536
|
+
* @ignore
|
|
2537
|
+
*/
|
|
2538
|
+
/** @en
|
|
2539
|
+
*
|
|
2540
|
+
* @ignore
|
|
2541
|
+
*/
|
|
2542
|
+
getCurrentFrameImage(imageType: string, quality: number): Promise<ImageTypedData>;
|
|
2543
|
+
/**
|
|
2544
|
+
* @自从
|
|
2545
|
+
* <br>   *4.2.0*
|
|
2546
|
+
*
|
|
2547
|
+
* 设置视频传输优化模式。
|
|
2548
|
+
*
|
|
2549
|
+
* 你可以在视频通话、视频直播或屏幕共享过程中调用此方法动态调整视频的传输优化模式。例如你想要把屏幕共享内容从演示文稿切换为视频时,你可以将传输优化模式从 `"detail"` 切换为 `"motion"`,确保视频画面在网络波动时不会出现卡顿。
|
|
2550
|
+
*
|
|
2551
|
+
* > 注意事项:该方法只支持 Chrome 浏览器。
|
|
2552
|
+
*
|
|
2553
|
+
* @param mode 视频传输优化模式:
|
|
2554
|
+
* - `"balanced"`: 使用默认的传输优化模式:
|
|
2555
|
+
* - 对于屏幕共享视频流,SDK 默认的优化策略为清晰优先。
|
|
2556
|
+
* - 对于其他视频流,SDK 默认的优化策略为兼顾清晰和流畅,弱网条件下,帧率和分辨率都会被调整。
|
|
2557
|
+
* - `"detail"`: 清晰优先。
|
|
2558
|
+
* - SDK 会自动根据你的采集分辨率和帧率设定一个最小码率。即使遭遇网络波动,发送码率也不会低于这个值,从而确保清晰的视频画面。
|
|
2559
|
+
* - 大部分情况下,SDK 不会降低发送分辨率,但是可能会降低帧率。
|
|
2560
|
+
* - `"motion"`: 流畅优先。
|
|
2561
|
+
* - SDK 不会启用最小码率策略。遭遇网络波动时,发送端会降低码率来确保接收端的视频画面不会出现中断和卡顿。
|
|
2562
|
+
* - 大部分情况下,SDK 不会降低帧率,但是可能会降低发送分辨率。
|
|
2563
|
+
*/
|
|
2564
|
+
/** @en
|
|
2565
|
+
* @since
|
|
2566
|
+
* <br>   *4.2.0*
|
|
2567
|
+
*
|
|
2568
|
+
* Sets the video transmission optimization mode.
|
|
2569
|
+
*
|
|
2570
|
+
* You can call this method during a video call, a live streaming or screen sharing to dynamically change the optimization mode. For example, during the screen sharing, before you change the shared content from text to video, you can change the optimization mode from `"detail"` to `"motion"` to ensure smoothness in poor network conditions.
|
|
2571
|
+
*
|
|
2572
|
+
* > Note: This method supports Chrome only.
|
|
2573
|
+
*
|
|
2574
|
+
* @param mode The video transmission optimization mode:
|
|
2575
|
+
* - `"balanced"`: Uses the default optimization mode.
|
|
2576
|
+
* - For a screen-sharing video track, the default transmission optimization strategy is to prioritizes clarity.
|
|
2577
|
+
* - For the other types of video tracks, the SDK may reduce the frame rate or the sending resolution in poor network conditions.
|
|
2578
|
+
* - `"detail"`: Prioritizes video quality.
|
|
2579
|
+
* - The SDK ensures high-quality images by automatically calculating a minimum bitrate based on the capturing resolution and frame rate. No matter how poor the network condition is, the sending bitrate will never be lower than the minimum value.
|
|
2580
|
+
* - In most cases, the SDK does not reduce the sending resolution, but may reduce the frame rate.
|
|
2581
|
+
* - `"motion"`: Prioritizes video smoothness.
|
|
2582
|
+
* - In poor network conditions, the SDK reduces the sending bitrate to minimize video freezes.
|
|
2583
|
+
* - In most cases, the SDK does not reduce the frame rate, but may reduce the sending resolution.
|
|
2584
|
+
*/
|
|
2585
|
+
setOptimizationMode(mode: "balanced" | "motion" | "detail"): Promise<void>;
|
|
1021
2586
|
/**
|
|
1022
2587
|
* * @自从
|
|
1023
2588
|
* <br>   *4.8.0*
|
|
1024
2589
|
*
|
|
1025
2590
|
* 获取 HTML `<video>` 标签的可见状态和不可见原因。
|
|
1026
2591
|
*
|
|
1027
|
-
* 调用 `
|
|
2592
|
+
* 调用 `localVideoTrack.play` 后 SDK 会创建 [HTML `<video>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video) 标签用于播放视频轨道。当 `localVideoTrack.isPlaying` 为 `true` 却看不到图像时,你可调用该方法进行问题排查。
|
|
1028
2593
|
*
|
|
1029
|
-
* @
|
|
1030
|
-
* - `
|
|
2594
|
+
* @returns [[CheckVideoVisibleResult]] 对象。如果该方法返回 `undefined`,可能为以下原因:
|
|
2595
|
+
* - `localVideoTrack.isPlaying` 为 `false`。
|
|
1031
2596
|
* - `<video>` 标签不存在。
|
|
1032
2597
|
* - `<video>` 标签不是通过 `play` 方法调用产生的。
|
|
1033
2598
|
*/
|
|
@@ -1037,156 +2602,1283 @@ export declare interface IRemoteVideoTrack extends IRemoteTrack {
|
|
|
1037
2602
|
*
|
|
1038
2603
|
* Gets the visibility of the `<video>` HTML tag.
|
|
1039
2604
|
*
|
|
1040
|
-
* After you call `
|
|
2605
|
+
* After you call `localVideoTrack.play`, the SDK creates an [`<video>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video) tag for playing video tracks. When `localVideoTrack.isPlaying` is `true` but you cannot see any video, call this method to check whether the `<video>` tag is visible or not and learn the reason when the `<video>` tag is invisible.
|
|
1041
2606
|
*
|
|
1042
2607
|
* @returns The [[CheckVideoVisibleResult]] object. If this method returns `undefined`, it may be due to the following reasons:
|
|
1043
|
-
* - `
|
|
2608
|
+
* - `localVideoTrack.isPlaying` is `false`.
|
|
1044
2609
|
* - The `<video>` tag does not exist.
|
|
1045
2610
|
* - The `<video>` tag is not created by calling the `play` method.
|
|
1046
2611
|
*/
|
|
1047
2612
|
getVideoElementVisibleStatus(): CheckVideoVisibleResult | undefined;
|
|
1048
2613
|
/**
|
|
1049
2614
|
* @自从
|
|
1050
|
-
* <br>   *4.
|
|
1051
|
-
*
|
|
1052
|
-
* 将 `Processor` 注入远端视频轨道。
|
|
2615
|
+
* <br>   *4.10.0*
|
|
1053
2616
|
*
|
|
2617
|
+
* 将 `Processor` 注入本地视频轨道。
|
|
1054
2618
|
* @param processor `Processor` 实例。每个插件均有对应类型的 `Processor`。
|
|
1055
2619
|
*
|
|
1056
2620
|
* @returns `Processor` 实例。
|
|
1057
2621
|
*/
|
|
1058
2622
|
/** @en
|
|
1059
|
-
*
|
|
1060
|
-
*
|
|
1061
|
-
*
|
|
1062
|
-
*
|
|
1063
|
-
*
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
2623
|
+
* Inserts a `Processor` to the local video track.
|
|
2624
|
+
*
|
|
2625
|
+
* @param processor The `Processor` instance. Each extension has a corresponding type of `Processor`.
|
|
2626
|
+
*
|
|
2627
|
+
* @returns The `Processor` instance.
|
|
2628
|
+
*/
|
|
2629
|
+
pipe(processor: IBaseProcessor): IBaseProcessor;
|
|
2630
|
+
/**
|
|
2631
|
+
* @自从
|
|
2632
|
+
* <br>   *4.10.0*
|
|
2633
|
+
*
|
|
2634
|
+
* 取消本地视频轨道上注入的 `Processor`。
|
|
2635
|
+
*/
|
|
2636
|
+
/** @en
|
|
2637
|
+
* @since
|
|
2638
|
+
* <br>   *4.10.0*
|
|
2639
|
+
*
|
|
2640
|
+
* Removes the `Processor` inserted to the local video track.
|
|
2641
|
+
*/
|
|
2642
|
+
unpipe(): void;
|
|
2643
|
+
/**
|
|
2644
|
+
* @自从
|
|
2645
|
+
* <br>   *4.10.0*
|
|
2646
|
+
*
|
|
2647
|
+
* 本地视频轨道上当前媒体处理链路的最终节点。
|
|
2648
|
+
*/
|
|
2649
|
+
/** @en
|
|
2650
|
+
* @since
|
|
2651
|
+
* <br>   *4.10.0*
|
|
2652
|
+
*
|
|
2653
|
+
* The destination of the current processing pipeline on the local video track.
|
|
2654
|
+
*/
|
|
2655
|
+
processorDestination: IBaseProcessor;
|
|
2656
|
+
/**
|
|
2657
|
+
* @自从
|
|
2658
|
+
* <br>   *4.17.0*
|
|
2659
|
+
*
|
|
2660
|
+
* 替换本地视频轨道。
|
|
2661
|
+
*
|
|
2662
|
+
* 该方法在本地视频流发布前或发布后都可以调用:
|
|
2663
|
+
* - 在发流前调用,新的视频轨道会在本地播放。
|
|
2664
|
+
* - 在发流后调用,远端会接收到新的视频轨道。
|
|
2665
|
+
*
|
|
2666
|
+
* 新的视频轨道可以通过 {@link ILocalVideoTrack.getMediaStreamTrack} 或者 `mediaStream.getVideoTracks` 方法获取。你可以选择是否停止被替换的视频轨道。
|
|
2667
|
+
*
|
|
2668
|
+
* > 注意事项:
|
|
2669
|
+
* > - 支持 Chrome 65+,Safari 以及最新版 Firefox 浏览器。
|
|
2670
|
+
* > - 部分移动设备上该方法可能不生效。
|
|
2671
|
+
* > - 建议在相同类型、相同编码配置的视频轨道之间进行替换,原因如下:
|
|
2672
|
+
* > - 如果视频轨道类型不同,例如用 `ScreenVideoTrack` 对象替换 `CameraVideoTrack` 对象,由于 `CameraVideoTrack` 默认开启镜像(详见 {@link VideoPlayerConfig.mirror}),会导致画面发生镜像翻转。
|
|
2673
|
+
* > - 如果编码配置(`encoderConfig`)不同,可能导致实际发送的分辨率或帧率不准。
|
|
2674
|
+
* > - 订阅端无法知悉视频轨道被替换。
|
|
2675
|
+
* > - 如果需要切换媒体输入设备,推荐使用 {@link ICameraVideoTrack.setDevice} 方法。
|
|
2676
|
+
*
|
|
2677
|
+
* **示例代码**
|
|
2678
|
+
* ```javascript
|
|
2679
|
+
* // 原有的本地视频轨道
|
|
2680
|
+
* const localVideoTrack = await AgoraRTC.createCameraVideoTrack();
|
|
2681
|
+
* // 获取新的视频轨道(方式一)
|
|
2682
|
+
* const newTrack = localVideoTrack.getMediaStreamTrack();
|
|
2683
|
+
* // 获取新的视频轨道(方式二)
|
|
2684
|
+
* const newTrack = await navigator.mediaDevices.getUserMedia({audio: true, video: true}).then(mediaStream => mediaStream.getVideoTracks()[0]);
|
|
2685
|
+
* // 替换本地视频轨道,并且停止原有的视频轨道
|
|
2686
|
+
* await localVideoTrack.replaceTrack(newTrack, true);
|
|
2687
|
+
* ```
|
|
2688
|
+
*
|
|
2689
|
+
* @param track 新的视频轨道。需要传入一个 [MediaStreamTrack](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack) 对象。
|
|
2690
|
+
* @param stopOldTrack 是否停止原有的视频轨道:
|
|
2691
|
+
* - 停止原有的视频轨道。
|
|
2692
|
+
* - 保留原有的视频轨道。
|
|
2693
|
+
*/
|
|
2694
|
+
/** @en
|
|
2695
|
+
* @since
|
|
2696
|
+
* <br>   *4.17.0*
|
|
2697
|
+
*
|
|
2698
|
+
* Replaces the local video track.
|
|
2699
|
+
*
|
|
2700
|
+
* You can call this method before or after publishing the local video stream:
|
|
2701
|
+
* - If you call this method before publishing, the new video track is played locally.
|
|
2702
|
+
* - If you call this method after publishing, the new video track is received by the remote user.
|
|
2703
|
+
*
|
|
2704
|
+
* The new video track can be retrieved by the {@link ILocalVideoTrack.getMediaStreamTrack} or `mediaStream.getVideoTracks` method. You can choose to either stop or retain the replaced track.
|
|
2705
|
+
*
|
|
2706
|
+
* > Notes:
|
|
2707
|
+
* > - This method supports Chrome 65+, Safari, and the latest Firefox.
|
|
2708
|
+
* > - This method might not take effect on some mobile devices.
|
|
2709
|
+
* > - Agora recommends switching between video tracks that are of the same type and have the same encoder configurations for the following reasons:
|
|
2710
|
+
* > - If the video track types are different, such as replacing a `CameraVideoTrack` object with a `ScreenVideoTrack` object, the video is flipped horizontally due to the mirror effect enabled by default on `CameraVideoTrack` (see {@link VideoPlayerConfig.mirror} for details).
|
|
2711
|
+
* > - If the encoder configurations (`encoderConfig`) are different, the actual sending resolution or frame rate might be different from what you set.
|
|
2712
|
+
* > - The subscriber will not be notified if the track gets replaced.
|
|
2713
|
+
* > - To switch the media input devices, Agora recommends using {@link ICameraVideoTrack.setDevice}.
|
|
2714
|
+
*
|
|
2715
|
+
* **Example**
|
|
2716
|
+
* ```javascript
|
|
2717
|
+
* // Current video track
|
|
2718
|
+
* const localVideoTrack = await AgoraRTC.createCameraVideoTrack();
|
|
2719
|
+
* // Gets the new video track (option one)
|
|
2720
|
+
* const newTrack = localVideoTrack.getMediaStreamTrack();
|
|
2721
|
+
* // Gets the new video track (option two)
|
|
2722
|
+
* const newTrack = await navigator.mediaDevices.getUserMedia({audio: true, video: true}).then(mediaStream => mediaStream.getVideoTracks()[0]);
|
|
2723
|
+
* // Replaces and stops the current video track
|
|
2724
|
+
* await localVideoTrack.replaceTrack(newTrack, true);
|
|
2725
|
+
* ```
|
|
2726
|
+
* @param track The new video track, which is a [MediaStreamTrack](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack) object.
|
|
2727
|
+
* @param stopOldTrack Whether to stop the old video track:
|
|
2728
|
+
* - true: Stops the old video track.
|
|
2729
|
+
* - false: Retains the old video track.
|
|
2730
|
+
*/
|
|
2731
|
+
replaceTrack(track: MediaStreamTrack, stopOldTrack: boolean): Promise<void>;
|
|
2732
|
+
/**
|
|
2733
|
+
* 设置视频的编码参数,包括分辨率、帧率、码率。
|
|
2734
|
+
*
|
|
2735
|
+
* @param config 你可以传入 SDK 预设的视频编码配置 [[VideoEncoderConfigurationPreset]],也可以传入自定义的 [[VideoEncoderConfiguration]] 对象。
|
|
2736
|
+
*/
|
|
2737
|
+
/** @en
|
|
2738
|
+
* Sets the video encoder configurations, such as resolution, frame rate, and bitrate.
|
|
2739
|
+
*
|
|
2740
|
+
* @param config The video encoder configurations. You can pass either [[VideoEncoderConfigurationPreset]] or a customized [[VideoEncoderConfiguration]] object.
|
|
2741
|
+
*/
|
|
2742
|
+
setEncoderConfiguration(config: VideoEncoderConfiguration | VideoEncoderConfigurationPreset): Promise<void>;
|
|
2743
|
+
/**
|
|
2744
|
+
* 在 H.264 视频流中添加 SEI 数据。
|
|
2745
|
+
*
|
|
2746
|
+
* @param sei SEI 数据。
|
|
2747
|
+
*/
|
|
2748
|
+
/** @en
|
|
2749
|
+
* Add the SEI data to the H.264 video stream.
|
|
2750
|
+
*
|
|
2751
|
+
* @param config SEI data.
|
|
2752
|
+
*/
|
|
2753
|
+
sendSeiData(sei: Uint8Array): void;
|
|
2754
|
+
}
|
|
2755
|
+
|
|
2756
|
+
export declare interface ImageTypedData {
|
|
2757
|
+
buffer: Uint8Array;
|
|
2758
|
+
width: number;
|
|
2759
|
+
height: number;
|
|
2760
|
+
}
|
|
2761
|
+
|
|
2762
|
+
/**
|
|
2763
|
+
* 本地麦克风音频轨道,继承于 [LocalAudioTrack]{@link ILocalAudioTrack},在此之上提供了更换采集设备的功能。
|
|
2764
|
+
*
|
|
2765
|
+
* 可以通过 [AgoraRTC.createMicrophoneAudioTrack]{@link IAgoraRTC.createMicrophoneAudioTrack} 来获取。
|
|
2766
|
+
*/
|
|
2767
|
+
/** @en
|
|
2768
|
+
* Inherited from [LocalAudioTrack]{@link ILocalAudioTrack}, `MicrophoneAudioTrack` is an interface for the audio sampled by a local microphone and adds several functions such as switching devices.
|
|
2769
|
+
*
|
|
2770
|
+
* You can create a local microphone audio track by calling [AgoraRTC.createMicrophoneAudioTrack]{@link IAgoraRTC.createMicrophoneAudioTrack}.
|
|
2771
|
+
*/
|
|
2772
|
+
export declare interface IMicrophoneAudioTrack extends ILocalAudioTrack {
|
|
2773
|
+
/**
|
|
2774
|
+
* 设置负责采集音频数据的麦克风设备。
|
|
2775
|
+
*
|
|
2776
|
+
* > 在发布前和发布后均可调用此方法。
|
|
2777
|
+
*
|
|
2778
|
+
* @param deviceId 指定设备的设备 Id,可以通过 [AgoraRTC.getMicrophones]{@link IAgoraRTC.getMicrophones} 获取。
|
|
2779
|
+
*/
|
|
2780
|
+
/** @en
|
|
2781
|
+
* Sets the device for sampling audio.
|
|
2782
|
+
*
|
|
2783
|
+
* > You can call the method either before or after publishing an audio track.
|
|
2784
|
+
*
|
|
2785
|
+
* @param deviceId The ID of the specified device. You can get the `deviceId` by calling [AgoraRTC.getMicrophones]{@link IAgoraRTC.getMicrophones}.
|
|
2786
|
+
*/
|
|
2787
|
+
setDevice(deviceId: string): Promise<void>;
|
|
2788
|
+
/**
|
|
2789
|
+
* @自从
|
|
2790
|
+
* <br>   *4.0.0*
|
|
2791
|
+
*
|
|
2792
|
+
* 启用/禁用该轨道。
|
|
2793
|
+
*
|
|
2794
|
+
* 轨道禁用后,播放和发布都将被停止。
|
|
2795
|
+
*
|
|
2796
|
+
* > - 禁用轨道不会触发 [LocalTrack.on("track-ended")]{@link event_track_ended} 事件。
|
|
2797
|
+
* > - 如果该轨道已发布,禁用轨道后,远端会触发 [user-unpublished]{@link IAgoraRTCClient.event_user_unpublished} 事件。重新启用后,远端会触发 [user-published]{@link IAgoraRTCClient.event_user_published} 事件。
|
|
2798
|
+
* > - `setEnabled` 和 `setMuted` 不能同时调用。
|
|
2799
|
+
*
|
|
2800
|
+
* @param enabled 是否启用该轨道:
|
|
2801
|
+
* - `true`: 启用该轨道.
|
|
2802
|
+
* - `false`: 禁用该轨道.
|
|
2803
|
+
*/
|
|
2804
|
+
/** @en
|
|
2805
|
+
* @since
|
|
2806
|
+
* <br>   *4.0.0*
|
|
2807
|
+
*
|
|
2808
|
+
* Enables/Disables the track.
|
|
2809
|
+
*
|
|
2810
|
+
* After a track is disabled, the SDK stops playing and publishing the track.
|
|
2811
|
+
*
|
|
2812
|
+
* > - Disabling a track does not trigger the [LocalTrack.on("track-ended")]{@link event_track_ended} event.
|
|
2813
|
+
* > - If a track is published, disabling this track triggers the [user-unpublished]{@link IAgoraRTCClient.event_user_unpublished} event on the remote client, and re-enabling this track triggers the [user-published]{@link IAgoraRTCClient.event_user_published} event.
|
|
2814
|
+
* > - Do not call `setEnabled` and `setMuted` together.
|
|
2815
|
+
*
|
|
2816
|
+
* @param enabled Whether to enable the track:
|
|
2817
|
+
* - `true`: Enable the track.
|
|
2818
|
+
* - `false`: Disable the track.
|
|
2819
|
+
*/
|
|
2820
|
+
setEnabled(enabled: boolean): Promise<void>;
|
|
2821
|
+
}
|
|
2822
|
+
|
|
2823
|
+
export declare function interceptLocalAudioFrame(sender: RTCRtpSender): Promise<void>;
|
|
2824
|
+
|
|
2825
|
+
export declare function interceptLocalVideoFrame(sender: RTCRtpSender, localVideoTrack: LocalVideoTrack): Promise<void>;
|
|
2826
|
+
|
|
2827
|
+
export declare function interceptRemoteAudioFrame(receiver: RTCRtpReceiver): Promise<void>;
|
|
2828
|
+
|
|
2829
|
+
export declare function interceptRemoteVideoFrame(receiver: RTCRtpReceiver, options?: InterceptVideoFrameOptions): Promise<void>;
|
|
2830
|
+
|
|
2831
|
+
declare interface InterceptVideoFrameOptions {
|
|
2832
|
+
onSei?: (sei: Uint8Array) => void;
|
|
2833
|
+
}
|
|
2834
|
+
|
|
2835
|
+
/**
|
|
2836
|
+
* 远端音频轨道,调用 [subscribe]{@link IAgoraRTCClient.subscribe} 后通过 [AgoraRTCRemoteUser.audioTrack]{@link IAgoraRTCRemoteUser.audioTrack} 对象获取
|
|
2837
|
+
*/
|
|
2838
|
+
/** @en
|
|
2839
|
+
* `RemoteAudioTrack` is the basic interface for the remote audio track.
|
|
2840
|
+
*
|
|
2841
|
+
* You can get create a remote audio track by the [AgoraRTCRemoteUser.audioTrack]{@link IAgoraRTCRemoteUser.audioTrack} object after calling [subscribe]{@link IAgoraRTCClient.subscribe}.
|
|
2842
|
+
*/
|
|
2843
|
+
export declare interface IRemoteAudioTrack extends IRemoteTrack {
|
|
2844
|
+
/**
|
|
2845
|
+
* 获取远端音频轨道相关信息。
|
|
2846
|
+
*
|
|
2847
|
+
* **不推荐使用** 请使用 [AgoraRTCClient.getRemoteAudioStats]{@link IAgoraRTCClient.getRemoteAudioStats} 获取远端音频轨道相关信息。
|
|
2848
|
+
*
|
|
2849
|
+
* @return 一个 [[RemoteAudioTrackStats]] 对象。
|
|
2850
|
+
*/
|
|
2851
|
+
/** @en
|
|
2852
|
+
* Gets the statistics of a remote audio track.
|
|
2853
|
+
*
|
|
2854
|
+
* @return An [[RemoteAudioTrackStats]] object.
|
|
2855
|
+
*/
|
|
2856
|
+
getStats(): RemoteAudioTrackStats;
|
|
2857
|
+
/**
|
|
2858
|
+
* 播放远端音频轨道。
|
|
2859
|
+
*
|
|
2860
|
+
* > 播放音频时 SDK 不会创建任何 DOM 元素,所以无需像视频一样提供 DOM 元素。
|
|
2861
|
+
*/
|
|
2862
|
+
/** @en
|
|
2863
|
+
* Plays a remote audio track.
|
|
2864
|
+
*
|
|
2865
|
+
* > When playing the audio track, you do not need to pass any DOM element.
|
|
2866
|
+
*/
|
|
2867
|
+
play(): void;
|
|
2868
|
+
/**
|
|
2869
|
+
* @自从
|
|
2870
|
+
* <br>   *4.1.0*
|
|
2871
|
+
*
|
|
2872
|
+
* 设置音频播放设备,比如扬声器。
|
|
2873
|
+
*
|
|
2874
|
+
* > 该方法只支持桌面端的 Chrome 和 Edge 浏览器。如果在其他浏览器上需要先设置`RESTRICTION_SET_PLAYBACK_DEVICE`为`false`,直接调用将会抛出 `NOT_SUPPORTED` 错误。
|
|
2875
|
+
* @param deviceId 设备 ID,可以通过 [[getPlaybackDevices]] 方法获取。
|
|
2876
|
+
*/
|
|
2877
|
+
/** @en
|
|
2878
|
+
* @since
|
|
2879
|
+
* <br>   *4.1.0*
|
|
2880
|
+
*
|
|
2881
|
+
* Sets the audio playback device, for example, the speaker.
|
|
2882
|
+
*
|
|
2883
|
+
* > > This method is only supported on desktop Chrome and Edge browsers. If you call it on other browsers, you need to set `RESTRICTION_SET_PLAYBACK_DEVICE` to `false` first, and calling it directly will throw a `NOT_SUPPORTED` error.
|
|
2884
|
+
* @param deviceId Device ID, which can be retrieved by calling [[getPlaybackDevices]].
|
|
2885
|
+
*/
|
|
2886
|
+
setPlaybackDevice(deviceId: string): Promise<void>;
|
|
2887
|
+
/**
|
|
2888
|
+
* 设置原始音频数据(PCM)回调。
|
|
2889
|
+
*
|
|
2890
|
+
* 设置成功后,SDK 会不断地将远端音频轨道的音频帧以 [AudioBuffer](https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer) 的形式通过回调返回。
|
|
2891
|
+
*
|
|
2892
|
+
* > 你可以通过 `frameSize` 来设置每次回调中音频帧的大小。该设置也会影响回调的间隔,`frameSize` 越大,每次回调的音频数据越多,回调间隔越长。
|
|
2893
|
+
*
|
|
2894
|
+
* ```js
|
|
2895
|
+
* track.setAudioFrameCallback((buffer) => {
|
|
2896
|
+
* for (let channel = 0; channel < buffer.numberOfChannels; channel += 1) {
|
|
2897
|
+
* // Float32Array with PCM data
|
|
2898
|
+
* const currentChannelData = buffer.getChannelData(channel);
|
|
2899
|
+
* console.log("PCM data in channel", channel, currentChannelData);
|
|
2900
|
+
* }
|
|
2901
|
+
* }, 2048);
|
|
2902
|
+
*
|
|
2903
|
+
* // ....
|
|
2904
|
+
* // Stop getting the raw audio data
|
|
2905
|
+
* track.setAudioFrameCallback(null);
|
|
2906
|
+
* ```
|
|
2907
|
+
*
|
|
2908
|
+
* @param audioFrameCallback 用于接收 [AudioBuffer](https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer) 的回调函数。设为 `null` 后,SDK 就会停止获取音频原始数据。
|
|
2909
|
+
* @param frameSize 每次回调的 `AudioBuffer` 中每个声道包含的采样数据个数,只能设为下列值:256, 512, 1024, 2048, 4096, 8192, 16384。默认为 4096。
|
|
2910
|
+
*/
|
|
2911
|
+
/** @en
|
|
2912
|
+
* Sets the callback for getting raw audio data in PCM format.
|
|
2913
|
+
*
|
|
2914
|
+
* After you successfully set the callback, the SDK constantly returns the audio frames of a remote audio track in this callback by using [AudioBuffer](https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer).
|
|
2915
|
+
*
|
|
2916
|
+
* > You can set the `frameSize` parameter to determine the frame size in each callback, which affects the interval between the callbacks. The larger the frame size, the longer the interval between them.
|
|
2917
|
+
*
|
|
2918
|
+
* ```js
|
|
2919
|
+
* track.setAudioFrameCallback((buffer) => {
|
|
2920
|
+
* for (let channel = 0; channel < buffer.numberOfChannels; channel += 1) {
|
|
2921
|
+
* // Float32Array with PCM data
|
|
2922
|
+
* const currentChannelData = buffer.getChannelData(channel);
|
|
2923
|
+
* console.log("PCM data in channel", channel, currentChannelData);
|
|
2924
|
+
* }
|
|
2925
|
+
* }, 2048);
|
|
2926
|
+
*
|
|
2927
|
+
* // ....
|
|
2928
|
+
* // Stop getting the raw audio data
|
|
2929
|
+
* track.setAudioFrameCallback(null);
|
|
2930
|
+
* ```
|
|
2931
|
+
*
|
|
2932
|
+
* @param audioFrameCallback The callback function for receiving the [AudioBuffer](https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer) object. If you set `audioBufferCallback` as `null`, the SDK stops getting raw audio data.
|
|
2933
|
+
* @param frameSize The number of samples of each audio channel that an `AudioBuffer` object contains. You can set `frameSize` as 256, 512, 1024, 2048, 4096, 8192, or 16384. The default value is 4096.
|
|
2934
|
+
*/
|
|
2935
|
+
setAudioFrameCallback(audioFrameCallback: null | ((buffer: AudioBuffer) => void), frameSize?: number): void;
|
|
2936
|
+
/**
|
|
2937
|
+
* 设置远端音频轨道的播放音量
|
|
2938
|
+
* @param volume 音量值,范围 [0, 100],0 代表静音,100 代表原始音量。
|
|
2939
|
+
*/
|
|
2940
|
+
/** @en
|
|
2941
|
+
* Sets the volume of a remote audio track.
|
|
2942
|
+
*
|
|
2943
|
+
* @param volume The volume. The value ranges from 0 (mute) to 100 (maximum). A value of 100 is the current volume.
|
|
2944
|
+
*/
|
|
2945
|
+
setVolume(volume: number): void;
|
|
2946
|
+
/**
|
|
2947
|
+
* 获取远端音频轨道的音量等级。
|
|
2948
|
+
*
|
|
2949
|
+
* @returns 音量等级值,范围 [0, 1],1 代表理论最大音量。通常该值大于 0.6 代表用户在持续说话。
|
|
2950
|
+
*/
|
|
2951
|
+
/** @en
|
|
2952
|
+
* Gets the audio level of a remote audio track.
|
|
2953
|
+
*
|
|
2954
|
+
* @returns The audio level. The value range is [0,1]. 1 is the highest audio level.
|
|
2955
|
+
* Usually a user with audio level above 0.6 is a speaking user.
|
|
2956
|
+
*/
|
|
2957
|
+
getVolumeLevel(): number;
|
|
2958
|
+
/**
|
|
2959
|
+
* @自从
|
|
2960
|
+
* <br>   *4.13.0*
|
|
2961
|
+
*
|
|
2962
|
+
* 将 `Processor` 注入远端音频轨道。
|
|
2963
|
+
*
|
|
2964
|
+
* @param processor `Processor` 实例。每个插件均有对应类型的 `Processor`。
|
|
2965
|
+
*
|
|
2966
|
+
* @returns `Processor` 实例。
|
|
2967
|
+
*/
|
|
2968
|
+
/** @en
|
|
2969
|
+
* @since
|
|
2970
|
+
* <br>   *4.13.0*
|
|
2971
|
+
*
|
|
2972
|
+
* Inserts a `Processor` to the remote audio track.
|
|
2973
|
+
*
|
|
2974
|
+
* @param processor The `Processor` instance. Each extension has a corresponding type of `Processor`.
|
|
2975
|
+
*
|
|
2976
|
+
* @returns The `Processor` instance.
|
|
2977
|
+
*/
|
|
2978
|
+
pipe(processor: IAudioProcessor): IAudioProcessor;
|
|
2979
|
+
/**
|
|
2980
|
+
* @自从
|
|
2981
|
+
* <br>   *4.13.0*
|
|
2982
|
+
*
|
|
2983
|
+
* 取消远端音频轨道上注入的 `Processor`。
|
|
2984
|
+
*/
|
|
2985
|
+
/** @en
|
|
2986
|
+
* @since
|
|
2987
|
+
* <br>   *4.13.0*
|
|
2988
|
+
*
|
|
2989
|
+
* Removes the `Processor` inserted to the remote audio track.
|
|
2990
|
+
*/
|
|
2991
|
+
unpipe(): void;
|
|
2992
|
+
/**
|
|
2993
|
+
* @自从
|
|
2994
|
+
* <br>   *4.13.0*
|
|
2995
|
+
*
|
|
2996
|
+
* 远端音频轨道上当前媒体处理链路的最终节点。
|
|
2997
|
+
*/
|
|
2998
|
+
/** @en
|
|
2999
|
+
* @since
|
|
3000
|
+
* <br>   *4.13.0*
|
|
3001
|
+
*
|
|
3002
|
+
* The destination of the current processing pipeline on the remote audio track.
|
|
3003
|
+
*/
|
|
3004
|
+
processorDestination: IAudioProcessor;
|
|
3005
|
+
}
|
|
3006
|
+
|
|
3007
|
+
/** @ignore */
|
|
3008
|
+
/** @en
|
|
3009
|
+
* @ignore
|
|
3010
|
+
*/
|
|
3011
|
+
export declare interface IRemoteDataChannel extends IDataChannel {
|
|
3012
|
+
/** @internal */
|
|
3013
|
+
on(event: "open", listener: typeof event_user_datachannel_open): void;
|
|
3014
|
+
/** @internal */
|
|
3015
|
+
on(event: "close", listener: typeof event_user_datachannel_close): void;
|
|
3016
|
+
/** @internal */
|
|
3017
|
+
on(event: "error", listener: typeof event_user_datachannel_error): void;
|
|
3018
|
+
/** @internal */
|
|
3019
|
+
on(event: "message", listener: typeof event_user_datachannel_message): void;
|
|
3020
|
+
}
|
|
3021
|
+
|
|
3022
|
+
/**
|
|
3023
|
+
* 远端轨道对象的基础类,为远端音频轨道 [RemoteAudioTrack]{@link IRemoteAudioTrack} 和远端视频轨道 [RemoteVideoTrack]{@link IRemoteVideoTrack} 提供一些公共的方法。
|
|
3024
|
+
*/
|
|
3025
|
+
/** @en
|
|
3026
|
+
* `RemoteTrack` is the basic interface for remote tracks, providing public methods for [RemoteAudioTrack]{@link IRemoteAudioTrack} and [RemoteVideoTrack]{@link IRemoteVideoTrack}.
|
|
3027
|
+
*/
|
|
3028
|
+
export declare interface IRemoteTrack extends ITrack {
|
|
3029
|
+
/**
|
|
3030
|
+
* @param event 事件名称。
|
|
3031
|
+
* @param listener 详见 [track-updated]{@link event_track_updated}。
|
|
3032
|
+
*/
|
|
3033
|
+
/** @en
|
|
3034
|
+
* @param event The event name.
|
|
3035
|
+
* @param listener See [track-updated]{@link event_track_updated}.
|
|
3036
|
+
*/
|
|
3037
|
+
on(event: "track-updated", listener: typeof event_track_updated): void;
|
|
3038
|
+
/**
|
|
3039
|
+
* @param event 事件名称。
|
|
3040
|
+
* @param listener 详见 [first-frame-decoded]{@link event_first_frame_decoded}。
|
|
3041
|
+
*/
|
|
3042
|
+
/** @en
|
|
3043
|
+
* @param event The event name.
|
|
3044
|
+
* @param listener See [first-frame-decoded]{@link event_first_frame_decoded}.
|
|
3045
|
+
*/
|
|
3046
|
+
on(event: "first-frame-decoded", listener: typeof event_first_frame_decoded): void;
|
|
3047
|
+
/**
|
|
3048
|
+
* 添加事件监听器。
|
|
3049
|
+
* @param event 事件名称。
|
|
3050
|
+
* @param listener 详见 [IRemoteTrack.transceiver-updated]{@link event_transceiver_updated_2}。
|
|
3051
|
+
*/
|
|
3052
|
+
/** @en
|
|
3053
|
+
* Adds an event listener.
|
|
3054
|
+
* @param event The event name.
|
|
3055
|
+
* @param listener See [IRemoteTrack.transceiver-updated]{@link event_transceiver_updated_2}.
|
|
3056
|
+
*/
|
|
3057
|
+
on(event: "transceiver-updated", listener: typeof event_transceiver_updated_2): void;
|
|
3058
|
+
/**
|
|
3059
|
+
* 获取发布远端轨道的远端用户 ID。
|
|
3060
|
+
*
|
|
3061
|
+
* @return 远端轨道对应的 `uid`。
|
|
3062
|
+
*/
|
|
3063
|
+
/** @en
|
|
3064
|
+
* Gets the `uid` of the remote user who publishes the remote track.
|
|
3065
|
+
*
|
|
3066
|
+
* @return The `uid` of the remote user.
|
|
3067
|
+
*/
|
|
3068
|
+
getUserId(): UID;
|
|
3069
|
+
/**
|
|
3070
|
+
* 获取远端轨道相关信息。
|
|
3071
|
+
*
|
|
3072
|
+
* @deprecated
|
|
3073
|
+
*
|
|
3074
|
+
* 自 v4.1.0 起废弃,请使用 [AgoraRTCClient.getRemoteVideoStats]{@link IAgoraRTCClient.getRemoteVideoStats} 和 [AgoraRTCClient.getRemoteAudioStats]{@link IAgoraRTCClient.getRemoteAudioStats}。
|
|
3075
|
+
* @return [[RemoteAudioTrackStats]] 或 [[RemoteVideoTrackStats]] 对象。
|
|
3076
|
+
*/
|
|
3077
|
+
/** @en
|
|
3078
|
+
* Gets the statistics of a remote track.
|
|
3079
|
+
*
|
|
3080
|
+
* @deprecated from v4.1.0. Use [AgoraRTCClient.getRemoteVideoStats]{@link IAgoraRTCClient.getRemoteVideoStats} and [AgoraRTCClient.getRemoteAudioStats]{@link IAgoraRTCClient.getRemoteAudioStats} instead.
|
|
3081
|
+
* @return An [[RemoteAudioTrackStats]] or [[RemoteVideoTrackStats]] object.
|
|
3082
|
+
*/
|
|
3083
|
+
getStats(): RemoteAudioTrackStats | RemoteVideoTrackStats;
|
|
3084
|
+
}
|
|
3085
|
+
|
|
3086
|
+
/**
|
|
3087
|
+
* 远端视频轨道。
|
|
3088
|
+
*
|
|
3089
|
+
* 调用 [subscribe]{@link IAgoraRTCClient.subscribe} 后通过 [AgoraRTCRemoteUser.videoTrack]{@link IAgoraRTCRemoteUser.videoTrack} 对象获取。
|
|
3090
|
+
*/
|
|
3091
|
+
/** @en
|
|
3092
|
+
* `RemoteVideoTrack` is the basic interface for the remote video track.
|
|
3093
|
+
*
|
|
3094
|
+
* You can get create a remote video track by the [AgoraRTCRemoteUser.videoTrack]{@link IAgoraRTCRemoteUser.videoTrack} object after calling [subscribe]{@link IAgoraRTCClient.subscribe}.
|
|
3095
|
+
*/
|
|
3096
|
+
export declare interface IRemoteVideoTrack extends IRemoteTrack {
|
|
3097
|
+
/**
|
|
3098
|
+
* @param event 事件名称。
|
|
3099
|
+
* @param listener 详见 [track-updated]{@link event_track_updated}。
|
|
3100
|
+
*/
|
|
3101
|
+
/** @en
|
|
3102
|
+
* @param event The event name.
|
|
3103
|
+
* @param listener See [track-updated]{@link event_track_updated}.
|
|
3104
|
+
*/
|
|
3105
|
+
on(event: "track-updated", listener: typeof event_track_updated): void;
|
|
3106
|
+
/**
|
|
3107
|
+
* @param event 事件名称。
|
|
3108
|
+
* @param listener 详见 [video-state-changed]{@link event_video_state_changed}。
|
|
3109
|
+
*/
|
|
3110
|
+
/** @en
|
|
3111
|
+
* @param event The event name.
|
|
3112
|
+
* @param listener See [video-state-changed]{@link event_video_state_changed}.
|
|
3113
|
+
*/
|
|
3114
|
+
on(event: "video-state-changed", listener: typeof event_video_state_changed): void;
|
|
3115
|
+
/**
|
|
3116
|
+
* @param event 事件名称。
|
|
3117
|
+
* @param listener 详见 [first-frame-decoded]{@link event_first_frame_decoded}。
|
|
3118
|
+
*/
|
|
3119
|
+
/** @en
|
|
3120
|
+
* @param event The event name.
|
|
3121
|
+
* @param listener See [first-frame-decoded]{@link event_first_frame_decoded}.
|
|
3122
|
+
*/
|
|
3123
|
+
on(event: "first-frame-decoded", listener: typeof event_first_frame_decoded): void;
|
|
3124
|
+
/**
|
|
3125
|
+
* @param event 事件名称。
|
|
3126
|
+
* @param listener 详见 [video-element-visible-status]{@link event_video_element_visible_status_2}。
|
|
3127
|
+
*/
|
|
3128
|
+
/** @en
|
|
3129
|
+
* @param event The event name.
|
|
3130
|
+
* @param listener See [video-element-visible-status]{@link event_video_element_visible_status_2}.
|
|
3131
|
+
*/
|
|
3132
|
+
on(event: "video-element-visible-status", listener: typeof event_video_element_visible_status_2): void;
|
|
3133
|
+
/**
|
|
3134
|
+
* 添加事件监听器。
|
|
3135
|
+
* @param event 事件名称。
|
|
3136
|
+
* @param listener 详见 [IRemoteTrack.transceiver-updated]{@link event_transceiver_updated_2}。
|
|
3137
|
+
*/
|
|
3138
|
+
/** @en
|
|
3139
|
+
* Adds an event listener.
|
|
3140
|
+
* @param event The event name.
|
|
3141
|
+
* @param listener See [IRemoteTrack.transceiver-updated]{@link event_transceiver_updated_2}.
|
|
3142
|
+
*/
|
|
3143
|
+
on(event: "transceiver-updated", listener: typeof event_transceiver_updated_2): void;
|
|
3144
|
+
/**
|
|
3145
|
+
* 添加事件监听器。
|
|
3146
|
+
* @param event 事件名称。
|
|
3147
|
+
* @param listener 详见 [ILocalTrack.sei-received]{@link event_sei_received}。
|
|
3148
|
+
*/
|
|
3149
|
+
/** @en
|
|
3150
|
+
* Adds an event listener.
|
|
3151
|
+
* @param event The event name.
|
|
3152
|
+
* @param listener See [ILocalTrack.sei-received]{@link event_sei_received}.
|
|
3153
|
+
*/
|
|
3154
|
+
on(event: "sei-received", listener: typeof event_sei_received): void;
|
|
3155
|
+
/**
|
|
3156
|
+
* 获取远端视频轨道相关信息。
|
|
3157
|
+
*
|
|
3158
|
+
* **不推荐使用** 请使用 [AgoraRTCClient.getRemoteVideoStats]{@link IAgoraRTCClient.getRemoteVideoStats} 获取远端视频轨道相关信息。
|
|
3159
|
+
*
|
|
3160
|
+
* @return 一个 [[RemoteVideoTrackStats]] 对象。
|
|
3161
|
+
*/
|
|
3162
|
+
/** @en
|
|
3163
|
+
* Gets the statistics of a remote video track.
|
|
3164
|
+
*
|
|
3165
|
+
* @return An [[RemoteVideoTrackStats]] object。
|
|
3166
|
+
*/
|
|
3167
|
+
getStats(): RemoteVideoTrackStats;
|
|
3168
|
+
/**
|
|
3169
|
+
* 在页面上播放本地视频轨道。
|
|
3170
|
+
* @param element 指定一个 DOM 元素,SDK 将在这个元素下创建 `<video>` 元素播放视频轨道,支持 2 种类型:
|
|
3171
|
+
* - `string`: 指定该 DOM 元素的 ID 值。
|
|
3172
|
+
* - `HTMLElement`: 直接传入一个 DOM 元素对象。
|
|
3173
|
+
* @param config 设置播放参数(镜像/显示模式)。详见 [[VideoPlayerConfig]]。对于本地视频轨道,镜像模式默认开启。
|
|
3174
|
+
*/
|
|
3175
|
+
/** @en
|
|
3176
|
+
* Plays a remote video track on the web page.
|
|
3177
|
+
*
|
|
3178
|
+
* @param element Specifies a DOM element. The SDK will create a `<video>` element under the specified DOM element to play the video track. You can specify a DOM element in either of following ways:
|
|
3179
|
+
* - `string`: Specify the ID of the DOM element.
|
|
3180
|
+
* - `HTMLElement`: Pass a DOM object.
|
|
3181
|
+
* @param config Sets the playback configurations, such as display mode and mirror mode. See [[VideoPlayerConfig]]. By default, the SDK enables mirror mode for a local video track.
|
|
3182
|
+
*/
|
|
3183
|
+
play(element: string | HTMLElement, config?: VideoPlayerConfig): void;
|
|
3184
|
+
/**
|
|
3185
|
+
* @自从
|
|
3186
|
+
* <br>   *4.1.0*
|
|
3187
|
+
*
|
|
3188
|
+
* 获取当前渲染的视频帧数据。
|
|
3189
|
+
*
|
|
3190
|
+
* > 只有在播放后才能调用此方法,如果没有调用 [[play]] 则返回空数据。
|
|
3191
|
+
*
|
|
3192
|
+
* @returns 存储了 RGBA 数据的 `ImageData` 对象。该对象为浏览器原生对象,详见 [ImageData](https://developer.mozilla.org/zh-CN/docs/Web/API/ImageData)。
|
|
3193
|
+
*/
|
|
3194
|
+
/** @en
|
|
3195
|
+
* @since
|
|
3196
|
+
* <br>   *4.1.0*
|
|
3197
|
+
*
|
|
3198
|
+
* Gets the data of the video frame being rendered.
|
|
3199
|
+
*
|
|
3200
|
+
* > You should call this method after calling [[play]]. Otherwise, the method call returns null.
|
|
3201
|
+
*
|
|
3202
|
+
* @returns An `ImageData` object that stores RGBA data. `ImageData` is a web API supported by the browser. For details, see [ImageData](https://developer.mozilla.org/en-US/docs/Web/API/ImageData).
|
|
3203
|
+
*/
|
|
3204
|
+
getCurrentFrameData(): ImageData;
|
|
3205
|
+
/**
|
|
3206
|
+
* * @自从
|
|
3207
|
+
* <br>   *4.8.0*
|
|
3208
|
+
*
|
|
3209
|
+
* 获取 HTML `<video>` 标签的可见状态和不可见原因。
|
|
3210
|
+
*
|
|
3211
|
+
* 调用 `remoteVideoTrack.play` 后 SDK 会创建 [HTML `<video>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video) 标签用于播放视频轨道。当 `remoteVideoTrack.isPlaying` 为 `true` 却看不到图像时,你可调用该方法进行问题排查。
|
|
3212
|
+
*
|
|
3213
|
+
* @return [[CheckVideoVisibleResult]] 对象。如果该方法返回 `undefined`,可能为以下原因:
|
|
3214
|
+
* - `remoteVideoTrack.isPlaying` 为 `false`。
|
|
3215
|
+
* - `<video>` 标签不存在。
|
|
3216
|
+
* - `<video>` 标签不是通过 `play` 方法调用产生的。
|
|
3217
|
+
*/
|
|
3218
|
+
/** @en
|
|
3219
|
+
* @since
|
|
3220
|
+
* <br>   *4.8.0*
|
|
3221
|
+
*
|
|
3222
|
+
* Gets the visibility of the `<video>` HTML tag.
|
|
3223
|
+
*
|
|
3224
|
+
* After you call `remoteVideoTrack.play`, the SDK creates an [`<video>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video) tag for playing video tracks. When `remoteVideoTrack.isPlaying` is `true` but you cannot see any video, call this method to check whether the `<video>` tag is visible or not and learn the reason when the `<video>` tag is invisible.
|
|
3225
|
+
*
|
|
3226
|
+
* @returns The [[CheckVideoVisibleResult]] object. If this method returns `undefined`, it may be due to the following reasons:
|
|
3227
|
+
* - `remoteVideoTrack.isPlaying` is `false`.
|
|
3228
|
+
* - The `<video>` tag does not exist.
|
|
3229
|
+
* - The `<video>` tag is not created by calling the `play` method.
|
|
3230
|
+
*/
|
|
3231
|
+
getVideoElementVisibleStatus(): CheckVideoVisibleResult | undefined;
|
|
3232
|
+
/**
|
|
3233
|
+
* @自从
|
|
3234
|
+
* <br>   *4.13.0*
|
|
3235
|
+
*
|
|
3236
|
+
* 将 `Processor` 注入远端视频轨道。
|
|
3237
|
+
*
|
|
3238
|
+
* @param processor `Processor` 实例。每个插件均有对应类型的 `Processor`。
|
|
3239
|
+
*
|
|
3240
|
+
* @returns `Processor` 实例。
|
|
3241
|
+
*/
|
|
3242
|
+
/** @en
|
|
3243
|
+
* @since
|
|
3244
|
+
* <br>   *4.13.0*
|
|
3245
|
+
*
|
|
3246
|
+
* Inserts a `Processor` to the remote video track.
|
|
3247
|
+
*
|
|
3248
|
+
* @param processor The `Processor` instance. Each extension has a corresponding type of `Processor`.
|
|
3249
|
+
*
|
|
3250
|
+
* @returns The `Processor` instance.
|
|
3251
|
+
*/
|
|
3252
|
+
pipe(processor: IBaseProcessor): IBaseProcessor;
|
|
3253
|
+
/**
|
|
3254
|
+
* @自从
|
|
3255
|
+
* <br>   *4.13.0*
|
|
3256
|
+
*
|
|
3257
|
+
* 取消远端视频轨道上注入的 `Processor`。
|
|
3258
|
+
*/
|
|
3259
|
+
/** @en
|
|
3260
|
+
* @since
|
|
3261
|
+
* <br>   *4.13.0*
|
|
3262
|
+
*
|
|
3263
|
+
* Removes the `Processor` inserted to the remote video track.
|
|
3264
|
+
*/
|
|
3265
|
+
unpipe(): void;
|
|
3266
|
+
/**
|
|
3267
|
+
* @自从
|
|
3268
|
+
* <br>   *4.13.0*
|
|
3269
|
+
*
|
|
3270
|
+
* 远端视频轨道上当前媒体处理链路的最终节点。
|
|
3271
|
+
*/
|
|
3272
|
+
/** @en
|
|
3273
|
+
* @since
|
|
3274
|
+
* <br>   *4.13.0*
|
|
3275
|
+
*
|
|
3276
|
+
* The destination of the current processing pipeline on the remote video track.
|
|
3277
|
+
*/
|
|
3278
|
+
processorDestination: IBaseProcessor;
|
|
3279
|
+
}
|
|
3280
|
+
|
|
3281
|
+
export declare function isAudioEncoderConfiguration(config: AudioEncoderConfiguration): config is AudioEncoderConfiguration;
|
|
3282
|
+
|
|
3283
|
+
/**
|
|
3284
|
+
* AudioProfilePreset Type Guard
|
|
3285
|
+
*/
|
|
3286
|
+
export declare function isAudioEncoderConfigurationOrPreset(profile: any): profile is AudioEncoderConfigurationPreset | AudioEncoderConfiguration;
|
|
3287
|
+
|
|
3288
|
+
export declare function isBeautyEffectOptions(options: BeautyEffectOptions): options is BeautyEffectOptions;
|
|
3289
|
+
|
|
3290
|
+
export { isElectron }
|
|
3291
|
+
|
|
3292
|
+
export declare function isLowStreamParameter(streamParameter: any): streamParameter is LowStreamParameter;
|
|
3293
|
+
|
|
3294
|
+
export declare function isScreenSourceType(mediaSource: any): mediaSource is ScreenSourceType;
|
|
3295
|
+
|
|
3296
|
+
export declare function isVideoEncoderConfiguration(config: VideoEncoderConfiguration): config is VideoEncoderConfiguration;
|
|
3297
|
+
|
|
3298
|
+
/**
|
|
3299
|
+
* VideoProfilePreset Type Guard
|
|
3300
|
+
*/
|
|
3301
|
+
export declare function isVideoEncoderConfigurationOrPreset(profile: any): profile is VideoEncoderConfigurationPreset | VideoEncoderConfiguration;
|
|
3302
|
+
|
|
3303
|
+
/**
|
|
3304
|
+
* @ignore
|
|
3305
|
+
*/
|
|
3306
|
+
export declare interface ITrack extends EventEmitter {
|
|
3307
|
+
/**
|
|
3308
|
+
* 媒体轨道的类型:
|
|
3309
|
+
* - `"audio"`: 音频轨道。
|
|
3310
|
+
* - `"video"`: 视频轨道。
|
|
3311
|
+
*/
|
|
3312
|
+
/** @en
|
|
3313
|
+
* The type of a media track:
|
|
3314
|
+
* - `"audio"`: Audio track.
|
|
3315
|
+
* - `"video"`: Video track.
|
|
3316
|
+
*/
|
|
3317
|
+
trackMediaType: "audio" | "video";
|
|
3318
|
+
/**
|
|
3319
|
+
* 媒体轨道是否正在页面上播放。
|
|
3320
|
+
* - `true`: 媒体轨道正在页面上播放。
|
|
3321
|
+
* - `false`: 媒体轨道没有在页面上播放。
|
|
3322
|
+
*/
|
|
3323
|
+
/** @en
|
|
3324
|
+
* Whether a media track is playing on the webpage:
|
|
3325
|
+
* - `true`: The media track is playing on the webpage.
|
|
3326
|
+
* - `false`: The media track is not playing on the webpage.
|
|
3327
|
+
*/
|
|
3328
|
+
isPlaying: boolean;
|
|
3329
|
+
/**
|
|
3330
|
+
* 获取由 SDK 生成的对于媒体轨道来说的唯一 ID。
|
|
3331
|
+
*
|
|
3332
|
+
* @return 媒体轨道 ID。
|
|
3333
|
+
*/
|
|
3334
|
+
/** @en
|
|
3335
|
+
* Gets the ID of a media track, a unique identifier generated by the SDK.
|
|
3336
|
+
*
|
|
3337
|
+
* @return The media track ID.
|
|
3338
|
+
*/
|
|
3339
|
+
getTrackId(): string;
|
|
3340
|
+
/**
|
|
3341
|
+
* 获取浏览器原生的 [MediaStreamTrack](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack) 对象。
|
|
3342
|
+
*
|
|
3343
|
+
* @return 一个 [MediaStreamTrack](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack) 对象。
|
|
3344
|
+
*/
|
|
3345
|
+
/** @en
|
|
3346
|
+
* Gets an [MediaStreamTrack](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack) object.
|
|
3347
|
+
*
|
|
3348
|
+
* @return An [MediaStreamTrack](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack) object.
|
|
3349
|
+
*/
|
|
3350
|
+
getMediaStreamTrack(): MediaStreamTrack;
|
|
3351
|
+
/**
|
|
3352
|
+
* 获取当前轨道的 [RTCRtpTransceiver](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpTransceiver) 实例。
|
|
3353
|
+
*
|
|
3354
|
+
* 该方法目前主要用于视频流的[端到端加密(Beta)](https://doc.shengwang.cn/doc/rtc/javascript/advanced-features/e2e-encryption)。
|
|
3355
|
+
*
|
|
3356
|
+
* > 如果 SDK 发生断线重连,当前轨道对应的 `RTCRtpTransceiver` 实例可能会发生变化。你可以通过以下回调来获取新的 `RTCRtpTransceiver` 实例:
|
|
3357
|
+
* > - 本地轨道:[ILocalTrack.transceiver-updated]{@link event_transceiver_updated}
|
|
3358
|
+
* > - 远端轨道:[IRemoteTrack.transceiver-updated]{@link event_transceiver_updated_2}
|
|
3359
|
+
*
|
|
3360
|
+
* @param type 视频流的类型。详见 {@link StreamType}。
|
|
3361
|
+
* @returns 当前轨道的 `RTCRtpTransceiver` 实例。
|
|
3362
|
+
*/
|
|
3363
|
+
/** @en
|
|
3364
|
+
* Gets the [RTCRtpTransceiver](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpTransceiver) instance of the current track.
|
|
3365
|
+
*
|
|
3366
|
+
* This method is currently mainly used for end-to-end encryption of video streams (Beta).
|
|
3367
|
+
*
|
|
3368
|
+
* > If the SDK experiences a reconnection, the `RTCRtpTransceiver` instance corresponding to the current track might change. You can obtain the new `RTCRtpTransceiver` instance through the following callbacks:
|
|
3369
|
+
* > - For a local track: [ILocalTrack.transceiver-updated]{@link event_transceiver_updated}
|
|
3370
|
+
* > - For a remote track: [IRemoteTrack.transceiver-updated]{@link event_transceiver_updated_2}
|
|
3371
|
+
*
|
|
3372
|
+
* @param type The type of the video stream. See {@link StreamType}.
|
|
3373
|
+
* @returns The [RTCRtpTransceiver](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpTransceiver) instance of the current track.
|
|
3374
|
+
*/
|
|
3375
|
+
getRTCRtpTransceiver(type?: StreamType): RTCRtpTransceiver | undefined;
|
|
3376
|
+
/**
|
|
3377
|
+
* 在页面上播放媒体轨道。
|
|
3378
|
+
*
|
|
3379
|
+
* @param element 指定一个 DOM 元素,SDK 将在这个元素下创建 `<video>` 元素播放视频轨道,支持 2 种类型:
|
|
3380
|
+
* - `string`: 指定该 DOM 元素的 ID 值。
|
|
3381
|
+
* - `HTMLElement`: 直接传入一个 DOM 元素对象。
|
|
3382
|
+
*/
|
|
3383
|
+
/** @en
|
|
3384
|
+
* Plays a media track on the webpage.
|
|
3385
|
+
*
|
|
3386
|
+
* @param element Specifies a DOM element. The SDK will create a `<video>` element under the specified DOM element to play the video track. You can specify a DOM element in either of following ways:
|
|
3387
|
+
* - `string`: Specify the ID of the DOM element.
|
|
3388
|
+
* - `HTMLElement`: Pass a DOM object.
|
|
3389
|
+
*/
|
|
3390
|
+
play(element?: string | HTMLElement): void;
|
|
3391
|
+
/**
|
|
3392
|
+
* 停止播放。
|
|
3393
|
+
*/
|
|
3394
|
+
/** @en
|
|
3395
|
+
* Stops playing the media track.
|
|
3396
|
+
*/
|
|
3397
|
+
stop(): void;
|
|
3398
|
+
}
|
|
3399
|
+
|
|
3400
|
+
export declare class LocalAudioTrack extends LocalTrack implements ILocalAudioTrack {
|
|
3401
|
+
readonly trackMediaType: "audio" | "video";
|
|
3402
|
+
_encoderConfig?: AudioEncoderConfiguration;
|
|
3403
|
+
_trackSource: AudioTrackSource | FakeTrackSource;
|
|
3404
|
+
/**
|
|
3405
|
+
* @description This method is used to init WebAudio, if you're sure you don't want to use WebAudio, call _trackSource
|
|
3406
|
+
*/
|
|
3407
|
+
get _source(): AudioTrackSource;
|
|
3408
|
+
set _source(source: AudioTrackSource | FakeTrackSource);
|
|
3409
|
+
_enabled: boolean;
|
|
3410
|
+
private _volume;
|
|
3411
|
+
_useAudioElement: boolean;
|
|
3412
|
+
_bypassWebAudio: boolean;
|
|
3413
|
+
protected processor?: IAudioProcessor;
|
|
3414
|
+
protected _processorContext: AudioProcessorContext | undefined;
|
|
3415
|
+
protected get processorContext(): AudioProcessorContext;
|
|
3416
|
+
_processorDestination: AudioProcessorDestination | undefined;
|
|
3417
|
+
get processorDestination(): AudioProcessorDestination;
|
|
3418
|
+
protected _getOriginVolumeLevel: boolean;
|
|
3419
|
+
get isPlaying(): boolean;
|
|
3420
|
+
get __className__(): string;
|
|
3421
|
+
constructor(track: MediaStreamTrack, encoderConfig?: AudioEncoderConfiguration, trackId?: string, getOriginVolumeLevel?: boolean);
|
|
3422
|
+
setVolume(volume: number): void;
|
|
3423
|
+
getVolumeLevel(): number;
|
|
3424
|
+
setPlaybackDevice(deviceId: string): Promise<void>;
|
|
3425
|
+
setEnabled(enabled: boolean, _?: any, skipChangeState?: boolean): Promise<void>;
|
|
3426
|
+
protected _setEnabled(enabled: boolean, _?: any, skipChangeState?: boolean): Promise<void>;
|
|
3427
|
+
setMuted(muted: boolean): Promise<void>;
|
|
3428
|
+
getStats(): LocalAudioTrackStats;
|
|
3429
|
+
setAudioFrameCallback(callback: null | ((buffer: AudioBuffer) => void), frameSize?: number): void;
|
|
3430
|
+
play(): void;
|
|
3431
|
+
stop(): void;
|
|
3432
|
+
close(): void;
|
|
3433
|
+
protected _updatePlayerSource(updateWebAudioSource?: boolean): void;
|
|
3434
|
+
protected _updateOriginMediaStreamTrack(track: MediaStreamTrack, stopOldTrack: boolean): Promise<void>;
|
|
3435
|
+
renewMediaStreamTrack(newConstraints?: MediaTrackConstraints): Promise<void>;
|
|
3436
|
+
pipe(processor: IAudioProcessor): IAudioProcessor;
|
|
3437
|
+
unpipe(): void;
|
|
3438
|
+
private bindProcessorDestinationEvents;
|
|
3439
|
+
private unbindProcessorDestinationEvents;
|
|
3440
|
+
protected bindProcessorContextEvents(processorContext: AudioProcessorContext): void;
|
|
3441
|
+
protected unbindProcessorContextEvents(processorContext: AudioProcessorContext): void;
|
|
3442
|
+
private initWebAudio;
|
|
3443
|
+
private initProcessor;
|
|
3444
|
+
}
|
|
3445
|
+
|
|
3446
|
+
/**
|
|
3447
|
+
* 本地音频轨道的基本信息,可以通过 [AgoraRTCClient.getLocalAudioStats]{@link IAgoraRTCClient.getLocalAudioStats} 获取。
|
|
3448
|
+
* @public
|
|
3449
|
+
*/
|
|
3450
|
+
/** @en
|
|
3451
|
+
* Information of the local audio track, which can be retrieved by calling [AgoraRTCClient.getLocalAudioStats]{@link IAgoraRTCClient.getLocalAudioStats}.
|
|
3452
|
+
*/
|
|
3453
|
+
export declare interface LocalAudioTrackStats {
|
|
3454
|
+
/**
|
|
3455
|
+
* 音频的编码格式。
|
|
3456
|
+
*
|
|
3457
|
+
* - `"opus"`: 音频编码格式为 OPUS。
|
|
3458
|
+
* - `"aac"`: 音频编码格式为 AAC。
|
|
3459
|
+
* - `"pcmu"`: 预留参数,暂不支持。
|
|
3460
|
+
* - `"pcma"`: 预留参数,暂不支持。
|
|
3461
|
+
* - `"g722"`: 预留参数,暂不支持。
|
|
3462
|
+
*
|
|
3463
|
+
* > Firefox 上无法获取该值。
|
|
3464
|
+
*/
|
|
3465
|
+
/** @en
|
|
3466
|
+
* The audio codec.
|
|
3467
|
+
*
|
|
3468
|
+
* - `"opus"`: The audio codec is OPUS。
|
|
3469
|
+
* - `"aac"`: The audio codec is AAC。
|
|
3470
|
+
* - `"pcmu"`: Reserved for future use.
|
|
3471
|
+
* - `"pcma"`: Reserved for future use.
|
|
3472
|
+
* - `"g722"`: Reserved for future use.
|
|
3473
|
+
*
|
|
3474
|
+
* > Firefox does not support this property.
|
|
3475
|
+
*/
|
|
3476
|
+
codecType?: "opus" | "aac" | "PCMU" | "PCMA" | "G722";
|
|
3477
|
+
/**
|
|
3478
|
+
* 发送的音频音量等级,范围为 [0,32767]。
|
|
3479
|
+
*
|
|
3480
|
+
* > 该值通过 WebRTC-Stats 获取,不能确保实时性。如果你想获取当前实时的音量等级,调用 [LocalAudioTrack.getVolumeLevel]{@link ILocalAudioTrack.getVolumeLevel}。
|
|
3481
|
+
*/
|
|
3482
|
+
/** @en
|
|
3483
|
+
* The energy level of the sent audio.
|
|
3484
|
+
*
|
|
3485
|
+
* The value range is [0,32767].
|
|
3486
|
+
*
|
|
3487
|
+
* > This value is retrieved by calling WebRTC-Stats and may not be up-to-date. To get the real-time sound volume, call [LocalAudioTrack.getVolumeLevel]{@link ILocalAudioTrack.getVolumeLevel}.
|
|
3488
|
+
*/
|
|
3489
|
+
sendVolumeLevel: number;
|
|
3490
|
+
/**
|
|
3491
|
+
* 发送的音频码率 (bps)。
|
|
3492
|
+
*/
|
|
3493
|
+
/** @en
|
|
3494
|
+
* The bitrate (bps) of the sent audio.
|
|
3495
|
+
*/
|
|
3496
|
+
sendBitrate: number;
|
|
3497
|
+
/**
|
|
3498
|
+
* 发送的音频总字节数 (bytes)。
|
|
3499
|
+
*/
|
|
3500
|
+
/** @en
|
|
3501
|
+
* The total bytes of the sent audio.
|
|
3502
|
+
*/
|
|
3503
|
+
sendBytes: number;
|
|
3504
|
+
/**
|
|
3505
|
+
* 发送的音频总包数。
|
|
3506
|
+
*/
|
|
3507
|
+
/** @en
|
|
3508
|
+
* The total packets of the sent audio.
|
|
3509
|
+
*/
|
|
3510
|
+
sendPackets: number;
|
|
3511
|
+
/**
|
|
3512
|
+
* 发送的音频总丢包数。
|
|
3513
|
+
*
|
|
3514
|
+
* > Safari 上无法获取该值。
|
|
3515
|
+
*/
|
|
3516
|
+
/** @en
|
|
3517
|
+
* The total number of lost audio packets that were sent.
|
|
3518
|
+
*
|
|
3519
|
+
* > You can not get this property on Safari.
|
|
3520
|
+
*/
|
|
3521
|
+
sendPacketsLost: number;
|
|
3522
|
+
/**
|
|
3523
|
+
* 发送音频数据包的抖动 (ms)。
|
|
3524
|
+
*/
|
|
3525
|
+
/** @en
|
|
3526
|
+
* Jitter (ms) of the audio packets that were sent.
|
|
3527
|
+
*/
|
|
3528
|
+
sendJitterMs: number;
|
|
3529
|
+
/**
|
|
3530
|
+
* 发送音频数据包的往返时延 (ms)。
|
|
3531
|
+
*/
|
|
3532
|
+
/** @en
|
|
3533
|
+
* Round-trip time delay (ms) of the audio packets that were sent.
|
|
3534
|
+
*/
|
|
3535
|
+
sendRttMs: number;
|
|
3536
|
+
/**
|
|
3537
|
+
* 发送的音频 400ms 内的丢包率。
|
|
3538
|
+
*/
|
|
3539
|
+
/** @en
|
|
3540
|
+
* The packet loss rate of the sent audio in 400ms.
|
|
3541
|
+
*/
|
|
3542
|
+
currentPacketLossRate: number;
|
|
3543
|
+
}
|
|
3544
|
+
|
|
3545
|
+
export declare class LocalDataChannel extends DataChannel implements ILocalDataChannel {
|
|
3546
|
+
send(data: ArrayBuffer): void;
|
|
3547
|
+
}
|
|
3548
|
+
|
|
3549
|
+
export declare abstract class LocalTrack extends Track implements ILocalTrack {
|
|
3550
|
+
_enabled: boolean;
|
|
3551
|
+
_muted: boolean;
|
|
3552
|
+
/**
|
|
3553
|
+
* @description Used to determine whether the user switches streams
|
|
3554
|
+
*/
|
|
3555
|
+
_isExternalTrack: boolean;
|
|
3556
|
+
get isExternalTrack(): boolean;
|
|
3557
|
+
get muted(): boolean;
|
|
3558
|
+
get enabled(): boolean;
|
|
3559
|
+
_isClosed: boolean;
|
|
3560
|
+
protected _enabledMutex: PromiseMutex;
|
|
3561
|
+
protected processor?: IBaseProcessor;
|
|
3562
|
+
protected abstract _processorContext: IProcessorContext | undefined;
|
|
3563
|
+
protected get processorContext(): IProcessorContext | undefined;
|
|
3564
|
+
abstract get processorDestination(): IBaseProcessor;
|
|
3565
|
+
constructor(track: MediaStreamTrack, trackId?: string);
|
|
3566
|
+
abstract getStats(): LocalVideoTrackStats | LocalAudioTrackStats;
|
|
3567
|
+
abstract setMuted(enabled: boolean): Promise<void>;
|
|
3568
|
+
abstract setEnabled(enabled: boolean): Promise<void>;
|
|
3569
|
+
getTrackLabel(): string;
|
|
3570
|
+
close(): void;
|
|
3571
|
+
protected _updateOriginMediaStreamTrack(track: MediaStreamTrack, stopOldTrack: boolean, isExternalTrack?: boolean): Promise<void>;
|
|
3572
|
+
protected abstract _updatePlayerSource(): void;
|
|
3573
|
+
protected _getDefaultPlayerConfig(): Partial<PlayerConfig>;
|
|
3574
|
+
protected _handleTrackEnded: () => void;
|
|
3575
|
+
protected onTrackEnded(): void;
|
|
3576
|
+
protected stateCheck(stateName: "enabled" | "muted", state: boolean): void;
|
|
3577
|
+
abstract renewMediaStreamTrack(): Promise<void>;
|
|
3578
|
+
getProcessorStats(): ProcessorStats[];
|
|
3579
|
+
getProcessorUsage(): Promise<UsageWithDirection[]>;
|
|
3580
|
+
}
|
|
3581
|
+
|
|
3582
|
+
export declare enum LocalTrackEvents {
|
|
3583
|
+
SOURCE_STATE_CHANGE = "source-state-change",
|
|
3584
|
+
TRACK_ENDED = "track-ended",
|
|
3585
|
+
/** @ignore */
|
|
3586
|
+
BEAUTY_EFFECT_OVERLOAD = "beauty-effect-overload",
|
|
3587
|
+
VIDEO_ELEMENT_VISIBLE_STATUS = "video-element-visible-status",
|
|
3588
|
+
CLOSED = "closed"
|
|
3589
|
+
}
|
|
3590
|
+
|
|
3591
|
+
export declare class LocalVideoTrack extends LocalTrack implements ILocalVideoTrack {
|
|
3592
|
+
readonly trackMediaType: "audio" | "video";
|
|
3593
|
+
_player?: AgoraRTCPlayer | VideoPlayer;
|
|
3594
|
+
isUseScaleResolutionDownBy: boolean;
|
|
3595
|
+
private _videoVisibleTimer;
|
|
3596
|
+
/**
|
|
3597
|
+
* 轮询监听stats
|
|
3598
|
+
*/
|
|
3599
|
+
protected _statsTimer: number | null;
|
|
3600
|
+
private _previousVideoVisibleStatus;
|
|
3601
|
+
private _clearPreviousVideoVisibleStatus;
|
|
3602
|
+
_encoderConfig?: Partial<VideoEncoderConfiguration>;
|
|
3603
|
+
_scalabilityMode?: SVCConfiguration;
|
|
3604
|
+
_optimizationMode?: OptimizationMode | "balanced";
|
|
3605
|
+
private _videoHeight?;
|
|
3606
|
+
private _videoWidth?;
|
|
3607
|
+
get videoHeight(): number | undefined;
|
|
3608
|
+
get videoWidth(): number | undefined;
|
|
3609
|
+
_forceBitrateLimit?: {
|
|
3610
|
+
max_bitrate: number;
|
|
3611
|
+
min_bitrate: number;
|
|
3612
|
+
};
|
|
3613
|
+
_enabled: boolean;
|
|
3614
|
+
get isPlaying(): boolean;
|
|
3615
|
+
protected _processorDestination: VideoProcessorDestination;
|
|
3616
|
+
get processorDestination(): VideoProcessorDestination;
|
|
3617
|
+
protected _processorContext: VideoProcessorContext;
|
|
3618
|
+
protected get processorContext(): VideoProcessorContext;
|
|
3619
|
+
protected set processorContext(ctx: VideoProcessorContext);
|
|
3620
|
+
get __className__(): string;
|
|
3621
|
+
constructor(track: MediaStreamTrack, encoderConfig?: Partial<VideoEncoderConfiguration>, scalabilityConfig?: SVCConfiguration, optimizationMode?: OptimizationMode | "balanced", trackId?: string, hints?: TrackHint[]);
|
|
3622
|
+
play(element: HTMLElement | HTMLVideoElement | string, config?: VideoPlayerConfig): void;
|
|
3623
|
+
stop(): void;
|
|
3624
|
+
setEnabled(enabled: boolean, skipChangeState?: boolean): Promise<void>;
|
|
3625
|
+
setMuted(muted: boolean): Promise<void>;
|
|
3626
|
+
setEncoderConfiguration(config: VideoEncoderConfiguration | VideoEncoderConfigurationPreset, doNotRenegoation?: boolean): Promise<void>;
|
|
3627
|
+
getStats(): LocalVideoTrackStats;
|
|
3628
|
+
setBeautyEffect(enabled: boolean, options?: BeautyEffectOptions): Promise<void>;
|
|
3629
|
+
getCurrentFrameData(): ImageData;
|
|
3630
|
+
getCurrentFrameImage(imageType: string, quality?: number): Promise<ImageTypedData>;
|
|
3631
|
+
setBitrateLimit(bitrateLimit: {
|
|
3632
|
+
max_bitrate: number;
|
|
3633
|
+
min_bitrate: number;
|
|
3634
|
+
}): Promise<void>;
|
|
3635
|
+
setOptimizationMode(mode: OptimizationMode | "balanced"): Promise<void>;
|
|
3636
|
+
setScalabiltyMode(mode: SVCConfiguration): void;
|
|
3637
|
+
updateMediaStreamTrackResolution(): void;
|
|
3638
|
+
protected _updatePlayerSource(): void;
|
|
3639
|
+
protected _getDefaultPlayerConfig(): Partial<VideoPlayerConfig>;
|
|
3640
|
+
protected setSenderConfiguration(config: VideoEncoderConfiguration | VideoEncoderConfigurationPreset): Promise<void>;
|
|
3641
|
+
updateBitrateFromProfile(): void;
|
|
3642
|
+
getVideoElementVisibleStatus(): CheckVideoVisibleResult | undefined;
|
|
3643
|
+
renewMediaStreamTrack(newConstraints?: MediaTrackConstraints): Promise<void>;
|
|
3644
|
+
pipe(processor: IBaseProcessor): IBaseProcessor;
|
|
3645
|
+
unpipe(): void;
|
|
3646
|
+
close(): void;
|
|
3647
|
+
clone(config?: VideoEncoderConfiguration | VideoEncoderConfigurationPreset, cloneTrack?: boolean): LocalVideoTrack;
|
|
3648
|
+
replaceTrack(track: MediaStreamTrack, stopOldTrack: boolean): Promise<void>;
|
|
3649
|
+
startMonitorStats(): void;
|
|
3650
|
+
sendSeiData(sei: Uint8Array): never;
|
|
3651
|
+
private bindProcessorDestinationEvents;
|
|
3652
|
+
private unbindProcessorDestinationEvents;
|
|
3653
|
+
private unbindProcessorContextEvents;
|
|
3654
|
+
}
|
|
3655
|
+
|
|
3656
|
+
/**
|
|
3657
|
+
* 本地视频轨道的基本信息,可以通过 [AgoraRTCClient.getLocalVideoStats]{@link IAgoraRTCClient.getLocalVideoStats} 获取。
|
|
3658
|
+
* @public
|
|
3659
|
+
*/
|
|
3660
|
+
/** @en
|
|
3661
|
+
* Information of the local video track, which can be retrieved by calling [AgoraRTCClient.getLocalVideoStats]{@link IAgoraRTCClient.getLocalVideoStats}.
|
|
3662
|
+
*/
|
|
3663
|
+
export declare interface LocalVideoTrackStats {
|
|
3664
|
+
/**
|
|
3665
|
+
* 视频编码格式。
|
|
3666
|
+
*
|
|
3667
|
+
* - `"H264"`: 视频编码格式为 H.264。
|
|
3668
|
+
* - `"VP8"`: 视频编码格式为 VP8。
|
|
3669
|
+
* - `"VP9"`: 视频编码格式为 VP9。
|
|
3670
|
+
* - `"AV1X"`: 预留参数,暂不支持。
|
|
3671
|
+
* - `"AV1"`: 预留参数,暂不支持。
|
|
3672
|
+
*
|
|
3673
|
+
* > Firefox 上无法获取该值。
|
|
3674
|
+
*/
|
|
3675
|
+
/** @en
|
|
3676
|
+
* The video codec.
|
|
3677
|
+
*
|
|
3678
|
+
* - `"H264"`: The video codec is H.264.
|
|
3679
|
+
* - `"VP8"`: The video codec is VP8.
|
|
3680
|
+
* - `"VP9"`: The video codec is VP9.
|
|
3681
|
+
* - `"AV1X"`: Reserved for future use.
|
|
3682
|
+
* - `"AV1"`: Reserved for future use.
|
|
3683
|
+
*
|
|
3684
|
+
* > You can not get this property on Firefox.
|
|
3685
|
+
*/
|
|
3686
|
+
codecType?: "H264" | "H265" | "VP8" | "VP9" | "AV1X" | "AV1";
|
|
3687
|
+
/**
|
|
3688
|
+
* 发送的视频总字节数 (bytes)。
|
|
3689
|
+
*/
|
|
3690
|
+
/** @en
|
|
3691
|
+
* The total bytes of the sent video.
|
|
3692
|
+
*/
|
|
3693
|
+
sendBytes: number;
|
|
3694
|
+
/**
|
|
3695
|
+
* 视频发送帧率(fps)。
|
|
3696
|
+
*
|
|
3697
|
+
* > Firefox 上无法获取该值。
|
|
3698
|
+
*/
|
|
3699
|
+
/** @en
|
|
3700
|
+
* The frame rate (fps) of the sent video.
|
|
3701
|
+
*
|
|
3702
|
+
* > You can not get this property on Firefox.
|
|
3703
|
+
*/
|
|
3704
|
+
sendFrameRate?: number;
|
|
3705
|
+
/**
|
|
3706
|
+
* 视频采集帧率(fps)。
|
|
3707
|
+
*
|
|
3708
|
+
* > Safari 和 Firefox 上无法获取该值。
|
|
3709
|
+
*/
|
|
3710
|
+
/** @en
|
|
3711
|
+
* The frame rate (fps) of the captured video.
|
|
3712
|
+
*
|
|
3713
|
+
* > You can not get this property on Safari and Firefox.
|
|
3714
|
+
*/
|
|
3715
|
+
captureFrameRate?: number;
|
|
3716
|
+
/**
|
|
3717
|
+
* 发送的视频总包数。
|
|
3718
|
+
*/
|
|
3719
|
+
/** @en
|
|
3720
|
+
* The total packets of the sent video.
|
|
3721
|
+
*/
|
|
3722
|
+
sendPackets: number;
|
|
3723
|
+
/**
|
|
3724
|
+
* 发送的视频总丢包数。
|
|
3725
|
+
*
|
|
3726
|
+
* > - Safari 上无法获取该值。
|
|
3727
|
+
* > - Firefox 上该字段不准确。
|
|
3728
|
+
*/
|
|
3729
|
+
/** @en
|
|
3730
|
+
* The total number of lost video packets that were sent.
|
|
3731
|
+
*
|
|
3732
|
+
* > - You can not get this property on Safari.
|
|
3733
|
+
* > - This property is inaccurate on Firefox.
|
|
3734
|
+
*/
|
|
3735
|
+
sendPacketsLost: number;
|
|
3736
|
+
/**
|
|
3737
|
+
* 发送视频数据包的抖动 (ms)。
|
|
3738
|
+
*/
|
|
3739
|
+
/** @en
|
|
3740
|
+
* Jitter (ms) of the video packets that were sent.
|
|
3741
|
+
*/
|
|
3742
|
+
sendJitterMs: number;
|
|
3743
|
+
/**
|
|
3744
|
+
* 发送视频数据包的往返时延 (ms)。
|
|
3745
|
+
*/
|
|
3746
|
+
/** @en
|
|
3747
|
+
* Round-trip time delay (ms) of the video packets that were sent.
|
|
3748
|
+
*/
|
|
3749
|
+
sendRttMs: number;
|
|
3750
|
+
/**
|
|
3751
|
+
* 视频发送的分辨率高度。
|
|
3752
|
+
*/
|
|
3753
|
+
/** @en
|
|
3754
|
+
* The resolution height (pixel) of the sent video.
|
|
3755
|
+
*/
|
|
3756
|
+
sendResolutionHeight: number;
|
|
3757
|
+
/**
|
|
3758
|
+
* 视频发送的分辨率宽度。
|
|
3759
|
+
*/
|
|
3760
|
+
/** @en
|
|
3761
|
+
* The resolution width (pixel) of the sent video.
|
|
3762
|
+
*/
|
|
3763
|
+
sendResolutionWidth: number;
|
|
3764
|
+
/**
|
|
3765
|
+
* 视频采集的分辨率高度。
|
|
3766
|
+
*/
|
|
3767
|
+
/** @en
|
|
3768
|
+
* The resolution height (pixel) of the captured video.
|
|
3769
|
+
*/
|
|
3770
|
+
captureResolutionHeight: number;
|
|
3771
|
+
/**
|
|
3772
|
+
* 视频采集的分辨率宽度。
|
|
3773
|
+
*/
|
|
3774
|
+
/** @en
|
|
3775
|
+
* The resolution width (pixel) of the captured video.
|
|
3776
|
+
*/
|
|
3777
|
+
captureResolutionWidth: number;
|
|
3778
|
+
/**
|
|
3779
|
+
* 视频编码延迟(ms)。
|
|
3780
|
+
*/
|
|
3781
|
+
/** @en
|
|
3782
|
+
* The time (ms) required for encoding the captured video.
|
|
1067
3783
|
*/
|
|
1068
|
-
|
|
3784
|
+
encodeDelay?: number;
|
|
1069
3785
|
/**
|
|
1070
|
-
*
|
|
1071
|
-
* <br>   *4.13.0*
|
|
1072
|
-
*
|
|
1073
|
-
* 取消远端视频轨道上注入的 `Processor`。
|
|
3786
|
+
* 视频发送码率 (bps)。
|
|
1074
3787
|
*/
|
|
1075
3788
|
/** @en
|
|
1076
|
-
*
|
|
1077
|
-
* <br>   *4.13.0*
|
|
1078
|
-
*
|
|
1079
|
-
* Removes the `Processor` inserted to the remote video track.
|
|
3789
|
+
* The bitrate (bps) of the sent video.
|
|
1080
3790
|
*/
|
|
1081
|
-
|
|
3791
|
+
sendBitrate: number;
|
|
1082
3792
|
/**
|
|
1083
|
-
*
|
|
1084
|
-
* <br>   *4.13.0*
|
|
1085
|
-
*
|
|
1086
|
-
* 远端视频轨道上当前媒体处理链路的最终节点。
|
|
3793
|
+
* 视频目标发送码率 (bps),即 {@link VideoEncoderConfiguration} 中设置的码率。
|
|
1087
3794
|
*/
|
|
1088
3795
|
/** @en
|
|
1089
|
-
* @
|
|
1090
|
-
* <br>   *4.13.0*
|
|
1091
|
-
*
|
|
1092
|
-
* The destination of the current processing pipeline on the remote video track.
|
|
3796
|
+
* The target bitrate (bps) of the sent video, namely the bitrate set in {@link VideoEncoderConfiguration}.
|
|
1093
3797
|
*/
|
|
1094
|
-
|
|
1095
|
-
}
|
|
1096
|
-
|
|
1097
|
-
/**
|
|
1098
|
-
* @ignore
|
|
1099
|
-
*/
|
|
1100
|
-
export declare interface ITrack extends EventEmitter {
|
|
3798
|
+
targetSendBitrate: number;
|
|
1101
3799
|
/**
|
|
1102
|
-
*
|
|
1103
|
-
* - `"audio"`: 音频轨道。
|
|
1104
|
-
* - `"video"`: 视频轨道。
|
|
3800
|
+
* 视频总时长,单位为秒。
|
|
1105
3801
|
*/
|
|
1106
3802
|
/** @en
|
|
1107
|
-
* The
|
|
1108
|
-
* - `"audio"`: Audio track.
|
|
1109
|
-
* - `"video"`: Video track.
|
|
3803
|
+
* The total duration of the sent video in seconds.
|
|
1110
3804
|
*/
|
|
1111
|
-
|
|
3805
|
+
totalDuration: number;
|
|
1112
3806
|
/**
|
|
1113
|
-
*
|
|
1114
|
-
* - `true`: 媒体轨道正在页面上播放。
|
|
1115
|
-
* - `false`: 媒体轨道没有在页面上播放。
|
|
3807
|
+
* 视频总卡顿时长,单位为秒。
|
|
1116
3808
|
*/
|
|
1117
3809
|
/** @en
|
|
1118
|
-
*
|
|
1119
|
-
* - `true`: The media track is playing on the webpage.
|
|
1120
|
-
* - `false`: The media track is not playing on the webpage.
|
|
3810
|
+
* The total freeze time of the encoded video in seconds.
|
|
1121
3811
|
*/
|
|
1122
|
-
|
|
3812
|
+
totalFreezeTime: number;
|
|
1123
3813
|
/**
|
|
1124
|
-
*
|
|
1125
|
-
*
|
|
1126
|
-
* @return 媒体轨道 ID。
|
|
3814
|
+
* 发送的视频 400ms 内的丢包率。
|
|
1127
3815
|
*/
|
|
1128
3816
|
/** @en
|
|
1129
|
-
*
|
|
1130
|
-
*
|
|
1131
|
-
* @return The media track ID.
|
|
3817
|
+
* The packet loss rate of the sent video in 400ms.
|
|
1132
3818
|
*/
|
|
1133
|
-
|
|
3819
|
+
currentPacketLossRate: number;
|
|
3820
|
+
}
|
|
3821
|
+
|
|
3822
|
+
/**
|
|
3823
|
+
* 小流的视频属性,用于 [setLowStreamParameter]{@link IAgoraRTCClient.setLowStreamParameter}。
|
|
3824
|
+
* @public
|
|
3825
|
+
*/
|
|
3826
|
+
/** @en
|
|
3827
|
+
* The video profile of the low-quality video stream. Set the the video profile of the low-quality video stream when calling [setLowStreamParameter]{@link IAgoraRTCClient.setLowStreamParameter}.
|
|
3828
|
+
*/
|
|
3829
|
+
export declare interface LowStreamParameter {
|
|
1134
3830
|
/**
|
|
1135
|
-
*
|
|
3831
|
+
* 小流视频的分辨率宽。
|
|
1136
3832
|
*
|
|
1137
|
-
*
|
|
3833
|
+
* 可以传入一个 `number`,或一个约束对象,如 `{ max: 1280, min: 720 }`。
|
|
3834
|
+
*
|
|
3835
|
+
* 关于约束对象的详细说明可以参考 [ConstrainLong]{@link ConstrainLong}。
|
|
1138
3836
|
*/
|
|
1139
3837
|
/** @en
|
|
1140
|
-
*
|
|
3838
|
+
* Width of the video.
|
|
1141
3839
|
*
|
|
1142
|
-
*
|
|
3840
|
+
* You can pass a `number`, or a constraint such as `{ max: 1280, min: 720 }`.
|
|
3841
|
+
*
|
|
3842
|
+
* For more details about the constraint, see [ConstrainLong]{@link ConstrainLong}.
|
|
1143
3843
|
*/
|
|
1144
|
-
|
|
3844
|
+
width: ConstrainULong;
|
|
1145
3845
|
/**
|
|
1146
|
-
*
|
|
3846
|
+
* 小流视频的分辨率高。
|
|
1147
3847
|
*
|
|
1148
|
-
*
|
|
1149
|
-
*
|
|
1150
|
-
* > 如果 SDK 发生断线重连,当前轨道对应的 `RTCRtpTransceiver` 实例可能会发生变化。你可以通过以下回调来获取新的 `RTCRtpTransceiver` 实例:
|
|
1151
|
-
* > - 远端轨道:[IRemoteTrack.transceiver-updated]{@link event_transceiver_updated_2}
|
|
3848
|
+
* 可以传入一个 `number`,或一个约束对象,如 `{ max: 720, min: 480 }`。
|
|
1152
3849
|
*
|
|
1153
|
-
*
|
|
1154
|
-
* @returns 当前轨道的 `RTCRtpTransceiver` 实例。
|
|
3850
|
+
* 关于约束对象的详细说明可以参考 [ConstrainLong]{@link ConstrainLong}。
|
|
1155
3851
|
*/
|
|
1156
3852
|
/** @en
|
|
1157
|
-
*
|
|
1158
|
-
*
|
|
1159
|
-
* This method is currently mainly used for end-to-end encryption of video streams (Beta).
|
|
3853
|
+
* Height of the video.
|
|
1160
3854
|
*
|
|
1161
|
-
*
|
|
1162
|
-
* > - For a remote track: [IRemoteTrack.transceiver-updated]{@link event_transceiver_updated_2}
|
|
3855
|
+
* You can pass a `number`, or a constraint such as `{ max: 1280, min: 720 }`.
|
|
1163
3856
|
*
|
|
1164
|
-
*
|
|
1165
|
-
* @returns The [RTCRtpTransceiver](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpTransceiver) instance of the current track.
|
|
3857
|
+
* For more details about the constraint, see [ConstrainLong]{@link ConstrainLong}.
|
|
1166
3858
|
*/
|
|
1167
|
-
|
|
3859
|
+
height: ConstrainULong;
|
|
1168
3860
|
/**
|
|
1169
|
-
*
|
|
3861
|
+
* 小流视频的帧率。
|
|
1170
3862
|
*
|
|
1171
|
-
*
|
|
1172
|
-
*
|
|
1173
|
-
*
|
|
3863
|
+
* 可以传入一个 `number`,或一个约束对象,如 `{ max: 30, min: 5 }`。
|
|
3864
|
+
*
|
|
3865
|
+
* 关于约束对象的详细说明可以参考 [ConstrainLong]{@link ConstrainLong}。
|
|
1174
3866
|
*/
|
|
1175
3867
|
/** @en
|
|
1176
|
-
*
|
|
3868
|
+
* Frame rate of the video (fps).
|
|
1177
3869
|
*
|
|
1178
|
-
*
|
|
1179
|
-
*
|
|
1180
|
-
*
|
|
3870
|
+
* You can pass a `number`, or a constraint such as `{ max: 30, min: 5 }`.
|
|
3871
|
+
*
|
|
3872
|
+
* For details about the constraint, see [ConstrainLong]{@link ConstrainLong}.
|
|
1181
3873
|
*/
|
|
1182
|
-
|
|
3874
|
+
framerate?: ConstrainULong;
|
|
1183
3875
|
/**
|
|
1184
|
-
*
|
|
3876
|
+
* 小流视频的码率,单位为 Kbps。
|
|
1185
3877
|
*/
|
|
1186
3878
|
/** @en
|
|
1187
|
-
*
|
|
3879
|
+
* Bitrate of the video (Kbps).
|
|
1188
3880
|
*/
|
|
1189
|
-
|
|
3881
|
+
bitrate?: number;
|
|
1190
3882
|
}
|
|
1191
3883
|
|
|
1192
3884
|
export declare const MediaElementNumStatus: {
|
|
@@ -1214,6 +3906,124 @@ export declare interface MediaStats {
|
|
|
1214
3906
|
resolution: Resolution;
|
|
1215
3907
|
}
|
|
1216
3908
|
|
|
3909
|
+
export declare class MicrophoneAudioTrack extends LocalAudioTrack implements IMicrophoneAudioTrack {
|
|
3910
|
+
_config: MicrophoneAudioTrackInitConfig;
|
|
3911
|
+
_deviceName: string;
|
|
3912
|
+
private _constraints;
|
|
3913
|
+
private readonly _originalConstraints;
|
|
3914
|
+
_enabled: boolean;
|
|
3915
|
+
get __className__(): string;
|
|
3916
|
+
constructor(track: MediaStreamTrack, config: MicrophoneAudioTrackInitConfig, constraints: MediaTrackConstraints, trackId?: string);
|
|
3917
|
+
setDevice(deviceId: string): Promise<void>;
|
|
3918
|
+
setEnabled(enabled: boolean, notCloseDevice?: boolean, skipChangeState?: boolean): Promise<void>;
|
|
3919
|
+
close(): void;
|
|
3920
|
+
protected onTrackEnded(): void;
|
|
3921
|
+
renewMediaStreamTrack(newConstraints?: MediaTrackConstraints): Promise<void>;
|
|
3922
|
+
protected bindProcessorContextEvents(processorContext: AudioProcessorContext): void;
|
|
3923
|
+
protected unbindProcessorContextEvents(processorContext: AudioProcessorContext): void;
|
|
3924
|
+
}
|
|
3925
|
+
|
|
3926
|
+
/**
|
|
3927
|
+
* 创建麦克风音频流时的配置对象,用于 [AgoraRTC.createMicrophoneAudioTrack]{@link IAgoraRTC.createMicrophoneAudioTrack}。
|
|
3928
|
+
*/
|
|
3929
|
+
/** @en
|
|
3930
|
+
* Configurations for the audio track from the audio captured by a microphone. Set these configurations when calling [AgoraRTC.createMicrophoneAudioTrack]{@link IAgoraRTC.createMicrophoneAudioTrack}.
|
|
3931
|
+
*/
|
|
3932
|
+
export declare interface MicrophoneAudioTrackInitConfig {
|
|
3933
|
+
/**
|
|
3934
|
+
* 控制音频的编码配置。
|
|
3935
|
+
*
|
|
3936
|
+
* 你可以通过 [[AudioEncoderConfigurationPreset]] 传入 SDK 内置的编码配置;也可以通过传入一个 [[AudioEncoderConfiguration]] 来自定义音频编码配置。
|
|
3937
|
+
*
|
|
3938
|
+
* > Firefox 不支持设置音频编码码率。
|
|
3939
|
+
*/
|
|
3940
|
+
/** @en
|
|
3941
|
+
* The audio encoder configurations.
|
|
3942
|
+
*
|
|
3943
|
+
* You can set the audio encoder configurations in either of the following ways:
|
|
3944
|
+
* - Pass the preset audio encoder configurations by using [[AudioEncoderConfigurationPreset]].
|
|
3945
|
+
* - Pass your customized audio encoder configurations by using [[AudioEncoderConfiguration]].
|
|
3946
|
+
*
|
|
3947
|
+
* > Firefox does not support setting the audio encoding rate.
|
|
3948
|
+
*/
|
|
3949
|
+
encoderConfig?: AudioEncoderConfiguration | AudioEncoderConfigurationPreset;
|
|
3950
|
+
/**
|
|
3951
|
+
* 是否开启回声消除:
|
|
3952
|
+
* - `true`: 开启回声消除。
|
|
3953
|
+
* - `false`: 不开启回声消除。
|
|
3954
|
+
*/
|
|
3955
|
+
/** @en
|
|
3956
|
+
* Whether to enable acoustic echo cancellation:
|
|
3957
|
+
* - `true`: Enable acoustic echo cancellation.
|
|
3958
|
+
* - `false`: Do not enable acoustic echo cancellation.
|
|
3959
|
+
*/
|
|
3960
|
+
AEC?: boolean;
|
|
3961
|
+
/**
|
|
3962
|
+
* 是否开启自动增益:
|
|
3963
|
+
* - `true`: 开启自动增益。
|
|
3964
|
+
* - `false`: 不开启自动增益。
|
|
3965
|
+
*/
|
|
3966
|
+
/** @en
|
|
3967
|
+
* Whether to enable audio gain control:
|
|
3968
|
+
* - `true`: Enable audio gain control.
|
|
3969
|
+
* - `false`: Do not enable audio gain control.
|
|
3970
|
+
*/
|
|
3971
|
+
AGC?: boolean;
|
|
3972
|
+
/**
|
|
3973
|
+
* 是否开启噪声抑制:
|
|
3974
|
+
* - `true`: 开启噪声抑制。
|
|
3975
|
+
* - `false`: 不开启噪声抑制。
|
|
3976
|
+
*/
|
|
3977
|
+
/** @en
|
|
3978
|
+
* Whether to enable automatic noise suppression:
|
|
3979
|
+
* - `true`: Enable automatic noise suppression.
|
|
3980
|
+
* - `false`: Do not automatic noise suppression.
|
|
3981
|
+
*/
|
|
3982
|
+
ANS?: boolean;
|
|
3983
|
+
/**
|
|
3984
|
+
* @ignore
|
|
3985
|
+
*/
|
|
3986
|
+
/** @en
|
|
3987
|
+
* @ignore
|
|
3988
|
+
*/
|
|
3989
|
+
DTX?: boolean;
|
|
3990
|
+
/**
|
|
3991
|
+
* 指定麦克风的设备 ID。
|
|
3992
|
+
*
|
|
3993
|
+
* 你可以通过 [AgoraRTC.getMicrophones]{@link IAgoraRTC.getMicrophones} 来获取当前的麦克风设备列表。
|
|
3994
|
+
*/
|
|
3995
|
+
/** @en
|
|
3996
|
+
* Specifies the microphone ID.
|
|
3997
|
+
*
|
|
3998
|
+
* You can get a list of the available microphones by calling [AgoraRTC.getMicrophones]{@link IAgoraRTC.getMicrophones}.
|
|
3999
|
+
*/
|
|
4000
|
+
microphoneId?: string;
|
|
4001
|
+
/**
|
|
4002
|
+
* @ignore
|
|
4003
|
+
* 指定是否音频不路由通过WebAudio
|
|
4004
|
+
*/
|
|
4005
|
+
/** @en
|
|
4006
|
+
* @ignore
|
|
4007
|
+
* Specifies whether or not audio track pass through WebAudio.
|
|
4008
|
+
*/
|
|
4009
|
+
bypassWebAudio?: boolean;
|
|
4010
|
+
}
|
|
4011
|
+
|
|
4012
|
+
export declare class MixingAudioTrack extends LocalAudioTrack {
|
|
4013
|
+
get __className__(): string;
|
|
4014
|
+
trackList: LocalAudioTrack[];
|
|
4015
|
+
private destNode;
|
|
4016
|
+
get isActive(): boolean;
|
|
4017
|
+
constructor();
|
|
4018
|
+
hasAudioTrack(track: LocalAudioTrack): boolean;
|
|
4019
|
+
addAudioTrack(track: LocalAudioTrack): void;
|
|
4020
|
+
removeAudioTrack(track: LocalAudioTrack): void;
|
|
4021
|
+
private updateEncoderConfig;
|
|
4022
|
+
_updateRtpTransceiver(transceiver: RTCRtpTransceiver): void;
|
|
4023
|
+
}
|
|
4024
|
+
|
|
4025
|
+
export declare type OptimizationMode = "motion" | "detail";
|
|
4026
|
+
|
|
1217
4027
|
/**
|
|
1218
4028
|
* @internal
|
|
1219
4029
|
*/
|
|
@@ -1424,6 +4234,14 @@ export declare interface RemoteAudioTrackStats {
|
|
|
1424
4234
|
publishDuration: number;
|
|
1425
4235
|
}
|
|
1426
4236
|
|
|
4237
|
+
export declare class RemoteDataChannel extends DataChannel implements IRemoteDataChannel {
|
|
4238
|
+
private _messageListener;
|
|
4239
|
+
constructor(config: IDataChannelConfig);
|
|
4240
|
+
_updateOriginDataChannel(datachannel: RTCDataChannel): void;
|
|
4241
|
+
_close(): void;
|
|
4242
|
+
private _bandRemoteDataChannelEvents;
|
|
4243
|
+
}
|
|
4244
|
+
|
|
1427
4245
|
/**
|
|
1428
4246
|
* 媒体流的回退策略选项,用于 [setStreamFallbackOption]{@link IAgoraRTCClient.setStreamFallbackOption}。
|
|
1429
4247
|
* @public
|
|
@@ -1617,99 +4435,415 @@ export declare interface RemoteVideoTrackStats {
|
|
|
1617
4435
|
*/
|
|
1618
4436
|
receiveFrameRate?: number;
|
|
1619
4437
|
/**
|
|
1620
|
-
* 视频渲染帧率(fps)。
|
|
4438
|
+
* 视频渲染帧率(fps)。
|
|
4439
|
+
*/
|
|
4440
|
+
/** @en
|
|
4441
|
+
* The rendering frame rate (fps) of the decoded video.
|
|
4442
|
+
*/
|
|
4443
|
+
renderFrameRate?: number;
|
|
4444
|
+
/**
|
|
4445
|
+
* 接收的视频总包数。
|
|
4446
|
+
*/
|
|
4447
|
+
/** @en
|
|
4448
|
+
* The total bytes of the received video.
|
|
4449
|
+
*/
|
|
4450
|
+
receivePackets: number;
|
|
4451
|
+
/**
|
|
4452
|
+
* 接收的视频总丢包数。
|
|
4453
|
+
*/
|
|
4454
|
+
/** @en
|
|
4455
|
+
* The total number of lost video packets that should be received.
|
|
4456
|
+
*/
|
|
4457
|
+
receivePacketsLost: number;
|
|
4458
|
+
/**
|
|
4459
|
+
* 接收的视频丢包率。
|
|
4460
|
+
*/
|
|
4461
|
+
/** @en
|
|
4462
|
+
* The packet loss rate of the received video.
|
|
4463
|
+
*/
|
|
4464
|
+
packetLossRate: number;
|
|
4465
|
+
/**
|
|
4466
|
+
* 接收的视频在400ms内的丢包率。
|
|
4467
|
+
*/
|
|
4468
|
+
/** @en
|
|
4469
|
+
* The packet loss rate of the received video.
|
|
4470
|
+
*/
|
|
4471
|
+
currentPacketLossRate: number;
|
|
4472
|
+
/**
|
|
4473
|
+
* 接收的视频分辨率高度。
|
|
4474
|
+
*/
|
|
4475
|
+
/** @en
|
|
4476
|
+
* The resolution height (pixel) of the received video.
|
|
4477
|
+
*/
|
|
4478
|
+
receiveResolutionHeight: number;
|
|
4479
|
+
/**
|
|
4480
|
+
* 接收的视频分辨率宽度。
|
|
4481
|
+
*/
|
|
4482
|
+
/** @en
|
|
4483
|
+
* The resolution width (pixel) of the received video.
|
|
4484
|
+
*/
|
|
4485
|
+
receiveResolutionWidth: number;
|
|
4486
|
+
/**
|
|
4487
|
+
* 接收的视频总时长,单位为秒。
|
|
4488
|
+
*/
|
|
4489
|
+
/** @en
|
|
4490
|
+
* The total duration of the received video in seconds.
|
|
4491
|
+
*/
|
|
4492
|
+
totalDuration: number;
|
|
4493
|
+
/**
|
|
4494
|
+
* 接收的视频总卡顿时长,单位为秒。
|
|
4495
|
+
*/
|
|
4496
|
+
/** @en
|
|
4497
|
+
* The total freeze time of the received video in seconds.
|
|
4498
|
+
*/
|
|
4499
|
+
totalFreezeTime: number;
|
|
4500
|
+
/**
|
|
4501
|
+
* 接收的视频卡顿率。
|
|
4502
|
+
*/
|
|
4503
|
+
/** @en
|
|
4504
|
+
* The freeze rate of the received video.
|
|
4505
|
+
*/
|
|
4506
|
+
freezeRate: number;
|
|
4507
|
+
/**
|
|
4508
|
+
* 远端发布视频时长
|
|
4509
|
+
* 如果为 -1,说明暂时还无法获取发布时长
|
|
4510
|
+
*/
|
|
4511
|
+
publishDuration: number;
|
|
4512
|
+
}
|
|
4513
|
+
|
|
4514
|
+
export declare function removeTrack(track: Track): void;
|
|
4515
|
+
|
|
4516
|
+
export declare function requestAutoplayGesture(): void;
|
|
4517
|
+
|
|
4518
|
+
export declare interface Resolution {
|
|
4519
|
+
width: number;
|
|
4520
|
+
height: number;
|
|
4521
|
+
}
|
|
4522
|
+
|
|
4523
|
+
/**
|
|
4524
|
+
* 全局 getUserMedia 锁,确保每次 GUM 时上一个 GUM 已经完成
|
|
4525
|
+
*
|
|
4526
|
+
* 该目前只用于 Safari 和 iOS 浏览器,https://bugs.webkit.org/show_bug.cgi?id=179363
|
|
4527
|
+
*
|
|
4528
|
+
* 防止 SDK Device 模块和用户同时触发 GUM 导致用户 GUN 返回的 track 被 mute。
|
|
4529
|
+
*/
|
|
4530
|
+
export declare const SAFARI_GLOBAL_GUM_LOCK: PromiseMutex;
|
|
4531
|
+
|
|
4532
|
+
export declare interface ScreenConstraintsWithElectron extends MediaTrackConstraints {
|
|
4533
|
+
/**
|
|
4534
|
+
* Electron 屏幕共享时用户传入的 sourceID。
|
|
4535
|
+
*/
|
|
4536
|
+
sourceId?: string;
|
|
4537
|
+
/**
|
|
4538
|
+
* Chrome 插件屏幕共享的 id。
|
|
4539
|
+
*/
|
|
4540
|
+
extensionId?: string;
|
|
4541
|
+
/**
|
|
4542
|
+
* Chrome 插件屏幕共享的 options。
|
|
4543
|
+
*/
|
|
4544
|
+
mandatory?: any;
|
|
4545
|
+
/**
|
|
4546
|
+
* 屏幕共享的 source 类型,目前只对 Firefox 有效。
|
|
4547
|
+
*/
|
|
4548
|
+
mediaSource?: ScreenSourceType;
|
|
4549
|
+
width?: ConstrainULong;
|
|
4550
|
+
height?: ConstrainULong;
|
|
4551
|
+
/**
|
|
4552
|
+
* "browser" for tabs.
|
|
4553
|
+
* "window" for windows.
|
|
4554
|
+
* "monitor" for screens.
|
|
4555
|
+
*/
|
|
4556
|
+
displaySurface?: "browser" | "window" | "monitor";
|
|
4557
|
+
/** 是否屏蔽本地tag页面, 默认include(和Chrome 107默认exclude不同,为了保持与过去浏览器版本一致), Chrome 107以上 Opera 93以上*/
|
|
4558
|
+
selfBrowserSurface?: "include" | "exclude";
|
|
4559
|
+
/** 是否允许tag切换分享, 默认允许include, Chrome 107以上 Opera 93以上*/
|
|
4560
|
+
surfaceSwitching?: "include" | "exclude";
|
|
4561
|
+
/** 是否开启系统音频,默认开启include, Chrome 105以上, Opera 91以上 */
|
|
4562
|
+
systemAudio?: "include" | "exclude";
|
|
4563
|
+
}
|
|
4564
|
+
|
|
4565
|
+
/**
|
|
4566
|
+
* SDK 预设的 [[VideoEncoderConfiguration]] 配置。
|
|
4567
|
+
*
|
|
4568
|
+
* 你可以在 [AgoraRTC.createScreenVideoTrack]{@link IAgoraRTC.createScreenVideoTrack} 方法中传入以下预设值来控制屏幕共享视频编码配置。
|
|
4569
|
+
*
|
|
4570
|
+
* 下表列出了 SDK 所有预设的屏幕共享视频属性配置。
|
|
4571
|
+
*
|
|
4572
|
+
* | 视频属性 | 分辨率(宽×高) | 帧率(fps) |
|
|
4573
|
+
* | -------- | --------------- | ----------- |
|
|
4574
|
+
* | "480p" | 640 × 480 | 5 |
|
|
4575
|
+
* | "480p_1" | 640 × 480 | 5 |
|
|
4576
|
+
* | "480p_2" | 640 × 480 | 30 |
|
|
4577
|
+
* | "480p_3" | 640 × 480 | 15 |
|
|
4578
|
+
* | "720p" | 1280 × 720 | 5 |
|
|
4579
|
+
* | "720p_1" | 1280 × 720 | 5 |
|
|
4580
|
+
* | "720p_2" | 1280 × 720 | 30 |
|
|
4581
|
+
* | "720p_3" | 1280 × 720 | 15 |
|
|
4582
|
+
* | "720p_auto" <sup>①</sup> | 1280 × 720 | 30 |
|
|
4583
|
+
* | "1080p" | 1920 × 1080 | 5 |
|
|
4584
|
+
* | "1080p_1" | 1920 × 1080 | 5 |
|
|
4585
|
+
* | "1080p_2" | 1920 × 1080 | 30 |
|
|
4586
|
+
* | "1080p_3" | 1920 × 1080 | 15 |
|
|
4587
|
+
*
|
|
4588
|
+
* > <sup>①</sup> `"720p_auto"` 仅推荐在 Safari 上设置,用于确保能够动态调整编码分辨率,详见[发版说明](https://doc.shengwang.cn/doc/rtc/javascript/overview/release-notes)。
|
|
4589
|
+
*
|
|
4590
|
+
*/
|
|
4591
|
+
/** @en
|
|
4592
|
+
* The preset video encoder configurations for screen sharing.
|
|
4593
|
+
*
|
|
4594
|
+
* You can pass the preset video encoder configurations when calling [AgoraRTC.createScreenVideoTrack]{@link IAgoraRTC.createScreenVideoTrack}.
|
|
4595
|
+
*
|
|
4596
|
+
* The following table lists all the preset video profiles for screen sharing.
|
|
4597
|
+
*
|
|
4598
|
+
* | Video Profile | Resolution (Width×Height) | Frame Rate (fps) |
|
|
4599
|
+
* | -------- | --------------- | ----------- |
|
|
4600
|
+
* | "480p" | 640 × 480 | 5 |
|
|
4601
|
+
* | "480p_1" | 640 × 480 | 5 |
|
|
4602
|
+
* | "480p_2" | 640 × 480 | 30 |
|
|
4603
|
+
* | "480p_3" | 640 × 480 | 15 |
|
|
4604
|
+
* | "720p" | 1280 × 720 | 5 |
|
|
4605
|
+
* | "720p_1" | 1280 × 720 | 5 |
|
|
4606
|
+
* | "720p_2" | 1280 × 720 | 30 |
|
|
4607
|
+
* | "720p_3" | 1280 × 720 | 15 |
|
|
4608
|
+
* | "720p_auto" <sup>①</sup> | 1280 × 720 | 30 |
|
|
4609
|
+
* | "1080p" | 1920 × 1080 | 5 |
|
|
4610
|
+
* | "1080p_1" | 1920 × 1080 | 5 |
|
|
4611
|
+
* | "1080p_2" | 1920 × 1080 | 30 |
|
|
4612
|
+
* | "1080p_3" | 1920 × 1080 | 15 |
|
|
4613
|
+
*
|
|
4614
|
+
* > <sup>①</sup> `"720p_auto"` is only recommended to be set on Safari to ensure dynamic adjustment of the encoding resolution. For details, see the release notes.
|
|
4615
|
+
*/
|
|
4616
|
+
export declare type ScreenEncoderConfigurationPreset = keyof typeof SUPPORT_SCREEN_ENCODER_CONFIG_LIST;
|
|
4617
|
+
|
|
4618
|
+
/**
|
|
4619
|
+
* 屏幕共享源的类型。
|
|
4620
|
+
* - `"screen"`: 共享屏幕。
|
|
4621
|
+
* - `"application"`: 共享某一个 app 的所有窗口。
|
|
4622
|
+
* - `"window"`: 共享某一个 app 的某一个窗口。
|
|
4623
|
+
* @public
|
|
4624
|
+
*/
|
|
4625
|
+
/** @en
|
|
4626
|
+
* The type of the source for screen sharing.
|
|
4627
|
+
* - `"screen"`: Sharing the whole screen.
|
|
4628
|
+
* - `"application"`: Sharing all windows of an app.
|
|
4629
|
+
* - `"window"`: Sharing a window of an app.
|
|
4630
|
+
*/
|
|
4631
|
+
export declare type ScreenSourceType = "screen" | "window" | "application";
|
|
4632
|
+
|
|
4633
|
+
/**
|
|
4634
|
+
* 创建屏幕共享视频轨道时的配置对象,用于 [AgoraRTC.createScreenVideoTrack]{@link IAgoraRTC.createScreenVideoTrack}。
|
|
4635
|
+
*/
|
|
4636
|
+
/** @en
|
|
4637
|
+
* Configurations for the video track for screen sharing. Set these configurations when calling [AgoraRTC.createScreenVideoTrack]{@link IAgoraRTC.createScreenVideoTrack}.
|
|
4638
|
+
*/
|
|
4639
|
+
export declare interface ScreenVideoTrackInitConfig {
|
|
4640
|
+
/**
|
|
4641
|
+
* 控制屏幕共享视频的编码配置。
|
|
4642
|
+
*
|
|
4643
|
+
* 你可以通过以下方式设置该属性:
|
|
4644
|
+
* - 通过 [[ScreenEncoderConfigurationPreset]] 传入 SDK 内置的编码配置。
|
|
4645
|
+
* - 通过传入一个 [[VideoEncoderConfiguration]] 对象来自定义视频编码配置。
|
|
4646
|
+
* - 不传或留空,使用 SDK 的默认值 `"1080p_2"`(分辨率 1920 × 1080、帧率 30 fps、码率 3000 Kbps)。
|
|
1621
4647
|
*/
|
|
1622
4648
|
/** @en
|
|
1623
|
-
* The
|
|
4649
|
+
* The video encoder configurations for screen sharing.
|
|
4650
|
+
*
|
|
4651
|
+
* You can set the video encoder configurations in either of the following ways:
|
|
4652
|
+
* - Pass the preset video encoder configurations by using [[ScreenEncoderConfigurationPreset]].
|
|
4653
|
+
* - Pass your customized video encoder configurations by using [[VideoEncoderConfiguration]].
|
|
4654
|
+
* - Leave this property empty to use the SDK's default value, `"1080p_2"` (resolution: 1920 × 1080, frame rate: 30 fps, bitrate: 3000 Kbps).
|
|
1624
4655
|
*/
|
|
1625
|
-
|
|
4656
|
+
encoderConfig?: VideoEncoderConfiguration | ScreenEncoderConfigurationPreset;
|
|
1626
4657
|
/**
|
|
1627
|
-
*
|
|
4658
|
+
* 使用 Electron 屏幕共享时,传入 `sourceId`。
|
|
1628
4659
|
*/
|
|
1629
4660
|
/** @en
|
|
1630
|
-
* The
|
|
4661
|
+
* The `sourceId` when you share the screen through Electron.
|
|
1631
4662
|
*/
|
|
1632
|
-
|
|
4663
|
+
electronScreenSourceId?: string;
|
|
1633
4664
|
/**
|
|
1634
|
-
*
|
|
4665
|
+
* 使用 Chrome 浏览器插件进行屏幕共享时,传入插件的 ID。
|
|
1635
4666
|
*/
|
|
1636
4667
|
/** @en
|
|
1637
|
-
* The
|
|
4668
|
+
* The `extensionId` when you share the screen with a Chrome extension.
|
|
1638
4669
|
*/
|
|
1639
|
-
|
|
4670
|
+
extensionId?: string;
|
|
1640
4671
|
/**
|
|
1641
|
-
*
|
|
4672
|
+
* @deprecated
|
|
4673
|
+
*
|
|
4674
|
+
* 自 v4.17.1 起废弃,请改用 {@link displaySurface}。
|
|
4675
|
+
*
|
|
4676
|
+
* 屏幕共享源的类型。
|
|
1642
4677
|
*/
|
|
1643
4678
|
/** @en
|
|
1644
|
-
*
|
|
4679
|
+
*
|
|
4680
|
+
* @deprecated from v4.17.1. Use {@link displaySurface} instead.
|
|
4681
|
+
*
|
|
4682
|
+
* The type of the source for screen sharing.
|
|
1645
4683
|
*/
|
|
1646
|
-
|
|
4684
|
+
screenSourceType?: ScreenSourceType;
|
|
1647
4685
|
/**
|
|
1648
|
-
*
|
|
4686
|
+
* @自从
|
|
4687
|
+
* <br>   *4.0.0*
|
|
4688
|
+
*
|
|
4689
|
+
* 传输优化模式。设置该值后,SDK 会自动调整码率配置以及使用不同的回退策略。
|
|
4690
|
+
* - `"motion"`: 流畅优先。
|
|
4691
|
+
* - SDK 不会启用最小码率策略。遭遇网络波动时,发送端会降低码率来确保接收端的视频画面不会出现中断和卡顿。
|
|
4692
|
+
* - 大部分情况下,SDK 不会降低帧率,但是可能会降低发送分辨率。
|
|
4693
|
+
* - `"detail"`: (默认)清晰优先。
|
|
4694
|
+
* - SDK 会自动根据你的采集分辨率和帧率设定一个最小码率。即使遭遇网络波动,发送码率也不会低于这个值,从而确保清晰的视频画面。
|
|
4695
|
+
* - 大部分情况下,SDK 不会降低发送分辨率,但是可能会降低帧率。
|
|
4696
|
+
*
|
|
4697
|
+
* > 注意事项:该方法只支持 Chrome 浏览器。
|
|
1649
4698
|
*/
|
|
1650
4699
|
/** @en
|
|
1651
|
-
*
|
|
4700
|
+
* @since
|
|
4701
|
+
* <br>   *4.0.0*
|
|
4702
|
+
*
|
|
4703
|
+
* Transmission optimization mode. Whether to prioritize video quality or smoothness:
|
|
4704
|
+
* - `"detail"`: (Default) Prioritizes video quality.
|
|
4705
|
+
* - The SDK ensures high-quality images by automatically calculating a minimum bitrate based on the capturing resolution and frame rate. No matter how poor the network condition is, the sending bitrate will never be lower than the minimum value.
|
|
4706
|
+
* - In most cases, the SDK does not reduce the sending resolution, but may reduce the frame rate.
|
|
4707
|
+
* - `"motion"`: Prioritizes video smoothness.
|
|
4708
|
+
* - In poor network conditions, the SDK reduces the sending bitrate to minimize video freezes.
|
|
4709
|
+
* - In most cases, the SDK does not reduce the frame rate, but may reduce the sending resolution.
|
|
4710
|
+
*
|
|
4711
|
+
* > Note: This method is only supported on Chrome.
|
|
1652
4712
|
*/
|
|
1653
|
-
|
|
4713
|
+
optimizationMode?: "motion" | "detail";
|
|
1654
4714
|
/**
|
|
1655
|
-
*
|
|
4715
|
+
* @ignore
|
|
4716
|
+
*
|
|
4717
|
+
* @自从
|
|
4718
|
+
* <br>   *4.18.0*
|
|
4719
|
+
*
|
|
4720
|
+
* SVC (可伸缩视频编码)配置。
|
|
4721
|
+
*
|
|
4722
|
+
* 你可以通过 {@link SVCConfigurationPreset} 传入 SDK 预设的 SVC 编码配置,也可以通过 {@link SVCConfiguration} 传入自定义的 SVC 编码配置。
|
|
1656
4723
|
*/
|
|
1657
4724
|
/** @en
|
|
1658
|
-
*
|
|
4725
|
+
* @ignore
|
|
4726
|
+
*
|
|
4727
|
+
* @since
|
|
4728
|
+
* <br>   *4.18.0*
|
|
4729
|
+
*
|
|
4730
|
+
* Configurations for Scalable Video Coding (SVC).
|
|
4731
|
+
*
|
|
4732
|
+
* You can set the configurations using one of the following options:
|
|
4733
|
+
* - Use the preset SVC configurations provided by the SDK through {@link SVCConfigurationPreset}.
|
|
4734
|
+
* - Use your custom SVC configurations through {@link SVCConfiguration}.
|
|
1659
4735
|
*/
|
|
1660
|
-
|
|
4736
|
+
scalabiltyMode?: SVCConfiguration | SVCConfigurationPreset;
|
|
1661
4737
|
/**
|
|
1662
|
-
*
|
|
4738
|
+
* @自从
|
|
4739
|
+
* <br>   *4.17.1*
|
|
4740
|
+
*
|
|
4741
|
+
* 默认选中的共享内容类型,支持设为标签页、应用窗口(如下图)、或屏幕。详见 [displaySurface](https://developer.chrome.com/docs/web-platform/screen-sharing-controls/#displaySurface)。
|
|
4742
|
+
*
|
|
4743
|
+
* 
|
|
4744
|
+
*
|
|
4745
|
+
* > 注意事项:该属性仅支持 Chrome 107 及以上版本、Edge 107 及以上版本。
|
|
4746
|
+
*
|
|
1663
4747
|
*/
|
|
1664
4748
|
/** @en
|
|
1665
|
-
*
|
|
4749
|
+
*
|
|
4750
|
+
* @since
|
|
4751
|
+
* <br>   *4.17.1*
|
|
4752
|
+
*
|
|
4753
|
+
* The pre-selected pane in the media picker. See [displaySurface](https://developer.chrome.com/docs/web-platform/screen-sharing-controls/#displaySurface) for details.
|
|
4754
|
+
*
|
|
4755
|
+
* > Note: This property is supported on Chrome 107 and later, as well as Edge 107 and later.
|
|
1666
4756
|
*/
|
|
1667
|
-
|
|
4757
|
+
displaySurface?: "browser" | "window" | "monitor";
|
|
1668
4758
|
/**
|
|
1669
|
-
*
|
|
4759
|
+
* @自从
|
|
4760
|
+
* <br>   *4.17.1*
|
|
4761
|
+
*
|
|
4762
|
+
* 是否允许用户共享当前标签页:
|
|
4763
|
+
* - `"include"`:(默认)允许用户共享当前标签页。
|
|
4764
|
+
* - `"exclude"`:禁止用户共享当前标签页。
|
|
4765
|
+
*
|
|
4766
|
+
* 详见 [selfBrowserSurface](https://developer.chrome.com/docs/web-platform/screen-sharing-controls/#selfBrowserSurface)。
|
|
4767
|
+
*
|
|
4768
|
+
* > 注意事项:
|
|
4769
|
+
* > - Chrome 107 上该属性的默认值为 `"exclude"`,但 SDK 为保证兼容性将默认值改为了 `"include"`,以免用户升级到 Chrome 107 后无法共享当前标签页。
|
|
4770
|
+
* > - 该属性仅支持 Chrome 107 及以上版本、Edge 107 及以上版本。
|
|
1670
4771
|
*/
|
|
1671
4772
|
/** @en
|
|
1672
|
-
*
|
|
4773
|
+
*
|
|
4774
|
+
* @since
|
|
4775
|
+
* <br>   *4.17.1*
|
|
4776
|
+
*
|
|
4777
|
+
* Whether to allow the user to share the current tab:
|
|
4778
|
+
* - `"include"`: (Default) Allows the user to share the current tab.
|
|
4779
|
+
* - `"exclude"`: Prevents the user from sharing the current tab.
|
|
4780
|
+
*
|
|
4781
|
+
* See [displaySurface](https://developer.chrome.com/docs/web-platform/screen-sharing-controls/#displaySurface) for details.
|
|
4782
|
+
*
|
|
4783
|
+
* > Note:
|
|
4784
|
+
* > - This property is defaulted to `"exclude"` on Chrome 107. For better compatibility with earlier versions, the SDK changes the default value to "include", which ensures that users can still share the current tab after upgrading to Chrome 107.
|
|
4785
|
+
* > - This property is supported on Chrome 107 and later, as well as Edge 107 and later.
|
|
1673
4786
|
*/
|
|
1674
|
-
|
|
4787
|
+
selfBrowserSurface?: "include" | "exclude";
|
|
1675
4788
|
/**
|
|
1676
|
-
*
|
|
4789
|
+
* @自从
|
|
4790
|
+
* <br>   *4.17.1*
|
|
4791
|
+
*
|
|
4792
|
+
* 是否允许用户动态切换共享的标签页:
|
|
4793
|
+
* - `"include"`:(默认)允许用户动态切换共享的标签页。
|
|
4794
|
+
* - `"exclude"`:禁止用户动态切换共享的标签页。
|
|
4795
|
+
*
|
|
4796
|
+
* 详见 [surfaceSwitching](https://developer.chrome.com/docs/web-platform/screen-sharing-controls/#surfaceSwitching)。
|
|
4797
|
+
*
|
|
4798
|
+
* > 注意事项:该属性仅支持 Chrome 107 及以上版本、Edge 107 及以上版本。
|
|
1677
4799
|
*/
|
|
1678
4800
|
/** @en
|
|
1679
|
-
*
|
|
4801
|
+
*
|
|
4802
|
+
* @since
|
|
4803
|
+
* <br>   *4.17.1*
|
|
4804
|
+
*
|
|
4805
|
+
* Whether to allow the user to dynamically switch between shared tabs:
|
|
4806
|
+
* - `"include"`: (Default) The user can dynamically switch between shared tabs.
|
|
4807
|
+
* - `"exclude"`: The user cannot dynamically switch between shared tabs.
|
|
4808
|
+
*
|
|
4809
|
+
* See [surfaceSwitching](https://developer.chrome.com/docs/web-platform/screen-sharing-controls/#surfaceSwitching) for details.
|
|
4810
|
+
*
|
|
4811
|
+
* > Note: This property is supported on Chrome 107 and later, as well as Edge 107 and later.
|
|
1680
4812
|
*/
|
|
1681
|
-
|
|
4813
|
+
surfaceSwitching?: "include" | "exclude";
|
|
1682
4814
|
/**
|
|
1683
|
-
*
|
|
4815
|
+
* @自从
|
|
4816
|
+
* <br>   *4.17.1*
|
|
4817
|
+
*
|
|
4818
|
+
* 是否允许采集系统音频:
|
|
4819
|
+
* - `"include"`:(默认)允许采集系统音频。
|
|
4820
|
+
* - `"exclude"`:禁止采集系统音频。
|
|
4821
|
+
*
|
|
4822
|
+
* 详见 [systemAudio](https://developer.chrome.com/docs/web-platform/screen-sharing-controls/#systemAudio)。
|
|
4823
|
+
*
|
|
4824
|
+
* > 注意事项:该属性仅支持 Windows 设备上的 Chrome 105 及以上版本、Edge 105 及以上版本。
|
|
1684
4825
|
*/
|
|
1685
4826
|
/** @en
|
|
1686
|
-
*
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
*
|
|
1691
|
-
*
|
|
4827
|
+
*
|
|
4828
|
+
* @since
|
|
4829
|
+
* <br>   *4.17.1*
|
|
4830
|
+
*
|
|
4831
|
+
* Whether to capture system audio:
|
|
4832
|
+
* - `"include"`: (Default) Captures system audio.
|
|
4833
|
+
* - `"exclude"`: Avoids capturing system audio
|
|
4834
|
+
*
|
|
4835
|
+
* See [systemAudio](https://developer.chrome.com/docs/web-platform/screen-sharing-controls/#systemAudio) for details.
|
|
4836
|
+
*
|
|
4837
|
+
* > Note: This property is supported on Chrome 105 and later (Windows only), as well as Edge 105 and later (Windows only).
|
|
1692
4838
|
*/
|
|
1693
|
-
|
|
1694
|
-
}
|
|
1695
|
-
|
|
1696
|
-
export declare function removeTrack(track: Track): void;
|
|
1697
|
-
|
|
1698
|
-
export declare function requestAutoplayGesture(): void;
|
|
1699
|
-
|
|
1700
|
-
export declare interface Resolution {
|
|
1701
|
-
width: number;
|
|
1702
|
-
height: number;
|
|
4839
|
+
systemAudio?: "include" | "exclude";
|
|
1703
4840
|
}
|
|
1704
4841
|
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
* 防止 SDK Device 模块和用户同时触发 GUM 导致用户 GUN 返回的 track 被 mute。
|
|
1711
|
-
*/
|
|
1712
|
-
export declare const SAFARI_GLOBAL_GUM_LOCK: PromiseMutex;
|
|
4842
|
+
export declare type SenderConfig = {
|
|
4843
|
+
bitrateMax: number;
|
|
4844
|
+
bitrateMin: number;
|
|
4845
|
+
scaleResolutionDownBy: number;
|
|
4846
|
+
};
|
|
1713
4847
|
|
|
1714
4848
|
/**
|
|
1715
4849
|
* 将节点输入的 AudioBuffer 返回,将节点输出的 AudioBuffer 设置成 silence
|
|
@@ -1736,6 +4870,107 @@ export declare enum StreamType {
|
|
|
1736
4870
|
LOW_STREAM = 1
|
|
1737
4871
|
}
|
|
1738
4872
|
|
|
4873
|
+
export declare const SUPPORT_720P_AUTO_CONFIG_LIST: Required<{
|
|
4874
|
+
scaleResolutionDownBy: number;
|
|
4875
|
+
width: number;
|
|
4876
|
+
height: number;
|
|
4877
|
+
frameRate: number;
|
|
4878
|
+
bitrateMin: number;
|
|
4879
|
+
bitrateMax: number;
|
|
4880
|
+
}>[];
|
|
4881
|
+
|
|
4882
|
+
/** @en
|
|
4883
|
+
* @ignore
|
|
4884
|
+
*/
|
|
4885
|
+
export declare const SUPPORT_SCREEN_ENCODER_CONFIG_LIST: Record<string, VideoEncoderConfiguration>;
|
|
4886
|
+
|
|
4887
|
+
/** @en
|
|
4888
|
+
* @ignore
|
|
4889
|
+
*/
|
|
4890
|
+
export declare const SUPPORT_SVC_CONFIG_LIST: Record<string, SVCConfiguration>;
|
|
4891
|
+
|
|
4892
|
+
/** @en
|
|
4893
|
+
* @ignore
|
|
4894
|
+
*/
|
|
4895
|
+
export declare const SUPPORT_VIDEO_ENCODER_CONFIG_LIST: Record<string, VideoEncoderConfiguration>;
|
|
4896
|
+
|
|
4897
|
+
/**
|
|
4898
|
+
* @ignore
|
|
4899
|
+
* @自从
|
|
4900
|
+
* <br>   *4.18.0*
|
|
4901
|
+
*
|
|
4902
|
+
* 自定义的 SVC 编码配置。
|
|
4903
|
+
*
|
|
4904
|
+
* 你可以在以下方法中传入 `SVCConfiguration` 来控制本地视频的 SVC 编码配置:
|
|
4905
|
+
* - [AgoraRTC.createCameraVideoTrack]{@link IAgoraRTC.createCameraVideoTrack}
|
|
4906
|
+
* - [AgoraRTC.createCustomVideoTrack]{@link IAgoraRTC.createCustomVideoTrack}
|
|
4907
|
+
* - [AgoraRTC.createScreenVideoTrack]{@link IAgoraRTC.createScreenVideoTrack}
|
|
4908
|
+
*/
|
|
4909
|
+
/** @en
|
|
4910
|
+
* @ignore
|
|
4911
|
+
* @since
|
|
4912
|
+
* <br>   *4.18.0*
|
|
4913
|
+
*
|
|
4914
|
+
* Custom SVC encoding configurations.
|
|
4915
|
+
*
|
|
4916
|
+
* You can control the SVC configurations for local video by passing `SVCConfiguration` in the following methods:
|
|
4917
|
+
* - [AgoraRTC.createCameraVideoTrack]{@link IAgoraRTC.createCameraVideoTrack}
|
|
4918
|
+
* - [AgoraRTC.createCustomVideoTrack]{@link IAgoraRTC.createCustomVideoTrack}
|
|
4919
|
+
* - [AgoraRTC.createScreenVideoTrack]{@link IAgoraRTC.createScreenVideoTrack}
|
|
4920
|
+
*/
|
|
4921
|
+
export declare interface SVCConfiguration {
|
|
4922
|
+
/**
|
|
4923
|
+
* SVC 空域层数。
|
|
4924
|
+
*/
|
|
4925
|
+
/** @en
|
|
4926
|
+
* Specifies the number of spatial layer in SVC.
|
|
4927
|
+
*/
|
|
4928
|
+
numSpatialLayers: 1 | 2 | 3;
|
|
4929
|
+
/**
|
|
4930
|
+
* SVC 时域层数。
|
|
4931
|
+
*/
|
|
4932
|
+
/** @en
|
|
4933
|
+
* Specifies the number of temporal layer in SVC.
|
|
4934
|
+
*/
|
|
4935
|
+
numTemporalLayers: 1 | 3;
|
|
4936
|
+
}
|
|
4937
|
+
|
|
4938
|
+
/**
|
|
4939
|
+
* @ignore
|
|
4940
|
+
*
|
|
4941
|
+
* @自从
|
|
4942
|
+
* <br>   *4.18.0*
|
|
4943
|
+
*
|
|
4944
|
+
* SDK 预设的 SVC 编码配置:
|
|
4945
|
+
* - `"1SL1TL"`: 空域层数为 1,时域层数为 1。
|
|
4946
|
+
* - `"3SL3TL"`: 空域层数为 3,时域层数为 3。
|
|
4947
|
+
* - `"2SL3TL"`: 空域层数为 2,时域层数为 3。
|
|
4948
|
+
*
|
|
4949
|
+
* 你可以在以下方法中传入这些预设值,来控制本地视频的 SVC 编码配置:
|
|
4950
|
+
* - [AgoraRTC.createCameraVideoTrack]{@link IAgoraRTC.createCameraVideoTrack}
|
|
4951
|
+
* - [AgoraRTC.createCustomVideoTrack]{@link IAgoraRTC.createCustomVideoTrack}
|
|
4952
|
+
* - [AgoraRTC.createScreenVideoTrack]{@link IAgoraRTC.createScreenVideoTrack}
|
|
4953
|
+
*
|
|
4954
|
+
*/
|
|
4955
|
+
/** @en
|
|
4956
|
+
* @ignore
|
|
4957
|
+
*
|
|
4958
|
+
* @since
|
|
4959
|
+
* <br>   *4.18.0*
|
|
4960
|
+
*
|
|
4961
|
+
* The preset SVC configurations provided by the SDK.
|
|
4962
|
+
* - `"1SL1TL"`: 1 spatial layer, 1 temporal layer.
|
|
4963
|
+
* - `"3SL3TL"`: 3 spatial layers, 3 temporal layers.
|
|
4964
|
+
* - `"2SL3TL"`: 2 spatial layers, 3 temporal layers.
|
|
4965
|
+
*
|
|
4966
|
+
* You can control the SVC configurations for local video by passing these preset values in the following methods:
|
|
4967
|
+
* - [AgoraRTC.createCameraVideoTrack]{@link IAgoraRTC.createCameraVideoTrack}
|
|
4968
|
+
* - [AgoraRTC.createCustomVideoTrack]{@link IAgoraRTC.createCustomVideoTrack}
|
|
4969
|
+
* - [AgoraRTC.createScreenVideoTrack]{@link IAgoraRTC.createScreenVideoTrack}
|
|
4970
|
+
*
|
|
4971
|
+
*/
|
|
4972
|
+
export declare type SVCConfigurationPreset = keyof typeof SUPPORT_SVC_CONFIG_LIST;
|
|
4973
|
+
|
|
1739
4974
|
export declare abstract class Track extends EventEmitter implements ITrack {
|
|
1740
4975
|
abstract readonly trackMediaType: "audio" | "video";
|
|
1741
4976
|
private _ID;
|
|
@@ -1748,7 +4983,9 @@ export declare abstract class Track extends EventEmitter implements ITrack {
|
|
|
1748
4983
|
/** 原始的 Track 对象,来自于采集/用户传入/订阅返回 */
|
|
1749
4984
|
_originMediaStreamTrack: MediaStreamTrack;
|
|
1750
4985
|
/** 用于播放和发布的 Track 对象,可能被各种模块修改,一般来说等于 `_originMediaStreamTrack` */
|
|
1751
|
-
|
|
4986
|
+
mediaStreamTrack: MediaStreamTrack;
|
|
4987
|
+
set _mediaStreamTrack(track: MediaStreamTrack);
|
|
4988
|
+
get _mediaStreamTrack(): MediaStreamTrack;
|
|
1752
4989
|
/** 提供给外部插件以同步数据 */
|
|
1753
4990
|
_external: ExternalMethods;
|
|
1754
4991
|
constructor(track: MediaStreamTrack, trackId?: string);
|
|
@@ -1767,7 +5004,7 @@ export declare enum TrackEvents {
|
|
|
1767
5004
|
TRANSCEIVER_UPDATED = "transceiver-updated",
|
|
1768
5005
|
SEI_TO_SEND = "sei-to-send",
|
|
1769
5006
|
SEI_RECEIVED = "sei-received",
|
|
1770
|
-
|
|
5007
|
+
TRACK_UPDATED = "track-updated"
|
|
1771
5008
|
}
|
|
1772
5009
|
|
|
1773
5010
|
/**
|
|
@@ -1783,7 +5020,7 @@ export declare enum TrackHint {
|
|
|
1783
5020
|
}
|
|
1784
5021
|
|
|
1785
5022
|
export declare enum TrackInternalEvent {
|
|
1786
|
-
NEED_RENEGOTIATE = "@need_renegotiate"
|
|
5023
|
+
NEED_RENEGOTIATE = "@need_renegotiate",//deprecated
|
|
1787
5024
|
NEED_REPLACE_TRACK = "@need_replace_track",
|
|
1788
5025
|
NEED_REPLACE_MIXING_TRACK = "@need_replace_mixing_track",
|
|
1789
5026
|
NEED_CLOSE = "@need_close",
|
|
@@ -1794,8 +5031,9 @@ export declare enum TrackInternalEvent {
|
|
|
1794
5031
|
GET_STATS = "@get_stats",
|
|
1795
5032
|
GET_RTC_STATS = "@get_rtc_stats",
|
|
1796
5033
|
GET_LOW_VIDEO_TRACK = "@get_low_video_track",
|
|
1797
|
-
NEED_RESET_REMOTE_SDP = "@need_reset_remote_sdp"
|
|
5034
|
+
NEED_RESET_REMOTE_SDP = "@need_reset_remote_sdp",//deprecated
|
|
1798
5035
|
NEED_UPDATE_VIDEO_ENCODER = "@need_update_video_encoder",
|
|
5036
|
+
NEED_UPDATE_VIDEO_SEND_PARAMETERS = "@need_update_video_send_parameters",
|
|
1799
5037
|
NEED_MUTE_TRACK = "@need_mute_track",
|
|
1800
5038
|
NEED_UNMUTE_TRACK = "@need_unmute_track"
|
|
1801
5039
|
}
|
|
@@ -1808,6 +5046,208 @@ export declare interface UsageRegistry {
|
|
|
1808
5046
|
cb: () => Usage | Promise<Usage>;
|
|
1809
5047
|
}
|
|
1810
5048
|
|
|
5049
|
+
/**
|
|
5050
|
+
* 定义视频编码参数的配置对象。
|
|
5051
|
+
*
|
|
5052
|
+
* 你可以在 [AgoraRTC.createCameraVideoTrack]{@link IAgoraRTC.createCameraVideoTrack} 或者 [AgoraRTC.createScreenVideoTrack]{@link IAgoraRTC.createScreenVideoTrack} 方法中传入自定义的视频编码配置。
|
|
5053
|
+
*
|
|
5054
|
+
* SDK 提供了一些预设视频编码配置,详见 [[VideoEncoderConfigurationPreset]]。
|
|
5055
|
+
*
|
|
5056
|
+
* > 受操作系统、浏览器影响,实际的码率可能会和设置的取值范围不同。我们建议将码率设置在 100 Kbps 到 5000 Kbps 之间。
|
|
5057
|
+
*
|
|
5058
|
+
* @public
|
|
5059
|
+
*/
|
|
5060
|
+
/** @en
|
|
5061
|
+
* `VideoEncoderConfiguration` is the interface that defines the video encoder configurations.
|
|
5062
|
+
*
|
|
5063
|
+
* You can customize the video encoder configurations when calling [AgoraRTC.createCameraVideoTrack]{@link IAgoraRTC.createCameraVideoTrack} or [AgoraRTC.createScreenVideoTrack]{@link IAgoraRTC.createScreenVideoTrack}.
|
|
5064
|
+
*
|
|
5065
|
+
* The SDK provides the preset video encoder configurations. For more information, see [[VideoEncoderConfigurationPreset]].
|
|
5066
|
+
*
|
|
5067
|
+
* > The actual bitrate may differ slightly from the value you set due to the limitations of the operation system or the web browser. Agora recommends setting the bitrate between 100 Kbps and 5000 Kbps.
|
|
5068
|
+
*/
|
|
5069
|
+
export declare interface VideoEncoderConfiguration {
|
|
5070
|
+
/**
|
|
5071
|
+
* 视频的分辨率宽。
|
|
5072
|
+
*
|
|
5073
|
+
* 支持传入 `number`,或一个约束对象,如 `{ max: 1280, min: 720 }`。
|
|
5074
|
+
*
|
|
5075
|
+
* 关于约束对象的详细说明可以参考 [ConstrainLong]{@link ConstrainLong}。
|
|
5076
|
+
*/
|
|
5077
|
+
/** @en
|
|
5078
|
+
* Width of the video.
|
|
5079
|
+
*
|
|
5080
|
+
* You can pass a `number`, or a constraint such as `{ max: 1280, min: 720 }`.
|
|
5081
|
+
*
|
|
5082
|
+
* For more details about the constraint, see [ConstrainLong]{@link ConstrainLong}.
|
|
5083
|
+
*/
|
|
5084
|
+
width?: number | ConstrainLong;
|
|
5085
|
+
/**
|
|
5086
|
+
* 视频的分辨率高。
|
|
5087
|
+
*
|
|
5088
|
+
* 支持传入 `number`,或一个约束对象,如 `{ max: 1280, min: 720 }`。
|
|
5089
|
+
*
|
|
5090
|
+
* 关于约束对象的详细说明可以参考 [ConstrainLong]{@link ConstrainLong}。
|
|
5091
|
+
*/
|
|
5092
|
+
/** @en
|
|
5093
|
+
* Height of the video.
|
|
5094
|
+
*
|
|
5095
|
+
* You can pass a `number`, or a constraint such as `{ max: 1280, min: 720 }`.
|
|
5096
|
+
*
|
|
5097
|
+
* For more details about the constraint, see [ConstrainLong]{@link ConstrainLong}.
|
|
5098
|
+
*/
|
|
5099
|
+
height?: number | ConstrainLong;
|
|
5100
|
+
/**
|
|
5101
|
+
* 视频帧率,单位为 fps。
|
|
5102
|
+
*
|
|
5103
|
+
* 支持传入 `number`,或一个约束对象,如 `{ max: 30, min: 5 }`。
|
|
5104
|
+
*
|
|
5105
|
+
* 关于约束对象的详细说明可以参考 [ConstrainLong]{@link ConstrainLong}。
|
|
5106
|
+
*/
|
|
5107
|
+
/** @en
|
|
5108
|
+
* Frame rate of the video (fps).
|
|
5109
|
+
*
|
|
5110
|
+
* You can pass a `number`, or a constraint such as `{ max: 30, min: 5 }`.
|
|
5111
|
+
*
|
|
5112
|
+
* For details about the constraint, see [ConstrainLong]{@link ConstrainLong}.
|
|
5113
|
+
*/
|
|
5114
|
+
frameRate?: number | ConstrainLong;
|
|
5115
|
+
/**
|
|
5116
|
+
* 传输过程中的最小码率,单位为 Kbps。
|
|
5117
|
+
*/
|
|
5118
|
+
/** @en
|
|
5119
|
+
* The minimum bitrate of the video (Kbps).
|
|
5120
|
+
*/
|
|
5121
|
+
bitrateMin?: number;
|
|
5122
|
+
/**
|
|
5123
|
+
* 传输过程中的最大码率,单位为 Kbps。
|
|
5124
|
+
*/
|
|
5125
|
+
/** @en
|
|
5126
|
+
* The maximum bitrate of the video (Kbps).
|
|
5127
|
+
*/
|
|
5128
|
+
bitrateMax?: number;
|
|
5129
|
+
/**
|
|
5130
|
+
* @ignore
|
|
5131
|
+
*/
|
|
5132
|
+
/** @en
|
|
5133
|
+
* @ignore
|
|
5134
|
+
*/
|
|
5135
|
+
scaleResolutionDownBy?: number;
|
|
5136
|
+
}
|
|
5137
|
+
|
|
5138
|
+
/**
|
|
5139
|
+
* SDK 预设的 [[VideoEncoderConfiguration]] 配置。
|
|
5140
|
+
*
|
|
5141
|
+
* 你可以在 [AgoraRTC.createCameraVideoTrack]{@link IAgoraRTC.createCameraVideoTrack} 方法中传入预设的视频编码配置。
|
|
5142
|
+
*
|
|
5143
|
+
* 下表列出了 SDK 所有内置的视频属性配置,SDK 默认使用 `"480p_1"`。
|
|
5144
|
+
*
|
|
5145
|
+
* | 视频属性 | 分辨率(宽×高) | 帧率(fps) | Chrome | Firefox | Safari |
|
|
5146
|
+
* | -------- | --------------- | ----------- | ------ | ------- | ------ |
|
|
5147
|
+
* | 120p | 160 × 120 | 15 | ✓ | | |
|
|
5148
|
+
* | 120p_1 | 160 × 120 | 15 | ✓ | | |
|
|
5149
|
+
* | 120p_3 | 120 × 120 | 15 | ✓ | | |
|
|
5150
|
+
* | 180p | 320 × 180 | 15 | ✓ | | |
|
|
5151
|
+
* | 180p_1 | 320 × 180 | 15 | ✓ | | |
|
|
5152
|
+
* | 180p_3 | 180 × 180 | 15 | ✓ | | |
|
|
5153
|
+
* | 180p_4 | 240 × 180 | 15 | ✓ | | |
|
|
5154
|
+
* | 240p | 320 × 240 | 15 | ✓ | | |
|
|
5155
|
+
* | 240p_1 | 320 × 240 | 15 | ✓ | | |
|
|
5156
|
+
* | 240p_3 | 240 × 240 | 15 | ✓ | | |
|
|
5157
|
+
* | 240p_4 | 424 × 240 | 15 | ✓ | | |
|
|
5158
|
+
* | 360p | 640 × 360 | 15 | ✓ | | |
|
|
5159
|
+
* | 360p_1 | 640 × 360 | 15 | ✓ | | |
|
|
5160
|
+
* | 360p_3 | 360 × 360 | 15 | ✓ | | |
|
|
5161
|
+
* | 360p_4 | 640 × 360 | 30 | ✓ | | |
|
|
5162
|
+
* | 360p_6 | 360 × 360 | 30 | ✓ | | |
|
|
5163
|
+
* | 360p_7 | 480 × 360 | 15 | ✓ | | |
|
|
5164
|
+
* | 360p_8 | 480 × 360 | 30 | ✓ | | |
|
|
5165
|
+
* | 360p_9 | 640 × 360 | 15 | ✓ | | |
|
|
5166
|
+
* | 360p_10 | 640 × 360 | 24 | ✓ | | |
|
|
5167
|
+
* | 360p_11 | 640 × 360 | 24 | ✓ | | |
|
|
5168
|
+
* | 480p | 640 × 480 | 15 | ✓ | ✓ | ✓ |
|
|
5169
|
+
* | 480p_1 | 640 × 480 | 15 | ✓ | ✓ | ✓ |
|
|
5170
|
+
* | 480p_2 | 640 × 480 | 30 | ✓ | ✓ | ✓ |
|
|
5171
|
+
* | 480p_3 | 480 × 480 | 15 | ✓ | ✓ | ✓ |
|
|
5172
|
+
* | 480p_4 | 640 × 480 | 30 | ✓ | ✓ | ✓ |
|
|
5173
|
+
* | 480p_6 | 480 × 480 | 30 | ✓ | ✓ | ✓ |
|
|
5174
|
+
* | 480p_8 | 848 × 480 | 15 | ✓ | ✓ | ✓ |
|
|
5175
|
+
* | 480p_9 | 848 × 480 | 30 | ✓ | ✓ | ✓ |
|
|
5176
|
+
* | 480p_10 | 640 × 480 | 10 | ✓ | ✓ | ✓ |
|
|
5177
|
+
* | 720p | 1280 × 720 | 15 | ✓ | ✓ | ✓ |
|
|
5178
|
+
* | 720p_1 | 1280 × 720 | 15 | ✓ | ✓ | ✓ |
|
|
5179
|
+
* | 720p_2 | 1280 × 720 | 30 | ✓ | ✓ | ✓ |
|
|
5180
|
+
* | 720p_3 | 1280 × 720 | 30 | ✓ | ✓ | ✓ |
|
|
5181
|
+
* | 720p_auto <sup>①</sup> | 1280 × 720 | 30 |✓ | ✓ | ✓ |
|
|
5182
|
+
* | 720p_5 | 960 × 720 | 15 | ✓ | ✓ | ✓ |
|
|
5183
|
+
* | 720p_6 | 960 × 720 | 30 | ✓ | ✓ | ✓ |
|
|
5184
|
+
* | 1080p | 1920 × 1080 | 15 | ✓ | | ✓ |
|
|
5185
|
+
* | 1080p_1 | 1920 × 1080 | 15 | ✓ | | ✓ |
|
|
5186
|
+
* | 1080p_2 | 1920 × 1080 | 30 | ✓ | | ✓ |
|
|
5187
|
+
* | 1080p_3 | 1920 × 1080 | 30 | ✓ | | ✓ |
|
|
5188
|
+
* | 1080p_5 | 1920 × 1080 | 60 | ✓ | | ✓ |
|
|
5189
|
+
*
|
|
5190
|
+
* > <sup>①</sup> `"720p_auto"` 仅推荐在 Safari 上设置,用于确保能够动态调整编码分辨率,详见[发版说明](https://doc.shengwang.cn/doc/rtc/javascript/overview/release-notes)。
|
|
5191
|
+
*
|
|
5192
|
+
* @public
|
|
5193
|
+
*/
|
|
5194
|
+
/** @en
|
|
5195
|
+
*
|
|
5196
|
+
* The preset video encoder configurations.
|
|
5197
|
+
*
|
|
5198
|
+
* You can pass the preset video encoder configurations when calling [AgoraRTC.createCameraVideoTrack]{@link IAgoraRTC.createCameraVideoTrack} or [AgoraRTC.createScreenVideoTrack]{@link IAgoraRTC.createScreenVideoTrack}.
|
|
5199
|
+
*
|
|
5200
|
+
* The following table lists all the preset video profiles. The SDK uses `"480p_1"` by default.
|
|
5201
|
+
*
|
|
5202
|
+
* | Video Profile | Resolution (Width×Height) | Frame Rate (fps) | Chrome | Firefox | Safari |
|
|
5203
|
+
* | -------- | --------------- | ----------- | ------ | ------- | ------ |
|
|
5204
|
+
* | 120p | 160 × 120 | 15 | ✓ | | |
|
|
5205
|
+
* | 120p_1 | 160 × 120 | 15 | ✓ | | |
|
|
5206
|
+
* | 120p_3 | 120 × 120 | 15 | ✓ | | |
|
|
5207
|
+
* | 180p | 320 × 180 | 15 | ✓ | | |
|
|
5208
|
+
* | 180p_1 | 320 × 180 | 15 | ✓ | | |
|
|
5209
|
+
* | 180p_3 | 180 × 180 | 15 | ✓ | | |
|
|
5210
|
+
* | 180p_4 | 240 × 180 | 15 | ✓ | | |
|
|
5211
|
+
* | 240p | 320 × 240 | 15 | ✓ | | |
|
|
5212
|
+
* | 240p_1 | 320 × 240 | 15 | ✓ | | |
|
|
5213
|
+
* | 240p_3 | 240 × 240 | 15 | ✓ | | |
|
|
5214
|
+
* | 240p_4 | 424 × 240 | 15 | ✓ | | |
|
|
5215
|
+
* | 360p | 640 × 360 | 15 | ✓ | | |
|
|
5216
|
+
* | 360p_1 | 640 × 360 | 15 | ✓ | | |
|
|
5217
|
+
* | 360p_3 | 360 × 360 | 15 | ✓ | | |
|
|
5218
|
+
* | 360p_4 | 640 × 360 | 30 | ✓ | | |
|
|
5219
|
+
* | 360p_6 | 360 × 360 | 30 | ✓ | | |
|
|
5220
|
+
* | 360p_7 | 480 × 360 | 15 | ✓ | | |
|
|
5221
|
+
* | 360p_8 | 480 × 360 | 30 | ✓ | | |
|
|
5222
|
+
* | 360p_9 | 640 × 360 | 15 | ✓ | | |
|
|
5223
|
+
* | 360p_10 | 640 × 360 | 24 | ✓ | | |
|
|
5224
|
+
* | 360p_11 | 640 × 360 | 24 | ✓ | | |
|
|
5225
|
+
* | 480p | 640 × 480 | 15 | ✓ | ✓ | ✓ |
|
|
5226
|
+
* | 480p_1 | 640 × 480 | 15 | ✓ | ✓ | ✓ |
|
|
5227
|
+
* | 480p_2 | 640 × 480 | 30 | ✓ | ✓ | ✓ |
|
|
5228
|
+
* | 480p_3 | 480 × 480 | 15 | ✓ | ✓ | ✓ |
|
|
5229
|
+
* | 480p_4 | 640 × 480 | 30 | ✓ | ✓ | ✓ |
|
|
5230
|
+
* | 480p_6 | 480 × 480 | 30 | ✓ | ✓ | ✓ |
|
|
5231
|
+
* | 480p_8 | 848 × 480 | 15 | ✓ | ✓ | ✓ |
|
|
5232
|
+
* | 480p_9 | 848 × 480 | 30 | ✓ | ✓ | ✓ |
|
|
5233
|
+
* | 480p_10 | 640 × 480 | 10 | ✓ | ✓ | ✓ |
|
|
5234
|
+
* | 720p | 1280 × 720 | 15 | ✓ | ✓ | ✓ |
|
|
5235
|
+
* | 720p_1 | 1280 × 720 | 15 | ✓ | ✓ | ✓ |
|
|
5236
|
+
* | 720p_2 | 1280 × 720 | 30 | ✓ | ✓ | ✓ |
|
|
5237
|
+
* | 720p_3 | 1280 × 720 | 30 | ✓ | ✓ | ✓ |
|
|
5238
|
+
* | 720p_auto <sup>①</sup> | 1280 × 720 | 30 | ✓ | ✓ | ✓ |
|
|
5239
|
+
* | 720p_5 | 960 × 720 | 15 | ✓ | ✓ | ✓ |
|
|
5240
|
+
* | 720p_6 | 960 × 720 | 30 | ✓ | ✓ | ✓ |
|
|
5241
|
+
* | 1080p | 1920 × 1080 | 15 | ✓ | | ✓ |
|
|
5242
|
+
* | 1080p_1 | 1920 × 1080 | 15 | ✓ | | ✓ |
|
|
5243
|
+
* | 1080p_2 | 1920 × 1080 | 30 | ✓ | | ✓ |
|
|
5244
|
+
* | 1080p_3 | 1920 × 1080 | 30 | ✓ | | ✓ |
|
|
5245
|
+
* | 1080p_5 | 1920 × 1080 | 60 | ✓ | | ✓ |
|
|
5246
|
+
*
|
|
5247
|
+
* > <sup>①</sup> `"720p_auto"` is only recommended to be set on Safari to ensure dynamic adjustment of the encoding resolution. For details, see the release notes.
|
|
5248
|
+
*/
|
|
5249
|
+
export declare type VideoEncoderConfigurationPreset = keyof typeof SUPPORT_VIDEO_ENCODER_CONFIG_LIST;
|
|
5250
|
+
|
|
1811
5251
|
/**
|
|
1812
5252
|
* @internal
|
|
1813
5253
|
*/
|
|
@@ -1829,6 +5269,8 @@ declare class VideoPlayer {
|
|
|
1829
5269
|
protected videoTrack?: MediaStreamTrack;
|
|
1830
5270
|
protected videoElement: HTMLVideoElement;
|
|
1831
5271
|
protected cacheVideoElement?: HTMLVideoElement;
|
|
5272
|
+
private renderStats?;
|
|
5273
|
+
get rendFrameRate(): number;
|
|
1832
5274
|
get videoElementStatus(): MediaElementStatus;
|
|
1833
5275
|
set videoElementStatus(status: MediaElementStatus);
|
|
1834
5276
|
get videoState(): VideoState;
|