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