@byteplus/veplayer-plugin 2.8.0-rc.6 → 2.8.0-rc.7

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.
@@ -4960,6 +4960,7 @@
4960
4960
  enableSei: false,
4961
4961
  enableOriginSdpLogger: false,
4962
4962
  checkStatsErrorDelay: 5e3,
4963
+ connectionStateChangeTimeout: 5e3,
4963
4964
  enableNetworkQuality: false,
4964
4965
  networkQuality: {
4965
4966
  networkQos: {
@@ -6733,6 +6734,7 @@
6733
6734
  _defineProperty$2(_assertThisInitialized$1(_this), "_preVideoStats", null);
6734
6735
  _defineProperty$2(_assertThisInitialized$1(_this), "_rtcReportTimer", 0);
6735
6736
  _defineProperty$2(_assertThisInitialized$1(_this), "_networkQualityResult", []);
6737
+ _defineProperty$2(_assertThisInitialized$1(_this), "_peerStateTimer", null);
6736
6738
  _defineProperty$2(_assertThisInitialized$1(_this), "_checkStatsError", /* @__PURE__ */ _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee2() {
6737
6739
  return _regeneratorRuntime$1().wrap(function _callee2$(_context2) {
6738
6740
  while (1)
@@ -6964,6 +6966,7 @@
6964
6966
  pc.addEventListener("track", this._onTrack);
6965
6967
  pc.addEventListener("connectionstatechange", function() {
6966
6968
  logger.warn("onconnectionstatechange:", pc.connectionState);
6969
+ _this3._clearPeerStateTimeout();
6967
6970
  _this3.emit(EXTEND_EVENTS.RTC_STATE_CHANGE, {
6968
6971
  state: pc.connectionState,
6969
6972
  url: _this3._url
@@ -7100,7 +7103,7 @@
7100
7103
  this._videoTransceicer = pc.addTransceiver("video", {
7101
7104
  direction: "recvonly"
7102
7105
  });
7103
- !this._opts.enableAdaptiveJitterBuffer && this._setDelay(this._opts.delayHint, this._opts.videoDelaySync);
7106
+ this._opts.delayHint !== void 0 && this._setDelay(this._opts.delayHint, this._opts.videoDelaySync);
7104
7107
  if (this._opts.enableSei) {
7105
7108
  this.initVideoEncodedTransform();
7106
7109
  this.initAudioEncodedTransform();
@@ -7223,64 +7226,84 @@
7223
7226
  return this._pc.setRemoteDescription(answer.remoteSdp);
7224
7227
  case 52:
7225
7228
  this._networkEvaluate = new NetworkEvaluate(pc, this._opts.networkEvaluateInterval);
7226
- _context4.next = 58;
7229
+ this._listenPeerStateTimeout();
7230
+ _context4.next = 59;
7227
7231
  break;
7228
- case 55:
7229
- _context4.prev = 55;
7232
+ case 56:
7233
+ _context4.prev = 56;
7230
7234
  _context4.t0 = _context4["catch"](23);
7231
7235
  this._emitError(StreamingError.network(_context4.t0));
7232
- case 58:
7236
+ case 59:
7233
7237
  case "end":
7234
7238
  return _context4.stop();
7235
7239
  }
7236
- }, _callee4, this, [[23, 55]]);
7240
+ }, _callee4, this, [[23, 56]]);
7237
7241
  }));
7238
7242
  function _connect() {
7239
7243
  return _connect2.apply(this, arguments);
7240
7244
  }
7241
7245
  return _connect;
7242
7246
  }()
7247
+ }, {
7248
+ key: "_listenPeerStateTimeout",
7249
+ value: function _listenPeerStateTimeout() {
7250
+ var _this6 = this;
7251
+ this._peerStateTimer && this._clearPeerStateTimeout();
7252
+ if (this._opts.connectionStateChangeTimeout) {
7253
+ this._peerStateTimer = setTimeout(function() {
7254
+ _this6._emitError(StreamingError.create(ERR.MEDIA, ERR.SUB_TYPES.MEDIA_ERR_SRC_NOT_SUPPORTED, {
7255
+ message: "listen connectionstatechange timeout"
7256
+ }));
7257
+ }, this._opts.connectionStateChangeTimeout);
7258
+ }
7259
+ }
7260
+ }, {
7261
+ key: "_clearPeerStateTimeout",
7262
+ value: function _clearPeerStateTimeout() {
7263
+ clearTimeout(this._peerStateTimer);
7264
+ this._peerStateTimer = null;
7265
+ }
7243
7266
  }, {
7244
7267
  key: "_startRtcReport",
7245
7268
  value: function _startRtcReport() {
7246
- var _this6 = this;
7269
+ var _this7 = this;
7247
7270
  this._stopRtcReport();
7248
7271
  this._rtcReportTimer = setInterval(/* @__PURE__ */ _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee5() {
7249
- var _yield$Promise$all, _yield$Promise$all2, curAudioStats, curVideoStats, _this6$_audioStallObs, _this6$_videoStallObs, _this6$_networkQualit, _this6$_networkQualit2, audioStats, videoStats, audioStallInfo, videoStallInfo, _ref4, _ref5, quality, qualityInfo, targetDelay;
7272
+ var _yield$Promise$all, _yield$Promise$all2, curAudioStats, curVideoStats, _this7$_audioStallObs, _this7$_videoStallObs, _this7$_networkQualit, _this7$_networkQualit2, audioStats, videoStats, audioStallInfo, videoStallInfo, _ref4, _ref5, quality, qualityInfo, targetDelay;
7250
7273
  return _regeneratorRuntime$1().wrap(function _callee5$(_context5) {
7251
7274
  while (1)
7252
7275
  switch (_context5.prev = _context5.next) {
7253
7276
  case 0:
7254
- if (!_this6._audioStallObserver && _this6._audioTransceicer) {
7255
- _this6._audioStallObserver = new AudioStallObserver();
7256
- _this6._audioStallObserver.start(_this6._audioTransceicer);
7277
+ if (!_this7._audioStallObserver && _this7._audioTransceicer) {
7278
+ _this7._audioStallObserver = new AudioStallObserver();
7279
+ _this7._audioStallObserver.start(_this7._audioTransceicer);
7257
7280
  }
7258
- if (!_this6._videoStallObserver && _this6._video) {
7259
- _this6._videoStallObserver = new VideoStallObserver();
7260
- _this6._videoStallObserver.start(_this6._media);
7281
+ if (!_this7._videoStallObserver && _this7._video) {
7282
+ _this7._videoStallObserver = new VideoStallObserver();
7283
+ _this7._videoStallObserver.start(_this7._media);
7261
7284
  }
7262
- if (!_this6._networkQuality && _this6._opts.enableNetworkQuality) {
7263
- _this6._networkQuality = new NetworkQuality(_this6._pc, _this6._opts.networkQuality);
7285
+ if (!_this7._networkQuality && _this7._opts.enableNetworkQuality) {
7286
+ _this7._networkQuality = new NetworkQuality(_this7._pc, _this7._opts.networkQuality);
7264
7287
  }
7265
7288
  _context5.next = 5;
7266
- return Promise.all([getRecvAudioStats(_this6._audioTransceicer.receiver.getStats()), getRecvVideoStats(_this6._videoTransceicer.receiver.getStats())]);
7289
+ return Promise.all([getRecvAudioStats(_this7._audioTransceicer.receiver.getStats()), getRecvVideoStats(_this7._videoTransceicer.receiver.getStats())]);
7267
7290
  case 5:
7268
7291
  _yield$Promise$all = _context5.sent;
7269
7292
  _yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
7270
7293
  curAudioStats = _yield$Promise$all2[0];
7271
7294
  curVideoStats = _yield$Promise$all2[1];
7272
- if (!(_this6._preAudioStats && _this6._preVideoStats)) {
7295
+ if (!(_this7._preAudioStats && _this7._preVideoStats)) {
7273
7296
  _context5.next = 21;
7274
7297
  break;
7275
7298
  }
7276
- audioStats = diffRecvAudioStats(_this6._preAudioStats, curAudioStats);
7277
- videoStats = diffRecvVideoStats(_this6._preVideoStats, curVideoStats);
7299
+ audioStats = diffRecvAudioStats(_this7._preAudioStats, curAudioStats);
7300
+ videoStats = diffRecvVideoStats(_this7._preVideoStats, curVideoStats);
7278
7301
  _context5.next = 14;
7279
- return (_this6$_audioStallObs = _this6._audioStallObserver) === null || _this6$_audioStallObs === void 0 ? void 0 : _this6$_audioStallObs.getAudioStallInfo();
7302
+ return (_this7$_audioStallObs = _this7._audioStallObserver) === null || _this7$_audioStallObs === void 0 ? void 0 : _this7$_audioStallObs.getAudioStallInfo();
7280
7303
  case 14:
7281
7304
  audioStallInfo = _context5.sent;
7282
7305
  _context5.next = 17;
7283
- return (_this6$_videoStallObs = _this6._videoStallObserver) === null || _this6$_videoStallObs === void 0 ? void 0 : _this6$_videoStallObs.getStallInfo({
7306
+ return (_this7$_videoStallObs = _this7._videoStallObserver) === null || _this7$_videoStallObs === void 0 ? void 0 : _this7$_videoStallObs.getStallInfo({
7284
7307
  interval: videoStats.statsInterval,
7285
7308
  frameRateReceived: videoStats.frameRateReceived,
7286
7309
  frameRateDecoded: videoStats.frameRateDecoded,
@@ -7288,15 +7311,15 @@
7288
7311
  });
7289
7312
  case 17:
7290
7313
  videoStallInfo = _context5.sent;
7291
- _ref4 = (_this6$_networkQualit = (_this6$_networkQualit2 = _this6._networkQuality) === null || _this6$_networkQualit2 === void 0 ? void 0 : _this6$_networkQualit2.getDownlinkQuality(_objectSpread2$2(_objectSpread2$2({}, audioStats), {}, {
7314
+ _ref4 = (_this7$_networkQualit = (_this7$_networkQualit2 = _this7._networkQuality) === null || _this7$_networkQualit2 === void 0 ? void 0 : _this7$_networkQualit2.getDownlinkQuality(_objectSpread2$2(_objectSpread2$2({}, audioStats), {}, {
7292
7315
  stallDuration: audioStallInfo.stallDuration
7293
7316
  }), _objectSpread2$2(_objectSpread2$2({}, videoStats), {}, {
7294
7317
  stallDuration: videoStallInfo.stall.stallDuration100ms
7295
- }))) !== null && _this6$_networkQualit !== void 0 ? _this6$_networkQualit : [], _ref5 = _slicedToArray(_ref4, 2), quality = _ref5[0], qualityInfo = _ref5[1];
7296
- if (_this6._opts.enableAdaptiveJitterBuffer) {
7297
- targetDelay = _this6._handleJitterBuffer(qualityInfo === null || qualityInfo === void 0 ? void 0 : qualityInfo.qualityQos, _this6._opts.adaptiveJitterBuffer, _this6._opts.networkStrategy);
7318
+ }))) !== null && _this7$_networkQualit !== void 0 ? _this7$_networkQualit : [], _ref5 = _slicedToArray(_ref4, 2), quality = _ref5[0], qualityInfo = _ref5[1];
7319
+ if (_this7._opts.enableAdaptiveJitterBuffer) {
7320
+ targetDelay = _this7._handleJitterBuffer(qualityInfo === null || qualityInfo === void 0 ? void 0 : qualityInfo.qualityQos, _this7._opts.adaptiveJitterBuffer, _this7._opts.networkStrategy);
7298
7321
  }
7299
- _this6.emit(EXTEND_EVENTS.RTC_NETWORK, {
7322
+ _this7.emit(EXTEND_EVENTS.RTC_NETWORK, {
7300
7323
  interval: videoStats.statsInterval,
7301
7324
  visibility_state: document.visibilityState,
7302
7325
  network_quality: quality,
@@ -7323,12 +7346,12 @@
7323
7346
  quality_qos: qualityInfo === null || qualityInfo === void 0 ? void 0 : qualityInfo.qualityQos,
7324
7347
  quality_audio_qoe: qualityInfo === null || qualityInfo === void 0 ? void 0 : qualityInfo.audioQoe,
7325
7348
  quality_video_qoe: qualityInfo === null || qualityInfo === void 0 ? void 0 : qualityInfo.videoQoe,
7326
- current_delay: _this6._getDelay(),
7349
+ current_delay: _this7._getDelay(),
7327
7350
  target_delay: targetDelay
7328
7351
  });
7329
7352
  case 21:
7330
- _this6._preAudioStats = curAudioStats;
7331
- _this6._preVideoStats = curVideoStats;
7353
+ _this7._preAudioStats = curAudioStats;
7354
+ _this7._preVideoStats = curVideoStats;
7332
7355
  case 23:
7333
7356
  case "end":
7334
7357
  return _context5.stop();
@@ -7381,6 +7404,7 @@
7381
7404
  (_this$_networkEvaluat2 = this._networkEvaluate) === null || _this$_networkEvaluat2 === void 0 ? void 0 : _this$_networkEvaluat2.destroy();
7382
7405
  this._stopRtcReport();
7383
7406
  clearTimeout(this._checkStatsErrorTimer);
7407
+ this._clearPeerStateTimeout();
7384
7408
  this._audioTransceicer = null;
7385
7409
  this._videoTransceicer = null;
7386
7410
  this._mediaStream = null;
@@ -7391,6 +7415,7 @@
7391
7415
  value: function _emitError(error) {
7392
7416
  this.emit(EVENT.ERROR, error);
7393
7417
  clearTimeout(this._checkStatsErrorTimer);
7418
+ this._clearPeerStateTimeout();
7394
7419
  if (this._pc) {
7395
7420
  this._pc.close();
7396
7421
  }
@@ -7535,7 +7560,7 @@
7535
7560
  }, {
7536
7561
  key: "version",
7537
7562
  get: function get() {
7538
- return "0.2.1-alpha.33";
7563
+ return "0.2.1-alpha.34";
7539
7564
  }
7540
7565
  }, {
7541
7566
  key: "beforePlayerInit",