@realsee/live 0.3.0-alpha.4 → 0.4.0-alpha.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/dist/index.d.ts +4 -0
- package/dist/live/controller.d.ts +43 -0
- package/{lib → dist/live}/createLive.d.ts +6 -6
- package/dist/live/createLiveReact.d.ts +6 -0
- package/dist/realsee-live.cjs.development.js +1813 -0
- package/dist/realsee-live.cjs.development.js.map +1 -0
- package/dist/realsee-live.cjs.js +7 -0
- package/dist/realsee-live.cjs.production.js +2 -0
- package/dist/realsee-live.cjs.production.js.map +1 -0
- package/dist/realsee-live.esm.js +1797 -0
- package/dist/realsee-live.esm.js.map +1 -0
- package/dist/realsee-live.umd.development.js +52136 -0
- package/dist/realsee-live.umd.development.js.map +1 -0
- package/dist/realsee-live.umd.production.js +2 -0
- package/dist/realsee-live.umd.production.js.map +1 -0
- package/{lib/RTC → dist/rtc}/BrowserRTC.d.ts +29 -30
- package/{lib/RTC → dist/rtc}/BrowserRTC4Chime.d.ts +55 -53
- package/dist/rtc/CoreRTC.d.ts +23 -0
- package/{lib/RTC → dist/rtc}/VRWebViewRTC.d.ts +22 -23
- package/dist/rtc/index.d.ts +5 -0
- package/{lib/typings/Chime → dist/typings/chime}/AttendeeResponse.d.ts +5 -5
- package/{lib/typings/Chime → dist/typings/chime}/MeetingResponse.d.ts +12 -12
- package/{lib/typings/Chime → dist/typings/chime}/MeetingSessionConfigurationOptions.d.ts +16 -16
- package/dist/typings/chime/index.d.ts +3 -0
- package/dist/typings/index.d.ts +4 -0
- package/{lib/typings → dist/typings/live}/EventType.d.ts +90 -89
- package/{lib/typings → dist/typings/live}/GetVoiceSign.d.ts +17 -11
- package/{lib/typings → dist/typings/live}/Live.d.ts +123 -122
- package/{lib/typings → dist/typings/live}/LiveMsg.d.ts +119 -119
- package/{lib/typings → dist/typings/live}/LiveOptions.d.ts +65 -46
- package/{lib/typings → dist/typings/live}/RoomInfo.d.ts +13 -13
- package/{lib/typings → dist/typings/live}/UserInfo.d.ts +87 -87
- package/dist/typings/live/UserVolume.d.ts +7 -0
- package/{lib/typings → dist/typings/live}/WebSocket.d.ts +78 -78
- package/dist/typings/live/index.d.ts +9 -0
- package/{lib/createLiveReact.d.ts → dist/typings/react/LiveReact.d.ts} +162 -160
- package/dist/typings/react/RTCActionReactCallback.d.ts +2 -0
- package/dist/typings/react/index.d.ts +2 -0
- package/dist/typings/rtc/VRWebViewRTCOptions.d.ts +6 -0
- package/{lib/typings/RTCEventType.d.ts → dist/typings/rtc/eventType.d.ts} +29 -35
- package/dist/typings/rtc/index.d.ts +5 -0
- package/{lib/typings/RTCJoinedInfo.d.ts → dist/typings/rtc/joinedInfo.d.ts} +34 -28
- package/{lib/typings/RTCProtocol.d.ts → dist/typings/rtc/protocol.d.ts} +53 -42
- package/dist/typings/rtc/type.d.ts +8 -0
- package/{lib/shared-utils → dist/utils}/appendUri.d.ts +1 -1
- package/dist/utils/clientDetector.d.ts +4 -0
- package/{lib/shared-utils → dist/utils}/equal.d.ts +10 -11
- package/{lib/shared-utils/Subscribe.d.ts → dist/utils/subscribe.d.ts} +75 -76
- package/{lib/shared-utils → dist/utils}/uuid.d.ts +4 -4
- package/package.json +21 -33
- package/docs/.nojekyll +0 -1
- package/docs/assets/custom.css +0 -43
- package/docs/assets/highlight.css +0 -127
- package/docs/assets/icons.css +0 -1043
- package/docs/assets/icons.png +0 -0
- package/docs/assets/icons@2x.png +0 -0
- package/docs/assets/main.js +0 -52
- package/docs/assets/search.js +0 -1
- package/docs/assets/style.css +0 -1413
- package/docs/assets/widgets.png +0 -0
- package/docs/assets/widgets@2x.png +0 -0
- package/docs/classes/RTCProtocol.BrowserRTC.html +0 -60
- package/docs/classes/RTCProtocol.BrowserRTC4Chime.html +0 -66
- package/docs/classes/RTCProtocol.RTCExample.html +0 -62
- package/docs/classes/RTCProtocol.VRWebViewRTC.html +0 -60
- package/docs/classes/shared_utils.Subscribe.html +0 -56
- package/docs/enums/RTCProtocol.RTCJoinedInfoCodeEnum.html +0 -9
- package/docs/enums/RTCProtocol.RTCType.html +0 -1
- package/docs/enums/live.BuiltinActionType.html +0 -15
- package/docs/enums/live.BuiltinEventType.html +0 -7
- package/docs/enums/live.Command.html +0 -7
- package/docs/enums/live.MemUserStatus.html +0 -1
- package/docs/enums/live.MicroStatus.html +0 -3
- package/docs/enums/live.UserStatus.html +0 -9
- package/docs/enums/live.WebSocketCloseError.html +0 -19
- package/docs/enums/live.WebSocketErrorType.html +0 -1
- package/docs/enums/live.WebSocketState.html +0 -13
- package/docs/index.html +0 -382
- package/docs/interfaces/RTCProtocol.GetVoiceSignReturnType.html +0 -1
- package/docs/interfaces/RTCProtocol.RTCJoinedInfo.html +0 -1
- package/docs/interfaces/RTCProtocol.RTCProtocol-1.html +0 -60
- package/docs/interfaces/RTCProtocol.VRWebViewRTCOptions.html +0 -1
- package/docs/interfaces/live.Live.html +0 -119
- package/docs/interfaces/live.LiveOptions.html +0 -22
- package/docs/interfaces/live.LiveReact.html +0 -52
- package/docs/modules/RTCProtocol.html +0 -17
- package/docs/modules/live.html +0 -103
- package/docs/modules/shared_utils.html +0 -10
- package/docs/modules.html +0 -1
- package/lib/RTC/BrowserRTC.js +0 -169
- package/lib/RTC/BrowserRTC.js.map +0 -1
- package/lib/RTC/BrowserRTC4Chime.js +0 -299
- package/lib/RTC/BrowserRTC4Chime.js.map +0 -1
- package/lib/RTC/VRWebViewRTC.js +0 -125
- package/lib/RTC/VRWebViewRTC.js.map +0 -1
- package/lib/RTC/index.d.ts +0 -22
- package/lib/RTC/index.js +0 -50
- package/lib/RTC/index.js.map +0 -1
- package/lib/createLive.js +0 -590
- package/lib/createLive.js.map +0 -1
- package/lib/createLiveReact.js +0 -212
- package/lib/createLiveReact.js.map +0 -1
- package/lib/index.d.ts +0 -2
- package/lib/index.js +0 -8
- package/lib/index.js.map +0 -1
- package/lib/shared-utils/Subscribe.js +0 -134
- package/lib/shared-utils/Subscribe.js.map +0 -1
- package/lib/shared-utils/appendUri.js +0 -13
- package/lib/shared-utils/appendUri.js.map +0 -1
- package/lib/shared-utils/equal.js +0 -92
- package/lib/shared-utils/equal.js.map +0 -1
- package/lib/shared-utils/uuid.js +0 -17
- package/lib/shared-utils/uuid.js.map +0 -1
- package/lib/typings/Chime/AttendeeResponse.js +0 -3
- package/lib/typings/Chime/AttendeeResponse.js.map +0 -1
- package/lib/typings/Chime/MeetingResponse.js +0 -3
- package/lib/typings/Chime/MeetingResponse.js.map +0 -1
- package/lib/typings/Chime/MeetingSessionConfigurationOptions.js +0 -3
- package/lib/typings/Chime/MeetingSessionConfigurationOptions.js.map +0 -1
- package/lib/typings/EventType.js +0 -3
- package/lib/typings/EventType.js.map +0 -1
- package/lib/typings/GetVoiceSign.js +0 -3
- package/lib/typings/GetVoiceSign.js.map +0 -1
- package/lib/typings/Live.js +0 -3
- package/lib/typings/Live.js.map +0 -1
- package/lib/typings/LiveMsg.js +0 -111
- package/lib/typings/LiveMsg.js.map +0 -1
- package/lib/typings/LiveOptions.js +0 -3
- package/lib/typings/LiveOptions.js.map +0 -1
- package/lib/typings/RTCEventType.js +0 -3
- package/lib/typings/RTCEventType.js.map +0 -1
- package/lib/typings/RTCJoinedInfo.js +0 -23
- package/lib/typings/RTCJoinedInfo.js.map +0 -1
- package/lib/typings/RTCProtocol.js +0 -9
- package/lib/typings/RTCProtocol.js.map +0 -1
- package/lib/typings/RoomInfo.js +0 -3
- package/lib/typings/RoomInfo.js.map +0 -1
- package/lib/typings/UserInfo.js +0 -31
- package/lib/typings/UserInfo.js.map +0 -1
- package/lib/typings/VRWebViewRTCOptions.d.ts +0 -6
- package/lib/typings/VRWebViewRTCOptions.js +0 -3
- package/lib/typings/VRWebViewRTCOptions.js.map +0 -1
- package/lib/typings/WebSocket.js +0 -107
- package/lib/typings/WebSocket.js.map +0 -1
- package/umd/RTCProtocol.543610f0.js +0 -1
- package/umd/createLive.1ecf7dd4.js +0 -1
- package/umd/createLiveReact.9075a8fd.js +0 -1
|
@@ -1,160 +1,162 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { RTCEventType } from '
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
export declare type LiveProviderPropTypes<Snapshot> = {
|
|
10
|
-
children?: React.ReactNode;
|
|
11
|
-
live?: Live<Snapshot>;
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
*
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* ```
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
*
|
|
41
|
-
*/
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* @deprecated 获取 `
|
|
45
|
-
*/
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
*
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
*
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
*
|
|
101
|
-
* @function
|
|
102
|
-
* @function
|
|
103
|
-
* @function
|
|
104
|
-
* @function
|
|
105
|
-
* @function
|
|
106
|
-
* @function
|
|
107
|
-
* @function
|
|
108
|
-
* @function
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
*
|
|
152
|
-
*
|
|
153
|
-
* ```
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { KeyframeTypes, LiveEventType, WebSocketEventType } from '../live/EventType';
|
|
3
|
+
import { Live, LiveActionReactCallback } from '../live/Live';
|
|
4
|
+
import { UserInfo } from '../live/UserInfo';
|
|
5
|
+
import { WebSocketState } from '../live/WebSocket';
|
|
6
|
+
import { RTCEventType } from '../rtc/eventType';
|
|
7
|
+
import { RTCProtocol } from '../rtc/protocol';
|
|
8
|
+
import { RTCActionReactCallback } from './RTCActionReactCallback';
|
|
9
|
+
export declare type LiveProviderPropTypes<Snapshot> = {
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
live?: Live<Snapshot>;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* @example
|
|
15
|
+
*
|
|
16
|
+
* 新建文件`LiveReact.ts` 创建一个 {@link LiveReact} 实例对象:
|
|
17
|
+
*
|
|
18
|
+
* ```js
|
|
19
|
+
* import { createLiveReact } from '@realsee/live'
|
|
20
|
+
* const LiveReact = createLiveReact({ getTicket: async () => '' })
|
|
21
|
+
* export default LiveReact
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
*
|
|
25
|
+
*/
|
|
26
|
+
export interface LiveReact</* 帧数据 */ Snapshot> {
|
|
27
|
+
live: Live<Snapshot>;
|
|
28
|
+
/**
|
|
29
|
+
* @description **LiveProvider** 基于 [React Context](https://reactjs.org/docs/context.html) 对 {@link Live }进行封装,你可以以 [React Hooks](https://reactjs.org/docs/hooks-intro.html) 的方式对 {@link Live } 实例进行操作、数据监听等。
|
|
30
|
+
*
|
|
31
|
+
* 在 `React` 环境中使用 {@link LiveReact.LiveProvider} 组件:
|
|
32
|
+
*
|
|
33
|
+
* ```ts
|
|
34
|
+
* import { LiveProvider } from './LiveReact'
|
|
35
|
+
* ReactDOM.render(<LiveProvider><App></LiveProvider>, containter)
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
LiveProvider: (props: LiveProviderPropTypes<Snapshot>) => JSX.Element;
|
|
39
|
+
/**
|
|
40
|
+
* @deprecated 获取 `live` 实例,**不鼓励使用**
|
|
41
|
+
*/
|
|
42
|
+
unsafe__useLiveInstance: () => Live<Snapshot>;
|
|
43
|
+
/**
|
|
44
|
+
* @deprecated 获取 `RTC` 实例,**不鼓励使用**
|
|
45
|
+
*/
|
|
46
|
+
unsafe__useRTCInstance: () => RTCProtocol;
|
|
47
|
+
/**
|
|
48
|
+
*
|
|
49
|
+
* @description 获取当前 WebSocket 连接的 URL,如果尚未创建 WebSocket 实例,则值为 `undefined`。
|
|
50
|
+
* 如果有重连等事件发生 URL 值会发生更新。
|
|
51
|
+
*
|
|
52
|
+
* ```ts
|
|
53
|
+
* import { useCurrentWebSocketUrl } from './LiveReact'
|
|
54
|
+
* function ReactComponent() {
|
|
55
|
+
* const url = useCurrentWebSocketUrl()
|
|
56
|
+
* return <div>当前URL: {url}.</div>
|
|
57
|
+
* }
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
useCurrentWebSocketUrl: () => string | undefined;
|
|
61
|
+
/**
|
|
62
|
+
* @description 连接 WebSocket 服务。如果 WebSocket 已经连接则什么都不做,若提供 `{force: true}` 则会强制重连。
|
|
63
|
+
*
|
|
64
|
+
*
|
|
65
|
+
* ```jsx
|
|
66
|
+
* import { useConnect } from './LiveReact'
|
|
67
|
+
* function ReactComponent() {
|
|
68
|
+
* const connect = useConnect()
|
|
69
|
+
* return <button onClick={() => connect()}>点击连接</button>
|
|
70
|
+
* }
|
|
71
|
+
* ```
|
|
72
|
+
*
|
|
73
|
+
*/
|
|
74
|
+
useConnect: () => (options?: {
|
|
75
|
+
force?: boolean;
|
|
76
|
+
url?: string;
|
|
77
|
+
getTicket?: () => Promise<string>;
|
|
78
|
+
}) => Promise<boolean | Error>;
|
|
79
|
+
/**
|
|
80
|
+
*
|
|
81
|
+
* @description 帧数据状态值。如果执行 `setKeyframe()` 则会传递 WebSocket 帧同步指令;若通过 WebSocket 收到新帧数据则会更新当前状态值。
|
|
82
|
+
*
|
|
83
|
+
* ```typescript
|
|
84
|
+
* function LocalFiveState() {
|
|
85
|
+
* const [keyframe, setKeyframe] = LiveReact.useKeyframe('five')
|
|
86
|
+
* return (<div>{JSON.stringify(keyframe)}</div>)
|
|
87
|
+
* }
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
useKeyframe: <K extends keyof Snapshot>(frameName: K) => [
|
|
91
|
+
frame: Snapshot[K] | undefined,
|
|
92
|
+
setFrame: (frame: Snapshot[K]) => boolean | Error
|
|
93
|
+
];
|
|
94
|
+
/**
|
|
95
|
+
*
|
|
96
|
+
*/
|
|
97
|
+
useKeyframeUpdateCallback: <K extends keyof KeyframeTypes<Snapshot>>(name: K, callback: (...args: Parameters<KeyframeTypes<Snapshot>[K]>) => ReturnType<KeyframeTypes<Snapshot>[K]>, deps?: React.DependencyList) => () => void;
|
|
98
|
+
/**
|
|
99
|
+
*
|
|
100
|
+
* @function broadcast 广播消息,详见 {@link Live.broadcast}。
|
|
101
|
+
* @function exit 退出带看,详见 {@link Live.exit}。
|
|
102
|
+
* @function kick 踢出带看,详见 {@link Live.kick}。
|
|
103
|
+
* @function toggleMicro 打开/关闭自己的麦克风,详见 {@link Live.toggleMicro}。
|
|
104
|
+
* @function forbidMicro 禁止麦克风,详见 {@link Live.forbidMicro}。
|
|
105
|
+
* @function sendKeyframe 发送帧数据,详见 {@link Live.sendKeyframe}。
|
|
106
|
+
* @function getFramesByKey 根据`key`从帧快照中获取某条帧数据,详见 {@link Live.getFramesByKey}。
|
|
107
|
+
* @function setSelfInfo 设置当前用户信息,详见 {@link Live.setSelfInfo}。
|
|
108
|
+
* @function updateStatus 更新用户或房间状态,详见 {@link Live.updateStatus}。
|
|
109
|
+
*
|
|
110
|
+
* @description 提供一些函数直接调用。
|
|
111
|
+
*
|
|
112
|
+
* ```ts
|
|
113
|
+
* function ReactComponent() {
|
|
114
|
+
* const { exit } = useLiveAction()
|
|
115
|
+
* return (<button onClick={() => exit()}>退出带看</button>)
|
|
116
|
+
* }
|
|
117
|
+
* ```
|
|
118
|
+
*/
|
|
119
|
+
useLiveAction: () => LiveActionReactCallback<Snapshot>;
|
|
120
|
+
/**
|
|
121
|
+
* 监听带看相关的异步 Hooks 事件。详情见 {@link LiveEventType}。
|
|
122
|
+
*/
|
|
123
|
+
useLiveEventCallback: <K extends keyof LiveEventType<Snapshot>>(name: K, callback: (...args: Parameters<LiveEventType<Snapshot>[K]>) => ReturnType<LiveEventType<Snapshot>[K]>, deps?: React.DependencyList) => () => void;
|
|
124
|
+
/**
|
|
125
|
+
* 获取当前 WebSocket 状态 {@link WebSocketState}。
|
|
126
|
+
*/
|
|
127
|
+
useReadyState: () => WebSocketState;
|
|
128
|
+
/**
|
|
129
|
+
* RTC 函数。
|
|
130
|
+
*/
|
|
131
|
+
useRTCAction: () => RTCActionReactCallback;
|
|
132
|
+
/**
|
|
133
|
+
* RTC 事件回调监听。
|
|
134
|
+
*/
|
|
135
|
+
useRTCEventCallback: <K extends keyof RTCEventType>(name: K, callback: (...args: Parameters<RTCEventType[K]>) => ReturnType<RTCEventType[K]>, deps?: React.DependencyList) => () => void;
|
|
136
|
+
/**
|
|
137
|
+
* 获取\更改 当前用户信息。
|
|
138
|
+
* ```
|
|
139
|
+
* const [userInfo, setUserInfo] = useSelfInfo()
|
|
140
|
+
* ```
|
|
141
|
+
*/
|
|
142
|
+
useSelfInfo: () => [
|
|
143
|
+
Partial<UserInfo>,
|
|
144
|
+
(userInfo: Partial<UserInfo>) => Promise<boolean | Error>
|
|
145
|
+
];
|
|
146
|
+
/**
|
|
147
|
+
* 当前帧数据快照。
|
|
148
|
+
*/
|
|
149
|
+
useSnapshot: () => Partial<Snapshot> | undefined;
|
|
150
|
+
/**
|
|
151
|
+
* 获取房间用户列表。
|
|
152
|
+
*
|
|
153
|
+
* ```
|
|
154
|
+
* const userList = useUserList()
|
|
155
|
+
* ```
|
|
156
|
+
*/
|
|
157
|
+
useUserList: () => UserInfo[] | undefined;
|
|
158
|
+
/**
|
|
159
|
+
* WebSocket 异步事件回调监听。
|
|
160
|
+
*/
|
|
161
|
+
useWebSocketEventCallback: <K extends keyof WebSocketEventType>(name: K, callback: (...args: Parameters<WebSocketEventType[K]>) => ReturnType<WebSocketEventType[K]>, deps?: React.DependencyList) => () => void;
|
|
162
|
+
}
|
|
@@ -1,35 +1,29 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* 每个用户的音量。
|
|
32
|
-
* @param userVolumes
|
|
33
|
-
*/
|
|
34
|
-
'userVolumes'(userVolumes: UserVolume[]): void;
|
|
35
|
-
};
|
|
1
|
+
import { UserVolume } from '../live/UserVolume';
|
|
2
|
+
import { RTCJoinedInfo } from './joinedInfo';
|
|
3
|
+
/**
|
|
4
|
+
* RTC 异步事件类型。
|
|
5
|
+
*/
|
|
6
|
+
export declare 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,28 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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,42 +1,53 @@
|
|
|
1
|
-
import { Subscribe } from '
|
|
2
|
-
import { RTCEventType } from './
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export interface RTCProtocol extends Subscribe<RTCEventType> {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
*
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
*
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
1
|
+
import { Subscribe } from '../../utils/subscribe';
|
|
2
|
+
import { RTCEventType } from './eventType';
|
|
3
|
+
import { RTCType } from './type';
|
|
4
|
+
/**
|
|
5
|
+
* rtc 协议接口
|
|
6
|
+
*/
|
|
7
|
+
export interface RTCProtocol extends Subscribe<RTCEventType> {
|
|
8
|
+
/**
|
|
9
|
+
* 是否已经加入房间
|
|
10
|
+
*/
|
|
11
|
+
joined: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* 麦克风状态
|
|
14
|
+
*/
|
|
15
|
+
micro: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* 语音房间ID
|
|
18
|
+
*/
|
|
19
|
+
voiceId: string;
|
|
20
|
+
/**
|
|
21
|
+
* rtc 实现类型
|
|
22
|
+
*/
|
|
23
|
+
type: RTCType;
|
|
24
|
+
/**
|
|
25
|
+
* 加入房间。
|
|
26
|
+
* @param voiceId (又称呼`roomId`),当前语音房间Id。
|
|
27
|
+
* @returns
|
|
28
|
+
*/
|
|
29
|
+
join(options: {
|
|
30
|
+
voiceId: string;
|
|
31
|
+
userId: string;
|
|
32
|
+
roomId: string | number | undefined;
|
|
33
|
+
type: RTCType;
|
|
34
|
+
}): Promise<boolean>;
|
|
35
|
+
/**
|
|
36
|
+
* 离开房间。
|
|
37
|
+
* @returns
|
|
38
|
+
*/
|
|
39
|
+
quit(): Promise<boolean>;
|
|
40
|
+
/**
|
|
41
|
+
* 监测麦克风授权。
|
|
42
|
+
* @returns
|
|
43
|
+
*/
|
|
44
|
+
detectMicro(): Promise<boolean>;
|
|
45
|
+
/**
|
|
46
|
+
* 关闭\开启 本地麦克风。
|
|
47
|
+
*/
|
|
48
|
+
toggleMicro(flag?: boolean): Promise<boolean>;
|
|
49
|
+
/**
|
|
50
|
+
* 震动。
|
|
51
|
+
*/
|
|
52
|
+
shock?(): void;
|
|
53
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function appendUri(uri: string, query?: Record<string, string | number>): string;
|
|
1
|
+
export declare function appendUri(uri: string, query?: Record<string, string | number>): string;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* @param
|
|
5
|
-
* @param
|
|
6
|
-
* @
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}): boolean;
|
|
1
|
+
/**
|
|
2
|
+
* 对象比较。
|
|
3
|
+
* @param value 第一个比较的值。
|
|
4
|
+
* @param other 第二个比较的值。
|
|
5
|
+
* @param options 可选参数,可选项:`deep` 是否深比较。
|
|
6
|
+
* @returns {boolean} 是否相等。
|
|
7
|
+
*/
|
|
8
|
+
export declare function equal(value: any, other: any, opt?: {
|
|
9
|
+
deep: boolean;
|
|
10
|
+
}): boolean;
|