@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.
@@ -265,7 +265,7 @@ class BrowserRTC extends CoreRTC {
265
265
  userId: options.userId,
266
266
  });
267
267
  // 1. 创建client
268
- this._trtc.client = TRTC__default["default"].createClient(Object.assign({ mode: 'rtc' }, createClientOptions));
268
+ this._trtc.client = TRTC__default["default"].createClient(Object.assign(Object.assign({ mode: 'rtc' }, createClientOptions), { enableAutoPlayDialog: typeof this._autoPlayConfirm === 'function' ? false : true }));
269
269
  (_a = this._trtc.client) === null || _a === void 0 ? void 0 : _a.enableAudioVolumeEvaluation();
270
270
  // 2. 订阅事件
271
271
  this._registerRtcEvent();
@@ -314,9 +314,24 @@ class BrowserRTC extends CoreRTC {
314
314
  dom.id = domId;
315
315
  this.$dom.appendChild(dom);
316
316
  // 播放远端流
317
- remoteStream.play(domId);
317
+ if (typeof this._autoPlayConfirm === 'function') {
318
+ remoteStream.play(domId).catch((error) => { });
319
+ remoteStream.on('error', (error) => {
320
+ const errorCode = error.getCode();
321
+ if (errorCode === 0x4043) {
322
+ // PLAY_NOT_ALLOWED,引导用户手势操作并调用 stream.resume 恢复音视频播放
323
+ const onConfirm = () => remoteStream.resume();
324
+ this._autoPlayConfirm({ onConfirm });
325
+ }
326
+ });
327
+ }
328
+ else {
329
+ remoteStream.play(domId);
330
+ }
318
331
  };
319
332
  this._getVoiceSign = options.getVoiceSign;
333
+ // @ts-ignore
334
+ this._autoPlayConfirm = options.autoPlayConfirm;
320
335
  this._initParentDom();
321
336
  }
322
337
  _initParentDom() {
@@ -3784,8 +3799,10 @@ class Live extends Subscribe$1 {
3784
3799
  }
3785
3800
  case exports.RTCType.RealseeBrowserRTC: {
3786
3801
  // 内置的 RealseeBrowserRTC
3802
+ logger$1.error('autoPlayConfirm method must be passed when using built-in RTC instances');
3787
3803
  return new BrowserRTC({
3788
3804
  getVoiceSign: this._options.getVoiceSign,
3805
+ autoPlayConfirm: this._options.autoPlayConfirm,
3789
3806
  });
3790
3807
  }
3791
3808
  default: {
@@ -3812,7 +3829,10 @@ class Live extends Subscribe$1 {
3812
3829
  ? new BrowserRTC4Chime({
3813
3830
  getVoiceSign: this._options.getVoiceSign,
3814
3831
  })
3815
- : new BrowserRTC({ getVoiceSign: this._options.getVoiceSign });
3832
+ : new BrowserRTC({
3833
+ getVoiceSign: this._options.getVoiceSign,
3834
+ autoPlayConfirm: this._options.autoPlayConfirm,
3835
+ });
3816
3836
  }
3817
3837
  }
3818
3838
  else {