@volcengine/veplayer-plugin 2.12.0-rc.1 → 2.12.0-rc.2

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.
@@ -1687,7 +1687,7 @@ util.getCurrentTimeByOffset = function(offsetTime, segments) {
1687
1687
  }
1688
1688
  return offsetTime;
1689
1689
  };
1690
- var version = "3.0.24-rc.2";
1690
+ var version = "3.0.24-rc.6";
1691
1691
  var ERROR_MAP = {
1692
1692
  1: 5101,
1693
1693
  2: 5102,
@@ -5080,9 +5080,9 @@ lib.parsePayloads = parser.parsePayloads;
5080
5080
  lib.parseRemoteCandidates = parser.parseRemoteCandidates;
5081
5081
  lib.parseImageAttributes = parser.parseImageAttributes;
5082
5082
  lib.parseSimulcastStreamList = parser.parseSimulcastStreamList;
5083
- var _excluded = ["adaptiveJitterBuffer"];
5083
+ var _excluded = ["adaptiveJitterBuffer", "standardizeKillSwitch"];
5084
5084
  function getOption(options) {
5085
- var _ref = options || {}, _ref$adaptiveJitterBu = _ref.adaptiveJitterBuffer, adaptiveJitterBuffer = _ref$adaptiveJitterBu === void 0 ? {} : _ref$adaptiveJitterBu, opts = _objectWithoutProperties$1(_ref, _excluded);
5085
+ var _ref = options || {}, _ref$adaptiveJitterBu = _ref.adaptiveJitterBuffer, adaptiveJitterBuffer = _ref$adaptiveJitterBu === void 0 ? {} : _ref$adaptiveJitterBu, _ref$standardizeKillS = _ref.standardizeKillSwitch, standardizeKillSwitch = _ref$standardizeKillS === void 0 ? {} : _ref$standardizeKillS, opts = _objectWithoutProperties$1(_ref, _excluded);
5086
5086
  return _objectSpread2$2({
5087
5087
  retryCount: 0,
5088
5088
  retryDelay: 1e3,
@@ -5153,7 +5153,12 @@ function getOption(options) {
5153
5153
  5: {
5154
5154
  jitterBuffer: 3
5155
5155
  }
5156
- }
5156
+ },
5157
+ standardizeKillSwitch: _objectSpread2$2({
5158
+ sld_fmtp_opus: true,
5159
+ sld_rtcpfb_opus_nack: true,
5160
+ sld_fmtp_sps_pps: true
5161
+ }, standardizeKillSwitch)
5157
5162
  }, opts);
5158
5163
  }
5159
5164
  function _getStats(stats) {
@@ -5495,7 +5500,7 @@ function getCapacity() {
5495
5500
  });
5496
5501
  }
5497
5502
  var isEncodedTransformSupported = function isEncodedTransformSupported2() {
5498
- return typeof TransformStream !== "undefined" && typeof RTCRtpSender !== "undefined" && typeof RTCRtpReceiver !== "undefined" && typeof RTCRtpScriptTransform !== "undefined" && "transform" in RTCRtpSender.prototype && "transform" in RTCRtpReceiver.prototype && isWorkerSupported() && isMessageChannelSupported();
5503
+ return typeof window.TransformStream !== "undefined" && typeof window.RTCRtpSender !== "undefined" && typeof window.RTCRtpReceiver !== "undefined" && typeof window.RTCRtpScriptTransform !== "undefined" && "transform" in window.RTCRtpSender.prototype && "transform" in window.RTCRtpReceiver.prototype && isWorkerSupported() && isMessageChannelSupported();
5499
5504
  };
5500
5505
  var isWorkerSupported = function isWorkerSupported2() {
5501
5506
  return typeof window !== "undefined" && window.Worker;
@@ -5504,7 +5509,7 @@ var isMessageChannelSupported = function isMessageChannelSupported2() {
5504
5509
  return typeof MessageChannel !== "undefined";
5505
5510
  };
5506
5511
  var isLegacyEncodedTransformSupported = function isLegacyEncodedTransformSupported2() {
5507
- return typeof TransformStream !== "undefined" && typeof RTCRtpSender !== "undefined" && typeof RTCRtpReceiver !== "undefined" && typeof RTCRtpSender.prototype.createEncodedStreams !== "undefined" && typeof RTCRtpReceiver.prototype.createEncodedStreams !== "undefined";
5512
+ return typeof window.TransformStream !== "undefined" && typeof window.RTCRtpSender !== "undefined" && typeof window.RTCRtpReceiver !== "undefined" && typeof window.RTCRtpSender.prototype.createEncodedStreams !== "undefined" && typeof window.RTCRtpReceiver.prototype.createEncodedStreams !== "undefined";
5508
5513
  };
5509
5514
  var Nalunit = {
5510
5515
  getNALUnits: function getNALUnits(buffer) {
@@ -6682,6 +6687,8 @@ function _getRecvVideoStats() {
6682
6687
  currentStats.firCount = stat.firCount;
6683
6688
  currentStats.nackCount = stat.nackCount;
6684
6689
  currentStats.pliCount = stat.pliCount;
6690
+ currentStats.fecPacketsReceived = stat.fecPacketsReceived;
6691
+ currentStats.fecSsrc = stat.fecSsrc;
6685
6692
  if (stat.jitterBufferDelay !== void 0) {
6686
6693
  currentStats.jitterBufferEmittedCount = stat.jitterBufferEmittedCount;
6687
6694
  currentStats.jitterBufferDelay = stat.jitterBufferDelay;
@@ -6746,12 +6753,14 @@ function diffRecvVideoStats(oldStats, newStats) {
6746
6753
  nackCount,
6747
6754
  pliCount: diffNumber(oldStats, newStats, "pliCount"),
6748
6755
  e2eDelay: Math.round((newStats.rtt || 0) + jitterBufferDelay),
6749
- retransmittedRate: +(nackCount / (packetsReceived + packetsLostDiff)).toFixed(2)
6756
+ retransmittedRate: +(nackCount / (packetsReceived + packetsLostDiff)).toFixed(2),
6757
+ fecPacketsReceived: diffNumber(oldStats, newStats, "fecPacketsReceived"),
6758
+ fecSsrc: newStats.fecSsrc
6750
6759
  };
6751
6760
  }
6752
6761
  function diffNumber(oldValue, newValue, key) {
6753
- var oldV = Number.isNaN(oldValue[key]) ? 0 : +oldValue[key];
6754
- var newV = Number.isNaN(newValue[key]) ? 0 : +newValue[key];
6762
+ var oldV = !Number.isFinite(oldValue[key]) ? 0 : +oldValue[key];
6763
+ var newV = !Number.isFinite(newValue[key]) ? 0 : +newValue[key];
6755
6764
  return Math.max(0, newV - oldV);
6756
6765
  }
6757
6766
  var QoELevel = {
@@ -6882,6 +6891,63 @@ var NetworkQuality = /* @__PURE__ */ function() {
6882
6891
  }]);
6883
6892
  return NetworkQuality2;
6884
6893
  }();
6894
+ var gpuInfo;
6895
+ function getGpuInfo() {
6896
+ if (!gpuInfo) {
6897
+ gpuInfo = _getGpuInfo();
6898
+ }
6899
+ return gpuInfo;
6900
+ }
6901
+ function _getGpuInfo() {
6902
+ var canvas = document.createElement("canvas");
6903
+ var gl = canvas.getContext("webgl") || canvas.getContext("experimental-webgl");
6904
+ if (!gl) {
6905
+ return {
6906
+ renderer: "unknown(WebGLRenderingContext not existed)",
6907
+ vendor: "unknown(WebGLRenderingContext not existed)"
6908
+ };
6909
+ }
6910
+ var info = gl.getExtension("WEBGL_debug_renderer_info");
6911
+ if (!info) {
6912
+ return {
6913
+ renderer: "unknown(info not existed)",
6914
+ vendor: "unknown(info not existed)"
6915
+ };
6916
+ }
6917
+ var renderer = gl.getParameter(info.UNMASKED_RENDERER_WEBGL);
6918
+ var vendor = gl.getParameter(info.UNMASKED_VENDOR_WEBGL);
6919
+ if (canvas && canvas.parentNode) {
6920
+ canvas.parentNode.removeChild(canvas);
6921
+ }
6922
+ canvas = void 0;
6923
+ gl = void 0;
6924
+ return {
6925
+ renderer,
6926
+ vendor
6927
+ };
6928
+ }
6929
+ function extractProfileInfo(sdpFmtpLine) {
6930
+ var profileLevelId = "";
6931
+ if (!sdpFmtpLine) {
6932
+ return profileLevelId;
6933
+ }
6934
+ var paramArray = sdpFmtpLine.split(";");
6935
+ var _iterator = _createForOfIteratorHelper$1(paramArray), _step;
6936
+ try {
6937
+ for (_iterator.s(); !(_step = _iterator.n()).done; ) {
6938
+ var param = _step.value;
6939
+ var _param$trim$split = param.trim().split("="), _param$trim$split2 = _slicedToArray(_param$trim$split, 2), key = _param$trim$split2[0], value = _param$trim$split2[1];
6940
+ if (key === "profile-level-id") {
6941
+ profileLevelId = value;
6942
+ }
6943
+ }
6944
+ } catch (err) {
6945
+ _iterator.e(err);
6946
+ } finally {
6947
+ _iterator.f();
6948
+ }
6949
+ return profileLevelId;
6950
+ }
6885
6951
  var FIRST_FRAME_STATE_ORDER = [RTC_FIRST_FRAME_STATE.LOAD_START, RTC_FIRST_FRAME_STATE.OFFER_SDP_READY, RTC_FIRST_FRAME_STATE.ANSWER_SDP_RECV, RTC_FIRST_FRAME_STATE.ANSWER_SDP_READY, RTC_FIRST_FRAME_STATE.ICE_CONNECTED, RTC_FIRST_FRAME_STATE.DTLS_CONNECTED, RTC_FIRST_FRAME_STATE.PEER_CONNECTED, RTC_FIRST_FRAME_STATE.FIRST_PACKET_RECV, RTC_FIRST_FRAME_STATE.FIRST_FRAME_RECV, RTC_FIRST_FRAME_STATE.FIRST_FRAME_DECODED, RTC_FIRST_FRAME_STATE.VIDEO_LOADEDDATA, RTC_FIRST_FRAME_STATE.VIDEO_CANPLAY, RTC_FIRST_FRAME_STATE.VIDEO_PLAYING];
6886
6952
  var FirstFrameObserver = /* @__PURE__ */ function() {
6887
6953
  function FirstFrameObserver2(_emitFirstFrameState) {
@@ -6895,6 +6961,7 @@ var FirstFrameObserver = /* @__PURE__ */ function() {
6895
6961
  this._pc = null;
6896
6962
  this._video = null;
6897
6963
  this._videoTransceiver = null;
6964
+ this._audioTransceiver = null;
6898
6965
  this._extraInfo = {
6899
6966
  is_preload: false
6900
6967
  };
@@ -6967,11 +7034,12 @@ var FirstFrameObserver = /* @__PURE__ */ function() {
6967
7034
  }
6968
7035
  }, {
6969
7036
  key: "bindEvents",
6970
- value: function bindEvents(pc, videoTransceiver, video) {
7037
+ value: function bindEvents(pc, videoTransceiver, audioTransceiver, video) {
6971
7038
  var _this3 = this;
6972
7039
  this._pc = pc;
6973
7040
  this._video = video;
6974
7041
  this._videoTransceiver = videoTransceiver;
7042
+ this._audioTransceiver = audioTransceiver;
6975
7043
  pc.addEventListener("connectionstatechange", this._handleConnectionStateChange);
6976
7044
  pc.addEventListener("iceconnectionstatechange", this._handleICEConnectionStateChange);
6977
7045
  var _ref2 = (videoTransceiver === null || videoTransceiver === void 0 ? void 0 : videoTransceiver.receiver) || {}, transport = _ref2.transport;
@@ -7045,7 +7113,9 @@ var FirstFrameObserver = /* @__PURE__ */ function() {
7045
7113
  if (Object.keys(this._state).length > 0) {
7046
7114
  var state = _objectSpread2$2({}, this._state);
7047
7115
  var extraInfo = _objectSpread2$2({}, this._extraInfo);
7048
- getTransportInfo(this._videoTransceiver, extraInfo).then(function() {
7116
+ Promise.all([getTransportInfo(this._videoTransceiver, extraInfo), getAudioCodecInfo(this._audioTransceiver, extraInfo)]).catch(function(e) {
7117
+ extraInfo.failure_reason = e.message;
7118
+ }).finally(function() {
7049
7119
  _this5._emitFirstFrameState(state, extraInfo);
7050
7120
  });
7051
7121
  }
@@ -7064,6 +7134,7 @@ var FirstFrameObserver = /* @__PURE__ */ function() {
7064
7134
  this._pc = null;
7065
7135
  this._video = null;
7066
7136
  this._videoTransceiver = null;
7137
+ this._audioTransceiver = null;
7067
7138
  }
7068
7139
  }]);
7069
7140
  return FirstFrameObserver2;
@@ -7071,7 +7142,7 @@ var FirstFrameObserver = /* @__PURE__ */ function() {
7071
7142
  var getTransportInfo = /* @__PURE__ */ function() {
7072
7143
  var _ref4 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee2(videoTransceiver, extraInfo) {
7073
7144
  var _videoTransceiver$rec;
7074
- var reports, candidatePairStats, localCandidateStats, remoteCandidateStats;
7145
+ var reports, candidatePairStats, localCandidateStats, remoteCandidateStats, inboundRtpStats, codecStats, _inboundRtpStats4;
7075
7146
  return _regeneratorRuntime$1().wrap(function _callee2$(_context2) {
7076
7147
  while (1)
7077
7148
  switch (_context2.prev = _context2.next) {
@@ -7086,6 +7157,9 @@ var getTransportInfo = /* @__PURE__ */ function() {
7086
7157
  candidatePairStats = report;
7087
7158
  localCandidateStats = reports.get(report.localCandidateId);
7088
7159
  remoteCandidateStats = reports.get(report.remoteCandidateId);
7160
+ } else if (report.type === "inbound-rtp") {
7161
+ inboundRtpStats = report;
7162
+ codecStats = reports.get(report.codecId);
7089
7163
  }
7090
7164
  });
7091
7165
  if (remoteCandidateStats) {
@@ -7106,7 +7180,20 @@ var getTransportInfo = /* @__PURE__ */ function() {
7106
7180
  extraInfo.stun_responses_sent = candidatePairStats.responsesSent;
7107
7181
  extraInfo.stun_responses_received = candidatePairStats.responsesReceived;
7108
7182
  }
7109
- case 7:
7183
+ if (codecStats) {
7184
+ extraInfo.video_codec = codecStats.mimeType;
7185
+ extraInfo.video_fmtp = codecStats.sdpFmtpLine;
7186
+ extraInfo.video_profile_level_id = extractProfileInfo(codecStats.sdpFmtpLine);
7187
+ }
7188
+ if (inboundRtpStats) {
7189
+ extraInfo.video_width = inboundRtpStats.frameWidth;
7190
+ extraInfo.video_height = inboundRtpStats.frameHeight;
7191
+ extraInfo.video_framerate = inboundRtpStats.framesPerSecond;
7192
+ extraInfo.video_decoder_name = inboundRtpStats.decoderImplementation;
7193
+ extraInfo.video_result = ((_inboundRtpStats4 = inboundRtpStats) === null || _inboundRtpStats4 === void 0 ? void 0 : _inboundRtpStats4.framesDecoded) > 0 ? true : false;
7194
+ }
7195
+ extraInfo.gpu_info = getGpuInfo().renderer;
7196
+ case 10:
7110
7197
  case "end":
7111
7198
  return _context2.stop();
7112
7199
  }
@@ -7116,6 +7203,43 @@ var getTransportInfo = /* @__PURE__ */ function() {
7116
7203
  return _ref4.apply(this, arguments);
7117
7204
  };
7118
7205
  }();
7206
+ var getAudioCodecInfo = /* @__PURE__ */ function() {
7207
+ var _ref5 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee3(audioTransceiver, extraInfo) {
7208
+ var _audioTransceiver$rec;
7209
+ var reports, inboundRtpStats, codecStats, _inboundRtpStats5, _inboundRtpStats6, _inboundRtpStats7, _inboundRtpStats8, _inboundRtpStats9, _inboundRtpStats10;
7210
+ return _regeneratorRuntime$1().wrap(function _callee3$(_context3) {
7211
+ while (1)
7212
+ switch (_context3.prev = _context3.next) {
7213
+ case 0:
7214
+ _context3.next = 2;
7215
+ return audioTransceiver === null || audioTransceiver === void 0 ? void 0 : (_audioTransceiver$rec = audioTransceiver.receiver) === null || _audioTransceiver$rec === void 0 ? void 0 : _audioTransceiver$rec.getStats().catch(function() {
7216
+ });
7217
+ case 2:
7218
+ reports = _context3.sent;
7219
+ reports === null || reports === void 0 ? void 0 : reports.forEach(function(report) {
7220
+ if (report.type === "inbound-rtp") {
7221
+ inboundRtpStats = report;
7222
+ codecStats = reports.get(report.codecId);
7223
+ }
7224
+ });
7225
+ if (codecStats) {
7226
+ extraInfo.audio_codec = codecStats.mimeType;
7227
+ extraInfo.audio_fmtp = codecStats.sdpFmtpLine;
7228
+ }
7229
+ if (inboundRtpStats) {
7230
+ extraInfo.audio_packet_received = ((_inboundRtpStats5 = inboundRtpStats) === null || _inboundRtpStats5 === void 0 ? void 0 : _inboundRtpStats5.packetsReceived) > 0;
7231
+ extraInfo.audio_result = ((_inboundRtpStats6 = inboundRtpStats) === null || _inboundRtpStats6 === void 0 ? void 0 : _inboundRtpStats6.audioLevel) !== 0 || ((_inboundRtpStats7 = inboundRtpStats) === null || _inboundRtpStats7 === void 0 ? void 0 : _inboundRtpStats7.totalAudioEnergy) !== 0 || ((_inboundRtpStats8 = inboundRtpStats) === null || _inboundRtpStats8 === void 0 ? void 0 : _inboundRtpStats8.totalSamplesReceived) > 0 && ((_inboundRtpStats9 = inboundRtpStats) === null || _inboundRtpStats9 === void 0 ? void 0 : _inboundRtpStats9.totalSamplesReceived) !== ((_inboundRtpStats10 = inboundRtpStats) === null || _inboundRtpStats10 === void 0 ? void 0 : _inboundRtpStats10.concealedSamples) ? true : false;
7232
+ }
7233
+ case 6:
7234
+ case "end":
7235
+ return _context3.stop();
7236
+ }
7237
+ }, _callee3);
7238
+ }));
7239
+ return function getAudioCodecInfo2(_x3, _x4) {
7240
+ return _ref5.apply(this, arguments);
7241
+ };
7242
+ }();
7119
7243
  function changeNumberInRange(source, min, max, delta) {
7120
7244
  var target = source + delta;
7121
7245
  if (target > max) {
@@ -7396,13 +7520,13 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
7396
7520
  _this$_opts$adaptiveJ = _this._opts.adaptiveJitterBuffer, loopInterval = _this$_opts$adaptiveJ.loopInterval, maxAvSyncDelay = _this$_opts$adaptiveJ.maxAvSyncDelay, maxJitterBufferDiff = _this$_opts$adaptiveJ.maxJitterBufferDiff, maxStep = _this$_opts$adaptiveJ.maxStep;
7397
7521
  avDiffTooMuchCount = 0;
7398
7522
  _this._setDelayTimer = setInterval(/* @__PURE__ */ _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee3() {
7399
- var _this$_audioTransceic4, _this$_videoTransceic3, currentTargetDelay, targetDelayMs, currentTargetDelayMs, _yield$Promise$all, _yield$Promise$all2, curAudioStats, curVideoStats, audioStats, videoStats, av_sync_diff, currentAudioDelay, currentVideoDelay, addOrReduce, nextJitterBufferDelay;
7523
+ var _this$_audioTransceic4, _this$_audioTransceic5, _this$_videoTransceic3, _this$_videoTransceic4, currentTargetDelay, targetDelayMs, currentTargetDelayMs, _yield$Promise$all, _yield$Promise$all2, curAudioStats, curVideoStats, audioStats, videoStats, av_sync_diff, currentAudioDelay, currentVideoDelay, addOrReduce, nextJitterBufferDelay;
7400
7524
  return _regeneratorRuntime$1().wrap(function _callee3$(_context3) {
7401
7525
  while (1)
7402
7526
  switch (_context3.prev = _context3.next) {
7403
7527
  case 0:
7404
7528
  _context3.prev = 0;
7405
- if (!(!((_this$_audioTransceic4 = _this._audioTransceicer) !== null && _this$_audioTransceic4 !== void 0 && _this$_audioTransceic4.receiver) || !((_this$_videoTransceic3 = _this._videoTransceicer) !== null && _this$_videoTransceic3 !== void 0 && _this$_videoTransceic3.receiver))) {
7529
+ if (!(!((_this$_audioTransceic4 = _this._audioTransceicer) !== null && _this$_audioTransceic4 !== void 0 && (_this$_audioTransceic5 = _this$_audioTransceic4.receiver) !== null && _this$_audioTransceic5 !== void 0 && _this$_audioTransceic5.getStats) || !((_this$_videoTransceic3 = _this._videoTransceicer) !== null && _this$_videoTransceic3 !== void 0 && (_this$_videoTransceic4 = _this$_videoTransceic3.receiver) !== null && _this$_videoTransceic4 !== void 0 && _this$_videoTransceic4.getStats))) {
7406
7530
  _context3.next = 5;
7407
7531
  break;
7408
7532
  }
@@ -7493,20 +7617,19 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
7493
7617
  }();
7494
7618
  _this._getDelay = function() {
7495
7619
  try {
7496
- var _this$_audioTransceic6;
7620
+ var _this$_audioTransceic7;
7497
7621
  var key = ["playoutDelayHint", "jitterBufferDelayHint", "jitterBufferTarget"].find(function(key2) {
7498
- var _this$_videoTransceic4, _this$_audioTransceic5;
7499
- return key2 in (((_this$_videoTransceic4 = _this._videoTransceicer) === null || _this$_videoTransceic4 === void 0 ? void 0 : _this$_videoTransceic4.receiver) || {}) && key2 in (((_this$_audioTransceic5 = _this._audioTransceicer) === null || _this$_audioTransceic5 === void 0 ? void 0 : _this$_audioTransceic5.receiver) || {});
7622
+ var _this$_videoTransceic5, _this$_audioTransceic6;
7623
+ return key2 in (((_this$_videoTransceic5 = _this._videoTransceicer) === null || _this$_videoTransceic5 === void 0 ? void 0 : _this$_videoTransceic5.receiver) || {}) && key2 in (((_this$_audioTransceic6 = _this._audioTransceicer) === null || _this$_audioTransceic6 === void 0 ? void 0 : _this$_audioTransceic6.receiver) || {});
7500
7624
  });
7501
7625
  if (!key)
7502
7626
  return;
7503
- return (_this$_audioTransceic6 = _this._audioTransceicer) === null || _this$_audioTransceic6 === void 0 ? void 0 : _this$_audioTransceic6.receiver[key];
7627
+ return (_this$_audioTransceic7 = _this._audioTransceicer) === null || _this$_audioTransceic7 === void 0 ? void 0 : _this$_audioTransceic7.receiver[key];
7504
7628
  } catch (error) {
7505
7629
  logger.error("get delay error");
7506
7630
  }
7507
7631
  };
7508
7632
  _this._onLoaderRetry = function(error, retryTime) {
7509
- console.log(error, "retryTime", retryTime);
7510
7633
  _this.emit(EVENT.LOAD_RETRY, {
7511
7634
  error: StreamingError.network(error),
7512
7635
  retryTime
@@ -7598,7 +7721,7 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
7598
7721
  value: function() {
7599
7722
  var _load = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee6(url, failureReason) {
7600
7723
  var _this2 = this;
7601
- var lastPc, answerSdp, errorStr, preloadPromise, info, encodedTransformSupported;
7724
+ var lastPc, pc, answerSdp, errorStr, preloadPromise, info, encodedTransformSupported;
7602
7725
  return _regeneratorRuntime$1().wrap(function _callee6$(_context6) {
7603
7726
  while (1)
7604
7727
  switch (_context6.prev = _context6.next) {
@@ -7606,44 +7729,47 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
7606
7729
  logger.log("load()", 'invoked, url: "'.concat(url, '"'));
7607
7730
  this._disconnect(failureReason || "invoke load");
7608
7731
  this._url = url;
7732
+ this._retry = this._opts.retryCount || 0;
7609
7733
  lastPc = this._pc;
7734
+ pc = null;
7610
7735
  if (!this._opts.hackCreateOfferIssue) {
7611
- _context6.next = 7;
7736
+ _context6.next = 9;
7612
7737
  break;
7613
7738
  }
7614
- _context6.next = 7;
7739
+ _context6.next = 9;
7615
7740
  return this._createEmptyPeer();
7616
- case 7:
7617
- _context6.prev = 7;
7741
+ case 9:
7742
+ _context6.prev = 9;
7618
7743
  this._firstFrameObserver.start();
7619
7744
  if (!this._preloadPromise) {
7620
- _context6.next = 38;
7745
+ _context6.next = 41;
7621
7746
  break;
7622
7747
  }
7623
7748
  logger.log("load()", "in preload process...");
7624
- _context6.prev = 11;
7749
+ _context6.prev = 13;
7625
7750
  this._firstFrameObserver.setIsPreload(true);
7626
7751
  if (compareURL(this._url, this._preloadPromise.url, ["tabr_start_bitrate"])) {
7627
- _context6.next = 17;
7752
+ _context6.next = 19;
7628
7753
  break;
7629
7754
  }
7630
7755
  errorStr = "preload url not match, current url: ".concat(this._url, ", preload url: ").concat(this._preloadPromise.url);
7631
7756
  delete this._preloadPromise;
7632
7757
  throw new Error(errorStr);
7633
- case 17:
7758
+ case 19:
7759
+ this._loader && (this._loader.finnalUrl = this._preloadPromise.url);
7634
7760
  preloadPromise = this._preloadPromise.promise;
7635
7761
  delete this._preloadPromise;
7636
- _context6.next = 21;
7762
+ _context6.next = 24;
7637
7763
  return preloadPromise;
7638
- case 21:
7764
+ case 24:
7639
7765
  info = _context6.sent;
7640
7766
  if (!(info.pc.signalingState !== "have-local-offer")) {
7641
- _context6.next = 24;
7767
+ _context6.next = 27;
7642
7768
  break;
7643
7769
  }
7644
7770
  throw new Error('pc.signalingState not equal "have-local-offer", current state is '.concat(info.pc.signalingState));
7645
- case 24:
7646
- this._pc = info.pc;
7771
+ case 27:
7772
+ pc = info.pc;
7647
7773
  answerSdp = info.answerSdp;
7648
7774
  this._videoTransceicer = info.videoTransceiver;
7649
7775
  this._audioTransceicer = info.audioTransceiver;
@@ -7651,48 +7777,49 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
7651
7777
  this.initVideoEncodedTransform();
7652
7778
  this.initAudioEncodedTransform();
7653
7779
  }
7654
- _context6.next = 36;
7780
+ _context6.next = 39;
7655
7781
  break;
7656
- case 31:
7657
- _context6.prev = 31;
7658
- _context6.t0 = _context6["catch"](11);
7782
+ case 34:
7783
+ _context6.prev = 34;
7784
+ _context6.t0 = _context6["catch"](13);
7659
7785
  logger.warn("load()", "preload failed, ".concat(_context6.t0.message || _context6.t0.toString()));
7660
7786
  this.load(url, _context6.t0.message || _context6.t0.toString());
7661
7787
  return _context6.abrupt("return");
7662
- case 36:
7663
- _context6.next = 44;
7788
+ case 39:
7789
+ _context6.next = 47;
7664
7790
  break;
7665
- case 38:
7791
+ case 41:
7666
7792
  encodedTransformSupported = isLegacyEncodedTransformSupported();
7667
7793
  logger.log("load()", "isLegacyEncodedTransformSupported: ".concat(encodedTransformSupported));
7668
- this._pc = new RTCPeerConnection({
7794
+ pc = new RTCPeerConnection({
7669
7795
  encodedInsertableStreams: encodedTransformSupported && this._opts.enableSei ? true : void 0
7670
7796
  });
7671
- _context6.next = 43;
7672
- return this._getAnswerSdp(this._pc);
7673
- case 43:
7797
+ _context6.next = 46;
7798
+ return this._getAnswerSdp(pc);
7799
+ case 46:
7674
7800
  answerSdp = _context6.sent;
7675
- case 44:
7676
- this._bindRTCEvents(this._pc);
7677
- _context6.next = 47;
7678
- return this._handleAnswerSdp(this._pc, answerSdp);
7679
7801
  case 47:
7802
+ this._bindRTCEvents(pc);
7803
+ _context6.next = 50;
7804
+ return this._handleAnswerSdp(pc, answerSdp);
7805
+ case 50:
7680
7806
  if (lastPc) {
7681
7807
  lastPc.close();
7682
7808
  }
7683
- _context6.next = 53;
7809
+ this._pc = pc;
7810
+ _context6.next = 57;
7684
7811
  break;
7685
- case 50:
7686
- _context6.prev = 50;
7687
- _context6.t1 = _context6["catch"](7);
7812
+ case 54:
7813
+ _context6.prev = 54;
7814
+ _context6.t1 = _context6["catch"](9);
7688
7815
  setTimeout(function() {
7689
7816
  return _this2._emitError(StreamingError.create(ERR.OTHER, null, _context6.t1));
7690
7817
  });
7691
- case 53:
7818
+ case 57:
7692
7819
  case "end":
7693
7820
  return _context6.stop();
7694
7821
  }
7695
- }, _callee6, this, [[7, 50], [11, 31]]);
7822
+ }, _callee6, this, [[9, 54], [13, 34]]);
7696
7823
  }));
7697
7824
  function load(_x2, _x3) {
7698
7825
  return _load.apply(this, arguments);
@@ -7835,6 +7962,7 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
7835
7962
  key: "_getAnswerSdp",
7836
7963
  value: function() {
7837
7964
  var _getAnswerSdp2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee7(pc) {
7965
+ var _this6 = this, _this$_opts$standardi;
7838
7966
  var offer, answerSdp, parsed, finnalUrl, _this$_opts, _this$_loader, _this$_opts2, _parsed$media, parseSession, sessionId, reqStart, res, answer, err;
7839
7967
  return _regeneratorRuntime$1().wrap(function _callee7$(_context7) {
7840
7968
  while (1)
@@ -7886,31 +8014,38 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
7886
8014
  parsed.media.filter(function(x) {
7887
8015
  return x.type === "audio";
7888
8016
  }).forEach(function(x) {
7889
- var _x$rtp$filter$, _x$rtcpFb;
8017
+ var _x$rtp$filter$, _this6$_opts$standard, _this6$_opts$standard2;
7890
8018
  var opusPayload = (_x$rtp$filter$ = x.rtp.filter(function(rtp) {
7891
8019
  return rtp.codec === "opus";
7892
8020
  })[0]) === null || _x$rtp$filter$ === void 0 ? void 0 : _x$rtp$filter$.payload;
7893
8021
  if (!opusPayload)
7894
8022
  return;
7895
- x.fmtp.forEach(function(fmtp) {
7896
- if (fmtp.payload !== opusPayload)
7897
- return;
7898
- fmtp.config = "minptime=10;stereo=1;useinbandfec=1";
7899
- });
7900
- (_x$rtcpFb = x.rtcpFb) === null || _x$rtcpFb === void 0 ? void 0 : _x$rtcpFb.push({
7901
- payload: opusPayload,
7902
- type: "nack"
7903
- });
8023
+ if ((_this6$_opts$standard = _this6._opts.standardizeKillSwitch) !== null && _this6$_opts$standard !== void 0 && _this6$_opts$standard.sld_fmtp_opus) {
8024
+ x.fmtp.forEach(function(fmtp) {
8025
+ if (fmtp.payload !== opusPayload)
8026
+ return;
8027
+ fmtp.config = "minptime=10;stereo=1;useinbandfec=1";
8028
+ });
8029
+ }
8030
+ if ((_this6$_opts$standard2 = _this6._opts.standardizeKillSwitch) !== null && _this6$_opts$standard2 !== void 0 && _this6$_opts$standard2.sld_rtcpfb_opus_nack) {
8031
+ var _x$rtcpFb;
8032
+ (_x$rtcpFb = x.rtcpFb) === null || _x$rtcpFb === void 0 ? void 0 : _x$rtcpFb.push({
8033
+ payload: opusPayload,
8034
+ type: "nack"
8035
+ });
8036
+ }
7904
8037
  });
7905
- parsed.media.filter(function(x) {
7906
- return x.type === "video";
7907
- }).forEach(function(x) {
7908
- x.fmtp.forEach(function(x2) {
7909
- if (x2.config.indexOf("profile-level-id") !== -1) {
7910
- x2.config = "".concat(x2.config, ";sps-pps-idr-in-keyframe=1");
7911
- }
8038
+ if ((_this$_opts$standardi = this._opts.standardizeKillSwitch) !== null && _this$_opts$standardi !== void 0 && _this$_opts$standardi.sld_fmtp_sps_pps) {
8039
+ parsed.media.filter(function(x) {
8040
+ return x.type === "video";
8041
+ }).forEach(function(x) {
8042
+ x.fmtp.forEach(function(x2) {
8043
+ if (x2.config.indexOf("profile-level-id") !== -1) {
8044
+ x2.config = "".concat(x2.config, ";sps-pps-idr-in-keyframe=1");
8045
+ }
8046
+ });
7912
8047
  });
7913
- });
8048
+ }
7914
8049
  offer.sdp = lib.write(parsed);
7915
8050
  logger.log("local offer modified:\n", offer);
7916
8051
  _context7.next = 25;
@@ -8045,7 +8180,7 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
8045
8180
  this._firstFrameObserver.changeFirstFrameState(RTC_FIRST_FRAME_STATE.ANSWER_SDP_READY);
8046
8181
  this._networkEvaluate = new NetworkEvaluate(pc, this._opts.networkEvaluateInterval);
8047
8182
  this._listenPeerStateTimeout();
8048
- this._firstFrameObserver.bindEvents(pc, this._videoTransceicer, this._media);
8183
+ this._firstFrameObserver.bindEvents(pc, this._videoTransceicer, this._audioTransceicer, this._media);
8049
8184
  case 17:
8050
8185
  case "end":
8051
8186
  return _context8.stop();
@@ -8060,11 +8195,11 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
8060
8195
  }, {
8061
8196
  key: "_listenPeerStateTimeout",
8062
8197
  value: function _listenPeerStateTimeout() {
8063
- var _this6 = this;
8198
+ var _this7 = this;
8064
8199
  this._clearPeerStateTimeout();
8065
8200
  if (this._opts.connectionStateChangeTimeout) {
8066
8201
  this._peerStateTimer = setTimeout(function() {
8067
- _this6._emitError(StreamingError.create(ERR.MEDIA, ERR.SUB_TYPES.MEDIA_ERR_SRC_NOT_SUPPORTED, {
8202
+ _this7._emitError(StreamingError.create(ERR.MEDIA, ERR.SUB_TYPES.MEDIA_ERR_SRC_NOT_SUPPORTED, {
8068
8203
  message: "listen connectionstatechange timeout"
8069
8204
  }));
8070
8205
  }, this._opts.connectionStateChangeTimeout);
@@ -8081,59 +8216,59 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
8081
8216
  }, {
8082
8217
  key: "_startRtcReport",
8083
8218
  value: function _startRtcReport() {
8084
- var _this7 = this;
8219
+ var _this8 = this;
8085
8220
  this._stopRtcReport();
8086
8221
  var report = /* @__PURE__ */ function() {
8087
8222
  var _ref5 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee9() {
8088
- var _this7$_audioTranscei, _this7$_videoTranscei;
8089
- var _this7$_frameRecvCall, _yield$Promise$all3, _yield$Promise$all4, curAudioStats, curVideoStats, _this7$_audioStallObs, _this7$_videoStallObs, _this7$_networkQualit, _this7$_networkQualit2, _this7$_media, _this7$_media2, _this7$_media3, _this7$_media4, _this7$_media5, _this7$_media6, _this7$_frameRecvCall2, audioStats, videoStats, audioStallInfo, videoStallInfo, _ref6, _ref7, quality, qualityInfo, av_sync_diff;
8223
+ var _this8$_audioTranscei, _this8$_audioTranscei2, _this8$_videoTranscei, _this8$_videoTranscei2;
8224
+ var _this8$_frameRecvCall, _yield$Promise$all3, _yield$Promise$all4, curAudioStats, curVideoStats, _this8$_audioStallObs, _this8$_videoStallObs, _this8$_networkQualit, _this8$_networkQualit2, _this8$_media, _this8$_media2, _this8$_media3, _this8$_media4, _this8$_media5, _this8$_media6, _this8$_frameRecvCall2, audioStats, videoStats, audioStallInfo, videoStallInfo, _ref6, _ref7, quality, qualityInfo, av_sync_diff;
8090
8225
  return _regeneratorRuntime$1().wrap(function _callee9$(_context9) {
8091
8226
  while (1)
8092
8227
  switch (_context9.prev = _context9.next) {
8093
8228
  case 0:
8094
- if (!(!((_this7$_audioTranscei = _this7._audioTransceicer) !== null && _this7$_audioTranscei !== void 0 && _this7$_audioTranscei.receiver) || !((_this7$_videoTranscei = _this7._videoTransceicer) !== null && _this7$_videoTranscei !== void 0 && _this7$_videoTranscei.receiver))) {
8229
+ if (!(!((_this8$_audioTranscei = _this8._audioTransceicer) !== null && _this8$_audioTranscei !== void 0 && (_this8$_audioTranscei2 = _this8$_audioTranscei.receiver) !== null && _this8$_audioTranscei2 !== void 0 && _this8$_audioTranscei2.getStats) || !((_this8$_videoTranscei = _this8._videoTransceicer) !== null && _this8$_videoTranscei !== void 0 && (_this8$_videoTranscei2 = _this8$_videoTranscei.receiver) !== null && _this8$_videoTranscei2 !== void 0 && _this8$_videoTranscei2.getStats))) {
8095
8230
  _context9.next = 4;
8096
8231
  break;
8097
8232
  }
8098
- _this7._preAudioStats = null;
8099
- _this7._preVideoStats = null;
8233
+ _this8._preAudioStats = null;
8234
+ _this8._preVideoStats = null;
8100
8235
  return _context9.abrupt("return");
8101
8236
  case 4:
8102
- if (!_this7._audioStallObserver && _this7._audioTransceicer) {
8103
- _this7._audioStallObserver = new AudioStallObserver();
8104
- _this7._audioStallObserver.start(_this7._audioTransceicer);
8237
+ if (!_this8._audioStallObserver && _this8._audioTransceicer) {
8238
+ _this8._audioStallObserver = new AudioStallObserver();
8239
+ _this8._audioStallObserver.start(_this8._audioTransceicer);
8105
8240
  }
8106
- if (!_this7._videoStallObserver && _this7._video && _this7._media) {
8107
- _this7._videoStallObserver = new VideoStallObserver();
8108
- _this7._videoStallObserver.start(_this7._media);
8241
+ if (!_this8._videoStallObserver && _this8._video && _this8._media) {
8242
+ _this8._videoStallObserver = new VideoStallObserver();
8243
+ _this8._videoStallObserver.start(_this8._media);
8109
8244
  }
8110
- if (!_this7._frameRecvCallback && _this7._media) {
8111
- _this7._frameRecvCallback = new VideoFrameRecvCallback();
8112
- (_this7$_frameRecvCall = _this7._frameRecvCallback) === null || _this7$_frameRecvCall === void 0 ? void 0 : _this7$_frameRecvCall.start(_this7._media);
8245
+ if (!_this8._frameRecvCallback && _this8._media) {
8246
+ _this8._frameRecvCallback = new VideoFrameRecvCallback();
8247
+ (_this8$_frameRecvCall = _this8._frameRecvCallback) === null || _this8$_frameRecvCall === void 0 ? void 0 : _this8$_frameRecvCall.start(_this8._media);
8113
8248
  }
8114
- if (_this7._pc && !_this7._networkQuality && _this7._opts.enableNetworkQuality && _this7._opts.networkQuality) {
8115
- _this7._networkQuality = new NetworkQuality(_this7._pc, _this7._opts.networkQuality);
8249
+ if (_this8._pc && !_this8._networkQuality && _this8._opts.enableNetworkQuality && _this8._opts.networkQuality) {
8250
+ _this8._networkQuality = new NetworkQuality(_this8._pc, _this8._opts.networkQuality);
8116
8251
  }
8117
8252
  _context9.next = 10;
8118
- return Promise.all([getRecvAudioStats(_this7._audioTransceicer.receiver.getStats()), getRecvVideoStats(_this7._videoTransceicer.receiver.getStats())]);
8253
+ return Promise.all([getRecvAudioStats(_this8._audioTransceicer.receiver.getStats()), getRecvVideoStats(_this8._videoTransceicer.receiver.getStats())]);
8119
8254
  case 10:
8120
8255
  _yield$Promise$all3 = _context9.sent;
8121
8256
  _yield$Promise$all4 = _slicedToArray(_yield$Promise$all3, 2);
8122
8257
  curAudioStats = _yield$Promise$all4[0];
8123
8258
  curVideoStats = _yield$Promise$all4[1];
8124
- if (!(_this7._preAudioStats && _this7._preVideoStats)) {
8259
+ if (!(_this8._preAudioStats && _this8._preVideoStats)) {
8125
8260
  _context9.next = 28;
8126
8261
  break;
8127
8262
  }
8128
- audioStats = diffRecvAudioStats(_this7._preAudioStats, curAudioStats);
8129
- videoStats = diffRecvVideoStats(_this7._preVideoStats, curVideoStats);
8130
- _this7._videoJitterBufferDelay = videoStats.jitterBufferDelay;
8263
+ audioStats = diffRecvAudioStats(_this8._preAudioStats, curAudioStats);
8264
+ videoStats = diffRecvVideoStats(_this8._preVideoStats, curVideoStats);
8265
+ _this8._videoJitterBufferDelay = videoStats.jitterBufferDelay;
8131
8266
  _context9.next = 20;
8132
- return (_this7$_audioStallObs = _this7._audioStallObserver) === null || _this7$_audioStallObs === void 0 ? void 0 : _this7$_audioStallObs.getAudioStallInfo();
8267
+ return (_this8$_audioStallObs = _this8._audioStallObserver) === null || _this8$_audioStallObs === void 0 ? void 0 : _this8$_audioStallObs.getAudioStallInfo();
8133
8268
  case 20:
8134
8269
  audioStallInfo = _context9.sent;
8135
8270
  _context9.next = 23;
8136
- return (_this7$_videoStallObs = _this7._videoStallObserver) === null || _this7$_videoStallObs === void 0 ? void 0 : _this7$_videoStallObs.getStallInfo({
8271
+ return (_this8$_videoStallObs = _this8._videoStallObserver) === null || _this8$_videoStallObs === void 0 ? void 0 : _this8$_videoStallObs.getStallInfo({
8137
8272
  interval: videoStats.statsInterval,
8138
8273
  frameRateReceived: videoStats.receivedFrameRate,
8139
8274
  frameRateDecoded: videoStats.decoderOutputFrameRate,
@@ -8141,18 +8276,18 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
8141
8276
  });
8142
8277
  case 23:
8143
8278
  videoStallInfo = _context9.sent;
8144
- _ref6 = (_this7$_networkQualit = (_this7$_networkQualit2 = _this7._networkQuality) === null || _this7$_networkQualit2 === void 0 ? void 0 : _this7$_networkQualit2.getDownlinkQuality(_objectSpread2$2(_objectSpread2$2({}, audioStats), {}, {
8279
+ _ref6 = (_this8$_networkQualit = (_this8$_networkQualit2 = _this8._networkQuality) === null || _this8$_networkQualit2 === void 0 ? void 0 : _this8$_networkQualit2.getDownlinkQuality(_objectSpread2$2(_objectSpread2$2({}, audioStats), {}, {
8145
8280
  stallDuration: (audioStallInfo === null || audioStallInfo === void 0 ? void 0 : audioStallInfo.stallDuration) || 0
8146
8281
  }), _objectSpread2$2(_objectSpread2$2({}, videoStats), {}, {
8147
8282
  stallDuration: (videoStallInfo === null || videoStallInfo === void 0 ? void 0 : videoStallInfo.stall.stallDuration100ms) || (videoStallInfo === null || videoStallInfo === void 0 ? void 0 : videoStallInfo.stall.stallDuration500ms) || 0
8148
- }))) !== null && _this7$_networkQualit !== void 0 ? _this7$_networkQualit : [], _ref7 = _slicedToArray(_ref6, 2), quality = _ref7[0], qualityInfo = _ref7[1];
8149
- if (_this7._opts.enableAdaptiveJitterBuffer) {
8150
- _this7._handleJitterBuffer(qualityInfo === null || qualityInfo === void 0 ? void 0 : qualityInfo.qualityQos, _this7._opts.adaptiveJitterBuffer, _this7._opts.networkStrategy);
8283
+ }))) !== null && _this8$_networkQualit !== void 0 ? _this8$_networkQualit : [], _ref7 = _slicedToArray(_ref6, 2), quality = _ref7[0], qualityInfo = _ref7[1];
8284
+ if (_this8._opts.enableAdaptiveJitterBuffer) {
8285
+ _this8._handleJitterBuffer(qualityInfo === null || qualityInfo === void 0 ? void 0 : qualityInfo.qualityQos, _this8._opts.adaptiveJitterBuffer, _this8._opts.networkStrategy);
8151
8286
  }
8152
8287
  if (videoStats.estimatedPlayoutTimestamp && audioStats.estimatedPlayoutTimestamp) {
8153
8288
  av_sync_diff = videoStats.estimatedPlayoutTimestamp - audioStats.estimatedPlayoutTimestamp;
8154
8289
  }
8155
- _this7.emit(EXTEND_EVENTS.RTC_NETWORK, _objectSpread2$2({
8290
+ _this8.emit(EXTEND_EVENTS.RTC_NETWORK, _objectSpread2$2({
8156
8291
  interval: videoStats.statsInterval,
8157
8292
  network_quality: quality,
8158
8293
  audio_stall_duration: audioStallInfo === null || audioStallInfo === void 0 ? void 0 : audioStallInfo.stallDuration,
@@ -8178,13 +8313,13 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
8178
8313
  quality_qos: qualityInfo === null || qualityInfo === void 0 ? void 0 : qualityInfo.qualityQos,
8179
8314
  quality_audio_qoe: qualityInfo === null || qualityInfo === void 0 ? void 0 : qualityInfo.audioQoe,
8180
8315
  quality_video_qoe: qualityInfo === null || qualityInfo === void 0 ? void 0 : qualityInfo.videoQoe,
8181
- current_delay: _this7._getDelay(),
8316
+ current_delay: _this8._getDelay(),
8182
8317
  visibility_state: document.visibilityState,
8183
- target_delay: _this7._targetDelayHint,
8318
+ target_delay: _this8._targetDelayHint,
8184
8319
  av_sync_diff,
8185
- set_delay_error: _this7._setDelayError || null,
8186
- video_width: ((_this7$_media = _this7._media) === null || _this7$_media === void 0 ? void 0 : _this7$_media.videoWidth) || 0,
8187
- video_height: ((_this7$_media2 = _this7._media) === null || _this7$_media2 === void 0 ? void 0 : _this7$_media2.videoHeight) || 0,
8320
+ set_delay_error: _this8._setDelayError || null,
8321
+ video_width: ((_this8$_media = _this8._media) === null || _this8$_media === void 0 ? void 0 : _this8$_media.videoWidth) || 0,
8322
+ video_height: ((_this8$_media2 = _this8._media) === null || _this8$_media2 === void 0 ? void 0 : _this8$_media2.videoHeight) || 0,
8188
8323
  abr_state: videoStats.abrState || "none",
8189
8324
  recv_frame_rate: videoStats.receivedFrameRate,
8190
8325
  decode_frame_rate: videoStats.decoderOutputFrameRate,
@@ -8192,15 +8327,19 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
8192
8327
  drop_frame_rate: videoStats.framesDropped,
8193
8328
  audio_packets_received: audioStats.packetsReceived,
8194
8329
  video_packets_received: videoStats.packetsReceived,
8195
- video_muted: (_this7$_media3 = _this7._media) === null || _this7$_media3 === void 0 ? void 0 : _this7$_media3.muted,
8196
- video_paused: (_this7$_media4 = _this7._media) === null || _this7$_media4 === void 0 ? void 0 : _this7$_media4.paused,
8197
- video_volume: (_this7$_media5 = _this7._media) === null || _this7$_media5 === void 0 ? void 0 : _this7$_media5.volume,
8198
- video_current_time: (_this7$_media6 = _this7._media) === null || _this7$_media6 === void 0 ? void 0 : _this7$_media6.currentTime
8199
- }, ((_this7$_frameRecvCall2 = _this7._frameRecvCallback) === null || _this7$_frameRecvCall2 === void 0 ? void 0 : _this7$_frameRecvCall2.getRecentRenderInfo4Report()) || {}));
8330
+ video_muted: (_this8$_media3 = _this8._media) === null || _this8$_media3 === void 0 ? void 0 : _this8$_media3.muted,
8331
+ video_paused: (_this8$_media4 = _this8._media) === null || _this8$_media4 === void 0 ? void 0 : _this8$_media4.paused,
8332
+ video_volume: (_this8$_media5 = _this8._media) === null || _this8$_media5 === void 0 ? void 0 : _this8$_media5.volume,
8333
+ video_current_time: (_this8$_media6 = _this8._media) === null || _this8$_media6 === void 0 ? void 0 : _this8$_media6.currentTime,
8334
+ fec_packets_received: videoStats.fecPacketsReceived,
8335
+ video_kbps: videoStats.receivedKBitrate,
8336
+ audio_kbps: audioStats.receivedKBitrate,
8337
+ fec_ssrc: videoStats.fecSsrc
8338
+ }, ((_this8$_frameRecvCall2 = _this8._frameRecvCallback) === null || _this8$_frameRecvCall2 === void 0 ? void 0 : _this8$_frameRecvCall2.getRecentRenderInfo4Report()) || {}));
8200
8339
  case 28:
8201
- _this7._preAudioStats = curAudioStats;
8202
- _this7._preVideoStats = curVideoStats;
8203
- _this7._setDelayError = null;
8340
+ _this8._preAudioStats = curAudioStats;
8341
+ _this8._preVideoStats = curVideoStats;
8342
+ _this8._setDelayError = null;
8204
8343
  case 31:
8205
8344
  case "end":
8206
8345
  return _context9.stop();
@@ -8355,7 +8494,7 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
8355
8494
  }, {
8356
8495
  key: "_changeVolumeInHarmonyWorkaround",
8357
8496
  value: function _changeVolumeInHarmonyWorkaround() {
8358
- var _this8 = this;
8497
+ var _this9 = this;
8359
8498
  if (isHarmonyOS()) {
8360
8499
  var originalDescriptor = Object.getOwnPropertyDescriptor(HTMLMediaElement.prototype, "muted");
8361
8500
  if (this._media && originalDescriptor) {
@@ -8374,9 +8513,9 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
8374
8513
  }
8375
8514
  });
8376
8515
  this._revertVolumeWorkaround = function() {
8377
- logger.log("revert HarmonyOS muted workaround. video dom:", _this8._media);
8378
- if (_this8._media) {
8379
- Object.defineProperty(_this8._media, "muted", originalDescriptor);
8516
+ logger.log("revert HarmonyOS muted workaround. video dom:", _this9._media);
8517
+ if (_this9._media) {
8518
+ Object.defineProperty(_this9._media, "muted", originalDescriptor);
8380
8519
  }
8381
8520
  };
8382
8521
  }
@@ -8385,7 +8524,7 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
8385
8524
  }, {
8386
8525
  key: "_mutedBeforePlayingWorkaround",
8387
8526
  value: function _mutedBeforePlayingWorkaround() {
8388
- var _this9 = this;
8527
+ var _this10 = this;
8389
8528
  if (isHeyTapBrowser() || isVivoBrowser()) {
8390
8529
  var originalDescriptor = Object.getOwnPropertyDescriptor(HTMLMediaElement.prototype, "muted");
8391
8530
  if (this._media && originalDescriptor) {
@@ -8405,12 +8544,13 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
8405
8544
  });
8406
8545
  var revertMutedProxy = function revertMutedProxy2() {
8407
8546
  logger.log("revert muted workaround. muted:", originalMuted);
8408
- if (_this9._media) {
8409
- Object.defineProperty(_this9._media, "muted", originalDescriptor);
8410
- _this9._media.muted = originalMuted;
8411
- _this9._media.removeEventListener("playing", revertMutedProxy2);
8547
+ if (_this10._media) {
8548
+ Object.defineProperty(_this10._media, "muted", originalDescriptor);
8549
+ _this10._media.muted = originalMuted;
8550
+ _this10._media.removeEventListener("playing", revertMutedProxy2);
8412
8551
  }
8413
8552
  };
8553
+ this._revertMutedWorkaround = revertMutedProxy;
8414
8554
  this._media.addEventListener("playing", revertMutedProxy);
8415
8555
  }
8416
8556
  }
@@ -8418,8 +8558,10 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
8418
8558
  }, {
8419
8559
  key: "destroy",
8420
8560
  value: function destroy(keepClearMediaStream) {
8421
- var _this$_revertVolumeWo, _this$_media3;
8561
+ var _this$_revertMutedWor, _this$_revertVolumeWo, _this$_media3;
8422
8562
  this._disconnect("invoke destroy");
8563
+ (_this$_revertMutedWor = this._revertMutedWorkaround) === null || _this$_revertMutedWor === void 0 ? void 0 : _this$_revertMutedWor.call(this);
8564
+ delete this._revertMutedWorkaround;
8423
8565
  (_this$_revertVolumeWo = this._revertVolumeWorkaround) === null || _this$_revertVolumeWo === void 0 ? void 0 : _this$_revertVolumeWo.call(this);
8424
8566
  delete this._revertVolumeWorkaround;
8425
8567
  (_this$_media3 = this._media) === null || _this$_media3 === void 0 ? void 0 : _this$_media3.removeEventListener("timeupdate", this._mockWaitingByTimeupdate);
@@ -8518,15 +8660,19 @@ var RtsPlugin = /* @__PURE__ */ function(_BasePlugin) {
8518
8660
  _this.__retry = function() {
8519
8661
  _this.player.removeClass(STATE_CLASS.ERROR);
8520
8662
  _this.player.addClass(STATE_CLASS.LOADING);
8521
- runHooks(_assertThisInitialized$1(_this), "retry", function() {
8663
+ _this.player.runHooks(_assertThisInitialized$1(_this), "retry", function() {
8522
8664
  _this.player.src = "";
8523
8665
  _this.player.once(CANPLAY, function() {
8524
- _this.player.mediaPlay();
8666
+ var _assertThisInitialize, _assertThisInitialize2;
8667
+ (_assertThisInitialize = _assertThisInitialized$1(_this)) === null || _assertThisInitialize === void 0 ? void 0 : (_assertThisInitialize2 = _assertThisInitialize.player) === null || _assertThisInitialize2 === void 0 ? void 0 : _assertThisInitialize2.mediaPlay();
8525
8668
  });
8526
8669
  });
8527
8670
  };
8528
8671
  _this.destroy = function() {
8529
8672
  var _this$_rts3;
8673
+ if (typeof _this._originHandleSource === "boolean") {
8674
+ _this.player.handleSource = _this._originHandleSource;
8675
+ }
8530
8676
  _this.player.switchURL = _this._originSwitchFn;
8531
8677
  _this.player.retry = _this._originRetry;
8532
8678
  _this._clearDisconnectTimer();
@@ -8573,12 +8719,16 @@ var RtsPlugin = /* @__PURE__ */ function(_BasePlugin) {
8573
8719
  }, {
8574
8720
  key: "version",
8575
8721
  get: function get() {
8576
- return "0.2.1-alpha.57";
8722
+ return "0.2.1-alpha.64";
8577
8723
  }
8578
8724
  }, {
8579
8725
  key: "beforePlayerInit",
8580
8726
  value: function beforePlayerInit() {
8581
- var _this$player2, _this$player$config, _this$player$config$r, _this2 = this;
8727
+ var _this$player$video, _this$player2, _this$player$config, _this$player$config$r, _this2 = this;
8728
+ var pl = this.player;
8729
+ this._originHandleSource = pl.handleSource;
8730
+ pl.handleSource = false;
8731
+ (_this$player$video = this.player.video) === null || _this$player$video === void 0 ? void 0 : _this$player$video.removeAttribute("src");
8582
8732
  this._init();
8583
8733
  if (!this._originSwitchFn) {
8584
8734
  var _this$player$switchUR;
@@ -8608,24 +8758,6 @@ var RtsPlugin = /* @__PURE__ */ function(_BasePlugin) {
8608
8758
  });
8609
8759
  }
8610
8760
  this._bindRtsEvents();
8611
- try {
8612
- BasePlugin.defineGetterOrSetter(this.player, {
8613
- __url: {
8614
- get: function get() {
8615
- try {
8616
- return URL.createObjectURL(new MediaSource());
8617
- } catch (e) {
8618
- var _this2$player, _this2$player$video;
8619
- if (!((_this2$player = _this2.player) !== null && _this2$player !== void 0 && (_this2$player$video = _this2$player.video) !== null && _this2$player$video !== void 0 && _this2$player$video.srcObject)) {
8620
- _this2.player.video.srcObject = new MediaStream();
8621
- }
8622
- return "";
8623
- }
8624
- }
8625
- }
8626
- });
8627
- } catch (e) {
8628
- }
8629
8761
  }
8630
8762
  }, {
8631
8763
  key: "getStats",
@@ -8715,6 +8847,9 @@ var RtsPlugin = /* @__PURE__ */ function(_BasePlugin) {
8715
8847
  player.unRegisterPlugin("rts");
8716
8848
  player.switchURL = _this3._originSwitchFn;
8717
8849
  player.retry = _this3._originRetry;
8850
+ if (typeof _this3._originHandleSource === "boolean") {
8851
+ player.handleSource = _this3._originHandleSource;
8852
+ }
8718
8853
  _this3._rts = null;
8719
8854
  player.rts = null;
8720
8855
  if ((_player$video = player.video) !== null && _player$video !== void 0 && _player$video.srcObject) {
@@ -8810,6 +8945,11 @@ var RtsPlugin = /* @__PURE__ */ function(_BasePlugin) {
8810
8945
  }
8811
8946
  return isSupportedH264;
8812
8947
  }()
8948
+ }, {
8949
+ key: "isEncodedTransformSupported",
8950
+ value: function isEncodedTransformSupported$1() {
8951
+ return isEncodedTransformSupported() || isLegacyEncodedTransformSupported();
8952
+ }
8813
8953
  }]);
8814
8954
  return RtsPlugin2;
8815
8955
  }(BasePlugin);