@agora-js/media 4.20.0 → 4.20.1-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
@@ -730,7 +730,7 @@ export declare class CameraVideoTrack extends LocalVideoTrack implements ICamera
730
730
  _enabled: boolean;
731
731
  _deviceName: string;
732
732
  get __className__(): string;
733
- constructor(track: MediaStreamTrack, config: CameraVideoTrackInitConfig, constraints: MediaTrackConstraints, scalabilityConfig?: SVCConfiguration, optimizationMode?: "motion" | "detail" | "balanced", trackId?: string);
733
+ constructor(track: MediaStreamTrack, config: CameraVideoTrackInitConfig, constraints: MediaTrackConstraints, scalabilityConfig?: SVCConfiguration, optimizationMode?: OptimizationMode | "balanced", trackId?: string);
734
734
  setDevice(deviceId: string | RequiredOnlyOneOf<{
735
735
  facingMode: VideoFacingModeEnum;
736
736
  deviceId: string;
@@ -832,7 +832,7 @@ export declare interface CameraVideoTrackInitConfig {
832
832
  *
833
833
  * > Note: This method is only supported on Chrome.
834
834
  */
835
- optimizationMode?: "motion" | "detail";
835
+ optimizationMode?: OptimizationMode;
836
836
  /**
837
837
  * @ignore
838
838
  * **自从**
@@ -1354,6 +1354,28 @@ declare function event_beauty_effect_overload(): void;
1354
1354
  */
1355
1355
  declare function event_first_frame_decoded(): void;
1356
1356
 
1357
+ /**
1358
+ * **自从**
1359
+ * <br>&emsp;&emsp;&emsp;*4.20.1*
1360
+ *
1361
+ * 从 H.264 视频流中解析出 SEI 数据时触发,此事件会返回 SEI 数据。
1362
+ *
1363
+ * @param sei Uint8Array 类型的 SEI 数据
1364
+ * @asMemberOf ILocalVideoTrack
1365
+ * @event
1366
+ */
1367
+ /** @en
1368
+ * **Since**
1369
+ * <br>&emsp;&emsp;&emsp;*4.20.1*
1370
+ *
1371
+ * Parsing SEI data from the H.264 video stream triggers this event, which returns the SEI data.
1372
+ *
1373
+ * @param sei SEI data in Uint8Array
1374
+ * @asMemberOf ILocalVideoTrack
1375
+ * @event
1376
+ */
1377
+ declare function event_sei_received(sei: Uint8Array): void;
1378
+
1357
1379
  /**
1358
1380
  * 当 [BufferSourceAudioTrack]{@link IBufferSourceAudioTrack} 的音频数据源处理状态变化时,会触发此事件。
1359
1381
  *
@@ -1408,6 +1430,8 @@ declare function event_source_state_change(currentState: AudioSourceState): void
1408
1430
  */
1409
1431
  declare function event_track_ended(): void;
1410
1432
 
1433
+ export declare function event_track_updated(track: MediaStreamTrack): void;
1434
+
1411
1435
  /**
1412
1436
  * 当前轨道的 `RTCRtpTransceiver` 实例更新回调。
1413
1437
  *
@@ -1533,6 +1557,20 @@ declare function event_video_element_visible_status(data?: CheckVideoVisibleResu
1533
1557
  */
1534
1558
  declare function event_video_element_visible_status_2(data?: CheckVideoVisibleResult): void;
1535
1559
 
1560
+ /**
1561
+ * 视频状态发生变化时触发。
1562
+ *
1563
+ * @event
1564
+ * @asMemberOf IRemoteTrack
1565
+ */
1566
+ /** @en
1567
+ * Occurs when the video state changes.
1568
+ *
1569
+ * @event
1570
+ * @asMemberOf IRemoteTrack
1571
+ */
1572
+ declare function event_video_state_changed(videoState: VideoState): void;
1573
+
1536
1574
  export declare interface ExtendedVideoFrameCallbackMetadata extends VideoFrameCallbackMetadata {
1537
1575
  timestamp: DOMHighResTimeStamp;
1538
1576
  }
@@ -1576,7 +1614,15 @@ export declare function getAudioContext(): AudioContext;
1576
1614
 
1577
1615
  export declare function getAudioEncoderConfiguration(profile: AudioEncoderConfigurationPreset | AudioEncoderConfiguration): AudioEncoderConfiguration;
1578
1616
 
1579
- export declare function getBitrateFromResAndFps(width: number, height: number, fps: number, bitrateAdapterType: "STANDARD_BITRATE" | "COMPATIABLE_BITRATE"): [number, number] | void;
1617
+ export declare function getBitrateConstrainRange(width: number, height: number, frameRate: number, bitrateMin?: number, bitrateMax?: number): DoubleRange;
1618
+
1619
+ /**
1620
+ * get bitrate, use STANDARD_BITRATE to make sure the response
1621
+ * @param width
1622
+ * @param height
1623
+ * @param fps
1624
+ */
1625
+ export declare function getBitrateFromResAndFps(width: number, height: number, fps: number): Required<DoubleRange>;
1580
1626
 
1581
1627
  export declare function getCompatibility(): AgoraRTCCompatibility;
1582
1628
 
@@ -1594,6 +1640,22 @@ export declare function getElectronScreenStreamByUserSelect(config: ScreenConstr
1594
1640
 
1595
1641
  export declare function getLocalStream(config: GetUserMediaConfig, id: string): Promise<MediaStream>;
1596
1642
 
1643
+ /**
1644
+ * 获取初始配置
1645
+ * 分辨率:track.getMediaStreamTrackSettings > 客户设置
1646
+ * 帧率: track.getMediaStreamTrackSettings > 客户设置
1647
+ * 码率: 客户设置 > 根据分辨率计算
1648
+ *
1649
+ * ⚠️:理论上不存在没有分辨率的情况,如果出现不足任何处理
1650
+ */
1651
+ export declare const getOriginSenderConfig: (track: LocalVideoTrack) => {
1652
+ frameRate: number;
1653
+ bitrateMax: number;
1654
+ bitrateMin: number;
1655
+ scaleResolutionDownBy: number;
1656
+ scale: number;
1657
+ };
1658
+
1597
1659
  export declare function getScalabilityConfiguration(profile: SVCConfiguration | SVCConfigurationPreset): SVCConfiguration;
1598
1660
 
1599
1661
  export declare function getScreenEncoderConfiguration(profile: VideoEncoderConfiguration | ScreenEncoderConfigurationPreset | string): VideoEncoderConfiguration;
@@ -2034,7 +2096,6 @@ export declare interface ILocalAudioTrack extends ILocalTrack {
2034
2096
  *
2035
2097
  * > 注意事项:
2036
2098
  * > - 自 v4.7.0 起,该方法不再生效。请改用 [IRemoteAudioTrack.setPlaybackDevice]{@link IRemoteAudioTrack.setPlaybackDevice}。
2037
- * > - 该方法只支持桌面端的 Chrome 浏览器,其他浏览器调用将会抛出 `NOT_SUPPORTED` 错误。
2038
2099
  *
2039
2100
  * 设置本地播放远端音频流的设备(扬声器)。
2040
2101
  *
@@ -2046,7 +2107,6 @@ export declare interface ILocalAudioTrack extends ILocalTrack {
2046
2107
  *
2047
2108
  * > Note:
2048
2109
  * > - As of v4.7.0, this method no longer takes effect. Use [IRemoteAudioTrack.setPlaybackDevice]{@link IRemoteAudioTrack.setPlaybackDevice} instead.
2049
- * > - This method supports Chrome on desktop devices only. Other browsers throw a '`NOT_SUPPORTED` error when calling this method.
2050
2110
  *
2051
2111
  * Sets the playback device (speaker) for the remote audio stream.
2052
2112
  *
@@ -2132,6 +2192,7 @@ export declare interface ILocalDataChannel extends IDataChannel {
2132
2192
  * `LocalTrack` is the basic interface for local tracks, providing public methods for [LocalAudioTrack]{@link ILocalAudioTrack} and [LocalVideoTrack]{@link ILocalVideoTrack}.
2133
2193
  */
2134
2194
  export declare interface ILocalTrack extends ITrack {
2195
+ on(event: "track-updated", listener: typeof event_track_updated): void;
2135
2196
  /**
2136
2197
  * @param event 事件名称。
2137
2198
  * @param listener 详见 [track-ended]{@link event_track_ended}。
@@ -2241,7 +2302,7 @@ export declare interface ILocalTrack extends ITrack {
2241
2302
  *
2242
2303
  * If the track is published, a successful call of `setMuted(true)` triggers the [user-unpublished]{@link IAgoraRTCClient.event_user_unpublished} event on the remote client, and a successful call of `setMuted(false)` triggers the [user-published]{@link IAgoraRTCClient.event_user_published} event.
2243
2304
  *
2244
- * > - Calling `setMuted(true)` does not stop capturing audio or video and takes shorter time to take effect than [[setEnabled]]. For details, see [What are the differences between setEnabled and setMuted?](https://docs.agora.io/en/Interactive%20Broadcast/faq/differences_between_setenabled_and_setmuted).
2305
+ * > - Calling `setMuted(true)` does not stop capturing audio or video and takes shorter time to take effect than [[setEnabled]]. For details, see [What are the differences between setEnabled and setMuted?](https://docs.agora.io/en/interactive-live-streaming/develop/product-workflow?platform=web#setenabled-and-setmuted).
2245
2306
  * > - Do not call `setEnabled` and `setMuted` together.
2246
2307
  *
2247
2308
  * @param muted Whether to stop sending the media data of the track:
@@ -2285,6 +2346,7 @@ export declare interface ILocalTrack extends ITrack {
2285
2346
  * Inherited from `LocalVideoTrack`, [CameraVideoTrack]{@link ICameraVideoTrack} is an interface for the video captured by a local camera and adds several camera-related functions.
2286
2347
  */
2287
2348
  export declare interface ILocalVideoTrack extends ILocalTrack {
2349
+ on(event: "track-updated", listener: typeof event_track_updated): void;
2288
2350
  /** @internal */
2289
2351
  on(event: "beauty-effect-overload", listener: typeof event_beauty_effect_overload): void;
2290
2352
  /**
@@ -2317,7 +2379,7 @@ export declare interface ILocalVideoTrack extends ILocalTrack {
2317
2379
  */
2318
2380
  on(event: "transceiver-updated", listener: typeof event_transceiver_updated): void;
2319
2381
  /**
2320
- * 在页面上播放本地视频轨道。
2382
+ * 在页面上播放远端视频轨道。
2321
2383
  *
2322
2384
  * @param element 指定一个 DOM 元素,SDK 将在这个元素下创建 `<video>` 元素播放视频轨道,支持 2 种类型:
2323
2385
  * - `string`: 指定该 DOM 元素的 ID 值。
@@ -2325,7 +2387,7 @@ export declare interface ILocalVideoTrack extends ILocalTrack {
2325
2387
  * @param config 设置播放参数(镜像/显示模式)。详见 [[VideoPlayerConfig]]。对于本地视频轨道,镜像模式默认开启。
2326
2388
  */
2327
2389
  /** @en
2328
- * Plays a local video track on the web page.
2390
+ * Plays a remote video track on the web page.
2329
2391
  *
2330
2392
  * @param element Specifies a DOM element. The SDK will create a `<video>` element under the specified DOM element to play the video track. You can specify a DOM element in either of the following ways:
2331
2393
  * - `string`: Specify the ID of the DOM element.
@@ -2641,6 +2703,17 @@ export declare interface ILocalVideoTrack extends ILocalTrack {
2641
2703
  * @param config The video encoder configurations. You can pass either [[VideoEncoderConfigurationPreset]] or a customized [[VideoEncoderConfiguration]] object.
2642
2704
  */
2643
2705
  setEncoderConfiguration(config: VideoEncoderConfiguration | VideoEncoderConfigurationPreset): Promise<void>;
2706
+ /**
2707
+ * 在 H.264 视频流中添加 SEI 数据。
2708
+ *
2709
+ * @param sei SEI 数据。
2710
+ */
2711
+ /** @en
2712
+ * Add the SEI data to the H.264 video stream.
2713
+ *
2714
+ * @param config SEI data.
2715
+ */
2716
+ sendSeiData(sei: Uint8Array): void;
2644
2717
  }
2645
2718
 
2646
2719
  export declare interface ImageTypedData {
@@ -2710,6 +2783,18 @@ export declare interface IMicrophoneAudioTrack extends ILocalAudioTrack {
2710
2783
  setEnabled(enabled: boolean): Promise<void>;
2711
2784
  }
2712
2785
 
2786
+ export declare function interceptLocalAudioFrame(sender: RTCRtpSender): Promise<void>;
2787
+
2788
+ export declare function interceptLocalVideoFrame(sender: RTCRtpSender, localVideoTrack: LocalVideoTrack): Promise<void>;
2789
+
2790
+ export declare function interceptRemoteAudioFrame(receiver: RTCRtpReceiver): Promise<void>;
2791
+
2792
+ export declare function interceptRemoteVideoFrame(receiver: RTCRtpReceiver, options?: InterceptVideoFrameOptions): Promise<void>;
2793
+
2794
+ declare interface InterceptVideoFrameOptions {
2795
+ onSei?: (sei: Uint8Array) => void;
2796
+ }
2797
+
2713
2798
  /**
2714
2799
  * 远端音频轨道,调用 [subscribe]{@link IAgoraRTCClient.subscribe} 后通过 [AgoraRTCRemoteUser.audioTrack]{@link IAgoraRTCRemoteUser.audioTrack} 对象获取
2715
2800
  */
@@ -2749,7 +2834,7 @@ export declare interface IRemoteAudioTrack extends IRemoteTrack {
2749
2834
  *
2750
2835
  * 设置音频播放设备,比如扬声器。
2751
2836
  *
2752
- * > 该方法只支持桌面端的 Chrome 浏览器,其他浏览器调用将会抛出 `NOT_SUPPORTED` 错误。
2837
+ * > 该方法只支持桌面端的 Chrome 和 Edge 浏览器,其他浏览器调用将会抛出 `NOT_SUPPORTED` 错误。
2753
2838
  * @param deviceId 设备 ID,可以通过 [[getPlaybackDevices]] 方法获取。
2754
2839
  */
2755
2840
  /** @en
@@ -2758,7 +2843,7 @@ export declare interface IRemoteAudioTrack extends IRemoteTrack {
2758
2843
  *
2759
2844
  * Sets the audio playback device, for example, the speaker.
2760
2845
  *
2761
- * > This method supports Chrome on desktop devices only. Other browsers throw a `NOT_SUPPORTED` error when calling this method.
2846
+ * > This method supports Chrome and Edge on desktop devices only. Other browsers throw a `NOT_SUPPORTED` error when calling this method.
2762
2847
  * @param deviceId Device ID, which can be retrieved by calling [[getPlaybackDevices]].
2763
2848
  */
2764
2849
  setPlaybackDevice(deviceId: string): Promise<void>;
@@ -2904,6 +2989,7 @@ export declare interface IRemoteDataChannel extends IDataChannel {
2904
2989
  * `RemoteTrack` is the basic interface for remote tracks, providing public methods for [RemoteAudioTrack]{@link IRemoteAudioTrack} and [RemoteVideoTrack]{@link IRemoteVideoTrack}.
2905
2990
  */
2906
2991
  export declare interface IRemoteTrack extends ITrack {
2992
+ on(event: "track-updated", listener: typeof event_track_updated): void;
2907
2993
  /**
2908
2994
  * @param event 事件名称。
2909
2995
  * @param listener 详见 [first-frame-decoded]{@link event_first_frame_decoded}。
@@ -2963,6 +3049,16 @@ export declare interface IRemoteTrack extends ITrack {
2963
3049
  * You can get create a remote video track by the [AgoraRTCRemoteUser.videoTrack]{@link IAgoraRTCRemoteUser.videoTrack} object after calling [subscribe]{@link IAgoraRTCClient.subscribe}.
2964
3050
  */
2965
3051
  export declare interface IRemoteVideoTrack extends IRemoteTrack {
3052
+ /**
3053
+ * @param event 事件名称。
3054
+ * @param listener 详见 [video-state-changed]{@link event_video_state_changed}。
3055
+ */
3056
+ /** @en
3057
+ * @param event The event name.
3058
+ * @param listener See [video-state-changed]{@link event_video_state_changed}.
3059
+ */
3060
+ on(event: "track-updated", listener: typeof event_track_updated): void;
3061
+ on(event: "video-state-changed", listener: typeof event_video_state_changed): void;
2966
3062
  /**
2967
3063
  * @param event 事件名称。
2968
3064
  * @param listener 详见 [first-frame-decoded]{@link event_first_frame_decoded}。
@@ -2992,6 +3088,17 @@ export declare interface IRemoteVideoTrack extends IRemoteTrack {
2992
3088
  * @param listener See [IRemoteTrack.transceiver-updated]{@link event_transceiver_updated_2}.
2993
3089
  */
2994
3090
  on(event: "transceiver-updated", listener: typeof event_transceiver_updated_2): void;
3091
+ /**
3092
+ * 添加事件监听器。
3093
+ * @param event 事件名称。
3094
+ * @param listener 详见 [ILocalTrack.sei-received]{@link event_sei_received}。
3095
+ */
3096
+ /** @en
3097
+ * Adds an event listener.
3098
+ * @param event The event name.
3099
+ * @param listener See [ILocalTrack.sei-received]{@link event_sei_received}.
3100
+ */
3101
+ on(event: "sei-received", listener: typeof event_sei_received): void;
2995
3102
  /**
2996
3103
  * 获取远端视频轨道相关信息。
2997
3104
  *
@@ -3241,23 +3348,24 @@ export declare class LocalAudioTrack extends LocalTrack implements ILocalAudioTr
3241
3348
  readonly trackMediaType: "audio" | "video";
3242
3349
  _encoderConfig?: AudioEncoderConfiguration;
3243
3350
  _trackSource: AudioTrackSource | FakeTrackSource;
3244
- get _source(): AudioTrackSource | FakeTrackSource;
3351
+ /**
3352
+ * @description This method is used to init WebAudio, if you're sure you don't want to use WebAudio, call _trackSource
3353
+ */
3354
+ get _source(): AudioTrackSource;
3245
3355
  set _source(source: AudioTrackSource | FakeTrackSource);
3246
3356
  _enabled: boolean;
3247
3357
  private _volume;
3248
3358
  _useAudioElement: boolean;
3249
3359
  _bypassWebAudio: boolean;
3250
3360
  protected processor?: IAudioProcessor;
3251
- protected _processorContext: AudioProcessorContext;
3361
+ protected _processorContext: AudioProcessorContext | undefined;
3252
3362
  protected get processorContext(): AudioProcessorContext;
3253
- protected set processorContext(ctx: AudioProcessorContext);
3254
- _processorDestination: AudioProcessorDestination;
3363
+ _processorDestination: AudioProcessorDestination | undefined;
3255
3364
  get processorDestination(): AudioProcessorDestination;
3256
- set processorDestination(des: AudioProcessorDestination);
3257
3365
  protected _getOriginVolumeLevel: boolean;
3258
3366
  get isPlaying(): boolean;
3259
3367
  get __className__(): string;
3260
- constructor(track: MediaStreamTrack, encoderConfig?: AudioEncoderConfiguration, trackId?: string, getOriginVolumeLevel?: boolean, deferWebAudio?: boolean);
3368
+ constructor(track: MediaStreamTrack, encoderConfig?: AudioEncoderConfiguration, trackId?: string, getOriginVolumeLevel?: boolean);
3261
3369
  setVolume(volume: number): void;
3262
3370
  getVolumeLevel(): number;
3263
3371
  setPlaybackDevice(deviceId: string): Promise<void>;
@@ -3276,7 +3384,10 @@ export declare class LocalAudioTrack extends LocalTrack implements ILocalAudioTr
3276
3384
  unpipe(): void;
3277
3385
  private bindProcessorDestinationEvents;
3278
3386
  private unbindProcessorDestinationEvents;
3279
- private unbindProcessorContextEvents;
3387
+ protected bindProcessorContextEvents(processorContext: AudioProcessorContext): void;
3388
+ protected unbindProcessorContextEvents(processorContext: AudioProcessorContext): void;
3389
+ private initWebAudio;
3390
+ private initProcessor;
3280
3391
  }
3281
3392
 
3282
3393
  /**
@@ -3395,9 +3506,9 @@ export declare abstract class LocalTrack extends Track implements ILocalTrack {
3395
3506
  _isClosed: boolean;
3396
3507
  protected _enabledMutex: PromiseMutex;
3397
3508
  protected processor?: IBaseProcessor;
3398
- protected abstract _processorContext: IProcessorContext;
3399
- protected get processorContext(): IProcessorContext;
3400
- protected set processorContext(ctx: IProcessorContext);
3509
+ protected abstract _processorContext: IProcessorContext | undefined;
3510
+ protected get processorContext(): IProcessorContext | undefined;
3511
+ abstract processorDestination: IBaseProcessor;
3401
3512
  constructor(track: MediaStreamTrack, trackId?: string);
3402
3513
  abstract getStats(): LocalVideoTrackStats | LocalAudioTrackStats;
3403
3514
  abstract setMuted(enabled: boolean): Promise<void>;
@@ -3435,9 +3546,21 @@ export declare class LocalVideoTrack extends LocalTrack implements ILocalVideoTr
3435
3546
  protected _statsTimer: number | null;
3436
3547
  private _previousVideoVisibleStatus;
3437
3548
  private _clearPreviousVideoVisibleStatus;
3438
- _encoderConfig?: Partial<VideoEncoderConfiguration>;
3549
+ _encoderConfig?: Partial<VideoEncoderConfiguration & {
3550
+ scale: number;
3551
+ }>;
3439
3552
  _scalabilityMode?: SVCConfiguration;
3440
- _optimizationMode?: "motion" | "detail" | "balanced";
3553
+ _optimizationMode?: OptimizationMode | "balanced";
3554
+ _qualityLimitationReason?: QualityLimitationReason;
3555
+ /**
3556
+ * Adaptation origin config
3557
+ */
3558
+ private _originalSenderConfig?;
3559
+ _adaptationConfig?: VideoSenderConfig;
3560
+ /**
3561
+ * 轮询监听stats
3562
+ */
3563
+ private _adaptationTimer;
3441
3564
  _videoHeight?: number;
3442
3565
  _videoWidth?: number;
3443
3566
  _forceBitrateLimit?: {
@@ -3451,13 +3574,13 @@ export declare class LocalVideoTrack extends LocalTrack implements ILocalVideoTr
3451
3574
  protected get processorContext(): VideoProcessorContext;
3452
3575
  protected set processorContext(ctx: VideoProcessorContext);
3453
3576
  get __className__(): string;
3454
- constructor(track: MediaStreamTrack, encoderConfig?: Partial<VideoEncoderConfiguration>, scalabilityConfig?: SVCConfiguration, optimizationMode?: "motion" | "detail" | "balanced", trackId?: string, hints?: TrackHint[]);
3577
+ constructor(track: MediaStreamTrack, encoderConfig?: Partial<VideoEncoderConfiguration>, scalabilityConfig?: SVCConfiguration, optimizationMode?: OptimizationMode | "balanced", trackId?: string, hints?: TrackHint[]);
3455
3578
  play(element: HTMLElement | HTMLVideoElement | string, config?: VideoPlayerConfig): void;
3456
3579
  stop(): void;
3457
3580
  setEnabled(enabled: boolean, skipChangeState?: boolean): Promise<void>;
3458
3581
  setMuted(muted: boolean): Promise<void>;
3459
3582
  setEncoderConfiguration(config: VideoEncoderConfiguration | VideoEncoderConfigurationPreset, doNotRenegoation?: boolean): Promise<void>;
3460
- getStats(): LocalVideoTrackStats;
3583
+ getStats(isExternal?: boolean): LocalVideoTrackStats;
3461
3584
  setBeautyEffect(enabled: boolean, options?: BeautyEffectOptions): Promise<void>;
3462
3585
  getCurrentFrameData(): ImageData;
3463
3586
  getCurrentFrameImage(imageType: string, quality?: number): Promise<ImageTypedData>;
@@ -3465,7 +3588,10 @@ export declare class LocalVideoTrack extends LocalTrack implements ILocalVideoTr
3465
3588
  max_bitrate: number;
3466
3589
  min_bitrate: number;
3467
3590
  }): Promise<void>;
3468
- setOptimizationMode(mode: "motion" | "detail" | "balanced"): Promise<void>;
3591
+ setOptimizationMode(mode: OptimizationMode | "balanced"): Promise<void>;
3592
+ protected applyAdaptation(config: VideoSenderConfig): Promise<void>;
3593
+ startVideoStreamAdapter(): void;
3594
+ protected updateAdapterConfig(): void;
3469
3595
  setScalabiltyMode(mode: SVCConfiguration): void;
3470
3596
  updateMediaStreamTrackResolution(): void;
3471
3597
  protected _updatePlayerSource(): void;
@@ -3480,6 +3606,7 @@ export declare class LocalVideoTrack extends LocalTrack implements ILocalVideoTr
3480
3606
  clone(config?: VideoEncoderConfiguration | VideoEncoderConfigurationPreset, cloneTrack?: boolean): LocalVideoTrack;
3481
3607
  replaceTrack(track: MediaStreamTrack, stopOldTrack: boolean): Promise<void>;
3482
3608
  startMonitorStats(): void;
3609
+ sendSeiData(sei: Uint8Array): never;
3483
3610
  private bindProcessorDestinationEvents;
3484
3611
  private unbindProcessorDestinationEvents;
3485
3612
  private unbindProcessorContextEvents;
@@ -3751,7 +3878,8 @@ export declare class MicrophoneAudioTrack extends LocalAudioTrack implements IMi
3751
3878
  close(): void;
3752
3879
  protected onTrackEnded(): void;
3753
3880
  renewMediaStreamTrack(newConstraints?: MediaTrackConstraints): Promise<void>;
3754
- private bindProcessorContextEvents;
3881
+ protected bindProcessorContextEvents(processorContext: AudioProcessorContext): void;
3882
+ protected unbindProcessorContextEvents(processorContext: AudioProcessorContext): void;
3755
3883
  }
3756
3884
 
3757
3885
  /**
@@ -3853,6 +3981,8 @@ export declare class MixingAudioTrack extends LocalAudioTrack {
3853
3981
  _updateRtpTransceiver(transceiver: RTCRtpTransceiver): void;
3854
3982
  }
3855
3983
 
3984
+ export declare type OptimizationMode = "motion" | "detail";
3985
+
3856
3986
  /**
3857
3987
  * @internal
3858
3988
  */
@@ -3885,6 +4015,13 @@ export declare interface ProcessorUsageStats {
3885
4015
  totalTs: number;
3886
4016
  }
3887
4017
 
4018
+ declare enum QualityLimitationReason {
4019
+ BANDWIDTH = "bandwidth",
4020
+ CPU = "cpu",
4021
+ NONE = "none",
4022
+ OTHER = "other"
4023
+ }
4024
+
3888
4025
  export declare class RemoteAudioTrack extends RemoteTrack implements IRemoteAudioTrack {
3889
4026
  readonly trackMediaType: "audio" | "video";
3890
4027
  _source: AudioTrackSource | FakeTrackSource;
@@ -4136,7 +4273,8 @@ export declare abstract class RemoteTrack extends Track implements IRemoteTrack
4136
4273
 
4137
4274
  export declare enum RemoteTrackEvents {
4138
4275
  FIRST_FRAME_DECODED = "first-frame-decoded",
4139
- VIDEO_ELEMENT_VISIBLE_STATUS = "video-element-visible-status"
4276
+ VIDEO_ELEMENT_VISIBLE_STATUS = "video-element-visible-status",
4277
+ VIDEO_STATE_CHANGED = "video-state-changed"
4140
4278
  }
4141
4279
 
4142
4280
  export declare class RemoteVideoTrack extends RemoteTrack implements IRemoteVideoTrack {
@@ -4164,6 +4302,7 @@ export declare class RemoteVideoTrack extends RemoteTrack implements IRemoteVide
4164
4302
  private bindProcessorDestinationEvents;
4165
4303
  private unbindProcessorDestinationEvents;
4166
4304
  _destroy(): void;
4305
+ _onSei(sei: Uint8Array): void;
4167
4306
  }
4168
4307
 
4169
4308
  /**
@@ -4666,6 +4805,12 @@ export declare interface ScreenVideoTrackInitConfig {
4666
4805
  systemAudio?: "include" | "exclude";
4667
4806
  }
4668
4807
 
4808
+ export declare type SenderConfig = {
4809
+ bitrateMax: number;
4810
+ bitrateMin: number;
4811
+ scaleResolutionDownBy: number;
4812
+ };
4813
+
4669
4814
  /**
4670
4815
  * 将节点输入的 AudioBuffer 返回,将节点输出的 AudioBuffer 设置成 silence
4671
4816
  */
@@ -4804,7 +4949,9 @@ export declare abstract class Track extends EventEmitter implements ITrack {
4804
4949
  /** 原始的 Track 对象,来自于采集/用户传入/订阅返回 */
4805
4950
  _originMediaStreamTrack: MediaStreamTrack;
4806
4951
  /** 用于播放和发布的 Track 对象,可能被各种模块修改,一般来说等于 `_originMediaStreamTrack` */
4807
- _mediaStreamTrack: MediaStreamTrack;
4952
+ mediaStreamTrack: MediaStreamTrack;
4953
+ set _mediaStreamTrack(track: MediaStreamTrack);
4954
+ get _mediaStreamTrack(): MediaStreamTrack;
4808
4955
  /** 提供给外部插件以同步数据 */
4809
4956
  _external: ExternalMethods;
4810
4957
  constructor(track: MediaStreamTrack, trackId?: string);
@@ -4820,7 +4967,10 @@ export declare abstract class Track extends EventEmitter implements ITrack {
4820
4967
  }
4821
4968
 
4822
4969
  export declare enum TrackEvents {
4823
- TRANSCEIVER_UPDATED = "transceiver-updated"
4970
+ TRANSCEIVER_UPDATED = "transceiver-updated",
4971
+ SEI_TO_SEND = "sei-to-send",
4972
+ SEI_RECEIVED = "sei-received",
4973
+ TRACK_UPDATED = "track-updated"
4824
4974
  }
4825
4975
 
4826
4976
  /**
@@ -4838,6 +4988,7 @@ export declare enum TrackHint {
4838
4988
  export declare enum TrackInternalEvent {
4839
4989
  NEED_RENEGOTIATE = "@need_renegotiate",
4840
4990
  NEED_REPLACE_TRACK = "@need_replace_track",
4991
+ NEED_REPLACE_MIXING_TRACK = "@need_replace_mixing_track",
4841
4992
  NEED_CLOSE = "@need_close",
4842
4993
  NEED_ENABLE_TRACK = "@need_enable_track",
4843
4994
  NEED_DISABLE_TRACK = "@need_disable_track",
@@ -4848,6 +4999,7 @@ export declare enum TrackInternalEvent {
4848
4999
  GET_LOW_VIDEO_TRACK = "@get_low_video_track",
4849
5000
  NEED_RESET_REMOTE_SDP = "@need_reset_remote_sdp",
4850
5001
  NEED_UPDATE_VIDEO_ENCODER = "@need_update_video_encoder",
5002
+ NEED_UPDATE_VIDEO_SEND_PARAMETERS = "@need_update_video_send_parameters",
4851
5003
  NEED_MUTE_TRACK = "@need_mute_track",
4852
5004
  NEED_UNMUTE_TRACK = "@need_unmute_track"
4853
5005
  }
@@ -5069,6 +5221,7 @@ declare class VideoPlayer {
5069
5221
  trackId: string;
5070
5222
  config: PlayerConfig;
5071
5223
  onFirstVideoFrameDecoded?: () => void;
5224
+ onVideoStateChanged?: (state: VideoState) => void;
5072
5225
  freezeTimeCounterList: number[];
5073
5226
  renderFreezeAccTime: number;
5074
5227
  isKeepLastFrame: boolean;
@@ -5084,7 +5237,11 @@ declare class VideoPlayer {
5084
5237
  protected cacheVideoElement?: HTMLVideoElement;
5085
5238
  get videoElementStatus(): MediaElementStatus;
5086
5239
  set videoElementStatus(status: MediaElementStatus);
5240
+ get videoState(): VideoState;
5241
+ set videoState(state: VideoState);
5242
+ private _videoState;
5087
5243
  private videoElementCheckInterval?;
5244
+ private videoElementFreezeTimeout?;
5088
5245
  private _videoElementStatus;
5089
5246
  private isGettingVideoDimensions;
5090
5247
  constructor(config: PlayerConfig);
@@ -5197,6 +5354,44 @@ export declare class VideoProcessorDestination extends EventEmitter implements I
5197
5354
  reset(): void;
5198
5355
  }
5199
5356
 
5357
+ declare interface VideoSenderConfig {
5358
+ frameRate: number;
5359
+ bitrateMax: number;
5360
+ bitrateMin: number;
5361
+ scaleResolutionDownBy: number;
5362
+ scale: number;
5363
+ }
5364
+
5365
+ /**
5366
+ * 视频流状态。
5367
+ * @public
5368
+ */
5369
+ /** @en
5370
+ * The state of the video stream.
5371
+ */
5372
+ export declare enum VideoState {
5373
+ /** 0: 视频默认初始状态。 */
5374
+ /** @en
5375
+ * 0: The initial state of the video.
5376
+ */
5377
+ VideoStateStopped = 0,
5378
+ /** 1: 本地用户已接收视频首包。 */
5379
+ /** @en
5380
+ * 1: The local user has received the first video packet.
5381
+ */
5382
+ VideoStateStarting = 1,
5383
+ /** 2: 视频流正在解码,正常播放。 */
5384
+ /** @en
5385
+ * 2: The video stream is being decoded and played normally.
5386
+ */
5387
+ VideoStateDecoding = 2,
5388
+ /** 3: 视频流卡顿。 */
5389
+ /** @en
5390
+ * 3: The video stream is frozen.
5391
+ */
5392
+ VideoStateFrozen = 3
5393
+ }
5394
+
5200
5395
  declare class VisibilityWatcher extends EventEmitter {
5201
5396
  private _lastHiddenTime;
5202
5397
  private _lastVisibleTime;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agora-js/media",
3
- "version": "4.20.0",
3
+ "version": "4.20.1-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,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.20.0",
27
- "@agora-js/report": "^4.20.0",
26
+ "@agora-js/shared": "4.20.1-1",
27
+ "@agora-js/report": "4.20.1-1",
28
28
  "axios": "^0.27.2",
29
29
  "agora-rte-extension": "^1.2.4",
30
30
  "webrtc-adapter": "8.2.0",