@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.
@@ -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
 
@@ -740,6 +744,18 @@ export declare interface CustomVideoTrackInitConfig {
740
744
  * The maximum bitrate of sending the video track (Kbps).
741
745
  */
742
746
  bitrateMax?: number;
747
+ /**
748
+ * The minimum width allowed during automatic downscaling.
749
+ *
750
+ * When the SDK takes over resolution downscaling, the sending width will not go below this value.
751
+ */
752
+ minDownscaleWidth?: number;
753
+ /**
754
+ * The minimum height allowed during automatic downscaling.
755
+ *
756
+ * When the SDK takes over resolution downscaling, the sending height will not go below this value.
757
+ */
758
+ minDownscaleHeight?: number;
743
759
  /**
744
760
  * @since
745
761
  * <br>&emsp;&emsp;&emsp;*4.2.0*
@@ -1159,11 +1175,15 @@ export declare function getNewNearestVideoProfile(width: number, height: number,
1159
1175
  export declare function getNewVideoBitrate(width: number, height: number, fps: number): [number, number];
1160
1176
 
1161
1177
  export declare const getOriginSenderConfig: (track: LocalVideoTrack) => {
1178
+ width: number;
1179
+ height: number;
1162
1180
  frameRate: number;
1163
1181
  bitrateMax: number;
1164
1182
  bitrateMin: number;
1165
1183
  scaleResolutionDownBy: number;
1166
1184
  scale: number;
1185
+ minDownscaleWidth: number;
1186
+ minDownscaleHeight: number;
1167
1187
  };
1168
1188
 
1169
1189
  export declare function getScalabilityConfiguration(profile: SVCConfiguration | SVCConfigurationPreset): SVCConfiguration;
@@ -1473,6 +1493,33 @@ export declare interface ILocalAudioTrack extends ILocalTrack {
1473
1493
  * The destination of the current processing pipeline on the local audio track.
1474
1494
  */
1475
1495
  processorDestination: IAudioProcessor;
1496
+ /**
1497
+ * Creates or reuses an audio extension instance on the current audio track using a class constructor.
1498
+ *
1499
+ * @param extensionCtor The audio extension class constructor.
1500
+ * @param extensionOptions Optional extension initialization parameters.
1501
+ */
1502
+ useExtension<T extends IAudioExtension>(extensionCtor: AudioExtensionConstructor<T>, extensionOptions?: Record<string, unknown>): T;
1503
+ /**
1504
+ * Removes an audio extension from the local audio track.
1505
+ *
1506
+ * @param extension The audio extension instance.
1507
+ * @returns Whether the removal succeeded.
1508
+ */
1509
+ removeExtension(extension: IAudioExtension): boolean;
1510
+ /**
1511
+ * Adds a reference track to the current audio extension pipeline.
1512
+ *
1513
+ * @param track The local or remote audio track used as the reference input.
1514
+ */
1515
+ addReferenceTrack(track: ILocalAudioTrack | IRemoteAudioTrack): void;
1516
+ /**
1517
+ * Removes a reference track from the current audio extension pipeline.
1518
+ *
1519
+ * @param track The reference input track to remove.
1520
+ * @returns Whether the removal succeeded.
1521
+ */
1522
+ removeReferenceTrack(track: ILocalAudioTrack | IRemoteAudioTrack): boolean;
1476
1523
  }
1477
1524
 
1478
1525
  /**
@@ -1713,6 +1760,8 @@ export declare interface ILocalVideoTrack extends ILocalTrack {
1713
1760
  * @since
1714
1761
  * <br>&emsp;&emsp;&emsp;*4.10.0*
1715
1762
  *
1763
+ * @deprecated Legacy v1 pipe-mode API. For new extensions, use `useExtension` and `removeExtension`.
1764
+ *
1716
1765
  * Removes the `Processor` inserted to the local video track.
1717
1766
  */
1718
1767
  unpipe(): void;
@@ -1720,9 +1769,31 @@ export declare interface ILocalVideoTrack extends ILocalTrack {
1720
1769
  * @since
1721
1770
  * <br>&emsp;&emsp;&emsp;*4.10.0*
1722
1771
  *
1772
+ * @deprecated Legacy v1 pipe-mode API. For new extensions, use `useExtension` and `removeExtension`.
1773
+ *
1723
1774
  * The destination of the current processing pipeline on the local video track.
1724
1775
  */
1725
1776
  processorDestination: IBaseProcessor;
1777
+ /**
1778
+ * Creates or reuses a video extension proxy on the current video track using a class constructor.
1779
+ *
1780
+ * The same extension constructor always returns the same instance proxy until it is destroyed.
1781
+ *
1782
+ * @param extensionCtor The video extension class constructor.
1783
+ * @param options Optional extension initialization parameters.
1784
+ */
1785
+ useExtension<T extends VideoExtensionConstructor>(extensionCtor: T, options?: {
1786
+ extensionOptions?: Record<string, unknown>;
1787
+ moduleURL?: string;
1788
+ registrationName?: string;
1789
+ }): InstanceType<T>;
1790
+ /**
1791
+ * Removes a video extension from the local video track.
1792
+ *
1793
+ * @param extension The video extension instance.
1794
+ * @returns Whether the removal succeeded.
1795
+ */
1796
+ removeExtension(extension: IVideoExtension): boolean;
1726
1797
  /**
1727
1798
  * @since
1728
1799
  * <br>&emsp;&emsp;&emsp;*4.17.0*
@@ -1932,6 +2003,32 @@ export declare interface IRemoteAudioTrack extends IRemoteTrack {
1932
2003
  * The destination of the current processing pipeline on the remote audio track.
1933
2004
  */
1934
2005
  processorDestination: IAudioProcessor;
2006
+ /**
2007
+ * Creates or reuses an audio extension instance on the current remote audio track using a class constructor.
2008
+ *
2009
+ * @param extensionCtor The audio extension class constructor.
2010
+ */
2011
+ useExtension<T extends IAudioExtension>(extensionCtor: AudioExtensionConstructor<T>): T;
2012
+ /**
2013
+ * Removes an audio extension from the remote audio track.
2014
+ *
2015
+ * @param extension The audio extension instance.
2016
+ * @returns Whether the removal succeeded.
2017
+ */
2018
+ removeExtension(extension: IAudioExtension): boolean;
2019
+ /**
2020
+ * Adds a reference track to the current audio extension pipeline.
2021
+ *
2022
+ * @param track The local or remote audio track used as the reference input.
2023
+ */
2024
+ addReferenceTrack(track: ILocalAudioTrack | IRemoteAudioTrack): void;
2025
+ /**
2026
+ * Removes a reference track from the current audio extension pipeline.
2027
+ *
2028
+ * @param track The reference input track to remove.
2029
+ * @returns Whether the removal succeeded.
2030
+ */
2031
+ removeReferenceTrack(track: ILocalAudioTrack | IRemoteAudioTrack): boolean;
1935
2032
  }
1936
2033
 
1937
2034
  /**
@@ -2086,6 +2183,24 @@ export declare interface IRemoteVideoTrack extends IRemoteTrack {
2086
2183
  * The destination of the current processing pipeline on the remote video track.
2087
2184
  */
2088
2185
  processorDestination: IBaseProcessor;
2186
+ /**
2187
+ * Creates or reuses a video extension proxy on the current video track using a class constructor.
2188
+ *
2189
+ * @param extensionCtor The video extension class constructor.
2190
+ * @param options Optional extension initialization parameters.
2191
+ */
2192
+ useExtension<T extends VideoExtensionConstructor>(extensionCtor: T, options?: {
2193
+ extensionOptions?: Record<string, unknown>;
2194
+ moduleURL?: string;
2195
+ registrationName?: string;
2196
+ }): InstanceType<T>;
2197
+ /**
2198
+ * Removes a video extension from the remote video track.
2199
+ *
2200
+ * @param extension The video extension instance.
2201
+ * @returns Whether the removal succeeded.
2202
+ */
2203
+ removeExtension(extension: IVideoExtension): boolean;
2089
2204
  /**
2090
2205
  * Stops playing the media track.
2091
2206
  * @param isKeepLastFrame Whether to keep the last frame.
@@ -2181,6 +2296,9 @@ export declare class LocalAudioTrack extends LocalTrack implements ILocalAudioTr
2181
2296
  _processorDestination: AudioProcessorDestination | undefined;
2182
2297
  get processorDestination(): AudioProcessorDestination;
2183
2298
  protected _getOriginVolumeLevel: boolean;
2299
+ private _usePipeMode;
2300
+ private _useExtensionMode;
2301
+ private _extensionManager?;
2184
2302
  get isPlaying(): boolean;
2185
2303
  get __className__(): string;
2186
2304
  constructor(track: MediaStreamTrack, encoderConfig?: AudioEncoderConfiguration, trackId?: string, getOriginVolumeLevel?: boolean);
@@ -2198,6 +2316,11 @@ export declare class LocalAudioTrack extends LocalTrack implements ILocalAudioTr
2198
2316
  protected _updatePlayerSource(updateWebAudioSource?: boolean): void;
2199
2317
  protected _updateOriginMediaStreamTrack(track: MediaStreamTrack, stopOldTrack: boolean): Promise<void>;
2200
2318
  renewMediaStreamTrack(newConstraints?: MediaTrackConstraints): Promise<void>;
2319
+ private _ensureExtensionManager;
2320
+ useExtension<T extends IAudioExtension>(ctor: AudioExtensionConstructor<T>, extensionOptions?: Record<string, unknown>): T;
2321
+ removeExtension(extension: IAudioExtension): boolean;
2322
+ addReferenceTrack(track: LocalAudioTrack | RemoteAudioTrack): void;
2323
+ removeReferenceTrack(track: LocalAudioTrack | RemoteAudioTrack): boolean;
2201
2324
  pipe(processor: IAudioProcessor): IAudioProcessor;
2202
2325
  unpipe(): void;
2203
2326
  private bindProcessorDestinationEvents;
@@ -2330,6 +2453,9 @@ export declare class LocalVideoTrack extends LocalTrack implements ILocalVideoTr
2330
2453
  protected _processorDestination: VideoProcessorDestination;
2331
2454
  get processorDestination(): VideoProcessorDestination;
2332
2455
  protected _processorContext: VideoProcessorContext;
2456
+ private _usePipeMode;
2457
+ private _useExtensionMode;
2458
+ private _extensionManager?;
2333
2459
  protected get processorContext(): VideoProcessorContext;
2334
2460
  protected set processorContext(ctx: VideoProcessorContext);
2335
2461
  get __className__(): string;
@@ -2358,6 +2484,13 @@ export declare class LocalVideoTrack extends LocalTrack implements ILocalVideoTr
2358
2484
  updateBitrateFromProfile(): void;
2359
2485
  getVideoElementVisibleStatus(): CheckVideoVisibleResult | undefined;
2360
2486
  renewMediaStreamTrack(newConstraints?: MediaTrackConstraints): Promise<void>;
2487
+ private _ensureVideoExtensionManager;
2488
+ useExtension<T extends VideoExtensionConstructor>(extensionCtor: T, options?: {
2489
+ extensionOptions?: Record<string, unknown>;
2490
+ moduleURL?: string;
2491
+ registrationName?: string;
2492
+ }): InstanceType<T>;
2493
+ removeExtension(extension: IVideoExtension): boolean;
2361
2494
  pipe(processor: IBaseProcessor): IBaseProcessor;
2362
2495
  unpipe(): void;
2363
2496
  close(): void;
@@ -2628,6 +2761,9 @@ export declare class RemoteAudioTrack extends RemoteTrack implements IRemoteAudi
2628
2761
  private _volume;
2629
2762
  protected processorContext: AudioProcessorContext;
2630
2763
  processorDestination: AudioProcessorDestination;
2764
+ private _usePipeMode;
2765
+ private _useExtensionMode;
2766
+ private _extensionManager?;
2631
2767
  private _played;
2632
2768
  private _bypassWebAudio;
2633
2769
  get isPlaying(): boolean;
@@ -2645,6 +2781,11 @@ export declare class RemoteAudioTrack extends RemoteTrack implements IRemoteAudi
2645
2781
  _destroy(): void;
2646
2782
  _isFreeze(): boolean;
2647
2783
  protected _updatePlayerSource(updateWebAudioSource?: boolean): void;
2784
+ private _ensureAudioExtensionManager;
2785
+ useExtension<T extends IAudioExtension>(ctor: AudioExtensionConstructor<T>): T;
2786
+ removeExtension(extension: IAudioExtension): boolean;
2787
+ addReferenceTrack(track: LocalAudioTrack | RemoteAudioTrack): void;
2788
+ removeReferenceTrack(track: LocalAudioTrack | RemoteAudioTrack): boolean;
2648
2789
  pipe(processor: IAudioProcessor): IAudioProcessor;
2649
2790
  unpipe(): void;
2650
2791
  private bindProcessorDestinationEvents;
@@ -2828,6 +2969,9 @@ export declare class RemoteVideoTrack extends RemoteTrack implements IRemoteVide
2828
2969
  private _prePlayer?;
2829
2970
  processorDestination: VideoProcessorDestination;
2830
2971
  protected processorContext: VideoProcessorContext;
2972
+ private _usePipeMode;
2973
+ private _useExtensionMode;
2974
+ private _extensionManager?;
2831
2975
  get isPlaying(): boolean;
2832
2976
  get __className__(): string;
2833
2977
  constructor(track: MediaStreamTrack, userId: UID, uintId: number, store: SDKStore, player?: AgoraRTCPlayer | VideoPlayer);
@@ -2838,6 +2982,13 @@ export declare class RemoteVideoTrack extends RemoteTrack implements IRemoteVide
2838
2982
  updateMediaStreamTrackResolution(): void;
2839
2983
  protected _updatePlayerSource(): void;
2840
2984
  getVideoElementVisibleStatus(): CheckVideoVisibleResult | undefined;
2985
+ private _ensureVideoExtensionManager;
2986
+ useExtension<T extends VideoExtensionConstructor>(extensionCtor: T, options?: {
2987
+ extensionOptions?: Record<string, unknown>;
2988
+ moduleURL?: string;
2989
+ registrationName?: string;
2990
+ }): InstanceType<T>;
2991
+ removeExtension(extension: IVideoExtension): boolean;
2841
2992
  pipe(processor: IBaseProcessor): IBaseProcessor;
2842
2993
  unpipe(): void;
2843
2994
  private bindProcessorDestinationEvents;
@@ -3408,6 +3559,18 @@ export declare interface VideoEncoderConfiguration {
3408
3559
  * @ignore
3409
3560
  */
3410
3561
  scaleResolutionDownBy?: number;
3562
+ /**
3563
+ * The minimum width allowed during automatic downscaling.
3564
+ *
3565
+ * When the SDK takes over resolution downscaling, the sending width will not go below this value.
3566
+ */
3567
+ minDownscaleWidth?: number;
3568
+ /**
3569
+ * The minimum height allowed during automatic downscaling.
3570
+ *
3571
+ * When the SDK takes over resolution downscaling, the sending height will not go below this value.
3572
+ */
3573
+ minDownscaleHeight?: number;
3411
3574
  }
3412
3575
 
3413
3576
  /**