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