@realsee/live 0.6.14 → 0.7.0
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/README.md +50 -55
- package/dist/index.cjs.js +89 -24
- package/dist/index.d.cts +1336 -0
- package/dist/index.d.ts +1336 -4
- package/dist/index.esm.js +30 -0
- package/docs/README.md +435 -0
- package/docs/classes/BrowserRTC.md +436 -0
- package/docs/classes/BrowserRTC4Chime.md +558 -0
- package/docs/classes/CoreRTC.md +448 -0
- package/docs/classes/Live.md +797 -0
- package/docs/classes/Subscribe.md +211 -0
- package/docs/classes/VRWebViewRTC.md +436 -0
- package/docs/enumerations/BuiltInRTCType.md +27 -0
- package/docs/enumerations/BuiltinActionType.md +81 -0
- package/docs/enumerations/BuiltinEventType.md +33 -0
- package/docs/enumerations/Command.md +107 -0
- package/docs/enumerations/LiveState.md +53 -0
- package/docs/enumerations/MemUserStatus.md +67 -0
- package/docs/enumerations/MicroStatus.md +33 -0
- package/docs/enumerations/RTCJoinedInfoCodeEnum.md +69 -0
- package/docs/enumerations/RTCType.md +39 -0
- package/docs/enumerations/UserStatus.md +45 -0
- package/docs/enumerations/WebSocketCloseError.md +117 -0
- package/docs/enumerations/WebSocketErrorType.md +77 -0
- package/docs/enumerations/WebSocketState.md +69 -0
- package/docs/functions/GetVoiceSignFn.md +27 -0
- package/docs/functions/clearLiveInstanceIfNeed.md +17 -0
- package/docs/functions/createLive.md +27 -0
- package/docs/functions/createLiveReact.md +449 -0
- package/docs/functions/parseLiveMsg.md +27 -0
- package/docs/functions/parseWSClsErr.md +21 -0
- package/docs/globals.md +77 -0
- package/docs/interfaces/AttendeeResponse.md +37 -0
- package/docs/interfaces/LiveOptions.md +246 -0
- package/docs/interfaces/MeetingResponse.md +55 -0
- package/docs/interfaces/MeetingSessionConfigurationOptions.md +93 -0
- package/docs/interfaces/Permission.md +147 -0
- package/docs/interfaces/RTCJoinedInfo.md +67 -0
- package/docs/interfaces/RTCProtocol.md +404 -0
- package/docs/interfaces/VRWebViewRTCOptions.md +41 -0
- package/docs/namespaces/SubscribeMixinType/README.md +17 -0
- package/docs/namespaces/SubscribeMixinType/interfaces/emit.md +31 -0
- package/docs/namespaces/SubscribeMixinType/interfaces/hasListener.md +25 -0
- package/docs/namespaces/SubscribeMixinType/interfaces/off.md +31 -0
- package/docs/namespaces/SubscribeMixinType/interfaces/on.md +37 -0
- package/docs/namespaces/SubscribeMixinType/interfaces/once.md +35 -0
- package/docs/type-aliases/BuiltinMsg.md +41 -0
- package/docs/type-aliases/EventMap.md +17 -0
- package/docs/type-aliases/EventType.md +19 -0
- package/docs/type-aliases/GetVoiceSign.md +15 -0
- package/docs/type-aliases/GetVoiceSignParams.md +35 -0
- package/docs/type-aliases/GetVoiceSignReturnType.md +41 -0
- package/docs/type-aliases/KeyframeEventType.md +19 -0
- package/docs/type-aliases/LiveBuiltInData.md +47 -0
- package/docs/type-aliases/LiveConnectOptions.md +47 -0
- package/docs/type-aliases/LiveEventType.md +165 -0
- package/docs/type-aliases/LiveMsg.md +53 -0
- package/docs/type-aliases/LiveProviderPropTypes.md +27 -0
- package/docs/type-aliases/RTCActionReactCallback.md +13 -0
- package/docs/type-aliases/RTCEventType.md +65 -0
- package/docs/type-aliases/ReqLiveMsg.md +45 -0
- package/docs/type-aliases/RoomInfo.md +55 -0
- package/docs/type-aliases/UserInfo.md +77 -0
- package/docs/type-aliases/UserInfoExt.md +33 -0
- package/docs/type-aliases/UserVolume.md +25 -0
- package/docs/type-aliases/WebSocketError.md +31 -0
- package/package.json +41 -31
- package/dist/index.cjs.js.map +0 -1
- package/dist/index.es.js +0 -2179
- package/dist/index.es.js.map +0 -1
- package/dist/live/controller.d.ts +0 -90
- package/dist/live/createLive.d.ts +0 -8
- package/dist/live/createLiveReact.d.ts +0 -52
- package/dist/live/live.d.ts +0 -182
- package/dist/rtc/BrowserRTC.d.ts +0 -39
- package/dist/rtc/BrowserRTC4Chime.d.ts +0 -60
- package/dist/rtc/CoreRTC.d.ts +0 -23
- package/dist/rtc/VRWebViewRTC.d.ts +0 -22
- package/dist/rtc/index.d.ts +0 -5
- package/dist/typings/chime/AttendeeResponse.d.ts +0 -5
- package/dist/typings/chime/MeetingResponse.d.ts +0 -12
- package/dist/typings/chime/MeetingSessionConfigurationOptions.d.ts +0 -16
- package/dist/typings/chime/index.d.ts +0 -3
- package/dist/typings/index.d.ts +0 -4
- package/dist/typings/live/EventType.d.ts +0 -74
- package/dist/typings/live/GetVoiceSign.d.ts +0 -17
- package/dist/typings/live/LiveConnectOptions.d.ts +0 -7
- package/dist/typings/live/LiveMsg.d.ts +0 -119
- package/dist/typings/live/LiveOptions.d.ts +0 -79
- package/dist/typings/live/LiveState.d.ts +0 -15
- package/dist/typings/live/RoomInfo.d.ts +0 -13
- package/dist/typings/live/UserInfo.d.ts +0 -103
- package/dist/typings/live/UserVolume.d.ts +0 -7
- package/dist/typings/live/WebSocket.d.ts +0 -82
- package/dist/typings/live/index.d.ts +0 -10
- package/dist/typings/react/RTCActionReactCallback.d.ts +0 -2
- package/dist/typings/react/index.d.ts +0 -1
- package/dist/typings/rtc/VRWebViewRTCOptions.d.ts +0 -6
- package/dist/typings/rtc/eventType.d.ts +0 -29
- package/dist/typings/rtc/index.d.ts +0 -5
- package/dist/typings/rtc/joinedInfo.d.ts +0 -34
- package/dist/typings/rtc/protocol.d.ts +0 -58
- package/dist/typings/rtc/type.d.ts +0 -12
- package/dist/utils/RobustWebSocket.d.ts +0 -157
- package/dist/utils/appendUri.d.ts +0 -1
- package/dist/utils/clientDetector.d.ts +0 -4
- package/dist/utils/equal.d.ts +0 -10
- package/dist/utils/logger.d.ts +0 -16
- package/dist/utils/subscribe.d.ts +0 -75
- package/dist/utils/uuid.d.ts +0 -4
- package/docs/.nojekyll +0 -1
- package/docs/assets/highlight.css +0 -120
- package/docs/assets/main.js +0 -58
- package/docs/assets/search.js +0 -1
- package/docs/assets/style.css +0 -1280
- package/docs/classes/BrowserRTC.html +0 -561
- package/docs/classes/BrowserRTC4Chime.html +0 -602
- package/docs/classes/CoreRTC.html +0 -432
- package/docs/classes/VRWebViewRTC.html +0 -448
- package/docs/enums/BuiltInRTCType.html +0 -69
- package/docs/enums/BuiltinActionType.html +0 -112
- package/docs/enums/BuiltinEventType.html +0 -76
- package/docs/enums/Command.html +0 -118
- package/docs/enums/LiveState.html +0 -89
- package/docs/enums/MemUserStatus.html +0 -97
- package/docs/enums/MicroStatus.html +0 -72
- package/docs/enums/RTCJoinedInfoCodeEnum.html +0 -94
- package/docs/enums/RTCType.html +0 -79
- package/docs/enums/UserStatus.html +0 -85
- package/docs/enums/WebSocketCloseError.html +0 -139
- package/docs/enums/WebSocketErrorType.html +0 -104
- package/docs/enums/WebSocketState.html +0 -103
- package/docs/functions/createLive.html +0 -107
- package/docs/functions/createLiveReact.html +0 -575
- package/docs/functions/parseLiveMsg.html +0 -105
- package/docs/functions/parseWSClsErr.html +0 -99
- package/docs/index.html +0 -470
- package/docs/interfaces/AttendeeResponse.html +0 -80
- package/docs/interfaces/GetVoiceSignReturnType.html +0 -90
- package/docs/interfaces/LiveOptions.html +0 -272
- package/docs/interfaces/MeetingResponse.html +0 -90
- package/docs/interfaces/MeetingSessionConfigurationOptions.html +0 -119
- package/docs/interfaces/Permission.html +0 -157
- package/docs/interfaces/RTCJoinedInfo.html +0 -104
- package/docs/interfaces/RTCProtocol.html +0 -412
- package/docs/interfaces/VRWebViewRTCOptions.html +0 -73
- package/docs/modules.html +0 -148
- package/docs/types/BuiltinMsg.html +0 -108
- package/docs/types/EventType.html +0 -97
- package/docs/types/GetVoiceSign.html +0 -124
- package/docs/types/KeyframeTypes.html +0 -97
- package/docs/types/LiveConnectOptions.html +0 -107
- package/docs/types/LiveEventType.html +0 -272
- package/docs/types/LiveMsg.html +0 -113
- package/docs/types/LiveProviderPropTypes.html +0 -102
- package/docs/types/RTCActionReactCallback.html +0 -90
- package/docs/types/RTCEventType.html +0 -155
- package/docs/types/ReqLiveMsg.html +0 -114
- package/docs/types/RoomInfo.html +0 -114
- package/docs/types/UserInfo.html +0 -135
- package/docs/types/UserInfoExt.html +0 -105
- package/docs/types/UserVolume.html +0 -99
- package/docs/types/WebSocketError.html +0 -101
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { JSBridgeProtocol } from '@realsee/jsbridge-x';
|
|
2
|
-
import { RTCProtocol } from '../rtc/protocol';
|
|
3
|
-
import { BuiltInRTCType, RTCType } from '../rtc/type';
|
|
4
|
-
import { GetVoiceSign } from './GetVoiceSign';
|
|
5
|
-
import { MicroStatus } from './LiveMsg';
|
|
6
|
-
/**
|
|
7
|
-
* 依赖配置。
|
|
8
|
-
*/
|
|
9
|
-
export interface LiveOptions {
|
|
10
|
-
/**
|
|
11
|
-
* 创建`WebSocket`所依赖的URL。
|
|
12
|
-
*/
|
|
13
|
-
url?: string;
|
|
14
|
-
/**
|
|
15
|
-
* RTC实例。
|
|
16
|
-
* 优先使用该实例。
|
|
17
|
-
*/
|
|
18
|
-
rtc?: RTCProtocol;
|
|
19
|
-
/**
|
|
20
|
-
* RTC类型
|
|
21
|
-
* rtc 为空时使用内置的rtc实例类型
|
|
22
|
-
*/
|
|
23
|
-
rtcType?: RTCType;
|
|
24
|
-
/**
|
|
25
|
-
* 麦克风初始状态
|
|
26
|
-
*/
|
|
27
|
-
initialMicroStatus?: MicroStatus;
|
|
28
|
-
/**
|
|
29
|
-
* 获取建立 WebSocket 连接的依赖Tick
|
|
30
|
-
*/
|
|
31
|
-
getTicket?: () => Promise<string>;
|
|
32
|
-
/**
|
|
33
|
-
* jsBridge实例
|
|
34
|
-
* 使用内置rtc时提供给rtc实例使用
|
|
35
|
-
*/
|
|
36
|
-
jsBridge?: JSBridgeProtocol;
|
|
37
|
-
/**
|
|
38
|
-
* 获取语音签名的接口
|
|
39
|
-
* 使用内置rtc时提供给rtc实例使用
|
|
40
|
-
*/
|
|
41
|
-
getVoiceSign?: GetVoiceSign;
|
|
42
|
-
/**
|
|
43
|
-
* 使用webRTC时会有自动播放的安全策略限制,用户有交互
|
|
44
|
-
* @param options
|
|
45
|
-
* @returns
|
|
46
|
-
*/
|
|
47
|
-
autoPlayConfirm?: (options: {
|
|
48
|
-
onConfirm: () => void;
|
|
49
|
-
}) => void;
|
|
50
|
-
/**
|
|
51
|
-
* 使用内置的rtc实例
|
|
52
|
-
*/
|
|
53
|
-
useBuiltInRTC?: boolean;
|
|
54
|
-
/**
|
|
55
|
-
* 内置的rtc通道类型
|
|
56
|
-
* trtc or chime , default trtc
|
|
57
|
-
*/
|
|
58
|
-
builtInRTCType?: BuiltInRTCType;
|
|
59
|
-
/**
|
|
60
|
-
* 使用内置的jsBridge实例
|
|
61
|
-
*/
|
|
62
|
-
useBuiltInJsBridge?: boolean;
|
|
63
|
-
/**
|
|
64
|
-
* 能否禁用某个/些用户的麦克风
|
|
65
|
-
*/
|
|
66
|
-
canForbidUserMicro?: (users: string | string[]) => boolean;
|
|
67
|
-
/**
|
|
68
|
-
* 能否限制某个/些用户的帧数据同步
|
|
69
|
-
*/
|
|
70
|
-
canForbidUserSync?: (users: string | string[]) => boolean;
|
|
71
|
-
/**
|
|
72
|
-
* 能否强制"踢掉"某个/些用户。
|
|
73
|
-
*/
|
|
74
|
-
canForbidUserKick?: (users: string | string[]) => boolean;
|
|
75
|
-
/**
|
|
76
|
-
* 是否开启调试模式:此模式下会在终端打印日志方便调试。
|
|
77
|
-
*/
|
|
78
|
-
__debug__?: boolean;
|
|
79
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export type RoomInfo = {
|
|
2
|
-
info: {
|
|
3
|
-
id: string | number;
|
|
4
|
-
status: string | number;
|
|
5
|
-
create_user_id: string;
|
|
6
|
-
app_id: string;
|
|
7
|
-
extension: Record<string, any>;
|
|
8
|
-
create_time: string;
|
|
9
|
-
room_code: string;
|
|
10
|
-
};
|
|
11
|
-
init_timestamp: string;
|
|
12
|
-
last_frame: Record<string, any>;
|
|
13
|
-
};
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 用户当前状态枚举。
|
|
3
|
-
*/
|
|
4
|
-
export declare enum UserStatus {
|
|
5
|
-
/**
|
|
6
|
-
* 正常
|
|
7
|
-
*/
|
|
8
|
-
Normal = 0,
|
|
9
|
-
/**
|
|
10
|
-
* 被移除
|
|
11
|
-
*/
|
|
12
|
-
Removed = 1,
|
|
13
|
-
/**
|
|
14
|
-
* 被替换
|
|
15
|
-
*/
|
|
16
|
-
Replaced = 2
|
|
17
|
-
}
|
|
18
|
-
export declare enum MemUserStatus {
|
|
19
|
-
WAIT_ENTER = "WAIT_ENTER",
|
|
20
|
-
ONLINE = "ONLINE",
|
|
21
|
-
LEAVE = "LEAVE",
|
|
22
|
-
KICK_OUT = "KICK_OUT",
|
|
23
|
-
BE_REPLACE = "BE_REPLACE",
|
|
24
|
-
EXCEPTION = "EXCEPTION"
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* 用户信息扩展字段:比如提供用户画像相关的数据。
|
|
28
|
-
*/
|
|
29
|
-
export type UserInfoExt = {
|
|
30
|
-
/**
|
|
31
|
-
* 用户昵称。
|
|
32
|
-
*/
|
|
33
|
-
nickname?: string;
|
|
34
|
-
/**
|
|
35
|
-
* 用户头像。
|
|
36
|
-
*/
|
|
37
|
-
avatar?: string;
|
|
38
|
-
/**
|
|
39
|
-
* 其他用户相关的字段,比如用户职称、住址、联系方式等信息。
|
|
40
|
-
*/
|
|
41
|
-
[key: string]: any;
|
|
42
|
-
};
|
|
43
|
-
/**
|
|
44
|
-
* 带看会话房间用户的信息格式。
|
|
45
|
-
*/
|
|
46
|
-
export type UserInfo = {
|
|
47
|
-
/**
|
|
48
|
-
* 用户唯一标识ID。
|
|
49
|
-
*/
|
|
50
|
-
id: string;
|
|
51
|
-
/**
|
|
52
|
-
* 用户当前的状态。
|
|
53
|
-
*/
|
|
54
|
-
status?: UserStatus;
|
|
55
|
-
/**
|
|
56
|
-
* 内存中的用户状态。
|
|
57
|
-
*/
|
|
58
|
-
mem_user_status?: MemUserStatus;
|
|
59
|
-
/**
|
|
60
|
-
* 用户当前是否开启麦克风。
|
|
61
|
-
*/
|
|
62
|
-
micro_status: boolean;
|
|
63
|
-
/**
|
|
64
|
-
* 用户角色定义。(前端不关注此字段)。
|
|
65
|
-
*/
|
|
66
|
-
user_role?: number | string;
|
|
67
|
-
/**
|
|
68
|
-
* 用户当前是否在线。
|
|
69
|
-
*/
|
|
70
|
-
current_ws_online?: boolean;
|
|
71
|
-
/**
|
|
72
|
-
* 用户曾经是否在线过,即进入房间后又由于某种原因离开后重新进入。
|
|
73
|
-
*/
|
|
74
|
-
once_ws_online?: boolean;
|
|
75
|
-
/**
|
|
76
|
-
* RTC 环境是否就绪,即当前语音是否联通。
|
|
77
|
-
*/
|
|
78
|
-
rtc: boolean;
|
|
79
|
-
/**
|
|
80
|
-
* 当前用户的权限配置。(UI层面理解)。
|
|
81
|
-
*/
|
|
82
|
-
permission?: Partial<Permission>;
|
|
83
|
-
/**
|
|
84
|
-
* 用户信息扩展字段。
|
|
85
|
-
*/
|
|
86
|
-
extension?: UserInfoExt;
|
|
87
|
-
};
|
|
88
|
-
export interface Permission {
|
|
89
|
-
more_vr_scene: boolean;
|
|
90
|
-
invite_other: boolean;
|
|
91
|
-
control_own_micro: boolean;
|
|
92
|
-
control_other_micro: boolean;
|
|
93
|
-
view_own_micro_status: boolean;
|
|
94
|
-
view_other_micro_status: boolean;
|
|
95
|
-
close_live_room: boolean;
|
|
96
|
-
apply_other_phone: boolean;
|
|
97
|
-
dynamic_enter: boolean;
|
|
98
|
-
sync_frame: boolean;
|
|
99
|
-
transfer_role: boolean;
|
|
100
|
-
change_other_status: boolean;
|
|
101
|
-
control_other_sync: boolean;
|
|
102
|
-
extension: Record<string, boolean>;
|
|
103
|
-
}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WebSocket 连接状态枚举
|
|
3
|
-
*/
|
|
4
|
-
export declare enum WebSocketState {
|
|
5
|
-
/**
|
|
6
|
-
* 尚未初始化
|
|
7
|
-
*/
|
|
8
|
-
NOTINITIALIZED = -1,
|
|
9
|
-
/**
|
|
10
|
-
* 正在链接中
|
|
11
|
-
*/
|
|
12
|
-
CONNECTING = 0,
|
|
13
|
-
/**
|
|
14
|
-
* 已经链接并且可以通讯
|
|
15
|
-
*/
|
|
16
|
-
OPEN = 1,
|
|
17
|
-
/**
|
|
18
|
-
* 连接正在关闭
|
|
19
|
-
*/
|
|
20
|
-
CLOSING = 2,
|
|
21
|
-
/**
|
|
22
|
-
* 连接已关闭或者没有链接成功
|
|
23
|
-
*/
|
|
24
|
-
CLOSED = 3
|
|
25
|
-
}
|
|
26
|
-
export type WebSocketError = {
|
|
27
|
-
type: WebSocketErrorType;
|
|
28
|
-
closeError?: WebSocketCloseError;
|
|
29
|
-
target?: Event | CloseEvent;
|
|
30
|
-
error?: any;
|
|
31
|
-
};
|
|
32
|
-
export declare enum WebSocketErrorType {
|
|
33
|
-
Error = "Error",
|
|
34
|
-
Close = "Close",
|
|
35
|
-
MicroAuth = "MicroAuth",
|
|
36
|
-
DuplicateConnect = "DuplicateConnect",
|
|
37
|
-
IllegalURL = "IllegalURL",
|
|
38
|
-
Unknown = "Unknown",
|
|
39
|
-
IllegalArgs = "IllegalArgs"
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* WebSocket 异常关闭枚举:https://developer.mozilla.org/zh-CN/docs/Web/API/CloseEvent。
|
|
43
|
-
*/
|
|
44
|
-
export declare enum WebSocketCloseError {
|
|
45
|
-
/**
|
|
46
|
-
* 正常关闭; 无论为何目的而创建,该链接都已成功完成任务。
|
|
47
|
-
*/
|
|
48
|
-
Err_1000 = "CLOSE_NORMAL",
|
|
49
|
-
/**
|
|
50
|
-
* 终端离开, 可能因为服务端错误, 也可能因为浏览器正从打开连接的页面跳转离开。
|
|
51
|
-
*/
|
|
52
|
-
Err_1001 = "CLOSE_GOING_AWAY",
|
|
53
|
-
/**
|
|
54
|
-
* 由于协议错误而中断连接。
|
|
55
|
-
*/
|
|
56
|
-
Err_1002 = "CLOSE_PROTOCOL_ERROR",
|
|
57
|
-
/**
|
|
58
|
-
* 由于接收到不允许的数据类型而断开连接 (如仅接收文本数据的终端接收到了二进制数据)。
|
|
59
|
-
*/
|
|
60
|
-
Err_1003 = "CLOSE_UNSUPPORTED",
|
|
61
|
-
/**
|
|
62
|
-
* 安全因素或WebSocket连接次数达到上限。
|
|
63
|
-
*/
|
|
64
|
-
Err_1006 = "CLOSE_ABNORMAL",
|
|
65
|
-
/**
|
|
66
|
-
* 由于收到了格式不符的数据而断开连接 (如文本消息中包含了非 UTF-8 数据)。
|
|
67
|
-
*/
|
|
68
|
-
Err_1007 = "Unsupported Data",
|
|
69
|
-
/**
|
|
70
|
-
* 由于收到不符合约定的数据而断开连接。
|
|
71
|
-
*/
|
|
72
|
-
Err_1008 = "Policy Violation",
|
|
73
|
-
/**
|
|
74
|
-
* 由于收到过大的数据帧而断开连接。
|
|
75
|
-
*/
|
|
76
|
-
Err_1009 = "CLOSE_TOO_LARGE",
|
|
77
|
-
/**
|
|
78
|
-
* 未知错误。
|
|
79
|
-
*/
|
|
80
|
-
Err_unknown = "unknown"
|
|
81
|
-
}
|
|
82
|
-
export declare function parseWSClsErr(code: number): WebSocketCloseError;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export * from './EventType';
|
|
2
|
-
export * from './GetVoiceSign';
|
|
3
|
-
export * from './LiveMsg';
|
|
4
|
-
export * from './LiveOptions';
|
|
5
|
-
export * from './LiveState';
|
|
6
|
-
export * from './LiveConnectOptions';
|
|
7
|
-
export * from './RoomInfo';
|
|
8
|
-
export * from './UserInfo';
|
|
9
|
-
export * from './UserVolume';
|
|
10
|
-
export * from './WebSocket';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './RTCActionReactCallback';
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { UserVolume } from '../live/UserVolume';
|
|
2
|
-
import { RTCJoinedInfo } from './joinedInfo';
|
|
3
|
-
/**
|
|
4
|
-
* RTC 异步事件类型。
|
|
5
|
-
*/
|
|
6
|
-
export type RTCEventType = {
|
|
7
|
-
/**
|
|
8
|
-
* 错误\异常
|
|
9
|
-
* @param error
|
|
10
|
-
*/
|
|
11
|
-
'error'(error: Error | RTCJoinedInfo): void;
|
|
12
|
-
/**
|
|
13
|
-
* 即将加入房间。
|
|
14
|
-
*/
|
|
15
|
-
'joinWillStart'(): void;
|
|
16
|
-
/**
|
|
17
|
-
* 成功加入语音房间。
|
|
18
|
-
*/
|
|
19
|
-
'joined'(): void;
|
|
20
|
-
/**
|
|
21
|
-
* 弱网提醒事件。
|
|
22
|
-
*/
|
|
23
|
-
'weakNetwork'(): void;
|
|
24
|
-
/**
|
|
25
|
-
* 每个用户的音量。
|
|
26
|
-
* @param userVolumes
|
|
27
|
-
*/
|
|
28
|
-
'userVolumes'(userVolumes: UserVolume[]): void;
|
|
29
|
-
};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* rtc加入返回值code枚举
|
|
3
|
-
*/
|
|
4
|
-
export declare enum RTCJoinedInfoCodeEnum {
|
|
5
|
-
/**
|
|
6
|
-
* 成功
|
|
7
|
-
*/
|
|
8
|
-
Success = 0,
|
|
9
|
-
/**
|
|
10
|
-
* 失败
|
|
11
|
-
*/
|
|
12
|
-
Failure = 1,
|
|
13
|
-
/**
|
|
14
|
-
* 重复加入
|
|
15
|
-
*/
|
|
16
|
-
ReJoin = 2,
|
|
17
|
-
/**
|
|
18
|
-
* 无麦克风权限
|
|
19
|
-
*/
|
|
20
|
-
NoMicroPermission = 3
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* 进入rtc房间的回调信息
|
|
24
|
-
*/
|
|
25
|
-
export interface RTCJoinedInfo {
|
|
26
|
-
code: RTCJoinedInfoCodeEnum;
|
|
27
|
-
message: string;
|
|
28
|
-
userId?: string;
|
|
29
|
-
roomId?: number;
|
|
30
|
-
errInfo?: {
|
|
31
|
-
errCode: number;
|
|
32
|
-
errMsg: string;
|
|
33
|
-
};
|
|
34
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { CheckResult } from 'trtc-js-sdk';
|
|
2
|
-
import { Subscribe } from '../../utils/subscribe';
|
|
3
|
-
import { RTCEventType } from './eventType';
|
|
4
|
-
import { RTCType } from './type';
|
|
5
|
-
/**
|
|
6
|
-
* rtc 协议接口
|
|
7
|
-
*/
|
|
8
|
-
export interface RTCProtocol extends Subscribe<RTCEventType> {
|
|
9
|
-
/**
|
|
10
|
-
* 是否已经加入房间
|
|
11
|
-
*/
|
|
12
|
-
joined: boolean;
|
|
13
|
-
/**
|
|
14
|
-
* 麦克风状态
|
|
15
|
-
*/
|
|
16
|
-
micro: boolean;
|
|
17
|
-
/**
|
|
18
|
-
* 语音房间ID
|
|
19
|
-
*/
|
|
20
|
-
voiceId: string;
|
|
21
|
-
/**
|
|
22
|
-
* rtc 实现类型
|
|
23
|
-
*/
|
|
24
|
-
type: RTCType;
|
|
25
|
-
/**
|
|
26
|
-
* 检查rtc的系统依赖是否满足
|
|
27
|
-
*/
|
|
28
|
-
checkRequirement?(): Promise<CheckResult>;
|
|
29
|
-
/**
|
|
30
|
-
* 加入房间。
|
|
31
|
-
* @param voiceId (又称呼`roomId`),当前语音房间Id。
|
|
32
|
-
* @returns
|
|
33
|
-
*/
|
|
34
|
-
join(options: {
|
|
35
|
-
voiceId: string;
|
|
36
|
-
userId: string;
|
|
37
|
-
roomId: string | number | undefined;
|
|
38
|
-
type: RTCType;
|
|
39
|
-
}): Promise<boolean>;
|
|
40
|
-
/**
|
|
41
|
-
* 离开房间。
|
|
42
|
-
* @returns
|
|
43
|
-
*/
|
|
44
|
-
quit(): Promise<boolean>;
|
|
45
|
-
/**
|
|
46
|
-
* 监测麦克风授权。
|
|
47
|
-
* @returns
|
|
48
|
-
*/
|
|
49
|
-
detectMicro(): Promise<boolean>;
|
|
50
|
-
/**
|
|
51
|
-
* 关闭\开启 本地麦克风。
|
|
52
|
-
*/
|
|
53
|
-
toggleMicro(flag?: boolean): Promise<boolean>;
|
|
54
|
-
/**
|
|
55
|
-
* 震动。
|
|
56
|
-
*/
|
|
57
|
-
shock?(): void;
|
|
58
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* rtc 类型
|
|
3
|
-
*/
|
|
4
|
-
export declare enum RTCType {
|
|
5
|
-
RealseeBrowserRTC = "RealseeBrowserRTC",
|
|
6
|
-
RealseeVRWebViewRTC = "RealseeVRWebViewRTC",
|
|
7
|
-
RealseeBrowserChimeRTC = "RealseeBrowserChimeRTC"
|
|
8
|
-
}
|
|
9
|
-
export declare enum BuiltInRTCType {
|
|
10
|
-
RealseeXTRTC = "trtc",
|
|
11
|
-
RealseeXChimeRTC = "chime"
|
|
12
|
-
}
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
import { Subscribe } from './subscribe';
|
|
2
|
-
/**
|
|
3
|
-
* 鲁棒ws的配置参数
|
|
4
|
-
*/
|
|
5
|
-
export type RobustWebSocketConstructorOptions = {
|
|
6
|
-
url: string | ((ws: RobustWebSocket) => string);
|
|
7
|
-
protocols?: string[];
|
|
8
|
-
robustOptions?: RobustOptions;
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* ws 鲁棒性的配置
|
|
12
|
-
*/
|
|
13
|
-
export type RobustOptions = {
|
|
14
|
-
timeout?: number;
|
|
15
|
-
shouldReconnect?: (event: CloseEvent, ws: RobustWebSocket) => undefined | number;
|
|
16
|
-
should1000Reconnect?: boolean;
|
|
17
|
-
ignoreConnectivityEvents?: boolean;
|
|
18
|
-
automaticOpen?: boolean;
|
|
19
|
-
};
|
|
20
|
-
export type RobustWebSocketEventDetail = {
|
|
21
|
-
reconnects: number;
|
|
22
|
-
attempts: number;
|
|
23
|
-
};
|
|
24
|
-
export type RobustWebSocketEvent<T> = Event & {
|
|
25
|
-
detail: T;
|
|
26
|
-
};
|
|
27
|
-
export type RobustWebSocketEventMap = {
|
|
28
|
-
connecting: (event: RobustWebSocketEvent<RobustWebSocketEventDetail>) => void;
|
|
29
|
-
timeout: (event: RobustWebSocketEvent<RobustWebSocketEventDetail>) => void;
|
|
30
|
-
open: (event: RobustWebSocketEvent<RobustWebSocketEventDetail>) => void;
|
|
31
|
-
closing: () => void;
|
|
32
|
-
close: (event: CloseEvent) => void;
|
|
33
|
-
error: (event: Event) => void;
|
|
34
|
-
message: (event: MessageEvent<string | ArrayBuffer | Blob | ArrayBufferView>) => void;
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
* 具有鲁棒性的WebSocket封装
|
|
38
|
-
* 1、自动重连
|
|
39
|
-
* 2、可根据网络情况进行重连
|
|
40
|
-
*/
|
|
41
|
-
export declare class RobustWebSocket extends Subscribe<RobustWebSocketEventMap> {
|
|
42
|
-
private _realWebSocket;
|
|
43
|
-
private _url?;
|
|
44
|
-
private _protocols;
|
|
45
|
-
private _readyState;
|
|
46
|
-
private _options;
|
|
47
|
-
private _connectTimeout;
|
|
48
|
-
private _attempts;
|
|
49
|
-
private _reconnects;
|
|
50
|
-
private _reconnectWhenOnlineAgain;
|
|
51
|
-
_explicitlyClosed: boolean;
|
|
52
|
-
private _pendingReconnect;
|
|
53
|
-
private _connectivityEventsAttached;
|
|
54
|
-
private _heathCheckTimer;
|
|
55
|
-
get attempts(): number;
|
|
56
|
-
constructor(options?: RobustWebSocketConstructorOptions);
|
|
57
|
-
setOptions(options: RobustWebSocketConstructorOptions): void;
|
|
58
|
-
/**
|
|
59
|
-
* 做一个健康检查
|
|
60
|
-
*/
|
|
61
|
-
private _healthCheck;
|
|
62
|
-
/**
|
|
63
|
-
* 清理超时计时器
|
|
64
|
-
*/
|
|
65
|
-
private _clearConnectTimeoutIfNeed;
|
|
66
|
-
/**
|
|
67
|
-
* 清理健康检查
|
|
68
|
-
*/
|
|
69
|
-
private _clearHeathCheckIfNeed;
|
|
70
|
-
/**
|
|
71
|
-
* 开启健康检查
|
|
72
|
-
*/
|
|
73
|
-
private _startHealthCheck;
|
|
74
|
-
/**
|
|
75
|
-
* 停止健康检查
|
|
76
|
-
*/
|
|
77
|
-
private _stopHealthCheck;
|
|
78
|
-
/**
|
|
79
|
-
* 清理连接中的请求
|
|
80
|
-
*/
|
|
81
|
-
private _clearPendingReconnectIfNeeded;
|
|
82
|
-
/**
|
|
83
|
-
* 当网页连接上网络进行重连
|
|
84
|
-
* @param event
|
|
85
|
-
*/
|
|
86
|
-
private _online;
|
|
87
|
-
/**
|
|
88
|
-
* 当网页断开网络进行关闭
|
|
89
|
-
*/
|
|
90
|
-
private _offline;
|
|
91
|
-
/**
|
|
92
|
-
* 解除网络监听事件
|
|
93
|
-
*/
|
|
94
|
-
private _detachConnectivityEvents;
|
|
95
|
-
/**
|
|
96
|
-
* 注册网络监听事件
|
|
97
|
-
*/
|
|
98
|
-
private _attachConnectivityEvents;
|
|
99
|
-
/**
|
|
100
|
-
* 发送消息
|
|
101
|
-
* @param data
|
|
102
|
-
* @returns
|
|
103
|
-
*/
|
|
104
|
-
send: (data: string | ArrayBuffer | Blob | ArrayBufferView) => void | undefined;
|
|
105
|
-
/**
|
|
106
|
-
* 关闭连接
|
|
107
|
-
* @param code 代码
|
|
108
|
-
* @param reason 原因
|
|
109
|
-
* @returns
|
|
110
|
-
*/
|
|
111
|
-
close: (code?: number | string, reason?: string) => void | undefined;
|
|
112
|
-
/**
|
|
113
|
-
* 进行ws连接
|
|
114
|
-
*/
|
|
115
|
-
open: (url?: string) => void;
|
|
116
|
-
/**
|
|
117
|
-
* 创建ws连接
|
|
118
|
-
*/
|
|
119
|
-
private _createWebSocket;
|
|
120
|
-
/**
|
|
121
|
-
* 断开ws事件
|
|
122
|
-
*/
|
|
123
|
-
private _removeWebSocketEvent;
|
|
124
|
-
/**
|
|
125
|
-
* 分发ws事件
|
|
126
|
-
*/
|
|
127
|
-
private _dispatchWebSocketEvent;
|
|
128
|
-
/**
|
|
129
|
-
* ws连接事件
|
|
130
|
-
* @returns
|
|
131
|
-
*/
|
|
132
|
-
private _webSocketOpenHandler;
|
|
133
|
-
/**
|
|
134
|
-
* ws 关闭事件
|
|
135
|
-
* @param event
|
|
136
|
-
* @returns
|
|
137
|
-
*/
|
|
138
|
-
private _webSocketCloseHandler;
|
|
139
|
-
/**
|
|
140
|
-
* ws 异常
|
|
141
|
-
* @param event
|
|
142
|
-
* @returns
|
|
143
|
-
*/
|
|
144
|
-
private _webSocketErrorHandler;
|
|
145
|
-
/**
|
|
146
|
-
* ws消息
|
|
147
|
-
* @param event
|
|
148
|
-
* @returns
|
|
149
|
-
*/
|
|
150
|
-
private _webSocketMessageHandler;
|
|
151
|
-
/**
|
|
152
|
-
* 进行重连
|
|
153
|
-
* @param event
|
|
154
|
-
* @returns
|
|
155
|
-
*/
|
|
156
|
-
private _reconnect;
|
|
157
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function appendUri(uri: string, query?: Record<string, string | number>): string;
|
package/dist/utils/equal.d.ts
DELETED
package/dist/utils/logger.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 输出格式化日志
|
|
3
|
-
*/
|
|
4
|
-
export declare enum LOG_LEVEL {
|
|
5
|
-
info = "INFO",
|
|
6
|
-
log = "LOG",
|
|
7
|
-
error = "ERROR",
|
|
8
|
-
warn = "WARN"
|
|
9
|
-
}
|
|
10
|
-
declare const logger: {
|
|
11
|
-
log: (...args: any[]) => void;
|
|
12
|
-
info: (...args: any[]) => void;
|
|
13
|
-
error: (...args: any[]) => void;
|
|
14
|
-
warn: (...args: any[]) => void;
|
|
15
|
-
};
|
|
16
|
-
export default logger;
|