@realsee/live 0.5.2-dev.4 → 0.5.2-dev.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.
@@ -290,7 +290,7 @@
290
290
  userId: options.userId,
291
291
  });
292
292
  // 1. 创建client
293
- this._trtc.client = TRTC.createClient(Object.assign({ mode: 'rtc' }, createClientOptions));
293
+ this._trtc.client = TRTC.createClient(Object.assign(Object.assign({ mode: 'rtc' }, createClientOptions), { enableAutoPlayDialog: typeof this._autoPlayConfirm === 'function' ? false : true }));
294
294
  (_a = this._trtc.client) === null || _a === void 0 ? void 0 : _a.enableAudioVolumeEvaluation();
295
295
  // 2. 订阅事件
296
296
  this._registerRtcEvent();
@@ -339,9 +339,24 @@
339
339
  dom.id = domId;
340
340
  this.$dom.appendChild(dom);
341
341
  // 播放远端流
342
- remoteStream.play(domId);
342
+ if (typeof this._autoPlayConfirm === 'function') {
343
+ remoteStream.play(domId).catch((error) => { });
344
+ remoteStream.on('error', (error) => {
345
+ const errorCode = error.getCode();
346
+ if (errorCode === 0x4043) {
347
+ // PLAY_NOT_ALLOWED,引导用户手势操作并调用 stream.resume 恢复音视频播放
348
+ const onConfirm = () => remoteStream.resume();
349
+ this._autoPlayConfirm({ onConfirm });
350
+ }
351
+ });
352
+ }
353
+ else {
354
+ remoteStream.play(domId);
355
+ }
343
356
  };
344
357
  this._getVoiceSign = options.getVoiceSign;
358
+ // @ts-ignore
359
+ this._autoPlayConfirm = options.autoPlayConfirm;
345
360
  this._initParentDom();
346
361
  }
347
362
  _initParentDom() {
@@ -51716,6 +51731,8 @@
51716
51731
  this.exit = () => __awaiter$10(this, void 0, void 0, function* () {
51717
51732
  var _l;
51718
51733
  this._clearLiveData();
51734
+ if (this.state !== exports.LiveState.OPEN)
51735
+ return true;
51719
51736
  try {
51720
51737
  /** 退出强制关闭语音 */
51721
51738
  (_l = this.$RTC) === null || _l === void 0 ? void 0 : _l.quit();
@@ -51855,8 +51872,10 @@
51855
51872
  }
51856
51873
  case exports.RTCType.RealseeBrowserRTC: {
51857
51874
  // 内置的 RealseeBrowserRTC
51875
+ logger$1.error('autoPlayConfirm method must be passed when using built-in RTC instances');
51858
51876
  return new BrowserRTC({
51859
51877
  getVoiceSign: this._options.getVoiceSign,
51878
+ autoPlayConfirm: this._options.autoPlayConfirm,
51860
51879
  });
51861
51880
  }
51862
51881
  default: {
@@ -51883,7 +51902,10 @@
51883
51902
  ? new BrowserRTC4Chime({
51884
51903
  getVoiceSign: this._options.getVoiceSign,
51885
51904
  })
51886
- : new BrowserRTC({ getVoiceSign: this._options.getVoiceSign });
51905
+ : new BrowserRTC({
51906
+ getVoiceSign: this._options.getVoiceSign,
51907
+ autoPlayConfirm: this._options.autoPlayConfirm,
51908
+ });
51887
51909
  }
51888
51910
  }
51889
51911
  else {