@realsee/live 0.5.0-alpha.11 → 0.5.0-alpha.14

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.
@@ -20,7 +20,7 @@ export declare function createLiveReact<KeyframesSnapshot>(options: LiveOptions)
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>;
@@ -1715,7 +1715,7 @@ class Live extends Subscribe {
1715
1715
  this._handleMessage = (liveMsg) => __awaiter(this, void 0, void 0, function* () {
1716
1716
  var _b, _c, _d, _e, _f, _g;
1717
1717
  if (typeof liveMsg === 'object') {
1718
- const { command, data, frontRequestId, code, message } = liveMsg;
1718
+ const { command, data = {}, frontRequestId, code, message } = liveMsg;
1719
1719
  if (code === 'SUCCESS') {
1720
1720
  switch (command) {
1721
1721
  /**
@@ -2265,11 +2265,11 @@ function createLiveReact(options) {
2265
2265
  * @deprecated
2266
2266
  * @returns
2267
2267
  */
2268
- const unsafe__useLiveInstance = () => useLiveInstance();
2268
+ const unsafe__useLiveInstance = () => live;
2269
2269
  /**
2270
2270
  * 使用rtc实例
2271
2271
  */
2272
- const useRTCInstance = () => useLiveInstance().$RTC;
2272
+ const useRTCInstance = () => live.$RTC;
2273
2273
  /**
2274
2274
  * 不建议这样使用
2275
2275
  * @deprecated
@@ -2279,7 +2279,7 @@ function createLiveReact(options) {
2279
2279
  /**
2280
2280
  * 带看连接操作
2281
2281
  */
2282
- const useConnect = () => (options) => __awaiter(this, void 0, void 0, function* () { return yield useLiveInstance().connect(options); });
2282
+ const useConnect = () => (options) => __awaiter(this, void 0, void 0, function* () { return yield live.connect(options); });
2283
2283
  /**
2284
2284
  *
2285
2285
  * @param name
@@ -2303,17 +2303,17 @@ function createLiveReact(options) {
2303
2303
  */
2304
2304
  function useLiveAction() {
2305
2305
  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]);
2306
+ const connect = (options) => __awaiter(this, void 0, void 0, function* () { return yield live.connect(options); });
2307
+ const toggleMicro = (microStatus) => live.toggleMicro(microStatus);
2308
+ const broadcast = (data, toUserIds, timeout = 0) => __awaiter(this, void 0, void 0, function* () { return yield live.broadcast(data, toUserIds, timeout); });
2309
+ const exit = () => __awaiter(this, void 0, void 0, function* () { return yield live.exit(); });
2310
+ const kick = (toUserIds) => __awaiter(this, void 0, void 0, function* () { return yield live.kick(toUserIds); });
2311
+ const forbidMicro = (micro, toUserIds = []) => __awaiter(this, void 0, void 0, function* () { return yield live.forbidMicro(micro, toUserIds); });
2312
+ const forbidSync = (sync, toUserIds = []) => live.forbidSync(sync, toUserIds);
2313
+ const getFramesByKey = (key) => live.getFramesByKey(key);
2314
+ const sendKeyframe = (key, frame) => live.sendKeyframe(key, frame);
2315
+ const setSelfInfo = (userInfo) => live.setSelfInfo(userInfo);
2316
+ const updateStatus = (evtType, atnType, status, toUserIds) => live.updateStatus(evtType, atnType, status, toUserIds);
2317
2317
  return {
2318
2318
  connect,
2319
2319
  broadcast,
@@ -2367,11 +2367,11 @@ function createLiveReact(options) {
2367
2367
  }
2368
2368
  function useRTCAction() {
2369
2369
  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]);
2370
+ const join = (options) => live.$RTC.join(options);
2371
+ const quit = () => live.$RTC.quit();
2372
+ const shock = () => { var _a, _b; return (_b = (_a = live.$RTC).shock) === null || _b === void 0 ? void 0 : _b.call(_a); };
2373
+ const toggleMicro = (flag) => live.$RTC.toggleMicro(flag);
2374
+ const detectMicro = () => live.$RTC.detectMicro();
2375
2375
  return {
2376
2376
  join,
2377
2377
  quit,