@realsee/live 0.4.0-beta.3 → 0.4.0-beta.6

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.
@@ -24,11 +24,11 @@ export declare class LiveController<Snapshot extends Record<string, any>> {
24
24
  onEvtMsgListener?: (evt: MessageEvent) => void;
25
25
  onEvtErrListener?: (evt: Event) => void;
26
26
  onEvtCLEListener?: (evt: CloseEvent) => void;
27
- dispose: () => void;
27
+ dispose: () => boolean;
28
28
  /**
29
29
  * 销毁WebSocket相关依赖。
30
30
  */
31
- disposeWebSocket: () => void;
31
+ disposeWebSocket: () => true | undefined;
32
32
  /**
33
33
  * 解析数据
34
34
  * @param liveMsg
@@ -500,6 +500,8 @@ class BrowserRTC4Chime extends CoreRTC {
500
500
  });
501
501
  }
502
502
  quit() {
503
+ if (!this.joined)
504
+ return Promise.resolve(true);
503
505
  return new Promise((success, fail) => {
504
506
  var _a, _b;
505
507
  this.joined = false;
@@ -1066,6 +1068,7 @@ class LiveController {
1066
1068
  clearInterval(this.healthCheckId);
1067
1069
  this.healthCheckId = undefined;
1068
1070
  }
1071
+ return true;
1069
1072
  };
1070
1073
  /**
1071
1074
  * 销毁WebSocket相关依赖。
@@ -1091,6 +1094,7 @@ class LiveController {
1091
1094
  }
1092
1095
  this.webSocket.close();
1093
1096
  this.webSocket = undefined;
1097
+ return true;
1094
1098
  };
1095
1099
  this.options = Object.assign({ autoConnect: true, healthCheck: 3000 }, options);
1096
1100
  }
@@ -1269,7 +1273,7 @@ function createLive(options) {
1269
1273
  super();
1270
1274
  this.keyframes = new Subscribe();
1271
1275
  const jsBridge = (() => {
1272
- if (!options.jsBridge)
1276
+ if (options.jsBridge)
1273
1277
  return options.jsBridge;
1274
1278
  if (options.useBuiltInJsBridge)
1275
1279
  return new JSBridge__default["default"]();
@@ -1500,8 +1504,14 @@ function createLive(options) {
1500
1504
  }
1501
1505
  async exit() {
1502
1506
  /** 退出强制关闭语音(?) */
1503
- await this.$RTC.quit();
1504
- return await this.updateStatus(exports.BuiltinEventType.RoomChange, exports.BuiltinActionType.RoomClose, {});
1507
+ try {
1508
+ this.$RTC.quit();
1509
+ await this.updateStatus(exports.BuiltinEventType.RoomChange, exports.BuiltinActionType.RoomClose, {});
1510
+ }
1511
+ catch (e) {
1512
+ console.log(e);
1513
+ }
1514
+ return liveController.dispose();
1505
1515
  }
1506
1516
  async connect(options = {}) {
1507
1517
  // 连接 WebSocket 前验证麦克风权限