@seastart/srtc-web-sdk 0.1.1 → 0.1.3
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 +91 -1
- package/srtc.d.ts +91 -1
- package/srtc.js +1 -1
- package/srtc.mjs +1 -1
package/package.json
CHANGED
package/srtc.d.mts
CHANGED
|
@@ -10,11 +10,15 @@ declare abstract class BaseSRTC {
|
|
|
10
10
|
* 获取运行环境信息
|
|
11
11
|
* @returns
|
|
12
12
|
*/
|
|
13
|
-
getEnvInfo(): any;
|
|
13
|
+
abstract getEnvInfo(): any;
|
|
14
14
|
/**
|
|
15
15
|
* 频道事件通知回调
|
|
16
16
|
*/
|
|
17
17
|
onNotifyChannelEvent?: ((event: ChannelEvent) => void) | null;
|
|
18
|
+
/**
|
|
19
|
+
* 频道外im事件通知回调
|
|
20
|
+
*/
|
|
21
|
+
onNotifyImEvent?: ((event: ImEvent) => void) | null;
|
|
18
22
|
constructor(initParams: SdkInitParams);
|
|
19
23
|
/**
|
|
20
24
|
* 加入频道的version信息
|
|
@@ -66,6 +70,23 @@ declare abstract class BaseSRTC {
|
|
|
66
70
|
* 取消订阅远端流
|
|
67
71
|
*/
|
|
68
72
|
unsubscribeRemoteTrack(track: BaseTrack): Promise<void>;
|
|
73
|
+
/**
|
|
74
|
+
* 获取远端用户音视频流实例,一般用于订阅流后您没有持有返回的流实例,可以用此方法获取对应实例
|
|
75
|
+
* @param uid 用户id
|
|
76
|
+
* @param id 流轨道id,与desc二选一
|
|
77
|
+
* @param desc 流描述,与id二选一
|
|
78
|
+
*/
|
|
79
|
+
getRemoteTrack(uid: string, id?: string, desc?: string): BaseTrack;
|
|
80
|
+
/**
|
|
81
|
+
* 启用频道外消息
|
|
82
|
+
* @param token 启用频道外消息token
|
|
83
|
+
* @returns im会话sid
|
|
84
|
+
*/
|
|
85
|
+
enableIm(token: string, params?: EnableImParams): Promise<string>;
|
|
86
|
+
/**
|
|
87
|
+
* 关闭频道外消息
|
|
88
|
+
*/
|
|
89
|
+
disableIm(): Promise<void>;
|
|
69
90
|
}
|
|
70
91
|
declare abstract class BaseTrack extends EventEmitter {
|
|
71
92
|
constructor(info: BaseTrackInfo, uid: string);
|
|
@@ -132,6 +153,19 @@ declare class CommonChannelEventType {
|
|
|
132
153
|
/** 流轨道停止,对应data为BaseTrack */
|
|
133
154
|
static readonly TRACK_ENDED = "track_ended";
|
|
134
155
|
}
|
|
156
|
+
/** 频道外事件类型 */
|
|
157
|
+
declare class CommonImEventType {
|
|
158
|
+
/** 首次连接im成功,无data */
|
|
159
|
+
static readonly ENABLE_SUCCEED = "enable_succeed";
|
|
160
|
+
/** im开始断线自动重连,无data */
|
|
161
|
+
static readonly RECONNECTING = "reconnecting";
|
|
162
|
+
/** im重连成功,断线重连成功后会触发 */
|
|
163
|
+
static readonly RECONNECTED = "reconnected";
|
|
164
|
+
/** 自己被强制断开im,对应data为ImDisconnectEventData */
|
|
165
|
+
static readonly DISCONNECTED = "disconnected";
|
|
166
|
+
/** im消息,对应data为ImMsgData */
|
|
167
|
+
static readonly IM_MSG = "im_msg";
|
|
168
|
+
}
|
|
135
169
|
declare class Logger {
|
|
136
170
|
constructor(dp?: string, dclt?: string);
|
|
137
171
|
setTarget(target: LogTarget): void;
|
|
@@ -207,6 +241,14 @@ export declare class ChannelEventType extends CommonChannelEventType {
|
|
|
207
241
|
/** 轨道自动播放失败,对应data为BaseTrack */
|
|
208
242
|
static readonly TRACK_AUTOPLAY_FAIL = "track_autoplay_fail";
|
|
209
243
|
}
|
|
244
|
+
/** 频道外事件通知 */
|
|
245
|
+
export declare class ImEvent {
|
|
246
|
+
/** 事件类型 */
|
|
247
|
+
type: CommonImEventType;
|
|
248
|
+
/** 事件携带的数据 */
|
|
249
|
+
data?: any;
|
|
250
|
+
constructor(type: CommonImEventType, data?: any);
|
|
251
|
+
}
|
|
210
252
|
/**
|
|
211
253
|
* 本地音频流轨道
|
|
212
254
|
*/
|
|
@@ -425,6 +467,7 @@ export declare class SRTC extends BaseSRTC {
|
|
|
425
467
|
* 取消订阅远端流
|
|
426
468
|
*/
|
|
427
469
|
unsubscribeRemoteTrack(track: RemoteAudioMixTrack | RemoteAudioTrack | RemoteVideoTrack): Promise<void>;
|
|
470
|
+
getRemoteTrack(uid: string, id?: string, desc?: string): RemoteAudioTrack | RemoteVideoTrack;
|
|
428
471
|
}
|
|
429
472
|
/**
|
|
430
473
|
* 摄像头预设参数
|
|
@@ -517,6 +560,19 @@ export declare enum DisconnectReason {
|
|
|
517
560
|
/** 频道销毁离开 */
|
|
518
561
|
Destroy = 5
|
|
519
562
|
}
|
|
563
|
+
/**
|
|
564
|
+
* 用户断开im的原因
|
|
565
|
+
*/
|
|
566
|
+
export declare enum ImDisconnectReason {
|
|
567
|
+
/** 错误 */
|
|
568
|
+
Error = -1,
|
|
569
|
+
/** 主动离开 */
|
|
570
|
+
Self = 1,
|
|
571
|
+
/** 被踢离开 */
|
|
572
|
+
Kicked = 2,
|
|
573
|
+
/** 心跳超时离开 */
|
|
574
|
+
Timeout = 4
|
|
575
|
+
}
|
|
520
576
|
/**
|
|
521
577
|
* 日志打印等级
|
|
522
578
|
*/
|
|
@@ -669,6 +725,15 @@ export interface DisconnectEventData {
|
|
|
669
725
|
/** 错误 */
|
|
670
726
|
error?: any;
|
|
671
727
|
}
|
|
728
|
+
/**
|
|
729
|
+
* 启用im选项
|
|
730
|
+
*/
|
|
731
|
+
export interface EnableImParams {
|
|
732
|
+
/** 线路号 */
|
|
733
|
+
netID: string;
|
|
734
|
+
/** 服务器分组id */
|
|
735
|
+
sgID: string;
|
|
736
|
+
}
|
|
672
737
|
/**
|
|
673
738
|
* web环境详情
|
|
674
739
|
*/
|
|
@@ -754,6 +819,30 @@ export interface EnvWebInfo extends Bowser$1.Parser.ParsedResult {
|
|
|
754
819
|
*/
|
|
755
820
|
devicePixelRatio: number;
|
|
756
821
|
}
|
|
822
|
+
/**
|
|
823
|
+
* im强制断开事件data
|
|
824
|
+
*/
|
|
825
|
+
export interface ImDisconnectEventData {
|
|
826
|
+
/** 断开原因 */
|
|
827
|
+
reason: ImDisconnectReason;
|
|
828
|
+
/** 错误 */
|
|
829
|
+
error?: any;
|
|
830
|
+
}
|
|
831
|
+
/**
|
|
832
|
+
* im频道外消息
|
|
833
|
+
*/
|
|
834
|
+
export interface ImMsgData {
|
|
835
|
+
/** 消息命令 */
|
|
836
|
+
action: string;
|
|
837
|
+
/** 消息体 */
|
|
838
|
+
content: any;
|
|
839
|
+
/** 发送者im会话id */
|
|
840
|
+
sid: string;
|
|
841
|
+
/** 发送者ID */
|
|
842
|
+
uid: string;
|
|
843
|
+
/** 发送者昵称 */
|
|
844
|
+
name: string;
|
|
845
|
+
}
|
|
757
846
|
/**
|
|
758
847
|
* 加入频道选项
|
|
759
848
|
*/
|
|
@@ -991,5 +1080,6 @@ export {
|
|
|
991
1080
|
BaseChannelInfo as ChannelInfo,
|
|
992
1081
|
BaseTrackInfo as TrackInfo,
|
|
993
1082
|
BaseUserInfo as UserInfo,
|
|
1083
|
+
CommonImEventType as ImEventType,
|
|
994
1084
|
};
|
|
995
1085
|
|
package/srtc.d.ts
CHANGED
|
@@ -10,11 +10,15 @@ declare abstract class BaseSRTC {
|
|
|
10
10
|
* 获取运行环境信息
|
|
11
11
|
* @returns
|
|
12
12
|
*/
|
|
13
|
-
getEnvInfo(): any;
|
|
13
|
+
abstract getEnvInfo(): any;
|
|
14
14
|
/**
|
|
15
15
|
* 频道事件通知回调
|
|
16
16
|
*/
|
|
17
17
|
onNotifyChannelEvent?: ((event: ChannelEvent) => void) | null;
|
|
18
|
+
/**
|
|
19
|
+
* 频道外im事件通知回调
|
|
20
|
+
*/
|
|
21
|
+
onNotifyImEvent?: ((event: ImEvent) => void) | null;
|
|
18
22
|
constructor(initParams: SdkInitParams);
|
|
19
23
|
/**
|
|
20
24
|
* 加入频道的version信息
|
|
@@ -66,6 +70,23 @@ declare abstract class BaseSRTC {
|
|
|
66
70
|
* 取消订阅远端流
|
|
67
71
|
*/
|
|
68
72
|
unsubscribeRemoteTrack(track: BaseTrack): Promise<void>;
|
|
73
|
+
/**
|
|
74
|
+
* 获取远端用户音视频流实例,一般用于订阅流后您没有持有返回的流实例,可以用此方法获取对应实例
|
|
75
|
+
* @param uid 用户id
|
|
76
|
+
* @param id 流轨道id,与desc二选一
|
|
77
|
+
* @param desc 流描述,与id二选一
|
|
78
|
+
*/
|
|
79
|
+
getRemoteTrack(uid: string, id?: string, desc?: string): BaseTrack;
|
|
80
|
+
/**
|
|
81
|
+
* 启用频道外消息
|
|
82
|
+
* @param token 启用频道外消息token
|
|
83
|
+
* @returns im会话sid
|
|
84
|
+
*/
|
|
85
|
+
enableIm(token: string, params?: EnableImParams): Promise<string>;
|
|
86
|
+
/**
|
|
87
|
+
* 关闭频道外消息
|
|
88
|
+
*/
|
|
89
|
+
disableIm(): Promise<void>;
|
|
69
90
|
}
|
|
70
91
|
declare abstract class BaseTrack extends EventEmitter {
|
|
71
92
|
constructor(info: BaseTrackInfo, uid: string);
|
|
@@ -132,6 +153,19 @@ declare class CommonChannelEventType {
|
|
|
132
153
|
/** 流轨道停止,对应data为BaseTrack */
|
|
133
154
|
static readonly TRACK_ENDED = "track_ended";
|
|
134
155
|
}
|
|
156
|
+
/** 频道外事件类型 */
|
|
157
|
+
declare class CommonImEventType {
|
|
158
|
+
/** 首次连接im成功,无data */
|
|
159
|
+
static readonly ENABLE_SUCCEED = "enable_succeed";
|
|
160
|
+
/** im开始断线自动重连,无data */
|
|
161
|
+
static readonly RECONNECTING = "reconnecting";
|
|
162
|
+
/** im重连成功,断线重连成功后会触发 */
|
|
163
|
+
static readonly RECONNECTED = "reconnected";
|
|
164
|
+
/** 自己被强制断开im,对应data为ImDisconnectEventData */
|
|
165
|
+
static readonly DISCONNECTED = "disconnected";
|
|
166
|
+
/** im消息,对应data为ImMsgData */
|
|
167
|
+
static readonly IM_MSG = "im_msg";
|
|
168
|
+
}
|
|
135
169
|
declare class Logger {
|
|
136
170
|
constructor(dp?: string, dclt?: string);
|
|
137
171
|
setTarget(target: LogTarget): void;
|
|
@@ -207,6 +241,14 @@ export declare class ChannelEventType extends CommonChannelEventType {
|
|
|
207
241
|
/** 轨道自动播放失败,对应data为BaseTrack */
|
|
208
242
|
static readonly TRACK_AUTOPLAY_FAIL = "track_autoplay_fail";
|
|
209
243
|
}
|
|
244
|
+
/** 频道外事件通知 */
|
|
245
|
+
export declare class ImEvent {
|
|
246
|
+
/** 事件类型 */
|
|
247
|
+
type: CommonImEventType;
|
|
248
|
+
/** 事件携带的数据 */
|
|
249
|
+
data?: any;
|
|
250
|
+
constructor(type: CommonImEventType, data?: any);
|
|
251
|
+
}
|
|
210
252
|
/**
|
|
211
253
|
* 本地音频流轨道
|
|
212
254
|
*/
|
|
@@ -425,6 +467,7 @@ export declare class SRTC extends BaseSRTC {
|
|
|
425
467
|
* 取消订阅远端流
|
|
426
468
|
*/
|
|
427
469
|
unsubscribeRemoteTrack(track: RemoteAudioMixTrack | RemoteAudioTrack | RemoteVideoTrack): Promise<void>;
|
|
470
|
+
getRemoteTrack(uid: string, id?: string, desc?: string): RemoteAudioTrack | RemoteVideoTrack;
|
|
428
471
|
}
|
|
429
472
|
/**
|
|
430
473
|
* 摄像头预设参数
|
|
@@ -517,6 +560,19 @@ export declare enum DisconnectReason {
|
|
|
517
560
|
/** 频道销毁离开 */
|
|
518
561
|
Destroy = 5
|
|
519
562
|
}
|
|
563
|
+
/**
|
|
564
|
+
* 用户断开im的原因
|
|
565
|
+
*/
|
|
566
|
+
export declare enum ImDisconnectReason {
|
|
567
|
+
/** 错误 */
|
|
568
|
+
Error = -1,
|
|
569
|
+
/** 主动离开 */
|
|
570
|
+
Self = 1,
|
|
571
|
+
/** 被踢离开 */
|
|
572
|
+
Kicked = 2,
|
|
573
|
+
/** 心跳超时离开 */
|
|
574
|
+
Timeout = 4
|
|
575
|
+
}
|
|
520
576
|
/**
|
|
521
577
|
* 日志打印等级
|
|
522
578
|
*/
|
|
@@ -669,6 +725,15 @@ export interface DisconnectEventData {
|
|
|
669
725
|
/** 错误 */
|
|
670
726
|
error?: any;
|
|
671
727
|
}
|
|
728
|
+
/**
|
|
729
|
+
* 启用im选项
|
|
730
|
+
*/
|
|
731
|
+
export interface EnableImParams {
|
|
732
|
+
/** 线路号 */
|
|
733
|
+
netID: string;
|
|
734
|
+
/** 服务器分组id */
|
|
735
|
+
sgID: string;
|
|
736
|
+
}
|
|
672
737
|
/**
|
|
673
738
|
* web环境详情
|
|
674
739
|
*/
|
|
@@ -754,6 +819,30 @@ export interface EnvWebInfo extends Bowser$1.Parser.ParsedResult {
|
|
|
754
819
|
*/
|
|
755
820
|
devicePixelRatio: number;
|
|
756
821
|
}
|
|
822
|
+
/**
|
|
823
|
+
* im强制断开事件data
|
|
824
|
+
*/
|
|
825
|
+
export interface ImDisconnectEventData {
|
|
826
|
+
/** 断开原因 */
|
|
827
|
+
reason: ImDisconnectReason;
|
|
828
|
+
/** 错误 */
|
|
829
|
+
error?: any;
|
|
830
|
+
}
|
|
831
|
+
/**
|
|
832
|
+
* im频道外消息
|
|
833
|
+
*/
|
|
834
|
+
export interface ImMsgData {
|
|
835
|
+
/** 消息命令 */
|
|
836
|
+
action: string;
|
|
837
|
+
/** 消息体 */
|
|
838
|
+
content: any;
|
|
839
|
+
/** 发送者im会话id */
|
|
840
|
+
sid: string;
|
|
841
|
+
/** 发送者ID */
|
|
842
|
+
uid: string;
|
|
843
|
+
/** 发送者昵称 */
|
|
844
|
+
name: string;
|
|
845
|
+
}
|
|
757
846
|
/**
|
|
758
847
|
* 加入频道选项
|
|
759
848
|
*/
|
|
@@ -991,5 +1080,6 @@ export {
|
|
|
991
1080
|
BaseChannelInfo as ChannelInfo,
|
|
992
1081
|
BaseTrackInfo as TrackInfo,
|
|
993
1082
|
BaseUserInfo as UserInfo,
|
|
1083
|
+
CommonImEventType as ImEventType,
|
|
994
1084
|
};
|
|
995
1085
|
|