@seastart/srtc-web-sdk 0.1.2 → 0.1.4
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 +85 -2
- package/srtc.d.ts +85 -2
- 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
|
*/
|
|
@@ -271,7 +306,7 @@ export declare class LocalMicTrack extends LocalAudioTrack {
|
|
|
271
306
|
/**
|
|
272
307
|
* 停止采集
|
|
273
308
|
*/
|
|
274
|
-
stopCapture():
|
|
309
|
+
stopCapture(): void;
|
|
275
310
|
/**
|
|
276
311
|
* 切换麦克风
|
|
277
312
|
* @param deviceId
|
|
@@ -370,6 +405,7 @@ export declare class SRTC extends BaseSRTC {
|
|
|
370
405
|
protected getStoredDeviceId(): string;
|
|
371
406
|
protected getDeviceType(): DeviceType;
|
|
372
407
|
constructor(initParams: SdkInitParams);
|
|
408
|
+
protected postLeave(): void;
|
|
373
409
|
leave(): Promise<void>;
|
|
374
410
|
/**
|
|
375
411
|
* 获取设备列表
|
|
@@ -525,6 +561,19 @@ export declare enum DisconnectReason {
|
|
|
525
561
|
/** 频道销毁离开 */
|
|
526
562
|
Destroy = 5
|
|
527
563
|
}
|
|
564
|
+
/**
|
|
565
|
+
* 用户断开im的原因
|
|
566
|
+
*/
|
|
567
|
+
export declare enum ImDisconnectReason {
|
|
568
|
+
/** 错误 */
|
|
569
|
+
Error = -1,
|
|
570
|
+
/** 主动离开 */
|
|
571
|
+
Self = 1,
|
|
572
|
+
/** 被踢离开 */
|
|
573
|
+
Kicked = 2,
|
|
574
|
+
/** 心跳超时离开 */
|
|
575
|
+
Timeout = 4
|
|
576
|
+
}
|
|
528
577
|
/**
|
|
529
578
|
* 日志打印等级
|
|
530
579
|
*/
|
|
@@ -677,6 +726,15 @@ export interface DisconnectEventData {
|
|
|
677
726
|
/** 错误 */
|
|
678
727
|
error?: any;
|
|
679
728
|
}
|
|
729
|
+
/**
|
|
730
|
+
* 启用im选项
|
|
731
|
+
*/
|
|
732
|
+
export interface EnableImParams {
|
|
733
|
+
/** 线路号 */
|
|
734
|
+
netID: string;
|
|
735
|
+
/** 服务器分组id */
|
|
736
|
+
sgID: string;
|
|
737
|
+
}
|
|
680
738
|
/**
|
|
681
739
|
* web环境详情
|
|
682
740
|
*/
|
|
@@ -762,6 +820,30 @@ export interface EnvWebInfo extends Bowser$1.Parser.ParsedResult {
|
|
|
762
820
|
*/
|
|
763
821
|
devicePixelRatio: number;
|
|
764
822
|
}
|
|
823
|
+
/**
|
|
824
|
+
* im强制断开事件data
|
|
825
|
+
*/
|
|
826
|
+
export interface ImDisconnectEventData {
|
|
827
|
+
/** 断开原因 */
|
|
828
|
+
reason: ImDisconnectReason;
|
|
829
|
+
/** 错误 */
|
|
830
|
+
error?: any;
|
|
831
|
+
}
|
|
832
|
+
/**
|
|
833
|
+
* im频道外消息
|
|
834
|
+
*/
|
|
835
|
+
export interface ImMsgData {
|
|
836
|
+
/** 消息命令 */
|
|
837
|
+
action: string;
|
|
838
|
+
/** 消息体 */
|
|
839
|
+
content: any;
|
|
840
|
+
/** 发送者im会话id */
|
|
841
|
+
sid: string;
|
|
842
|
+
/** 发送者ID */
|
|
843
|
+
uid: string;
|
|
844
|
+
/** 发送者昵称 */
|
|
845
|
+
name: string;
|
|
846
|
+
}
|
|
765
847
|
/**
|
|
766
848
|
* 加入频道选项
|
|
767
849
|
*/
|
|
@@ -999,5 +1081,6 @@ export {
|
|
|
999
1081
|
BaseChannelInfo as ChannelInfo,
|
|
1000
1082
|
BaseTrackInfo as TrackInfo,
|
|
1001
1083
|
BaseUserInfo as UserInfo,
|
|
1084
|
+
CommonImEventType as ImEventType,
|
|
1002
1085
|
};
|
|
1003
1086
|
|
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
|
*/
|
|
@@ -271,7 +306,7 @@ export declare class LocalMicTrack extends LocalAudioTrack {
|
|
|
271
306
|
/**
|
|
272
307
|
* 停止采集
|
|
273
308
|
*/
|
|
274
|
-
stopCapture():
|
|
309
|
+
stopCapture(): void;
|
|
275
310
|
/**
|
|
276
311
|
* 切换麦克风
|
|
277
312
|
* @param deviceId
|
|
@@ -370,6 +405,7 @@ export declare class SRTC extends BaseSRTC {
|
|
|
370
405
|
protected getStoredDeviceId(): string;
|
|
371
406
|
protected getDeviceType(): DeviceType;
|
|
372
407
|
constructor(initParams: SdkInitParams);
|
|
408
|
+
protected postLeave(): void;
|
|
373
409
|
leave(): Promise<void>;
|
|
374
410
|
/**
|
|
375
411
|
* 获取设备列表
|
|
@@ -525,6 +561,19 @@ export declare enum DisconnectReason {
|
|
|
525
561
|
/** 频道销毁离开 */
|
|
526
562
|
Destroy = 5
|
|
527
563
|
}
|
|
564
|
+
/**
|
|
565
|
+
* 用户断开im的原因
|
|
566
|
+
*/
|
|
567
|
+
export declare enum ImDisconnectReason {
|
|
568
|
+
/** 错误 */
|
|
569
|
+
Error = -1,
|
|
570
|
+
/** 主动离开 */
|
|
571
|
+
Self = 1,
|
|
572
|
+
/** 被踢离开 */
|
|
573
|
+
Kicked = 2,
|
|
574
|
+
/** 心跳超时离开 */
|
|
575
|
+
Timeout = 4
|
|
576
|
+
}
|
|
528
577
|
/**
|
|
529
578
|
* 日志打印等级
|
|
530
579
|
*/
|
|
@@ -677,6 +726,15 @@ export interface DisconnectEventData {
|
|
|
677
726
|
/** 错误 */
|
|
678
727
|
error?: any;
|
|
679
728
|
}
|
|
729
|
+
/**
|
|
730
|
+
* 启用im选项
|
|
731
|
+
*/
|
|
732
|
+
export interface EnableImParams {
|
|
733
|
+
/** 线路号 */
|
|
734
|
+
netID: string;
|
|
735
|
+
/** 服务器分组id */
|
|
736
|
+
sgID: string;
|
|
737
|
+
}
|
|
680
738
|
/**
|
|
681
739
|
* web环境详情
|
|
682
740
|
*/
|
|
@@ -762,6 +820,30 @@ export interface EnvWebInfo extends Bowser$1.Parser.ParsedResult {
|
|
|
762
820
|
*/
|
|
763
821
|
devicePixelRatio: number;
|
|
764
822
|
}
|
|
823
|
+
/**
|
|
824
|
+
* im强制断开事件data
|
|
825
|
+
*/
|
|
826
|
+
export interface ImDisconnectEventData {
|
|
827
|
+
/** 断开原因 */
|
|
828
|
+
reason: ImDisconnectReason;
|
|
829
|
+
/** 错误 */
|
|
830
|
+
error?: any;
|
|
831
|
+
}
|
|
832
|
+
/**
|
|
833
|
+
* im频道外消息
|
|
834
|
+
*/
|
|
835
|
+
export interface ImMsgData {
|
|
836
|
+
/** 消息命令 */
|
|
837
|
+
action: string;
|
|
838
|
+
/** 消息体 */
|
|
839
|
+
content: any;
|
|
840
|
+
/** 发送者im会话id */
|
|
841
|
+
sid: string;
|
|
842
|
+
/** 发送者ID */
|
|
843
|
+
uid: string;
|
|
844
|
+
/** 发送者昵称 */
|
|
845
|
+
name: string;
|
|
846
|
+
}
|
|
765
847
|
/**
|
|
766
848
|
* 加入频道选项
|
|
767
849
|
*/
|
|
@@ -999,5 +1081,6 @@ export {
|
|
|
999
1081
|
BaseChannelInfo as ChannelInfo,
|
|
1000
1082
|
BaseTrackInfo as TrackInfo,
|
|
1001
1083
|
BaseUserInfo as UserInfo,
|
|
1084
|
+
CommonImEventType as ImEventType,
|
|
1002
1085
|
};
|
|
1003
1086
|
|