@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.
@@ -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';
@@ -109,53 +106,6 @@ export declare enum AUDIO_CONTEXT_EVENT {
109
106
  STATE_CHANGE = "state-change"
110
107
  }
111
108
 
112
- /**
113
- * @ignore
114
- */
115
- export declare const AUDIO_ENCODER_CONFIG_SETTINGS: {
116
- speech_low_quality: AudioEncoderConfiguration;
117
- speech_standard: AudioEncoderConfiguration;
118
- music_standard: AudioEncoderConfiguration;
119
- standard_stereo: AudioEncoderConfiguration;
120
- high_quality: AudioEncoderConfiguration;
121
- high_quality_stereo: AudioEncoderConfiguration;
122
- };
123
-
124
- export declare enum AUDIO_TRACK_EVENT {
125
- UPDATE_TRACK_SOURCE = "update-track-source"
126
- }
127
-
128
- declare class AudioBufferSource extends AudioSource {
129
- private audioBuffer;
130
- protected sourceNode?: AudioBufferSourceNode;
131
- private startPlayTime;
132
- private startPlayOffset;
133
- private pausePlayTime;
134
- private options;
135
- private currentLoopCount;
136
- private currentPlaybackSpeed;
137
- set currentState(state: AudioSourceState);
138
- get currentState(): AudioSourceState;
139
- private _currentState;
140
- constructor(buffer: AudioBuffer, options?: AudioSourceOptions);
141
- createWebAudioDiagram(): GainNode;
142
- get duration(): number;
143
- get playbackSpeed(): number;
144
- get currentTime(): number;
145
- updateOptions(options: AudioSourceOptions): void;
146
- startProcessAudioBuffer(): void;
147
- pauseProcessAudioBuffer(): void;
148
- seekAudioBuffer(time: number): void;
149
- resumeProcessAudioBuffer(): void;
150
- stopProcessAudioBuffer(): void;
151
- destroy(): void;
152
- setAudioBufferPlaybackSpeed(speed: number): void;
153
- private startSourceNode;
154
- private createSourceNode;
155
- private handleSourceNodeEnded;
156
- private reset;
157
- }
158
-
159
109
  export declare const audioContextState: AudioState;
160
110
 
161
111
  declare class AudioElementPlayCenter {
@@ -180,59 +130,6 @@ declare class AudioElementPlayCenter {
180
130
 
181
131
  export declare const audioElementPlayCenter: AudioElementPlayCenter;
182
132
 
183
- /**
184
- *
185
- * `AudioEncoderConfiguration` is the interface that defines the audio encoder configurations.
186
- *
187
- * 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}.
188
- */
189
- export declare interface AudioEncoderConfiguration {
190
- /**
191
- * Sample rate of the audio (Hz).
192
- */
193
- sampleRate?: number;
194
- /**
195
- * Sample size of the audio.
196
- */
197
- sampleSize?: number;
198
- /**
199
- * Whether to enable stereo.
200
- */
201
- stereo?: boolean;
202
- /**
203
- * Bitrate of the audio (Kbps).
204
- */
205
- bitrate?: number;
206
- }
207
-
208
- /**
209
- * The preset audio encoder configurations.
210
- *
211
- * You can pass the preset video encoder configurations when calling the following methods:
212
- * - [AgoraRTC.createCustomAudioTrack]{@link IAgoraRTC.createCustomAudioTrack}
213
- * - [AgoraRTC.createMicrophoneAudioTrack]{@link IAgoraRTC.createMicrophoneAudioTrack}
214
- * - [AgoraRTC.createBufferSourceAudioTrack]{@link IAgoraRTC.createBufferSourceAudioTrack}
215
- *
216
- * The following table lists all the preset audio profiles. The SDK uses `"music_standard"` by default.
217
- *
218
- * | Audio Profile | Configurations |
219
- * | -------- | --------------- |
220
- * |`"speech_low_quality"`|Sample rate 16 kHz, mono, encoding rate 24 Kbps|
221
- * |`"speech_standard"`|Sample rate 32 kHz, mono, encoding rate 24 Kbps|
222
- * |`"music_standard"`|Sample rate 48 kHz, mono, encoding rate 40 Kbps|
223
- * |`"standard_stereo"`|Sample rate 48 kHz, stereo, encoding rate 64 Kbps|
224
- * |`"high_quality"`|Sample rate 48 kHz, mono, encoding rate 128 Kbps|
225
- * |`"high_quality_stereo"`|Sample rate 48 kHz, stereo, encoding rate 192 Kbps| Kbps.
226
- * @public
227
- */
228
- export declare type AudioEncoderConfigurationPreset = keyof typeof AUDIO_ENCODER_CONFIG_SETTINGS;
229
-
230
- export declare interface AudioPlaybackOptions {
231
- origin?: boolean;
232
- mixing?: boolean;
233
- effect?: boolean;
234
- }
235
-
236
133
  export declare class AudioProcessorContext extends EventEmitter implements IAudioProcessorContext {
237
134
  private constraintsMap;
238
135
  private statsRegistry;
@@ -320,24 +217,6 @@ export declare enum AudioSourceEvents {
320
217
  UPDATE_SOURCE = "update_source"
321
218
  }
322
219
 
323
- /**
324
- * Options for processing the audio buffer. You need to set the options for processing the audio buffer when calling [startProcessAudioBuffer]{@link IBufferSourceAudioTrack.startProcessAudioBuffer}.
325
- */
326
- export declare interface AudioSourceOptions {
327
- /**
328
- * How many times the audio loops.
329
- */
330
- cycle?: number;
331
- /**
332
- * Whether to loop the audio infinitely.
333
- */
334
- loop?: boolean;
335
- /**
336
- * The playback position (seconds).
337
- */
338
- startPlayTime?: number;
339
- }
340
-
341
220
  /**
342
221
  * Processing state of the audio buffer:
343
222
  * - `"stopped"`: The SDK stops processing the audio buffer. Reasons may include:
@@ -355,12 +234,7 @@ declare class AudioState extends EventEmitter {
355
234
  curState: AudioContextState | "interrupted" | undefined;
356
235
  currentTime?: number;
357
236
  currentTimeStuckAt?: number;
358
- private interruptDetectorTrack?;
359
237
  get duringInterruption(): boolean;
360
- private onLocalAudioTrackMute;
361
- private onLocalAudioTrackUnmute;
362
- bindInterruptDetectorTrack(track: MicrophoneAudioTrack): void;
363
- unbindInterruptDetectorTrack(track: MicrophoneAudioTrack): void;
364
238
  }
365
239
 
366
240
  export declare function audioTimerLoop(callback: (time: number) => any, frequency: number): () => void;
@@ -390,189 +264,14 @@ declare class AutoPlayGestureEventEmitter extends EventEmitter {
390
264
 
391
265
  export declare const autoPlayGestureEventEmitter: AutoPlayGestureEventEmitter;
392
266
 
393
- /**
394
- * @ignore
395
- *
396
- * Image enhancement options. You need to set the image enhancement options when calling [setBeautyEffect]{@link ILocalVideoTrack.setBeautyEffect}.
397
- */
398
- export declare interface BeautyEffectOptions {
399
- /**
400
- *
401
- * The smoothness level.
402
- *
403
- * 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.
404
- */
405
- smoothnessLevel?: number;
406
- /**
407
- * The brightness level.
408
- *
409
- * The value range is [0.0, 1.0]. The original brightness level is 0.0. The default value is 0.7.
410
- */
411
- lighteningLevel?: number;
412
- /**
413
- * The redness level.
414
- *
415
- * 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.
416
- */
417
- rednessLevel?: number;
418
- /**
419
- * The contrast level. Use this together with {@link lighteningLevel}.
420
- * - 0: Low contrast level.
421
- * - 1: (Default) The original contrast level.
422
- * - 2: High contrast level.
423
- */
424
- lighteningContrastLevel?: 0 | 1 | 2;
425
- }
426
-
427
- export declare interface BeautyWebGLParameters {
428
- denoiseLevel?: number;
429
- lightLevel?: number;
430
- rednessLevel?: number;
431
- lighteningContrastLevel?: number;
432
- }
433
-
434
267
  export declare const blob2Uint8Array: (blob: Blob) => Promise<Uint8Array>;
435
268
 
436
- export declare class BufferSourceAudioTrack extends LocalAudioTrack implements IBufferSourceAudioTrack {
437
- source: string | File | AudioBuffer | null;
438
- private _bufferSource;
439
- get __className__(): string;
440
- constructor(source: string | File | AudioBuffer, bufferSource: AudioBufferSource, encodingConfig?: AudioEncoderConfiguration, trackId?: string);
441
- get currentState(): AudioSourceState;
442
- get duration(): number;
443
- get playbackSpeed(): number;
444
- getCurrentTime(): number;
445
- startProcessAudioBuffer(options?: AudioSourceOptions): void;
446
- pauseProcessAudioBuffer(): void;
447
- seekAudioBuffer(time: number): void;
448
- resumeProcessAudioBuffer(): void;
449
- stopProcessAudioBuffer(): void;
450
- close(): void;
451
- setAudioBufferPlaybackSpeed(speed: number): void;
452
- }
453
-
454
- /**
455
- * Configurations for the audio track from an audio file or `AudioBuffer` object. Set these configurations when calling [AgoraRTC.createBufferSourceAudioTrack]{@link IAgoraRTC.createBufferSourceAudioTrack}.
456
- */
457
- export declare interface BufferSourceAudioTrackInitConfig {
458
- /**
459
- * The type of the audio source:
460
- * - `File`: An [File](https://developer.mozilla.org/en-US/docs/Web/API/File) object, representing a local audio file.
461
- * - `string`: The online audio file retrieved from an HTTPS address. Ensure the address supports HTTPS and CORS.
462
- * - `AudioBuffer`: An [AudioBuffer](https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer) object, representing the raw data in PCM format.
463
- */
464
- source: File | string | AudioBuffer;
465
- /**
466
- * Whether to cache the online file:
467
- * - `true`: Cache the online file.
468
- * - `false`: (default) Do not cache the online file.
469
- */
470
- cacheOnlineFile?: boolean;
471
- /**
472
- * The audio encoder configurations.
473
- *
474
- * You can set the audio encoder configurations in either of the following ways:
475
- * - Pass the preset audio encoder configurations by using [[AudioEncoderConfigurationPreset]].
476
- * - Pass your customized audio encoder configurations by using [[AudioEncoderConfiguration]].
477
- *
478
- * > Firefox does not support setting the audio encoding rate.
479
- */
480
- encoderConfig?: AudioEncoderConfiguration | AudioEncoderConfigurationPreset;
481
- }
482
-
483
- export declare class CameraVideoTrack extends LocalVideoTrack implements ICameraVideoTrack {
484
- private _config;
485
- private _originalConstraints;
486
- private _constraints;
487
- _enabled: boolean;
488
- _deviceName: string;
489
- get __className__(): string;
490
- constructor(track: MediaStreamTrack, config: CameraVideoTrackInitConfig, constraints: MediaTrackConstraints, scalabilityConfig?: SVCConfiguration, optimizationMode?: "motion" | "detail" | "balanced", trackId?: string);
491
- setDevice(deviceId: string | RequiredOnlyOneOf<{
492
- facingMode: VideoFacingModeEnum;
493
- deviceId: string;
494
- }>): Promise<void>;
495
- private _setDeviceById;
496
- private _setDeviceByFacingModel;
497
- setEnabled(enabled: boolean, skipChangeState?: boolean): Promise<void>;
498
- setEncoderConfiguration(config: VideoEncoderConfiguration | VideoEncoderConfigurationPreset, doNotRenegoation?: boolean): Promise<void>;
499
- protected _getDefaultPlayerConfig(): Partial<PlayerConfig>;
500
- protected onTrackEnded(): void;
501
- renewMediaStreamTrack(newConstraints?: MediaTrackConstraints): Promise<void>;
502
- tryResumeVideoForIOS15_16WeChat: () => Promise<void>;
503
- close(): void;
504
- clone(config?: VideoEncoderConfiguration | VideoEncoderConfigurationPreset, cloneTrack?: boolean): CameraVideoTrack;
505
- bindProcessorContextEvents(): void;
506
- }
507
-
508
- /**
509
- * Configurations for the video track from the video captured by a camera. Set these configurations when calling [AgoraRTC.createCameraVideoTrack]{@link IAgoraRTC.createCameraVideoTrack}.
510
- */
511
- export declare interface CameraVideoTrackInitConfig {
512
- /**
513
- * The video encoder configurations.
514
- *
515
- * You can set the video encoder configurations in either of the following ways:
516
- * - Pass the preset video encoder configurations by using [[VideoEncoderConfigurationPreset]].
517
- * - Pass your customized video encoder configurations by using [[VideoEncoderConfiguration]].
518
- * - Leave this property empty to use the SDK's default value, `"480p_1"` (resolution: 640 × 480, frame rate: 15 fps, bitrate: 500 Kbps).
519
- */
520
- encoderConfig?: VideoEncoderConfiguration | VideoEncoderConfigurationPreset;
521
- /**
522
- * Whether to user the front camera or the rear camera.
523
- *
524
- * You can use this parameter to choose between the front camera and the rear camera on a mobile device:
525
- * - `"user"`: The front camera.
526
- * - `"environment"`: The rear camera.
527
- */
528
- facingMode?: VideoFacingModeEnum;
529
- /**
530
- * Specifies the camera ID.
531
- *
532
- * You can get a list of the available cameras by calling [AgoraRTC.getCameras]{@link IAgoraRTC.getCameras}.
533
- */
534
- cameraId?: string;
535
- /**
536
- * @since
537
- * <br>&emsp;&emsp;&emsp;*4.0.0*
538
- *
539
- * Transmission optimization mode. Whether to prioritize video quality or smoothness:
540
- * - `"detail"`: Prioritizes video quality.
541
- * - 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.
542
- * - In most cases, the SDK does not reduce the sending resolution, but may reduce the frame rate.
543
- * - `"motion"`: Prioritizes video smoothness.
544
- * - In poor network conditions, the SDK reduces the sending bitrate to minimize video freezes.
545
- * - In most cases, the SDK does not reduce the frame rate, but may reduce the sending resolution.
546
- * - Empty: Uses the default transmission optimization mode. The SDK may reduce the frame rate or the sending resolution in poor network conditions.
547
- *
548
- * > Note: This method is only supported on Chrome.
549
- */
550
- optimizationMode?: "motion" | "detail";
551
- /**
552
- * @ignore
553
- *
554
- * @since
555
- * <br>&emsp;&emsp;&emsp;*4.18.0*
556
- *
557
- * Configurations for Scalable Video Coding (SVC).
558
- *
559
- * You can set the configurations using one of the following options:
560
- * - Use the preset SVC configurations provided by the SDK through {@link SVCConfigurationPreset}.
561
- * - Use your custom SVC configurations through {@link SVCConfiguration}.
562
- */
563
- scalabiltyMode?: SVCConfiguration | SVCConfigurationPreset;
564
- }
565
-
566
269
  export declare function checkMediaStreamTrackResolution(track: MediaStreamTrack): Promise<[number, number]>;
567
270
 
568
- export declare function checkTrackState(): (target: any, propertyKey: any, descriptor: PropertyDescriptor) => TypedPropertyDescriptor<any> | undefined;
569
-
570
271
  /**
571
272
  * The visibility of the `<video>` tag.
572
273
  *
573
274
  * Get the visibility of the `<video>` tag through the following methods and events:
574
- * - [localVideoTrack.on("video-element-visible-status")]{@link ILocalVideoTrack.event_video_element_visible_status}
575
- * - [localVideoTrack.getVideoElementVisibleStatus]{@link ILocalVideoTrack.getVideoElementVisibleStatus}
576
275
  * - [remoteVideoTrack.on("video-element-visible-status")]{@link IRemoteVideoTrack.event_video_element_visible_status}
577
276
  * - [remoteVideoTrack.getVideoElementVisibleStatus]{@link IRemoteVideoTrack.getVideoElementVisibleStatus}
578
277
  *
@@ -586,201 +285,8 @@ export declare function checkTrackState(): (target: any, propertyKey: any, descr
586
285
  */
587
286
  export declare type CheckVideoVisibleResult = CheckVisibleResult;
588
287
 
589
- /**
590
- * Specifies a constraint for a property, such as the resolution or bitrate for video capture in [[VideoEncoderConfiguration]].
591
- */
592
- export declare interface ConstrainLong {
593
- /**
594
- * The lower limit of the property.
595
- */
596
- min?: number;
597
- /**
598
- * The upper limit of the property.
599
- */
600
- max?: number;
601
- /**
602
- * An ideal value of a property. If the video capture device cannot output this value, it outputs the closest value instead.
603
- */
604
- ideal?: number;
605
- /**
606
- * A required value of a property. If the video capture device cannot output this value, the video capture fails.
607
- */
608
- exact?: number;
609
- }
610
-
611
- export declare function createBufferSourceAudioTrack(config: BufferSourceAudioTrackInitConfig): Promise<BufferSourceAudioTrack>;
612
-
613
- export declare function createCameraVideoTrack(config?: CameraVideoTrackInitConfig): Promise<CameraVideoTrack>;
614
-
615
- export declare function createCustomAudioTrack(config: CustomAudioTrackInitConfig): LocalAudioTrack;
616
-
617
- export declare function createCustomVideoTrack(config: CustomVideoTrackInitConfig): LocalVideoTrack;
618
-
619
- export declare function createMicrophoneAndCameraTracks(audioConfig?: MicrophoneAudioTrackInitConfig, videoConfig?: CameraVideoTrackInitConfig): Promise<[MicrophoneAudioTrack, CameraVideoTrack]>;
620
-
621
- export declare function createMicrophoneAudioTrack(config?: MicrophoneAudioTrackInitConfig): Promise<MicrophoneAudioTrack>;
622
-
623
- export declare function createMixingAudioTrack(trackList: LocalAudioTrack[]): MixingAudioTrack;
624
-
625
- export declare function createScreenVideoTrack(config: ScreenVideoTrackInitConfig, withAudio: "enable"): Promise<[LocalVideoTrack, LocalAudioTrack]>;
626
-
627
- export declare function createScreenVideoTrack(config?: ScreenVideoTrackInitConfig, withAudio?: "disable"): Promise<LocalVideoTrack>;
628
-
629
- export declare function createScreenVideoTrack(config: ScreenVideoTrackInitConfig, withAudio: "auto"): Promise<[LocalVideoTrack, LocalAudioTrack] | LocalVideoTrack>;
630
-
631
- /**
632
- * Configurations for the custom audio track. Set these configurations when calling [AgoraRTC.createCustomAudioTrack]{@link IAgoraRTC.createCustomAudioTrack}.
633
- */
634
- export declare interface CustomAudioTrackInitConfig {
635
- /**
636
- * Your [MediaStreamTrack](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack) object.
637
- */
638
- mediaStreamTrack: MediaStreamTrack;
639
- /**
640
- * The audio encoder configurations.
641
- *
642
- * You can set the audio encoder configurations in either of the following ways:
643
- * - Pass the preset audio encoder configurations by using [[AudioEncoderConfigurationPreset]].
644
- * - Pass your customized audio encoder configurations by using [[AudioEncoderConfiguration]].
645
- *
646
- * > Firefox does not support setting the audio encoding rate.
647
- */
648
- encoderConfig?: AudioEncoderConfiguration | AudioEncoderConfigurationPreset;
649
- }
650
-
651
- /**
652
- * Configurations for the custom video track. Set these configurations when calling [AgoraRTC.createCustomVideoTrack]{@link IAgoraRTC.createCustomVideoTrack}.
653
- */
654
- export declare interface CustomVideoTrackInitConfig {
655
- /**
656
- * Your [MediaStreamTrack](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack) object.
657
- */
658
- mediaStreamTrack: MediaStreamTrack;
659
- /**
660
- * @since
661
- * <br>&emsp;&emsp;&emsp;*4.17.1*
662
- *
663
- * Width of the video.
664
- *
665
- * You can pass a `number`, or a constraint such as `{ max: 1280, min: 720 }`.
666
- *
667
- * For more details about the constraint, see [ConstrainLong]{@link ConstrainLong}.
668
- */
669
- width?: number | ConstrainLong;
670
- /**
671
- * @since
672
- * <br>&emsp;&emsp;&emsp;*4.17.1*
673
- *
674
- * Height of the video.
675
- *
676
- * You can pass a `number`, or a constraint such as `{ max: 1280, min: 720 }`.
677
- *
678
- * For more details about the constraint, see [ConstrainLong]{@link ConstrainLong}.
679
- */
680
- height?: number | ConstrainLong;
681
- /**
682
- * @since
683
- * <br>&emsp;&emsp;&emsp;*4.17.1*
684
- *
685
- * Frame rate of the video (fps).
686
- *
687
- * You can pass a `number`, or a constraint such as `{ max: 30, min: 5 }`.
688
- *
689
- * For details about the constraint, see [ConstrainLong]{@link ConstrainLong}.
690
- */
691
- frameRate?: number | ConstrainLong;
692
- /**
693
- * The minimum bitrate of sending the video track (Kbps).
694
- */
695
- bitrateMin?: number;
696
- /**
697
- * The maximum bitrate of sending the video track (Kbps).
698
- */
699
- bitrateMax?: number;
700
- /**
701
- * @since
702
- * <br>&emsp;&emsp;&emsp;*4.0.0*
703
- *
704
- * Transmission optimization mode. Whether to prioritize video quality or smoothness:
705
- * - `"detail"`: Prioritizes video quality.
706
- * - 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.
707
- * - In most cases, the SDK does not reduce the sending resolution, but may reduce the frame rate.
708
- * - `"motion"`: Prioritizes video smoothness.
709
- * - In poor network conditions, the SDK reduces the sending bitrate to minimize video freezes.
710
- * - In most cases, the SDK does not reduce the frame rate, but may reduce the sending resolution.
711
- * - Empty: Uses the default transmission optimization mode. The SDK may reduce the frame rate or the sending resolution in poor network conditions.
712
- *
713
- * > Note: This method is only supported on Chrome.
714
- */
715
- optimizationMode?: "motion" | "detail";
716
- /**
717
- * @ignore
718
- *
719
- * @since
720
- * <br>&emsp;&emsp;&emsp;*4.18.0*
721
- *
722
- * Configurations for Scalable Video Coding (SVC).
723
- *
724
- * You can set `scalabiltyMode` using one of the following options:
725
- * - Use the preset SVC configurations provided by the SDK through {@link SVCConfigurationPreset}.
726
- * - Use your custom SVC configurations through {@link SVCConfiguration}.
727
- */
728
- scalabiltyMode?: SVCConfiguration | SVCConfigurationPreset;
729
- }
730
-
731
- export declare abstract class DataChannel extends EventEmitter implements IDataChannel {
732
- private _version;
733
- private _type;
734
- _config: IDataChannelConfig;
735
- _originDataChannel?: RTCDataChannel;
736
- protected _dataStreamPacketHeader: ArrayBuffer;
737
- protected _dataStreamPacketHandler: DataStream;
738
- private _datachannelEventMap;
739
- constructor(config: IDataChannelConfig, datachannel?: RTCDataChannel);
740
- get id(): number;
741
- get ordered(): boolean;
742
- get maxRetransmits(): number;
743
- get metadata(): string;
744
- get readyState(): RTCDataChannelState;
745
- get _originDataChannelId(): number | null;
746
- getChannelId(): number;
747
- getConfig(): IDataChannelConfig;
748
- _close(): void;
749
- _waitTillOpen(): Promise<void>;
750
- _updateOriginDataChannel(datachannel: RTCDataChannel): void;
751
- private _initPacketHeader;
752
- private _bandDataChannelEvents;
753
- private _unbindDataChannelEvents;
754
- }
755
-
756
- export declare enum DataChannelEvents {
757
- OPEN = "open",
758
- MESSAGE = "message",
759
- CLOSE = "close",
760
- CLOSING = "closing",
761
- ERROR = "error"
762
- }
763
-
764
- declare class DataStream {
765
- private _sequence;
766
- private _startTime;
767
- private isUseOneByte;
768
- private get startTime();
769
- private get sequence();
770
- serialize(payload: ArrayBuffer): ArrayBuffer;
771
- deserialize(packet: ArrayBuffer): ArrayBuffer;
772
- private serializeExtension;
773
- private deserializeExtension;
774
- private decompress;
775
- private compress;
776
- }
777
-
778
288
  export declare function decodeAudioData(buffer: ArrayBuffer): Promise<AudioBuffer>;
779
289
 
780
- export declare const DEFAULT_LOCAL_AUDIO_TRACK_STATS: LocalAudioTrackStats;
781
-
782
- export declare const DEFAULT_LOCAL_VIDEO_TRACK_STATS: LocalVideoTrackStats;
783
-
784
290
  export declare const DEFAULT_NETWORK_QUALITY_STATS: NetworkQuality;
785
291
 
786
292
  export declare const DEFAULT_REMOTE_AUDIO_TRACK_STATS: RemoteAudioTrackStats;
@@ -824,6 +330,30 @@ export declare interface DeviceInfo {
824
330
  device: MediaDeviceInfo;
825
331
  }
826
332
 
333
+ export declare class DeviceManager extends EventEmitter {
334
+ private _state;
335
+ get state(): DeviceManagerState;
336
+ set state(state: DeviceManagerState);
337
+ private isAccessMicrophonePermission;
338
+ private isAccessCameraPermission;
339
+ private lastAccessMicrophonePermission;
340
+ private lastAccessCameraPermission;
341
+ private checkdeviceMatched;
342
+ private deviceInfoMap;
343
+ constructor();
344
+ enumerateDevices(audio: boolean, video: boolean, skipPermissionCheck?: boolean): Promise<MediaDeviceInfo[]>;
345
+ getRecordingDevices(skipPermissionCheck?: boolean): Promise<MediaDeviceInfo[]>;
346
+ getCamerasDevices(skipPermissionCheck?: boolean): Promise<MediaDeviceInfo[]>;
347
+ getSpeakers(skipPermissionCheck?: boolean): Promise<MediaDeviceInfo[]>;
348
+ searchDeviceIdByName(deviceName: string): string | null;
349
+ getDeviceById(deviceId: string): Promise<MediaDeviceInfo>;
350
+ private init;
351
+ private updateDevicesInfo;
352
+ private checkMediaDeviceInfoIsOk;
353
+ }
354
+
355
+ export declare const deviceManager: DeviceManager;
356
+
827
357
  export declare enum DeviceManagerEvent {
828
358
  STATE_CHANGE = "state_change",
829
359
  RECORDING_DEVICE_CHANGED = "recordingDeviceChanged",
@@ -846,24 +376,6 @@ export declare type DeviceState = "ACTIVE" | "INACTIVE";
846
376
 
847
377
  export declare const emptyImage2TypedArray: (type: string) => Promise<ImageTypedData>;
848
378
 
849
- /**
850
- * @ignore
851
- *
852
- * Occurs when the device is overloaded after you call [setBeautyEffect]{@link ILocalVideoTrack.setBeautyEffect} to enable image enhancement.
853
- *
854
- * You can listen for this event to notify users of the device overload and disable image enhancement.
855
- *
856
- * ```javascript
857
- * localVideoTrack.on("beauty-effect-overload", () => {
858
- * console.log("beauty effect overload, disable beauty effect");
859
- * localVideoTrack.setBeautyEffect(false);
860
- * });
861
- * ```
862
- * @event
863
- * @asMemberOf ILocalVideoTrack
864
- */
865
- declare function event_beauty_effect_overload(): void;
866
-
867
379
  /**
868
380
  * Occurs when the first remote audio or video frame is decoded.
869
381
  *
@@ -884,48 +396,6 @@ declare function event_first_frame_decoded(): void;
884
396
  */
885
397
  declare function event_sei_received(sei: Uint8Array): void;
886
398
 
887
- /**
888
- * Occurs when the state of processing the audio buffer in [BufferSourceAudioTrack]{@link IBufferSourceAudioTrack} changes.
889
- *
890
- * @param currentState The state of processing the audio buffer:
891
- * - `"stopped"`: The SDK stops processing the audio buffer. Reasons may include:
892
- * - The SDK finishes processing the audio buffer.
893
- * - The user manually stops the processing of the audio buffer.
894
- * - `"paused"`: The SDK pauses the processing of the audio buffer.
895
- * - `"playing"`: The SDK is processing the audio buffer.
896
- *
897
- * @event
898
- * @asMemberOf IBufferSourceAudioTrack
899
- */
900
- declare function event_source_state_change(currentState: AudioSourceState): void;
901
-
902
- /**
903
- * Occurs when a audio or video track ends.
904
- *
905
- * Reasons may include:
906
- * - Camera is unplugged.
907
- * - Microphone is unplugged.
908
- * - The local user stops screen sharing.
909
- * - The local user closes the underlying `MediaStreamTrack`.
910
- * - A local media device malfunctions.
911
- * - The device permission is revoked.
912
- *
913
- * @event
914
- * @asMemberOf ILocalTrack
915
- */
916
- declare function event_track_ended(): void;
917
-
918
- /**
919
- * Occurs when the `RTCRtpTransceiver` instance of the current track is updated.
920
- *
921
- * @param transceiver The new `RTCRtpTransceiver` instance.
922
- * @param type The type of the video stream to which the current track belongs. See {@link StreamType}.
923
- *
924
- * @event
925
- * @asMemberOf ILocalTrack
926
- */
927
- declare function event_transceiver_updated(transceiver: RTCRtpTransceiver, type?: StreamType): void;
928
-
929
399
  /**
930
400
  * Occurs when the `RTCRtpTransceiver` instance of the current track is updated.
931
401
  *
@@ -933,43 +403,7 @@ declare function event_transceiver_updated(transceiver: RTCRtpTransceiver, type?
933
403
  * @event
934
404
  * @asMemberOf IRemoteTrack
935
405
  */
936
- declare function event_transceiver_updated_2(transceiver: RTCRtpTransceiver): void;
937
-
938
- /**
939
- * @ignore
940
- */
941
- declare function event_user_datachannel_close(): void;
942
-
943
- /**
944
- * @ignore
945
- */
946
- declare function event_user_datachannel_error(ev: Event): void;
947
-
948
- /**
949
- * @ignore
950
- */
951
- declare function event_user_datachannel_message(data: ArrayBuffer): void;
952
-
953
- /**
954
- * @ignore
955
- */
956
- declare function event_user_datachannel_open(): void;
957
-
958
- /**
959
- * @since
960
- * <br>&emsp;&emsp;&emsp;*4.8.0*
961
- *
962
- * Indicates the visibility of the `<video>` HTML tag.
963
- *
964
- * The SDK triggers this event every 30 seconds.
965
- *
966
- * 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.
967
- *
968
- * @param data The visibility of the `<video>` tag.
969
- * @asMemberOf ILocalVideoTrack
970
- * @event
971
- */
972
- declare function event_video_element_visible_status(data?: CheckVideoVisibleResult): void;
406
+ declare function event_transceiver_updated(transceiver: RTCRtpTransceiver): void;
973
407
 
974
408
  /**
975
409
  * @since
@@ -985,7 +419,7 @@ declare function event_video_element_visible_status(data?: CheckVideoVisibleResu
985
419
  * @asMemberOf IRemoteVideoTrack
986
420
  * @event
987
421
  */
988
- declare function event_video_element_visible_status_2(data?: CheckVideoVisibleResult): void;
422
+ declare function event_video_element_visible_status(data?: CheckVideoVisibleResult): void;
989
423
 
990
424
  /**
991
425
  * Occurs when the video state changes.
@@ -1032,266 +466,60 @@ declare class FakeTrackSource extends EventEmitter {
1032
466
  createMediaStreamSourceNode(): undefined;
1033
467
  }
1034
468
 
1035
- export declare const frameData2CryptoBuffer: (imageData: ImageTypedData, appid: string, channelName: string) => Promise<Uint8Array>;
1036
-
1037
469
  export declare function getAudioContext(): AudioContext;
1038
470
 
1039
- export declare function getAudioEncoderConfiguration(profile: AudioEncoderConfigurationPreset | AudioEncoderConfiguration): AudioEncoderConfiguration;
1040
-
1041
- export declare function getAudioInputs(checkPermission?: boolean): Promise<MediaDeviceInfo[]>;
1042
-
1043
- export declare function getAudioOutputs(checkPermission?: boolean): Promise<MediaDeviceInfo[]>;
1044
-
1045
- export declare function getBitrateConstrainRange(width: number, height: number, frameRate: number, bitrateMin?: number, bitrateMax?: number): DoubleRange;
1046
-
1047
471
  export declare function getCompatibility(): AgoraRTCCompatibility;
1048
472
 
1049
- export declare function getConstraintsFromCameraConfig(config: CameraVideoTrackInitConfig): MediaTrackConstraints;
1050
-
1051
- export declare function getConstraintsFromMicrophoneConfig(config: MicrophoneAudioTrackInitConfig): MediaTrackConstraints;
473
+ export declare function getSilenceAudioTrack(): MediaStreamTrack;
1052
474
 
1053
- export declare function getConstraintsFromScreenConfig(config: ScreenVideoTrackInitConfig): ScreenConstraintsWithElectron;
475
+ export declare function getSilenceSamplesDuration(buffer: AudioBuffer): number;
1054
476
 
1055
- export declare function getDeviceById(deviceId: string): Promise<MediaDeviceInfo>;
477
+ export declare function handleGetUserMediaError(errorName: string, message?: string): AgoraRTCError;
1056
478
 
1057
- export declare function getDeviceIdByLabel(label: string): string;
479
+ export declare const HAS_GUM_AUDIO: boolean;
1058
480
 
1059
- export declare function getElectronScreenSources(type?: ScreenSourceType): Promise<ElectronDesktopCapturerSource[]>;
481
+ export declare const HAS_GUM_VIDEO: boolean;
1060
482
 
1061
- export declare function getElectronScreenStream(sourceId: string, config: ScreenConstraintsWithElectron, captureAudio?: boolean): Promise<MediaStream>;
483
+ export declare function hasAudioContext(): boolean;
1062
484
 
1063
- export declare function getElectronScreenStreamByUserSelect(config: ScreenConstraintsWithElectron, captureAudio?: boolean): Promise<MediaStream>;
1064
-
1065
- export declare function getLocalStream(config: GetUserMediaConfig, id: string): Promise<MediaStream>;
1066
-
1067
- export declare function getMediaDevices(requestAudioPermission: boolean, requestVideoPermission: boolean, source?: "user" | "event" | "init"): Promise<MediaDeviceInfo[]>;
1068
-
1069
- export declare function getScalabilityConfiguration(profile: SVCConfiguration | SVCConfigurationPreset): SVCConfiguration;
1070
-
1071
- export declare function getScreenEncoderConfiguration(profile: VideoEncoderConfiguration | ScreenEncoderConfigurationPreset | string): VideoEncoderConfiguration;
1072
-
1073
- export declare function getSilenceAudioTrack(): MediaStreamTrack;
1074
-
1075
- export declare function getSilenceSamplesDuration(buffer: AudioBuffer): number;
1076
-
1077
- export declare function getStaticTrackStream(track: MediaStreamTrack, interval?: number): MediaStreamTrack | void;
1078
-
1079
- export declare interface GetUserMediaConfig {
1080
- video?: MediaTrackConstraints;
1081
- audio?: MediaTrackConstraints;
1082
- screen?: ScreenConstraintsWithElectron;
1083
- videoSource?: MediaStreamTrack;
1084
- audioSource?: MediaStreamTrack;
1085
- screenAudio?: boolean;
485
+ export declare interface ImageTypedData {
486
+ buffer: Uint8Array;
487
+ width: number;
488
+ height: number;
1086
489
  }
1087
490
 
1088
- export declare function getVideoEncoderConfiguration(profile: VideoEncoderConfigurationPreset | VideoEncoderConfiguration | undefined): VideoEncoderConfiguration;
1089
-
1090
- export declare function getVideoInputs(checkPermission?: boolean): Promise<MediaDeviceInfo[]>;
1091
-
1092
- export declare function handleGetUserMediaError(errorName: string, message?: string): AgoraRTCError;
1093
-
1094
- export declare let HAS_GUM_AUDIO: boolean;
1095
-
1096
- export declare let HAS_GUM_VIDEO: boolean;
1097
-
1098
- export declare function hasAudioContext(): boolean;
1099
-
1100
491
  /**
1101
- * Inherited from [LocalAudioTrack]{@link ILocalAudioTrack}, `BufferSourceAudioTrack` is an interface for the audio from a local audio file and adds several functions for controlling the processing of the audio buffer, such as starting processing, stopping processing, and seeking a specified time location.
492
+ * `RemoteAudioTrack` is the basic interface for the remote audio track.
1102
493
  *
1103
- * You can create an audio track from an audio file by calling [AgoraRTC.createBufferSourceAudioTrack]{@link IAgoraRTC.createBufferSourceAudioTrack}.
494
+ * You can get create a remote audio track by the [AgoraRTCRemoteUser.audioTrack]{@link IAgoraRTCRemoteUser.audioTrack} object after calling [subscribe]{@link IAgoraRTCClient.subscribe}.
1104
495
  */
1105
- export declare interface IBufferSourceAudioTrack extends ILocalAudioTrack {
1106
- /**
1107
- * The [source]{@link BufferSourceAudioTrackInitConfig.source} specified when creating an audio track.
1108
- */
1109
- source: string | File | AudioBuffer | null;
1110
- /**
1111
- * The current state of audio processing, such as start, pause, or stop.
1112
- */
1113
- currentState: AudioSourceState;
1114
- /**
1115
- * The total duration of the audio (seconds).
1116
- */
1117
- duration: number;
1118
- /**
1119
- * @since
1120
- * <br>&emsp;&emsp;&emsp;*4.18.0*
1121
- *
1122
- * The playback speed of the current audio file. Valid range is [50, 400], where:
1123
- * - `50`: Half the original speed.
1124
- * - `100`: (Default) The original speed.
1125
- * - `400`: Four times the original speed.
1126
- */
1127
- playbackSpeed: number;
1128
- /**
1129
- * @param event The event name.
1130
- * @param listener See [source-state-change]{@link event_source_state_change}.
1131
- */
1132
- on(event: "source-state-change", listener: typeof event_source_state_change): void;
1133
- /**
1134
- * When the specified event happens, the SDK triggers the callback that you pass.
1135
- *
1136
- * @param event The event name.
1137
- * @param listener The callback function.
1138
- */
1139
- on(event: string, listener: Function): void;
1140
- /**
1141
- * Gets the progress (seconds) of the audio buffer processing.
1142
- *
1143
- * @returns The progress (seconds) of the audio buffer processing.
1144
- */
1145
- getCurrentTime(): number;
1146
- /**
1147
- * Starts processing the audio buffer.
1148
- *
1149
- * > Starting processing the audio buffer means that the processing unit in the SDK has received the audio data. If the audio track has been published, the remote user can hear the audio.
1150
- * > 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.
1151
- *
1152
- * @param options Options for processing the audio buffer. See [[AudioSourceOptions]].
1153
- */
1154
- startProcessAudioBuffer(options?: AudioSourceOptions): void;
1155
- /**
1156
- * Pauses processing the audio buffer.
1157
- */
1158
- pauseProcessAudioBuffer(): void;
1159
- /**
1160
- * Jumps to a specified time point.
1161
- *
1162
- * @param time The specified time point (seconds).
1163
- */
1164
- seekAudioBuffer(time: number): void;
1165
- /**
1166
- * Resumes processing the audio buffer.
1167
- */
1168
- resumeProcessAudioBuffer(): void;
1169
- /**
1170
- * Stops processing the audio buffer.
1171
- */
1172
- stopProcessAudioBuffer(): void;
496
+ export declare interface IRemoteAudioTrack extends IRemoteTrack {
1173
497
  /**
1174
- * @since
1175
- * <br>&emsp;&emsp;&emsp;*4.18.0*
1176
- *
1177
- * Sets the playback speed for the current audio file.
1178
- *
1179
- * You can call this method before or after joining a channel.
498
+ * Gets the statistics of a remote audio track.
1180
499
  *
1181
- * @param speed The playback speed. Valid range is [50, 400], where:
1182
- * - `50`: Half the original speed.
1183
- * - `100`: (Default) The original speed.
1184
- * - `400`: Four times the original speed.
500
+ * @return An [[RemoteAudioTrackStats]] object.
1185
501
  */
1186
- setAudioBufferPlaybackSpeed(speed: number): void;
1187
- }
1188
-
1189
- /**
1190
- *
1191
- * 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.
1192
- *
1193
- * You can create a local camera video track by calling [AgoraRTC.createCameraVideoTrack]{@link IAgoraRTC.createCameraVideoTrack}.
1194
- */
1195
- export declare interface ICameraVideoTrack extends ILocalVideoTrack {
1196
- /**
1197
- * Sets the device for capturing video.
1198
- *
1199
- * > You can call this method either before or after publishing the video track.
1200
- *
1201
- * @param deviceId Device ID, which can be passed in using the following ways:
1202
- * - Pass a string: Pass the `deviceId` obtained using [AgoraRTC.getCameras]{@link IAgoraRTC.getCameras}.
1203
- * - Pass an object: Starting from version 4.19.0, you can pass an object
1204
- * containing `facingMode` or `deviceId`, but only one of these properties
1205
- * can be specified. `deviceId` can be obtained through [AgoraRTC.getCameras]{@link IAgoraRTC.getCameras}, and `facingMode` supports the following values:
1206
- * - `"environment"`: Use the rear camera.
1207
- * - `"user"`: Use the front camera.
1208
- */
1209
- setDevice(deviceId: string | RequiredOnlyOneOf<{
1210
- facingMode: VideoFacingModeEnum;
1211
- deviceId: string;
1212
- }>): Promise<void>;
502
+ getStats(): RemoteAudioTrackStats;
1213
503
  /**
1214
- * @since
1215
- * <br>&emsp;&emsp;&emsp;*4.0.0*
1216
- *
1217
- * Enables/Disables the track.
1218
- *
1219
- * After a track is disabled, the SDK stops playing and publishing the track.
1220
- *
1221
- * > - Disabling a track does not trigger the [LocalTrack.on("track-ended")]{@link event_track_ended} event.
1222
- * > - 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.
1223
- * > - Do not call `setEnabled` and `setMuted` together.
504
+ * Plays a remote audio track.
1224
505
  *
1225
- * @param enabled Whether to enable the track:
1226
- * - `true`: Enable the track.
1227
- * - `false`: Disable the track.
506
+ * > When playing the audio track, you do not need to pass any DOM element.
1228
507
  */
1229
- setEnabled(enabled: boolean): Promise<void>;
508
+ play(): void;
1230
509
  /**
1231
510
  * @since
1232
- * <br>&emsp;&emsp;&emsp;*4.19.0*
1233
- *
1234
- * Clones the current video track to create a new video track.
1235
- *
1236
- * 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.
1237
- *
1238
- * @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]].
1239
- * @param cloneTrack Whether to clone the current track. Default is `true`.
1240
- * @returns The newly generated video track.
1241
- */
1242
- clone(config?: VideoEncoderConfiguration | VideoEncoderConfigurationPreset, cloneTrack?: boolean): ICameraVideoTrack;
1243
- }
1244
-
1245
- /**
1246
- * @ignore
1247
- */
1248
- export declare interface IDataChannel extends EventEmitter {
1249
- readonly id: number;
1250
- readonly maxRetransmits: number | null;
1251
- readonly ordered: boolean;
1252
- readonly readyState: RTCDataChannelState;
1253
- readonly metadata: string;
1254
- getChannelId(): number;
1255
- getConfig(): IDataChannelConfig;
1256
- }
1257
-
1258
- /**
1259
- * @ignore
1260
- */
1261
- export declare interface IDataChannelConfig {
1262
- id: number;
1263
- ordered: boolean;
1264
- metadata: string;
1265
- }
1266
-
1267
- /**
1268
- * `LocalAudioTrack` is the basic interface for local audio tracks, providing main methods of local audio tracks.
1269
- *
1270
- * You can create a local audio track by calling [AgoraRTC.createCustomAudioTrack]{@link IAgoraRTC.createCustomAudioTrack}.
1271
- *
1272
- * The following interfaces are inherited from `LocalAudioTrack`:
1273
- * - [MicrophoneAudioTrack]{@link IMicrophoneAudioTrack}, the interface for the audio sampled by a local microphone, which adds several microphone-related functions.
1274
- * - [BufferSourceAudioTrack]{@link IBufferSourceAudioTrack}, the interface for the audio from a local audio file, which adds several audio-file-related functions.
1275
- */
1276
- export declare interface ILocalAudioTrack extends ILocalTrack {
1277
- /**
1278
- * Sets the volume of a local audio track.
1279
- *
1280
- * @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.
1281
- */
1282
- setVolume(volume: number): void;
1283
- /**
1284
- * Gets the audio level of a local audio track.
511
+ * <br>&emsp;&emsp;&emsp;*4.1.0*
1285
512
  *
1286
- * @returns The audio level. The value range is [0,1]. 1 is the highest audio level.
1287
- * Usually a user with audio level above 0.6 is a speaking user.
513
+ * Sets the audio playback device, for example, the speaker.
1288
514
  *
515
+ * > This method supports Chrome and Edge on desktop devices only. Other browsers throw a `NOT_SUPPORTED` error when calling this method.
516
+ * @param deviceId Device ID, which can be retrieved by calling [[getPlaybackDevices]].
1289
517
  */
1290
- getVolumeLevel(): number;
518
+ setPlaybackDevice(deviceId: string): Promise<void>;
1291
519
  /**
1292
520
  * Sets the callback for getting raw audio data in PCM format.
1293
521
  *
1294
- * 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).
522
+ * 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).
1295
523
  *
1296
524
  * > 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.
1297
525
  *
@@ -1314,31 +542,23 @@ export declare interface ILocalAudioTrack extends ILocalTrack {
1314
542
  */
1315
543
  setAudioFrameCallback(audioFrameCallback: null | ((buffer: AudioBuffer) => void), frameSize?: number): void;
1316
544
  /**
1317
- * Plays a local audio track.
545
+ * Sets the volume of a remote audio track.
1318
546
  *
1319
- * > When playing a audio track, you do not need to pass any DOM element.
547
+ * @param volume The volume. The value ranges from 0 (mute) to 100 (maximum). A value of 100 is the current volume.
1320
548
  */
1321
- play(): void;
549
+ setVolume(volume: number): void;
1322
550
  /**
1323
- * @since
1324
- * <br>&emsp;&emsp;&emsp;*4.1.0*
1325
- *
1326
- * > Note:
1327
- * > - As of v4.7.0, this method no longer takes effect. Use [IRemoteAudioTrack.setPlaybackDevice]{@link IRemoteAudioTrack.setPlaybackDevice} instead.
1328
- *
1329
- * Sets the playback device (speaker) for the remote audio stream.
551
+ * Gets the audio level of a remote audio track.
1330
552
  *
1331
- * @param deviceId The device ID, which can be retrieved by calling [[getPlaybackDevices]].
553
+ * @returns The audio level. The value range is [0,1]. 1 is the highest audio level.
554
+ * Usually a user with audio level above 0.6 is a speaking user.
1332
555
  */
1333
- setPlaybackDevice(deviceId: string): Promise<void>;
556
+ getVolumeLevel(): number;
1334
557
  /**
1335
- * Gets the statistics of a local audio track.
558
+ * @since
559
+ * <br>&emsp;&emsp;&emsp;*4.13.0*
1336
560
  *
1337
- * @deprecated from v4.1.0. Use [AgoraRTCClient.getLocalVideoStats]{@link IAgoraRTCClient.getLocalVideoStats} and [AgoraRTCClient.getLocalAudioStats]{@link IAgoraRTCClient.getLocalAudioStats} instead.
1338
- */
1339
- getStats(): LocalAudioTrackStats;
1340
- /**
1341
- * Inserts a `Processor` to the local audio track.
561
+ * Inserts a `Processor` to the remote audio track.
1342
562
  *
1343
563
  * @param processor The `Processor` instance. Each extension has a corresponding type of `Processor`.
1344
564
  *
@@ -1347,991 +567,199 @@ export declare interface ILocalAudioTrack extends ILocalTrack {
1347
567
  pipe(processor: IAudioProcessor): IAudioProcessor;
1348
568
  /**
1349
569
  * @since
1350
- * <br>&emsp;&emsp;&emsp;*4.10.0*
570
+ * <br>&emsp;&emsp;&emsp;*4.13.0*
1351
571
  *
1352
- * Removes the `Processor` inserted to the local audio track.
572
+ * Removes the `Processor` inserted to the remote audio track.
1353
573
  */
1354
574
  unpipe(): void;
1355
575
  /**
1356
576
  * @since
1357
- * <br>&emsp;&emsp;&emsp;*4.10.0*
577
+ * <br>&emsp;&emsp;&emsp;*4.13.0*
1358
578
  *
1359
- * The destination of the current processing pipeline on the local audio track.
579
+ * The destination of the current processing pipeline on the remote audio track.
1360
580
  */
1361
581
  processorDestination: IAudioProcessor;
1362
582
  }
1363
583
 
1364
584
  /**
1365
- * @ignore
1366
- */
1367
- export declare interface ILocalDataChannel extends IDataChannel {
1368
- send(data: ArrayBuffer): void;
1369
- /** @internal */
1370
- on(event: "open", listener: typeof event_user_datachannel_open): void;
1371
- /** @internal */
1372
- on(event: "close", listener: typeof event_user_datachannel_close): void;
1373
- /** @internal */
1374
- on(event: "error", listener: typeof event_user_datachannel_error): void;
1375
- }
1376
-
1377
- /**
1378
- * `LocalTrack` is the basic interface for local tracks, providing public methods for [LocalAudioTrack]{@link ILocalAudioTrack} and [LocalVideoTrack]{@link ILocalVideoTrack}.
585
+ * `RemoteTrack` is the basic interface for remote tracks, providing public methods for [RemoteAudioTrack]{@link IRemoteAudioTrack} and [RemoteVideoTrack]{@link IRemoteVideoTrack}.
1379
586
  */
1380
- export declare interface ILocalTrack extends ITrack {
587
+ export declare interface IRemoteTrack extends ITrack {
1381
588
  /**
1382
589
  * @param event The event name.
1383
- * @param listener See [track-ended]{@link event_track_ended}.
590
+ * @param listener See [first-frame-decoded]{@link event_first_frame_decoded}.
1384
591
  */
1385
- on(event: "track-ended", listener: typeof event_track_ended): void;
592
+ on(event: "first-frame-decoded", listener: typeof event_first_frame_decoded): void;
1386
593
  /**
1387
594
  * Adds an event listener.
1388
595
  * @param event The event name.
1389
- * @param listener See [ILocalTrack.transceiver-updated]{@link event_transceiver_updated}.
596
+ * @param listener See [IRemoteTrack.transceiver-updated]{@link event_transceiver_updated_2}.
1390
597
  */
1391
598
  on(event: "transceiver-updated", listener: typeof event_transceiver_updated): void;
1392
599
  /**
1393
- * @since
1394
- * <br>&emsp;&emsp;&emsp;*4.0.0*
1395
- *
1396
- * Enables/Disables the track.
1397
- *
1398
- * After a track is disabled, the SDK stops playing and publishing the track.
1399
- *
1400
- * > - Disabling a track does not trigger the [LocalTrack.on("track-ended")]{@link event_track_ended} event.
1401
- * > - 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.
1402
- * > - Do not call `setEnabled` and `setMuted` together.
1403
- *
1404
- * @param enabled Whether to enable the track:
1405
- * - `true`: Enable the track.
1406
- * - `false`: Disable the track.
1407
- */
1408
- setEnabled(enabled: boolean): Promise<void>;
1409
- /**
1410
- * @deprecated from v4.1.0. Use [AgoraRTCClient.getLocalVideoStats]{@link IAgoraRTCClient.getLocalVideoStats} and [AgoraRTCClient.getLocalAudioStats]{@link IAgoraRTCClient.getLocalAudioStats} instead.
1411
- *
1412
- * Gets the statistics of a local track.
1413
- *
1414
- * > Note: When getting the statistics of a local video track, you cannot get the `encodeDelay` property on iOS.
1415
- */
1416
- getStats(): LocalVideoTrackStats | LocalAudioTrackStats;
1417
- /**
1418
- * Gets the label of a local track.
1419
- *
1420
- * @return The label that the SDK returns may include:
1421
- * - 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`.
1422
- * - The `sourceId` property, if the track is created by calling `createScreenVideoTrack`.
1423
- * - 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`.
1424
- */
1425
- getTrackLabel(): string;
1426
- /**
1427
- * Sends or stops sending the media data of the track.
1428
- *
1429
- * @since
1430
- * <br>&emsp;&emsp;&emsp;*4.6.0*
1431
- *
1432
- * 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.
1433
- *
1434
- * > - 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).
1435
- * > - Do not call `setEnabled` and `setMuted` together.
600
+ * Gets the `uid` of the remote user who publishes the remote track.
1436
601
  *
1437
- * @param muted Whether to stop sending the media data of the track:
1438
- * - `true`: Stop sending the media data of the track.
1439
- * - `false`: Resume sending the media data of the track.
602
+ * @return The `uid` of the remote user.
1440
603
  */
1441
- setMuted(muted: boolean): Promise<void>;
604
+ getUserId(): UID;
1442
605
  /**
1443
- * Closes a local track and releases the audio and video resources that it occupies.
606
+ * Gets the statistics of a remote track.
1444
607
  *
1445
- * Once you close a local track, you can no longer reuse it.
608
+ * @deprecated from v4.1.0. Use [AgoraRTCClient.getRemoteVideoStats]{@link IAgoraRTCClient.getRemoteVideoStats} and [AgoraRTCClient.getRemoteAudioStats]{@link IAgoraRTCClient.getRemoteAudioStats} instead.
609
+ * @return An [[RemoteAudioTrackStats]] or [[RemoteVideoTrackStats]] object.
1446
610
  */
1447
- close(): void;
1448
- muted: boolean;
1449
- enabled: boolean;
611
+ getStats(): RemoteAudioTrackStats | RemoteVideoTrackStats;
1450
612
  }
1451
613
 
1452
614
  /**
1453
- * `LocalVideoTrack` is the basic interface for local video tracks, providing the main methods for local video tracks.
1454
- *
1455
- * You can get create a local video track by calling [AgoraRTC.createCustomVideoTrack]{@link IAgoraRTC.createCustomVideoTrack} or [AgoraRTC.createScreenVideoTrack]{@link IAgoraRTC.createScreenVideoTrack} method.
615
+ * `RemoteVideoTrack` is the basic interface for the remote video track.
1456
616
  *
1457
- * Inherited from `LocalVideoTrack`, [CameraVideoTrack]{@link ICameraVideoTrack} is an interface for the video captured by a local camera and adds several camera-related functions.
617
+ * You can get create a remote video track by the [AgoraRTCRemoteUser.videoTrack]{@link IAgoraRTCRemoteUser.videoTrack} object after calling [subscribe]{@link IAgoraRTCClient.subscribe}.
1458
618
  */
1459
- export declare interface ILocalVideoTrack extends ILocalTrack {
1460
- /** @internal */
1461
- on(event: "beauty-effect-overload", listener: typeof event_beauty_effect_overload): void;
619
+ export declare interface IRemoteVideoTrack extends IRemoteTrack {
1462
620
  /**
1463
621
  * @param event The event name.
1464
- * @param listener See [track-ended]{@link event_track_ended}.
622
+ * @param listener See [video-state-changed]{@link event_video_state_changed}.
623
+ */
624
+ on(event: "video-state-changed", listener: typeof event_video_state_changed): void;
625
+ /**
626
+ * @param event The event name.
627
+ * @param listener See [first-frame-decoded]{@link event_first_frame_decoded}.
1465
628
  */
1466
- on(event: "track-ended", listener: typeof event_track_ended): void;
629
+ on(event: "first-frame-decoded", listener: typeof event_first_frame_decoded): void;
1467
630
  /**
1468
631
  * @param event The event name.
1469
- * @param listener See [video-element-visible-status]{@link event_video_element_visible_status}.
632
+ * @param listener See [video-element-visible-status]{@link event_video_element_visible_status_2}.
1470
633
  */
1471
634
  on(event: "video-element-visible-status", listener: typeof event_video_element_visible_status): void;
1472
635
  /**
1473
636
  * Adds an event listener.
1474
637
  * @param event The event name.
1475
- * @param listener See [ILocalTrack.transceiver-updated]{@link event_transceiver_updated}.
638
+ * @param listener See [IRemoteTrack.transceiver-updated]{@link event_transceiver_updated_2}.
1476
639
  */
1477
640
  on(event: "transceiver-updated", listener: typeof event_transceiver_updated): void;
1478
641
  /**
1479
- * Plays a remote video track on the web page.
1480
- *
1481
- * @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:
1482
- * - `string`: Specify the ID of the DOM element.
1483
- * - `HTMLElement`: Pass a DOM object.
1484
- * @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.
1485
- */
1486
- play(element: string | HTMLElement, config?: VideoPlayerConfig): void;
1487
- /**
1488
- * Gets the statistics of a local video track.
1489
- *
1490
- * @deprecated from v4.1.0. Use [AgoraRTCClient.getLocalVideoStats]{@link IAgoraRTCClient.getLocalVideoStats} and [AgoraRTCClient.getLocalAudioStats]{@link IAgoraRTCClient.getLocalAudioStats} instead.
1491
- */
1492
- getStats(): LocalVideoTrackStats;
1493
- /**
1494
- * @since
1495
- * <br>&emsp;&emsp;&emsp;*4.19.0*
1496
- *
1497
- * Clones the current video track to create a new video track.
1498
- *
1499
- * 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.
1500
- *
1501
- * @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]].
1502
- * @param cloneTrack Whether to clone the current track. Default is `true`.
1503
- * @returns The newly generated video track.
1504
- */
1505
- clone(config?: VideoEncoderConfiguration | VideoEncoderConfigurationPreset, cloneTrack?: boolean): ILocalVideoTrack;
1506
- /**
1507
- * @ignore
1508
- *
1509
- * Enables/Disables image enhancement and sets the options.
1510
- *
1511
- * > Notes:
1512
- * > - Agora is planning to sunset this built-in image enhancement feature.
1513
- * You can use the upgraded Image Enhancement Extension instead. For details, see
1514
- * [Use the Image Enhancement Extension](https://docs.agora.io/en/Video/beauty_effect_web_ng?platform=Web).
1515
- * > - This method supports the following browsers:
1516
- * > - Safari 12 or later.
1517
- * > - Chrome 65 or later.
1518
- * > - Firefox 70.0.1 or later.
1519
- * > - This function is not supported on mobile devices.
1520
- * > - If you enable dual-stream mode, the image enhancement options only apply to the high-quality video stream.
1521
- *
1522
- * @param enabled Whether to enable image enhancement:
1523
- * - `true`: Enable image enhancement.
1524
- * - `false`: Disable image enhancement.
1525
- * @param options Sets image enhancement options. See [[BeautyEffectOptions]].
1526
- */
1527
- setBeautyEffect(enabled: boolean, options?: BeautyEffectOptions): Promise<void>;
1528
- /**
1529
- * @since
1530
- * <br>&emsp;&emsp;&emsp;*4.1.0*
1531
- *
1532
- * Gets the data of the video frame being rendered.
1533
- *
1534
- * > You should call this method after calling [[play]]. Otherwise, the method call returns null.
1535
- *
1536
- * @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).
1537
- */
1538
- getCurrentFrameData(): ImageData;
1539
- /**
1540
- *
1541
- * @ignore
1542
- */
1543
- getCurrentFrameImage(imageType: string, quality: number): Promise<ImageTypedData>;
1544
- /**
1545
- * @since
1546
- * <br>&emsp;&emsp;&emsp;*4.2.0*
1547
- *
1548
- * Sets the video transmission optimization mode.
1549
- *
1550
- * 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.
1551
- *
1552
- * > Note: This method supports Chrome only.
1553
- *
1554
- * @param mode The video transmission optimization mode:
1555
- * - `"balanced"`: Uses the default optimization mode.
1556
- * - For a screen-sharing video track, the default transmission optimization strategy is to prioritizes clarity.
1557
- * - For the other types of video tracks, the SDK may reduce the frame rate or the sending resolution in poor network conditions.
1558
- * - `"detail"`: Prioritizes video quality.
1559
- * - 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.
1560
- * - In most cases, the SDK does not reduce the sending resolution, but may reduce the frame rate.
1561
- * - `"motion"`: Prioritizes video smoothness.
1562
- * - In poor network conditions, the SDK reduces the sending bitrate to minimize video freezes.
1563
- * - In most cases, the SDK does not reduce the frame rate, but may reduce the sending resolution.
1564
- */
1565
- setOptimizationMode(mode: "balanced" | "motion" | "detail"): Promise<void>;
1566
- /**
1567
- * @since
1568
- * <br>&emsp;&emsp;&emsp;*4.8.0*
1569
- *
1570
- * Gets the visibility of the `<video>` HTML tag.
1571
- *
1572
- * 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.
1573
- *
1574
- * @returns The [[CheckVideoVisibleResult]] object. If this method returns `undefined`, it may be due to the following reasons:
1575
- * - `localVideoTrack.isPlaying` is `false`.
1576
- * - The `<video>` tag does not exist.
1577
- * - The `<video>` tag is not created by calling the `play` method.
1578
- */
1579
- getVideoElementVisibleStatus(): CheckVideoVisibleResult | undefined;
1580
- /**
1581
- * Inserts a `Processor` to the local video track.
1582
- *
1583
- * @param processor The `Processor` instance. Each extension has a corresponding type of `Processor`.
1584
- *
1585
- * @returns The `Processor` instance.
1586
- */
1587
- pipe(processor: IBaseProcessor): IBaseProcessor;
1588
- /**
1589
- * @since
1590
- * <br>&emsp;&emsp;&emsp;*4.10.0*
1591
- *
1592
- * Removes the `Processor` inserted to the local video track.
1593
- */
1594
- unpipe(): void;
1595
- /**
1596
- * @since
1597
- * <br>&emsp;&emsp;&emsp;*4.10.0*
1598
- *
1599
- * The destination of the current processing pipeline on the local video track.
1600
- */
1601
- processorDestination: IBaseProcessor;
1602
- /**
1603
- * @since
1604
- * <br>&emsp;&emsp;&emsp;*4.17.0*
1605
- *
1606
- * Replaces the local video track.
1607
- *
1608
- * You can call this method before or after publishing the local video stream:
1609
- * - If you call this method before publishing, the new video track is played locally.
1610
- * - If you call this method after publishing, the new video track is received by the remote user.
1611
- *
1612
- * 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.
1613
- *
1614
- * > Notes:
1615
- * > - This method supports Chrome 65+, Safari, and the latest Firefox.
1616
- * > - This method might not take effect on some mobile devices.
1617
- * > - Agora recommends switching between video tracks that are of the same type and have the same encoder configurations for the following reasons:
1618
- * > - 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).
1619
- * > - If the encoder configurations (`encoderConfig`) are different, the actual sending resolution or frame rate might be different from what you set.
1620
- * > - The subscriber will not be notified if the track gets replaced.
1621
- * > - To switch the media input devices, Agora recommends using {@link ICameraVideoTrack.setDevice}.
1622
- *
1623
- * **Example**
1624
- * ```javascript
1625
- * // Current video track
1626
- * const localVideoTrack = await AgoraRTC.createCameraVideoTrack();
1627
- * // Gets the new video track (option one)
1628
- * const newTrack = localVideoTrack.getMediaStreamTrack();
1629
- * // Gets the new video track (option two)
1630
- * const newTrack = await navigator.mediaDevices.getUserMedia({audio: true, video: true}).then(mediaStream => mediaStream.getVideoTracks()[0]);
1631
- * // Replaces and stops the current video track
1632
- * await localVideoTrack.replaceTrack(newTrack, true);
1633
- * ```
1634
- * @param track The new video track, which is a [MediaStreamTrack](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack) object.
1635
- * @param stopOldTrack Whether to stop the old video track:
1636
- * - true: Stops the old video track.
1637
- * - false: Retains the old video track.
1638
- */
1639
- replaceTrack(track: MediaStreamTrack, stopOldTrack: boolean): Promise<void>;
1640
- /**
1641
- * Sets the video encoder configurations, such as resolution, frame rate, and bitrate.
1642
- *
1643
- * @param config The video encoder configurations. You can pass either [[VideoEncoderConfigurationPreset]] or a customized [[VideoEncoderConfiguration]] object.
1644
- */
1645
- setEncoderConfiguration(config: VideoEncoderConfiguration | VideoEncoderConfigurationPreset): Promise<void>;
1646
- /**
1647
- * Add the SEI data to the H.264 video stream.
1648
- *
1649
- * @param config SEI data.
1650
- */
1651
- sendSeiData(sei: Uint8Array): void;
1652
- }
1653
-
1654
- export declare interface ImageTypedData {
1655
- buffer: Uint8Array;
1656
- width: number;
1657
- height: number;
1658
- }
1659
-
1660
- /**
1661
- * 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.
1662
- *
1663
- * You can create a local microphone audio track by calling [AgoraRTC.createMicrophoneAudioTrack]{@link IAgoraRTC.createMicrophoneAudioTrack}.
1664
- */
1665
- export declare interface IMicrophoneAudioTrack extends ILocalAudioTrack {
1666
- /**
1667
- * Sets the device for sampling audio.
1668
- *
1669
- * > You can call the method either before or after publishing an audio track.
1670
- *
1671
- * @param deviceId The ID of the specified device. You can get the `deviceId` by calling [AgoraRTC.getMicrophones]{@link IAgoraRTC.getMicrophones}.
1672
- */
1673
- setDevice(deviceId: string): Promise<void>;
1674
- /**
1675
- * @since
1676
- * <br>&emsp;&emsp;&emsp;*4.0.0*
1677
- *
1678
- * Enables/Disables the track.
1679
- *
1680
- * After a track is disabled, the SDK stops playing and publishing the track.
1681
- *
1682
- * > - Disabling a track does not trigger the [LocalTrack.on("track-ended")]{@link event_track_ended} event.
1683
- * > - 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.
1684
- * > - Do not call `setEnabled` and `setMuted` together.
1685
- *
1686
- * @param enabled Whether to enable the track:
1687
- * - `true`: Enable the track.
1688
- * - `false`: Disable the track.
1689
- */
1690
- setEnabled(enabled: boolean): Promise<void>;
1691
- }
1692
-
1693
- export declare function interceptLocalAudioFrame(sender: RTCRtpSender): Promise<void>;
1694
-
1695
- export declare function interceptLocalVideoFrame(sender: RTCRtpSender, localVideoTrack: LocalVideoTrack): Promise<void>;
1696
-
1697
- export declare function interceptRemoteAudioFrame(receiver: RTCRtpReceiver): Promise<void>;
1698
-
1699
- export declare function interceptRemoteVideoFrame(receiver: RTCRtpReceiver, options?: InterceptVideoFrameOptions): Promise<void>;
1700
-
1701
- declare interface InterceptVideoFrameOptions {
1702
- onSei?: (sei: Uint8Array) => void;
1703
- }
1704
-
1705
- /**
1706
- * `RemoteAudioTrack` is the basic interface for the remote audio track.
1707
- *
1708
- * You can get create a remote audio track by the [AgoraRTCRemoteUser.audioTrack]{@link IAgoraRTCRemoteUser.audioTrack} object after calling [subscribe]{@link IAgoraRTCClient.subscribe}.
1709
- */
1710
- export declare interface IRemoteAudioTrack extends IRemoteTrack {
1711
- /**
1712
- * Gets the statistics of a remote audio track.
1713
- *
1714
- * @return An [[RemoteAudioTrackStats]] object.
1715
- */
1716
- getStats(): RemoteAudioTrackStats;
1717
- /**
1718
- * Plays a remote audio track.
1719
- *
1720
- * > When playing the audio track, you do not need to pass any DOM element.
1721
- */
1722
- play(): void;
1723
- /**
1724
- * @since
1725
- * <br>&emsp;&emsp;&emsp;*4.1.0*
1726
- *
1727
- * Sets the audio playback device, for example, the speaker.
1728
- *
1729
- * > This method supports Chrome and Edge on desktop devices only. Other browsers throw a `NOT_SUPPORTED` error when calling this method.
1730
- * @param deviceId Device ID, which can be retrieved by calling [[getPlaybackDevices]].
1731
- */
1732
- setPlaybackDevice(deviceId: string): Promise<void>;
1733
- /**
1734
- * Sets the callback for getting raw audio data in PCM format.
1735
- *
1736
- * 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).
1737
- *
1738
- * > 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.
1739
- *
1740
- * ```js
1741
- * track.setAudioFrameCallback((buffer) => {
1742
- * for (let channel = 0; channel < buffer.numberOfChannels; channel += 1) {
1743
- * // Float32Array with PCM data
1744
- * const currentChannelData = buffer.getChannelData(channel);
1745
- * console.log("PCM data in channel", channel, currentChannelData);
1746
- * }
1747
- * }, 2048);
1748
- *
1749
- * // ....
1750
- * // Stop getting the raw audio data
1751
- * track.setAudioFrameCallback(null);
1752
- * ```
1753
- *
1754
- * @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.
1755
- * @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.
1756
- */
1757
- setAudioFrameCallback(audioFrameCallback: null | ((buffer: AudioBuffer) => void), frameSize?: number): void;
1758
- /**
1759
- * Sets the volume of a remote audio track.
1760
- *
1761
- * @param volume The volume. The value ranges from 0 (mute) to 100 (maximum). A value of 100 is the current volume.
1762
- */
1763
- setVolume(volume: number): void;
1764
- /**
1765
- * Gets the audio level of a remote audio track.
1766
- *
1767
- * @returns The audio level. The value range is [0,1]. 1 is the highest audio level.
1768
- * Usually a user with audio level above 0.6 is a speaking user.
1769
- */
1770
- getVolumeLevel(): number;
1771
- /**
1772
- * @since
1773
- * <br>&emsp;&emsp;&emsp;*4.13.0*
1774
- *
1775
- * Inserts a `Processor` to the remote audio track.
1776
- *
1777
- * @param processor The `Processor` instance. Each extension has a corresponding type of `Processor`.
1778
- *
1779
- * @returns The `Processor` instance.
1780
- */
1781
- pipe(processor: IAudioProcessor): IAudioProcessor;
1782
- /**
1783
- * @since
1784
- * <br>&emsp;&emsp;&emsp;*4.13.0*
1785
- *
1786
- * Removes the `Processor` inserted to the remote audio track.
1787
- */
1788
- unpipe(): void;
1789
- /**
1790
- * @since
1791
- * <br>&emsp;&emsp;&emsp;*4.13.0*
1792
- *
1793
- * The destination of the current processing pipeline on the remote audio track.
1794
- */
1795
- processorDestination: IAudioProcessor;
1796
- }
1797
-
1798
- /**
1799
- * @ignore
1800
- */
1801
- export declare interface IRemoteDataChannel extends IDataChannel {
1802
- /** @internal */
1803
- on(event: "open", listener: typeof event_user_datachannel_open): void;
1804
- /** @internal */
1805
- on(event: "close", listener: typeof event_user_datachannel_close): void;
1806
- /** @internal */
1807
- on(event: "error", listener: typeof event_user_datachannel_error): void;
1808
- /** @internal */
1809
- on(event: "message", listener: typeof event_user_datachannel_message): void;
1810
- }
1811
-
1812
- /**
1813
- * `RemoteTrack` is the basic interface for remote tracks, providing public methods for [RemoteAudioTrack]{@link IRemoteAudioTrack} and [RemoteVideoTrack]{@link IRemoteVideoTrack}.
1814
- */
1815
- export declare interface IRemoteTrack extends ITrack {
1816
- /**
1817
- * @param event The event name.
1818
- * @param listener See [first-frame-decoded]{@link event_first_frame_decoded}.
1819
- */
1820
- on(event: "first-frame-decoded", listener: typeof event_first_frame_decoded): void;
1821
- /**
1822
- * Adds an event listener.
1823
- * @param event The event name.
1824
- * @param listener See [IRemoteTrack.transceiver-updated]{@link event_transceiver_updated_2}.
1825
- */
1826
- on(event: "transceiver-updated", listener: typeof event_transceiver_updated_2): void;
1827
- /**
1828
- * Gets the `uid` of the remote user who publishes the remote track.
1829
- *
1830
- * @return The `uid` of the remote user.
1831
- */
1832
- getUserId(): UID;
1833
- /**
1834
- * Gets the statistics of a remote track.
1835
- *
1836
- * @deprecated from v4.1.0. Use [AgoraRTCClient.getRemoteVideoStats]{@link IAgoraRTCClient.getRemoteVideoStats} and [AgoraRTCClient.getRemoteAudioStats]{@link IAgoraRTCClient.getRemoteAudioStats} instead.
1837
- * @return An [[RemoteAudioTrackStats]] or [[RemoteVideoTrackStats]] object.
1838
- */
1839
- getStats(): RemoteAudioTrackStats | RemoteVideoTrackStats;
1840
- }
1841
-
1842
- /**
1843
- * `RemoteVideoTrack` is the basic interface for the remote video track.
1844
- *
1845
- * You can get create a remote video track by the [AgoraRTCRemoteUser.videoTrack]{@link IAgoraRTCRemoteUser.videoTrack} object after calling [subscribe]{@link IAgoraRTCClient.subscribe}.
1846
- */
1847
- export declare interface IRemoteVideoTrack extends IRemoteTrack {
1848
- /**
1849
- * @param event The event name.
1850
- * @param listener See [video-state-changed]{@link event_video_state_changed}.
1851
- */
1852
- on(event: "video-state-changed", listener: typeof event_video_state_changed): void;
1853
- /**
1854
- * @param event The event name.
1855
- * @param listener See [first-frame-decoded]{@link event_first_frame_decoded}.
1856
- */
1857
- on(event: "first-frame-decoded", listener: typeof event_first_frame_decoded): void;
1858
- /**
1859
- * @param event The event name.
1860
- * @param listener See [video-element-visible-status]{@link event_video_element_visible_status_2}.
1861
- */
1862
- on(event: "video-element-visible-status", listener: typeof event_video_element_visible_status_2): void;
1863
- /**
1864
- * Adds an event listener.
1865
- * @param event The event name.
1866
- * @param listener See [IRemoteTrack.transceiver-updated]{@link event_transceiver_updated_2}.
1867
- */
1868
- on(event: "transceiver-updated", listener: typeof event_transceiver_updated_2): void;
1869
- /**
1870
- * Adds an event listener.
1871
- * @param event The event name.
1872
- * @param listener See [ILocalTrack.sei-received]{@link event_sei_received}.
642
+ * Adds an event listener.
643
+ * @param event The event name.
644
+ * @param listener See [ILocalTrack.sei-received]{@link event_sei_received}.
1873
645
  */
1874
646
  on(event: "sei-received", listener: typeof event_sei_received): void;
1875
647
  /**
1876
- * Gets the statistics of a remote video track.
1877
- *
1878
- * @return An [[RemoteVideoTrackStats]] object。
1879
- */
1880
- getStats(): RemoteVideoTrackStats;
1881
- /**
1882
- * Plays a remote video track on the web page.
1883
- *
1884
- * @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:
1885
- * - `string`: Specify the ID of the DOM element.
1886
- * - `HTMLElement`: Pass a DOM object.
1887
- * @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.
1888
- */
1889
- play(element: string | HTMLElement, config?: VideoPlayerConfig): void;
1890
- /**
1891
- * @since
1892
- * <br>&emsp;&emsp;&emsp;*4.1.0*
1893
- *
1894
- * Gets the data of the video frame being rendered.
1895
- *
1896
- * > You should call this method after calling [[play]]. Otherwise, the method call returns null.
1897
- *
1898
- * @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).
1899
- */
1900
- getCurrentFrameData(): ImageData;
1901
- /**
1902
- * @since
1903
- * <br>&emsp;&emsp;&emsp;*4.8.0*
1904
- *
1905
- * Gets the visibility of the `<video>` HTML tag.
1906
- *
1907
- * 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.
1908
- *
1909
- * @returns The [[CheckVideoVisibleResult]] object. If this method returns `undefined`, it may be due to the following reasons:
1910
- * - `localRemoteTrack.isPlaying` is `false`.
1911
- * - The `<video>` tag does not exist.
1912
- * - The `<video>` tag is not created by calling the `play` method.
1913
- */
1914
- getVideoElementVisibleStatus(): CheckVideoVisibleResult | undefined;
1915
- /**
1916
- * @since
1917
- * <br>&emsp;&emsp;&emsp;*4.13.0*
1918
- *
1919
- * Inserts a `Processor` to the remote video track.
1920
- *
1921
- * @param processor The `Processor` instance. Each extension has a corresponding type of `Processor`.
1922
- *
1923
- * @returns The `Processor` instance.
1924
- */
1925
- pipe(processor: IBaseProcessor): IBaseProcessor;
1926
- /**
1927
- * @since
1928
- * <br>&emsp;&emsp;&emsp;*4.13.0*
1929
- *
1930
- * Removes the `Processor` inserted to the remote video track.
1931
- */
1932
- unpipe(): void;
1933
- /**
1934
- * @since
1935
- * <br>&emsp;&emsp;&emsp;*4.13.0*
1936
- *
1937
- * The destination of the current processing pipeline on the remote video track.
1938
- */
1939
- processorDestination: IBaseProcessor;
1940
- }
1941
-
1942
- export declare function isAudioEncoderConfiguration(config: AudioEncoderConfiguration): config is AudioEncoderConfiguration;
1943
-
1944
- export declare function isAudioEncoderConfigurationOrPreset(profile: any): profile is AudioEncoderConfigurationPreset | AudioEncoderConfiguration;
1945
-
1946
- export declare function isBeautyEffectOptions(options: BeautyEffectOptions): options is BeautyEffectOptions;
1947
-
1948
- export { isElectron }
1949
-
1950
- export declare function isLowStreamParameter(streamParameter: any): streamParameter is LowStreamParameter;
1951
-
1952
- export declare function isScreenSourceType(mediaSource: any): mediaSource is ScreenSourceType;
1953
-
1954
- export declare function isVideoEncoderConfiguration(config: VideoEncoderConfiguration): config is VideoEncoderConfiguration;
1955
-
1956
- export declare function isVideoEncoderConfigurationOrPreset(profile: any): profile is VideoEncoderConfigurationPreset | VideoEncoderConfiguration;
1957
-
1958
- export declare interface ITrack extends EventEmitter {
1959
- /**
1960
- * The type of a media track:
1961
- * - `"audio"`: Audio track.
1962
- * - `"video"`: Video track.
1963
- */
1964
- trackMediaType: "audio" | "video";
1965
- /**
1966
- * Whether a media track is playing on the webpage:
1967
- * - `true`: The media track is playing on the webpage.
1968
- * - `false`: The media track is not playing on the webpage.
1969
- */
1970
- isPlaying: boolean;
1971
- /**
1972
- * Gets the ID of a media track, a unique identifier generated by the SDK.
1973
- *
1974
- * @return The media track ID.
1975
- */
1976
- getTrackId(): string;
1977
- /**
1978
- * Gets an [MediaStreamTrack](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack) object.
1979
- *
1980
- * @return An [MediaStreamTrack](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack) object.
1981
- */
1982
- getMediaStreamTrack(): MediaStreamTrack;
1983
- /**
1984
- * Gets the [RTCRtpTransceiver](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpTransceiver) instance of the current track.
1985
- *
1986
- * This method is currently mainly used for end-to-end encryption of video streams (Beta).
1987
- *
1988
- * > 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:
1989
- * > - For a local track: [ILocalTrack.transceiver-updated]{@link event_transceiver_updated}
1990
- * > - For a remote track: [IRemoteTrack.transceiver-updated]{@link event_transceiver_updated_2}
1991
- *
1992
- * @param type The type of the video stream. See {@link StreamType}.
1993
- * @returns The [RTCRtpTransceiver](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpTransceiver) instance of the current track.
1994
- */
1995
- getRTCRtpTransceiver(type?: StreamType): RTCRtpTransceiver | undefined;
1996
- /**
1997
- * Plays a media track on the webpage.
1998
- *
1999
- * @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:
2000
- * - `string`: Specify the ID of the DOM element.
2001
- * - `HTMLElement`: Pass a DOM object.
2002
- */
2003
- play(element?: string | HTMLElement): void;
2004
- /**
2005
- * Stops playing the media track.
2006
- */
2007
- stop(): void;
2008
- }
2009
-
2010
- export declare class LocalAudioTrack extends LocalTrack implements ILocalAudioTrack {
2011
- readonly trackMediaType: "audio" | "video";
2012
- _encoderConfig?: AudioEncoderConfiguration;
2013
- _trackSource: AudioTrackSource | FakeTrackSource;
2014
- get _source(): AudioTrackSource;
2015
- set _source(source: AudioTrackSource | FakeTrackSource);
2016
- _enabled: boolean;
2017
- private _volume;
2018
- _useAudioElement: boolean;
2019
- _bypassWebAudio: boolean;
2020
- protected processor?: IAudioProcessor;
2021
- protected _processorContext: AudioProcessorContext | undefined;
2022
- protected get processorContext(): AudioProcessorContext;
2023
- _processorDestination: AudioProcessorDestination | undefined;
2024
- get processorDestination(): AudioProcessorDestination;
2025
- protected _getOriginVolumeLevel: boolean;
2026
- get isPlaying(): boolean;
2027
- get __className__(): string;
2028
- constructor(track: MediaStreamTrack, encoderConfig?: AudioEncoderConfiguration, trackId?: string, getOriginVolumeLevel?: boolean);
2029
- setVolume(volume: number): void;
2030
- getVolumeLevel(): number;
2031
- setPlaybackDevice(deviceId: string): Promise<void>;
2032
- setEnabled(enabled: boolean, _?: any, skipChangeState?: boolean): Promise<void>;
2033
- protected _setEnabled(enabled: boolean, _?: any, skipChangeState?: boolean): Promise<void>;
2034
- setMuted(muted: boolean): Promise<void>;
2035
- getStats(): LocalAudioTrackStats;
2036
- setAudioFrameCallback(callback: null | ((buffer: AudioBuffer) => void), frameSize?: number): void;
2037
- play(): void;
2038
- stop(): void;
2039
- close(): void;
2040
- protected _updatePlayerSource(updateWebAudioSource?: boolean): void;
2041
- protected _updateOriginMediaStreamTrack(track: MediaStreamTrack, stopOldTrack: boolean): Promise<void>;
2042
- renewMediaStreamTrack(newConstraints?: MediaTrackConstraints): Promise<void>;
2043
- pipe(processor: IAudioProcessor): IAudioProcessor;
2044
- unpipe(): void;
2045
- private bindProcessorDestinationEvents;
2046
- private unbindProcessorDestinationEvents;
2047
- protected bindProcessorContextEvents(processorContext: AudioProcessorContext): void;
2048
- protected unbindProcessorContextEvents(processorContext: AudioProcessorContext): void;
2049
- private initWebAudio;
2050
- private initProcessor;
2051
- }
2052
-
2053
- /**
2054
- * Information of the local audio track, which can be retrieved by calling [AgoraRTCClient.getLocalAudioStats]{@link IAgoraRTCClient.getLocalAudioStats}.
2055
- */
2056
- export declare interface LocalAudioTrackStats {
2057
- /**
2058
- * The audio codec.
2059
- *
2060
- * - `"opus"`: The audio codec is OPUS。
2061
- * - `"aac"`: The audio codec is AAC。
2062
- * - `"pcmu"`: Reserved for future use.
2063
- * - `"pcma"`: Reserved for future use.
2064
- * - `"g722"`: Reserved for future use.
2065
- *
2066
- * > Firefox does not support this property.
2067
- */
2068
- codecType?: "opus" | "aac" | "PCMU" | "PCMA" | "G722";
2069
- /**
2070
- * The energy level of the sent audio.
2071
- *
2072
- * The value range is [0,32767].
2073
- *
2074
- * > 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}.
2075
- */
2076
- sendVolumeLevel: number;
2077
- /**
2078
- * The bitrate (bps) of the sent audio.
2079
- */
2080
- sendBitrate: number;
2081
- /**
2082
- * The total bytes of the sent audio.
2083
- */
2084
- sendBytes: number;
2085
- /**
2086
- * The total packets of the sent audio.
2087
- */
2088
- sendPackets: number;
2089
- /**
2090
- * The total number of lost audio packets that were sent.
2091
- *
2092
- * > You can not get this property on Safari.
2093
- */
2094
- sendPacketsLost: number;
2095
- /**
2096
- * Jitter (ms) of the audio packets that were sent.
2097
- */
2098
- sendJitterMs: number;
2099
- /**
2100
- * Round-trip time delay (ms) of the audio packets that were sent.
2101
- */
2102
- sendRttMs: number;
2103
- /**
2104
- * The packet loss rate of the sent audio in 400ms.
2105
- */
2106
- currentPacketLossRate: number;
2107
- }
2108
-
2109
- export declare class LocalDataChannel extends DataChannel implements ILocalDataChannel {
2110
- send(data: ArrayBuffer): void;
2111
- }
2112
-
2113
- export declare abstract class LocalTrack extends Track implements ILocalTrack {
2114
- _enabled: boolean;
2115
- _muted: boolean;
2116
- _isExternalTrack: boolean;
2117
- get isExternalTrack(): boolean;
2118
- get muted(): boolean;
2119
- get enabled(): boolean;
2120
- _isClosed: boolean;
2121
- protected _enabledMutex: PromiseMutex;
2122
- protected processor?: IBaseProcessor;
2123
- protected abstract _processorContext: IProcessorContext | undefined;
2124
- protected get processorContext(): IProcessorContext | undefined;
2125
- abstract processorDestination: IBaseProcessor;
2126
- constructor(track: MediaStreamTrack, trackId?: string);
2127
- abstract getStats(): LocalVideoTrackStats | LocalAudioTrackStats;
2128
- abstract setMuted(enabled: boolean): Promise<void>;
2129
- abstract setEnabled(enabled: boolean): Promise<void>;
2130
- getTrackLabel(): string;
2131
- close(): void;
2132
- protected _updateOriginMediaStreamTrack(track: MediaStreamTrack, stopOldTrack: boolean, isExternalTrack?: boolean): Promise<void>;
2133
- protected abstract _updatePlayerSource(): void;
2134
- protected _getDefaultPlayerConfig(): Partial<PlayerConfig>;
2135
- protected _handleTrackEnded: () => void;
2136
- protected onTrackEnded(): void;
2137
- protected stateCheck(stateName: "enabled" | "muted", state: boolean): void;
2138
- abstract renewMediaStreamTrack(): Promise<void>;
2139
- getProcessorStats(): ProcessorStats[];
2140
- getProcessorUsage(): Promise<UsageWithDirection[]>;
2141
- }
2142
-
2143
- export declare enum LocalTrackEvents {
2144
- SOURCE_STATE_CHANGE = "source-state-change",
2145
- TRACK_ENDED = "track-ended",
2146
- BEAUTY_EFFECT_OVERLOAD = "beauty-effect-overload",
2147
- VIDEO_ELEMENT_VISIBLE_STATUS = "video-element-visible-status",
2148
- CLOSED = "closed"
2149
- }
2150
-
2151
- export declare class LocalVideoTrack extends LocalTrack implements ILocalVideoTrack {
2152
- readonly trackMediaType: "audio" | "video";
2153
- _player?: AgoraRTCPlayer | VideoPlayer;
2154
- isUseScaleResolutionDownBy: boolean;
2155
- private _videoVisibleTimer;
2156
- protected _statsTimer: number | null;
2157
- private _previousVideoVisibleStatus;
2158
- private _clearPreviousVideoVisibleStatus;
2159
- _encoderConfig?: Partial<VideoEncoderConfiguration>;
2160
- _scalabilityMode?: SVCConfiguration;
2161
- _optimizationMode?: "motion" | "detail" | "balanced";
2162
- _videoHeight?: number;
2163
- _videoWidth?: number;
2164
- _forceBitrateLimit?: {
2165
- max_bitrate: number;
2166
- min_bitrate: number;
2167
- };
2168
- _enabled: boolean;
2169
- get isPlaying(): boolean;
2170
- processorDestination: VideoProcessorDestination;
2171
- protected _processorContext: VideoProcessorContext;
2172
- protected get processorContext(): VideoProcessorContext;
2173
- protected set processorContext(ctx: VideoProcessorContext);
2174
- get __className__(): string;
2175
- constructor(track: MediaStreamTrack, encoderConfig?: Partial<VideoEncoderConfiguration>, scalabilityConfig?: SVCConfiguration, optimizationMode?: "motion" | "detail" | "balanced", trackId?: string, hints?: TrackHint[]);
2176
- play(element: HTMLElement | HTMLVideoElement | string, config?: VideoPlayerConfig): void;
2177
- stop(): void;
2178
- setEnabled(enabled: boolean, skipChangeState?: boolean): Promise<void>;
2179
- setMuted(muted: boolean): Promise<void>;
2180
- setEncoderConfiguration(config: VideoEncoderConfiguration | VideoEncoderConfigurationPreset, doNotRenegoation?: boolean): Promise<void>;
2181
- getStats(): LocalVideoTrackStats;
2182
- setBeautyEffect(enabled: boolean, options?: BeautyEffectOptions): Promise<void>;
2183
- getCurrentFrameData(): ImageData;
2184
- getCurrentFrameImage(imageType: string, quality?: number): Promise<ImageTypedData>;
2185
- setBitrateLimit(bitrateLimit: {
2186
- max_bitrate: number;
2187
- min_bitrate: number;
2188
- }): Promise<void>;
2189
- setOptimizationMode(mode: "motion" | "detail" | "balanced"): Promise<void>;
2190
- setScalabiltyMode(mode: SVCConfiguration): void;
2191
- updateMediaStreamTrackResolution(): void;
2192
- protected _updatePlayerSource(): void;
2193
- protected _getDefaultPlayerConfig(): Partial<VideoPlayerConfig>;
2194
- protected setSenderConfiguration(config: VideoEncoderConfiguration | VideoEncoderConfigurationPreset): Promise<void>;
2195
- updateBitrateFromProfile(): void;
2196
- getVideoElementVisibleStatus(): CheckVideoVisibleResult | undefined;
2197
- renewMediaStreamTrack(newConstraints?: MediaTrackConstraints): Promise<void>;
2198
- pipe(processor: IBaseProcessor): IBaseProcessor;
2199
- unpipe(): void;
2200
- close(): void;
2201
- clone(config?: VideoEncoderConfiguration | VideoEncoderConfigurationPreset, cloneTrack?: boolean): LocalVideoTrack;
2202
- replaceTrack(track: MediaStreamTrack, stopOldTrack: boolean): Promise<void>;
2203
- startMonitorStats(): void;
2204
- sendSeiData(sei: Uint8Array): never;
2205
- private bindProcessorDestinationEvents;
2206
- private unbindProcessorDestinationEvents;
2207
- private unbindProcessorContextEvents;
2208
- }
2209
-
2210
- /**
2211
- * Information of the local video track, which can be retrieved by calling [AgoraRTCClient.getLocalVideoStats]{@link IAgoraRTCClient.getLocalVideoStats}.
2212
- */
2213
- export declare interface LocalVideoTrackStats {
2214
- /**
2215
- * The video codec.
2216
- *
2217
- * - `"H264"`: The video codec is H.264.
2218
- * - `"VP8"`: The video codec is VP8.
2219
- * - `"VP9"`: The video codec is VP9.
2220
- * - `"AV1X"`: Reserved for future use.
2221
- * - `"AV1"`: Reserved for future use.
2222
- *
2223
- * > You can not get this property on Firefox.
2224
- */
2225
- codecType?: "H264" | "H265" | "VP8" | "VP9" | "AV1X" | "AV1";
2226
- /**
2227
- * The total bytes of the sent video.
2228
- */
2229
- sendBytes: number;
2230
- /**
2231
- * The frame rate (fps) of the sent video.
2232
- *
2233
- * > You can not get this property on Firefox.
2234
- */
2235
- sendFrameRate?: number;
2236
- /**
2237
- * The frame rate (fps) of the captured video.
2238
- *
2239
- * > You can not get this property on Safari and Firefox.
2240
- */
2241
- captureFrameRate?: number;
2242
- /**
2243
- * The total packets of the sent video.
2244
- */
2245
- sendPackets: number;
2246
- /**
2247
- * The total number of lost video packets that were sent.
2248
- *
2249
- * > - You can not get this property on Safari.
2250
- * > - This property is inaccurate on Firefox.
2251
- */
2252
- sendPacketsLost: number;
2253
- /**
2254
- * Jitter (ms) of the video packets that were sent.
2255
- */
2256
- sendJitterMs: number;
2257
- /**
2258
- * Round-trip time delay (ms) of the video packets that were sent.
2259
- */
2260
- sendRttMs: number;
2261
- /**
2262
- * The resolution height (pixel) of the sent video.
648
+ * Gets the statistics of a remote video track.
649
+ *
650
+ * @return An [[RemoteVideoTrackStats]] object。
2263
651
  */
2264
- sendResolutionHeight: number;
652
+ getStats(): RemoteVideoTrackStats;
2265
653
  /**
2266
- * The resolution width (pixel) of the sent video.
654
+ * Plays a remote video track on the web page.
655
+ *
656
+ * @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:
657
+ * - `string`: Specify the ID of the DOM element.
658
+ * - `HTMLElement`: Pass a DOM object.
659
+ * @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.
2267
660
  */
2268
- sendResolutionWidth: number;
661
+ play(element: string | HTMLElement, config?: VideoPlayerConfig): void;
2269
662
  /**
2270
- * The resolution height (pixel) of the captured video.
663
+ * @since
664
+ * <br>&emsp;&emsp;&emsp;*4.1.0*
665
+ *
666
+ * Gets the data of the video frame being rendered.
667
+ *
668
+ * > You should call this method after calling [[play]]. Otherwise, the method call returns null.
669
+ *
670
+ * @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).
2271
671
  */
2272
- captureResolutionHeight: number;
672
+ getCurrentFrameData(): ImageData;
2273
673
  /**
2274
- * The resolution width (pixel) of the captured video.
674
+ * @since
675
+ * <br>&emsp;&emsp;&emsp;*4.8.0*
676
+ *
677
+ * Gets the visibility of the `<video>` HTML tag.
678
+ *
679
+ * 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.
680
+ *
681
+ * @returns The [[CheckVideoVisibleResult]] object. If this method returns `undefined`, it may be due to the following reasons:
682
+ * - `localRemoteTrack.isPlaying` is `false`.
683
+ * - The `<video>` tag does not exist.
684
+ * - The `<video>` tag is not created by calling the `play` method.
2275
685
  */
2276
- captureResolutionWidth: number;
686
+ getVideoElementVisibleStatus(): CheckVideoVisibleResult | undefined;
2277
687
  /**
2278
- * The time (ms) required for encoding the captured video.
688
+ * @since
689
+ * <br>&emsp;&emsp;&emsp;*4.13.0*
690
+ *
691
+ * Inserts a `Processor` to the remote video track.
692
+ *
693
+ * @param processor The `Processor` instance. Each extension has a corresponding type of `Processor`.
694
+ *
695
+ * @returns The `Processor` instance.
2279
696
  */
2280
- encodeDelay?: number;
697
+ pipe(processor: IBaseProcessor): IBaseProcessor;
2281
698
  /**
2282
- * The bitrate (bps) of the sent video.
699
+ * @since
700
+ * <br>&emsp;&emsp;&emsp;*4.13.0*
701
+ *
702
+ * Removes the `Processor` inserted to the remote video track.
2283
703
  */
2284
- sendBitrate: number;
704
+ unpipe(): void;
2285
705
  /**
2286
- * The target bitrate (bps) of the sent video, namely the bitrate set in {@link VideoEncoderConfiguration}.
706
+ * @since
707
+ * <br>&emsp;&emsp;&emsp;*4.13.0*
708
+ *
709
+ * The destination of the current processing pipeline on the remote video track.
2287
710
  */
2288
- targetSendBitrate: number;
711
+ processorDestination: IBaseProcessor;
712
+ }
713
+
714
+ export declare interface ITrack extends EventEmitter {
2289
715
  /**
2290
- * The total duration of the sent video in seconds.
716
+ * The type of a media track:
717
+ * - `"audio"`: Audio track.
718
+ * - `"video"`: Video track.
2291
719
  */
2292
- totalDuration: number;
720
+ trackMediaType: "audio" | "video";
2293
721
  /**
2294
- * The total freeze time of the encoded video in seconds.
722
+ * Whether a media track is playing on the webpage:
723
+ * - `true`: The media track is playing on the webpage.
724
+ * - `false`: The media track is not playing on the webpage.
2295
725
  */
2296
- totalFreezeTime: number;
726
+ isPlaying: boolean;
2297
727
  /**
2298
- * The packet loss rate of the sent video in 400ms.
728
+ * Gets the ID of a media track, a unique identifier generated by the SDK.
729
+ *
730
+ * @return The media track ID.
2299
731
  */
2300
- currentPacketLossRate: number;
2301
- }
2302
-
2303
- /**
2304
- * 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}.
2305
- */
2306
- export declare interface LowStreamParameter {
732
+ getTrackId(): string;
2307
733
  /**
2308
- * Width of the video.
2309
- *
2310
- * You can pass a `number`, or a constraint such as `{ max: 1280, min: 720 }`.
734
+ * Gets an [MediaStreamTrack](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack) object.
2311
735
  *
2312
- * For more details about the constraint, see [ConstrainLong]{@link ConstrainLong}.
736
+ * @return An [MediaStreamTrack](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack) object.
2313
737
  */
2314
- width: ConstrainULong;
738
+ getMediaStreamTrack(): MediaStreamTrack;
2315
739
  /**
2316
- * Height of the video.
740
+ * Gets the [RTCRtpTransceiver](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpTransceiver) instance of the current track.
741
+ *
742
+ * This method is currently mainly used for end-to-end encryption of video streams (Beta).
2317
743
  *
2318
- * You can pass a `number`, or a constraint such as `{ max: 1280, min: 720 }`.
744
+ * > 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:
745
+ * > - For a remote track: [IRemoteTrack.transceiver-updated]{@link event_transceiver_updated_2}
2319
746
  *
2320
- * For more details about the constraint, see [ConstrainLong]{@link ConstrainLong}.
747
+ * @param type The type of the video stream. See {@link StreamType}.
748
+ * @returns The [RTCRtpTransceiver](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpTransceiver) instance of the current track.
2321
749
  */
2322
- height: ConstrainULong;
750
+ getRTCRtpTransceiver(type?: StreamType): RTCRtpTransceiver | undefined;
2323
751
  /**
2324
- * Frame rate of the video (fps).
2325
- *
2326
- * You can pass a `number`, or a constraint such as `{ max: 30, min: 5 }`.
752
+ * Plays a media track on the webpage.
2327
753
  *
2328
- * For details about the constraint, see [ConstrainLong]{@link ConstrainLong}.
754
+ * @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:
755
+ * - `string`: Specify the ID of the DOM element.
756
+ * - `HTMLElement`: Pass a DOM object.
2329
757
  */
2330
- framerate?: ConstrainULong;
758
+ play(element?: string | HTMLElement): void;
2331
759
  /**
2332
- * Bitrate of the video (Kbps).
760
+ * Stops playing the media track.
2333
761
  */
2334
- bitrate?: number;
762
+ stop(): void;
2335
763
  }
2336
764
 
2337
765
  export declare const MediaElementNumStatus: {
@@ -2359,91 +787,6 @@ export declare interface MediaStats {
2359
787
  resolution: Resolution;
2360
788
  }
2361
789
 
2362
- export declare class MicrophoneAudioTrack extends LocalAudioTrack implements IMicrophoneAudioTrack {
2363
- _config: MicrophoneAudioTrackInitConfig;
2364
- _deviceName: string;
2365
- private _constraints;
2366
- private readonly _originalConstraints;
2367
- _enabled: boolean;
2368
- get __className__(): string;
2369
- constructor(track: MediaStreamTrack, config: MicrophoneAudioTrackInitConfig, constraints: MediaTrackConstraints, trackId?: string);
2370
- setDevice(deviceId: string): Promise<void>;
2371
- setEnabled(enabled: boolean, notCloseDevice?: boolean, skipChangeState?: boolean): Promise<void>;
2372
- close(): void;
2373
- protected onTrackEnded(): void;
2374
- renewMediaStreamTrack(newConstraints?: MediaTrackConstraints): Promise<void>;
2375
- protected bindProcessorContextEvents(processorContext: AudioProcessorContext): void;
2376
- protected unbindProcessorContextEvents(processorContext: AudioProcessorContext): void;
2377
- }
2378
-
2379
- /**
2380
- * Configurations for the audio track from the audio captured by a microphone. Set these configurations when calling [AgoraRTC.createMicrophoneAudioTrack]{@link IAgoraRTC.createMicrophoneAudioTrack}.
2381
- */
2382
- export declare interface MicrophoneAudioTrackInitConfig {
2383
- /**
2384
- * The audio encoder configurations.
2385
- *
2386
- * You can set the audio encoder configurations in either of the following ways:
2387
- * - Pass the preset audio encoder configurations by using [[AudioEncoderConfigurationPreset]].
2388
- * - Pass your customized audio encoder configurations by using [[AudioEncoderConfiguration]].
2389
- *
2390
- * > Firefox does not support setting the audio encoding rate.
2391
- */
2392
- encoderConfig?: AudioEncoderConfiguration | AudioEncoderConfigurationPreset;
2393
- /**
2394
- * Whether to enable acoustic echo cancellation:
2395
- * - `true`: Enable acoustic echo cancellation.
2396
- * - `false`: Do not enable acoustic echo cancellation.
2397
- */
2398
- AEC?: boolean;
2399
- /**
2400
- * Whether to enable audio gain control:
2401
- * - `true`: Enable audio gain control.
2402
- * - `false`: Do not enable audio gain control.
2403
- */
2404
- AGC?: boolean;
2405
- /**
2406
- * Whether to enable automatic noise suppression:
2407
- * - `true`: Enable automatic noise suppression.
2408
- * - `false`: Do not automatic noise suppression.
2409
- */
2410
- ANS?: boolean;
2411
- /**
2412
- * @ignore
2413
- */
2414
- DTX?: boolean;
2415
- /**
2416
- * Specifies the microphone ID.
2417
- *
2418
- * You can get a list of the available microphones by calling [AgoraRTC.getMicrophones]{@link IAgoraRTC.getMicrophones}.
2419
- */
2420
- microphoneId?: string;
2421
- /**
2422
- * @ignore
2423
- * Specifies whether or not audio track pass through WebAudio.
2424
- */
2425
- bypassWebAudio?: boolean;
2426
- }
2427
-
2428
- export declare class MixingAudioTrack extends LocalAudioTrack {
2429
- get __className__(): string;
2430
- trackList: LocalAudioTrack[];
2431
- private destNode;
2432
- get isActive(): boolean;
2433
- constructor();
2434
- hasAudioTrack(track: LocalAudioTrack): boolean;
2435
- addAudioTrack(track: LocalAudioTrack): void;
2436
- removeAudioTrack(track: LocalAudioTrack): void;
2437
- private updateEncoderConfig;
2438
- _updateRtpTransceiver(transceiver: RTCRtpTransceiver): void;
2439
- }
2440
-
2441
- export declare function onAudioInputChanged(callback?: (devices: DeviceInfo) => void): void;
2442
-
2443
- export declare function onAudioOutputChanged(callback?: (devices: DeviceInfo) => void): void;
2444
-
2445
- export declare function onVideoInputChanged(callback?: (devices: DeviceInfo) => void): void;
2446
-
2447
790
  export declare interface PlayerConfig extends VideoPlayerConfig {
2448
791
  trackId: string;
2449
792
  element: HTMLElement;
@@ -2578,14 +921,6 @@ export declare interface RemoteAudioTrackStats {
2578
921
  publishDuration: number;
2579
922
  }
2580
923
 
2581
- export declare class RemoteDataChannel extends DataChannel implements IRemoteDataChannel {
2582
- private _messageListener;
2583
- constructor(config: IDataChannelConfig);
2584
- _updateOriginDataChannel(datachannel: RTCDataChannel): void;
2585
- _close(): void;
2586
- private _bandRemoteDataChannelEvents;
2587
- }
2588
-
2589
924
  /**
2590
925
  * The stream fallback option. Set the stream fallback option when calling [setStreamFallbackOption]{@link IAgoraRTCClient.setStreamFallbackOption}.
2591
926
  *
@@ -2775,166 +1110,6 @@ export declare interface Resolution {
2775
1110
 
2776
1111
  export declare const SAFARI_GLOBAL_GUM_LOCK: PromiseMutex;
2777
1112
 
2778
- export declare interface ScreenConstraintsWithElectron extends MediaTrackConstraints {
2779
- sourceId?: string;
2780
- extensionId?: string;
2781
- mandatory?: any;
2782
- mediaSource?: ScreenSourceType;
2783
- width?: ConstrainULong;
2784
- height?: ConstrainULong;
2785
- displaySurface?: "browser" | "window" | "monitor";
2786
- selfBrowserSurface?: "include" | "exclude";
2787
- surfaceSwitching?: "include" | "exclude";
2788
- systemAudio?: "include" | "exclude";
2789
- }
2790
-
2791
- /**
2792
- * The preset video encoder configurations for screen sharing.
2793
- *
2794
- * You can pass the preset video encoder configurations when calling [AgoraRTC.createScreenVideoTrack]{@link IAgoraRTC.createScreenVideoTrack}.
2795
- *
2796
- * The following table lists all the preset video profiles for screen sharing.
2797
- *
2798
- * | Video Profile | Resolution (Width×Height) | Frame Rate (fps) |
2799
- * | -------- | --------------- | ----------- |
2800
- * | "480p" | 640 × 480 | 5 |
2801
- * | "480p_1" | 640 × 480 | 5 |
2802
- * | "480p_2" | 640 × 480 | 30 |
2803
- * | "480p_3" | 640 × 480 | 15 |
2804
- * | "720p" | 1280 × 720 | 5 |
2805
- * | "720p_1" | 1280 × 720 | 5 |
2806
- * | "720p_2" | 1280 × 720 | 30 |
2807
- * | "720p_3" | 1280 × 720 | 15 |
2808
- * | "720p_auto" <sup>①</sup> | 1280 × 720 | 30 |
2809
- * | "1080p" | 1920 × 1080 | 5 |
2810
- * | "1080p_1" | 1920 × 1080 | 5 |
2811
- * | "1080p_2" | 1920 × 1080 | 30 |
2812
- * | "1080p_3" | 1920 × 1080 | 15 |
2813
- *
2814
- * > <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.
2815
- */
2816
- export declare type ScreenEncoderConfigurationPreset = keyof typeof SUPPORT_SCREEN_ENCODER_CONFIG_LIST;
2817
-
2818
- /**
2819
- * The type of the source for screen sharing.
2820
- * - `"screen"`: Sharing the whole screen.
2821
- * - `"application"`: Sharing all windows of an app.
2822
- * - `"window"`: Sharing a window of an app.
2823
- */
2824
- export declare type ScreenSourceType = "screen" | "window" | "application";
2825
-
2826
- /**
2827
- * Configurations for the video track for screen sharing. Set these configurations when calling [AgoraRTC.createScreenVideoTrack]{@link IAgoraRTC.createScreenVideoTrack}.
2828
- */
2829
- export declare interface ScreenVideoTrackInitConfig {
2830
- /**
2831
- * The video encoder configurations for screen sharing.
2832
- *
2833
- * You can set the video encoder configurations in either of the following ways:
2834
- * - Pass the preset video encoder configurations by using [[ScreenEncoderConfigurationPreset]].
2835
- * - Pass your customized video encoder configurations by using [[VideoEncoderConfiguration]].
2836
- * - Leave this property empty to use the SDK's default value, `"1080p_2"` (resolution: 1920 × 1080, frame rate: 30 fps, bitrate: 3000 Kbps).
2837
- */
2838
- encoderConfig?: VideoEncoderConfiguration | ScreenEncoderConfigurationPreset;
2839
- /**
2840
- * The `sourceId` when you share the screen through Electron.
2841
- */
2842
- electronScreenSourceId?: string;
2843
- /**
2844
- * The `extensionId` when you share the screen with a Chrome extension.
2845
- */
2846
- extensionId?: string;
2847
- /**
2848
- *
2849
- * @deprecated from v4.17.1. Use {@link displaySurface} instead.
2850
- *
2851
- * The type of the source for screen sharing.
2852
- */
2853
- screenSourceType?: ScreenSourceType;
2854
- /**
2855
- * @since
2856
- * <br>&emsp;&emsp;&emsp;*4.0.0*
2857
- *
2858
- * Transmission optimization mode. Whether to prioritize video quality or smoothness:
2859
- * - `"detail"`: (Default) Prioritizes video quality.
2860
- * - 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.
2861
- * - In most cases, the SDK does not reduce the sending resolution, but may reduce the frame rate.
2862
- * - `"motion"`: Prioritizes video smoothness.
2863
- * - In poor network conditions, the SDK reduces the sending bitrate to minimize video freezes.
2864
- * - In most cases, the SDK does not reduce the frame rate, but may reduce the sending resolution.
2865
- *
2866
- * > Note: This method is only supported on Chrome.
2867
- */
2868
- optimizationMode?: "motion" | "detail";
2869
- /**
2870
- * @ignore
2871
- *
2872
- * @since
2873
- * <br>&emsp;&emsp;&emsp;*4.18.0*
2874
- *
2875
- * Configurations for Scalable Video Coding (SVC).
2876
- *
2877
- * You can set the configurations using one of the following options:
2878
- * - Use the preset SVC configurations provided by the SDK through {@link SVCConfigurationPreset}.
2879
- * - Use your custom SVC configurations through {@link SVCConfiguration}.
2880
- */
2881
- scalabiltyMode?: SVCConfiguration | SVCConfigurationPreset;
2882
- /**
2883
- *
2884
- * @since
2885
- * <br>&emsp;&emsp;&emsp;*4.17.1*
2886
- *
2887
- * The pre-selected pane in the media picker. See [displaySurface](https://developer.chrome.com/docs/web-platform/screen-sharing-controls/#displaySurface) for details.
2888
- *
2889
- * > Note: This property is supported on Chrome 107 and later, as well as Edge 107 and later.
2890
- */
2891
- displaySurface?: "browser" | "window" | "monitor";
2892
- /**
2893
- *
2894
- * @since
2895
- * <br>&emsp;&emsp;&emsp;*4.17.1*
2896
- *
2897
- * Whether to allow the user to share the current tab:
2898
- * - `"include"`: (Default) Allows the user to share the current tab.
2899
- * - `"exclude"`: Prevents the user from sharing the current tab.
2900
- *
2901
- * See [displaySurface](https://developer.chrome.com/docs/web-platform/screen-sharing-controls/#displaySurface) for details.
2902
- *
2903
- * > Note:
2904
- * > - 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.
2905
- * > - This property is supported on Chrome 107 and later, as well as Edge 107 and later.
2906
- */
2907
- selfBrowserSurface?: "include" | "exclude";
2908
- /**
2909
- *
2910
- * @since
2911
- * <br>&emsp;&emsp;&emsp;*4.17.1*
2912
- *
2913
- * Whether to allow the user to dynamically switch between shared tabs:
2914
- * - `"include"`: (Default) The user can dynamically switch between shared tabs.
2915
- * - `"exclude"`: The user cannot dynamically switch between shared tabs.
2916
- *
2917
- * See [surfaceSwitching](https://developer.chrome.com/docs/web-platform/screen-sharing-controls/#surfaceSwitching) for details.
2918
- *
2919
- * > Note: This property is supported on Chrome 107 and later, as well as Edge 107 and later.
2920
- */
2921
- surfaceSwitching?: "include" | "exclude";
2922
- /**
2923
- *
2924
- * @since
2925
- * <br>&emsp;&emsp;&emsp;*4.17.1*
2926
- *
2927
- * Whether to capture system audio:
2928
- * - `"include"`: (Default) Captures system audio.
2929
- * - `"exclude"`: Avoids capturing system audio
2930
- *
2931
- * See [systemAudio](https://developer.chrome.com/docs/web-platform/screen-sharing-controls/#systemAudio) for details.
2932
- *
2933
- * > Note: This property is supported on Chrome 105 and later (Windows only), as well as Edge 105 and later (Windows only).
2934
- */
2935
- systemAudio?: "include" | "exclude";
2936
- }
2937
-
2938
1113
  export declare function silenceScriptProcessHandler(e: AudioProcessingEvent): AudioBuffer;
2939
1114
 
2940
1115
  export declare interface StatsRegistry {
@@ -2955,72 +1130,6 @@ export declare enum StreamType {
2955
1130
  LOW_STREAM = 1
2956
1131
  }
2957
1132
 
2958
- export declare const SUPPORT_720P_AUTO_CONFIG_LIST: Required<{
2959
- scaleResolutionDownBy: number;
2960
- width: number;
2961
- height: number;
2962
- frameRate: number;
2963
- bitrateMin: number;
2964
- bitrateMax: number;
2965
- }>[];
2966
-
2967
- /**
2968
- * @ignore
2969
- */
2970
- export declare const SUPPORT_SCREEN_ENCODER_CONFIG_LIST: Record<string, VideoEncoderConfiguration>;
2971
-
2972
- /**
2973
- * @ignore
2974
- */
2975
- export declare const SUPPORT_SVC_CONFIG_LIST: Record<string, SVCConfiguration>;
2976
-
2977
- /**
2978
- * @ignore
2979
- */
2980
- export declare const SUPPORT_VIDEO_ENCODER_CONFIG_LIST: Record<string, VideoEncoderConfiguration>;
2981
-
2982
- /**
2983
- * @ignore
2984
- * @since
2985
- * <br>&emsp;&emsp;&emsp;*4.18.0*
2986
- *
2987
- * Custom SVC encoding configurations.
2988
- *
2989
- * You can control the SVC configurations for local video by passing `SVCConfiguration` in the following methods:
2990
- * - [AgoraRTC.createCameraVideoTrack]{@link IAgoraRTC.createCameraVideoTrack}
2991
- * - [AgoraRTC.createCustomVideoTrack]{@link IAgoraRTC.createCustomVideoTrack}
2992
- * - [AgoraRTC.createScreenVideoTrack]{@link IAgoraRTC.createScreenVideoTrack}
2993
- */
2994
- export declare interface SVCConfiguration {
2995
- /**
2996
- * Specifies the number of spatial layer in SVC.
2997
- */
2998
- numSpatialLayers: 1 | 2 | 3;
2999
- /**
3000
- * Specifies the number of temporal layer in SVC.
3001
- */
3002
- numTemporalLayers: 1 | 3;
3003
- }
3004
-
3005
- /**
3006
- * @ignore
3007
- *
3008
- * @since
3009
- * <br>&emsp;&emsp;&emsp;*4.18.0*
3010
- *
3011
- * The preset SVC configurations provided by the SDK.
3012
- * - `"1SL1TL"`: 1 spatial layer, 1 temporal layer.
3013
- * - `"3SL3TL"`: 3 spatial layers, 3 temporal layers.
3014
- * - `"2SL3TL"`: 2 spatial layers, 3 temporal layers.
3015
- *
3016
- * You can control the SVC configurations for local video by passing these preset values in the following methods:
3017
- * - [AgoraRTC.createCameraVideoTrack]{@link IAgoraRTC.createCameraVideoTrack}
3018
- * - [AgoraRTC.createCustomVideoTrack]{@link IAgoraRTC.createCustomVideoTrack}
3019
- * - [AgoraRTC.createScreenVideoTrack]{@link IAgoraRTC.createScreenVideoTrack}
3020
- *
3021
- */
3022
- export declare type SVCConfigurationPreset = keyof typeof SUPPORT_SVC_CONFIG_LIST;
3023
-
3024
1133
  export declare abstract class Track extends EventEmitter implements ITrack {
3025
1134
  abstract readonly trackMediaType: "audio" | "video";
3026
1135
  private _ID;
@@ -3047,7 +1156,8 @@ export declare abstract class Track extends EventEmitter implements ITrack {
3047
1156
  export declare enum TrackEvents {
3048
1157
  TRANSCEIVER_UPDATED = "transceiver-updated",
3049
1158
  SEI_TO_SEND = "sei-to-send",
3050
- SEI_RECEIVED = "sei-received"
1159
+ SEI_RECEIVED = "sei-received",
1160
+ CLOSED = "closed"
3051
1161
  }
3052
1162
 
3053
1163
  export declare enum TrackHint {
@@ -3082,111 +1192,6 @@ export declare interface UsageRegistry {
3082
1192
  cb: () => Usage | Promise<Usage>;
3083
1193
  }
3084
1194
 
3085
- /**
3086
- * `VideoEncoderConfiguration` is the interface that defines the video encoder configurations.
3087
- *
3088
- * You can customize the video encoder configurations when calling [AgoraRTC.createCameraVideoTrack]{@link IAgoraRTC.createCameraVideoTrack} or [AgoraRTC.createScreenVideoTrack]{@link IAgoraRTC.createScreenVideoTrack}.
3089
- *
3090
- * The SDK provides the preset video encoder configurations. For more information, see [[VideoEncoderConfigurationPreset]].
3091
- *
3092
- * > 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.
3093
- */
3094
- export declare interface VideoEncoderConfiguration {
3095
- /**
3096
- * Width of the video.
3097
- *
3098
- * You can pass a `number`, or a constraint such as `{ max: 1280, min: 720 }`.
3099
- *
3100
- * For more details about the constraint, see [ConstrainLong]{@link ConstrainLong}.
3101
- */
3102
- width?: number | ConstrainLong;
3103
- /**
3104
- * Height of the video.
3105
- *
3106
- * You can pass a `number`, or a constraint such as `{ max: 1280, min: 720 }`.
3107
- *
3108
- * For more details about the constraint, see [ConstrainLong]{@link ConstrainLong}.
3109
- */
3110
- height?: number | ConstrainLong;
3111
- /**
3112
- * Frame rate of the video (fps).
3113
- *
3114
- * You can pass a `number`, or a constraint such as `{ max: 30, min: 5 }`.
3115
- *
3116
- * For details about the constraint, see [ConstrainLong]{@link ConstrainLong}.
3117
- */
3118
- frameRate?: number | ConstrainLong;
3119
- /**
3120
- * The minimum bitrate of the video (Kbps).
3121
- */
3122
- bitrateMin?: number;
3123
- /**
3124
- * The maximum bitrate of the video (Kbps).
3125
- */
3126
- bitrateMax?: number;
3127
- /**
3128
- * @ignore
3129
- */
3130
- scaleResolutionDownBy?: number;
3131
- }
3132
-
3133
- /**
3134
- *
3135
- * The preset video encoder configurations.
3136
- *
3137
- * You can pass the preset video encoder configurations when calling [AgoraRTC.createCameraVideoTrack]{@link IAgoraRTC.createCameraVideoTrack} or [AgoraRTC.createScreenVideoTrack]{@link IAgoraRTC.createScreenVideoTrack}.
3138
- *
3139
- * The following table lists all the preset video profiles. The SDK uses `"480p_1"` by default.
3140
- *
3141
- * | Video Profile | Resolution (Width×Height) | Frame Rate (fps) | Bitrate (Kbps) | Chrome | Firefox | Safari |
3142
- * | -------- | --------------- | ----------- | ------------ | ------ | ------- | ------ |
3143
- * | 120p | 160 × 120 | 15 | 65 | ✓ | | |
3144
- * | 120p_1 | 160 × 120 | 15 | 65 | ✓ | | |
3145
- * | 120p_3 | 120 × 120 | 15 | 50 | ✓ | | |
3146
- * | 180p | 320 × 180 | 15 | 140 | ✓ | | |
3147
- * | 180p_1 | 320 × 180 | 15 | 140 | ✓ | | |
3148
- * | 180p_3 | 180 × 180 | 15 | 100 | ✓ | | |
3149
- * | 180p_4 | 240 × 180 | 15 | 120 | ✓ | | |
3150
- * | 240p | 320 × 240 | 15 | 200 | ✓ | | |
3151
- * | 240p_1 | 320 × 240 | 15 | 200 | ✓ | | |
3152
- * | 240p_3 | 240 × 240 | 15 | 140 | ✓ | | |
3153
- * | 240p_4 | 424 × 240 | 15 | 220 | ✓ | | |
3154
- * | 360p | 640 × 360 | 15 | 400 | ✓ | | |
3155
- * | 360p_1 | 640 × 360 | 15 | 400 | ✓ | | |
3156
- * | 360p_3 | 360 × 360 | 15 | 260 | ✓ | | |
3157
- * | 360p_4 | 640 × 360 | 30 | 600 | ✓ | | |
3158
- * | 360p_6 | 360 × 360 | 30 | 400 | ✓ | | |
3159
- * | 360p_7 | 480 × 360 | 15 | 320 | ✓ | | |
3160
- * | 360p_8 | 480 × 360 | 30 | 490 | ✓ | | |
3161
- * | 360p_9 | 640 × 360 | 15 | 800 | ✓ | | |
3162
- * | 360p_10 | 640 × 360 | 24 | 800 | ✓ | | |
3163
- * | 360p_11 | 640 × 360 | 24 | 1000 | ✓ | | |
3164
- * | 480p | 640 × 480 | 15 | 500 | ✓ | ✓ | ✓ |
3165
- * | 480p_1 | 640 × 480 | 15 | 500 | ✓ | ✓ | ✓ |
3166
- * | 480p_2 | 640 × 480 | 30 | 1000 | ✓ | ✓ | ✓ |
3167
- * | 480p_3 | 480 × 480 | 15 | 400 | ✓ | ✓ | ✓ |
3168
- * | 480p_4 | 640 × 480 | 30 | 750 | ✓ | ✓ | ✓ |
3169
- * | 480p_6 | 480 × 480 | 30 | 600 | ✓ | ✓ | ✓ |
3170
- * | 480p_8 | 848 × 480 | 15 | 610 | ✓ | ✓ | ✓ |
3171
- * | 480p_9 | 848 × 480 | 30 | 930 | ✓ | ✓ | ✓ |
3172
- * | 480p_10 | 640 × 480 | 10 | 400 | ✓ | ✓ | ✓ |
3173
- * | 720p | 1280 × 720 | 15 | 1130 | ✓ | ✓ | ✓ |
3174
- * | 720p_1 | 1280 × 720 | 15 | 1130 | ✓ | ✓ | ✓ |
3175
- * | 720p_2 | 1280 × 720 | 30 | 2000 | ✓ | ✓ | ✓ |
3176
- * | 720p_3 | 1280 × 720 | 30 | 1710 | ✓ | ✓ | ✓ |
3177
- * | 720p_auto <sup>①</sup> | 1280 × 720 | 30 | 3000 | ✓ | ✓ | ✓ |
3178
- * | 720p_5 | 960 × 720 | 15 | 910 | ✓ | ✓ | ✓ |
3179
- * | 720p_6 | 960 × 720 | 30 | 1380 | ✓ | ✓ | ✓ |
3180
- * | 1080p | 1920 × 1080 | 15 | 2080 | ✓ | | ✓ |
3181
- * | 1080p_1 | 1920 × 1080 | 15 | 2080 | ✓ | | ✓ |
3182
- * | 1080p_2 | 1920 × 1080 | 30 | 3000 | ✓ | | ✓ |
3183
- * | 1080p_3 | 1920 × 1080 | 30 | 3150 | ✓ | | ✓ |
3184
- * | 1080p_5 | 1920 × 1080 | 60 | 4780 | ✓ | | ✓ |
3185
- *
3186
- * > <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.
3187
- */
3188
- export declare type VideoEncoderConfigurationPreset = keyof typeof SUPPORT_VIDEO_ENCODER_CONFIG_LIST;
3189
-
3190
1195
  declare class VideoPlayer {
3191
1196
  trackId: string;
3192
1197
  config: PlayerConfig;