@realsee/live 0.5.0-alpha.9 → 0.5.2-dev.2

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 (33) hide show
  1. package/dist/live/controller.d.ts +1 -1
  2. package/dist/live/createLive.d.ts +1 -1
  3. package/dist/live/createLiveReact.d.ts +4 -4
  4. package/dist/live/live.d.ts +2 -2
  5. package/dist/realsee-live.cjs.development.js +155 -150
  6. package/dist/realsee-live.cjs.development.js.map +1 -1
  7. package/dist/realsee-live.cjs.production.js +1 -1
  8. package/dist/realsee-live.cjs.production.js.map +1 -1
  9. package/dist/realsee-live.esm.js +156 -151
  10. package/dist/realsee-live.esm.js.map +1 -1
  11. package/dist/realsee-live.umd.development.js +2342 -2228
  12. package/dist/realsee-live.umd.development.js.map +1 -1
  13. package/dist/realsee-live.umd.production.js +1 -1
  14. package/dist/realsee-live.umd.production.js.map +1 -1
  15. package/dist/rtc/BrowserRTC.d.ts +1 -0
  16. package/dist/typings/live/EventType.d.ts +3 -3
  17. package/dist/typings/live/GetVoiceSign.d.ts +1 -1
  18. package/dist/typings/live/LiveConnectOptions.d.ts +1 -1
  19. package/dist/typings/live/LiveMsg.d.ts +3 -3
  20. package/dist/typings/live/RoomInfo.d.ts +1 -1
  21. package/dist/typings/live/UserInfo.d.ts +20 -3
  22. package/dist/typings/live/UserVolume.d.ts +1 -1
  23. package/dist/typings/live/WebSocket.d.ts +1 -1
  24. package/dist/typings/react/RTCActionReactCallback.d.ts +1 -1
  25. package/dist/typings/rtc/eventType.d.ts +1 -1
  26. package/dist/typings/rtc/protocol.d.ts +5 -0
  27. package/dist/utils/RobustWebSocket.d.ts +5 -5
  28. package/dist/utils/subscribe.d.ts +1 -1
  29. package/docs/assets/search.js +1 -1
  30. package/docs/classes/BrowserRTC.html +10 -10
  31. package/docs/interfaces/RTCProtocol.html +12 -10
  32. package/docs/modules.html +12 -6
  33. package/package.json +17 -15
@@ -2,7 +2,7 @@ import { LiveMsg } from '../typings';
2
2
  import { LiveState } from '../typings/live/LiveState';
3
3
  import { RobustWebSocketEventDetail } from '../utils/RobustWebSocket';
4
4
  import { Subscribe } from '../utils/subscribe';
5
- export declare type LiveControllerEventMap = {
5
+ export type LiveControllerEventMap = {
6
6
  stateChange: (state: LiveState, prevState: LiveState) => void;
7
7
  message: (message: LiveMsg) => void;
8
8
  reconnected: (detail: RobustWebSocketEventDetail) => void;
@@ -5,4 +5,4 @@ import { Live } from './live';
5
5
  * @param opts
6
6
  * @returns
7
7
  */
8
- export declare const createLive: <KeyframesSnapshot>(opts: LiveOptions) => Live<KeyframesSnapshot>;
8
+ export declare const createLive: <KeyframesSnapshot extends Record<string, any>>(opts: LiveOptions) => Live<KeyframesSnapshot>;
@@ -2,25 +2,25 @@ import React from 'react';
2
2
  import { BuiltinActionType, BuiltinEventType, KeyframeTypes, LiveConnectOptions, LiveEventType, LiveOptions, MicroStatus, RTCEventType, RTCType, UserInfo } from '../typings';
3
3
  import { LiveState } from '../typings/live/LiveState';
4
4
  import { Live } from './live';
5
- export declare type LiveProviderPropTypes<KeyframesSnapshot> = {
5
+ export type LiveProviderPropTypes<KeyframesSnapshot extends Record<string, any>> = {
6
6
  children?: React.ReactNode;
7
7
  live?: Live<KeyframesSnapshot>;
8
8
  };
9
9
  /**
10
10
  * 创建 {@link LiveReact} 实例,并提供 `React` 技术栈相关工具链。
11
11
  */
12
- export declare function createLiveReact<KeyframesSnapshot>(options: LiveOptions): {
12
+ export declare function createLiveReact<KeyframesSnapshot extends Record<string, any>>(options: LiveOptions): {
13
13
  live: Live<KeyframesSnapshot>;
14
14
  jsBridge: import("@realsee/jsbridge-x").JSBridgeProtocol;
15
15
  LiveProvider: (props: LiveProviderPropTypes<KeyframesSnapshot>) => JSX.Element;
16
16
  unsafe__useLiveInstance: () => Live<KeyframesSnapshot>;
17
17
  unsafe__useRTCInstance: () => import("../typings").RTCProtocol;
18
- useConnect: (options: LiveConnectOptions) => Promise<boolean | Error>;
18
+ useConnect: () => (options: LiveConnectOptions) => Promise<boolean | Error>;
19
19
  useKeyframe: <K extends keyof KeyframesSnapshot>(key: K) => [frame: KeyframesSnapshot[K] | undefined, setFrame: (frame: KeyframesSnapshot[K]) => boolean | Error];
20
20
  useKeyframeUpdateCallback: <KeyOfKeyframe extends keyof KeyframeTypes<KeyframesSnapshot>>(key: KeyOfKeyframe, callback: (...args: Parameters<KeyframeTypes<KeyframesSnapshot>[KeyOfKeyframe]>) => ReturnType<KeyframeTypes<KeyframesSnapshot>[KeyOfKeyframe]>, deps?: React.DependencyList) => () => void;
21
21
  useLiveAction: () => {
22
22
  connect: (options: LiveConnectOptions) => Promise<boolean | Error>;
23
- broadcast: (data: Record<string, any>, toUserIds: string | string[], timeout?: any) => Promise<unknown>;
23
+ broadcast: (data: Record<string, any>, toUserIds: string | string[], timeout?: number) => Promise<unknown>;
24
24
  exit: () => Promise<boolean>;
25
25
  kick: (toUserIds: string | string[]) => Promise<boolean>;
26
26
  toggleMicro: (microStatus: boolean) => Promise<boolean>;
@@ -3,7 +3,7 @@ import { RTCProtocol } from '../rtc';
3
3
  import { EventType, KeyframeTypes, LiveOptions, RoomInfo, RTCType, UserInfo, BuiltinEventType, BuiltinActionType, MicroStatus, LiveConnectOptions } from '../typings';
4
4
  import { LiveState } from '../typings/live/LiveState';
5
5
  import { Subscribe } from '../utils/subscribe';
6
- export declare type LiveBuiltInData<KeyframesSnapshot> = {
6
+ export type LiveBuiltInData<KeyframesSnapshot> = {
7
7
  selfInfo?: UserInfo;
8
8
  userList?: UserInfo[];
9
9
  roomInfo?: RoomInfo;
@@ -145,7 +145,7 @@ export declare class Live<KeyframesSnapshot extends Record<string, any>> extends
145
145
  * @param timeout
146
146
  * @returns
147
147
  */
148
- broadcast<Request, Response>(request: Request, toUserIds: string | string[], timeout: number): Promise<Response> | Error | false;
148
+ broadcast<Request extends Record<string, any>, Response>(request: Request, toUserIds: string | string[], timeout: number): Promise<Response> | Error | false;
149
149
  toggleMicro: (microStatus: boolean) => Promise<boolean>;
150
150
  /**
151
151
  * 控制别人的麦
@@ -171,6 +171,54 @@ exports.BuiltInRTCType = void 0;
171
171
  BuiltInRTCType["RealseeXChimeRTC"] = "chime";
172
172
  })(exports.BuiltInRTCType || (exports.BuiltInRTCType = {}));
173
173
 
174
+ /**
175
+ * 输出格式化日志
176
+ */
177
+ // 获取当前时间
178
+ const getTime = () => {
179
+ const date = new Date();
180
+ const year = date.getFullYear();
181
+ const month = (date.getMonth() + 1).toString().padStart(2, '0'); //月份是从0开始的
182
+ const day = date.getDate().toString().padStart(2, '0');
183
+ const hour = date.getHours().toString().padStart(2, '0');
184
+ const min = date.getMinutes().toString().padStart(2, '0');
185
+ const sec = date.getSeconds().toString().padStart(2, '0');
186
+ const ms = date.getMilliseconds();
187
+ return `[${year}-${month}-${day} ${hour}:${min}:${sec}.${ms}]`;
188
+ };
189
+ var LOG_LEVEL;
190
+ (function (LOG_LEVEL) {
191
+ LOG_LEVEL["info"] = "INFO";
192
+ LOG_LEVEL["log"] = "LOG";
193
+ LOG_LEVEL["error"] = "ERROR";
194
+ LOG_LEVEL["warn"] = "WARN";
195
+ })(LOG_LEVEL || (LOG_LEVEL = {}));
196
+ // 输出日志
197
+ const echo = (logLevel, args = []) => {
198
+ args.unshift(`Realsee Live ${getTime()} <${logLevel}> `);
199
+ switch (logLevel) {
200
+ case LOG_LEVEL.info:
201
+ return console.info(...args);
202
+ case LOG_LEVEL.error:
203
+ return console.error(...args);
204
+ case LOG_LEVEL.warn:
205
+ return console.warn(...args);
206
+ default:
207
+ return console.log(...args);
208
+ }
209
+ };
210
+ const log = (...args) => echo(LOG_LEVEL.log, args);
211
+ const info = (...args) => echo(LOG_LEVEL.info, args);
212
+ const error = (...args) => echo(LOG_LEVEL.error, args);
213
+ const warn = (...args) => echo(LOG_LEVEL.warn, args);
214
+ const logger = {
215
+ log,
216
+ info,
217
+ error,
218
+ warn,
219
+ };
220
+ var logger$1 = logger;
221
+
174
222
  // uuid
175
223
  function S4() {
176
224
  return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
@@ -204,6 +252,7 @@ class BrowserRTC extends CoreRTC {
204
252
  this._getVoiceSign = () => {
205
253
  throw new Error('方法 getVoiceSign 未实现');
206
254
  };
255
+ this.checkRequirement = () => TRTC__default["default"].checkSystemRequirements();
207
256
  this.$dom = document.createElement('div');
208
257
  this._trtc = {
209
258
  client: null,
@@ -297,7 +346,10 @@ class BrowserRTC extends CoreRTC {
297
346
  navigator.mediaDevices
298
347
  .getUserMedia(rule)
299
348
  .then(() => resolve(true))
300
- .catch(() => resolve(false));
349
+ .catch((e) => {
350
+ logger$1.error(e.message);
351
+ resolve(false);
352
+ });
301
353
  }
302
354
  catch (e) {
303
355
  console.error(e);
@@ -318,9 +370,10 @@ class BrowserRTC extends CoreRTC {
318
370
  var _a, _b, _c, _d;
319
371
  (_a = this._trtc.client) === null || _a === void 0 ? void 0 : _a.on('stream-added', this._handleStreamAdded);
320
372
  (_b = this._trtc.client) === null || _b === void 0 ? void 0 : _b.on('stream-subscribed', this._handleStreamSubscribed);
321
- (_c = this._trtc.client) === null || _c === void 0 ? void 0 : _c.on('audio-volume', (event) => this.emit('userVolumes', [
322
- { userId: event.userId, audioVolume: event.audioVolume },
323
- ]));
373
+ (_c = this._trtc.client) === null || _c === void 0 ? void 0 : _c.on('audio-volume', (event) => this.emit('userVolumes', event.result.map(({ userId, audioVolume }) => ({
374
+ userId,
375
+ audioVolume,
376
+ }))));
324
377
  (_d = this._trtc.client) === null || _d === void 0 ? void 0 : _d.on('error', (event) => this.emit('error', event));
325
378
  }
326
379
  }
@@ -611,6 +664,9 @@ exports.RTCJoinedInfoCodeEnum = void 0;
611
664
  })(exports.RTCJoinedInfoCodeEnum || (exports.RTCJoinedInfoCodeEnum = {}));
612
665
 
613
666
  class VRWebViewRTC extends CoreRTC {
667
+ get jsBridge() {
668
+ return this.options.jsBridge;
669
+ }
614
670
  constructor({ jsBridge, getVoiceSign }) {
615
671
  super();
616
672
  this.type = exports.RTCType.RealseeVRWebViewRTC;
@@ -629,9 +685,6 @@ class VRWebViewRTC extends CoreRTC {
629
685
  this.emit('weakNetwork');
630
686
  });
631
687
  }
632
- get jsBridge() {
633
- return this.options.jsBridge;
634
- }
635
688
  join(options) {
636
689
  return __awaiter(this, void 0, void 0, function* () {
637
690
  try {
@@ -984,7 +1037,7 @@ exports.default = LogLevel;
984
1037
 
985
1038
  var LogLevel = /*@__PURE__*/getDefaultExportFromCjs(LogLevel_1);
986
1039
 
987
- function appendUri(uri, query) {
1040
+ function appendUri(uri, query = {}) {
988
1041
  const hasQuery = uri.indexOf('?') !== -1;
989
1042
  const newQuery = Object.keys(query).reduce((accu, curr, idx) => `${accu}${(idx === 0 && !hasQuery) ? '?' : '&'}${curr}=${query[curr]}`, '');
990
1043
  return uri + newQuery;
@@ -1122,66 +1175,21 @@ function objEqualDeep(value, other) {
1122
1175
  * @param options 可选参数,可选项:`deep` 是否深比较。
1123
1176
  * @returns {boolean} 是否相等。
1124
1177
  */
1125
- function equal(value, other, opt) {
1178
+ function equal(value, other, opt = { deep: false }) {
1126
1179
  if (!opt.deep)
1127
1180
  return isShallowEqual(value, other);
1128
1181
  return isDeepEqual(value, other);
1129
1182
  }
1130
1183
 
1131
- /**
1132
- * 输出格式化日志
1133
- */
1134
- // 获取当前时间
1135
- const getTime = () => {
1136
- const date = new Date();
1137
- const year = date.getFullYear();
1138
- const month = (date.getMonth() + 1).toString().padStart(2, '0'); //月份是从0开始的
1139
- const day = date.getDate().toString().padStart(2, '0');
1140
- const hour = date.getHours().toString().padStart(2, '0');
1141
- const min = date.getMinutes().toString().padStart(2, '0');
1142
- const sec = date.getSeconds().toString().padStart(2, '0');
1143
- const ms = date.getMilliseconds();
1144
- return `[${year}-${month}-${day} ${hour}:${min}:${sec}.${ms}]`;
1145
- };
1146
- var LOG_LEVEL;
1147
- (function (LOG_LEVEL) {
1148
- LOG_LEVEL["info"] = "INFO";
1149
- LOG_LEVEL["log"] = "LOG";
1150
- LOG_LEVEL["error"] = "ERROR";
1151
- LOG_LEVEL["warn"] = "WARN";
1152
- })(LOG_LEVEL || (LOG_LEVEL = {}));
1153
- // 输出日志
1154
- const echo = (logLevel, args = []) => {
1155
- args.unshift(`Realsee Live ${getTime()} <${logLevel}> `);
1156
- switch (logLevel) {
1157
- case LOG_LEVEL.info:
1158
- return console.info(...args);
1159
- case LOG_LEVEL.error:
1160
- return console.error(...args);
1161
- case LOG_LEVEL.warn:
1162
- return console.warn(...args);
1163
- default:
1164
- return console.log(...args);
1165
- }
1166
- };
1167
- const log = (...args) => echo(LOG_LEVEL.log, args);
1168
- const info = (...args) => echo(LOG_LEVEL.info, args);
1169
- const error = (...args) => echo(LOG_LEVEL.error, args);
1170
- const warn = (...args) => echo(LOG_LEVEL.warn, args);
1171
- const logger = {
1172
- log,
1173
- info,
1174
- error,
1175
- warn,
1176
- };
1177
- var logger$1 = logger;
1178
-
1179
1184
  /**
1180
1185
  * 具有鲁棒性的WebSocket封装
1181
1186
  * 1、自动重连
1182
1187
  * 2、可根据网络情况进行重连
1183
1188
  */
1184
1189
  class RobustWebSocket extends Subscribe {
1190
+ get attempts() {
1191
+ return this._attempts;
1192
+ }
1185
1193
  constructor(options) {
1186
1194
  // eslint-disable-next-line @typescript-eslint/no-unsafe-call
1187
1195
  super();
@@ -1429,9 +1437,6 @@ class RobustWebSocket extends Subscribe {
1429
1437
  }
1430
1438
  this._startHealthCheck();
1431
1439
  }
1432
- get attempts() {
1433
- return this._attempts;
1434
- }
1435
1440
  setOptions(options) {
1436
1441
  if (!options)
1437
1442
  return;
@@ -1473,6 +1478,14 @@ class RobustWebSocket extends Subscribe {
1473
1478
  }
1474
1479
 
1475
1480
  class LiveController extends Subscribe {
1481
+ set state(state) {
1482
+ const prevState = JSON.parse(JSON.stringify(this._state));
1483
+ this._state = state;
1484
+ this.emit('stateChange', this.state, prevState);
1485
+ }
1486
+ get state() {
1487
+ return this._state;
1488
+ }
1476
1489
  constructor() {
1477
1490
  super();
1478
1491
  /**
@@ -1602,14 +1615,6 @@ class LiveController extends Subscribe {
1602
1615
  });
1603
1616
  this._addWebSocketEventListeners();
1604
1617
  }
1605
- set state(state) {
1606
- const prevState = JSON.parse(JSON.stringify(this._state));
1607
- this._state = state;
1608
- this.emit('stateChange', this.state, prevState);
1609
- }
1610
- get state() {
1611
- return this._state;
1612
- }
1613
1618
  /**
1614
1619
  * 发送数据
1615
1620
  * @param data
@@ -1641,6 +1646,65 @@ const _clearLiveInstanceIfNeed = () => {
1641
1646
  }
1642
1647
  };
1643
1648
  class Live extends Subscribe {
1649
+ get options() {
1650
+ return Object.freeze(this._options || {});
1651
+ }
1652
+ /**
1653
+ * 带看状态
1654
+ */
1655
+ get state() {
1656
+ return this._controller.state;
1657
+ }
1658
+ /**
1659
+ * 兼容老逻辑
1660
+ * @deprecated 请直接读取 state 属性字段,未来将移除该属性
1661
+ */
1662
+ get readyState() {
1663
+ return this._controller.state;
1664
+ }
1665
+ /**
1666
+ * 获取当前WebSocket连接的URL。(注意:这个是WebSocket连接的完整连接,附带一些query参数)。
1667
+ * @deprecated 带看不需要关注底层ws的相关信息,未来将移除
1668
+ */
1669
+ get url() {
1670
+ return this.options.url;
1671
+ }
1672
+ /**
1673
+ * 获取当前live使用的RTC实例
1674
+ */
1675
+ get $RTC() {
1676
+ return this._options.rtc;
1677
+ }
1678
+ /**
1679
+ * 获取当前live使用的jsBridge实例
1680
+ */
1681
+ get jsBridge() {
1682
+ return this._options.jsBridge;
1683
+ }
1684
+ /**
1685
+ * 当前帧数据快照
1686
+ */
1687
+ get snapshot() {
1688
+ return this._buildInData.keyframes;
1689
+ }
1690
+ /**
1691
+ * 当前用户信息
1692
+ */
1693
+ get selfInfo() {
1694
+ return this._buildInData.selfInfo;
1695
+ }
1696
+ /**
1697
+ * 当前用户列表
1698
+ */
1699
+ get userList() {
1700
+ return this._buildInData.userList || [];
1701
+ }
1702
+ /**
1703
+ * 当前带看房间信息
1704
+ */
1705
+ get roomInfo() {
1706
+ return this._buildInData.roomInfo;
1707
+ }
1644
1708
  constructor(opts) {
1645
1709
  var _a;
1646
1710
  super();
@@ -1715,7 +1779,7 @@ class Live extends Subscribe {
1715
1779
  this._handleMessage = (liveMsg) => __awaiter(this, void 0, void 0, function* () {
1716
1780
  var _b, _c, _d, _e, _f, _g;
1717
1781
  if (typeof liveMsg === 'object') {
1718
- const { command, data, frontRequestId, code, message } = liveMsg;
1782
+ const { command, data = {}, frontRequestId, code, message } = liveMsg;
1719
1783
  if (code === 'SUCCESS') {
1720
1784
  switch (command) {
1721
1785
  /**
@@ -1885,8 +1949,8 @@ class Live extends Subscribe {
1885
1949
  }
1886
1950
  const { force = false } = options;
1887
1951
  // 检测一下麦克风权限,hack
1888
- if (this._options.rtc && this._options.jsBridge) {
1889
- const res = yield this._options.jsBridge.detectMicro();
1952
+ if (this._options.rtc) {
1953
+ const res = yield this._options.rtc.detectMicro();
1890
1954
  if (!res) {
1891
1955
  return new Error('Failed to obtain microphone authorization');
1892
1956
  }
@@ -2111,65 +2175,6 @@ class Live extends Subscribe {
2111
2175
  Object.assign(window, { $liveController: this._controller, $live: this });
2112
2176
  }
2113
2177
  }
2114
- get options() {
2115
- return Object.freeze(this._options || {});
2116
- }
2117
- /**
2118
- * 带看状态
2119
- */
2120
- get state() {
2121
- return this._controller.state;
2122
- }
2123
- /**
2124
- * 兼容老逻辑
2125
- * @deprecated 请直接读取 state 属性字段,未来将移除该属性
2126
- */
2127
- get readyState() {
2128
- return this._controller.state;
2129
- }
2130
- /**
2131
- * 获取当前WebSocket连接的URL。(注意:这个是WebSocket连接的完整连接,附带一些query参数)。
2132
- * @deprecated 带看不需要关注底层ws的相关信息,未来将移除
2133
- */
2134
- get url() {
2135
- return this.options.url;
2136
- }
2137
- /**
2138
- * 获取当前live使用的RTC实例
2139
- */
2140
- get $RTC() {
2141
- return this._options.rtc;
2142
- }
2143
- /**
2144
- * 获取当前live使用的jsBridge实例
2145
- */
2146
- get jsBridge() {
2147
- return this._options.jsBridge;
2148
- }
2149
- /**
2150
- * 当前帧数据快照
2151
- */
2152
- get snapshot() {
2153
- return this._buildInData.keyframes;
2154
- }
2155
- /**
2156
- * 当前用户信息
2157
- */
2158
- get selfInfo() {
2159
- return this._buildInData.selfInfo;
2160
- }
2161
- /**
2162
- * 当前用户列表
2163
- */
2164
- get userList() {
2165
- return this._buildInData.userList || [];
2166
- }
2167
- /**
2168
- * 当前带看房间信息
2169
- */
2170
- get roomInfo() {
2171
- return this._buildInData.roomInfo;
2172
- }
2173
2178
  /**
2174
2179
  * 修改状态
2175
2180
  * @param evtType
@@ -2265,21 +2270,21 @@ function createLiveReact(options) {
2265
2270
  * @deprecated
2266
2271
  * @returns
2267
2272
  */
2268
- const unsafe__useLiveInstance = React.useCallback(() => useLiveInstance(), [useLiveInstance]);
2273
+ const unsafe__useLiveInstance = () => live;
2269
2274
  /**
2270
2275
  * 使用rtc实例
2271
2276
  */
2272
- const useRTCInstance = React.useCallback(() => useLiveInstance().$RTC, [useLiveInstance]);
2277
+ const useRTCInstance = () => live.$RTC;
2273
2278
  /**
2274
2279
  * 不建议这样使用
2275
2280
  * @deprecated
2276
2281
  * @returns
2277
2282
  */
2278
- const unsafe__useRTCInstance = React.useCallback(() => useRTCInstance(), [useRTCInstance]);
2283
+ const unsafe__useRTCInstance = () => useRTCInstance();
2279
2284
  /**
2280
2285
  * 带看连接操作
2281
2286
  */
2282
- const useConnect = React.useCallback((options) => __awaiter(this, void 0, void 0, function* () { return yield useLiveInstance().connect(options); }), []);
2287
+ const useConnect = () => (options) => __awaiter(this, void 0, void 0, function* () { return yield live.connect(options); });
2283
2288
  /**
2284
2289
  *
2285
2290
  * @param name
@@ -2303,17 +2308,17 @@ function createLiveReact(options) {
2303
2308
  */
2304
2309
  function useLiveAction() {
2305
2310
  const live = useLiveInstance();
2306
- const connect = React__default["default"].useCallback((options) => __awaiter(this, void 0, void 0, function* () { return yield live.connect(options); }), [live]);
2307
- const toggleMicro = React__default["default"].useCallback((microStatus) => live.toggleMicro(microStatus), [live]);
2308
- const broadcast = React__default["default"].useCallback((data, toUserIds, timeout = 0) => __awaiter(this, void 0, void 0, function* () { return yield live.broadcast(data, toUserIds, timeout); }), [live]);
2309
- const exit = React__default["default"].useCallback(() => __awaiter(this, void 0, void 0, function* () { return yield live.exit(); }), [live]);
2310
- const kick = React__default["default"].useCallback((toUserIds) => __awaiter(this, void 0, void 0, function* () { return yield live.kick(toUserIds); }), [live]);
2311
- const forbidMicro = React__default["default"].useCallback((micro, toUserIds = []) => __awaiter(this, void 0, void 0, function* () { return yield live.forbidMicro(micro, toUserIds); }), [live]);
2312
- const forbidSync = React__default["default"].useCallback((sync, toUserIds = []) => live.forbidSync(sync, toUserIds), [live]);
2313
- const getFramesByKey = React__default["default"].useCallback((key) => live.getFramesByKey(key), [live]);
2314
- const sendKeyframe = React__default["default"].useCallback((key, frame) => live.sendKeyframe(key, frame), [live]);
2315
- const setSelfInfo = React__default["default"].useCallback((userInfo) => live.setSelfInfo(userInfo), [live]);
2316
- const updateStatus = React__default["default"].useCallback((evtType, atnType, status, toUserIds) => live.updateStatus(evtType, atnType, status, toUserIds), [live]);
2311
+ const connect = (options) => __awaiter(this, void 0, void 0, function* () { return yield live.connect(options); });
2312
+ const toggleMicro = (microStatus) => live.toggleMicro(microStatus);
2313
+ const broadcast = (data, toUserIds, timeout = 0) => __awaiter(this, void 0, void 0, function* () { return yield live.broadcast(data, toUserIds, timeout); });
2314
+ const exit = () => __awaiter(this, void 0, void 0, function* () { return yield live.exit(); });
2315
+ const kick = (toUserIds) => __awaiter(this, void 0, void 0, function* () { return yield live.kick(toUserIds); });
2316
+ const forbidMicro = (micro, toUserIds = []) => __awaiter(this, void 0, void 0, function* () { return yield live.forbidMicro(micro, toUserIds); });
2317
+ const forbidSync = (sync, toUserIds = []) => live.forbidSync(sync, toUserIds);
2318
+ const getFramesByKey = (key) => live.getFramesByKey(key);
2319
+ const sendKeyframe = (key, frame) => live.sendKeyframe(key, frame);
2320
+ const setSelfInfo = (userInfo) => live.setSelfInfo(userInfo);
2321
+ const updateStatus = (evtType, atnType, status, toUserIds) => live.updateStatus(evtType, atnType, status, toUserIds);
2317
2322
  return {
2318
2323
  connect,
2319
2324
  broadcast,
@@ -2367,11 +2372,11 @@ function createLiveReact(options) {
2367
2372
  }
2368
2373
  function useRTCAction() {
2369
2374
  const live = useLiveInstance();
2370
- const join = React__default["default"].useCallback((options) => live.$RTC.join(options), [live]);
2371
- const quit = React__default["default"].useCallback(() => live.$RTC.quit(), [live]);
2372
- const shock = React__default["default"].useCallback(() => { var _a, _b; return (_b = (_a = live.$RTC).shock) === null || _b === void 0 ? void 0 : _b.call(_a); }, [live]);
2373
- const toggleMicro = React__default["default"].useCallback((flag) => live.$RTC.toggleMicro(flag), [live]);
2374
- const detectMicro = React__default["default"].useCallback(() => live.$RTC.detectMicro(), [live]);
2375
+ const join = (options) => live.$RTC.join(options);
2376
+ const quit = () => live.$RTC.quit();
2377
+ const shock = () => { var _a, _b; return (_b = (_a = live.$RTC).shock) === null || _b === void 0 ? void 0 : _b.call(_a); };
2378
+ const toggleMicro = (flag) => live.$RTC.toggleMicro(flag);
2379
+ const detectMicro = () => live.$RTC.detectMicro();
2375
2380
  return {
2376
2381
  join,
2377
2382
  quit,