@agora-js/media 4.22.2 → 4.23.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/media.d.ts CHANGED
@@ -776,7 +776,7 @@ export declare class CameraVideoTrack extends LocalVideoTrack implements ICamera
776
776
  _enabled: boolean;
777
777
  _deviceName: string;
778
778
  get __className__(): string;
779
- constructor(track: MediaStreamTrack, config: CameraVideoTrackInitConfig, constraints: MediaTrackConstraints, scalabilityConfig?: SVCConfiguration, optimizationMode?: OptimizationMode | "balanced", trackId?: string);
779
+ constructor(track: MediaStreamTrack, config: CameraVideoTrackInitConfig, constraints: MediaTrackConstraints, scalabilityConfig?: SVCConfiguration, optimizationMode?: OptimizationMode, trackId?: string);
780
780
  setDevice(deviceId: string | RequiredOnlyOneOf<{
781
781
  facingMode: VideoFacingModeEnum;
782
782
  deviceId: string;
@@ -883,6 +883,9 @@ export declare interface CameraVideoTrackInitConfig {
883
883
  * - `"motion"`: Since v4.21.0, the browser prioritizes video smoothness.
884
884
  * - In poor network conditions, the browser reduces the sending bitrate to minimize video freezes.
885
885
  * - In most cases, the browser does not reduce the frame rate, but may reduce the sending resolution.
886
+ * - `"balanced"`: The default optimization mode.
887
+ * - For screen sharing video streams, the SDK default optimization strategy is quality-first.
888
+ * - For other video streams, the SDK default optimization strategy is balanced between quality and smoothness. Under poor network conditions, both the frame rate and resolution will be adjusted.
886
889
  */
887
890
  optimizationMode?: OptimizationMode;
888
891
  /**
@@ -1172,7 +1175,7 @@ export declare interface CustomVideoTrackInitConfig {
1172
1175
  * - In poor network conditions, the SDK reduces the sending bitrate to minimize video freezes.
1173
1176
  * - In most cases, the SDK does not reduce the frame rate, but may reduce the sending resolution.
1174
1177
  */
1175
- optimizationMode?: "motion" | "detail";
1178
+ optimizationMode?: OptimizationMode;
1176
1179
  /**
1177
1180
  * @ignore
1178
1181
  * @自从
@@ -1677,7 +1680,7 @@ declare class FakeTrackSource extends EventEmitter {
1677
1680
  createMediaStreamSourceNode(): undefined;
1678
1681
  }
1679
1682
 
1680
- export declare const frameData2CryptoBuffer: (imageData: ImageTypedData, appid: string, channelName: string) => Promise<Uint8Array>;
1683
+ export declare const frameData2CryptoBuffer: (imageData: ImageTypedData, appid: string, channelName: string) => Promise<Uint8Array<ArrayBufferLike>>;
1681
1684
 
1682
1685
  export declare function getAudioContext(): AudioContext;
1683
1686
 
@@ -2638,7 +2641,7 @@ export declare interface ILocalVideoTrack extends ILocalTrack {
2638
2641
  * - In poor network conditions, the browser reduces the sending bitrate to minimize video freezes.
2639
2642
  * - In most cases, the browser does not reduce the frame rate, but may reduce the sending resolution.
2640
2643
  */
2641
- setOptimizationMode(mode: "balanced" | "motion" | "detail"): Promise<void>;
2644
+ setOptimizationMode(mode: OptimizationMode): Promise<void>;
2642
2645
  /**
2643
2646
  * * @自从
2644
2647
  * <br>&emsp;&emsp;&emsp;*4.8.0*
@@ -3655,7 +3658,7 @@ export declare class LocalVideoTrack extends LocalTrack implements ILocalVideoTr
3655
3658
  private _clearPreviousVideoVisibleStatus;
3656
3659
  _encoderConfig?: Partial<VideoEncoderConfiguration>;
3657
3660
  _scalabilityMode?: SVCConfiguration;
3658
- _optimizationMode?: OptimizationMode | "balanced";
3661
+ _optimizationMode?: OptimizationMode;
3659
3662
  private _videoHeight?;
3660
3663
  private _videoWidth?;
3661
3664
  get videoHeight(): number | undefined;
@@ -3672,7 +3675,7 @@ export declare class LocalVideoTrack extends LocalTrack implements ILocalVideoTr
3672
3675
  protected get processorContext(): VideoProcessorContext;
3673
3676
  protected set processorContext(ctx: VideoProcessorContext);
3674
3677
  get __className__(): string;
3675
- constructor(track: MediaStreamTrack, encoderConfig?: Partial<VideoEncoderConfiguration>, scalabilityConfig?: SVCConfiguration, optimizationMode?: OptimizationMode | "balanced", trackId?: string, hints?: TrackHint[]);
3678
+ constructor(track: MediaStreamTrack, encoderConfig?: Partial<VideoEncoderConfiguration>, scalabilityConfig?: SVCConfiguration, optimizationMode?: OptimizationMode, trackId?: string, hints?: TrackHint[]);
3676
3679
  play(element: HTMLElement | HTMLVideoElement | string, config?: VideoPlayerConfig): void;
3677
3680
  stop(): void;
3678
3681
  setEnabled(enabled: boolean, skipChangeState?: boolean): Promise<void>;
@@ -3686,7 +3689,7 @@ export declare class LocalVideoTrack extends LocalTrack implements ILocalVideoTr
3686
3689
  max_bitrate: number;
3687
3690
  min_bitrate: number;
3688
3691
  }): Promise<void>;
3689
- setOptimizationMode(mode: OptimizationMode | "balanced"): Promise<void>;
3692
+ setOptimizationMode(mode: OptimizationMode): Promise<void>;
3690
3693
  setScalabiltyMode(mode: SVCConfiguration): void;
3691
3694
  updateMediaStreamTrackResolution(): void;
3692
3695
  protected _updatePlayerSource(): void;
@@ -4050,6 +4053,9 @@ export declare class MixingAudioTrack extends LocalAudioTrack {
4050
4053
  * - `"motion"`: 自 4.21.0 开始,浏览器默认开启流畅优先模式。
4051
4054
  * - 浏览器不会启用最小码率策略。遭遇网络波动时,发送端会降低码率来确保接收端的视频画面不会出现中断和卡顿。
4052
4055
  * - 大部分情况下,浏览器不会降低帧率,但是可能会降低发送分辨率。
4056
+ * - `"balanced"`: 默认的传输优化模式。
4057
+ * - 对于屏幕共享视频流,SDK 默认的优化策略为清晰优先。
4058
+ * - 对于其他视频流,SDK 默认的优化策略为坚固清晰合流畅,弱网条件下,帧率和分辨率都会被调整。
4053
4059
  * @public
4054
4060
  */
4055
4061
  /** @en
@@ -4060,8 +4066,11 @@ export declare class MixingAudioTrack extends LocalAudioTrack {
4060
4066
  * - `"motion"`: Since v4.21.0, the browser prioritizes video smoothness.
4061
4067
  * - In poor network conditions, the browser reduces the sending bitrate to minimize video freezes.
4062
4068
  * - In most cases, the browser does not reduce the frame rate, but may reduce the sending resolution.
4069
+ * - `"balanced"`: The default optimization mode.
4070
+ * - For screen sharing video streams, the SDK default optimization strategy is quality-first.
4071
+ * - For other video streams, the SDK default optimization strategy is balanced between quality and smoothness. Under poor network conditions, both the frame rate and resolution will be adjusted.
4063
4072
  */
4064
- export declare type OptimizationMode = "motion" | "detail";
4073
+ export declare type OptimizationMode = "motion" | "detail" | "balanced";
4065
4074
 
4066
4075
  /**
4067
4076
  * @internal
@@ -4242,14 +4251,14 @@ export declare interface RemoteAudioTrackStats {
4242
4251
  * 接收的音频总丢包率。
4243
4252
  */
4244
4253
  /** @en
4245
- * The packet loss rate of the received audio.
4254
+ * The total packet loss rate of the received audio.
4246
4255
  */
4247
4256
  packetLossRate: number;
4248
4257
  /**
4249
- * 接收的音频400ms内的丢包率。
4258
+ * 接收的音频在 400ms 内的丢包率。
4250
4259
  */
4251
4260
  /** @en
4252
- * The packet loss rate of the received audio.
4261
+ * The packet loss rate of the received audio in 400ms.
4253
4262
  */
4254
4263
  currentPacketLossRate: number;
4255
4264
  /**
@@ -4521,17 +4530,17 @@ export declare interface RemoteVideoTrackStats {
4521
4530
  */
4522
4531
  receivePacketsLost: number;
4523
4532
  /**
4524
- * 接收的视频丢包率。
4533
+ * 接收的视频总丢包率。
4525
4534
  */
4526
4535
  /** @en
4527
- * The packet loss rate of the received video.
4536
+ * The total packet loss rate of the received video.
4528
4537
  */
4529
4538
  packetLossRate: number;
4530
4539
  /**
4531
- * 接收的视频在400ms内的丢包率。
4540
+ * 接收的视频在 400ms 内的丢包率。
4532
4541
  */
4533
4542
  /** @en
4534
- * The packet loss rate of the received video.
4543
+ * The packet loss rate of the received video in 400ms.
4535
4544
  */
4536
4545
  currentPacketLossRate: number;
4537
4546
  /**
@@ -4563,10 +4572,10 @@ export declare interface RemoteVideoTrackStats {
4563
4572
  */
4564
4573
  totalFreezeTime: number;
4565
4574
  /**
4566
- * 接收的视频卡顿率。
4575
+ * 最近一秒接收视频的卡顿率。取值范围为 [0.0,1.0],代表最近一秒内视频卡顿百分比。
4567
4576
  */
4568
4577
  /** @en
4569
- * The freeze rate of the received video.
4578
+ * The freeze rate of the remote video in the last second. The value range is [0.0,1.0], representing the percentage of video freezes in the last second.
4570
4579
  */
4571
4580
  freezeRate: number;
4572
4581
  /**
@@ -4633,6 +4642,8 @@ export declare interface ScreenConstraintsWithElectron extends MediaTrackConstra
4633
4642
  surfaceSwitching?: "include" | "exclude";
4634
4643
  /** 是否开启系统音频,默认开启include, Chrome 105以上, Opera 91以上 */
4635
4644
  systemAudio?: "include" | "exclude";
4645
+ /** 是否默认分享当前页面,默认为false, Chrome 94以上, Opera 80以上 */
4646
+ preferCurrentTab?: boolean;
4636
4647
  }
4637
4648
 
4638
4649
  /**
@@ -4772,6 +4783,9 @@ export declare interface ScreenVideoTrackInitConfig {
4772
4783
  * - `"motion"`: 自 4.21.0 开始,浏览器默认开启流畅优先模式。
4773
4784
  * - 浏览器不会启用最小码率策略。遭遇网络波动时,发送端会降低码率来确保接收端的视频画面不会出现中断和卡顿。
4774
4785
  * - 大部分情况下,浏览器不会降低帧率,但是可能会降低发送分辨率。
4786
+ * - `"balanced"`: 默认的传输优化模式。
4787
+ * - 对于屏幕共享视频流,SDK 默认的优化策略为清晰优先。
4788
+ * - 对于其他视频流,SDK 默认的优化策略为坚固清晰合流畅,弱网条件下,帧率和分辨率都会被调整。
4775
4789
  */
4776
4790
  /** @en
4777
4791
  * @since
@@ -4791,7 +4805,7 @@ export declare interface ScreenVideoTrackInitConfig {
4791
4805
  * - In poor network conditions, the browser reduces the sending bitrate to minimize video freezes.
4792
4806
  * - In most cases, the browser does not reduce the frame rate, but may reduce the sending resolution.
4793
4807
  */
4794
- optimizationMode?: "motion" | "detail";
4808
+ optimizationMode?: OptimizationMode;
4795
4809
  /**
4796
4810
  * @ignore
4797
4811
  *
@@ -4918,6 +4932,28 @@ export declare interface ScreenVideoTrackInitConfig {
4918
4932
  * > Note: This property is supported on Chrome 105 and later (Windows only), as well as Edge 105 and later (Windows only).
4919
4933
  */
4920
4934
  systemAudio?: "include" | "exclude";
4935
+ /**
4936
+ * @自从
4937
+ * <br>&emsp;&emsp;&emsp;*4.23.0*
4938
+ *
4939
+ * 是否默认共享当前页面。
4940
+ * - `true`: 是。
4941
+ * - `false`: (默认)否。
4942
+ *
4943
+ * > 注意事项: 该属性仅支持 Chrome 94 及以上版本、Opera 80 及以上版本。
4944
+ */
4945
+ /** @en
4946
+ *
4947
+ * @since
4948
+ * <br>&emsp;&emsp;&emsp;*4.23.0*
4949
+ *
4950
+ * Whether to share the current tab by default.
4951
+ * - `true`: Yes.
4952
+ * - `false`: (Default) No.
4953
+ *
4954
+ * > Note: This property is only supported in Chrome 94 and above, and Opera 80 and above..
4955
+ */
4956
+ preferCurrentTab?: boolean;
4921
4957
  }
4922
4958
 
4923
4959
  export declare type SenderConfig = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agora-js/media",
3
- "version": "4.22.2",
3
+ "version": "4.23.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",
@@ -23,8 +23,8 @@
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.22.2",
27
- "@agora-js/report": "4.22.2",
26
+ "@agora-js/shared": "4.23.0",
27
+ "@agora-js/report": "4.23.0",
28
28
  "axios": "^1.7.7",
29
29
  "agora-rte-extension": "^1.2.4",
30
30
  "webrtc-adapter": "8.2.0"
@@ -513,7 +513,7 @@ export declare class CameraVideoTrack extends LocalVideoTrack implements ICamera
513
513
  _enabled: boolean;
514
514
  _deviceName: string;
515
515
  get __className__(): string;
516
- constructor(track: MediaStreamTrack, config: CameraVideoTrackInitConfig, constraints: MediaTrackConstraints, scalabilityConfig?: SVCConfiguration, optimizationMode?: OptimizationMode | "balanced", trackId?: string);
516
+ constructor(track: MediaStreamTrack, config: CameraVideoTrackInitConfig, constraints: MediaTrackConstraints, scalabilityConfig?: SVCConfiguration, optimizationMode?: OptimizationMode, trackId?: string);
517
517
  setDevice(deviceId: string | RequiredOnlyOneOf<{
518
518
  facingMode: VideoFacingModeEnum;
519
519
  deviceId: string;
@@ -575,6 +575,9 @@ export declare interface CameraVideoTrackInitConfig {
575
575
  * - `"motion"`: Since v4.21.0, the browser prioritizes video smoothness.
576
576
  * - In poor network conditions, the browser reduces the sending bitrate to minimize video freezes.
577
577
  * - In most cases, the browser does not reduce the frame rate, but may reduce the sending resolution.
578
+ * - `"balanced"`: The default optimization mode.
579
+ * - For screen sharing video streams, the SDK default optimization strategy is quality-first.
580
+ * - For other video streams, the SDK default optimization strategy is balanced between quality and smoothness. Under poor network conditions, both the frame rate and resolution will be adjusted.
578
581
  */
579
582
  optimizationMode?: OptimizationMode;
580
583
  /**
@@ -747,7 +750,7 @@ export declare interface CustomVideoTrackInitConfig {
747
750
  * - In poor network conditions, the SDK reduces the sending bitrate to minimize video freezes.
748
751
  * - In most cases, the SDK does not reduce the frame rate, but may reduce the sending resolution.
749
752
  */
750
- optimizationMode?: "motion" | "detail";
753
+ optimizationMode?: OptimizationMode;
751
754
  /**
752
755
  * @ignore
753
756
  *
@@ -1088,7 +1091,7 @@ declare class FakeTrackSource extends EventEmitter {
1088
1091
  createMediaStreamSourceNode(): undefined;
1089
1092
  }
1090
1093
 
1091
- export declare const frameData2CryptoBuffer: (imageData: ImageTypedData, appid: string, channelName: string) => Promise<Uint8Array>;
1094
+ export declare const frameData2CryptoBuffer: (imageData: ImageTypedData, appid: string, channelName: string) => Promise<Uint8Array<ArrayBufferLike>>;
1092
1095
 
1093
1096
  export declare function getAudioContext(): AudioContext;
1094
1097
 
@@ -1635,7 +1638,7 @@ export declare interface ILocalVideoTrack extends ILocalTrack {
1635
1638
  * - In poor network conditions, the browser reduces the sending bitrate to minimize video freezes.
1636
1639
  * - In most cases, the browser does not reduce the frame rate, but may reduce the sending resolution.
1637
1640
  */
1638
- setOptimizationMode(mode: "balanced" | "motion" | "detail"): Promise<void>;
1641
+ setOptimizationMode(mode: OptimizationMode): Promise<void>;
1639
1642
  /**
1640
1643
  * @since
1641
1644
  * <br>&emsp;&emsp;&emsp;*4.8.0*
@@ -2242,7 +2245,7 @@ export declare class LocalVideoTrack extends LocalTrack implements ILocalVideoTr
2242
2245
  private _clearPreviousVideoVisibleStatus;
2243
2246
  _encoderConfig?: Partial<VideoEncoderConfiguration>;
2244
2247
  _scalabilityMode?: SVCConfiguration;
2245
- _optimizationMode?: OptimizationMode | "balanced";
2248
+ _optimizationMode?: OptimizationMode;
2246
2249
  private _videoHeight?;
2247
2250
  private _videoWidth?;
2248
2251
  get videoHeight(): number | undefined;
@@ -2259,7 +2262,7 @@ export declare class LocalVideoTrack extends LocalTrack implements ILocalVideoTr
2259
2262
  protected get processorContext(): VideoProcessorContext;
2260
2263
  protected set processorContext(ctx: VideoProcessorContext);
2261
2264
  get __className__(): string;
2262
- constructor(track: MediaStreamTrack, encoderConfig?: Partial<VideoEncoderConfiguration>, scalabilityConfig?: SVCConfiguration, optimizationMode?: OptimizationMode | "balanced", trackId?: string, hints?: TrackHint[]);
2265
+ constructor(track: MediaStreamTrack, encoderConfig?: Partial<VideoEncoderConfiguration>, scalabilityConfig?: SVCConfiguration, optimizationMode?: OptimizationMode, trackId?: string, hints?: TrackHint[]);
2263
2266
  play(element: HTMLElement | HTMLVideoElement | string, config?: VideoPlayerConfig): void;
2264
2267
  stop(): void;
2265
2268
  setEnabled(enabled: boolean, skipChangeState?: boolean): Promise<void>;
@@ -2273,7 +2276,7 @@ export declare class LocalVideoTrack extends LocalTrack implements ILocalVideoTr
2273
2276
  max_bitrate: number;
2274
2277
  min_bitrate: number;
2275
2278
  }): Promise<void>;
2276
- setOptimizationMode(mode: OptimizationMode | "balanced"): Promise<void>;
2279
+ setOptimizationMode(mode: OptimizationMode): Promise<void>;
2277
2280
  setScalabiltyMode(mode: SVCConfiguration): void;
2278
2281
  updateMediaStreamTrackResolution(): void;
2279
2282
  protected _updatePlayerSource(): void;
@@ -2514,8 +2517,11 @@ export declare class MixingAudioTrack extends LocalAudioTrack {
2514
2517
  * - `"motion"`: Since v4.21.0, the browser prioritizes video smoothness.
2515
2518
  * - In poor network conditions, the browser reduces the sending bitrate to minimize video freezes.
2516
2519
  * - In most cases, the browser does not reduce the frame rate, but may reduce the sending resolution.
2520
+ * - `"balanced"`: The default optimization mode.
2521
+ * - For screen sharing video streams, the SDK default optimization strategy is quality-first.
2522
+ * - For other video streams, the SDK default optimization strategy is balanced between quality and smoothness. Under poor network conditions, both the frame rate and resolution will be adjusted.
2517
2523
  */
2518
- export declare type OptimizationMode = "motion" | "detail";
2524
+ export declare type OptimizationMode = "motion" | "detail" | "balanced";
2519
2525
 
2520
2526
  export declare interface PlayerConfig extends VideoPlayerConfig {
2521
2527
  trackId: string;
@@ -2633,11 +2639,11 @@ export declare interface RemoteAudioTrackStats {
2633
2639
  */
2634
2640
  receivePacketsDiscarded: number;
2635
2641
  /**
2636
- * The packet loss rate of the received audio.
2642
+ * The total packet loss rate of the received audio.
2637
2643
  */
2638
2644
  packetLossRate: number;
2639
2645
  /**
2640
- * The packet loss rate of the received audio.
2646
+ * The packet loss rate of the received audio in 400ms.
2641
2647
  */
2642
2648
  currentPacketLossRate: number;
2643
2649
  /**
@@ -2823,11 +2829,11 @@ export declare interface RemoteVideoTrackStats {
2823
2829
  */
2824
2830
  receivePacketsLost: number;
2825
2831
  /**
2826
- * The packet loss rate of the received video.
2832
+ * The total packet loss rate of the received video.
2827
2833
  */
2828
2834
  packetLossRate: number;
2829
2835
  /**
2830
- * The packet loss rate of the received video.
2836
+ * The packet loss rate of the received video in 400ms.
2831
2837
  */
2832
2838
  currentPacketLossRate: number;
2833
2839
  /**
@@ -2847,7 +2853,7 @@ export declare interface RemoteVideoTrackStats {
2847
2853
  */
2848
2854
  totalFreezeTime: number;
2849
2855
  /**
2850
- * The freeze rate of the received video.
2856
+ * The freeze rate of the remote video in the last second. The value range is [0.0,1.0], representing the percentage of video freezes in the last second.
2851
2857
  */
2852
2858
  freezeRate: number;
2853
2859
  publishDuration: number;
@@ -2880,6 +2886,7 @@ export declare interface ScreenConstraintsWithElectron extends MediaTrackConstra
2880
2886
  selfBrowserSurface?: "include" | "exclude";
2881
2887
  surfaceSwitching?: "include" | "exclude";
2882
2888
  systemAudio?: "include" | "exclude";
2889
+ preferCurrentTab?: boolean;
2883
2890
  }
2884
2891
 
2885
2892
  /**
@@ -2963,7 +2970,7 @@ export declare interface ScreenVideoTrackInitConfig {
2963
2970
  * - In poor network conditions, the browser reduces the sending bitrate to minimize video freezes.
2964
2971
  * - In most cases, the browser does not reduce the frame rate, but may reduce the sending resolution.
2965
2972
  */
2966
- optimizationMode?: "motion" | "detail";
2973
+ optimizationMode?: OptimizationMode;
2967
2974
  /**
2968
2975
  * @ignore
2969
2976
  *
@@ -3031,6 +3038,18 @@ export declare interface ScreenVideoTrackInitConfig {
3031
3038
  * > Note: This property is supported on Chrome 105 and later (Windows only), as well as Edge 105 and later (Windows only).
3032
3039
  */
3033
3040
  systemAudio?: "include" | "exclude";
3041
+ /**
3042
+ *
3043
+ * @since
3044
+ * <br>&emsp;&emsp;&emsp;*4.23.0*
3045
+ *
3046
+ * Whether to share the current tab by default.
3047
+ * - `true`: Yes.
3048
+ * - `false`: (Default) No.
3049
+ *
3050
+ * > Note: This property is only supported in Chrome 94 and above, and Opera 80 and above..
3051
+ */
3052
+ preferCurrentTab?: boolean;
3034
3053
  }
3035
3054
 
3036
3055
  export declare type SenderConfig = {