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