@byteplus/veplayer-plugin 2.8.0-rc.0 → 2.8.0-rc.10

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.
@@ -4955,11 +4955,14 @@
4955
4955
  stallInterval: 400,
4956
4956
  networkEvaluateInterval: 1e3,
4957
4957
  delayHint: 0,
4958
+ videoDelaySync: false,
4958
4959
  seamlesslyReload: false,
4959
4960
  enableSei: false,
4960
4961
  enableOriginSdpLogger: false,
4961
4962
  checkStatsErrorDelay: 5e3,
4963
+ connectionStateChangeTimeout: 5e3,
4962
4964
  enableNetworkQuality: false,
4965
+ hackCreateOfferIssue: false,
4963
4966
  networkQuality: {
4964
4967
  networkQos: {
4965
4968
  1: {
@@ -6163,7 +6166,24 @@
6163
6166
  };
6164
6167
  var VideoStallObserver = /* @__PURE__ */ function() {
6165
6168
  function VideoStallObserver2() {
6169
+ var _this = this;
6166
6170
  _classCallCheck$3(this, VideoStallObserver2);
6171
+ _defineProperty$2(this, "_handleVisibilityChange", function() {
6172
+ if (document.visibilityState === "hidden") {
6173
+ _this._framePause();
6174
+ }
6175
+ });
6176
+ _defineProperty$2(this, "_framePause", function() {
6177
+ if (_this._prePts) {
6178
+ var current = performance.now();
6179
+ var delta = current - _this._prePts;
6180
+ _this._stallList.push({
6181
+ playTime: current,
6182
+ timeUpdateInterval: Math.round(delta)
6183
+ });
6184
+ _this._prePts = void 0;
6185
+ }
6186
+ });
6167
6187
  this._removeHandler = void 0;
6168
6188
  this._remotePlayPauseHandler = void 0;
6169
6189
  this._prePts = void 0;
@@ -6184,20 +6204,20 @@
6184
6204
  _createClass$3(VideoStallObserver2, [{
6185
6205
  key: "start",
6186
6206
  value: function start(player) {
6187
- var _this = this;
6207
+ var _this2 = this;
6188
6208
  this._player = player;
6189
6209
  if (this._support100msStall) {
6190
6210
  if (player) {
6191
6211
  this._requestVideoFrameCallbackTimer = player.requestVideoFrameCallback(this._onVideoRefresh.bind(this));
6192
6212
  this._removeHandler = function() {
6193
- if (_this._requestVideoFrameCallbackTimer) {
6194
- player.cancelVideoFrameCallback(_this._requestVideoFrameCallbackTimer);
6213
+ if (_this2._requestVideoFrameCallbackTimer) {
6214
+ player.cancelVideoFrameCallback(_this2._requestVideoFrameCallbackTimer);
6195
6215
  }
6196
6216
  };
6197
6217
  }
6198
6218
  } else {
6199
6219
  var handle = function handle2() {
6200
- return _this._onVideoTimeupdate(player);
6220
+ return _this2._onVideoTimeupdate(player);
6201
6221
  };
6202
6222
  player.addEventListener("timeupdate", handle);
6203
6223
  this._removeHandler = function() {
@@ -6205,17 +6225,19 @@
6205
6225
  };
6206
6226
  }
6207
6227
  var handlePause = function handlePause2() {
6208
- return _this._onVideoPause();
6228
+ return _this2._onVideoPause();
6209
6229
  };
6210
6230
  player.addEventListener("pause", handlePause);
6211
6231
  var handlePlay = function handlePlay2() {
6212
- return _this._onVideoPlay();
6232
+ return _this2._onVideoPlay();
6213
6233
  };
6214
6234
  player.addEventListener("play", handlePlay);
6215
6235
  this._remotePlayPauseHandler = function() {
6216
6236
  player.removeEventListener("pause", handlePause);
6217
6237
  player.removeEventListener("play", handlePlay);
6218
6238
  };
6239
+ document.addEventListener("visibilitychange", this._handleVisibilityChange);
6240
+ document.addEventListener("pagehide", this._framePause());
6219
6241
  }
6220
6242
  }, {
6221
6243
  key: "stop",
@@ -6233,6 +6255,8 @@
6233
6255
  delete this._prePts;
6234
6256
  this._videoInWaiting100ms = false;
6235
6257
  this._videoInWaiting500ms = false;
6258
+ document.removeEventListener("visibilitychange", this._handleVisibilityChange);
6259
+ document.removeEventListener("pagehide", this._framePause());
6236
6260
  }
6237
6261
  }, {
6238
6262
  key: "destroy",
@@ -6242,7 +6266,7 @@
6242
6266
  }, {
6243
6267
  key: "getStallInfo",
6244
6268
  value: function getStallInfo(_ref) {
6245
- var _this2 = this;
6269
+ var _this3 = this;
6246
6270
  var interval = _ref.interval, frameRateReceived = _ref.frameRateReceived, frameRateDecoded = _ref.frameRateDecoded, bitrate = _ref.bitrate;
6247
6271
  var stallInfo = {
6248
6272
  pts: 0,
@@ -6256,7 +6280,7 @@
6256
6280
  },
6257
6281
  pauseDuration: this._getPauseDuration()
6258
6282
  };
6259
- if (this._stallList) {
6283
+ if (this._stallList && document.visibilityState === "visible" && !this._isPaused) {
6260
6284
  var poorNetworkInSafari = (isSafari() || isFirefox()) && (bitrate === 0 || (frameRateDecoded || Infinity) <= 1 || (frameRateReceived || Infinity) <= 1);
6261
6285
  if (poorNetworkInSafari || this._stallList.length === 0) {
6262
6286
  stallInfo.stall.stallDuration500ms = interval;
@@ -6273,27 +6297,27 @@
6273
6297
  this._stallList.forEach(function(frameRecord, idx) {
6274
6298
  var timeUpdateInterval = frameRecord.timeUpdateInterval, playTime = frameRecord.playTime;
6275
6299
  var stallDuration = timeUpdateInterval;
6276
- if (idx === 0 && (_this2._videoInWaiting100ms || _this2._videoInWaiting500ms)) {
6300
+ if (idx === 0 && (_this3._videoInWaiting100ms || _this3._videoInWaiting500ms)) {
6277
6301
  stallDuration = Math.round(timeUpdateInterval % interval);
6278
6302
  }
6279
- if (timeUpdateInterval > _this2._stallTimeThreshold.stall500ms) {
6303
+ if (timeUpdateInterval > _this3._stallTimeThreshold.stall500ms) {
6280
6304
  stallInfo.stall.stallDuration500ms += stallDuration;
6281
- if (!_this2._videoInWaiting500ms) {
6305
+ if (!_this3._videoInWaiting500ms) {
6282
6306
  stallInfo.stall.stallCount500ms++;
6283
6307
  }
6284
- _this2._videoInWaiting500ms = true;
6308
+ _this3._videoInWaiting500ms = true;
6285
6309
  } else {
6286
- _this2._videoInWaiting500ms = false;
6310
+ _this3._videoInWaiting500ms = false;
6287
6311
  }
6288
- if (_this2._support100msStall) {
6289
- if (timeUpdateInterval > _this2._stallTimeThreshold.stall100ms) {
6312
+ if (_this3._support100msStall) {
6313
+ if (timeUpdateInterval > _this3._stallTimeThreshold.stall100ms) {
6290
6314
  stallInfo.stall.stallDuration100ms += stallDuration;
6291
- if (!_this2._videoInWaiting100ms) {
6315
+ if (!_this3._videoInWaiting100ms) {
6292
6316
  stallInfo.stall.stallCount100ms++;
6293
6317
  }
6294
- _this2._videoInWaiting100ms = true;
6318
+ _this3._videoInWaiting100ms = true;
6295
6319
  } else {
6296
- _this2._videoInWaiting100ms = false;
6320
+ _this3._videoInWaiting100ms = false;
6297
6321
  }
6298
6322
  }
6299
6323
  stallInfo.pts = playTime;
@@ -6332,6 +6356,7 @@
6332
6356
  value: function _onVideoPause() {
6333
6357
  this._isPaused = true;
6334
6358
  this._pauseStart = Date.now();
6359
+ this._framePause();
6335
6360
  }
6336
6361
  }, {
6337
6362
  key: "_onVideoPlay",
@@ -6710,11 +6735,15 @@
6710
6735
  _defineProperty$2(_assertThisInitialized$1(_this), "_preVideoStats", null);
6711
6736
  _defineProperty$2(_assertThisInitialized$1(_this), "_rtcReportTimer", 0);
6712
6737
  _defineProperty$2(_assertThisInitialized$1(_this), "_networkQualityResult", []);
6738
+ _defineProperty$2(_assertThisInitialized$1(_this), "_peerStateTimer", null);
6713
6739
  _defineProperty$2(_assertThisInitialized$1(_this), "_checkStatsError", /* @__PURE__ */ _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee2() {
6714
6740
  return _regeneratorRuntime$1().wrap(function _callee2$(_context2) {
6715
6741
  while (1)
6716
6742
  switch (_context2.prev = _context2.next) {
6717
6743
  case 0:
6744
+ if (_this._checkStatsErrorTimer) {
6745
+ clearTimeout(_this._checkStatsErrorTimer);
6746
+ }
6718
6747
  _this._checkStatsErrorTimer = setTimeout(/* @__PURE__ */ _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee() {
6719
6748
  var stats, _stats$video, framesDecoded, bytesReceived;
6720
6749
  return _regeneratorRuntime$1().wrap(function _callee$(_context) {
@@ -6743,7 +6772,7 @@
6743
6772
  }
6744
6773
  }, _callee);
6745
6774
  })), _this._opts.checkStatsErrorDelay);
6746
- case 1:
6775
+ case 2:
6747
6776
  case "end":
6748
6777
  return _context2.stop();
6749
6778
  }
@@ -6767,7 +6796,6 @@
6767
6796
  });
6768
6797
  _defineProperty$2(_assertThisInitialized$1(_this), "_onLoadedData", function() {
6769
6798
  logger.log("loadeddata emit");
6770
- _this._startRtcReport();
6771
6799
  _this.getStatsSnapshoot().then(function(snap) {
6772
6800
  _this.emit(EVENT.METADATA_PARSED, {
6773
6801
  type: "video",
@@ -6782,6 +6810,7 @@
6782
6810
  });
6783
6811
  });
6784
6812
  _defineProperty$2(_assertThisInitialized$1(_this), "_setDelay", function(delayHint) {
6813
+ var videoDelaySync = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
6785
6814
  var currentDelay = _this._getDelay();
6786
6815
  delayHint = typeof delayHint === "number" && delayHint > 0 ? delayHint : null;
6787
6816
  if (currentDelay === delayHint)
@@ -6798,6 +6827,10 @@
6798
6827
  });
6799
6828
  if (key) {
6800
6829
  audioReceiver[key] = delayHint;
6830
+ if (!videoDelaySync) {
6831
+ videoReceiver[key] = delayHint;
6832
+ logger.log("set videoReceiver.".concat(key, " = ").concat(delayHint));
6833
+ }
6801
6834
  logger.log("set audioReceiver.".concat(key, " = ").concat(delayHint));
6802
6835
  }
6803
6836
  } catch (error) {
@@ -6895,26 +6928,33 @@
6895
6928
  }
6896
6929
  encodedTransformSupported = isLegacyEncodedTransformSupported();
6897
6930
  _context3.prev = 6;
6931
+ if (!this._opts.hackCreateOfferIssue) {
6932
+ _context3.next = 10;
6933
+ break;
6934
+ }
6935
+ _context3.next = 10;
6936
+ return this._createEmptyPeer();
6937
+ case 10:
6898
6938
  this._pc = new RTCPeerConnection({
6899
6939
  encodedInsertableStreams: encodedTransformSupported && this._opts.enableSei ? true : void 0
6900
6940
  });
6901
6941
  this._bindRTCEvents();
6902
- _context3.next = 11;
6942
+ _context3.next = 14;
6903
6943
  return this._connect(url);
6904
- case 11:
6905
- _context3.next = 16;
6944
+ case 14:
6945
+ _context3.next = 19;
6906
6946
  break;
6907
- case 13:
6908
- _context3.prev = 13;
6947
+ case 16:
6948
+ _context3.prev = 16;
6909
6949
  _context3.t0 = _context3["catch"](6);
6910
6950
  setTimeout(function() {
6911
6951
  return _this2._emitError(StreamingError.create(ERR.OTHER, null, _context3.t0));
6912
6952
  });
6913
- case 16:
6953
+ case 19:
6914
6954
  case "end":
6915
6955
  return _context3.stop();
6916
6956
  }
6917
- }, _callee3, this, [[6, 13]]);
6957
+ }, _callee3, this, [[6, 16]]);
6918
6958
  }));
6919
6959
  function load(_x) {
6920
6960
  return _load.apply(this, arguments);
@@ -6934,6 +6974,7 @@
6934
6974
  pc.addEventListener("track", this._onTrack);
6935
6975
  pc.addEventListener("connectionstatechange", function() {
6936
6976
  logger.warn("onconnectionstatechange:", pc.connectionState);
6977
+ _this3._clearPeerStateTimeout();
6937
6978
  _this3.emit(EXTEND_EVENTS.RTC_STATE_CHANGE, {
6938
6979
  state: pc.connectionState,
6939
6980
  url: _this3._url
@@ -6958,6 +6999,7 @@
6958
6999
  elapsed: Date.now() - _this3._rctConnectStartTs
6959
7000
  });
6960
7001
  _this3._checkStatsError();
7002
+ _this3._startRtcReport();
6961
7003
  }
6962
7004
  });
6963
7005
  }
@@ -7069,7 +7111,7 @@
7069
7111
  this._videoTransceicer = pc.addTransceiver("video", {
7070
7112
  direction: "recvonly"
7071
7113
  });
7072
- !this._opts.enableAdaptiveJitterBuffer && this._setDelay(this._opts.delayHint);
7114
+ this._opts.delayHint !== void 0 && this._setDelay(this._opts.delayHint, this._opts.videoDelaySync);
7073
7115
  if (this._opts.enableSei) {
7074
7116
  this.initVideoEncodedTransform();
7075
7117
  this.initAudioEncodedTransform();
@@ -7090,6 +7132,9 @@
7090
7132
  case 13:
7091
7133
  offer = _context4.sent;
7092
7134
  case 14:
7135
+ if (this._opts.hackCreateOfferIssue) {
7136
+ this._createEmptyPeer();
7137
+ }
7093
7138
  logger.log("local offer");
7094
7139
  logger.log(offer.sdp);
7095
7140
  parsed = lib.parse(offer.sdp);
@@ -7114,11 +7159,11 @@
7114
7159
  });
7115
7160
  offer.sdp = lib.write(parsed);
7116
7161
  logger.log("local offer modified:\n", offer.sdp);
7117
- _context4.next = 22;
7162
+ _context4.next = 23;
7118
7163
  return pc.setLocalDescription(offer);
7119
- case 22:
7164
+ case 23:
7120
7165
  finnalUrl = this._url;
7121
- _context4.prev = 23;
7166
+ _context4.prev = 24;
7122
7167
  if (this._opts.preProcessUrl) {
7123
7168
  finnalUrl = this._opts.preProcessUrl(finnalUrl).url;
7124
7169
  }
@@ -7131,7 +7176,7 @@
7131
7176
  sessionId
7132
7177
  });
7133
7178
  reqStart = Date.now();
7134
- _context4.next = 32;
7179
+ _context4.next = 33;
7135
7180
  return this._loader.load(finnalUrl, {
7136
7181
  body: JSON.stringify({
7137
7182
  sessionId,
@@ -7139,27 +7184,27 @@
7139
7184
  localSdp: offer
7140
7185
  })
7141
7186
  });
7142
- case 32:
7187
+ case 33:
7143
7188
  res = _context4.sent;
7144
7189
  this.emit(EVENT.LOAD_RESPONSE_HEADERS, {
7145
7190
  headers: res.response.headers
7146
7191
  });
7147
7192
  answer = res === null || res === void 0 ? void 0 : res.data;
7148
7193
  if (!((answer === null || answer === void 0 ? void 0 : answer.code) === 404 || (answer === null || answer === void 0 ? void 0 : answer.code) === 403)) {
7149
- _context4.next = 40;
7194
+ _context4.next = 41;
7150
7195
  break;
7151
7196
  }
7152
7197
  err = StreamingError.create(answer.code === 404 ? ERR.NETWORK_NOTFOUND : ERR.NETWORK_FORBIDDEN, null, answer);
7153
7198
  err.errorType = ERR.NETWORK;
7154
7199
  this._emitError(err);
7155
7200
  return _context4.abrupt("return");
7156
- case 40:
7201
+ case 41:
7157
7202
  if (!((answer === null || answer === void 0 ? void 0 : answer.code) !== 200)) {
7158
- _context4.next = 42;
7203
+ _context4.next = 43;
7159
7204
  break;
7160
7205
  }
7161
7206
  throw new Error("code: ".concat(answer === null || answer === void 0 ? void 0 : answer.code, ", message:").concat(answer === null || answer === void 0 ? void 0 : answer.message));
7162
- case 42:
7207
+ case 43:
7163
7208
  logger.log("answer:");
7164
7209
  logger.log((_answer$remoteSdp = answer.remoteSdp) === null || _answer$remoteSdp === void 0 ? void 0 : _answer$remoteSdp.sdp);
7165
7210
  _parsed = lib.parse(answer.remoteSdp.sdp);
@@ -7188,67 +7233,88 @@
7188
7233
  answer.remoteSdp.sdp = lib.write(_parsed);
7189
7234
  logger.log("answer modified:\n", answer.remoteSdp.sdp);
7190
7235
  this._rctConnectStartTs = Date.now();
7191
- _context4.next = 52;
7236
+ _context4.next = 53;
7192
7237
  return this._pc.setRemoteDescription(answer.remoteSdp);
7193
- case 52:
7238
+ case 53:
7194
7239
  this._networkEvaluate = new NetworkEvaluate(pc, this._opts.networkEvaluateInterval);
7195
- _context4.next = 58;
7240
+ this._listenPeerStateTimeout();
7241
+ _context4.next = 60;
7196
7242
  break;
7197
- case 55:
7198
- _context4.prev = 55;
7199
- _context4.t0 = _context4["catch"](23);
7243
+ case 57:
7244
+ _context4.prev = 57;
7245
+ _context4.t0 = _context4["catch"](24);
7200
7246
  this._emitError(StreamingError.network(_context4.t0));
7201
- case 58:
7247
+ case 60:
7202
7248
  case "end":
7203
7249
  return _context4.stop();
7204
7250
  }
7205
- }, _callee4, this, [[23, 55]]);
7251
+ }, _callee4, this, [[24, 57]]);
7206
7252
  }));
7207
7253
  function _connect() {
7208
7254
  return _connect2.apply(this, arguments);
7209
7255
  }
7210
7256
  return _connect;
7211
7257
  }()
7258
+ }, {
7259
+ key: "_listenPeerStateTimeout",
7260
+ value: function _listenPeerStateTimeout() {
7261
+ var _this6 = this;
7262
+ this._peerStateTimer && this._clearPeerStateTimeout();
7263
+ if (this._opts.connectionStateChangeTimeout) {
7264
+ this._peerStateTimer = setTimeout(function() {
7265
+ _this6._emitError(StreamingError.create(ERR.MEDIA, ERR.SUB_TYPES.MEDIA_ERR_SRC_NOT_SUPPORTED, {
7266
+ message: "listen connectionstatechange timeout"
7267
+ }));
7268
+ }, this._opts.connectionStateChangeTimeout);
7269
+ }
7270
+ }
7271
+ }, {
7272
+ key: "_clearPeerStateTimeout",
7273
+ value: function _clearPeerStateTimeout() {
7274
+ clearTimeout(this._peerStateTimer);
7275
+ this._peerStateTimer = null;
7276
+ }
7212
7277
  }, {
7213
7278
  key: "_startRtcReport",
7214
7279
  value: function _startRtcReport() {
7215
- var _this6 = this;
7280
+ var _this7 = this;
7281
+ this._stopRtcReport();
7216
7282
  this._rtcReportTimer = setInterval(/* @__PURE__ */ _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee5() {
7217
- 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;
7283
+ 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;
7218
7284
  return _regeneratorRuntime$1().wrap(function _callee5$(_context5) {
7219
7285
  while (1)
7220
7286
  switch (_context5.prev = _context5.next) {
7221
7287
  case 0:
7222
- if (!_this6._audioStallObserver && _this6._audioTransceicer) {
7223
- _this6._audioStallObserver = new AudioStallObserver();
7224
- _this6._audioStallObserver.start(_this6._audioTransceicer);
7288
+ if (!_this7._audioStallObserver && _this7._audioTransceicer) {
7289
+ _this7._audioStallObserver = new AudioStallObserver();
7290
+ _this7._audioStallObserver.start(_this7._audioTransceicer);
7225
7291
  }
7226
- if (!_this6._videoStallObserver && _this6._video) {
7227
- _this6._videoStallObserver = new VideoStallObserver();
7228
- _this6._videoStallObserver.start(_this6._media);
7292
+ if (!_this7._videoStallObserver && _this7._video) {
7293
+ _this7._videoStallObserver = new VideoStallObserver();
7294
+ _this7._videoStallObserver.start(_this7._media);
7229
7295
  }
7230
- if (!_this6._networkQuality && _this6._opts.enableNetworkQuality) {
7231
- _this6._networkQuality = new NetworkQuality(_this6._pc, _this6._opts.networkQuality);
7296
+ if (!_this7._networkQuality && _this7._opts.enableNetworkQuality) {
7297
+ _this7._networkQuality = new NetworkQuality(_this7._pc, _this7._opts.networkQuality);
7232
7298
  }
7233
7299
  _context5.next = 5;
7234
- return Promise.all([getRecvAudioStats(_this6._audioTransceicer.receiver.getStats()), getRecvVideoStats(_this6._videoTransceicer.receiver.getStats())]);
7300
+ return Promise.all([getRecvAudioStats(_this7._audioTransceicer.receiver.getStats()), getRecvVideoStats(_this7._videoTransceicer.receiver.getStats())]);
7235
7301
  case 5:
7236
7302
  _yield$Promise$all = _context5.sent;
7237
7303
  _yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
7238
7304
  curAudioStats = _yield$Promise$all2[0];
7239
7305
  curVideoStats = _yield$Promise$all2[1];
7240
- if (!(_this6._preAudioStats && _this6._preVideoStats)) {
7306
+ if (!(_this7._preAudioStats && _this7._preVideoStats)) {
7241
7307
  _context5.next = 21;
7242
7308
  break;
7243
7309
  }
7244
- audioStats = diffRecvAudioStats(_this6._preAudioStats, curAudioStats);
7245
- videoStats = diffRecvVideoStats(_this6._preVideoStats, curVideoStats);
7310
+ audioStats = diffRecvAudioStats(_this7._preAudioStats, curAudioStats);
7311
+ videoStats = diffRecvVideoStats(_this7._preVideoStats, curVideoStats);
7246
7312
  _context5.next = 14;
7247
- return (_this6$_audioStallObs = _this6._audioStallObserver) === null || _this6$_audioStallObs === void 0 ? void 0 : _this6$_audioStallObs.getAudioStallInfo();
7313
+ return (_this7$_audioStallObs = _this7._audioStallObserver) === null || _this7$_audioStallObs === void 0 ? void 0 : _this7$_audioStallObs.getAudioStallInfo();
7248
7314
  case 14:
7249
7315
  audioStallInfo = _context5.sent;
7250
7316
  _context5.next = 17;
7251
- return (_this6$_videoStallObs = _this6._videoStallObserver) === null || _this6$_videoStallObs === void 0 ? void 0 : _this6$_videoStallObs.getStallInfo({
7317
+ return (_this7$_videoStallObs = _this7._videoStallObserver) === null || _this7$_videoStallObs === void 0 ? void 0 : _this7$_videoStallObs.getStallInfo({
7252
7318
  interval: videoStats.statsInterval,
7253
7319
  frameRateReceived: videoStats.frameRateReceived,
7254
7320
  frameRateDecoded: videoStats.frameRateDecoded,
@@ -7256,15 +7322,15 @@
7256
7322
  });
7257
7323
  case 17:
7258
7324
  videoStallInfo = _context5.sent;
7259
- _ref4 = (_this6$_networkQualit = (_this6$_networkQualit2 = _this6._networkQuality) === null || _this6$_networkQualit2 === void 0 ? void 0 : _this6$_networkQualit2.getDownlinkQuality(_objectSpread2$2(_objectSpread2$2({}, audioStats), {}, {
7325
+ _ref4 = (_this7$_networkQualit = (_this7$_networkQualit2 = _this7._networkQuality) === null || _this7$_networkQualit2 === void 0 ? void 0 : _this7$_networkQualit2.getDownlinkQuality(_objectSpread2$2(_objectSpread2$2({}, audioStats), {}, {
7260
7326
  stallDuration: audioStallInfo.stallDuration
7261
7327
  }), _objectSpread2$2(_objectSpread2$2({}, videoStats), {}, {
7262
7328
  stallDuration: videoStallInfo.stall.stallDuration100ms
7263
- }))) !== null && _this6$_networkQualit !== void 0 ? _this6$_networkQualit : [], _ref5 = _slicedToArray(_ref4, 2), quality = _ref5[0], qualityInfo = _ref5[1];
7264
- if (_this6._opts.enableAdaptiveJitterBuffer) {
7265
- targetDelay = _this6._handleJitterBuffer(qualityInfo === null || qualityInfo === void 0 ? void 0 : qualityInfo.qualityQos, _this6._opts.adaptiveJitterBuffer, _this6._opts.networkStrategy);
7329
+ }))) !== null && _this7$_networkQualit !== void 0 ? _this7$_networkQualit : [], _ref5 = _slicedToArray(_ref4, 2), quality = _ref5[0], qualityInfo = _ref5[1];
7330
+ if (_this7._opts.enableAdaptiveJitterBuffer) {
7331
+ targetDelay = _this7._handleJitterBuffer(qualityInfo === null || qualityInfo === void 0 ? void 0 : qualityInfo.qualityQos, _this7._opts.adaptiveJitterBuffer, _this7._opts.networkStrategy);
7266
7332
  }
7267
- _this6.emit(EXTEND_EVENTS.RTC_NETWORK, {
7333
+ _this7.emit(EXTEND_EVENTS.RTC_NETWORK, {
7268
7334
  interval: videoStats.statsInterval,
7269
7335
  visibility_state: document.visibilityState,
7270
7336
  network_quality: quality,
@@ -7291,12 +7357,12 @@
7291
7357
  quality_qos: qualityInfo === null || qualityInfo === void 0 ? void 0 : qualityInfo.qualityQos,
7292
7358
  quality_audio_qoe: qualityInfo === null || qualityInfo === void 0 ? void 0 : qualityInfo.audioQoe,
7293
7359
  quality_video_qoe: qualityInfo === null || qualityInfo === void 0 ? void 0 : qualityInfo.videoQoe,
7294
- current_delay: _this6._getDelay(),
7360
+ current_delay: _this7._getDelay(),
7295
7361
  target_delay: targetDelay
7296
7362
  });
7297
7363
  case 21:
7298
- _this6._preAudioStats = curAudioStats;
7299
- _this6._preVideoStats = curVideoStats;
7364
+ _this7._preAudioStats = curAudioStats;
7365
+ _this7._preVideoStats = curVideoStats;
7300
7366
  case 23:
7301
7367
  case "end":
7302
7368
  return _context5.stop();
@@ -7348,6 +7414,8 @@
7348
7414
  (_this$_loader = this._loader) === null || _this$_loader === void 0 ? void 0 : _this$_loader.cancel();
7349
7415
  (_this$_networkEvaluat2 = this._networkEvaluate) === null || _this$_networkEvaluat2 === void 0 ? void 0 : _this$_networkEvaluat2.destroy();
7350
7416
  this._stopRtcReport();
7417
+ clearTimeout(this._checkStatsErrorTimer);
7418
+ this._clearPeerStateTimeout();
7351
7419
  this._audioTransceicer = null;
7352
7420
  this._videoTransceicer = null;
7353
7421
  this._mediaStream = null;
@@ -7358,10 +7426,37 @@
7358
7426
  value: function _emitError(error) {
7359
7427
  this.emit(EVENT.ERROR, error);
7360
7428
  clearTimeout(this._checkStatsErrorTimer);
7429
+ this._clearPeerStateTimeout();
7361
7430
  if (this._pc) {
7362
7431
  this._pc.close();
7363
7432
  }
7364
7433
  }
7434
+ }, {
7435
+ key: "_createEmptyPeer",
7436
+ value: function() {
7437
+ var _createEmptyPeer2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee6() {
7438
+ var pc;
7439
+ return _regeneratorRuntime$1().wrap(function _callee6$(_context6) {
7440
+ while (1)
7441
+ switch (_context6.prev = _context6.next) {
7442
+ case 0:
7443
+ pc = new RTCPeerConnection();
7444
+ _context6.next = 3;
7445
+ return pc.createOffer();
7446
+ case 3:
7447
+ pc.close();
7448
+ pc = null;
7449
+ case 5:
7450
+ case "end":
7451
+ return _context6.stop();
7452
+ }
7453
+ }, _callee6);
7454
+ }));
7455
+ function _createEmptyPeer() {
7456
+ return _createEmptyPeer2.apply(this, arguments);
7457
+ }
7458
+ return _createEmptyPeer;
7459
+ }()
7365
7460
  }, {
7366
7461
  key: "destroy",
7367
7462
  value: function destroy(keepClearMediaStream) {
@@ -7502,7 +7597,7 @@
7502
7597
  }, {
7503
7598
  key: "version",
7504
7599
  get: function get() {
7505
- return "0.2.1-alpha.29";
7600
+ return "0.2.1-alpha.35";
7506
7601
  }
7507
7602
  }, {
7508
7603
  key: "beforePlayerInit",