@seastart/srtc-web-sdk 0.1.2 → 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 +83 -1
- package/srtc.d.ts +83 -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信息
|
|
@@ -73,6 +77,16 @@ declare abstract class BaseSRTC {
|
|
|
73
77
|
* @param desc 流描述,与id二选一
|
|
74
78
|
*/
|
|
75
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>;
|
|
76
90
|
}
|
|
77
91
|
declare abstract class BaseTrack extends EventEmitter {
|
|
78
92
|
constructor(info: BaseTrackInfo, uid: string);
|
|
@@ -139,6 +153,19 @@ declare class CommonChannelEventType {
|
|
|
139
153
|
/** 流轨道停止,对应data为BaseTrack */
|
|
140
154
|
static readonly TRACK_ENDED = "track_ended";
|
|
141
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
|
+
}
|
|
142
169
|
declare class Logger {
|
|
143
170
|
constructor(dp?: string, dclt?: string);
|
|
144
171
|
setTarget(target: LogTarget): void;
|
|
@@ -214,6 +241,14 @@ export declare class ChannelEventType extends CommonChannelEventType {
|
|
|
214
241
|
/** 轨道自动播放失败,对应data为BaseTrack */
|
|
215
242
|
static readonly TRACK_AUTOPLAY_FAIL = "track_autoplay_fail";
|
|
216
243
|
}
|
|
244
|
+
/** 频道外事件通知 */
|
|
245
|
+
export declare class ImEvent {
|
|
246
|
+
/** 事件类型 */
|
|
247
|
+
type: CommonImEventType;
|
|
248
|
+
/** 事件携带的数据 */
|
|
249
|
+
data?: any;
|
|
250
|
+
constructor(type: CommonImEventType, data?: any);
|
|
251
|
+
}
|
|
217
252
|
/**
|
|
218
253
|
* 本地音频流轨道
|
|
219
254
|
*/
|
|
@@ -525,6 +560,19 @@ export declare enum DisconnectReason {
|
|
|
525
560
|
/** 频道销毁离开 */
|
|
526
561
|
Destroy = 5
|
|
527
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
|
+
}
|
|
528
576
|
/**
|
|
529
577
|
* 日志打印等级
|
|
530
578
|
*/
|
|
@@ -677,6 +725,15 @@ export interface DisconnectEventData {
|
|
|
677
725
|
/** 错误 */
|
|
678
726
|
error?: any;
|
|
679
727
|
}
|
|
728
|
+
/**
|
|
729
|
+
* 启用im选项
|
|
730
|
+
*/
|
|
731
|
+
export interface EnableImParams {
|
|
732
|
+
/** 线路号 */
|
|
733
|
+
netID: string;
|
|
734
|
+
/** 服务器分组id */
|
|
735
|
+
sgID: string;
|
|
736
|
+
}
|
|
680
737
|
/**
|
|
681
738
|
* web环境详情
|
|
682
739
|
*/
|
|
@@ -762,6 +819,30 @@ export interface EnvWebInfo extends Bowser$1.Parser.ParsedResult {
|
|
|
762
819
|
*/
|
|
763
820
|
devicePixelRatio: number;
|
|
764
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
|
+
}
|
|
765
846
|
/**
|
|
766
847
|
* 加入频道选项
|
|
767
848
|
*/
|
|
@@ -999,5 +1080,6 @@ export {
|
|
|
999
1080
|
BaseChannelInfo as ChannelInfo,
|
|
1000
1081
|
BaseTrackInfo as TrackInfo,
|
|
1001
1082
|
BaseUserInfo as UserInfo,
|
|
1083
|
+
CommonImEventType as ImEventType,
|
|
1002
1084
|
};
|
|
1003
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信息
|
|
@@ -73,6 +77,16 @@ declare abstract class BaseSRTC {
|
|
|
73
77
|
* @param desc 流描述,与id二选一
|
|
74
78
|
*/
|
|
75
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>;
|
|
76
90
|
}
|
|
77
91
|
declare abstract class BaseTrack extends EventEmitter {
|
|
78
92
|
constructor(info: BaseTrackInfo, uid: string);
|
|
@@ -139,6 +153,19 @@ declare class CommonChannelEventType {
|
|
|
139
153
|
/** 流轨道停止,对应data为BaseTrack */
|
|
140
154
|
static readonly TRACK_ENDED = "track_ended";
|
|
141
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
|
+
}
|
|
142
169
|
declare class Logger {
|
|
143
170
|
constructor(dp?: string, dclt?: string);
|
|
144
171
|
setTarget(target: LogTarget): void;
|
|
@@ -214,6 +241,14 @@ export declare class ChannelEventType extends CommonChannelEventType {
|
|
|
214
241
|
/** 轨道自动播放失败,对应data为BaseTrack */
|
|
215
242
|
static readonly TRACK_AUTOPLAY_FAIL = "track_autoplay_fail";
|
|
216
243
|
}
|
|
244
|
+
/** 频道外事件通知 */
|
|
245
|
+
export declare class ImEvent {
|
|
246
|
+
/** 事件类型 */
|
|
247
|
+
type: CommonImEventType;
|
|
248
|
+
/** 事件携带的数据 */
|
|
249
|
+
data?: any;
|
|
250
|
+
constructor(type: CommonImEventType, data?: any);
|
|
251
|
+
}
|
|
217
252
|
/**
|
|
218
253
|
* 本地音频流轨道
|
|
219
254
|
*/
|
|
@@ -525,6 +560,19 @@ export declare enum DisconnectReason {
|
|
|
525
560
|
/** 频道销毁离开 */
|
|
526
561
|
Destroy = 5
|
|
527
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
|
+
}
|
|
528
576
|
/**
|
|
529
577
|
* 日志打印等级
|
|
530
578
|
*/
|
|
@@ -677,6 +725,15 @@ export interface DisconnectEventData {
|
|
|
677
725
|
/** 错误 */
|
|
678
726
|
error?: any;
|
|
679
727
|
}
|
|
728
|
+
/**
|
|
729
|
+
* 启用im选项
|
|
730
|
+
*/
|
|
731
|
+
export interface EnableImParams {
|
|
732
|
+
/** 线路号 */
|
|
733
|
+
netID: string;
|
|
734
|
+
/** 服务器分组id */
|
|
735
|
+
sgID: string;
|
|
736
|
+
}
|
|
680
737
|
/**
|
|
681
738
|
* web环境详情
|
|
682
739
|
*/
|
|
@@ -762,6 +819,30 @@ export interface EnvWebInfo extends Bowser$1.Parser.ParsedResult {
|
|
|
762
819
|
*/
|
|
763
820
|
devicePixelRatio: number;
|
|
764
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
|
+
}
|
|
765
846
|
/**
|
|
766
847
|
* 加入频道选项
|
|
767
848
|
*/
|
|
@@ -999,5 +1080,6 @@ export {
|
|
|
999
1080
|
BaseChannelInfo as ChannelInfo,
|
|
1000
1081
|
BaseTrackInfo as TrackInfo,
|
|
1001
1082
|
BaseUserInfo as UserInfo,
|
|
1083
|
+
CommonImEventType as ImEventType,
|
|
1002
1084
|
};
|
|
1003
1085
|
|