@agora-js/media 4.20.0 → 4.20.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/AgoraRTC_N-media.esm.mjs +2 -2
- package/AgoraRTC_N-media.js +3 -2
- package/media.d.ts +144 -21
- package/package.json +3 -3
- package/rtc-sdk-media_en.d.ts +101 -18
package/media.d.ts
CHANGED
|
@@ -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>   *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>   *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
|
*
|
|
@@ -1533,6 +1555,20 @@ declare function event_video_element_visible_status(data?: CheckVideoVisibleResu
|
|
|
1533
1555
|
*/
|
|
1534
1556
|
declare function event_video_element_visible_status_2(data?: CheckVideoVisibleResult): void;
|
|
1535
1557
|
|
|
1558
|
+
/**
|
|
1559
|
+
* 视频状态发生变化时触发。
|
|
1560
|
+
*
|
|
1561
|
+
* @event
|
|
1562
|
+
* @asMemberOf IRemoteTrack
|
|
1563
|
+
*/
|
|
1564
|
+
/** @en
|
|
1565
|
+
* Occurs when the video state changes.
|
|
1566
|
+
*
|
|
1567
|
+
* @event
|
|
1568
|
+
* @asMemberOf IRemoteTrack
|
|
1569
|
+
*/
|
|
1570
|
+
declare function event_video_state_changed(videoState: VideoState): void;
|
|
1571
|
+
|
|
1536
1572
|
export declare interface ExtendedVideoFrameCallbackMetadata extends VideoFrameCallbackMetadata {
|
|
1537
1573
|
timestamp: DOMHighResTimeStamp;
|
|
1538
1574
|
}
|
|
@@ -1576,7 +1612,7 @@ export declare function getAudioContext(): AudioContext;
|
|
|
1576
1612
|
|
|
1577
1613
|
export declare function getAudioEncoderConfiguration(profile: AudioEncoderConfigurationPreset | AudioEncoderConfiguration): AudioEncoderConfiguration;
|
|
1578
1614
|
|
|
1579
|
-
export declare function
|
|
1615
|
+
export declare function getBitrateConstrainRange(width: number, height: number, frameRate: number, bitrateMin?: number, bitrateMax?: number): DoubleRange;
|
|
1580
1616
|
|
|
1581
1617
|
export declare function getCompatibility(): AgoraRTCCompatibility;
|
|
1582
1618
|
|
|
@@ -2034,7 +2070,6 @@ export declare interface ILocalAudioTrack extends ILocalTrack {
|
|
|
2034
2070
|
*
|
|
2035
2071
|
* > 注意事项:
|
|
2036
2072
|
* > - 自 v4.7.0 起,该方法不再生效。请改用 [IRemoteAudioTrack.setPlaybackDevice]{@link IRemoteAudioTrack.setPlaybackDevice}。
|
|
2037
|
-
* > - 该方法只支持桌面端的 Chrome 浏览器,其他浏览器调用将会抛出 `NOT_SUPPORTED` 错误。
|
|
2038
2073
|
*
|
|
2039
2074
|
* 设置本地播放远端音频流的设备(扬声器)。
|
|
2040
2075
|
*
|
|
@@ -2046,7 +2081,6 @@ export declare interface ILocalAudioTrack extends ILocalTrack {
|
|
|
2046
2081
|
*
|
|
2047
2082
|
* > Note:
|
|
2048
2083
|
* > - 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
2084
|
*
|
|
2051
2085
|
* Sets the playback device (speaker) for the remote audio stream.
|
|
2052
2086
|
*
|
|
@@ -2241,7 +2275,7 @@ export declare interface ILocalTrack extends ITrack {
|
|
|
2241
2275
|
*
|
|
2242
2276
|
* 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
2277
|
*
|
|
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/
|
|
2278
|
+
* > - 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
2279
|
* > - Do not call `setEnabled` and `setMuted` together.
|
|
2246
2280
|
*
|
|
2247
2281
|
* @param muted Whether to stop sending the media data of the track:
|
|
@@ -2317,7 +2351,7 @@ export declare interface ILocalVideoTrack extends ILocalTrack {
|
|
|
2317
2351
|
*/
|
|
2318
2352
|
on(event: "transceiver-updated", listener: typeof event_transceiver_updated): void;
|
|
2319
2353
|
/**
|
|
2320
|
-
*
|
|
2354
|
+
* 在页面上播放远端视频轨道。
|
|
2321
2355
|
*
|
|
2322
2356
|
* @param element 指定一个 DOM 元素,SDK 将在这个元素下创建 `<video>` 元素播放视频轨道,支持 2 种类型:
|
|
2323
2357
|
* - `string`: 指定该 DOM 元素的 ID 值。
|
|
@@ -2325,7 +2359,7 @@ export declare interface ILocalVideoTrack extends ILocalTrack {
|
|
|
2325
2359
|
* @param config 设置播放参数(镜像/显示模式)。详见 [[VideoPlayerConfig]]。对于本地视频轨道,镜像模式默认开启。
|
|
2326
2360
|
*/
|
|
2327
2361
|
/** @en
|
|
2328
|
-
* Plays a
|
|
2362
|
+
* Plays a remote video track on the web page.
|
|
2329
2363
|
*
|
|
2330
2364
|
* @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
2365
|
* - `string`: Specify the ID of the DOM element.
|
|
@@ -2641,6 +2675,17 @@ export declare interface ILocalVideoTrack extends ILocalTrack {
|
|
|
2641
2675
|
* @param config The video encoder configurations. You can pass either [[VideoEncoderConfigurationPreset]] or a customized [[VideoEncoderConfiguration]] object.
|
|
2642
2676
|
*/
|
|
2643
2677
|
setEncoderConfiguration(config: VideoEncoderConfiguration | VideoEncoderConfigurationPreset): Promise<void>;
|
|
2678
|
+
/**
|
|
2679
|
+
* 在 H.264 视频流中添加 SEI 数据。
|
|
2680
|
+
*
|
|
2681
|
+
* @param sei SEI 数据。
|
|
2682
|
+
*/
|
|
2683
|
+
/** @en
|
|
2684
|
+
* Add the SEI data to the H.264 video stream.
|
|
2685
|
+
*
|
|
2686
|
+
* @param config SEI data.
|
|
2687
|
+
*/
|
|
2688
|
+
sendSeiData(sei: Uint8Array): void;
|
|
2644
2689
|
}
|
|
2645
2690
|
|
|
2646
2691
|
export declare interface ImageTypedData {
|
|
@@ -2710,6 +2755,18 @@ export declare interface IMicrophoneAudioTrack extends ILocalAudioTrack {
|
|
|
2710
2755
|
setEnabled(enabled: boolean): Promise<void>;
|
|
2711
2756
|
}
|
|
2712
2757
|
|
|
2758
|
+
export declare function interceptLocalAudioFrame(sender: RTCRtpSender): Promise<void>;
|
|
2759
|
+
|
|
2760
|
+
export declare function interceptLocalVideoFrame(sender: RTCRtpSender, localVideoTrack: LocalVideoTrack): Promise<void>;
|
|
2761
|
+
|
|
2762
|
+
export declare function interceptRemoteAudioFrame(receiver: RTCRtpReceiver): Promise<void>;
|
|
2763
|
+
|
|
2764
|
+
export declare function interceptRemoteVideoFrame(receiver: RTCRtpReceiver, options?: InterceptVideoFrameOptions): Promise<void>;
|
|
2765
|
+
|
|
2766
|
+
declare interface InterceptVideoFrameOptions {
|
|
2767
|
+
onSei?: (sei: Uint8Array) => void;
|
|
2768
|
+
}
|
|
2769
|
+
|
|
2713
2770
|
/**
|
|
2714
2771
|
* 远端音频轨道,调用 [subscribe]{@link IAgoraRTCClient.subscribe} 后通过 [AgoraRTCRemoteUser.audioTrack]{@link IAgoraRTCRemoteUser.audioTrack} 对象获取
|
|
2715
2772
|
*/
|
|
@@ -2749,7 +2806,7 @@ export declare interface IRemoteAudioTrack extends IRemoteTrack {
|
|
|
2749
2806
|
*
|
|
2750
2807
|
* 设置音频播放设备,比如扬声器。
|
|
2751
2808
|
*
|
|
2752
|
-
* > 该方法只支持桌面端的 Chrome 浏览器,其他浏览器调用将会抛出 `NOT_SUPPORTED` 错误。
|
|
2809
|
+
* > 该方法只支持桌面端的 Chrome 和 Edge 浏览器,其他浏览器调用将会抛出 `NOT_SUPPORTED` 错误。
|
|
2753
2810
|
* @param deviceId 设备 ID,可以通过 [[getPlaybackDevices]] 方法获取。
|
|
2754
2811
|
*/
|
|
2755
2812
|
/** @en
|
|
@@ -2758,7 +2815,7 @@ export declare interface IRemoteAudioTrack extends IRemoteTrack {
|
|
|
2758
2815
|
*
|
|
2759
2816
|
* Sets the audio playback device, for example, the speaker.
|
|
2760
2817
|
*
|
|
2761
|
-
* > This method supports Chrome on desktop devices only. Other browsers throw a `NOT_SUPPORTED` error when calling this method.
|
|
2818
|
+
* > This method supports Chrome and Edge on desktop devices only. Other browsers throw a `NOT_SUPPORTED` error when calling this method.
|
|
2762
2819
|
* @param deviceId Device ID, which can be retrieved by calling [[getPlaybackDevices]].
|
|
2763
2820
|
*/
|
|
2764
2821
|
setPlaybackDevice(deviceId: string): Promise<void>;
|
|
@@ -2963,6 +3020,15 @@ export declare interface IRemoteTrack extends ITrack {
|
|
|
2963
3020
|
* You can get create a remote video track by the [AgoraRTCRemoteUser.videoTrack]{@link IAgoraRTCRemoteUser.videoTrack} object after calling [subscribe]{@link IAgoraRTCClient.subscribe}.
|
|
2964
3021
|
*/
|
|
2965
3022
|
export declare interface IRemoteVideoTrack extends IRemoteTrack {
|
|
3023
|
+
/**
|
|
3024
|
+
* @param event 事件名称。
|
|
3025
|
+
* @param listener 详见 [video-state-changed]{@link event_video_state_changed}。
|
|
3026
|
+
*/
|
|
3027
|
+
/** @en
|
|
3028
|
+
* @param event The event name.
|
|
3029
|
+
* @param listener See [video-state-changed]{@link event_video_state_changed}.
|
|
3030
|
+
*/
|
|
3031
|
+
on(event: "video-state-changed", listener: typeof event_video_state_changed): void;
|
|
2966
3032
|
/**
|
|
2967
3033
|
* @param event 事件名称。
|
|
2968
3034
|
* @param listener 详见 [first-frame-decoded]{@link event_first_frame_decoded}。
|
|
@@ -2992,6 +3058,17 @@ export declare interface IRemoteVideoTrack extends IRemoteTrack {
|
|
|
2992
3058
|
* @param listener See [IRemoteTrack.transceiver-updated]{@link event_transceiver_updated_2}.
|
|
2993
3059
|
*/
|
|
2994
3060
|
on(event: "transceiver-updated", listener: typeof event_transceiver_updated_2): void;
|
|
3061
|
+
/**
|
|
3062
|
+
* 添加事件监听器。
|
|
3063
|
+
* @param event 事件名称。
|
|
3064
|
+
* @param listener 详见 [ILocalTrack.sei-received]{@link event_sei_received}。
|
|
3065
|
+
*/
|
|
3066
|
+
/** @en
|
|
3067
|
+
* Adds an event listener.
|
|
3068
|
+
* @param event The event name.
|
|
3069
|
+
* @param listener See [ILocalTrack.sei-received]{@link event_sei_received}.
|
|
3070
|
+
*/
|
|
3071
|
+
on(event: "sei-received", listener: typeof event_sei_received): void;
|
|
2995
3072
|
/**
|
|
2996
3073
|
* 获取远端视频轨道相关信息。
|
|
2997
3074
|
*
|
|
@@ -3241,23 +3318,24 @@ export declare class LocalAudioTrack extends LocalTrack implements ILocalAudioTr
|
|
|
3241
3318
|
readonly trackMediaType: "audio" | "video";
|
|
3242
3319
|
_encoderConfig?: AudioEncoderConfiguration;
|
|
3243
3320
|
_trackSource: AudioTrackSource | FakeTrackSource;
|
|
3244
|
-
|
|
3321
|
+
/**
|
|
3322
|
+
* @description This method is used to init WebAudio, if you're sure you don't want to use WebAudio, call _trackSource
|
|
3323
|
+
*/
|
|
3324
|
+
get _source(): AudioTrackSource;
|
|
3245
3325
|
set _source(source: AudioTrackSource | FakeTrackSource);
|
|
3246
3326
|
_enabled: boolean;
|
|
3247
3327
|
private _volume;
|
|
3248
3328
|
_useAudioElement: boolean;
|
|
3249
3329
|
_bypassWebAudio: boolean;
|
|
3250
3330
|
protected processor?: IAudioProcessor;
|
|
3251
|
-
protected _processorContext: AudioProcessorContext;
|
|
3331
|
+
protected _processorContext: AudioProcessorContext | undefined;
|
|
3252
3332
|
protected get processorContext(): AudioProcessorContext;
|
|
3253
|
-
|
|
3254
|
-
_processorDestination: AudioProcessorDestination;
|
|
3333
|
+
_processorDestination: AudioProcessorDestination | undefined;
|
|
3255
3334
|
get processorDestination(): AudioProcessorDestination;
|
|
3256
|
-
set processorDestination(des: AudioProcessorDestination);
|
|
3257
3335
|
protected _getOriginVolumeLevel: boolean;
|
|
3258
3336
|
get isPlaying(): boolean;
|
|
3259
3337
|
get __className__(): string;
|
|
3260
|
-
constructor(track: MediaStreamTrack, encoderConfig?: AudioEncoderConfiguration, trackId?: string, getOriginVolumeLevel?: boolean
|
|
3338
|
+
constructor(track: MediaStreamTrack, encoderConfig?: AudioEncoderConfiguration, trackId?: string, getOriginVolumeLevel?: boolean);
|
|
3261
3339
|
setVolume(volume: number): void;
|
|
3262
3340
|
getVolumeLevel(): number;
|
|
3263
3341
|
setPlaybackDevice(deviceId: string): Promise<void>;
|
|
@@ -3276,7 +3354,10 @@ export declare class LocalAudioTrack extends LocalTrack implements ILocalAudioTr
|
|
|
3276
3354
|
unpipe(): void;
|
|
3277
3355
|
private bindProcessorDestinationEvents;
|
|
3278
3356
|
private unbindProcessorDestinationEvents;
|
|
3279
|
-
|
|
3357
|
+
protected bindProcessorContextEvents(processorContext: AudioProcessorContext): void;
|
|
3358
|
+
protected unbindProcessorContextEvents(processorContext: AudioProcessorContext): void;
|
|
3359
|
+
private initWebAudio;
|
|
3360
|
+
private initProcessor;
|
|
3280
3361
|
}
|
|
3281
3362
|
|
|
3282
3363
|
/**
|
|
@@ -3395,9 +3476,9 @@ export declare abstract class LocalTrack extends Track implements ILocalTrack {
|
|
|
3395
3476
|
_isClosed: boolean;
|
|
3396
3477
|
protected _enabledMutex: PromiseMutex;
|
|
3397
3478
|
protected processor?: IBaseProcessor;
|
|
3398
|
-
protected abstract _processorContext: IProcessorContext;
|
|
3399
|
-
protected get processorContext(): IProcessorContext;
|
|
3400
|
-
|
|
3479
|
+
protected abstract _processorContext: IProcessorContext | undefined;
|
|
3480
|
+
protected get processorContext(): IProcessorContext | undefined;
|
|
3481
|
+
abstract processorDestination: IBaseProcessor;
|
|
3401
3482
|
constructor(track: MediaStreamTrack, trackId?: string);
|
|
3402
3483
|
abstract getStats(): LocalVideoTrackStats | LocalAudioTrackStats;
|
|
3403
3484
|
abstract setMuted(enabled: boolean): Promise<void>;
|
|
@@ -3480,6 +3561,7 @@ export declare class LocalVideoTrack extends LocalTrack implements ILocalVideoTr
|
|
|
3480
3561
|
clone(config?: VideoEncoderConfiguration | VideoEncoderConfigurationPreset, cloneTrack?: boolean): LocalVideoTrack;
|
|
3481
3562
|
replaceTrack(track: MediaStreamTrack, stopOldTrack: boolean): Promise<void>;
|
|
3482
3563
|
startMonitorStats(): void;
|
|
3564
|
+
sendSeiData(sei: Uint8Array): never;
|
|
3483
3565
|
private bindProcessorDestinationEvents;
|
|
3484
3566
|
private unbindProcessorDestinationEvents;
|
|
3485
3567
|
private unbindProcessorContextEvents;
|
|
@@ -3751,7 +3833,8 @@ export declare class MicrophoneAudioTrack extends LocalAudioTrack implements IMi
|
|
|
3751
3833
|
close(): void;
|
|
3752
3834
|
protected onTrackEnded(): void;
|
|
3753
3835
|
renewMediaStreamTrack(newConstraints?: MediaTrackConstraints): Promise<void>;
|
|
3754
|
-
|
|
3836
|
+
protected bindProcessorContextEvents(processorContext: AudioProcessorContext): void;
|
|
3837
|
+
protected unbindProcessorContextEvents(processorContext: AudioProcessorContext): void;
|
|
3755
3838
|
}
|
|
3756
3839
|
|
|
3757
3840
|
/**
|
|
@@ -4136,7 +4219,8 @@ export declare abstract class RemoteTrack extends Track implements IRemoteTrack
|
|
|
4136
4219
|
|
|
4137
4220
|
export declare enum RemoteTrackEvents {
|
|
4138
4221
|
FIRST_FRAME_DECODED = "first-frame-decoded",
|
|
4139
|
-
VIDEO_ELEMENT_VISIBLE_STATUS = "video-element-visible-status"
|
|
4222
|
+
VIDEO_ELEMENT_VISIBLE_STATUS = "video-element-visible-status",
|
|
4223
|
+
VIDEO_STATE_CHANGED = "video-state-changed"
|
|
4140
4224
|
}
|
|
4141
4225
|
|
|
4142
4226
|
export declare class RemoteVideoTrack extends RemoteTrack implements IRemoteVideoTrack {
|
|
@@ -4164,6 +4248,7 @@ export declare class RemoteVideoTrack extends RemoteTrack implements IRemoteVide
|
|
|
4164
4248
|
private bindProcessorDestinationEvents;
|
|
4165
4249
|
private unbindProcessorDestinationEvents;
|
|
4166
4250
|
_destroy(): void;
|
|
4251
|
+
_onSei(sei: Uint8Array): void;
|
|
4167
4252
|
}
|
|
4168
4253
|
|
|
4169
4254
|
/**
|
|
@@ -4820,7 +4905,9 @@ export declare abstract class Track extends EventEmitter implements ITrack {
|
|
|
4820
4905
|
}
|
|
4821
4906
|
|
|
4822
4907
|
export declare enum TrackEvents {
|
|
4823
|
-
TRANSCEIVER_UPDATED = "transceiver-updated"
|
|
4908
|
+
TRANSCEIVER_UPDATED = "transceiver-updated",
|
|
4909
|
+
SEI_TO_SEND = "sei-to-send",
|
|
4910
|
+
SEI_RECEIVED = "sei-received"
|
|
4824
4911
|
}
|
|
4825
4912
|
|
|
4826
4913
|
/**
|
|
@@ -4838,6 +4925,7 @@ export declare enum TrackHint {
|
|
|
4838
4925
|
export declare enum TrackInternalEvent {
|
|
4839
4926
|
NEED_RENEGOTIATE = "@need_renegotiate",
|
|
4840
4927
|
NEED_REPLACE_TRACK = "@need_replace_track",
|
|
4928
|
+
NEED_REPLACE_MIXING_TRACK = "@need_replace_mixing_track",
|
|
4841
4929
|
NEED_CLOSE = "@need_close",
|
|
4842
4930
|
NEED_ENABLE_TRACK = "@need_enable_track",
|
|
4843
4931
|
NEED_DISABLE_TRACK = "@need_disable_track",
|
|
@@ -5069,6 +5157,7 @@ declare class VideoPlayer {
|
|
|
5069
5157
|
trackId: string;
|
|
5070
5158
|
config: PlayerConfig;
|
|
5071
5159
|
onFirstVideoFrameDecoded?: () => void;
|
|
5160
|
+
onVideoStateChanged?: (state: VideoState) => void;
|
|
5072
5161
|
freezeTimeCounterList: number[];
|
|
5073
5162
|
renderFreezeAccTime: number;
|
|
5074
5163
|
isKeepLastFrame: boolean;
|
|
@@ -5084,7 +5173,11 @@ declare class VideoPlayer {
|
|
|
5084
5173
|
protected cacheVideoElement?: HTMLVideoElement;
|
|
5085
5174
|
get videoElementStatus(): MediaElementStatus;
|
|
5086
5175
|
set videoElementStatus(status: MediaElementStatus);
|
|
5176
|
+
get videoState(): VideoState;
|
|
5177
|
+
set videoState(state: VideoState);
|
|
5178
|
+
private _videoState;
|
|
5087
5179
|
private videoElementCheckInterval?;
|
|
5180
|
+
private videoElementFreezeTimeout?;
|
|
5088
5181
|
private _videoElementStatus;
|
|
5089
5182
|
private isGettingVideoDimensions;
|
|
5090
5183
|
constructor(config: PlayerConfig);
|
|
@@ -5197,6 +5290,36 @@ export declare class VideoProcessorDestination extends EventEmitter implements I
|
|
|
5197
5290
|
reset(): void;
|
|
5198
5291
|
}
|
|
5199
5292
|
|
|
5293
|
+
/**
|
|
5294
|
+
* 视频流状态。
|
|
5295
|
+
* @public
|
|
5296
|
+
*/
|
|
5297
|
+
/** @en
|
|
5298
|
+
* The state of the video stream.
|
|
5299
|
+
*/
|
|
5300
|
+
export declare enum VideoState {
|
|
5301
|
+
/** 0: 视频默认初始状态。 */
|
|
5302
|
+
/** @en
|
|
5303
|
+
* 0: The initial state of the video.
|
|
5304
|
+
*/
|
|
5305
|
+
VideoStateStopped = 0,
|
|
5306
|
+
/** 1: 本地用户已接收视频首包。 */
|
|
5307
|
+
/** @en
|
|
5308
|
+
* 1: The local user has received the first video packet.
|
|
5309
|
+
*/
|
|
5310
|
+
VideoStateStarting = 1,
|
|
5311
|
+
/** 2: 视频流正在解码,正常播放。 */
|
|
5312
|
+
/** @en
|
|
5313
|
+
* 2: The video stream is being decoded and played normally.
|
|
5314
|
+
*/
|
|
5315
|
+
VideoStateDecoding = 2,
|
|
5316
|
+
/** 3: 视频流卡顿。 */
|
|
5317
|
+
/** @en
|
|
5318
|
+
* 3: The video stream is frozen.
|
|
5319
|
+
*/
|
|
5320
|
+
VideoStateFrozen = 3
|
|
5321
|
+
}
|
|
5322
|
+
|
|
5200
5323
|
declare class VisibilityWatcher extends EventEmitter {
|
|
5201
5324
|
private _lastHiddenTime;
|
|
5202
5325
|
private _lastVisibleTime;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agora-js/media",
|
|
3
|
-
"version": "4.20.
|
|
3
|
+
"version": "4.20.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": "
|
|
27
|
-
"@agora-js/report": "
|
|
26
|
+
"@agora-js/shared": "4.20.1",
|
|
27
|
+
"@agora-js/report": "4.20.1",
|
|
28
28
|
"axios": "^0.27.2",
|
|
29
29
|
"agora-rte-extension": "^1.2.4",
|
|
30
30
|
"webrtc-adapter": "8.2.0",
|
package/rtc-sdk-media_en.d.ts
CHANGED
|
@@ -896,6 +896,18 @@ declare function event_beauty_effect_overload(): void;
|
|
|
896
896
|
*/
|
|
897
897
|
declare function event_first_frame_decoded(): void;
|
|
898
898
|
|
|
899
|
+
/**
|
|
900
|
+
* **Since**
|
|
901
|
+
* <br>   *4.20.1*
|
|
902
|
+
*
|
|
903
|
+
* Parsing SEI data from the H.264 video stream triggers this event, which returns the SEI data.
|
|
904
|
+
*
|
|
905
|
+
* @param sei SEI data in Uint8Array
|
|
906
|
+
* @asMemberOf ILocalVideoTrack
|
|
907
|
+
* @event
|
|
908
|
+
*/
|
|
909
|
+
declare function event_sei_received(sei: Uint8Array): void;
|
|
910
|
+
|
|
899
911
|
/**
|
|
900
912
|
* Occurs when the state of processing the audio buffer in [BufferSourceAudioTrack]{@link IBufferSourceAudioTrack} changes.
|
|
901
913
|
*
|
|
@@ -999,6 +1011,14 @@ declare function event_video_element_visible_status(data?: CheckVideoVisibleResu
|
|
|
999
1011
|
*/
|
|
1000
1012
|
declare function event_video_element_visible_status_2(data?: CheckVideoVisibleResult): void;
|
|
1001
1013
|
|
|
1014
|
+
/**
|
|
1015
|
+
* Occurs when the video state changes.
|
|
1016
|
+
*
|
|
1017
|
+
* @event
|
|
1018
|
+
* @asMemberOf IRemoteTrack
|
|
1019
|
+
*/
|
|
1020
|
+
declare function event_video_state_changed(videoState: VideoState): void;
|
|
1021
|
+
|
|
1002
1022
|
export declare interface ExtendedVideoFrameCallbackMetadata extends VideoFrameCallbackMetadata {
|
|
1003
1023
|
timestamp: DOMHighResTimeStamp;
|
|
1004
1024
|
}
|
|
@@ -1042,7 +1062,7 @@ export declare function getAudioContext(): AudioContext;
|
|
|
1042
1062
|
|
|
1043
1063
|
export declare function getAudioEncoderConfiguration(profile: AudioEncoderConfigurationPreset | AudioEncoderConfiguration): AudioEncoderConfiguration;
|
|
1044
1064
|
|
|
1045
|
-
export declare function
|
|
1065
|
+
export declare function getBitrateConstrainRange(width: number, height: number, frameRate: number, bitrateMin?: number, bitrateMax?: number): DoubleRange;
|
|
1046
1066
|
|
|
1047
1067
|
export declare function getCompatibility(): AgoraRTCCompatibility;
|
|
1048
1068
|
|
|
@@ -1317,7 +1337,6 @@ export declare interface ILocalAudioTrack extends ILocalTrack {
|
|
|
1317
1337
|
*
|
|
1318
1338
|
* > Note:
|
|
1319
1339
|
* > - As of v4.7.0, this method no longer takes effect. Use [IRemoteAudioTrack.setPlaybackDevice]{@link IRemoteAudioTrack.setPlaybackDevice} instead.
|
|
1320
|
-
* > - This method supports Chrome on desktop devices only. Other browsers throw a '`NOT_SUPPORTED` error when calling this method.
|
|
1321
1340
|
*
|
|
1322
1341
|
* Sets the playback device (speaker) for the remote audio stream.
|
|
1323
1342
|
*
|
|
@@ -1424,7 +1443,7 @@ export declare interface ILocalTrack extends ITrack {
|
|
|
1424
1443
|
*
|
|
1425
1444
|
* 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.
|
|
1426
1445
|
*
|
|
1427
|
-
* > - 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/
|
|
1446
|
+
* > - 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).
|
|
1428
1447
|
* > - Do not call `setEnabled` and `setMuted` together.
|
|
1429
1448
|
*
|
|
1430
1449
|
* @param muted Whether to stop sending the media data of the track:
|
|
@@ -1469,7 +1488,7 @@ export declare interface ILocalVideoTrack extends ILocalTrack {
|
|
|
1469
1488
|
*/
|
|
1470
1489
|
on(event: "transceiver-updated", listener: typeof event_transceiver_updated): void;
|
|
1471
1490
|
/**
|
|
1472
|
-
* Plays a
|
|
1491
|
+
* Plays a remote video track on the web page.
|
|
1473
1492
|
*
|
|
1474
1493
|
* @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:
|
|
1475
1494
|
* - `string`: Specify the ID of the DOM element.
|
|
@@ -1636,6 +1655,12 @@ export declare interface ILocalVideoTrack extends ILocalTrack {
|
|
|
1636
1655
|
* @param config The video encoder configurations. You can pass either [[VideoEncoderConfigurationPreset]] or a customized [[VideoEncoderConfiguration]] object.
|
|
1637
1656
|
*/
|
|
1638
1657
|
setEncoderConfiguration(config: VideoEncoderConfiguration | VideoEncoderConfigurationPreset): Promise<void>;
|
|
1658
|
+
/**
|
|
1659
|
+
* Add the SEI data to the H.264 video stream.
|
|
1660
|
+
*
|
|
1661
|
+
* @param config SEI data.
|
|
1662
|
+
*/
|
|
1663
|
+
sendSeiData(sei: Uint8Array): void;
|
|
1639
1664
|
}
|
|
1640
1665
|
|
|
1641
1666
|
export declare interface ImageTypedData {
|
|
@@ -1677,6 +1702,18 @@ export declare interface IMicrophoneAudioTrack extends ILocalAudioTrack {
|
|
|
1677
1702
|
setEnabled(enabled: boolean): Promise<void>;
|
|
1678
1703
|
}
|
|
1679
1704
|
|
|
1705
|
+
export declare function interceptLocalAudioFrame(sender: RTCRtpSender): Promise<void>;
|
|
1706
|
+
|
|
1707
|
+
export declare function interceptLocalVideoFrame(sender: RTCRtpSender, localVideoTrack: LocalVideoTrack): Promise<void>;
|
|
1708
|
+
|
|
1709
|
+
export declare function interceptRemoteAudioFrame(receiver: RTCRtpReceiver): Promise<void>;
|
|
1710
|
+
|
|
1711
|
+
export declare function interceptRemoteVideoFrame(receiver: RTCRtpReceiver, options?: InterceptVideoFrameOptions): Promise<void>;
|
|
1712
|
+
|
|
1713
|
+
declare interface InterceptVideoFrameOptions {
|
|
1714
|
+
onSei?: (sei: Uint8Array) => void;
|
|
1715
|
+
}
|
|
1716
|
+
|
|
1680
1717
|
/**
|
|
1681
1718
|
* `RemoteAudioTrack` is the basic interface for the remote audio track.
|
|
1682
1719
|
*
|
|
@@ -1701,7 +1738,7 @@ export declare interface IRemoteAudioTrack extends IRemoteTrack {
|
|
|
1701
1738
|
*
|
|
1702
1739
|
* Sets the audio playback device, for example, the speaker.
|
|
1703
1740
|
*
|
|
1704
|
-
* > This method supports Chrome on desktop devices only. Other browsers throw a `NOT_SUPPORTED` error when calling this method.
|
|
1741
|
+
* > This method supports Chrome and Edge on desktop devices only. Other browsers throw a `NOT_SUPPORTED` error when calling this method.
|
|
1705
1742
|
* @param deviceId Device ID, which can be retrieved by calling [[getPlaybackDevices]].
|
|
1706
1743
|
*/
|
|
1707
1744
|
setPlaybackDevice(deviceId: string): Promise<void>;
|
|
@@ -1820,6 +1857,11 @@ export declare interface IRemoteTrack extends ITrack {
|
|
|
1820
1857
|
* You can get create a remote video track by the [AgoraRTCRemoteUser.videoTrack]{@link IAgoraRTCRemoteUser.videoTrack} object after calling [subscribe]{@link IAgoraRTCClient.subscribe}.
|
|
1821
1858
|
*/
|
|
1822
1859
|
export declare interface IRemoteVideoTrack extends IRemoteTrack {
|
|
1860
|
+
/**
|
|
1861
|
+
* @param event The event name.
|
|
1862
|
+
* @param listener See [video-state-changed]{@link event_video_state_changed}.
|
|
1863
|
+
*/
|
|
1864
|
+
on(event: "video-state-changed", listener: typeof event_video_state_changed): void;
|
|
1823
1865
|
/**
|
|
1824
1866
|
* @param event The event name.
|
|
1825
1867
|
* @param listener See [first-frame-decoded]{@link event_first_frame_decoded}.
|
|
@@ -1836,6 +1878,12 @@ export declare interface IRemoteVideoTrack extends IRemoteTrack {
|
|
|
1836
1878
|
* @param listener See [IRemoteTrack.transceiver-updated]{@link event_transceiver_updated_2}.
|
|
1837
1879
|
*/
|
|
1838
1880
|
on(event: "transceiver-updated", listener: typeof event_transceiver_updated_2): void;
|
|
1881
|
+
/**
|
|
1882
|
+
* Adds an event listener.
|
|
1883
|
+
* @param event The event name.
|
|
1884
|
+
* @param listener See [ILocalTrack.sei-received]{@link event_sei_received}.
|
|
1885
|
+
*/
|
|
1886
|
+
on(event: "sei-received", listener: typeof event_sei_received): void;
|
|
1839
1887
|
/**
|
|
1840
1888
|
* Gets the statistics of a remote video track.
|
|
1841
1889
|
*
|
|
@@ -1975,23 +2023,21 @@ export declare class LocalAudioTrack extends LocalTrack implements ILocalAudioTr
|
|
|
1975
2023
|
readonly trackMediaType: "audio" | "video";
|
|
1976
2024
|
_encoderConfig?: AudioEncoderConfiguration;
|
|
1977
2025
|
_trackSource: AudioTrackSource | FakeTrackSource;
|
|
1978
|
-
get _source(): AudioTrackSource
|
|
2026
|
+
get _source(): AudioTrackSource;
|
|
1979
2027
|
set _source(source: AudioTrackSource | FakeTrackSource);
|
|
1980
2028
|
_enabled: boolean;
|
|
1981
2029
|
private _volume;
|
|
1982
2030
|
_useAudioElement: boolean;
|
|
1983
2031
|
_bypassWebAudio: boolean;
|
|
1984
2032
|
protected processor?: IAudioProcessor;
|
|
1985
|
-
protected _processorContext: AudioProcessorContext;
|
|
2033
|
+
protected _processorContext: AudioProcessorContext | undefined;
|
|
1986
2034
|
protected get processorContext(): AudioProcessorContext;
|
|
1987
|
-
|
|
1988
|
-
_processorDestination: AudioProcessorDestination;
|
|
2035
|
+
_processorDestination: AudioProcessorDestination | undefined;
|
|
1989
2036
|
get processorDestination(): AudioProcessorDestination;
|
|
1990
|
-
set processorDestination(des: AudioProcessorDestination);
|
|
1991
2037
|
protected _getOriginVolumeLevel: boolean;
|
|
1992
2038
|
get isPlaying(): boolean;
|
|
1993
2039
|
get __className__(): string;
|
|
1994
|
-
constructor(track: MediaStreamTrack, encoderConfig?: AudioEncoderConfiguration, trackId?: string, getOriginVolumeLevel?: boolean
|
|
2040
|
+
constructor(track: MediaStreamTrack, encoderConfig?: AudioEncoderConfiguration, trackId?: string, getOriginVolumeLevel?: boolean);
|
|
1995
2041
|
setVolume(volume: number): void;
|
|
1996
2042
|
getVolumeLevel(): number;
|
|
1997
2043
|
setPlaybackDevice(deviceId: string): Promise<void>;
|
|
@@ -2010,7 +2056,10 @@ export declare class LocalAudioTrack extends LocalTrack implements ILocalAudioTr
|
|
|
2010
2056
|
unpipe(): void;
|
|
2011
2057
|
private bindProcessorDestinationEvents;
|
|
2012
2058
|
private unbindProcessorDestinationEvents;
|
|
2013
|
-
|
|
2059
|
+
protected bindProcessorContextEvents(processorContext: AudioProcessorContext): void;
|
|
2060
|
+
protected unbindProcessorContextEvents(processorContext: AudioProcessorContext): void;
|
|
2061
|
+
private initWebAudio;
|
|
2062
|
+
private initProcessor;
|
|
2014
2063
|
}
|
|
2015
2064
|
|
|
2016
2065
|
/**
|
|
@@ -2083,9 +2132,9 @@ export declare abstract class LocalTrack extends Track implements ILocalTrack {
|
|
|
2083
2132
|
_isClosed: boolean;
|
|
2084
2133
|
protected _enabledMutex: PromiseMutex;
|
|
2085
2134
|
protected processor?: IBaseProcessor;
|
|
2086
|
-
protected abstract _processorContext: IProcessorContext;
|
|
2087
|
-
protected get processorContext(): IProcessorContext;
|
|
2088
|
-
|
|
2135
|
+
protected abstract _processorContext: IProcessorContext | undefined;
|
|
2136
|
+
protected get processorContext(): IProcessorContext | undefined;
|
|
2137
|
+
abstract processorDestination: IBaseProcessor;
|
|
2089
2138
|
constructor(track: MediaStreamTrack, trackId?: string);
|
|
2090
2139
|
abstract getStats(): LocalVideoTrackStats | LocalAudioTrackStats;
|
|
2091
2140
|
abstract setMuted(enabled: boolean): Promise<void>;
|
|
@@ -2164,6 +2213,7 @@ export declare class LocalVideoTrack extends LocalTrack implements ILocalVideoTr
|
|
|
2164
2213
|
clone(config?: VideoEncoderConfiguration | VideoEncoderConfigurationPreset, cloneTrack?: boolean): LocalVideoTrack;
|
|
2165
2214
|
replaceTrack(track: MediaStreamTrack, stopOldTrack: boolean): Promise<void>;
|
|
2166
2215
|
startMonitorStats(): void;
|
|
2216
|
+
sendSeiData(sei: Uint8Array): never;
|
|
2167
2217
|
private bindProcessorDestinationEvents;
|
|
2168
2218
|
private unbindProcessorDestinationEvents;
|
|
2169
2219
|
private unbindProcessorContextEvents;
|
|
@@ -2334,7 +2384,8 @@ export declare class MicrophoneAudioTrack extends LocalAudioTrack implements IMi
|
|
|
2334
2384
|
close(): void;
|
|
2335
2385
|
protected onTrackEnded(): void;
|
|
2336
2386
|
renewMediaStreamTrack(newConstraints?: MediaTrackConstraints): Promise<void>;
|
|
2337
|
-
|
|
2387
|
+
protected bindProcessorContextEvents(processorContext: AudioProcessorContext): void;
|
|
2388
|
+
protected unbindProcessorContextEvents(processorContext: AudioProcessorContext): void;
|
|
2338
2389
|
}
|
|
2339
2390
|
|
|
2340
2391
|
/**
|
|
@@ -2593,7 +2644,8 @@ export declare abstract class RemoteTrack extends Track implements IRemoteTrack
|
|
|
2593
2644
|
|
|
2594
2645
|
export declare enum RemoteTrackEvents {
|
|
2595
2646
|
FIRST_FRAME_DECODED = "first-frame-decoded",
|
|
2596
|
-
VIDEO_ELEMENT_VISIBLE_STATUS = "video-element-visible-status"
|
|
2647
|
+
VIDEO_ELEMENT_VISIBLE_STATUS = "video-element-visible-status",
|
|
2648
|
+
VIDEO_STATE_CHANGED = "video-state-changed"
|
|
2597
2649
|
}
|
|
2598
2650
|
|
|
2599
2651
|
export declare class RemoteVideoTrack extends RemoteTrack implements IRemoteVideoTrack {
|
|
@@ -2621,6 +2673,7 @@ export declare class RemoteVideoTrack extends RemoteTrack implements IRemoteVide
|
|
|
2621
2673
|
private bindProcessorDestinationEvents;
|
|
2622
2674
|
private unbindProcessorDestinationEvents;
|
|
2623
2675
|
_destroy(): void;
|
|
2676
|
+
_onSei(sei: Uint8Array): void;
|
|
2624
2677
|
}
|
|
2625
2678
|
|
|
2626
2679
|
/**
|
|
@@ -2998,7 +3051,9 @@ export declare abstract class Track extends EventEmitter implements ITrack {
|
|
|
2998
3051
|
}
|
|
2999
3052
|
|
|
3000
3053
|
export declare enum TrackEvents {
|
|
3001
|
-
TRANSCEIVER_UPDATED = "transceiver-updated"
|
|
3054
|
+
TRANSCEIVER_UPDATED = "transceiver-updated",
|
|
3055
|
+
SEI_TO_SEND = "sei-to-send",
|
|
3056
|
+
SEI_RECEIVED = "sei-received"
|
|
3002
3057
|
}
|
|
3003
3058
|
|
|
3004
3059
|
export declare enum TrackHint {
|
|
@@ -3010,6 +3065,7 @@ export declare enum TrackHint {
|
|
|
3010
3065
|
export declare enum TrackInternalEvent {
|
|
3011
3066
|
NEED_RENEGOTIATE = "@need_renegotiate",
|
|
3012
3067
|
NEED_REPLACE_TRACK = "@need_replace_track",
|
|
3068
|
+
NEED_REPLACE_MIXING_TRACK = "@need_replace_mixing_track",
|
|
3013
3069
|
NEED_CLOSE = "@need_close",
|
|
3014
3070
|
NEED_ENABLE_TRACK = "@need_enable_track",
|
|
3015
3071
|
NEED_DISABLE_TRACK = "@need_disable_track",
|
|
@@ -3141,6 +3197,7 @@ declare class VideoPlayer {
|
|
|
3141
3197
|
trackId: string;
|
|
3142
3198
|
config: PlayerConfig;
|
|
3143
3199
|
onFirstVideoFrameDecoded?: () => void;
|
|
3200
|
+
onVideoStateChanged?: (state: VideoState) => void;
|
|
3144
3201
|
freezeTimeCounterList: number[];
|
|
3145
3202
|
renderFreezeAccTime: number;
|
|
3146
3203
|
isKeepLastFrame: boolean;
|
|
@@ -3154,7 +3211,11 @@ declare class VideoPlayer {
|
|
|
3154
3211
|
protected cacheVideoElement?: HTMLVideoElement;
|
|
3155
3212
|
get videoElementStatus(): MediaElementStatus;
|
|
3156
3213
|
set videoElementStatus(status: MediaElementStatus);
|
|
3214
|
+
get videoState(): VideoState;
|
|
3215
|
+
set videoState(state: VideoState);
|
|
3216
|
+
private _videoState;
|
|
3157
3217
|
private videoElementCheckInterval?;
|
|
3218
|
+
private videoElementFreezeTimeout?;
|
|
3158
3219
|
private _videoElementStatus;
|
|
3159
3220
|
private isGettingVideoDimensions;
|
|
3160
3221
|
constructor(config: PlayerConfig);
|
|
@@ -3245,6 +3306,28 @@ export declare class VideoProcessorDestination extends EventEmitter implements I
|
|
|
3245
3306
|
reset(): void;
|
|
3246
3307
|
}
|
|
3247
3308
|
|
|
3309
|
+
/**
|
|
3310
|
+
* The state of the video stream.
|
|
3311
|
+
*/
|
|
3312
|
+
export declare enum VideoState {
|
|
3313
|
+
/**
|
|
3314
|
+
* 0: The initial state of the video.
|
|
3315
|
+
*/
|
|
3316
|
+
VideoStateStopped = 0,
|
|
3317
|
+
/**
|
|
3318
|
+
* 1: The local user has received the first video packet.
|
|
3319
|
+
*/
|
|
3320
|
+
VideoStateStarting = 1,
|
|
3321
|
+
/**
|
|
3322
|
+
* 2: The video stream is being decoded and played normally.
|
|
3323
|
+
*/
|
|
3324
|
+
VideoStateDecoding = 2,
|
|
3325
|
+
/**
|
|
3326
|
+
* 3: The video stream is frozen.
|
|
3327
|
+
*/
|
|
3328
|
+
VideoStateFrozen = 3
|
|
3329
|
+
}
|
|
3330
|
+
|
|
3248
3331
|
declare class VisibilityWatcher extends EventEmitter {
|
|
3249
3332
|
private _lastHiddenTime;
|
|
3250
3333
|
private _lastVisibleTime;
|