@agora-js/media 4.20.2 → 4.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@agora-js/media",
3
- "version": "4.20.2",
3
+ "version": "4.22.0",
4
4
  "description": "media module across @agora-js packages",
5
5
  "main": "AgoraRTC_N-media.js",
6
6
  "module": "AgoraRTC_N-media.esm.mjs",
7
- "types": "media.d.ts",
7
+ "types": "rtc-sdk-media_en.d.ts",
8
8
  "declaration": true,
9
9
  "author": "Agora WebRTC Team",
10
10
  "keywords": [
@@ -23,11 +23,10 @@
23
23
  "homepage": "https://api-ref.agora.io/en/voice-sdk/web/4.x/index.html",
24
24
  "peerDependencies": {},
25
25
  "dependencies": {
26
- "@agora-js/shared": "4.20.2",
27
- "@agora-js/report": "4.20.2",
28
- "axios": "^1.6.7",
26
+ "@agora-js/shared": "4.22.0",
27
+ "@agora-js/report": "4.22.0",
28
+ "axios": "^1.6.8",
29
29
  "agora-rte-extension": "^1.2.4",
30
- "webrtc-adapter": "8.2.0",
31
- "pako": "^2.1.0"
30
+ "webrtc-adapter": "8.2.0"
32
31
  }
33
32
  }
@@ -39,6 +39,8 @@ export declare interface AgoraRTCCompatibility {
39
39
  supportPCSetConfiguration: boolean;
40
40
  supportWebRTCEncodedTransform: boolean;
41
41
  supportWebRTCInsertableStream: boolean;
42
+ supportRequestVideoFrameCallback: boolean;
43
+ supportWebCrypto: boolean;
42
44
  }
43
45
 
44
46
  declare class AgoraRTCPlayer extends VideoPlayer {
@@ -217,12 +219,12 @@ export declare interface AudioEncoderConfiguration {
217
219
  *
218
220
  * | Audio Profile | Configurations |
219
221
  * | -------- | --------------- |
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.
222
+ * |`"speech_low_quality"`|Sample rate 16 kHz, mono, encoding bitrate 24 Kbps|
223
+ * |`"speech_standard"`|Sample rate 32 kHz, mono, encoding bitrate 24 Kbps|
224
+ * |`"music_standard"`|Sample rate 48 kHz, mono, encoding bitrate 32 Kbps|
225
+ * |`"standard_stereo"`|Sample rate 48 kHz, stereo, encoding bitrate 64 Kbps|
226
+ * |`"high_quality"`|Sample rate 48 kHz, mono, encoding bitrate 128 Kbps|
227
+ * |`"high_quality_stereo"`|Sample rate 48 kHz, stereo, encoding bitrate 192 Kbps| Kbps.
226
228
  * @public
227
229
  */
228
230
  export declare type AudioEncoderConfigurationPreset = keyof typeof AUDIO_ENCODER_CONFIG_SETTINGS;
@@ -487,7 +489,7 @@ export declare class CameraVideoTrack extends LocalVideoTrack implements ICamera
487
489
  _enabled: boolean;
488
490
  _deviceName: string;
489
491
  get __className__(): string;
490
- constructor(track: MediaStreamTrack, config: CameraVideoTrackInitConfig, constraints: MediaTrackConstraints, scalabilityConfig?: SVCConfiguration, optimizationMode?: "motion" | "detail" | "balanced", trackId?: string);
492
+ constructor(track: MediaStreamTrack, config: CameraVideoTrackInitConfig, constraints: MediaTrackConstraints, scalabilityConfig?: SVCConfiguration, optimizationMode?: OptimizationMode | "balanced", trackId?: string);
491
493
  setDevice(deviceId: string | RequiredOnlyOneOf<{
492
494
  facingMode: VideoFacingModeEnum;
493
495
  deviceId: string;
@@ -534,20 +536,23 @@ export declare interface CameraVideoTrackInitConfig {
534
536
  cameraId?: string;
535
537
  /**
536
538
  * @since
537
- * <br>&emsp;&emsp;&emsp;*4.0.0*
539
+ * <br>&emsp;&emsp;&emsp;*4.2.0*
540
+ *
541
+ * Sets the video transmission optimization mode.
542
+ *
543
+ * 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.
544
+ *
545
+ * > Note: This method supports Chrome only.
538
546
  *
539
- * Transmission optimization mode. Whether to prioritize video quality or smoothness:
547
+ * @param mode The video transmission optimization mode:
540
548
  * - `"detail"`: Prioritizes video quality.
541
549
  * - 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
550
  * - In most cases, the SDK does not reduce the sending resolution, but may reduce the frame rate.
543
- * - `"motion"`: Prioritizes video smoothness.
551
+ * - `"motion"`: Since 4.21.0, the SDK prioritizes video smoothness.
544
552
  * - In poor network conditions, the SDK reduces the sending bitrate to minimize video freezes.
545
553
  * - 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
554
  */
550
- optimizationMode?: "motion" | "detail";
555
+ optimizationMode?: OptimizationMode;
551
556
  /**
552
557
  * @ignore
553
558
  *
@@ -573,7 +578,7 @@ export declare function checkTrackState(): (target: any, propertyKey: any, descr
573
578
  * Get the visibility of the `<video>` tag through the following methods and events:
574
579
  * - [localVideoTrack.on("video-element-visible-status")]{@link ILocalVideoTrack.event_video_element_visible_status}
575
580
  * - [localVideoTrack.getVideoElementVisibleStatus]{@link ILocalVideoTrack.getVideoElementVisibleStatus}
576
- * - [remoteVideoTrack.on("video-element-visible-status")]{@link IRemoteVideoTrack.event_video_element_visible_status}
581
+ * - [remoteVideoTrack.on("video-element-visible-status")]{@link IRemoteVideoTrack.event_video_element_visible_status_2}
577
582
  * - [remoteVideoTrack.getVideoElementVisibleStatus]{@link IRemoteVideoTrack.getVideoElementVisibleStatus}
578
583
  *
579
584
  * This object contains the following parameters:
@@ -699,18 +704,24 @@ export declare interface CustomVideoTrackInitConfig {
699
704
  bitrateMax?: number;
700
705
  /**
701
706
  * @since
702
- * <br>&emsp;&emsp;&emsp;*4.0.0*
707
+ * <br>&emsp;&emsp;&emsp;*4.2.0*
708
+ *
709
+ * Sets the video transmission optimization mode.
703
710
  *
704
- * Transmission optimization mode. Whether to prioritize video quality or smoothness:
711
+ * 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.
712
+ *
713
+ * > Note: This method supports Chrome only.
714
+ *
715
+ * @param mode The video transmission optimization mode:
716
+ * - `"balanced"`: Uses the default optimization mode.
717
+ * - For a screen-sharing video track, the default transmission optimization strategy is to prioritizes clarity.
718
+ * - For the other types of video tracks, the SDK may reduce the frame rate or the sending resolution in poor network conditions.
705
719
  * - `"detail"`: Prioritizes video quality.
706
720
  * - 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
721
  * - In most cases, the SDK does not reduce the sending resolution, but may reduce the frame rate.
708
- * - `"motion"`: Prioritizes video smoothness.
722
+ * - `"motion"`: Since 4.21.0, the SDK prioritizes video smoothness.
709
723
  * - In poor network conditions, the SDK reduces the sending bitrate to minimize video freezes.
710
724
  * - 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
725
  */
715
726
  optimizationMode?: "motion" | "detail";
716
727
  /**
@@ -729,14 +740,16 @@ export declare interface CustomVideoTrackInitConfig {
729
740
  }
730
741
 
731
742
  export declare abstract class DataChannel extends EventEmitter implements IDataChannel {
743
+ readonly trackMediaType: TrackMediaType.DATA;
732
744
  private _version;
733
745
  private _type;
734
746
  _config: IDataChannelConfig;
735
747
  _originDataChannel?: RTCDataChannel;
736
748
  protected _dataStreamPacketHeader: ArrayBuffer;
737
- protected _dataStreamPacketHandler: DataStream;
749
+ protected _dataStreamPacketHandler: IDataStream;
738
750
  private _datachannelEventMap;
739
751
  constructor(config: IDataChannelConfig, datachannel?: RTCDataChannel);
752
+ useDataStream(dataStream: IDataStream): void;
740
753
  get id(): number;
741
754
  get ordered(): boolean;
742
755
  get maxRetransmits(): number;
@@ -761,20 +774,6 @@ export declare enum DataChannelEvents {
761
774
  ERROR = "error"
762
775
  }
763
776
 
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
777
  export declare function decodeAudioData(buffer: ArrayBuffer): Promise<AudioBuffer>;
779
778
 
780
779
  export declare const DEFAULT_LOCAL_AUDIO_TRACK_STATS: LocalAudioTrackStats;
@@ -794,6 +793,8 @@ export declare interface DenoiserStats {
794
793
  vl: number;
795
794
  }
796
795
 
796
+ export declare function detectSupportAudioElementSetSinkId(): boolean;
797
+
797
798
  /**
798
799
  * Information of the media input device.
799
800
  *
@@ -939,6 +940,13 @@ declare function event_source_state_change(currentState: AudioSourceState): void
939
940
  */
940
941
  declare function event_track_ended(): void;
941
942
 
943
+ /**
944
+ * Triggers when a media track is updated.
945
+ * @param track The media stream track. See [MediaStreamTrack](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack).
946
+ * @event
947
+ */
948
+ export declare function event_track_updated(track: MediaStreamTrack): void;
949
+
942
950
  /**
943
951
  * Occurs when the `RTCRtpTransceiver` instance of the current track is updated.
944
952
  *
@@ -1064,6 +1072,8 @@ export declare function getAudioEncoderConfiguration(profile: AudioEncoderConfig
1064
1072
 
1065
1073
  export declare function getBitrateConstrainRange(width: number, height: number, frameRate: number, bitrateMin?: number, bitrateMax?: number): DoubleRange;
1066
1074
 
1075
+ export declare function getBitrateFromResAndFps(width: number, height: number, fps: number): Required<DoubleRange>;
1076
+
1067
1077
  export declare function getCompatibility(): AgoraRTCCompatibility;
1068
1078
 
1069
1079
  export declare function getConstraintsFromCameraConfig(config: CameraVideoTrackInitConfig): MediaTrackConstraints;
@@ -1080,6 +1090,14 @@ export declare function getElectronScreenStreamByUserSelect(config: ScreenConstr
1080
1090
 
1081
1091
  export declare function getLocalStream(config: GetUserMediaConfig, id: string): Promise<MediaStream>;
1082
1092
 
1093
+ export declare const getOriginSenderConfig: (track: LocalVideoTrack) => {
1094
+ frameRate: number;
1095
+ bitrateMax: number;
1096
+ bitrateMin: number;
1097
+ scaleResolutionDownBy: number;
1098
+ scale: number;
1099
+ };
1100
+
1083
1101
  export declare function getScalabilityConfiguration(profile: SVCConfiguration | SVCConfigurationPreset): SVCConfiguration;
1084
1102
 
1085
1103
  export declare function getScreenEncoderConfiguration(profile: VideoEncoderConfiguration | ScreenEncoderConfigurationPreset | string): VideoEncoderConfiguration;
@@ -1276,6 +1294,11 @@ export declare interface IDataChannelConfig {
1276
1294
  metadata: string;
1277
1295
  }
1278
1296
 
1297
+ declare interface IDataStream {
1298
+ serialize: (payload: ArrayBuffer) => ArrayBuffer;
1299
+ deserialize: (packet: ArrayBuffer) => ArrayBuffer;
1300
+ }
1301
+
1279
1302
  /**
1280
1303
  * `LocalAudioTrack` is the basic interface for local audio tracks, providing main methods of local audio tracks.
1281
1304
  *
@@ -1390,6 +1413,11 @@ export declare interface ILocalDataChannel extends IDataChannel {
1390
1413
  * `LocalTrack` is the basic interface for local tracks, providing public methods for [LocalAudioTrack]{@link ILocalAudioTrack} and [LocalVideoTrack]{@link ILocalVideoTrack}.
1391
1414
  */
1392
1415
  export declare interface ILocalTrack extends ITrack {
1416
+ /**
1417
+ * @param event The event name.
1418
+ * @param listener See [track-updated]{@link event_track_updated}.
1419
+ */
1420
+ on(event: "track-updated", listener: typeof event_track_updated): void;
1393
1421
  /**
1394
1422
  * @param event The event name.
1395
1423
  * @param listener See [track-ended]{@link event_track_ended}.
@@ -1469,6 +1497,11 @@ export declare interface ILocalTrack extends ITrack {
1469
1497
  * Inherited from `LocalVideoTrack`, [CameraVideoTrack]{@link ICameraVideoTrack} is an interface for the video captured by a local camera and adds several camera-related functions.
1470
1498
  */
1471
1499
  export declare interface ILocalVideoTrack extends ILocalTrack {
1500
+ /**
1501
+ * @param event The event name.
1502
+ * @param listener See [track-updated]{@link event_track_updated}.
1503
+ */
1504
+ on(event: "track-updated", listener: typeof event_track_updated): void;
1472
1505
  /** @internal */
1473
1506
  on(event: "beauty-effect-overload", listener: typeof event_beauty_effect_overload): void;
1474
1507
  /**
@@ -1570,7 +1603,7 @@ export declare interface ILocalVideoTrack extends ILocalTrack {
1570
1603
  * - `"detail"`: Prioritizes video quality.
1571
1604
  * - 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.
1572
1605
  * - In most cases, the SDK does not reduce the sending resolution, but may reduce the frame rate.
1573
- * - `"motion"`: Prioritizes video smoothness.
1606
+ * - `"motion"`: Since 4.21.0, the SDK prioritizes video smoothness.
1574
1607
  * - In poor network conditions, the SDK reduces the sending bitrate to minimize video freezes.
1575
1608
  * - In most cases, the SDK does not reduce the frame rate, but may reduce the sending resolution.
1576
1609
  */
@@ -1825,6 +1858,11 @@ export declare interface IRemoteDataChannel extends IDataChannel {
1825
1858
  * `RemoteTrack` is the basic interface for remote tracks, providing public methods for [RemoteAudioTrack]{@link IRemoteAudioTrack} and [RemoteVideoTrack]{@link IRemoteVideoTrack}.
1826
1859
  */
1827
1860
  export declare interface IRemoteTrack extends ITrack {
1861
+ /**
1862
+ * @param event The event name.
1863
+ * @param listener See [track-updated]{@link event_track_updated}.
1864
+ */
1865
+ on(event: "track-updated", listener: typeof event_track_updated): void;
1828
1866
  /**
1829
1867
  * @param event The event name.
1830
1868
  * @param listener See [first-frame-decoded]{@link event_first_frame_decoded}.
@@ -1857,6 +1895,11 @@ export declare interface IRemoteTrack extends ITrack {
1857
1895
  * You can get create a remote video track by the [AgoraRTCRemoteUser.videoTrack]{@link IAgoraRTCRemoteUser.videoTrack} object after calling [subscribe]{@link IAgoraRTCClient.subscribe}.
1858
1896
  */
1859
1897
  export declare interface IRemoteVideoTrack extends IRemoteTrack {
1898
+ /**
1899
+ * @param event The event name.
1900
+ * @param listener See [track-updated]{@link event_track_updated}.
1901
+ */
1902
+ on(event: "track-updated", listener: typeof event_track_updated): void;
1860
1903
  /**
1861
1904
  * @param event The event name.
1862
1905
  * @param listener See [video-state-changed]{@link event_video_state_changed}.
@@ -1919,7 +1962,7 @@ export declare interface IRemoteVideoTrack extends IRemoteTrack {
1919
1962
  * 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.
1920
1963
  *
1921
1964
  * @returns The [[CheckVideoVisibleResult]] object. If this method returns `undefined`, it may be due to the following reasons:
1922
- * - `localRemoteTrack.isPlaying` is `false`.
1965
+ * - `remoteVideoTrack.isPlaying` is `false`.
1923
1966
  * - The `<video>` tag does not exist.
1924
1967
  * - The `<video>` tag is not created by calling the `play` method.
1925
1968
  */
@@ -1961,6 +2004,8 @@ export { isElectron }
1961
2004
 
1962
2005
  export declare function isLowStreamParameter(streamParameter: any): streamParameter is LowStreamParameter;
1963
2006
 
2007
+ export declare function isPlanB(): boolean;
2008
+
1964
2009
  export declare function isScreenSourceType(mediaSource: any): mediaSource is ScreenSourceType;
1965
2010
 
1966
2011
  export declare function isVideoEncoderConfiguration(config: VideoEncoderConfiguration): config is VideoEncoderConfiguration;
@@ -2134,7 +2179,7 @@ export declare abstract class LocalTrack extends Track implements ILocalTrack {
2134
2179
  protected processor?: IBaseProcessor;
2135
2180
  protected abstract _processorContext: IProcessorContext | undefined;
2136
2181
  protected get processorContext(): IProcessorContext | undefined;
2137
- abstract processorDestination: IBaseProcessor;
2182
+ abstract get processorDestination(): IBaseProcessor;
2138
2183
  constructor(track: MediaStreamTrack, trackId?: string);
2139
2184
  abstract getStats(): LocalVideoTrackStats | LocalAudioTrackStats;
2140
2185
  abstract setMuted(enabled: boolean): Promise<void>;
@@ -2165,26 +2210,28 @@ export declare class LocalVideoTrack extends LocalTrack implements ILocalVideoTr
2165
2210
  _player?: AgoraRTCPlayer | VideoPlayer;
2166
2211
  isUseScaleResolutionDownBy: boolean;
2167
2212
  private _videoVisibleTimer;
2168
- protected _statsTimer: number | null;
2169
2213
  private _previousVideoVisibleStatus;
2170
2214
  private _clearPreviousVideoVisibleStatus;
2171
2215
  _encoderConfig?: Partial<VideoEncoderConfiguration>;
2172
2216
  _scalabilityMode?: SVCConfiguration;
2173
- _optimizationMode?: "motion" | "detail" | "balanced";
2174
- _videoHeight?: number;
2175
- _videoWidth?: number;
2217
+ _optimizationMode?: OptimizationMode | "balanced";
2218
+ private _videoHeight?;
2219
+ private _videoWidth?;
2220
+ get videoHeight(): number | undefined;
2221
+ get videoWidth(): number | undefined;
2176
2222
  _forceBitrateLimit?: {
2177
2223
  max_bitrate: number;
2178
2224
  min_bitrate: number;
2179
2225
  };
2180
2226
  _enabled: boolean;
2181
2227
  get isPlaying(): boolean;
2182
- processorDestination: VideoProcessorDestination;
2228
+ protected _processorDestination: VideoProcessorDestination;
2229
+ get processorDestination(): VideoProcessorDestination;
2183
2230
  protected _processorContext: VideoProcessorContext;
2184
2231
  protected get processorContext(): VideoProcessorContext;
2185
2232
  protected set processorContext(ctx: VideoProcessorContext);
2186
2233
  get __className__(): string;
2187
- constructor(track: MediaStreamTrack, encoderConfig?: Partial<VideoEncoderConfiguration>, scalabilityConfig?: SVCConfiguration, optimizationMode?: "motion" | "detail" | "balanced", trackId?: string, hints?: TrackHint[]);
2234
+ constructor(track: MediaStreamTrack, encoderConfig?: Partial<VideoEncoderConfiguration>, scalabilityConfig?: SVCConfiguration, optimizationMode?: OptimizationMode | "balanced", trackId?: string, hints?: TrackHint[]);
2188
2235
  play(element: HTMLElement | HTMLVideoElement | string, config?: VideoPlayerConfig): void;
2189
2236
  stop(): void;
2190
2237
  setEnabled(enabled: boolean, skipChangeState?: boolean): Promise<void>;
@@ -2198,7 +2245,7 @@ export declare class LocalVideoTrack extends LocalTrack implements ILocalVideoTr
2198
2245
  max_bitrate: number;
2199
2246
  min_bitrate: number;
2200
2247
  }): Promise<void>;
2201
- setOptimizationMode(mode: "motion" | "detail" | "balanced"): Promise<void>;
2248
+ setOptimizationMode(mode: OptimizationMode | "balanced"): Promise<void>;
2202
2249
  setScalabiltyMode(mode: SVCConfiguration): void;
2203
2250
  updateMediaStreamTrackResolution(): void;
2204
2251
  protected _updatePlayerSource(): void;
@@ -2212,7 +2259,6 @@ export declare class LocalVideoTrack extends LocalTrack implements ILocalVideoTr
2212
2259
  close(): void;
2213
2260
  clone(config?: VideoEncoderConfiguration | VideoEncoderConfigurationPreset, cloneTrack?: boolean): LocalVideoTrack;
2214
2261
  replaceTrack(track: MediaStreamTrack, stopOldTrack: boolean): Promise<void>;
2215
- startMonitorStats(): void;
2216
2262
  sendSeiData(sei: Uint8Array): never;
2217
2263
  private bindProcessorDestinationEvents;
2218
2264
  private unbindProcessorDestinationEvents;
@@ -2230,7 +2276,7 @@ export declare interface LocalVideoTrackStats {
2230
2276
  * - `"VP8"`: The video codec is VP8.
2231
2277
  * - `"VP9"`: The video codec is VP9.
2232
2278
  * - `"AV1X"`: Reserved for future use.
2233
- * - `"AV1"`: Reserved for future use.
2279
+ * - `"AV1"`: The video codec is AV1.
2234
2280
  *
2235
2281
  * > You can not get this property on Firefox.
2236
2282
  */
@@ -2450,6 +2496,8 @@ export declare class MixingAudioTrack extends LocalAudioTrack {
2450
2496
  _updateRtpTransceiver(transceiver: RTCRtpTransceiver): void;
2451
2497
  }
2452
2498
 
2499
+ export declare type OptimizationMode = "motion" | "detail";
2500
+
2453
2501
  export declare interface PlayerConfig extends VideoPlayerConfig {
2454
2502
  trackId: string;
2455
2503
  element: HTMLElement;
@@ -2475,7 +2523,7 @@ export declare interface ProcessorUsageStats {
2475
2523
  }
2476
2524
 
2477
2525
  export declare class RemoteAudioTrack extends RemoteTrack implements IRemoteAudioTrack {
2478
- readonly trackMediaType: "audio" | "video";
2526
+ readonly trackMediaType: TrackMediaType.AUDIO;
2479
2527
  _source: AudioTrackSource | FakeTrackSource;
2480
2528
  _useAudioElement: boolean;
2481
2529
  private _volume;
@@ -2561,6 +2609,10 @@ export declare interface RemoteAudioTrackStats {
2561
2609
  * The total number of lost audio packets that should be received.
2562
2610
  */
2563
2611
  receivePacketsLost: number;
2612
+ /**
2613
+ * The number of packets discarded by the jitter buffer due to early or late arrival.
2614
+ */
2615
+ receivePacketsDiscarded: number;
2564
2616
  /**
2565
2617
  * The packet loss rate of the received audio.
2566
2618
  */
@@ -2652,7 +2704,7 @@ export declare class RemoteVideoTrack extends RemoteTrack implements IRemoteVide
2652
2704
  private _videoVisibleTimer;
2653
2705
  private _previousVideoVisibleStatus;
2654
2706
  private _clearPreviousVideoVisibleStatus;
2655
- readonly trackMediaType: "audio" | "video";
2707
+ readonly trackMediaType: TrackMediaType.VIDEO;
2656
2708
  _videoWidth?: number;
2657
2709
  _videoHeight?: number;
2658
2710
  _player?: AgoraRTCPlayer | VideoPlayer;
@@ -2693,7 +2745,7 @@ export declare interface RemoteVideoTrackStats {
2693
2745
  * - `"VP8"`: The video codec is VP8.
2694
2746
  * - `"VP9"`: The video codec is VP9.
2695
2747
  * - `"AV1X"`: Reserved for future use.
2696
- * - `"AV1"`: Reserved for future use.
2748
+ * - `"AV1"`: The video codec is AV1.
2697
2749
  *
2698
2750
  * > You can not get this property on Firefox.
2699
2751
  */
@@ -2859,17 +2911,21 @@ export declare interface ScreenVideoTrackInitConfig {
2859
2911
  screenSourceType?: ScreenSourceType;
2860
2912
  /**
2861
2913
  * @since
2862
- * <br>&emsp;&emsp;&emsp;*4.0.0*
2914
+ * <br>&emsp;&emsp;&emsp;*4.2.0*
2915
+ *
2916
+ * Sets the video transmission optimization mode.
2863
2917
  *
2864
- * Transmission optimization mode. Whether to prioritize video quality or smoothness:
2865
- * - `"detail"`: (Default) Prioritizes video quality.
2918
+ * 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.
2919
+ *
2920
+ * > Note: This method supports Chrome only.
2921
+ *
2922
+ * @param mode The video transmission optimization mode:
2923
+ * - `"detail"`: Prioritizes video quality.
2866
2924
  * - 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.
2867
2925
  * - In most cases, the SDK does not reduce the sending resolution, but may reduce the frame rate.
2868
- * - `"motion"`: Prioritizes video smoothness.
2926
+ * - `"motion"`: Since 4.21.0, the SDK prioritizes video smoothness.
2869
2927
  * - In poor network conditions, the SDK reduces the sending bitrate to minimize video freezes.
2870
2928
  * - In most cases, the SDK does not reduce the frame rate, but may reduce the sending resolution.
2871
- *
2872
- * > Note: This method is only supported on Chrome.
2873
2929
  */
2874
2930
  optimizationMode?: "motion" | "detail";
2875
2931
  /**
@@ -2941,6 +2997,12 @@ export declare interface ScreenVideoTrackInitConfig {
2941
2997
  systemAudio?: "include" | "exclude";
2942
2998
  }
2943
2999
 
3000
+ export declare type SenderConfig = {
3001
+ bitrateMax: number;
3002
+ bitrateMin: number;
3003
+ scaleResolutionDownBy: number;
3004
+ };
3005
+
2944
3006
  export declare function silenceScriptProcessHandler(e: AudioProcessingEvent): AudioBuffer;
2945
3007
 
2946
3008
  export declare interface StatsRegistry {
@@ -3036,7 +3098,9 @@ export declare abstract class Track extends EventEmitter implements ITrack {
3036
3098
  _hints: TrackHint[];
3037
3099
  _isClosed: boolean;
3038
3100
  _originMediaStreamTrack: MediaStreamTrack;
3039
- _mediaStreamTrack: MediaStreamTrack;
3101
+ mediaStreamTrack: MediaStreamTrack;
3102
+ set _mediaStreamTrack(track: MediaStreamTrack);
3103
+ get _mediaStreamTrack(): MediaStreamTrack;
3040
3104
  _external: ExternalMethods;
3041
3105
  constructor(track: MediaStreamTrack, trackId?: string);
3042
3106
  toString(): string;
@@ -3053,7 +3117,8 @@ export declare abstract class Track extends EventEmitter implements ITrack {
3053
3117
  export declare enum TrackEvents {
3054
3118
  TRANSCEIVER_UPDATED = "transceiver-updated",
3055
3119
  SEI_TO_SEND = "sei-to-send",
3056
- SEI_RECEIVED = "sei-received"
3120
+ SEI_RECEIVED = "sei-received",
3121
+ TRACK_UPDATED = "track-updated"
3057
3122
  }
3058
3123
 
3059
3124
  export declare enum TrackHint {
@@ -3076,10 +3141,17 @@ export declare enum TrackInternalEvent {
3076
3141
  GET_LOW_VIDEO_TRACK = "@get_low_video_track",
3077
3142
  NEED_RESET_REMOTE_SDP = "@need_reset_remote_sdp",
3078
3143
  NEED_UPDATE_VIDEO_ENCODER = "@need_update_video_encoder",
3144
+ NEED_UPDATE_VIDEO_SEND_PARAMETERS = "@need_update_video_send_parameters",
3079
3145
  NEED_MUTE_TRACK = "@need_mute_track",
3080
3146
  NEED_UNMUTE_TRACK = "@need_unmute_track"
3081
3147
  }
3082
3148
 
3149
+ export declare enum TrackMediaType {
3150
+ AUDIO = "audio",
3151
+ VIDEO = "video",
3152
+ DATA = "data"
3153
+ }
3154
+
3083
3155
  export declare function updateAgoraRTCCompatibility(): void;
3084
3156
 
3085
3157
  export declare interface UsageRegistry {
@@ -3144,50 +3216,50 @@ export declare interface VideoEncoderConfiguration {
3144
3216
  *
3145
3217
  * The following table lists all the preset video profiles. The SDK uses `"480p_1"` by default.
3146
3218
  *
3147
- * | Video Profile | Resolution (Width×Height) | Frame Rate (fps) | Bitrate (Kbps) | Chrome | Firefox | Safari |
3148
- * | -------- | --------------- | ----------- | ------------ | ------ | ------- | ------ |
3149
- * | 120p | 160 × 120 | 15 | 65 | ✓ | | |
3150
- * | 120p_1 | 160 × 120 | 15 | 65 | ✓ | | |
3151
- * | 120p_3 | 120 × 120 | 15 | 50 | ✓ | | |
3152
- * | 180p | 320 × 180 | 15 | 140 | ✓ | | |
3153
- * | 180p_1 | 320 × 180 | 15 | 140 | ✓ | | |
3154
- * | 180p_3 | 180 × 180 | 15 | 100 | ✓ | | |
3155
- * | 180p_4 | 240 × 180 | 15 | 120 | ✓ | | |
3156
- * | 240p | 320 × 240 | 15 | 200 | ✓ | | |
3157
- * | 240p_1 | 320 × 240 | 15 | 200 | ✓ | | |
3158
- * | 240p_3 | 240 × 240 | 15 | 140 | ✓ | | |
3159
- * | 240p_4 | 424 × 240 | 15 | 220 | ✓ | | |
3160
- * | 360p | 640 × 360 | 15 | 400 | ✓ | | |
3161
- * | 360p_1 | 640 × 360 | 15 | 400 | ✓ | | |
3162
- * | 360p_3 | 360 × 360 | 15 | 260 | ✓ | | |
3163
- * | 360p_4 | 640 × 360 | 30 | 600 | ✓ | | |
3164
- * | 360p_6 | 360 × 360 | 30 | 400 | ✓ | | |
3165
- * | 360p_7 | 480 × 360 | 15 | 320 | ✓ | | |
3166
- * | 360p_8 | 480 × 360 | 30 | 490 | ✓ | | |
3167
- * | 360p_9 | 640 × 360 | 15 | 800 | ✓ | | |
3168
- * | 360p_10 | 640 × 360 | 24 | 800 | ✓ | | |
3169
- * | 360p_11 | 640 × 360 | 24 | 1000 | ✓ | | |
3170
- * | 480p | 640 × 480 | 15 | 500 | ✓ | ✓ | ✓ |
3171
- * | 480p_1 | 640 × 480 | 15 | 500 | ✓ | ✓ | ✓ |
3172
- * | 480p_2 | 640 × 480 | 30 | 1000 | ✓ | ✓ | ✓ |
3173
- * | 480p_3 | 480 × 480 | 15 | 400 | ✓ | ✓ | ✓ |
3174
- * | 480p_4 | 640 × 480 | 30 | 750 | ✓ | ✓ | ✓ |
3175
- * | 480p_6 | 480 × 480 | 30 | 600 | ✓ | ✓ | ✓ |
3176
- * | 480p_8 | 848 × 480 | 15 | 610 | ✓ | ✓ | ✓ |
3177
- * | 480p_9 | 848 × 480 | 30 | 930 | ✓ | ✓ | ✓ |
3178
- * | 480p_10 | 640 × 480 | 10 | 400 | ✓ | ✓ | ✓ |
3179
- * | 720p | 1280 × 720 | 15 | 1130 | ✓ | ✓ | ✓ |
3180
- * | 720p_1 | 1280 × 720 | 15 | 1130 | ✓ | ✓ | ✓ |
3181
- * | 720p_2 | 1280 × 720 | 30 | 2000 | ✓ | ✓ | ✓ |
3182
- * | 720p_3 | 1280 × 720 | 30 | 1710 | ✓ | ✓ | ✓ |
3183
- * | 720p_auto <sup>①</sup> | 1280 × 720 | 30 | 3000 | ✓ | ✓ | ✓ |
3184
- * | 720p_5 | 960 × 720 | 15 | 910 | ✓ | ✓ | ✓ |
3185
- * | 720p_6 | 960 × 720 | 30 | 1380 | ✓ | ✓ | ✓ |
3186
- * | 1080p | 1920 × 1080 | 15 | 2080 | ✓ | | ✓ |
3187
- * | 1080p_1 | 1920 × 1080 | 15 | 2080 | ✓ | | ✓ |
3188
- * | 1080p_2 | 1920 × 1080 | 30 | 3000 | ✓ | | ✓ |
3189
- * | 1080p_3 | 1920 × 1080 | 30 | 3150 | ✓ | | ✓ |
3190
- * | 1080p_5 | 1920 × 1080 | 60 | 4780 | ✓ | | ✓ |
3219
+ * | Video Profile | Resolution (Width×Height) | Frame Rate (fps) | Chrome | Firefox | Safari |
3220
+ * | -------- | --------------- | ----------- | ------ | ------- | ------ |
3221
+ * | 120p | 160 × 120 | 15 | ✓ | | |
3222
+ * | 120p_1 | 160 × 120 | 15 | ✓ | | |
3223
+ * | 120p_3 | 120 × 120 | 15 | ✓ | | |
3224
+ * | 180p | 320 × 180 | 15 | ✓ | | |
3225
+ * | 180p_1 | 320 × 180 | 15 | ✓ | | |
3226
+ * | 180p_3 | 180 × 180 | 15 | ✓ | | |
3227
+ * | 180p_4 | 240 × 180 | 15 | ✓ | | |
3228
+ * | 240p | 320 × 240 | 15 | ✓ | | |
3229
+ * | 240p_1 | 320 × 240 | 15 | ✓ | | |
3230
+ * | 240p_3 | 240 × 240 | 15 | ✓ | | |
3231
+ * | 240p_4 | 424 × 240 | 15 | ✓ | | |
3232
+ * | 360p | 640 × 360 | 15 | ✓ | | |
3233
+ * | 360p_1 | 640 × 360 | 15 | ✓ | | |
3234
+ * | 360p_3 | 360 × 360 | 15 | ✓ | | |
3235
+ * | 360p_4 | 640 × 360 | 30 | ✓ | | |
3236
+ * | 360p_6 | 360 × 360 | 30 | ✓ | | |
3237
+ * | 360p_7 | 480 × 360 | 15 | ✓ | | |
3238
+ * | 360p_8 | 480 × 360 | 30 | ✓ | | |
3239
+ * | 360p_9 | 640 × 360 | 15 | ✓ | | |
3240
+ * | 360p_10 | 640 × 360 | 24 | ✓ | | |
3241
+ * | 360p_11 | 640 × 360 | 24 | ✓ | | |
3242
+ * | 480p | 640 × 480 | 15 | ✓ | ✓ | ✓ |
3243
+ * | 480p_1 | 640 × 480 | 15 | ✓ | ✓ | ✓ |
3244
+ * | 480p_2 | 640 × 480 | 30 | ✓ | ✓ | ✓ |
3245
+ * | 480p_3 | 480 × 480 | 15 | ✓ | ✓ | ✓ |
3246
+ * | 480p_4 | 640 × 480 | 30 | ✓ | ✓ | ✓ |
3247
+ * | 480p_6 | 480 × 480 | 30 | ✓ | ✓ | ✓ |
3248
+ * | 480p_8 | 848 × 480 | 15 | ✓ | ✓ | ✓ |
3249
+ * | 480p_9 | 848 × 480 | 30 | ✓ | ✓ | ✓ |
3250
+ * | 480p_10 | 640 × 480 | 10 | ✓ | ✓ | ✓ |
3251
+ * | 720p | 1280 × 720 | 15 | ✓ | ✓ | ✓ |
3252
+ * | 720p_1 | 1280 × 720 | 15 | ✓ | ✓ | ✓ |
3253
+ * | 720p_2 | 1280 × 720 | 30 | ✓ | ✓ | ✓ |
3254
+ * | 720p_3 | 1280 × 720 | 30 | ✓ | ✓ | ✓ |
3255
+ * | 720p_auto <sup>①</sup> | 1280 × 720 | 30 | ✓ | ✓ | ✓ |
3256
+ * | 720p_5 | 960 × 720 | 15 | ✓ | ✓ | ✓ |
3257
+ * | 720p_6 | 960 × 720 | 30 | ✓ | ✓ | ✓ |
3258
+ * | 1080p | 1920 × 1080 | 15 | ✓ | | ✓ |
3259
+ * | 1080p_1 | 1920 × 1080 | 15 | ✓ | | ✓ |
3260
+ * | 1080p_2 | 1920 × 1080 | 30 | ✓ | | ✓ |
3261
+ * | 1080p_3 | 1920 × 1080 | 30 | ✓ | | ✓ |
3262
+ * | 1080p_5 | 1920 × 1080 | 60 | ✓ | | ✓ |
3191
3263
  *
3192
3264
  * > <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.
3193
3265
  */
@@ -3209,6 +3281,8 @@ declare class VideoPlayer {
3209
3281
  protected videoTrack?: MediaStreamTrack;
3210
3282
  protected videoElement: HTMLVideoElement;
3211
3283
  protected cacheVideoElement?: HTMLVideoElement;
3284
+ private renderStats?;
3285
+ get rendFrameRate(): number;
3212
3286
  get videoElementStatus(): MediaElementStatus;
3213
3287
  set videoElementStatus(status: MediaElementStatus);
3214
3288
  get videoState(): VideoState;