@seastart/srtc-web-sdk 0.3.7 → 0.4.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/package.json +1 -1
- package/srtc.d.mts +125 -1
- package/srtc.d.ts +125 -1
- package/srtc.js +1 -1
- package/srtc.mjs +1 -1
package/package.json
CHANGED
package/srtc.d.mts
CHANGED
|
@@ -242,6 +242,14 @@ export declare class ChannelEventType extends CommonChannelEventType {
|
|
|
242
242
|
static readonly DEVICE_REMOVE = "device_remove";
|
|
243
243
|
/** 轨道自动播放失败,对应data为BaseTrack */
|
|
244
244
|
static readonly TRACK_AUTOPLAY_FAIL = "track_autoplay_fail";
|
|
245
|
+
/** 轨道进入画中画模式,对应data为BaseTrack */
|
|
246
|
+
static readonly TRACK_PIP_ENTER = "track_pip_enter";
|
|
247
|
+
/** 轨道退出画中画模式,对应data为BaseTrack */
|
|
248
|
+
static readonly TRACK_PIP_EXIT = "track_pip_exit";
|
|
249
|
+
/** 轨道弹出独立窗口,对应data为BaseTrack */
|
|
250
|
+
static readonly TRACK_POPOUT_OPEN = "track_popout_open";
|
|
251
|
+
/** 轨道关闭独立窗口,对应data为BaseTrack */
|
|
252
|
+
static readonly TRACK_POPOUT_CLOSE = "track_popout_close";
|
|
245
253
|
}
|
|
246
254
|
/** 频道外事件通知 */
|
|
247
255
|
export declare class ImEvent {
|
|
@@ -260,6 +268,10 @@ export declare class LocalAudioTrack extends BaseWebrtcTrack {
|
|
|
260
268
|
* 获取音量
|
|
261
269
|
*/
|
|
262
270
|
getVolume(): number;
|
|
271
|
+
/**
|
|
272
|
+
* 是否正在播放
|
|
273
|
+
*/
|
|
274
|
+
isPlaying(): boolean;
|
|
263
275
|
/**
|
|
264
276
|
* 播放音频(可指定播放设备)
|
|
265
277
|
*/
|
|
@@ -374,6 +386,38 @@ export declare class LocalVideoTrack extends BaseWebrtcTrack {
|
|
|
374
386
|
* 移除所有播放窗口
|
|
375
387
|
*/
|
|
376
388
|
removeAllPlayViews(): void;
|
|
389
|
+
/**
|
|
390
|
+
* 将指定容器的视频进入画中画模式
|
|
391
|
+
* @param container 播放容器
|
|
392
|
+
* @param options 画中画配置
|
|
393
|
+
*/
|
|
394
|
+
enterPictureInPicture(container: HTMLElement, options?: PipOptions): Promise<PipHandle>;
|
|
395
|
+
/**
|
|
396
|
+
* 退出指定容器的画中画
|
|
397
|
+
* @param container 播放容器
|
|
398
|
+
*/
|
|
399
|
+
exitPictureInPicture(container: HTMLElement): Promise<void>;
|
|
400
|
+
/**
|
|
401
|
+
* 指定容器是否处于画中画模式
|
|
402
|
+
* @param container 播放容器
|
|
403
|
+
*/
|
|
404
|
+
isPictureInPicture(container: HTMLElement): boolean;
|
|
405
|
+
/**
|
|
406
|
+
* 将指定容器的视频弹出到独立窗口(可拖到第二个显示器)
|
|
407
|
+
* @param container 播放容器
|
|
408
|
+
* @param options 弹出窗口配置
|
|
409
|
+
*/
|
|
410
|
+
popOutToWindow(container: HTMLElement, options?: PopOutOptions): PopOutHandle;
|
|
411
|
+
/**
|
|
412
|
+
* 关闭指定容器的弹出窗口
|
|
413
|
+
* @param container 原始播放容器
|
|
414
|
+
*/
|
|
415
|
+
closePopOutWindow(container: HTMLElement): void;
|
|
416
|
+
/**
|
|
417
|
+
* 指定容器是否已弹出到独立窗口
|
|
418
|
+
* @param container 播放容器
|
|
419
|
+
*/
|
|
420
|
+
isPopOut(container: HTMLElement): boolean;
|
|
377
421
|
}
|
|
378
422
|
/**
|
|
379
423
|
* 远端混音流
|
|
@@ -425,6 +469,38 @@ export declare class RemoteVideoTrack extends BaseWebrtcTrack {
|
|
|
425
469
|
* 移除所有播放窗口
|
|
426
470
|
*/
|
|
427
471
|
removeAllPlayViews(): void;
|
|
472
|
+
/**
|
|
473
|
+
* 将指定容器的视频进入画中画模式
|
|
474
|
+
* @param container 播放容器
|
|
475
|
+
* @param options 画中画配置
|
|
476
|
+
*/
|
|
477
|
+
enterPictureInPicture(container: HTMLElement, options?: PipOptions): Promise<PipHandle>;
|
|
478
|
+
/**
|
|
479
|
+
* 退出指定容器的画中画
|
|
480
|
+
* @param container 播放容器
|
|
481
|
+
*/
|
|
482
|
+
exitPictureInPicture(container: HTMLElement): Promise<void>;
|
|
483
|
+
/**
|
|
484
|
+
* 指定容器是否处于画中画模式
|
|
485
|
+
* @param container 播放容器
|
|
486
|
+
*/
|
|
487
|
+
isPictureInPicture(container: HTMLElement): boolean;
|
|
488
|
+
/**
|
|
489
|
+
* 将指定容器的视频弹出到独立窗口(可拖到第二个显示器)
|
|
490
|
+
* @param container 播放容器
|
|
491
|
+
* @param options 弹出窗口配置
|
|
492
|
+
*/
|
|
493
|
+
popOutToWindow(container: HTMLElement, options?: PopOutOptions): PopOutHandle;
|
|
494
|
+
/**
|
|
495
|
+
* 关闭指定容器的弹出窗口
|
|
496
|
+
* @param container 原始播放容器
|
|
497
|
+
*/
|
|
498
|
+
closePopOutWindow(container: HTMLElement): void;
|
|
499
|
+
/**
|
|
500
|
+
* 指定容器是否已弹出到独立窗口
|
|
501
|
+
* @param container 播放容器
|
|
502
|
+
*/
|
|
503
|
+
isPopOut(container: HTMLElement): boolean;
|
|
428
504
|
}
|
|
429
505
|
export declare class SRTC extends BaseSRTC {
|
|
430
506
|
buildInfo(): BuildInfo;
|
|
@@ -468,7 +544,7 @@ export declare class SRTC extends BaseSRTC {
|
|
|
468
544
|
/**
|
|
469
545
|
* 临时enable本地流轨道,如取消静音麦克风
|
|
470
546
|
*/
|
|
471
|
-
enableLocalTrack(track: LocalAudioTrack | LocalVideoTrack): void
|
|
547
|
+
enableLocalTrack(track: LocalAudioTrack | LocalVideoTrack): Promise<void>;
|
|
472
548
|
/**
|
|
473
549
|
* 临时disable本地流轨道,如临时静音麦克风
|
|
474
550
|
* 比unpublishLocalTrack取消发布轨道轻
|
|
@@ -710,6 +786,10 @@ export interface AudioOutputOptions {
|
|
|
710
786
|
* 当因权限问题自动播放失败时,禁用sdk自带的播放弹窗,手动处理
|
|
711
787
|
*/
|
|
712
788
|
disableAutoPlayDialog?: boolean;
|
|
789
|
+
/**
|
|
790
|
+
* 音量,范围[0,1]
|
|
791
|
+
*/
|
|
792
|
+
volume?: number;
|
|
713
793
|
}
|
|
714
794
|
/**
|
|
715
795
|
* 音频发布配置
|
|
@@ -993,6 +1073,50 @@ export interface MixedAudioMediaStreamTrack extends MediaStreamTrack {
|
|
|
993
1073
|
context: AudioContext;
|
|
994
1074
|
addTrack(track: MediaStreamTrack): void;
|
|
995
1075
|
removeTrack(track: MediaStreamTrack): void;
|
|
1076
|
+
trackCount: number;
|
|
1077
|
+
}
|
|
1078
|
+
/** 画中画句柄,用于控制画中画状态 */
|
|
1079
|
+
export interface PipHandle {
|
|
1080
|
+
/** 画中画类型:document-pip 支持自定义UI,video-pip 为传统模式 */
|
|
1081
|
+
type: "document-pip" | "video-pip";
|
|
1082
|
+
/** Document PiP 模式下的 window 引用,可用于添加自定义控件 */
|
|
1083
|
+
pipWindow?: Window;
|
|
1084
|
+
/** 退出画中画 */
|
|
1085
|
+
exit(): Promise<void>;
|
|
1086
|
+
}
|
|
1087
|
+
/** 画中画配置选项 */
|
|
1088
|
+
export interface PipOptions {
|
|
1089
|
+
/** 画中画窗口宽度 */
|
|
1090
|
+
width?: number;
|
|
1091
|
+
/** 画中画窗口高度 */
|
|
1092
|
+
height?: number;
|
|
1093
|
+
/** 是否优先使用 Document PiP(支持自定义UI),默认true */
|
|
1094
|
+
preferDocumentPip?: boolean;
|
|
1095
|
+
/**
|
|
1096
|
+
* 是否隐藏原始播放视图,默认true
|
|
1097
|
+
* 仅在 Document PiP 生效,传统 video PiP 使用的就是原 video 元素,不能隐藏
|
|
1098
|
+
*/
|
|
1099
|
+
hideOriginView?: boolean;
|
|
1100
|
+
}
|
|
1101
|
+
/** 弹出窗口句柄,用于控制弹出窗口 */
|
|
1102
|
+
export interface PopOutHandle {
|
|
1103
|
+
/** 弹出窗口的 window 引用 */
|
|
1104
|
+
window: Window;
|
|
1105
|
+
/** 将视频回收到主页面指定容器 */
|
|
1106
|
+
moveBack(container: HTMLElement): void;
|
|
1107
|
+
/** 关闭弹出窗口 */
|
|
1108
|
+
close(): void;
|
|
1109
|
+
}
|
|
1110
|
+
/** 弹出窗口配置选项 */
|
|
1111
|
+
export interface PopOutOptions {
|
|
1112
|
+
/** 弹出窗口宽度,默认640 */
|
|
1113
|
+
width?: number;
|
|
1114
|
+
/** 弹出窗口高度,默认480 */
|
|
1115
|
+
height?: number;
|
|
1116
|
+
/** 弹出窗口标题 */
|
|
1117
|
+
title?: string;
|
|
1118
|
+
/** 是否隐藏原始播放视图,默认true */
|
|
1119
|
+
hideOriginView?: boolean;
|
|
996
1120
|
}
|
|
997
1121
|
/**
|
|
998
1122
|
* 属性更改项
|
package/srtc.d.ts
CHANGED
|
@@ -242,6 +242,14 @@ export declare class ChannelEventType extends CommonChannelEventType {
|
|
|
242
242
|
static readonly DEVICE_REMOVE = "device_remove";
|
|
243
243
|
/** 轨道自动播放失败,对应data为BaseTrack */
|
|
244
244
|
static readonly TRACK_AUTOPLAY_FAIL = "track_autoplay_fail";
|
|
245
|
+
/** 轨道进入画中画模式,对应data为BaseTrack */
|
|
246
|
+
static readonly TRACK_PIP_ENTER = "track_pip_enter";
|
|
247
|
+
/** 轨道退出画中画模式,对应data为BaseTrack */
|
|
248
|
+
static readonly TRACK_PIP_EXIT = "track_pip_exit";
|
|
249
|
+
/** 轨道弹出独立窗口,对应data为BaseTrack */
|
|
250
|
+
static readonly TRACK_POPOUT_OPEN = "track_popout_open";
|
|
251
|
+
/** 轨道关闭独立窗口,对应data为BaseTrack */
|
|
252
|
+
static readonly TRACK_POPOUT_CLOSE = "track_popout_close";
|
|
245
253
|
}
|
|
246
254
|
/** 频道外事件通知 */
|
|
247
255
|
export declare class ImEvent {
|
|
@@ -260,6 +268,10 @@ export declare class LocalAudioTrack extends BaseWebrtcTrack {
|
|
|
260
268
|
* 获取音量
|
|
261
269
|
*/
|
|
262
270
|
getVolume(): number;
|
|
271
|
+
/**
|
|
272
|
+
* 是否正在播放
|
|
273
|
+
*/
|
|
274
|
+
isPlaying(): boolean;
|
|
263
275
|
/**
|
|
264
276
|
* 播放音频(可指定播放设备)
|
|
265
277
|
*/
|
|
@@ -374,6 +386,38 @@ export declare class LocalVideoTrack extends BaseWebrtcTrack {
|
|
|
374
386
|
* 移除所有播放窗口
|
|
375
387
|
*/
|
|
376
388
|
removeAllPlayViews(): void;
|
|
389
|
+
/**
|
|
390
|
+
* 将指定容器的视频进入画中画模式
|
|
391
|
+
* @param container 播放容器
|
|
392
|
+
* @param options 画中画配置
|
|
393
|
+
*/
|
|
394
|
+
enterPictureInPicture(container: HTMLElement, options?: PipOptions): Promise<PipHandle>;
|
|
395
|
+
/**
|
|
396
|
+
* 退出指定容器的画中画
|
|
397
|
+
* @param container 播放容器
|
|
398
|
+
*/
|
|
399
|
+
exitPictureInPicture(container: HTMLElement): Promise<void>;
|
|
400
|
+
/**
|
|
401
|
+
* 指定容器是否处于画中画模式
|
|
402
|
+
* @param container 播放容器
|
|
403
|
+
*/
|
|
404
|
+
isPictureInPicture(container: HTMLElement): boolean;
|
|
405
|
+
/**
|
|
406
|
+
* 将指定容器的视频弹出到独立窗口(可拖到第二个显示器)
|
|
407
|
+
* @param container 播放容器
|
|
408
|
+
* @param options 弹出窗口配置
|
|
409
|
+
*/
|
|
410
|
+
popOutToWindow(container: HTMLElement, options?: PopOutOptions): PopOutHandle;
|
|
411
|
+
/**
|
|
412
|
+
* 关闭指定容器的弹出窗口
|
|
413
|
+
* @param container 原始播放容器
|
|
414
|
+
*/
|
|
415
|
+
closePopOutWindow(container: HTMLElement): void;
|
|
416
|
+
/**
|
|
417
|
+
* 指定容器是否已弹出到独立窗口
|
|
418
|
+
* @param container 播放容器
|
|
419
|
+
*/
|
|
420
|
+
isPopOut(container: HTMLElement): boolean;
|
|
377
421
|
}
|
|
378
422
|
/**
|
|
379
423
|
* 远端混音流
|
|
@@ -425,6 +469,38 @@ export declare class RemoteVideoTrack extends BaseWebrtcTrack {
|
|
|
425
469
|
* 移除所有播放窗口
|
|
426
470
|
*/
|
|
427
471
|
removeAllPlayViews(): void;
|
|
472
|
+
/**
|
|
473
|
+
* 将指定容器的视频进入画中画模式
|
|
474
|
+
* @param container 播放容器
|
|
475
|
+
* @param options 画中画配置
|
|
476
|
+
*/
|
|
477
|
+
enterPictureInPicture(container: HTMLElement, options?: PipOptions): Promise<PipHandle>;
|
|
478
|
+
/**
|
|
479
|
+
* 退出指定容器的画中画
|
|
480
|
+
* @param container 播放容器
|
|
481
|
+
*/
|
|
482
|
+
exitPictureInPicture(container: HTMLElement): Promise<void>;
|
|
483
|
+
/**
|
|
484
|
+
* 指定容器是否处于画中画模式
|
|
485
|
+
* @param container 播放容器
|
|
486
|
+
*/
|
|
487
|
+
isPictureInPicture(container: HTMLElement): boolean;
|
|
488
|
+
/**
|
|
489
|
+
* 将指定容器的视频弹出到独立窗口(可拖到第二个显示器)
|
|
490
|
+
* @param container 播放容器
|
|
491
|
+
* @param options 弹出窗口配置
|
|
492
|
+
*/
|
|
493
|
+
popOutToWindow(container: HTMLElement, options?: PopOutOptions): PopOutHandle;
|
|
494
|
+
/**
|
|
495
|
+
* 关闭指定容器的弹出窗口
|
|
496
|
+
* @param container 原始播放容器
|
|
497
|
+
*/
|
|
498
|
+
closePopOutWindow(container: HTMLElement): void;
|
|
499
|
+
/**
|
|
500
|
+
* 指定容器是否已弹出到独立窗口
|
|
501
|
+
* @param container 播放容器
|
|
502
|
+
*/
|
|
503
|
+
isPopOut(container: HTMLElement): boolean;
|
|
428
504
|
}
|
|
429
505
|
export declare class SRTC extends BaseSRTC {
|
|
430
506
|
buildInfo(): BuildInfo;
|
|
@@ -468,7 +544,7 @@ export declare class SRTC extends BaseSRTC {
|
|
|
468
544
|
/**
|
|
469
545
|
* 临时enable本地流轨道,如取消静音麦克风
|
|
470
546
|
*/
|
|
471
|
-
enableLocalTrack(track: LocalAudioTrack | LocalVideoTrack): void
|
|
547
|
+
enableLocalTrack(track: LocalAudioTrack | LocalVideoTrack): Promise<void>;
|
|
472
548
|
/**
|
|
473
549
|
* 临时disable本地流轨道,如临时静音麦克风
|
|
474
550
|
* 比unpublishLocalTrack取消发布轨道轻
|
|
@@ -710,6 +786,10 @@ export interface AudioOutputOptions {
|
|
|
710
786
|
* 当因权限问题自动播放失败时,禁用sdk自带的播放弹窗,手动处理
|
|
711
787
|
*/
|
|
712
788
|
disableAutoPlayDialog?: boolean;
|
|
789
|
+
/**
|
|
790
|
+
* 音量,范围[0,1]
|
|
791
|
+
*/
|
|
792
|
+
volume?: number;
|
|
713
793
|
}
|
|
714
794
|
/**
|
|
715
795
|
* 音频发布配置
|
|
@@ -993,6 +1073,50 @@ export interface MixedAudioMediaStreamTrack extends MediaStreamTrack {
|
|
|
993
1073
|
context: AudioContext;
|
|
994
1074
|
addTrack(track: MediaStreamTrack): void;
|
|
995
1075
|
removeTrack(track: MediaStreamTrack): void;
|
|
1076
|
+
trackCount: number;
|
|
1077
|
+
}
|
|
1078
|
+
/** 画中画句柄,用于控制画中画状态 */
|
|
1079
|
+
export interface PipHandle {
|
|
1080
|
+
/** 画中画类型:document-pip 支持自定义UI,video-pip 为传统模式 */
|
|
1081
|
+
type: "document-pip" | "video-pip";
|
|
1082
|
+
/** Document PiP 模式下的 window 引用,可用于添加自定义控件 */
|
|
1083
|
+
pipWindow?: Window;
|
|
1084
|
+
/** 退出画中画 */
|
|
1085
|
+
exit(): Promise<void>;
|
|
1086
|
+
}
|
|
1087
|
+
/** 画中画配置选项 */
|
|
1088
|
+
export interface PipOptions {
|
|
1089
|
+
/** 画中画窗口宽度 */
|
|
1090
|
+
width?: number;
|
|
1091
|
+
/** 画中画窗口高度 */
|
|
1092
|
+
height?: number;
|
|
1093
|
+
/** 是否优先使用 Document PiP(支持自定义UI),默认true */
|
|
1094
|
+
preferDocumentPip?: boolean;
|
|
1095
|
+
/**
|
|
1096
|
+
* 是否隐藏原始播放视图,默认true
|
|
1097
|
+
* 仅在 Document PiP 生效,传统 video PiP 使用的就是原 video 元素,不能隐藏
|
|
1098
|
+
*/
|
|
1099
|
+
hideOriginView?: boolean;
|
|
1100
|
+
}
|
|
1101
|
+
/** 弹出窗口句柄,用于控制弹出窗口 */
|
|
1102
|
+
export interface PopOutHandle {
|
|
1103
|
+
/** 弹出窗口的 window 引用 */
|
|
1104
|
+
window: Window;
|
|
1105
|
+
/** 将视频回收到主页面指定容器 */
|
|
1106
|
+
moveBack(container: HTMLElement): void;
|
|
1107
|
+
/** 关闭弹出窗口 */
|
|
1108
|
+
close(): void;
|
|
1109
|
+
}
|
|
1110
|
+
/** 弹出窗口配置选项 */
|
|
1111
|
+
export interface PopOutOptions {
|
|
1112
|
+
/** 弹出窗口宽度,默认640 */
|
|
1113
|
+
width?: number;
|
|
1114
|
+
/** 弹出窗口高度,默认480 */
|
|
1115
|
+
height?: number;
|
|
1116
|
+
/** 弹出窗口标题 */
|
|
1117
|
+
title?: string;
|
|
1118
|
+
/** 是否隐藏原始播放视图,默认true */
|
|
1119
|
+
hideOriginView?: boolean;
|
|
996
1120
|
}
|
|
997
1121
|
/**
|
|
998
1122
|
* 属性更改项
|