@agora-js/media 4.24.4 → 4.24.5

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
@@ -1,12 +1,15 @@
1
1
  import { AgoraRTCError } from '@agora-js/shared';
2
+ import type { AudioExtensionConstructor } from 'agora-rte-extension-ng';
2
3
  import { CheckVisibleResult } from '@agora-js/shared';
3
4
  import { ElectronDesktopCapturerSource } from '@agora-js/shared';
4
5
  import { EventEmitter } from '@agora-js/shared';
6
+ import type { IAudioExtension } from 'agora-rte-extension-ng';
5
7
  import { IAudioProcessor } from 'agora-rte-extension';
6
8
  import type { IAudioProcessorContext } from 'agora-rte-extension';
7
9
  import { IBaseProcessor } from 'agora-rte-extension';
8
10
  import type { IProcessorContext } from 'agora-rte-extension';
9
11
  import { isElectron } from '@agora-js/shared';
12
+ import type { IVideoExtension } from 'agora-rte-extension-ng';
10
13
  import type { Kind } from 'agora-rte-extension';
11
14
  import type { NetworkQuality } from '@agora-js/shared';
12
15
  import type { ProcessorStats } from 'agora-rte-extension';
@@ -16,6 +19,7 @@ import { SDKStore } from '@agora-js/shared';
16
19
  import { UID } from '@agora-js/shared';
17
20
  import { Usage } from 'agora-rte-extension';
18
21
  import type { UsageWithDirection } from 'agora-rte-extension';
22
+ import type { VideoExtensionConstructor } from 'agora-rte-extension-ng';
19
23
 
20
24
  export declare const __TRACK_LIST__: Track[];
21
25
 
@@ -1146,6 +1150,28 @@ export declare interface CustomVideoTrackInitConfig {
1146
1150
  * The maximum bitrate of sending the video track (Kbps).
1147
1151
  */
1148
1152
  bitrateMax?: number;
1153
+ /**
1154
+ * 自动降分辨率时允许降到的最小宽度。
1155
+ *
1156
+ * 当 SDK 接管分辨率降档时,发送宽度不会低于这个值。
1157
+ */
1158
+ /** @en
1159
+ * The minimum width allowed during automatic downscaling.
1160
+ *
1161
+ * When the SDK takes over resolution downscaling, the sending width will not go below this value.
1162
+ */
1163
+ minDownscaleWidth?: number;
1164
+ /**
1165
+ * 自动降分辨率时允许降到的最小高度。
1166
+ *
1167
+ * 当 SDK 接管分辨率降档时,发送高度不会低于这个值。
1168
+ */
1169
+ /** @en
1170
+ * The minimum height allowed during automatic downscaling.
1171
+ *
1172
+ * When the SDK takes over resolution downscaling, the sending height will not go below this value.
1173
+ */
1174
+ minDownscaleHeight?: number;
1149
1175
  /**
1150
1176
  * @自从
1151
1177
  * <br>&emsp;&emsp;&emsp;*4.2.0*
@@ -1786,11 +1812,15 @@ export declare function getNewVideoBitrate(width: number, height: number, fps: n
1786
1812
  * ⚠️:理论上不存在没有分辨率的情况,如果出现不足任何处理
1787
1813
  */
1788
1814
  export declare const getOriginSenderConfig: (track: LocalVideoTrack) => {
1815
+ width: number;
1816
+ height: number;
1789
1817
  frameRate: number;
1790
1818
  bitrateMax: number;
1791
1819
  bitrateMin: number;
1792
1820
  scaleResolutionDownBy: number;
1793
1821
  scale: number;
1822
+ minDownscaleWidth: number;
1823
+ minDownscaleHeight: number;
1794
1824
  };
1795
1825
 
1796
1826
  export declare function getScalabilityConfiguration(profile: SVCConfiguration | SVCConfigurationPreset): SVCConfiguration;
@@ -2320,6 +2350,56 @@ export declare interface ILocalAudioTrack extends ILocalTrack {
2320
2350
  * The destination of the current processing pipeline on the local audio track.
2321
2351
  */
2322
2352
  processorDestination: IAudioProcessor;
2353
+ /**
2354
+ * 使用类构造器在当前音频轨道上创建或复用一个音频插件实例。
2355
+ *
2356
+ * @param extensionCtor 音频插件类构造器。
2357
+ * @param extensionOptions 可选的插件初始化参数。
2358
+ */
2359
+ /** @en
2360
+ * Creates or reuses an audio extension instance on the current audio track using a class constructor.
2361
+ *
2362
+ * @param extensionCtor The audio extension class constructor.
2363
+ * @param extensionOptions Optional extension initialization parameters.
2364
+ */
2365
+ useExtension<T extends IAudioExtension>(extensionCtor: AudioExtensionConstructor<T>, extensionOptions?: Record<string, unknown>): T;
2366
+ /**
2367
+ * 从本地音频轨道移除音频插件。
2368
+ *
2369
+ * @param extension 音频插件实例。
2370
+ * @returns 是否成功移除。
2371
+ */
2372
+ /** @en
2373
+ * Removes an audio extension from the local audio track.
2374
+ *
2375
+ * @param extension The audio extension instance.
2376
+ * @returns Whether the removal succeeded.
2377
+ */
2378
+ removeExtension(extension: IAudioExtension): boolean;
2379
+ /**
2380
+ * 向当前音频扩展链路添加参考音轨。
2381
+ *
2382
+ * @param track 作为参考输入的本地或远端音频轨道。
2383
+ */
2384
+ /** @en
2385
+ * Adds a reference track to the current audio extension pipeline.
2386
+ *
2387
+ * @param track The local or remote audio track used as the reference input.
2388
+ */
2389
+ addReferenceTrack(track: ILocalAudioTrack | IRemoteAudioTrack): void;
2390
+ /**
2391
+ * 从当前音频扩展链路移除参考音轨。
2392
+ *
2393
+ * @param track 要移除的参考输入轨道。
2394
+ * @returns 是否成功移除。
2395
+ */
2396
+ /** @en
2397
+ * Removes a reference track from the current audio extension pipeline.
2398
+ *
2399
+ * @param track The reference input track to remove.
2400
+ * @returns Whether the removal succeeded.
2401
+ */
2402
+ removeReferenceTrack(track: ILocalAudioTrack | IRemoteAudioTrack): boolean;
2323
2403
  }
2324
2404
 
2325
2405
  /** @ignore */
@@ -2762,12 +2842,16 @@ export declare interface ILocalVideoTrack extends ILocalTrack {
2762
2842
  * @自从
2763
2843
  * <br>&emsp;&emsp;&emsp;*4.10.0*
2764
2844
  *
2845
+ * @deprecated 旧版 v1 pipe 模式 API。新插件请使用 `useExtension` 和 `removeExtension`。
2846
+ *
2765
2847
  * 取消本地视频轨道上注入的 `Processor`。
2766
2848
  */
2767
2849
  /** @en
2768
2850
  * @since
2769
2851
  * <br>&emsp;&emsp;&emsp;*4.10.0*
2770
2852
  *
2853
+ * @deprecated Legacy v1 pipe-mode API. For new extensions, use `useExtension` and `removeExtension`.
2854
+ *
2771
2855
  * Removes the `Processor` inserted to the local video track.
2772
2856
  */
2773
2857
  unpipe(): void;
@@ -2775,15 +2859,53 @@ export declare interface ILocalVideoTrack extends ILocalTrack {
2775
2859
  * @自从
2776
2860
  * <br>&emsp;&emsp;&emsp;*4.10.0*
2777
2861
  *
2862
+ * @deprecated 旧版 v1 pipe 模式 API。新插件请使用 `useExtension` 和 `removeExtension`。
2863
+ *
2778
2864
  * 本地视频轨道上当前媒体处理链路的最终节点。
2779
2865
  */
2780
2866
  /** @en
2781
2867
  * @since
2782
2868
  * <br>&emsp;&emsp;&emsp;*4.10.0*
2783
2869
  *
2870
+ * @deprecated Legacy v1 pipe-mode API. For new extensions, use `useExtension` and `removeExtension`.
2871
+ *
2784
2872
  * The destination of the current processing pipeline on the local video track.
2785
2873
  */
2786
2874
  processorDestination: IBaseProcessor;
2875
+ /**
2876
+ * 使用类构造器在当前视频轨道上创建或复用一个视频插件代理。
2877
+ *
2878
+ * 同一个插件构造器在 destroy 前会始终返回同一个实例代理。
2879
+ *
2880
+ * @param extensionCtor 视频插件类构造器。
2881
+ * @param options 可选的插件初始化参数。
2882
+ */
2883
+ /** @en
2884
+ * Creates or reuses a video extension proxy on the current video track using a class constructor.
2885
+ *
2886
+ * The same extension constructor always returns the same instance proxy until it is destroyed.
2887
+ *
2888
+ * @param extensionCtor The video extension class constructor.
2889
+ * @param options Optional extension initialization parameters.
2890
+ */
2891
+ useExtension<T extends VideoExtensionConstructor>(extensionCtor: T, options?: {
2892
+ extensionOptions?: Record<string, unknown>;
2893
+ moduleURL?: string;
2894
+ registrationName?: string;
2895
+ }): InstanceType<T>;
2896
+ /**
2897
+ * 从本地视频轨道移除视频插件。
2898
+ *
2899
+ * @param extension 视频插件实例。
2900
+ * @returns 是否成功移除。
2901
+ */
2902
+ /** @en
2903
+ * Removes a video extension from the local video track.
2904
+ *
2905
+ * @param extension The video extension instance.
2906
+ * @returns Whether the removal succeeded.
2907
+ */
2908
+ removeExtension(extension: IVideoExtension): boolean;
2787
2909
  /**
2788
2910
  * @自从
2789
2911
  * <br>&emsp;&emsp;&emsp;*4.17.0*
@@ -3148,6 +3270,54 @@ export declare interface IRemoteAudioTrack extends IRemoteTrack {
3148
3270
  * The destination of the current processing pipeline on the remote audio track.
3149
3271
  */
3150
3272
  processorDestination: IAudioProcessor;
3273
+ /**
3274
+ * 使用类构造器在当前远端音频轨道上创建或复用一个音频插件实例。
3275
+ *
3276
+ * @param extensionCtor 音频插件类构造器。
3277
+ */
3278
+ /** @en
3279
+ * Creates or reuses an audio extension instance on the current remote audio track using a class constructor.
3280
+ *
3281
+ * @param extensionCtor The audio extension class constructor.
3282
+ */
3283
+ useExtension<T extends IAudioExtension>(extensionCtor: AudioExtensionConstructor<T>): T;
3284
+ /**
3285
+ * 从远端音频轨道移除音频插件。
3286
+ *
3287
+ * @param extension 音频插件实例。
3288
+ * @returns 是否成功移除。
3289
+ */
3290
+ /** @en
3291
+ * Removes an audio extension from the remote audio track.
3292
+ *
3293
+ * @param extension The audio extension instance.
3294
+ * @returns Whether the removal succeeded.
3295
+ */
3296
+ removeExtension(extension: IAudioExtension): boolean;
3297
+ /**
3298
+ * 向当前音频扩展链路添加参考音轨。
3299
+ *
3300
+ * @param track 作为参考输入的本地或远端音频轨道。
3301
+ */
3302
+ /** @en
3303
+ * Adds a reference track to the current audio extension pipeline.
3304
+ *
3305
+ * @param track The local or remote audio track used as the reference input.
3306
+ */
3307
+ addReferenceTrack(track: ILocalAudioTrack | IRemoteAudioTrack): void;
3308
+ /**
3309
+ * 从当前音频扩展链路移除参考音轨。
3310
+ *
3311
+ * @param track 要移除的参考输入轨道。
3312
+ * @returns 是否成功移除。
3313
+ */
3314
+ /** @en
3315
+ * Removes a reference track from the current audio extension pipeline.
3316
+ *
3317
+ * @param track The reference input track to remove.
3318
+ * @returns Whether the removal succeeded.
3319
+ */
3320
+ removeReferenceTrack(track: ILocalAudioTrack | IRemoteAudioTrack): boolean;
3151
3321
  }
3152
3322
 
3153
3323
  /** @ignore */
@@ -3422,6 +3592,36 @@ export declare interface IRemoteVideoTrack extends IRemoteTrack {
3422
3592
  * The destination of the current processing pipeline on the remote video track.
3423
3593
  */
3424
3594
  processorDestination: IBaseProcessor;
3595
+ /**
3596
+ * 使用类构造器在当前视频轨道上创建或复用一个视频插件代理。
3597
+ *
3598
+ * @param extensionCtor 视频插件类构造器。
3599
+ * @param options 可选的插件初始化参数。
3600
+ */
3601
+ /** @en
3602
+ * Creates or reuses a video extension proxy on the current video track using a class constructor.
3603
+ *
3604
+ * @param extensionCtor The video extension class constructor.
3605
+ * @param options Optional extension initialization parameters.
3606
+ */
3607
+ useExtension<T extends VideoExtensionConstructor>(extensionCtor: T, options?: {
3608
+ extensionOptions?: Record<string, unknown>;
3609
+ moduleURL?: string;
3610
+ registrationName?: string;
3611
+ }): InstanceType<T>;
3612
+ /**
3613
+ * 从远端视频轨道移除视频插件。
3614
+ *
3615
+ * @param extension 视频插件实例。
3616
+ * @returns 是否成功移除。
3617
+ */
3618
+ /** @en
3619
+ * Removes a video extension from the remote video track.
3620
+ *
3621
+ * @param extension The video extension instance.
3622
+ * @returns Whether the removal succeeded.
3623
+ */
3624
+ removeExtension(extension: IVideoExtension): boolean;
3425
3625
  /**
3426
3626
  * 停止播放。
3427
3627
  * @param isKeepLastFrame 是否保留最后一帧。
@@ -3576,6 +3776,10 @@ export declare class LocalAudioTrack extends LocalTrack implements ILocalAudioTr
3576
3776
  _processorDestination: AudioProcessorDestination | undefined;
3577
3777
  get processorDestination(): AudioProcessorDestination;
3578
3778
  protected _getOriginVolumeLevel: boolean;
3779
+ /** Tracks whether this track is using the new UseExtension mode vs the old pipe mode */
3780
+ private _usePipeMode;
3781
+ private _useExtensionMode;
3782
+ private _extensionManager?;
3579
3783
  get isPlaying(): boolean;
3580
3784
  get __className__(): string;
3581
3785
  constructor(track: MediaStreamTrack, encoderConfig?: AudioEncoderConfiguration, trackId?: string, getOriginVolumeLevel?: boolean);
@@ -3593,6 +3797,11 @@ export declare class LocalAudioTrack extends LocalTrack implements ILocalAudioTr
3593
3797
  protected _updatePlayerSource(updateWebAudioSource?: boolean): void;
3594
3798
  protected _updateOriginMediaStreamTrack(track: MediaStreamTrack, stopOldTrack: boolean): Promise<void>;
3595
3799
  renewMediaStreamTrack(newConstraints?: MediaTrackConstraints): Promise<void>;
3800
+ private _ensureExtensionManager;
3801
+ useExtension<T extends IAudioExtension>(ctor: AudioExtensionConstructor<T>, extensionOptions?: Record<string, unknown>): T;
3802
+ removeExtension(extension: IAudioExtension): boolean;
3803
+ addReferenceTrack(track: LocalAudioTrack | RemoteAudioTrack): void;
3804
+ removeReferenceTrack(track: LocalAudioTrack | RemoteAudioTrack): boolean;
3596
3805
  pipe(processor: IAudioProcessor): IAudioProcessor;
3597
3806
  unpipe(): void;
3598
3807
  private bindProcessorDestinationEvents;
@@ -3772,6 +3981,10 @@ export declare class LocalVideoTrack extends LocalTrack implements ILocalVideoTr
3772
3981
  protected _processorDestination: VideoProcessorDestination;
3773
3982
  get processorDestination(): VideoProcessorDestination;
3774
3983
  protected _processorContext: VideoProcessorContext;
3984
+ /** Tracks whether this track is using the new UseExtension mode vs the old pipe mode */
3985
+ private _usePipeMode;
3986
+ private _useExtensionMode;
3987
+ private _extensionManager?;
3775
3988
  protected get processorContext(): VideoProcessorContext;
3776
3989
  protected set processorContext(ctx: VideoProcessorContext);
3777
3990
  get __className__(): string;
@@ -3800,6 +4013,13 @@ export declare class LocalVideoTrack extends LocalTrack implements ILocalVideoTr
3800
4013
  updateBitrateFromProfile(): void;
3801
4014
  getVideoElementVisibleStatus(): CheckVideoVisibleResult | undefined;
3802
4015
  renewMediaStreamTrack(newConstraints?: MediaTrackConstraints): Promise<void>;
4016
+ private _ensureVideoExtensionManager;
4017
+ useExtension<T extends VideoExtensionConstructor>(extensionCtor: T, options?: {
4018
+ extensionOptions?: Record<string, unknown>;
4019
+ moduleURL?: string;
4020
+ registrationName?: string;
4021
+ }): InstanceType<T>;
4022
+ removeExtension(extension: IVideoExtension): boolean;
3803
4023
  pipe(processor: IBaseProcessor): IBaseProcessor;
3804
4024
  unpipe(): void;
3805
4025
  close(): void;
@@ -4214,6 +4434,10 @@ export declare class RemoteAudioTrack extends RemoteTrack implements IRemoteAudi
4214
4434
  private _volume;
4215
4435
  protected processorContext: AudioProcessorContext;
4216
4436
  processorDestination: AudioProcessorDestination;
4437
+ /** Tracks whether this track is using the new UseExtension mode vs the old pipe mode */
4438
+ private _usePipeMode;
4439
+ private _useExtensionMode;
4440
+ private _extensionManager?;
4217
4441
  private _played;
4218
4442
  private _bypassWebAudio;
4219
4443
  get isPlaying(): boolean;
@@ -4231,6 +4455,11 @@ export declare class RemoteAudioTrack extends RemoteTrack implements IRemoteAudi
4231
4455
  _destroy(): void;
4232
4456
  _isFreeze(): boolean;
4233
4457
  protected _updatePlayerSource(updateWebAudioSource?: boolean): void;
4458
+ private _ensureAudioExtensionManager;
4459
+ useExtension<T extends IAudioExtension>(ctor: AudioExtensionConstructor<T>): T;
4460
+ removeExtension(extension: IAudioExtension): boolean;
4461
+ addReferenceTrack(track: LocalAudioTrack | RemoteAudioTrack): void;
4462
+ removeReferenceTrack(track: LocalAudioTrack | RemoteAudioTrack): boolean;
4234
4463
  pipe(processor: IAudioProcessor): IAudioProcessor;
4235
4464
  unpipe(): void;
4236
4465
  private bindProcessorDestinationEvents;
@@ -4508,6 +4737,10 @@ export declare class RemoteVideoTrack extends RemoteTrack implements IRemoteVide
4508
4737
  private _prePlayer?;
4509
4738
  processorDestination: VideoProcessorDestination;
4510
4739
  protected processorContext: VideoProcessorContext;
4740
+ /** Tracks whether this track is using the new UseExtension mode vs the old pipe mode */
4741
+ private _usePipeMode;
4742
+ private _useExtensionMode;
4743
+ private _extensionManager?;
4511
4744
  get isPlaying(): boolean;
4512
4745
  get __className__(): string;
4513
4746
  constructor(track: MediaStreamTrack, userId: UID, uintId: number, store: SDKStore, player?: AgoraRTCPlayer | VideoPlayer);
@@ -4518,6 +4751,13 @@ export declare class RemoteVideoTrack extends RemoteTrack implements IRemoteVide
4518
4751
  updateMediaStreamTrackResolution(): void;
4519
4752
  protected _updatePlayerSource(): void;
4520
4753
  getVideoElementVisibleStatus(): CheckVideoVisibleResult | undefined;
4754
+ private _ensureVideoExtensionManager;
4755
+ useExtension<T extends VideoExtensionConstructor>(extensionCtor: T, options?: {
4756
+ extensionOptions?: Record<string, unknown>;
4757
+ moduleURL?: string;
4758
+ registrationName?: string;
4759
+ }): InstanceType<T>;
4760
+ removeExtension(extension: IVideoExtension): boolean;
4521
4761
  pipe(processor: IBaseProcessor): IBaseProcessor;
4522
4762
  unpipe(): void;
4523
4763
  private bindProcessorDestinationEvents;
@@ -5509,6 +5749,28 @@ export declare interface VideoEncoderConfiguration {
5509
5749
  * @ignore
5510
5750
  */
5511
5751
  scaleResolutionDownBy?: number;
5752
+ /**
5753
+ * 自动降分辨率时允许降到的最小宽度。
5754
+ *
5755
+ * 当 SDK 接管分辨率降档时,发送宽度不会低于这个值。
5756
+ */
5757
+ /** @en
5758
+ * The minimum width allowed during automatic downscaling.
5759
+ *
5760
+ * When the SDK takes over resolution downscaling, the sending width will not go below this value.
5761
+ */
5762
+ minDownscaleWidth?: number;
5763
+ /**
5764
+ * 自动降分辨率时允许降到的最小高度。
5765
+ *
5766
+ * 当 SDK 接管分辨率降档时,发送高度不会低于这个值。
5767
+ */
5768
+ /** @en
5769
+ * The minimum height allowed during automatic downscaling.
5770
+ *
5771
+ * When the SDK takes over resolution downscaling, the sending height will not go below this value.
5772
+ */
5773
+ minDownscaleHeight?: number;
5512
5774
  }
5513
5775
 
5514
5776
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agora-js/media",
3
- "version": "4.24.4",
3
+ "version": "4.24.5",
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,10 +23,11 @@
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.24.4",
27
- "@agora-js/report": "4.24.4",
26
+ "@agora-js/shared": "4.24.5",
27
+ "@agora-js/report": "4.24.5",
28
28
  "axios": "^1.16.1",
29
29
  "agora-rte-extension": "^1.2.4",
30
+ "agora-rte-extension-ng": "^1.0.3",
30
31
  "webrtc-adapter": "8.2.0"
31
32
  }
32
33
  }