@realsee/live 0.5.2-dev.5 → 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() {
@@ -51857,8 +51872,10 @@
51857
51872
  }
51858
51873
  case exports.RTCType.RealseeBrowserRTC: {
51859
51874
  // 内置的 RealseeBrowserRTC
51875
+ logger$1.error('autoPlayConfirm method must be passed when using built-in RTC instances');
51860
51876
  return new BrowserRTC({
51861
51877
  getVoiceSign: this._options.getVoiceSign,
51878
+ autoPlayConfirm: this._options.autoPlayConfirm,
51862
51879
  });
51863
51880
  }
51864
51881
  default: {
@@ -51885,7 +51902,10 @@
51885
51902
  ? new BrowserRTC4Chime({
51886
51903
  getVoiceSign: this._options.getVoiceSign,
51887
51904
  })
51888
- : new BrowserRTC({ getVoiceSign: this._options.getVoiceSign });
51905
+ : new BrowserRTC({
51906
+ getVoiceSign: this._options.getVoiceSign,
51907
+ autoPlayConfirm: this._options.autoPlayConfirm,
51908
+ });
51889
51909
  }
51890
51910
  }
51891
51911
  else {