@agora-js/media 4.21.0 → 4.22.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/media.d.ts CHANGED
@@ -808,33 +808,39 @@ export declare interface CameraVideoTrackInitConfig {
808
808
  cameraId?: string;
809
809
  /**
810
810
  * @自从
811
- * <br>&emsp;&emsp;&emsp;*4.0.0*
811
+ * <br>&emsp;&emsp;&emsp;*4.2.0*
812
+ *
813
+ * 设置视频传输优化模式。
812
814
  *
813
- * 传输优化模式。设置该值后,SDK 会自动调整码率配置以及使用不同的回退策略。
815
+ * 你可以在视频通话、视频直播或屏幕共享过程中调用此方法动态调整视频的传输优化模式。例如你想要把屏幕共享内容从演示文稿切换为视频时,你可以将传输优化模式从 `"detail"` 切换为 `"motion"`,确保视频画面在网络波动时不会出现卡顿。
816
+ *
817
+ * > 注意事项:该方法只支持 Chrome 浏览器。
818
+ *
819
+ * @param mode 视频传输优化模式:
814
820
  * - `"detail"`: 清晰优先。
815
821
  * - SDK 会自动根据你的采集分辨率和帧率设定一个最小码率。即使遭遇网络波动,发送码率也不会低于这个值,从而确保清晰的视频画面。
816
822
  * - 大部分情况下,SDK 不会降低发送分辨率,但是可能会降低帧率。
817
- * - `"motion"`: 流畅优先。
823
+ * - `"motion"`: 自 4.21.0 开始,SDK 默认开启流畅优先模式。
818
824
  * - SDK 不会启用最小码率策略。遭遇网络波动时,发送端会降低码率来确保接收端的视频画面不会出现中断和卡顿。
819
825
  * - 大部分情况下,SDK 不会降低帧率,但是可能会降低发送分辨率。
820
- * - 留空: 默认优化策略,兼顾清晰和流畅,也就是说弱网条件下,帧率和分辨率都会被调整。
821
- *
822
- * > 注意事项:该方法只支持 Chrome 浏览器。
823
826
  */
824
827
  /** @en
825
828
  * @since
826
- * <br>&emsp;&emsp;&emsp;*4.0.0*
829
+ * <br>&emsp;&emsp;&emsp;*4.2.0*
827
830
  *
828
- * Transmission optimization mode. Whether to prioritize video quality or smoothness:
831
+ * Sets the video transmission optimization mode.
832
+ *
833
+ * 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.
834
+ *
835
+ * > Note: This method supports Chrome only.
836
+ *
837
+ * @param mode The video transmission optimization mode:
829
838
  * - `"detail"`: Prioritizes video quality.
830
839
  * - The SDK ensures high-quality images by automatically calculating a minimum bitrate based on the capturing resolution and frame rate. No matter how poor the network condition is, the sending bitrate will never be lower than the minimum value.
831
840
  * - In most cases, the SDK does not reduce the sending resolution, but may reduce the frame rate.
832
- * - `"motion"`: Prioritizes video smoothness.
841
+ * - `"motion"`: Since 4.21.0, the SDK prioritizes video smoothness.
833
842
  * - In poor network conditions, the SDK reduces the sending bitrate to minimize video freezes.
834
843
  * - In most cases, the SDK does not reduce the frame rate, but may reduce the sending resolution.
835
- * - Empty: Uses the default transmission optimization mode. The SDK may reduce the frame rate or the sending resolution in poor network conditions.
836
- *
837
- * > Note: This method is only supported on Chrome.
838
844
  */
839
845
  optimizationMode?: OptimizationMode;
840
846
  /**
@@ -871,7 +877,7 @@ export declare function checkTrackState(): (target: any, propertyKey: any, descr
871
877
  * 可通过以下方法或事件获取:
872
878
  * - [localVideoTrack.on("video-element-visible-status")]{@link ILocalVideoTrack.event_video_element_visible_status}
873
879
  * - [localVideoTrack.getVideoElementVisibleStatus]{@link ILocalVideoTrack.getVideoElementVisibleStatus}
874
- * - [remoteVideoTrack.on("video-element-visible-status")]{@link IRemoteVideoTrack.event_video_element_visible_status}
880
+ * - [remoteVideoTrack.on("video-element-visible-status")]{@link IRemoteVideoTrack.event_video_element_visible_status_2}
875
881
  * - [remoteVideoTrack.getVideoElementVisibleStatus]{@link IRemoteVideoTrack.getVideoElementVisibleStatus}
876
882
  *
877
883
  * 包含以下字段:
@@ -888,7 +894,7 @@ export declare function checkTrackState(): (target: any, propertyKey: any, descr
888
894
  * Get the visibility of the `<video>` tag through the following methods and events:
889
895
  * - [localVideoTrack.on("video-element-visible-status")]{@link ILocalVideoTrack.event_video_element_visible_status}
890
896
  * - [localVideoTrack.getVideoElementVisibleStatus]{@link ILocalVideoTrack.getVideoElementVisibleStatus}
891
- * - [remoteVideoTrack.on("video-element-visible-status")]{@link IRemoteVideoTrack.event_video_element_visible_status}
897
+ * - [remoteVideoTrack.on("video-element-visible-status")]{@link IRemoteVideoTrack.event_video_element_visible_status_2}
892
898
  * - [remoteVideoTrack.getVideoElementVisibleStatus]{@link IRemoteVideoTrack.getVideoElementVisibleStatus}
893
899
  *
894
900
  * This object contains the following parameters:
@@ -1084,33 +1090,45 @@ export declare interface CustomVideoTrackInitConfig {
1084
1090
  bitrateMax?: number;
1085
1091
  /**
1086
1092
  * @自从
1087
- * <br>&emsp;&emsp;&emsp;*4.0.0*
1093
+ * <br>&emsp;&emsp;&emsp;*4.2.0*
1094
+ *
1095
+ * 设置视频传输优化模式。
1088
1096
  *
1089
- * 传输优化模式。设置该值后,SDK 会自动调整码率配置以及使用不同的回退策略。
1097
+ * 你可以在视频通话、视频直播或屏幕共享过程中调用此方法动态调整视频的传输优化模式。例如你想要把屏幕共享内容从演示文稿切换为视频时,你可以将传输优化模式从 `"detail"` 切换为 `"motion"`,确保视频画面在网络波动时不会出现卡顿。
1098
+ *
1099
+ * > 注意事项:该方法只支持 Chrome 浏览器。
1100
+ *
1101
+ * @param mode 视频传输优化模式:
1102
+ * - `"balanced"`: 使用默认的传输优化模式:
1103
+ * - 对于屏幕共享视频流,SDK 默认的优化策略为清晰优先。
1104
+ * - 对于其他视频流,SDK 默认的优化策略为兼顾清晰和流畅,弱网条件下,帧率和分辨率都会被调整。
1090
1105
  * - `"detail"`: 清晰优先。
1091
1106
  * - SDK 会自动根据你的采集分辨率和帧率设定一个最小码率。即使遭遇网络波动,发送码率也不会低于这个值,从而确保清晰的视频画面。
1092
1107
  * - 大部分情况下,SDK 不会降低发送分辨率,但是可能会降低帧率。
1093
- * - `"motion"`: 流畅优先。
1108
+ * - `"motion"`: 自 4.21.0开始,SDK 默认开启流畅优先模式
1094
1109
  * - SDK 不会启用最小码率策略。遭遇网络波动时,发送端会降低码率来确保接收端的视频画面不会出现中断和卡顿。
1095
1110
  * - 大部分情况下,SDK 不会降低帧率,但是可能会降低发送分辨率。
1096
- * - 留空: 默认优化策略,兼顾清晰和流畅,也就是说弱网条件下,帧率和分辨率都会被调整。
1097
- *
1098
- * > 注意事项:该方法只支持 Chrome 浏览器。
1099
1111
  */
1100
1112
  /** @en
1101
1113
  * @since
1102
- * <br>&emsp;&emsp;&emsp;*4.0.0*
1114
+ * <br>&emsp;&emsp;&emsp;*4.2.0*
1103
1115
  *
1104
- * Transmission optimization mode. Whether to prioritize video quality or smoothness:
1116
+ * Sets the video transmission optimization mode.
1117
+ *
1118
+ * 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.
1119
+ *
1120
+ * > Note: This method supports Chrome only.
1121
+ *
1122
+ * @param mode The video transmission optimization mode:
1123
+ * - `"balanced"`: Uses the default optimization mode.
1124
+ * - For a screen-sharing video track, the default transmission optimization strategy is to prioritizes clarity.
1125
+ * - For the other types of video tracks, the SDK may reduce the frame rate or the sending resolution in poor network conditions.
1105
1126
  * - `"detail"`: Prioritizes video quality.
1106
1127
  * - The SDK ensures high-quality images by automatically calculating a minimum bitrate based on the capturing resolution and frame rate. No matter how poor the network condition is, the sending bitrate will never be lower than the minimum value.
1107
1128
  * - In most cases, the SDK does not reduce the sending resolution, but may reduce the frame rate.
1108
- * - `"motion"`: Prioritizes video smoothness.
1129
+ * - `"motion"`: Since 4.21.0, the SDK prioritizes video smoothness.
1109
1130
  * - In poor network conditions, the SDK reduces the sending bitrate to minimize video freezes.
1110
1131
  * - In most cases, the SDK does not reduce the frame rate, but may reduce the sending resolution.
1111
- * - Empty: Uses the default transmission optimization mode. The SDK may reduce the frame rate or the sending resolution in poor network conditions.
1112
- *
1113
- * > Note: This method is only supported on Chrome.
1114
1132
  */
1115
1133
  optimizationMode?: "motion" | "detail";
1116
1134
  /**
@@ -1138,15 +1156,17 @@ export declare interface CustomVideoTrackInitConfig {
1138
1156
  }
1139
1157
 
1140
1158
  export declare abstract class DataChannel extends EventEmitter implements IDataChannel {
1159
+ readonly trackMediaType: TrackMediaType.DATA;
1141
1160
  private _version;
1142
1161
  private _type;
1143
1162
  _config: IDataChannelConfig;
1144
1163
  /** 原始的 DataChannel 对象 */
1145
1164
  _originDataChannel?: RTCDataChannel;
1146
1165
  protected _dataStreamPacketHeader: ArrayBuffer;
1147
- protected _dataStreamPacketHandler: DataStream;
1166
+ protected _dataStreamPacketHandler: IDataStream;
1148
1167
  private _datachannelEventMap;
1149
1168
  constructor(config: IDataChannelConfig, datachannel?: RTCDataChannel);
1169
+ useDataStream(dataStream: IDataStream): void;
1150
1170
  get id(): number;
1151
1171
  get ordered(): boolean;
1152
1172
  get maxRetransmits(): number;
@@ -1171,20 +1191,6 @@ export declare enum DataChannelEvents {
1171
1191
  ERROR = "error"
1172
1192
  }
1173
1193
 
1174
- declare class DataStream {
1175
- private _sequence;
1176
- private _startTime;
1177
- private isUseOneByte;
1178
- private get startTime();
1179
- private get sequence();
1180
- serialize(payload: ArrayBuffer): ArrayBuffer;
1181
- deserialize(packet: ArrayBuffer): ArrayBuffer;
1182
- private serializeExtension;
1183
- private deserializeExtension;
1184
- private decompress;
1185
- private compress;
1186
- }
1187
-
1188
1194
  export declare function decodeAudioData(buffer: ArrayBuffer): Promise<AudioBuffer>;
1189
1195
 
1190
1196
  export declare const DEFAULT_LOCAL_AUDIO_TRACK_STATS: LocalAudioTrackStats;
@@ -2010,6 +2016,11 @@ export declare interface IDataChannelConfig {
2010
2016
  metadata: string;
2011
2017
  }
2012
2018
 
2019
+ declare interface IDataStream {
2020
+ serialize: (payload: ArrayBuffer) => ArrayBuffer;
2021
+ deserialize: (packet: ArrayBuffer) => ArrayBuffer;
2022
+ }
2023
+
2013
2024
  /**
2014
2025
  * 基础本地音频轨道,提供了本地音频轨道的主要功能。
2015
2026
  *
@@ -2557,7 +2568,7 @@ export declare interface ILocalVideoTrack extends ILocalTrack {
2557
2568
  * - `"detail"`: 清晰优先。
2558
2569
  * - SDK 会自动根据你的采集分辨率和帧率设定一个最小码率。即使遭遇网络波动,发送码率也不会低于这个值,从而确保清晰的视频画面。
2559
2570
  * - 大部分情况下,SDK 不会降低发送分辨率,但是可能会降低帧率。
2560
- * - `"motion"`: 流畅优先。
2571
+ * - `"motion"`: 自 4.21.0 开始,SDK 默认开启流畅优先模式。
2561
2572
  * - SDK 不会启用最小码率策略。遭遇网络波动时,发送端会降低码率来确保接收端的视频画面不会出现中断和卡顿。
2562
2573
  * - 大部分情况下,SDK 不会降低帧率,但是可能会降低发送分辨率。
2563
2574
  */
@@ -2578,7 +2589,7 @@ export declare interface ILocalVideoTrack extends ILocalTrack {
2578
2589
  * - `"detail"`: Prioritizes video quality.
2579
2590
  * - The SDK ensures high-quality images by automatically calculating a minimum bitrate based on the capturing resolution and frame rate. No matter how poor the network condition is, the sending bitrate will never be lower than the minimum value.
2580
2591
  * - In most cases, the SDK does not reduce the sending resolution, but may reduce the frame rate.
2581
- * - `"motion"`: Prioritizes video smoothness.
2592
+ * - `"motion"`: Since 4.21.0, the SDK prioritizes video smoothness.
2582
2593
  * - In poor network conditions, the SDK reduces the sending bitrate to minimize video freezes.
2583
2594
  * - In most cases, the SDK does not reduce the frame rate, but may reduce the sending resolution.
2584
2595
  */
@@ -2871,7 +2882,7 @@ export declare interface IRemoteAudioTrack extends IRemoteTrack {
2871
2882
  *
2872
2883
  * 设置音频播放设备,比如扬声器。
2873
2884
  *
2874
- * > 该方法只支持桌面端的 Chrome 和 Edge 浏览器。如果在其他浏览器上需要先设置`RESTRICTION_SET_PLAYBACK_DEVICE`为`false`,直接调用将会抛出 `NOT_SUPPORTED` 错误。
2885
+ * > 该方法只支持桌面端的 Chrome 和 Edge 浏览器,其他浏览器调用将会抛出 `NOT_SUPPORTED` 错误。
2875
2886
  * @param deviceId 设备 ID,可以通过 [[getPlaybackDevices]] 方法获取。
2876
2887
  */
2877
2888
  /** @en
@@ -2880,7 +2891,7 @@ export declare interface IRemoteAudioTrack extends IRemoteTrack {
2880
2891
  *
2881
2892
  * Sets the audio playback device, for example, the speaker.
2882
2893
  *
2883
- * > > This method is only supported on desktop Chrome and Edge browsers. If you call it on other browsers, you need to set `RESTRICTION_SET_PLAYBACK_DEVICE` to `false` first, and calling it directly will throw a `NOT_SUPPORTED` error.
2894
+ * > This method supports Chrome and Edge on desktop devices only. Other browsers throw a `NOT_SUPPORTED` error when calling this method.
2884
2895
  * @param deviceId Device ID, which can be retrieved by calling [[getPlaybackDevices]].
2885
2896
  */
2886
2897
  setPlaybackDevice(deviceId: string): Promise<void>;
@@ -3291,6 +3302,8 @@ export { isElectron }
3291
3302
 
3292
3303
  export declare function isLowStreamParameter(streamParameter: any): streamParameter is LowStreamParameter;
3293
3304
 
3305
+ export declare function isPlanB(): boolean;
3306
+
3294
3307
  export declare function isScreenSourceType(mediaSource: any): mediaSource is ScreenSourceType;
3295
3308
 
3296
3309
  export declare function isVideoEncoderConfiguration(config: VideoEncoderConfiguration): config is VideoEncoderConfiguration;
@@ -3593,10 +3606,6 @@ export declare class LocalVideoTrack extends LocalTrack implements ILocalVideoTr
3593
3606
  _player?: AgoraRTCPlayer | VideoPlayer;
3594
3607
  isUseScaleResolutionDownBy: boolean;
3595
3608
  private _videoVisibleTimer;
3596
- /**
3597
- * 轮询监听stats
3598
- */
3599
- protected _statsTimer: number | null;
3600
3609
  private _previousVideoVisibleStatus;
3601
3610
  private _clearPreviousVideoVisibleStatus;
3602
3611
  _encoderConfig?: Partial<VideoEncoderConfiguration>;
@@ -3646,7 +3655,6 @@ export declare class LocalVideoTrack extends LocalTrack implements ILocalVideoTr
3646
3655
  close(): void;
3647
3656
  clone(config?: VideoEncoderConfiguration | VideoEncoderConfigurationPreset, cloneTrack?: boolean): LocalVideoTrack;
3648
3657
  replaceTrack(track: MediaStreamTrack, stopOldTrack: boolean): Promise<void>;
3649
- startMonitorStats(): void;
3650
3658
  sendSeiData(sei: Uint8Array): never;
3651
3659
  private bindProcessorDestinationEvents;
3652
3660
  private unbindProcessorDestinationEvents;
@@ -3668,7 +3676,7 @@ export declare interface LocalVideoTrackStats {
3668
3676
  * - `"VP8"`: 视频编码格式为 VP8。
3669
3677
  * - `"VP9"`: 视频编码格式为 VP9。
3670
3678
  * - `"AV1X"`: 预留参数,暂不支持。
3671
- * - `"AV1"`: 预留参数,暂不支持。
3679
+ * - `"AV1"`: 视频编码格式为 AV1。
3672
3680
  *
3673
3681
  * > Firefox 上无法获取该值。
3674
3682
  */
@@ -3679,7 +3687,7 @@ export declare interface LocalVideoTrackStats {
3679
3687
  * - `"VP8"`: The video codec is VP8.
3680
3688
  * - `"VP9"`: The video codec is VP9.
3681
3689
  * - `"AV1X"`: Reserved for future use.
3682
- * - `"AV1"`: Reserved for future use.
3690
+ * - `"AV1"`: The video codec is AV1.
3683
3691
  *
3684
3692
  * > You can not get this property on Firefox.
3685
3693
  */
@@ -4057,7 +4065,7 @@ export declare interface ProcessorUsageStats {
4057
4065
  }
4058
4066
 
4059
4067
  export declare class RemoteAudioTrack extends RemoteTrack implements IRemoteAudioTrack {
4060
- readonly trackMediaType: "audio" | "video";
4068
+ readonly trackMediaType: TrackMediaType.AUDIO;
4061
4069
  _source: AudioTrackSource | FakeTrackSource;
4062
4070
  _useAudioElement: boolean;
4063
4071
  private _volume;
@@ -4192,6 +4200,13 @@ export declare interface RemoteAudioTrackStats {
4192
4200
  * The total number of lost audio packets that should be received.
4193
4201
  */
4194
4202
  receivePacketsLost: number;
4203
+ /**
4204
+ * 因过早或过晚到达抖动缓冲器而被丢弃的数据包数量。
4205
+ */
4206
+ /** @en
4207
+ * The number of packets discarded by the jitter buffer due to early or late arrival.
4208
+ */
4209
+ receivePacketsDiscarded: number;
4195
4210
  /**
4196
4211
  * 接收的音频总丢包率。
4197
4212
  */
@@ -4264,7 +4279,16 @@ export declare enum RemoteStreamFallbackType {
4264
4279
  /** @en
4265
4280
  * 2: Subscribe to the low-quality video stream when the network conditions worsen, and subscribe to audio only when the conditions become too poor to support video transmission.
4266
4281
  */
4267
- AUDIO_ONLY = 2
4282
+ AUDIO_ONLY = 2,
4283
+ /**
4284
+ * ABR 拓展, 暂时不对外,以实际客户为主
4285
+ */
4286
+ HIGH_STREAM_LAYER1 = 3,
4287
+ HIGH_STREAM_LAYER2 = 4,
4288
+ HIGH_STREAM_LAYER3 = 5,
4289
+ HIGH_STREAM_LAYER4 = 6,
4290
+ HIGH_STREAM_LAYER5 = 7,
4291
+ HIGH_STREAM_LAYER6 = 8
4268
4292
  }
4269
4293
 
4270
4294
  /**
@@ -4284,7 +4308,17 @@ export declare enum RemoteStreamType {
4284
4308
  /** @en
4285
4309
  * 1: Low-quality video stream (low-bitrate, low-resolution).
4286
4310
  */
4287
- LOW_STREAM = 1
4311
+ LOW_STREAM = 1,
4312
+ /**
4313
+ * ABR 拓展
4314
+ * 暂时不对外,以实际客户为主
4315
+ */
4316
+ HIGH_STREAM_LAYER1 = 4,
4317
+ HIGH_STREAM_LAYER2 = 5,
4318
+ HIGH_STREAM_LAYER3 = 6,
4319
+ HIGH_STREAM_LAYER4 = 7,
4320
+ HIGH_STREAM_LAYER5 = 8,
4321
+ HIGH_STREAM_LAYER6 = 9
4288
4322
  }
4289
4323
 
4290
4324
  export declare abstract class RemoteTrack extends Track implements IRemoteTrack {
@@ -4315,7 +4349,7 @@ export declare class RemoteVideoTrack extends RemoteTrack implements IRemoteVide
4315
4349
  private _videoVisibleTimer;
4316
4350
  private _previousVideoVisibleStatus;
4317
4351
  private _clearPreviousVideoVisibleStatus;
4318
- readonly trackMediaType: "audio" | "video";
4352
+ readonly trackMediaType: TrackMediaType.VIDEO;
4319
4353
  _videoWidth?: number;
4320
4354
  _videoHeight?: number;
4321
4355
  _player?: AgoraRTCPlayer | VideoPlayer;
@@ -4376,7 +4410,7 @@ export declare interface RemoteVideoTrackStats {
4376
4410
  * - `"VP8"`: The video codec is VP8.
4377
4411
  * - `"VP9"`: The video codec is VP9.
4378
4412
  * - `"AV1X"`: Reserved for future use.
4379
- * - `"AV1"`: Reserved for future use.
4413
+ * - `"AV1"`: The video codec is AV1.
4380
4414
  *
4381
4415
  * > You can not get this property on Firefox.
4382
4416
  */
@@ -4684,31 +4718,39 @@ export declare interface ScreenVideoTrackInitConfig {
4684
4718
  screenSourceType?: ScreenSourceType;
4685
4719
  /**
4686
4720
  * @自从
4687
- * <br>&emsp;&emsp;&emsp;*4.0.0*
4721
+ * <br>&emsp;&emsp;&emsp;*4.2.0*
4688
4722
  *
4689
- * 传输优化模式。设置该值后,SDK 会自动调整码率配置以及使用不同的回退策略。
4690
- * - `"motion"`: 流畅优先。
4691
- * - SDK 不会启用最小码率策略。遭遇网络波动时,发送端会降低码率来确保接收端的视频画面不会出现中断和卡顿。
4692
- * - 大部分情况下,SDK 不会降低帧率,但是可能会降低发送分辨率。
4693
- * - `"detail"`: (默认)清晰优先。
4694
- * - SDK 会自动根据你的采集分辨率和帧率设定一个最小码率。即使遭遇网络波动,发送码率也不会低于这个值,从而确保清晰的视频画面。
4695
- * - 大部分情况下,SDK 不会降低发送分辨率,但是可能会降低帧率。
4723
+ * 设置视频传输优化模式。
4724
+ *
4725
+ * 你可以在视频通话、视频直播或屏幕共享过程中调用此方法动态调整视频的传输优化模式。例如你想要把屏幕共享内容从演示文稿切换为视频时,你可以将传输优化模式从 `"detail"` 切换为 `"motion"`,确保视频画面在网络波动时不会出现卡顿。
4696
4726
  *
4697
4727
  * > 注意事项:该方法只支持 Chrome 浏览器。
4728
+ *
4729
+ * @param mode 视频传输优化模式:
4730
+ * - `"detail"`: 清晰优先。
4731
+ * - SDK 会自动根据你的采集分辨率和帧率设定一个最小码率。即使遭遇网络波动,发送码率也不会低于这个值,从而确保清晰的视频画面。
4732
+ * - 大部分情况下,SDK 不会降低发送分辨率,但是可能会降低帧率。
4733
+ * - `"motion"`: 自 4.21.0 开始,SDK 默认开启流畅优先模式。
4734
+ * - SDK 不会启用最小码率策略。遭遇网络波动时,发送端会降低码率来确保接收端的视频画面不会出现中断和卡顿。
4735
+ * - 大部分情况下,SDK 不会降低帧率,但是可能会降低发送分辨率。
4698
4736
  */
4699
4737
  /** @en
4700
4738
  * @since
4701
- * <br>&emsp;&emsp;&emsp;*4.0.0*
4739
+ * <br>&emsp;&emsp;&emsp;*4.2.0*
4740
+ *
4741
+ * Sets the video transmission optimization mode.
4742
+ *
4743
+ * 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.
4744
+ *
4745
+ * > Note: This method supports Chrome only.
4702
4746
  *
4703
- * Transmission optimization mode. Whether to prioritize video quality or smoothness:
4704
- * - `"detail"`: (Default) Prioritizes video quality.
4747
+ * @param mode The video transmission optimization mode:
4748
+ * - `"detail"`: Prioritizes video quality.
4705
4749
  * - The SDK ensures high-quality images by automatically calculating a minimum bitrate based on the capturing resolution and frame rate. No matter how poor the network condition is, the sending bitrate will never be lower than the minimum value.
4706
4750
  * - In most cases, the SDK does not reduce the sending resolution, but may reduce the frame rate.
4707
- * - `"motion"`: Prioritizes video smoothness.
4751
+ * - `"motion"`: Since 4.21.0, the SDK prioritizes video smoothness.
4708
4752
  * - In poor network conditions, the SDK reduces the sending bitrate to minimize video freezes.
4709
4753
  * - In most cases, the SDK does not reduce the frame rate, but may reduce the sending resolution.
4710
- *
4711
- * > Note: This method is only supported on Chrome.
4712
4754
  */
4713
4755
  optimizationMode?: "motion" | "detail";
4714
4756
  /**
@@ -5016,7 +5058,9 @@ export declare enum TrackHint {
5016
5058
  /** 该轨道是克隆自定义视频轨道生成的。 */
5017
5059
  CUSTOM_TRACK = "custome_track",
5018
5060
  /** 该轨道是克隆小流视频轨道生成的。 */
5019
- LOW_STREAM = "low_stream"
5061
+ LOW_STREAM = "low_stream",
5062
+ /** 标记这个 Track 是否来自于屏幕共享小流 */
5063
+ SCREEN_LOW_TRACK = "screen_low_track"
5020
5064
  }
5021
5065
 
5022
5066
  export declare enum TrackInternalEvent {
@@ -5038,6 +5082,12 @@ export declare enum TrackInternalEvent {
5038
5082
  NEED_UNMUTE_TRACK = "@need_unmute_track"
5039
5083
  }
5040
5084
 
5085
+ export declare enum TrackMediaType {
5086
+ AUDIO = "audio",
5087
+ VIDEO = "video",
5088
+ DATA = "data"
5089
+ }
5090
+
5041
5091
  export declare function updateAgoraRTCCompatibility(): void;
5042
5092
 
5043
5093
  export declare interface UsageRegistry {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agora-js/media",
3
- "version": "4.21.0",
3
+ "version": "4.22.1",
4
4
  "description": "media module across @agora-js packages",
5
5
  "main": "AgoraRTC_N-media.js",
6
6
  "module": "AgoraRTC_N-media.esm.mjs",
@@ -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.21.0",
27
- "@agora-js/report": "4.21.0",
28
- "axios": "^1.6.8",
26
+ "@agora-js/shared": "4.22.1",
27
+ "@agora-js/report": "4.22.1",
28
+ "axios": "^1.7.7",
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
  }