@agora-js/media 4.20.2 → 4.21.0-200
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 -3
- package/media.d.ts +229 -114
- package/package.json +5 -5
- package/rtc-sdk-media_en.d.ts +138 -65
package/media.d.ts
CHANGED
|
@@ -56,6 +56,10 @@ export declare interface AgoraRTCCompatibility {
|
|
|
56
56
|
supportWebRTCEncodedTransform: boolean;
|
|
57
57
|
/** 是否支持WebRTC Insertable Stream */
|
|
58
58
|
supportWebRTCInsertableStream: boolean;
|
|
59
|
+
/** 是否支持requestVideoFrameCallback, 用于计算卡顿率 */
|
|
60
|
+
supportRequestVideoFrameCallback: boolean;
|
|
61
|
+
/** 是否支持WebCrypto */
|
|
62
|
+
supportWebCrypto: boolean;
|
|
59
63
|
}
|
|
60
64
|
|
|
61
65
|
/**
|
|
@@ -331,7 +335,7 @@ export declare interface AudioEncoderConfiguration {
|
|
|
331
335
|
* | -------- | --------------- |
|
|
332
336
|
* |`"speech_low_quality"`|16 kHz 采样率,单声道,编码码率约 24 Kbps|
|
|
333
337
|
* |`"speech_standard"`|32 kHz 采样率,单声道,编码码率约 24 Kbps|
|
|
334
|
-
* |`"music_standard"`|48 kHz 采样率,单声道,编码码率约
|
|
338
|
+
* |`"music_standard"`|48 kHz 采样率,单声道,编码码率约 32 Kbps|
|
|
335
339
|
* |`"standard_stereo"`|48 kHz 采样率,双声道,编码码率约 64 Kbps|
|
|
336
340
|
* |`"high_quality"`|48 kHz 采样率,单声道, 编码码率约 128 Kbps|
|
|
337
341
|
* |`"high_quality_stereo"`|48 kHz 采样率,双声道,编码码率约 192 Kbps|
|
|
@@ -349,16 +353,20 @@ export declare interface AudioEncoderConfiguration {
|
|
|
349
353
|
*
|
|
350
354
|
* | Audio Profile | Configurations |
|
|
351
355
|
* | -------- | --------------- |
|
|
352
|
-
* |`"speech_low_quality"`|Sample rate 16 kHz, mono, encoding
|
|
353
|
-
* |`"speech_standard"`|Sample rate 32 kHz, mono, encoding
|
|
354
|
-
* |`"music_standard"`|Sample rate 48 kHz, mono, encoding
|
|
355
|
-
* |`"standard_stereo"`|Sample rate 48 kHz, stereo, encoding
|
|
356
|
-
* |`"high_quality"`|Sample rate 48 kHz, mono, encoding
|
|
357
|
-
* |`"high_quality_stereo"`|Sample rate 48 kHz, stereo, encoding
|
|
356
|
+
* |`"speech_low_quality"`|Sample rate 16 kHz, mono, encoding bitrate 24 Kbps|
|
|
357
|
+
* |`"speech_standard"`|Sample rate 32 kHz, mono, encoding bitrate 24 Kbps|
|
|
358
|
+
* |`"music_standard"`|Sample rate 48 kHz, mono, encoding bitrate 32 Kbps|
|
|
359
|
+
* |`"standard_stereo"`|Sample rate 48 kHz, stereo, encoding bitrate 64 Kbps|
|
|
360
|
+
* |`"high_quality"`|Sample rate 48 kHz, mono, encoding bitrate 128 Kbps|
|
|
361
|
+
* |`"high_quality_stereo"`|Sample rate 48 kHz, stereo, encoding bitrate 192 Kbps| Kbps.
|
|
358
362
|
* @public
|
|
359
363
|
*/
|
|
360
364
|
export declare type AudioEncoderConfigurationPreset = keyof typeof AUDIO_ENCODER_CONFIG_SETTINGS;
|
|
361
365
|
|
|
366
|
+
export declare interface AudioMetadata {
|
|
367
|
+
value: Uint8Array;
|
|
368
|
+
}
|
|
369
|
+
|
|
362
370
|
export declare interface AudioPlaybackOptions {
|
|
363
371
|
/**
|
|
364
372
|
* 控制人声是否要被播放,默认为 `true`
|
|
@@ -730,7 +738,7 @@ export declare class CameraVideoTrack extends LocalVideoTrack implements ICamera
|
|
|
730
738
|
_enabled: boolean;
|
|
731
739
|
_deviceName: string;
|
|
732
740
|
get __className__(): string;
|
|
733
|
-
constructor(track: MediaStreamTrack, config: CameraVideoTrackInitConfig, constraints: MediaTrackConstraints, scalabilityConfig?: SVCConfiguration, optimizationMode?:
|
|
741
|
+
constructor(track: MediaStreamTrack, config: CameraVideoTrackInitConfig, constraints: MediaTrackConstraints, scalabilityConfig?: SVCConfiguration, optimizationMode?: OptimizationMode | "balanced", trackId?: string);
|
|
734
742
|
setDevice(deviceId: string | RequiredOnlyOneOf<{
|
|
735
743
|
facingMode: VideoFacingModeEnum;
|
|
736
744
|
deviceId: string;
|
|
@@ -832,7 +840,7 @@ export declare interface CameraVideoTrackInitConfig {
|
|
|
832
840
|
*
|
|
833
841
|
* > Note: This method is only supported on Chrome.
|
|
834
842
|
*/
|
|
835
|
-
optimizationMode?:
|
|
843
|
+
optimizationMode?: OptimizationMode;
|
|
836
844
|
/**
|
|
837
845
|
* @ignore
|
|
838
846
|
* @自从
|
|
@@ -1200,6 +1208,13 @@ export declare interface DenoiserStats {
|
|
|
1200
1208
|
vl: number;
|
|
1201
1209
|
}
|
|
1202
1210
|
|
|
1211
|
+
/**
|
|
1212
|
+
* 是否支持Audio标签 setSinkId
|
|
1213
|
+
* Firefox 116 以上也支持此接口,但是会出现回声问题
|
|
1214
|
+
* 仅支持PC 端 Chrome / Edge,且不支持移动端
|
|
1215
|
+
*/
|
|
1216
|
+
export declare function detectSupportAudioElementSetSinkId(): boolean;
|
|
1217
|
+
|
|
1203
1218
|
/**
|
|
1204
1219
|
* 音视频采集设备的信息。
|
|
1205
1220
|
*
|
|
@@ -1430,6 +1445,18 @@ declare function event_source_state_change(currentState: AudioSourceState): void
|
|
|
1430
1445
|
*/
|
|
1431
1446
|
declare function event_track_ended(): void;
|
|
1432
1447
|
|
|
1448
|
+
/**
|
|
1449
|
+
* 媒体轨道有更新时触发。
|
|
1450
|
+
* @param track 媒体轨道。详见 [MediaStreamTrack](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack)。
|
|
1451
|
+
* @event
|
|
1452
|
+
*/
|
|
1453
|
+
/** @en
|
|
1454
|
+
* Triggers when a media track is updated.
|
|
1455
|
+
* @param track The media stream track. See [MediaStreamTrack](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack).
|
|
1456
|
+
* @event
|
|
1457
|
+
*/
|
|
1458
|
+
export declare function event_track_updated(track: MediaStreamTrack): void;
|
|
1459
|
+
|
|
1433
1460
|
/**
|
|
1434
1461
|
* 当前轨道的 `RTCRtpTransceiver` 实例更新回调。
|
|
1435
1462
|
*
|
|
@@ -1614,6 +1641,14 @@ export declare function getAudioEncoderConfiguration(profile: AudioEncoderConfig
|
|
|
1614
1641
|
|
|
1615
1642
|
export declare function getBitrateConstrainRange(width: number, height: number, frameRate: number, bitrateMin?: number, bitrateMax?: number): DoubleRange;
|
|
1616
1643
|
|
|
1644
|
+
/**
|
|
1645
|
+
* get bitrate, use STANDARD_BITRATE to make sure the response
|
|
1646
|
+
* @param width
|
|
1647
|
+
* @param height
|
|
1648
|
+
* @param fps
|
|
1649
|
+
*/
|
|
1650
|
+
export declare function getBitrateFromResAndFps(width: number, height: number, fps: number): Required<DoubleRange>;
|
|
1651
|
+
|
|
1617
1652
|
export declare function getCompatibility(): AgoraRTCCompatibility;
|
|
1618
1653
|
|
|
1619
1654
|
export declare function getConstraintsFromCameraConfig(config: CameraVideoTrackInitConfig): MediaTrackConstraints;
|
|
@@ -1630,6 +1665,22 @@ export declare function getElectronScreenStreamByUserSelect(config: ScreenConstr
|
|
|
1630
1665
|
|
|
1631
1666
|
export declare function getLocalStream(config: GetUserMediaConfig, id: string): Promise<MediaStream>;
|
|
1632
1667
|
|
|
1668
|
+
/**
|
|
1669
|
+
* 获取初始配置
|
|
1670
|
+
* 分辨率:track.getMediaStreamTrackSettings > 客户设置
|
|
1671
|
+
* 帧率: track.getMediaStreamTrackSettings > 客户设置
|
|
1672
|
+
* 码率: 客户设置 > 根据分辨率计算
|
|
1673
|
+
*
|
|
1674
|
+
* ⚠️:理论上不存在没有分辨率的情况,如果出现不足任何处理
|
|
1675
|
+
*/
|
|
1676
|
+
export declare const getOriginSenderConfig: (track: LocalVideoTrack) => {
|
|
1677
|
+
frameRate: number;
|
|
1678
|
+
bitrateMax: number;
|
|
1679
|
+
bitrateMin: number;
|
|
1680
|
+
scaleResolutionDownBy: number;
|
|
1681
|
+
scale: number;
|
|
1682
|
+
};
|
|
1683
|
+
|
|
1633
1684
|
export declare function getScalabilityConfiguration(profile: SVCConfiguration | SVCConfigurationPreset): SVCConfiguration;
|
|
1634
1685
|
|
|
1635
1686
|
export declare function getScreenEncoderConfiguration(profile: VideoEncoderConfiguration | ScreenEncoderConfigurationPreset | string): VideoEncoderConfiguration;
|
|
@@ -2166,6 +2217,15 @@ export declare interface ILocalDataChannel extends IDataChannel {
|
|
|
2166
2217
|
* `LocalTrack` is the basic interface for local tracks, providing public methods for [LocalAudioTrack]{@link ILocalAudioTrack} and [LocalVideoTrack]{@link ILocalVideoTrack}.
|
|
2167
2218
|
*/
|
|
2168
2219
|
export declare interface ILocalTrack extends ITrack {
|
|
2220
|
+
/**
|
|
2221
|
+
* @param event 事件名称。
|
|
2222
|
+
* @param listener 详见 [track-updated]{@link event_track_updated}。
|
|
2223
|
+
*/
|
|
2224
|
+
/** @en
|
|
2225
|
+
* @param event The event name.
|
|
2226
|
+
* @param listener See [track-updated]{@link event_track_updated}.
|
|
2227
|
+
*/
|
|
2228
|
+
on(event: "track-updated", listener: typeof event_track_updated): void;
|
|
2169
2229
|
/**
|
|
2170
2230
|
* @param event 事件名称。
|
|
2171
2231
|
* @param listener 详见 [track-ended]{@link event_track_ended}。
|
|
@@ -2319,6 +2379,15 @@ export declare interface ILocalTrack extends ITrack {
|
|
|
2319
2379
|
* Inherited from `LocalVideoTrack`, [CameraVideoTrack]{@link ICameraVideoTrack} is an interface for the video captured by a local camera and adds several camera-related functions.
|
|
2320
2380
|
*/
|
|
2321
2381
|
export declare interface ILocalVideoTrack extends ILocalTrack {
|
|
2382
|
+
/**
|
|
2383
|
+
* @param event 事件名称。
|
|
2384
|
+
* @param listener 详见 [track-updated]{@link event_track_updated}。
|
|
2385
|
+
*/
|
|
2386
|
+
/** @en
|
|
2387
|
+
* @param event The event name.
|
|
2388
|
+
* @param listener See [track-updated]{@link event_track_updated}.
|
|
2389
|
+
*/
|
|
2390
|
+
on(event: "track-updated", listener: typeof event_track_updated): void;
|
|
2322
2391
|
/** @internal */
|
|
2323
2392
|
on(event: "beauty-effect-overload", listener: typeof event_beauty_effect_overload): void;
|
|
2324
2393
|
/**
|
|
@@ -2755,11 +2824,21 @@ export declare interface IMicrophoneAudioTrack extends ILocalAudioTrack {
|
|
|
2755
2824
|
setEnabled(enabled: boolean): Promise<void>;
|
|
2756
2825
|
}
|
|
2757
2826
|
|
|
2758
|
-
|
|
2827
|
+
declare interface InterceptAudioFrameOptions {
|
|
2828
|
+
enableTopn?: boolean;
|
|
2829
|
+
enableMetadata?: boolean;
|
|
2830
|
+
onMetadata?: (metadata: Uint8Array) => void;
|
|
2831
|
+
}
|
|
2832
|
+
|
|
2833
|
+
declare interface InterceptAudioFrameOptions_2 {
|
|
2834
|
+
metadata?: () => Uint8Array | undefined;
|
|
2835
|
+
}
|
|
2836
|
+
|
|
2837
|
+
export declare function interceptLocalAudioFrame(sender: RTCRtpSender, options?: InterceptAudioFrameOptions_2): Promise<void>;
|
|
2759
2838
|
|
|
2760
2839
|
export declare function interceptLocalVideoFrame(sender: RTCRtpSender, localVideoTrack: LocalVideoTrack): Promise<void>;
|
|
2761
2840
|
|
|
2762
|
-
export declare function interceptRemoteAudioFrame(receiver: RTCRtpReceiver): Promise<void>;
|
|
2841
|
+
export declare function interceptRemoteAudioFrame(receiver: RTCRtpReceiver, options?: InterceptAudioFrameOptions): Promise<void>;
|
|
2763
2842
|
|
|
2764
2843
|
export declare function interceptRemoteVideoFrame(receiver: RTCRtpReceiver, options?: InterceptVideoFrameOptions): Promise<void>;
|
|
2765
2844
|
|
|
@@ -2806,7 +2885,7 @@ export declare interface IRemoteAudioTrack extends IRemoteTrack {
|
|
|
2806
2885
|
*
|
|
2807
2886
|
* 设置音频播放设备,比如扬声器。
|
|
2808
2887
|
*
|
|
2809
|
-
* > 该方法只支持桌面端的 Chrome 和 Edge
|
|
2888
|
+
* > 该方法只支持桌面端的 Chrome 和 Edge 浏览器。如果在其他浏览器上需要先设置`RESTRICTION_SET_PLAYBACK_DEVICE`为`false`,直接调用将会抛出 `NOT_SUPPORTED` 错误。
|
|
2810
2889
|
* @param deviceId 设备 ID,可以通过 [[getPlaybackDevices]] 方法获取。
|
|
2811
2890
|
*/
|
|
2812
2891
|
/** @en
|
|
@@ -2815,7 +2894,7 @@ export declare interface IRemoteAudioTrack extends IRemoteTrack {
|
|
|
2815
2894
|
*
|
|
2816
2895
|
* Sets the audio playback device, for example, the speaker.
|
|
2817
2896
|
*
|
|
2818
|
-
* > This method
|
|
2897
|
+
* > > This method is only supported on desktop Chrome and Edge browsers. If you call it on other browsers, you need to set `RESTRICTION_SET_PLAYBACK_DEVICE` to `false` first, and calling it directly will throw a `NOT_SUPPORTED` error.
|
|
2819
2898
|
* @param deviceId Device ID, which can be retrieved by calling [[getPlaybackDevices]].
|
|
2820
2899
|
*/
|
|
2821
2900
|
setPlaybackDevice(deviceId: string): Promise<void>;
|
|
@@ -2961,6 +3040,15 @@ export declare interface IRemoteDataChannel extends IDataChannel {
|
|
|
2961
3040
|
* `RemoteTrack` is the basic interface for remote tracks, providing public methods for [RemoteAudioTrack]{@link IRemoteAudioTrack} and [RemoteVideoTrack]{@link IRemoteVideoTrack}.
|
|
2962
3041
|
*/
|
|
2963
3042
|
export declare interface IRemoteTrack extends ITrack {
|
|
3043
|
+
/**
|
|
3044
|
+
* @param event 事件名称。
|
|
3045
|
+
* @param listener 详见 [track-updated]{@link event_track_updated}。
|
|
3046
|
+
*/
|
|
3047
|
+
/** @en
|
|
3048
|
+
* @param event The event name.
|
|
3049
|
+
* @param listener See [track-updated]{@link event_track_updated}.
|
|
3050
|
+
*/
|
|
3051
|
+
on(event: "track-updated", listener: typeof event_track_updated): void;
|
|
2964
3052
|
/**
|
|
2965
3053
|
* @param event 事件名称。
|
|
2966
3054
|
* @param listener 详见 [first-frame-decoded]{@link event_first_frame_decoded}。
|
|
@@ -3020,6 +3108,15 @@ export declare interface IRemoteTrack extends ITrack {
|
|
|
3020
3108
|
* You can get create a remote video track by the [AgoraRTCRemoteUser.videoTrack]{@link IAgoraRTCRemoteUser.videoTrack} object after calling [subscribe]{@link IAgoraRTCClient.subscribe}.
|
|
3021
3109
|
*/
|
|
3022
3110
|
export declare interface IRemoteVideoTrack extends IRemoteTrack {
|
|
3111
|
+
/**
|
|
3112
|
+
* @param event 事件名称。
|
|
3113
|
+
* @param listener 详见 [track-updated]{@link event_track_updated}。
|
|
3114
|
+
*/
|
|
3115
|
+
/** @en
|
|
3116
|
+
* @param event The event name.
|
|
3117
|
+
* @param listener See [track-updated]{@link event_track_updated}.
|
|
3118
|
+
*/
|
|
3119
|
+
on(event: "track-updated", listener: typeof event_track_updated): void;
|
|
3023
3120
|
/**
|
|
3024
3121
|
* @param event 事件名称。
|
|
3025
3122
|
* @param listener 详见 [video-state-changed]{@link event_video_state_changed}。
|
|
@@ -3128,7 +3225,7 @@ export declare interface IRemoteVideoTrack extends IRemoteTrack {
|
|
|
3128
3225
|
* 调用 `remoteVideoTrack.play` 后 SDK 会创建 [HTML `<video>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video) 标签用于播放视频轨道。当 `remoteVideoTrack.isPlaying` 为 `true` 却看不到图像时,你可调用该方法进行问题排查。
|
|
3129
3226
|
*
|
|
3130
3227
|
* @return [[CheckVideoVisibleResult]] 对象。如果该方法返回 `undefined`,可能为以下原因:
|
|
3131
|
-
* - `
|
|
3228
|
+
* - `remoteVideoTrack.isPlaying` 为 `false`。
|
|
3132
3229
|
* - `<video>` 标签不存在。
|
|
3133
3230
|
* - `<video>` 标签不是通过 `play` 方法调用产生的。
|
|
3134
3231
|
*/
|
|
@@ -3141,7 +3238,7 @@ export declare interface IRemoteVideoTrack extends IRemoteTrack {
|
|
|
3141
3238
|
* After you call `remoteVideoTrack.play`, the SDK creates an [`<video>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video) tag for playing video tracks. When `remoteVideoTrack.isPlaying` is `true` but you cannot see any video, call this method to check whether the `<video>` tag is visible or not and learn the reason when the `<video>` tag is invisible.
|
|
3142
3239
|
*
|
|
3143
3240
|
* @returns The [[CheckVideoVisibleResult]] object. If this method returns `undefined`, it may be due to the following reasons:
|
|
3144
|
-
* - `
|
|
3241
|
+
* - `remoteVideoTrack.isPlaying` is `false`.
|
|
3145
3242
|
* - The `<video>` tag does not exist.
|
|
3146
3243
|
* - The `<video>` tag is not created by calling the `play` method.
|
|
3147
3244
|
*/
|
|
@@ -3318,6 +3415,7 @@ export declare class LocalAudioTrack extends LocalTrack implements ILocalAudioTr
|
|
|
3318
3415
|
readonly trackMediaType: "audio" | "video";
|
|
3319
3416
|
_encoderConfig?: AudioEncoderConfiguration;
|
|
3320
3417
|
_trackSource: AudioTrackSource | FakeTrackSource;
|
|
3418
|
+
metadata: AudioMetadata[];
|
|
3321
3419
|
/**
|
|
3322
3420
|
* @description This method is used to init WebAudio, if you're sure you don't want to use WebAudio, call _trackSource
|
|
3323
3421
|
*/
|
|
@@ -3478,7 +3576,7 @@ export declare abstract class LocalTrack extends Track implements ILocalTrack {
|
|
|
3478
3576
|
protected processor?: IBaseProcessor;
|
|
3479
3577
|
protected abstract _processorContext: IProcessorContext | undefined;
|
|
3480
3578
|
protected get processorContext(): IProcessorContext | undefined;
|
|
3481
|
-
abstract processorDestination: IBaseProcessor;
|
|
3579
|
+
abstract get processorDestination(): IBaseProcessor;
|
|
3482
3580
|
constructor(track: MediaStreamTrack, trackId?: string);
|
|
3483
3581
|
abstract getStats(): LocalVideoTrackStats | LocalAudioTrackStats;
|
|
3484
3582
|
abstract setMuted(enabled: boolean): Promise<void>;
|
|
@@ -3518,21 +3616,24 @@ export declare class LocalVideoTrack extends LocalTrack implements ILocalVideoTr
|
|
|
3518
3616
|
private _clearPreviousVideoVisibleStatus;
|
|
3519
3617
|
_encoderConfig?: Partial<VideoEncoderConfiguration>;
|
|
3520
3618
|
_scalabilityMode?: SVCConfiguration;
|
|
3521
|
-
_optimizationMode?:
|
|
3522
|
-
_videoHeight
|
|
3523
|
-
_videoWidth
|
|
3619
|
+
_optimizationMode?: OptimizationMode | "balanced";
|
|
3620
|
+
private _videoHeight?;
|
|
3621
|
+
private _videoWidth?;
|
|
3622
|
+
get videoHeight(): number | undefined;
|
|
3623
|
+
get videoWidth(): number | undefined;
|
|
3524
3624
|
_forceBitrateLimit?: {
|
|
3525
3625
|
max_bitrate: number;
|
|
3526
3626
|
min_bitrate: number;
|
|
3527
3627
|
};
|
|
3528
3628
|
_enabled: boolean;
|
|
3529
3629
|
get isPlaying(): boolean;
|
|
3530
|
-
|
|
3630
|
+
protected _processorDestination: VideoProcessorDestination;
|
|
3631
|
+
get processorDestination(): VideoProcessorDestination;
|
|
3531
3632
|
protected _processorContext: VideoProcessorContext;
|
|
3532
3633
|
protected get processorContext(): VideoProcessorContext;
|
|
3533
3634
|
protected set processorContext(ctx: VideoProcessorContext);
|
|
3534
3635
|
get __className__(): string;
|
|
3535
|
-
constructor(track: MediaStreamTrack, encoderConfig?: Partial<VideoEncoderConfiguration>, scalabilityConfig?: SVCConfiguration, optimizationMode?:
|
|
3636
|
+
constructor(track: MediaStreamTrack, encoderConfig?: Partial<VideoEncoderConfiguration>, scalabilityConfig?: SVCConfiguration, optimizationMode?: OptimizationMode | "balanced", trackId?: string, hints?: TrackHint[]);
|
|
3536
3637
|
play(element: HTMLElement | HTMLVideoElement | string, config?: VideoPlayerConfig): void;
|
|
3537
3638
|
stop(): void;
|
|
3538
3639
|
setEnabled(enabled: boolean, skipChangeState?: boolean): Promise<void>;
|
|
@@ -3546,7 +3647,7 @@ export declare class LocalVideoTrack extends LocalTrack implements ILocalVideoTr
|
|
|
3546
3647
|
max_bitrate: number;
|
|
3547
3648
|
min_bitrate: number;
|
|
3548
3649
|
}): Promise<void>;
|
|
3549
|
-
setOptimizationMode(mode:
|
|
3650
|
+
setOptimizationMode(mode: OptimizationMode | "balanced"): Promise<void>;
|
|
3550
3651
|
setScalabiltyMode(mode: SVCConfiguration): void;
|
|
3551
3652
|
updateMediaStreamTrackResolution(): void;
|
|
3552
3653
|
protected _updatePlayerSource(): void;
|
|
@@ -3936,6 +4037,8 @@ export declare class MixingAudioTrack extends LocalAudioTrack {
|
|
|
3936
4037
|
_updateRtpTransceiver(transceiver: RTCRtpTransceiver): void;
|
|
3937
4038
|
}
|
|
3938
4039
|
|
|
4040
|
+
export declare type OptimizationMode = "motion" | "detail";
|
|
4041
|
+
|
|
3939
4042
|
/**
|
|
3940
4043
|
* @internal
|
|
3941
4044
|
*/
|
|
@@ -4751,6 +4854,12 @@ export declare interface ScreenVideoTrackInitConfig {
|
|
|
4751
4854
|
systemAudio?: "include" | "exclude";
|
|
4752
4855
|
}
|
|
4753
4856
|
|
|
4857
|
+
export declare type SenderConfig = {
|
|
4858
|
+
bitrateMax: number;
|
|
4859
|
+
bitrateMin: number;
|
|
4860
|
+
scaleResolutionDownBy: number;
|
|
4861
|
+
};
|
|
4862
|
+
|
|
4754
4863
|
/**
|
|
4755
4864
|
* 将节点输入的 AudioBuffer 返回,将节点输出的 AudioBuffer 设置成 silence
|
|
4756
4865
|
*/
|
|
@@ -4889,7 +4998,9 @@ export declare abstract class Track extends EventEmitter implements ITrack {
|
|
|
4889
4998
|
/** 原始的 Track 对象,来自于采集/用户传入/订阅返回 */
|
|
4890
4999
|
_originMediaStreamTrack: MediaStreamTrack;
|
|
4891
5000
|
/** 用于播放和发布的 Track 对象,可能被各种模块修改,一般来说等于 `_originMediaStreamTrack` */
|
|
4892
|
-
|
|
5001
|
+
mediaStreamTrack: MediaStreamTrack;
|
|
5002
|
+
set _mediaStreamTrack(track: MediaStreamTrack);
|
|
5003
|
+
get _mediaStreamTrack(): MediaStreamTrack;
|
|
4893
5004
|
/** 提供给外部插件以同步数据 */
|
|
4894
5005
|
_external: ExternalMethods;
|
|
4895
5006
|
constructor(track: MediaStreamTrack, trackId?: string);
|
|
@@ -4907,7 +5018,8 @@ export declare abstract class Track extends EventEmitter implements ITrack {
|
|
|
4907
5018
|
export declare enum TrackEvents {
|
|
4908
5019
|
TRANSCEIVER_UPDATED = "transceiver-updated",
|
|
4909
5020
|
SEI_TO_SEND = "sei-to-send",
|
|
4910
|
-
SEI_RECEIVED = "sei-received"
|
|
5021
|
+
SEI_RECEIVED = "sei-received",
|
|
5022
|
+
TRACK_UPDATED = "track-updated"
|
|
4911
5023
|
}
|
|
4912
5024
|
|
|
4913
5025
|
/**
|
|
@@ -4923,7 +5035,7 @@ export declare enum TrackHint {
|
|
|
4923
5035
|
}
|
|
4924
5036
|
|
|
4925
5037
|
export declare enum TrackInternalEvent {
|
|
4926
|
-
NEED_RENEGOTIATE = "@need_renegotiate"
|
|
5038
|
+
NEED_RENEGOTIATE = "@need_renegotiate",//deprecated
|
|
4927
5039
|
NEED_REPLACE_TRACK = "@need_replace_track",
|
|
4928
5040
|
NEED_REPLACE_MIXING_TRACK = "@need_replace_mixing_track",
|
|
4929
5041
|
NEED_CLOSE = "@need_close",
|
|
@@ -4934,8 +5046,9 @@ export declare enum TrackInternalEvent {
|
|
|
4934
5046
|
GET_STATS = "@get_stats",
|
|
4935
5047
|
GET_RTC_STATS = "@get_rtc_stats",
|
|
4936
5048
|
GET_LOW_VIDEO_TRACK = "@get_low_video_track",
|
|
4937
|
-
NEED_RESET_REMOTE_SDP = "@need_reset_remote_sdp"
|
|
5049
|
+
NEED_RESET_REMOTE_SDP = "@need_reset_remote_sdp",//deprecated
|
|
4938
5050
|
NEED_UPDATE_VIDEO_ENCODER = "@need_update_video_encoder",
|
|
5051
|
+
NEED_UPDATE_VIDEO_SEND_PARAMETERS = "@need_update_video_send_parameters",
|
|
4939
5052
|
NEED_MUTE_TRACK = "@need_mute_track",
|
|
4940
5053
|
NEED_UNMUTE_TRACK = "@need_unmute_track"
|
|
4941
5054
|
}
|
|
@@ -5044,50 +5157,50 @@ export declare interface VideoEncoderConfiguration {
|
|
|
5044
5157
|
*
|
|
5045
5158
|
* 下表列出了 SDK 所有内置的视频属性配置,SDK 默认使用 `"480p_1"`。
|
|
5046
5159
|
*
|
|
5047
|
-
* | 视频属性 | 分辨率(宽×高) | 帧率(fps) |
|
|
5048
|
-
* | -------- | --------------- | ----------- |
|
|
5049
|
-
* | 120p | 160 × 120 | 15 |
|
|
5050
|
-
* | 120p_1 | 160 × 120 | 15 |
|
|
5051
|
-
* | 120p_3 | 120 × 120 | 15 |
|
|
5052
|
-
* | 180p | 320 × 180 | 15 |
|
|
5053
|
-
* | 180p_1 | 320 × 180 | 15 |
|
|
5054
|
-
* | 180p_3 | 180 × 180 | 15 |
|
|
5055
|
-
* | 180p_4 | 240 × 180 | 15 |
|
|
5056
|
-
* | 240p | 320 × 240 | 15 |
|
|
5057
|
-
* | 240p_1 | 320 × 240 | 15 |
|
|
5058
|
-
* | 240p_3 | 240 × 240 | 15 |
|
|
5059
|
-
* | 240p_4 | 424 × 240 | 15 |
|
|
5060
|
-
* | 360p | 640 × 360 | 15 |
|
|
5061
|
-
* | 360p_1 | 640 × 360 | 15 |
|
|
5062
|
-
* | 360p_3 | 360 × 360 | 15 |
|
|
5063
|
-
* | 360p_4 | 640 × 360 | 30 |
|
|
5064
|
-
* | 360p_6 | 360 × 360 | 30 |
|
|
5065
|
-
* | 360p_7 | 480 × 360 | 15 |
|
|
5066
|
-
* | 360p_8 | 480 × 360 | 30 |
|
|
5067
|
-
* | 360p_9 | 640 × 360 | 15 |
|
|
5068
|
-
* | 360p_10 | 640 × 360 | 24 |
|
|
5069
|
-
* | 360p_11 | 640 × 360 | 24 |
|
|
5070
|
-
* | 480p | 640 × 480 | 15 |
|
|
5071
|
-
* | 480p_1 | 640 × 480 | 15 |
|
|
5072
|
-
* | 480p_2 | 640 × 480 | 30 |
|
|
5073
|
-
* | 480p_3 | 480 × 480 | 15 |
|
|
5074
|
-
* | 480p_4 | 640 × 480 | 30 |
|
|
5075
|
-
* | 480p_6 | 480 × 480 | 30 |
|
|
5076
|
-
* | 480p_8 | 848 × 480 | 15 |
|
|
5077
|
-
* | 480p_9 | 848 × 480 | 30 |
|
|
5078
|
-
* | 480p_10 | 640 × 480 | 10 |
|
|
5079
|
-
* | 720p | 1280 × 720 | 15 |
|
|
5080
|
-
* | 720p_1 | 1280 × 720 | 15 |
|
|
5081
|
-
* | 720p_2 | 1280 × 720 | 30 |
|
|
5082
|
-
* | 720p_3 | 1280 × 720 | 30 |
|
|
5083
|
-
* | 720p_auto <sup>①</sup> | 1280 × 720 | 30
|
|
5084
|
-
* | 720p_5 | 960 × 720 | 15 |
|
|
5085
|
-
* | 720p_6 | 960 × 720 | 30 |
|
|
5086
|
-
* | 1080p | 1920 × 1080 | 15 |
|
|
5087
|
-
* | 1080p_1 | 1920 × 1080 | 15 |
|
|
5088
|
-
* | 1080p_2 | 1920 × 1080 | 30 |
|
|
5089
|
-
* | 1080p_3 | 1920 × 1080 | 30 |
|
|
5090
|
-
* | 1080p_5 | 1920 × 1080 | 60 |
|
|
5160
|
+
* | 视频属性 | 分辨率(宽×高) | 帧率(fps) | Chrome | Firefox | Safari |
|
|
5161
|
+
* | -------- | --------------- | ----------- | ------ | ------- | ------ |
|
|
5162
|
+
* | 120p | 160 × 120 | 15 | ✓ | | |
|
|
5163
|
+
* | 120p_1 | 160 × 120 | 15 | ✓ | | |
|
|
5164
|
+
* | 120p_3 | 120 × 120 | 15 | ✓ | | |
|
|
5165
|
+
* | 180p | 320 × 180 | 15 | ✓ | | |
|
|
5166
|
+
* | 180p_1 | 320 × 180 | 15 | ✓ | | |
|
|
5167
|
+
* | 180p_3 | 180 × 180 | 15 | ✓ | | |
|
|
5168
|
+
* | 180p_4 | 240 × 180 | 15 | ✓ | | |
|
|
5169
|
+
* | 240p | 320 × 240 | 15 | ✓ | | |
|
|
5170
|
+
* | 240p_1 | 320 × 240 | 15 | ✓ | | |
|
|
5171
|
+
* | 240p_3 | 240 × 240 | 15 | ✓ | | |
|
|
5172
|
+
* | 240p_4 | 424 × 240 | 15 | ✓ | | |
|
|
5173
|
+
* | 360p | 640 × 360 | 15 | ✓ | | |
|
|
5174
|
+
* | 360p_1 | 640 × 360 | 15 | ✓ | | |
|
|
5175
|
+
* | 360p_3 | 360 × 360 | 15 | ✓ | | |
|
|
5176
|
+
* | 360p_4 | 640 × 360 | 30 | ✓ | | |
|
|
5177
|
+
* | 360p_6 | 360 × 360 | 30 | ✓ | | |
|
|
5178
|
+
* | 360p_7 | 480 × 360 | 15 | ✓ | | |
|
|
5179
|
+
* | 360p_8 | 480 × 360 | 30 | ✓ | | |
|
|
5180
|
+
* | 360p_9 | 640 × 360 | 15 | ✓ | | |
|
|
5181
|
+
* | 360p_10 | 640 × 360 | 24 | ✓ | | |
|
|
5182
|
+
* | 360p_11 | 640 × 360 | 24 | ✓ | | |
|
|
5183
|
+
* | 480p | 640 × 480 | 15 | ✓ | ✓ | ✓ |
|
|
5184
|
+
* | 480p_1 | 640 × 480 | 15 | ✓ | ✓ | ✓ |
|
|
5185
|
+
* | 480p_2 | 640 × 480 | 30 | ✓ | ✓ | ✓ |
|
|
5186
|
+
* | 480p_3 | 480 × 480 | 15 | ✓ | ✓ | ✓ |
|
|
5187
|
+
* | 480p_4 | 640 × 480 | 30 | ✓ | ✓ | ✓ |
|
|
5188
|
+
* | 480p_6 | 480 × 480 | 30 | ✓ | ✓ | ✓ |
|
|
5189
|
+
* | 480p_8 | 848 × 480 | 15 | ✓ | ✓ | ✓ |
|
|
5190
|
+
* | 480p_9 | 848 × 480 | 30 | ✓ | ✓ | ✓ |
|
|
5191
|
+
* | 480p_10 | 640 × 480 | 10 | ✓ | ✓ | ✓ |
|
|
5192
|
+
* | 720p | 1280 × 720 | 15 | ✓ | ✓ | ✓ |
|
|
5193
|
+
* | 720p_1 | 1280 × 720 | 15 | ✓ | ✓ | ✓ |
|
|
5194
|
+
* | 720p_2 | 1280 × 720 | 30 | ✓ | ✓ | ✓ |
|
|
5195
|
+
* | 720p_3 | 1280 × 720 | 30 | ✓ | ✓ | ✓ |
|
|
5196
|
+
* | 720p_auto <sup>①</sup> | 1280 × 720 | 30 |✓ | ✓ | ✓ |
|
|
5197
|
+
* | 720p_5 | 960 × 720 | 15 | ✓ | ✓ | ✓ |
|
|
5198
|
+
* | 720p_6 | 960 × 720 | 30 | ✓ | ✓ | ✓ |
|
|
5199
|
+
* | 1080p | 1920 × 1080 | 15 | ✓ | | ✓ |
|
|
5200
|
+
* | 1080p_1 | 1920 × 1080 | 15 | ✓ | | ✓ |
|
|
5201
|
+
* | 1080p_2 | 1920 × 1080 | 30 | ✓ | | ✓ |
|
|
5202
|
+
* | 1080p_3 | 1920 × 1080 | 30 | ✓ | | ✓ |
|
|
5203
|
+
* | 1080p_5 | 1920 × 1080 | 60 | ✓ | | ✓ |
|
|
5091
5204
|
*
|
|
5092
5205
|
* > <sup>①</sup> `"720p_auto"` 仅推荐在 Safari 上设置,用于确保能够动态调整编码分辨率,详见[发版说明](https://doc.shengwang.cn/doc/rtc/javascript/overview/release-notes)。
|
|
5093
5206
|
*
|
|
@@ -5101,50 +5214,50 @@ export declare interface VideoEncoderConfiguration {
|
|
|
5101
5214
|
*
|
|
5102
5215
|
* The following table lists all the preset video profiles. The SDK uses `"480p_1"` by default.
|
|
5103
5216
|
*
|
|
5104
|
-
* | Video Profile | Resolution (Width×Height) | Frame Rate (fps) |
|
|
5105
|
-
* | -------- | --------------- | ----------- |
|
|
5106
|
-
* | 120p | 160 × 120 | 15 |
|
|
5107
|
-
* | 120p_1 | 160 × 120 | 15 |
|
|
5108
|
-
* | 120p_3 | 120 × 120 | 15 |
|
|
5109
|
-
* | 180p | 320 × 180 | 15 |
|
|
5110
|
-
* | 180p_1 | 320 × 180 | 15 |
|
|
5111
|
-
* | 180p_3 | 180 × 180 | 15 |
|
|
5112
|
-
* | 180p_4 | 240 × 180 | 15 |
|
|
5113
|
-
* | 240p | 320 × 240 | 15 |
|
|
5114
|
-
* | 240p_1 | 320 × 240 | 15 |
|
|
5115
|
-
* | 240p_3 | 240 × 240 | 15 |
|
|
5116
|
-
* | 240p_4 | 424 × 240 | 15 |
|
|
5117
|
-
* | 360p | 640 × 360 | 15 |
|
|
5118
|
-
* | 360p_1 | 640 × 360 | 15 |
|
|
5119
|
-
* | 360p_3 | 360 × 360 | 15 |
|
|
5120
|
-
* | 360p_4 | 640 × 360 | 30 |
|
|
5121
|
-
* | 360p_6 | 360 × 360 | 30 |
|
|
5122
|
-
* | 360p_7 | 480 × 360 | 15 |
|
|
5123
|
-
* | 360p_8 | 480 × 360 | 30 |
|
|
5124
|
-
* | 360p_9 | 640 × 360 | 15 |
|
|
5125
|
-
* | 360p_10 | 640 × 360 | 24 |
|
|
5126
|
-
* | 360p_11 | 640 × 360 | 24 |
|
|
5127
|
-
* | 480p | 640 × 480 | 15 |
|
|
5128
|
-
* | 480p_1 | 640 × 480 | 15 |
|
|
5129
|
-
* | 480p_2 | 640 × 480 | 30 |
|
|
5130
|
-
* | 480p_3 | 480 × 480 | 15 |
|
|
5131
|
-
* | 480p_4 | 640 × 480 | 30 |
|
|
5132
|
-
* | 480p_6 | 480 × 480 | 30 |
|
|
5133
|
-
* | 480p_8 | 848 × 480 | 15 |
|
|
5134
|
-
* | 480p_9 | 848 × 480 | 30 |
|
|
5135
|
-
* | 480p_10 | 640 × 480 | 10 |
|
|
5136
|
-
* | 720p | 1280 × 720 | 15 |
|
|
5137
|
-
* | 720p_1 | 1280 × 720 | 15 |
|
|
5138
|
-
* | 720p_2 | 1280 × 720 | 30 |
|
|
5139
|
-
* | 720p_3 | 1280 × 720 | 30 |
|
|
5140
|
-
* | 720p_auto <sup>①</sup> | 1280 × 720 | 30 |
|
|
5141
|
-
* | 720p_5 | 960 × 720 | 15 |
|
|
5142
|
-
* | 720p_6 | 960 × 720 | 30 |
|
|
5143
|
-
* | 1080p | 1920 × 1080 | 15 |
|
|
5144
|
-
* | 1080p_1 | 1920 × 1080 | 15 |
|
|
5145
|
-
* | 1080p_2 | 1920 × 1080 | 30 |
|
|
5146
|
-
* | 1080p_3 | 1920 × 1080 | 30 |
|
|
5147
|
-
* | 1080p_5 | 1920 × 1080 | 60 |
|
|
5217
|
+
* | Video Profile | Resolution (Width×Height) | Frame Rate (fps) | Chrome | Firefox | Safari |
|
|
5218
|
+
* | -------- | --------------- | ----------- | ------ | ------- | ------ |
|
|
5219
|
+
* | 120p | 160 × 120 | 15 | ✓ | | |
|
|
5220
|
+
* | 120p_1 | 160 × 120 | 15 | ✓ | | |
|
|
5221
|
+
* | 120p_3 | 120 × 120 | 15 | ✓ | | |
|
|
5222
|
+
* | 180p | 320 × 180 | 15 | ✓ | | |
|
|
5223
|
+
* | 180p_1 | 320 × 180 | 15 | ✓ | | |
|
|
5224
|
+
* | 180p_3 | 180 × 180 | 15 | ✓ | | |
|
|
5225
|
+
* | 180p_4 | 240 × 180 | 15 | ✓ | | |
|
|
5226
|
+
* | 240p | 320 × 240 | 15 | ✓ | | |
|
|
5227
|
+
* | 240p_1 | 320 × 240 | 15 | ✓ | | |
|
|
5228
|
+
* | 240p_3 | 240 × 240 | 15 | ✓ | | |
|
|
5229
|
+
* | 240p_4 | 424 × 240 | 15 | ✓ | | |
|
|
5230
|
+
* | 360p | 640 × 360 | 15 | ✓ | | |
|
|
5231
|
+
* | 360p_1 | 640 × 360 | 15 | ✓ | | |
|
|
5232
|
+
* | 360p_3 | 360 × 360 | 15 | ✓ | | |
|
|
5233
|
+
* | 360p_4 | 640 × 360 | 30 | ✓ | | |
|
|
5234
|
+
* | 360p_6 | 360 × 360 | 30 | ✓ | | |
|
|
5235
|
+
* | 360p_7 | 480 × 360 | 15 | ✓ | | |
|
|
5236
|
+
* | 360p_8 | 480 × 360 | 30 | ✓ | | |
|
|
5237
|
+
* | 360p_9 | 640 × 360 | 15 | ✓ | | |
|
|
5238
|
+
* | 360p_10 | 640 × 360 | 24 | ✓ | | |
|
|
5239
|
+
* | 360p_11 | 640 × 360 | 24 | ✓ | | |
|
|
5240
|
+
* | 480p | 640 × 480 | 15 | ✓ | ✓ | ✓ |
|
|
5241
|
+
* | 480p_1 | 640 × 480 | 15 | ✓ | ✓ | ✓ |
|
|
5242
|
+
* | 480p_2 | 640 × 480 | 30 | ✓ | ✓ | ✓ |
|
|
5243
|
+
* | 480p_3 | 480 × 480 | 15 | ✓ | ✓ | ✓ |
|
|
5244
|
+
* | 480p_4 | 640 × 480 | 30 | ✓ | ✓ | ✓ |
|
|
5245
|
+
* | 480p_6 | 480 × 480 | 30 | ✓ | ✓ | ✓ |
|
|
5246
|
+
* | 480p_8 | 848 × 480 | 15 | ✓ | ✓ | ✓ |
|
|
5247
|
+
* | 480p_9 | 848 × 480 | 30 | ✓ | ✓ | ✓ |
|
|
5248
|
+
* | 480p_10 | 640 × 480 | 10 | ✓ | ✓ | ✓ |
|
|
5249
|
+
* | 720p | 1280 × 720 | 15 | ✓ | ✓ | ✓ |
|
|
5250
|
+
* | 720p_1 | 1280 × 720 | 15 | ✓ | ✓ | ✓ |
|
|
5251
|
+
* | 720p_2 | 1280 × 720 | 30 | ✓ | ✓ | ✓ |
|
|
5252
|
+
* | 720p_3 | 1280 × 720 | 30 | ✓ | ✓ | ✓ |
|
|
5253
|
+
* | 720p_auto <sup>①</sup> | 1280 × 720 | 30 | ✓ | ✓ | ✓ |
|
|
5254
|
+
* | 720p_5 | 960 × 720 | 15 | ✓ | ✓ | ✓ |
|
|
5255
|
+
* | 720p_6 | 960 × 720 | 30 | ✓ | ✓ | ✓ |
|
|
5256
|
+
* | 1080p | 1920 × 1080 | 15 | ✓ | | ✓ |
|
|
5257
|
+
* | 1080p_1 | 1920 × 1080 | 15 | ✓ | | ✓ |
|
|
5258
|
+
* | 1080p_2 | 1920 × 1080 | 30 | ✓ | | ✓ |
|
|
5259
|
+
* | 1080p_3 | 1920 × 1080 | 30 | ✓ | | ✓ |
|
|
5260
|
+
* | 1080p_5 | 1920 × 1080 | 60 | ✓ | | ✓ |
|
|
5148
5261
|
*
|
|
5149
5262
|
* > <sup>①</sup> `"720p_auto"` is only recommended to be set on Safari to ensure dynamic adjustment of the encoding resolution. For details, see the release notes.
|
|
5150
5263
|
*/
|
|
@@ -5171,6 +5284,8 @@ declare class VideoPlayer {
|
|
|
5171
5284
|
protected videoTrack?: MediaStreamTrack;
|
|
5172
5285
|
protected videoElement: HTMLVideoElement;
|
|
5173
5286
|
protected cacheVideoElement?: HTMLVideoElement;
|
|
5287
|
+
private renderStats?;
|
|
5288
|
+
get rendFrameRate(): number;
|
|
5174
5289
|
get videoElementStatus(): MediaElementStatus;
|
|
5175
5290
|
set videoElementStatus(status: MediaElementStatus);
|
|
5176
5291
|
get videoState(): VideoState;
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agora-js/media",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.21.0-200",
|
|
4
4
|
"description": "media module across @agora-js packages",
|
|
5
5
|
"main": "AgoraRTC_N-media.js",
|
|
6
6
|
"module": "AgoraRTC_N-media.esm.mjs",
|
|
7
|
-
"types": "
|
|
7
|
+
"types": "rtc-sdk-media_en.d.ts",
|
|
8
8
|
"declaration": true,
|
|
9
9
|
"author": "Agora WebRTC Team",
|
|
10
10
|
"keywords": [
|
|
@@ -23,9 +23,9 @@
|
|
|
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.
|
|
27
|
-
"@agora-js/report": "4.
|
|
28
|
-
"axios": "^1.6.
|
|
26
|
+
"@agora-js/shared": "4.21.0-200",
|
|
27
|
+
"@agora-js/report": "4.21.0-200",
|
|
28
|
+
"axios": "^1.6.8",
|
|
29
29
|
"agora-rte-extension": "^1.2.4",
|
|
30
30
|
"webrtc-adapter": "8.2.0",
|
|
31
31
|
"pako": "^2.1.0"
|