@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.
@@ -256,7 +256,7 @@ class BrowserRTC extends CoreRTC {
256
256
  userId: options.userId,
257
257
  });
258
258
  // 1. 创建client
259
- this._trtc.client = TRTC.createClient(Object.assign({ mode: 'rtc' }, createClientOptions));
259
+ this._trtc.client = TRTC.createClient(Object.assign(Object.assign({ mode: 'rtc' }, createClientOptions), { enableAutoPlayDialog: typeof this._autoPlayConfirm === 'function' ? false : true }));
260
260
  (_a = this._trtc.client) === null || _a === void 0 ? void 0 : _a.enableAudioVolumeEvaluation();
261
261
  // 2. 订阅事件
262
262
  this._registerRtcEvent();
@@ -305,9 +305,24 @@ class BrowserRTC extends CoreRTC {
305
305
  dom.id = domId;
306
306
  this.$dom.appendChild(dom);
307
307
  // 播放远端流
308
- remoteStream.play(domId);
308
+ if (typeof this._autoPlayConfirm === 'function') {
309
+ remoteStream.play(domId).catch((error) => { });
310
+ remoteStream.on('error', (error) => {
311
+ const errorCode = error.getCode();
312
+ if (errorCode === 0x4043) {
313
+ // PLAY_NOT_ALLOWED,引导用户手势操作并调用 stream.resume 恢复音视频播放
314
+ const onConfirm = () => remoteStream.resume();
315
+ this._autoPlayConfirm({ onConfirm });
316
+ }
317
+ });
318
+ }
319
+ else {
320
+ remoteStream.play(domId);
321
+ }
309
322
  };
310
323
  this._getVoiceSign = options.getVoiceSign;
324
+ // @ts-ignore
325
+ this._autoPlayConfirm = options.autoPlayConfirm;
311
326
  this._initParentDom();
312
327
  }
313
328
  _initParentDom() {
@@ -3775,8 +3790,10 @@ class Live extends Subscribe$1 {
3775
3790
  }
3776
3791
  case RTCType.RealseeBrowserRTC: {
3777
3792
  // 内置的 RealseeBrowserRTC
3793
+ logger$1.error('autoPlayConfirm method must be passed when using built-in RTC instances');
3778
3794
  return new BrowserRTC({
3779
3795
  getVoiceSign: this._options.getVoiceSign,
3796
+ autoPlayConfirm: this._options.autoPlayConfirm,
3780
3797
  });
3781
3798
  }
3782
3799
  default: {
@@ -3803,7 +3820,10 @@ class Live extends Subscribe$1 {
3803
3820
  ? new BrowserRTC4Chime({
3804
3821
  getVoiceSign: this._options.getVoiceSign,
3805
3822
  })
3806
- : new BrowserRTC({ getVoiceSign: this._options.getVoiceSign });
3823
+ : new BrowserRTC({
3824
+ getVoiceSign: this._options.getVoiceSign,
3825
+ autoPlayConfirm: this._options.autoPlayConfirm,
3826
+ });
3807
3827
  }
3808
3828
  }
3809
3829
  else {