@volcengine/veplayer-plugin 2.4.3-rc.0 → 2.4.5-rc.0

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 (31) hide show
  1. package/esm/index.development.js +499 -1891
  2. package/esm/index.production.js +1 -1
  3. package/esm/veplayer.plugin.abr.development.js +3 -71
  4. package/esm/veplayer.plugin.abr.production.js +1 -1
  5. package/esm/veplayer.plugin.drm.development.js +3 -71
  6. package/esm/veplayer.plugin.drm.production.js +1 -1
  7. package/esm/veplayer.plugin.flv.development.js +196 -727
  8. package/esm/veplayer.plugin.flv.production.js +1 -1
  9. package/esm/veplayer.plugin.hls.development.js +304 -1233
  10. package/esm/veplayer.plugin.hls.production.js +1 -1
  11. package/esm/veplayer.plugin.mp4.development.js +5 -73
  12. package/esm/veplayer.plugin.mp4.production.js +1 -1
  13. package/esm/veplayer.plugin.rtm.development.js +4 -72
  14. package/esm/veplayer.plugin.rtm.production.js +1 -1
  15. package/esm/veplayer.plugin.shaka.development.js +4 -72
  16. package/esm/veplayer.plugin.shaka.production.js +1 -1
  17. package/package.json +1 -1
  18. package/umd/veplayer.plugin.abr.development.js +3 -71
  19. package/umd/veplayer.plugin.abr.production.js +1 -1
  20. package/umd/veplayer.plugin.drm.development.js +3 -71
  21. package/umd/veplayer.plugin.drm.production.js +1 -1
  22. package/umd/veplayer.plugin.flv.development.js +196 -727
  23. package/umd/veplayer.plugin.flv.production.js +1 -1
  24. package/umd/veplayer.plugin.hls.development.js +304 -1233
  25. package/umd/veplayer.plugin.hls.production.js +1 -1
  26. package/umd/veplayer.plugin.mp4.development.js +5 -73
  27. package/umd/veplayer.plugin.mp4.production.js +1 -1
  28. package/umd/veplayer.plugin.rtm.development.js +4 -72
  29. package/umd/veplayer.plugin.rtm.production.js +1 -1
  30. package/umd/veplayer.plugin.shaka.development.js +4 -72
  31. package/umd/veplayer.plugin.shaka.production.js +1 -1
@@ -1550,7 +1550,7 @@ var VERSION_REG = {
1550
1550
  android: /(Android)\s([\d.]+)/,
1551
1551
  ios: /(Version)\/([\d.]+)/
1552
1552
  };
1553
- var H264_MIMETYPES = ["avc1.42E01E, mp4a.40.2", "avc1.58A01E, mp4a.40.2", "avc1.4D401E, mp4a.40.2", "avc1.64001E, mp4a.40.2", "avc1.42E01E", "mp4v.20.8", "mp4v.20.8, mp4a.40.2", "mp4v.20.240, mp4a.40.2"];
1553
+ var H264_MIMETYPES = ["avc1.42E01E, mp4a.40.2", "avc1.58A01E, mp4a.40.2", "avc1.4D401E, mp4a.40.2", "avc1.64001E, mp4a.40.2", "avc1.42E01E", "mp4v.20.8", "avc1.42E01E, mp4a.40.2", "avc1.58A01E, mp4a.40.2", "avc1.4D401E, mp4a.40.2", "avc1.64001E, mp4a.40.2", "mp4v.20.8, mp4a.40.2", "mp4v.20.240, mp4a.40.2"];
1554
1554
  var sniffer = {
1555
1555
  get device() {
1556
1556
  var r = sniffer.os;
@@ -1695,7 +1695,7 @@ var sniffer = {
1695
1695
  }
1696
1696
  }
1697
1697
  };
1698
- var version$3 = "3.0.20-rc.6";
1698
+ var version$3 = "3.0.19-rc.0";
1699
1699
  var ERROR_MAP = {
1700
1700
  1: 5101,
1701
1701
  2: 5102,
@@ -1810,7 +1810,8 @@ function hook(hookName, handler) {
1810
1810
  }
1811
1811
  if (this.__hooks && this.__hooks[hookName]) {
1812
1812
  try {
1813
- var preRet = runHooks(this, hookName, handler);
1813
+ var _this$__hooks$hookNam;
1814
+ var preRet = (_this$__hooks$hookNam = this.__hooks[hookName]).call.apply(_this$__hooks$hookNam, [this, this].concat(Array.prototype.slice.call(arguments)));
1814
1815
  if (preRet) {
1815
1816
  if (preRet.then) {
1816
1817
  preRet.then(function(isContinue) {
@@ -1835,19 +1836,6 @@ function hook(hookName, handler) {
1835
1836
  }
1836
1837
  }.bind(this);
1837
1838
  }
1838
- function findHookIndex(hookName, handler) {
1839
- var __hooks = this.__hooks;
1840
- if (!__hooks || !Array.isArray(__hooks[hookName])) {
1841
- return -1;
1842
- }
1843
- var hookHandlers = __hooks[hookName];
1844
- for (var i = 0; i < hookHandlers.length; i++) {
1845
- if (hookHandlers[i] === handler) {
1846
- return i;
1847
- }
1848
- }
1849
- return -1;
1850
- }
1851
1839
  function useHooks(hookName, handler) {
1852
1840
  var __hooks = this.__hooks;
1853
1841
  if (!__hooks) {
@@ -1857,12 +1845,7 @@ function useHooks(hookName, handler) {
1857
1845
  console.warn("has no supported hook which name [".concat(hookName, "]"));
1858
1846
  return false;
1859
1847
  }
1860
- if (!Array.isArray(__hooks[hookName])) {
1861
- __hooks[hookName] = [];
1862
- }
1863
- if (findHookIndex.call(this, hookName, handler) === -1) {
1864
- __hooks[hookName].push(handler);
1865
- }
1848
+ __hooks && (__hooks[hookName] = handler);
1866
1849
  return true;
1867
1850
  }
1868
1851
  function removeHooks(hookName, handler) {
@@ -1870,13 +1853,6 @@ function removeHooks(hookName, handler) {
1870
1853
  if (!__hooks) {
1871
1854
  return;
1872
1855
  }
1873
- if (Array.isArray(__hooks[hookName])) {
1874
- var hooks = __hooks[hookName];
1875
- var index2 = findHookIndex.call(this, hookName, handler);
1876
- if (index2 !== -1) {
1877
- hooks.splice(index2, 1);
1878
- }
1879
- }
1880
1856
  delete __hooks[hookName];
1881
1857
  }
1882
1858
  function hooksDescriptor(instance) {
@@ -1898,38 +1874,6 @@ function hooksDescriptor(instance) {
1898
1874
  function delHooksDescriptor(instance) {
1899
1875
  instance.__hooks = null;
1900
1876
  }
1901
- function runHooks(obj, hookName, handler) {
1902
- for (var _len5 = arguments.length, args = new Array(_len5 > 3 ? _len5 - 3 : 0), _key5 = 3; _key5 < _len5; _key5++) {
1903
- args[_key5 - 3] = arguments[_key5];
1904
- }
1905
- if (obj.__hooks && Array.isArray(obj.__hooks[hookName])) {
1906
- var hooks = obj.__hooks[hookName];
1907
- var index2 = -1;
1908
- var runHooksRecursive = function runHooksRecursive2(obj2, hookName2, handler2) {
1909
- for (var _len6 = arguments.length, args2 = new Array(_len6 > 3 ? _len6 - 3 : 0), _key6 = 3; _key6 < _len6; _key6++) {
1910
- args2[_key6 - 3] = arguments[_key6];
1911
- }
1912
- index2++;
1913
- if (hooks.length === 0 || index2 === hooks.length) {
1914
- return handler2.call.apply(handler2, [obj2, obj2].concat(args2));
1915
- }
1916
- var hook2 = hooks[index2];
1917
- var ret = hook2.call.apply(hook2, [obj2, obj2].concat(args2));
1918
- if (ret && ret.then) {
1919
- return ret.then(function(data2) {
1920
- return data2 === false ? null : runHooksRecursive2.apply(void 0, [obj2, hookName2, handler2].concat(args2));
1921
- }).catch(function(e) {
1922
- console.warn("[runHooks]".concat(hookName2, " reject"), e.message);
1923
- });
1924
- } else if (ret !== false) {
1925
- return runHooksRecursive2.apply(void 0, [obj2, hookName2, handler2].concat(args2));
1926
- }
1927
- };
1928
- return runHooksRecursive.apply(void 0, [obj, hookName, handler].concat(args));
1929
- } else {
1930
- return handler.call.apply(handler, [obj, obj].concat(args));
1931
- }
1932
- }
1933
1877
  function showErrorMsg(pluginName, msg) {
1934
1878
  XG_DEBUG.logError("[".concat(pluginName, "] event or callback cant be undefined or null when call ").concat(msg));
1935
1879
  }
@@ -2169,18 +2113,6 @@ var BasePlugin = /* @__PURE__ */ function() {
2169
2113
  }
2170
2114
  }
2171
2115
  }
2172
- }, {
2173
- key: "defineMethod",
2174
- value: function defineMethod(Obj, map6) {
2175
- for (var key2 in map6) {
2176
- if (Object.prototype.hasOwnProperty.call(map6, key2) && typeof map6[key2] === "function") {
2177
- Object.defineProperty(Obj, key2, {
2178
- configurable: true,
2179
- value: map6[key2]
2180
- });
2181
- }
2182
- }
2183
- }
2184
2116
  }, {
2185
2117
  key: "defaultConfig",
2186
2118
  get: function get3() {
@@ -2803,7 +2735,7 @@ function _arrayLikeToArray$c(arr, len) {
2803
2735
  arr2[i] = arr[i];
2804
2736
  return arr2;
2805
2737
  }
2806
- function _createForOfIteratorHelper$4(o, allowArrayLike) {
2738
+ function _createForOfIteratorHelper$3(o, allowArrayLike) {
2807
2739
  var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
2808
2740
  if (!it) {
2809
2741
  if (Array.isArray(o) || (it = _unsupportedIterableToArray$c(o)) || allowArrayLike && o && typeof o.length === "number") {
@@ -2991,21 +2923,6 @@ var Buffer$6 = /* @__PURE__ */ function() {
2991
2923
  length: Buffer22.totalLength && Buffer22.totalLength(buffers)
2992
2924
  };
2993
2925
  }
2994
- }, {
2995
- key: "isBuffered",
2996
- value: function isBuffered(media, pos) {
2997
- if (media) {
2998
- var buffered = Buffer22.get(media);
2999
- if (buffered !== null && buffered !== void 0 && buffered.length) {
3000
- for (var i = 0; i < buffered.length; i++) {
3001
- if (pos >= buffered.start(i) && pos <= buffered.end(i)) {
3002
- return true;
3003
- }
3004
- }
3005
- }
3006
- }
3007
- return false;
3008
- }
3009
2926
  }]);
3010
2927
  return Buffer22;
3011
2928
  }();
@@ -3158,7 +3075,7 @@ var Logger$a = /* @__PURE__ */ function() {
3158
3075
  this.logCache.apply(this, [LogCacheLevel$2.DEBUG].concat(args));
3159
3076
  if (Logger2.disabled)
3160
3077
  return;
3161
- (_console = console).debug.apply(_console, ["[".concat(nowTime$7(), "]"), this._prefix].concat(args));
3078
+ (_console = console).debug.apply(_console, [this._prefix, nowTime$7()].concat(args));
3162
3079
  }
3163
3080
  }, {
3164
3081
  key: "log",
@@ -3170,7 +3087,7 @@ var Logger$a = /* @__PURE__ */ function() {
3170
3087
  this.logCache.apply(this, [LogCacheLevel$2.LOG].concat(args));
3171
3088
  if (Logger2.disabled)
3172
3089
  return;
3173
- (_console2 = console).log.apply(_console2, ["[".concat(nowTime$7(), "]"), this._prefix].concat(args));
3090
+ (_console2 = console).log.apply(_console2, [this._prefix, nowTime$7()].concat(args));
3174
3091
  }
3175
3092
  }, {
3176
3093
  key: "warn",
@@ -3182,7 +3099,7 @@ var Logger$a = /* @__PURE__ */ function() {
3182
3099
  this.logCache.apply(this, [LogCacheLevel$2.WARN].concat(args));
3183
3100
  if (Logger2.disabled)
3184
3101
  return;
3185
- (_console3 = console).warn.apply(_console3, ["[".concat(nowTime$7(), "]"), this._prefix].concat(args));
3102
+ (_console3 = console).warn.apply(_console3, [this._prefix, nowTime$7()].concat(args));
3186
3103
  }
3187
3104
  }, {
3188
3105
  key: "error",
@@ -3194,7 +3111,7 @@ var Logger$a = /* @__PURE__ */ function() {
3194
3111
  this.logCache.apply(this, [LogCacheLevel$2.ERROR].concat(args));
3195
3112
  if (Logger2.disabled)
3196
3113
  return;
3197
- (_console4 = console).error.apply(_console4, ["[".concat(nowTime$7(), "]"), this._prefix].concat(args));
3114
+ (_console4 = console).error.apply(_console4, [this._prefix, nowTime$7()].concat(args));
3198
3115
  }
3199
3116
  }, {
3200
3117
  key: "logCache",
@@ -3209,7 +3126,7 @@ var Logger$a = /* @__PURE__ */ function() {
3209
3126
  var finLogText = logText.map(function(item) {
3210
3127
  return logable$2(item);
3211
3128
  });
3212
- text = "[".concat(nowTime$7(), "]") + this._prefix + JSON.stringify(finLogText);
3129
+ text = this._prefix + nowTime$7() + JSON.stringify(finLogText);
3213
3130
  } catch (e) {
3214
3131
  return;
3215
3132
  }
@@ -4125,8 +4042,8 @@ function createResponse$3(data2, done, response, contentLength, age, startTime,
4125
4042
  response
4126
4043
  };
4127
4044
  }
4128
- function calculateSpeed$3(byteLen, milliSecond) {
4129
- return Math.round(byteLen * 8 * 1e3 / milliSecond / 1024);
4045
+ function calculateSpeed$3(byteLen, millisec) {
4046
+ return Math.round(byteLen * 8 * 1e3 / millisec / 1024);
4130
4047
  }
4131
4048
  var EVENT$3 = {
4132
4049
  ERROR: "error",
@@ -4138,7 +4055,6 @@ var EVENT$3 = {
4138
4055
  SOURCEBUFFER_CREATED: "core.sourcebuffercreated",
4139
4056
  MEDIASOURCE_OPENED: "core.mediasourceopened",
4140
4057
  ANALYZE_DURATION_EXCEEDED: "core.analyzedurationexceeded",
4141
- APPEND_BUFFER: "core.appendbuffer",
4142
4058
  REMOVE_BUFFER: "core.removebuffer",
4143
4059
  BUFFEREOS: "core.buffereos",
4144
4060
  KEYFRAME: "core.keyframe",
@@ -4911,7 +4827,7 @@ var XhrLoader$3 = /* @__PURE__ */ function(_EventEmitter) {
4911
4827
  value: function _getHeaders(xhr) {
4912
4828
  var headerLines = xhr.getAllResponseHeaders().trim().split("\r\n");
4913
4829
  var headers = {};
4914
- var _iterator = _createForOfIteratorHelper$4(headerLines), _step;
4830
+ var _iterator = _createForOfIteratorHelper$3(headerLines), _step;
4915
4831
  try {
4916
4832
  for (_iterator.s(); !(_step = _iterator.n()).done; ) {
4917
4833
  var header = _step.value;
@@ -4933,7 +4849,7 @@ var XhrLoader$3 = /* @__PURE__ */ function(_EventEmitter) {
4933
4849
  }]);
4934
4850
  return XhrLoader2;
4935
4851
  }(EventEmitter$1);
4936
- var _excluded$6 = ["retry", "retryDelay", "onRetryError", "transformError"];
4852
+ var _excluded$5 = ["retry", "retryDelay", "onRetryError", "transformError"];
4937
4853
  var Task$3 = /* @__PURE__ */ function() {
4938
4854
  function Task2(type, config) {
4939
4855
  _classCallCheck$h(this, Task2);
@@ -4953,7 +4869,7 @@ var Task$3 = /* @__PURE__ */ function() {
4953
4869
  key: "exec",
4954
4870
  value: function exec2() {
4955
4871
  var _this = this;
4956
- var _this$_config = this._config, retry = _this$_config.retry, retryDelay = _this$_config.retryDelay, onRetryError = _this$_config.onRetryError, transformError = _this$_config.transformError, rest = _objectWithoutProperties$5(_this$_config, _excluded$6);
4872
+ var _this$_config = this._config, retry = _this$_config.retry, retryDelay = _this$_config.retryDelay, onRetryError = _this$_config.onRetryError, transformError = _this$_config.transformError, rest = _objectWithoutProperties$5(_this$_config, _excluded$5);
4957
4873
  var request = /* @__PURE__ */ function() {
4958
4874
  var _ref = _asyncToGenerator$9(/* @__PURE__ */ _regeneratorRuntime$9().mark(function _callee() {
4959
4875
  var response, error, isRetry;
@@ -5771,15 +5687,13 @@ var TrackType$3 = {
5771
5687
  METADATA: "metadata"
5772
5688
  };
5773
5689
  var VideoCodecType$3 = {
5774
- AV1: "av1",
5775
5690
  AVC: "avc",
5776
5691
  HEVC: "hevc"
5777
5692
  };
5778
5693
  var AudioCodecType$2 = {
5779
5694
  AAC: "aac",
5780
5695
  G711PCMA: "g7110a",
5781
- G711PCMU: "g7110m",
5782
- OPUS: "opus"
5696
+ G711PCMU: "g7110m"
5783
5697
  };
5784
5698
  var WarningType$1 = {
5785
5699
  LARGE_AV_SHIFT: "LARGE_AV_SHIFT",
@@ -5819,7 +5733,6 @@ var VideoTrack$2 = /* @__PURE__ */ function() {
5819
5733
  _defineProperty$e(this, "isVideoEncryption", false);
5820
5734
  _defineProperty$e(this, "isAudioEncryption", false);
5821
5735
  _defineProperty$e(this, "isVideo", true);
5822
- _defineProperty$e(this, "lastKeyFrameDts", 0);
5823
5736
  _defineProperty$e(this, "kid", null);
5824
5737
  _defineProperty$e(this, "pssh", null);
5825
5738
  _defineProperty$e(this, "ext", void 0);
@@ -5862,9 +5775,6 @@ var VideoTrack$2 = /* @__PURE__ */ function() {
5862
5775
  }, {
5863
5776
  key: "exist",
5864
5777
  value: function exist() {
5865
- if (/av01/.test(this.codec)) {
5866
- return true;
5867
- }
5868
5778
  return !!(this.pps.length && this.sps.length && this.codec);
5869
5779
  }
5870
5780
  }, {
@@ -5928,7 +5838,7 @@ var AudioTrack$2 = /* @__PURE__ */ function() {
5928
5838
  }, {
5929
5839
  key: "exist",
5930
5840
  value: function exist() {
5931
- return !!(this.sampleRate && this.channelCount && this.codec && (this.codecType === AudioCodecType$2.AAC || this.codecType === AudioCodecType$2.G711PCMA || this.codecType === AudioCodecType$2.G711PCMU || this.codecType === AudioCodecType$2.OPUS));
5841
+ return !!(this.sampleRate && this.channelCount && this.codec && this.codecType === AudioCodecType$2.AAC);
5932
5842
  }
5933
5843
  }, {
5934
5844
  key: "hasSample",
@@ -6142,7 +6052,7 @@ var AAC$2 = /* @__PURE__ */ function() {
6142
6052
  continue;
6143
6053
  }
6144
6054
  frameLength = (data2[i + 3] & 3) << 11 | data2[i + 4] << 3 | (data2[i + 5] & 224) >> 5;
6145
- if (!frameLength || len - i < frameLength)
6055
+ if (len - i < frameLength)
6146
6056
  break;
6147
6057
  protectionSkipBytes = (~data2[i + 1] & 1) * 2;
6148
6058
  frames.push({
@@ -6276,57 +6186,14 @@ var AAC$2 = /* @__PURE__ */ function() {
6276
6186
  return AAC2;
6277
6187
  }();
6278
6188
  _defineProperty$e(AAC$2, "FREQ", [96e3, 88200, 64e3, 48e3, 44100, 32e3, 24e3, 22050, 16e3, 12e3, 11025, 8e3, 7350]);
6279
- var OPUS = /* @__PURE__ */ function() {
6280
- function OPUS2() {
6281
- _classCallCheck$g(this, OPUS2);
6282
- }
6283
- _createClass$g(OPUS2, null, [{
6284
- key: "getFrameDuration",
6285
- value: function getFrameDuration(samples) {
6286
- return 20;
6287
- }
6288
- }, {
6289
- key: "parseHeaderPackets",
6290
- value: function parseHeaderPackets(data2) {
6291
- if (!data2.length)
6292
- return;
6293
- var dv = new DataView(data2.buffer, data2.byteOffset, data2.byteLength);
6294
- var magicSignature = "";
6295
- for (var i = 0; i < 8; i++) {
6296
- magicSignature += String.fromCodePoint(data2[i]);
6297
- }
6298
- if (magicSignature !== "OpusHead") {
6299
- throw new Error("Invalid Opus MagicSignature");
6300
- }
6301
- var channelCount = data2[9];
6302
- console.log("Pre-skip", data2[10], data2[11]);
6303
- var sampleRate = dv.getUint32(12, true);
6304
- var outputGain = dv.getInt16(16, true);
6305
- if (!sampleRate)
6306
- return;
6307
- var codec = "opus";
6308
- var originCodec = "opus";
6309
- var config = new Uint8Array(data2.buffer, data2.byteOffset + 8, data2.byteLength - 8);
6310
- return {
6311
- outputGain,
6312
- sampleRate,
6313
- channelCount,
6314
- config,
6315
- codec,
6316
- originCodec
6317
- };
6318
- }
6319
- }]);
6320
- return OPUS2;
6321
- }();
6322
6189
  var LARGE_AV_FIRST_FRAME_GAP$1 = 500;
6323
6190
  var AUDIO_GAP_OVERLAP_THRESHOLD_COUNT$1 = 3;
6324
6191
  var MAX_SILENT_FRAME_DURATION$1 = 1e3;
6325
- var AUDIO_EXCEPTION_LOG_EMIT_DURATION = 5e3;
6192
+ var AUDIO_EXCETION_LOG_EMIT_DURATION$1 = 5e3;
6326
6193
  var MAX_VIDEO_FRAME_DURATION$1 = 1e3;
6327
6194
  var MAX_DTS_DELTA_WITH_NEXT_CHUNK$1 = 200;
6328
- var VIDEO_EXCEPTION_LOG_EMIT_DURATION = 5e3;
6329
- var TRACK_BROKEN_CHECK_TIME = 5;
6195
+ var VIDEO_EXCETION_LOG_EMIT_DURATION = 5e3;
6196
+ var TRACK_BREACKED_CHECK_TIME = 5;
6330
6197
  var FlvFixer = /* @__PURE__ */ function() {
6331
6198
  function FlvFixer2(videoTrack, audioTrack, metadataTrack) {
6332
6199
  _classCallCheck$g(this, FlvFixer2);
@@ -6442,7 +6309,7 @@ var FlvFixer = /* @__PURE__ */ function() {
6442
6309
  var firstSample = samples[0];
6443
6310
  var vDelta = this._videoNextDts - firstSample.dts;
6444
6311
  if (Math.abs(vDelta) > MAX_DTS_DELTA_WITH_NEXT_CHUNK$1) {
6445
- if (Math.abs(firstSample.dts - this._lastVideoExceptionChunkFirstDtsDot) > VIDEO_EXCEPTION_LOG_EMIT_DURATION) {
6312
+ if (Math.abs(firstSample.dts - this._lastVideoExceptionChunkFirstDtsDot) > VIDEO_EXCETION_LOG_EMIT_DURATION) {
6446
6313
  var _samples$;
6447
6314
  this._lastVideoExceptionChunkFirstDtsDot = firstSample.dts;
6448
6315
  videoTrack.warnings.push({
@@ -6453,7 +6320,7 @@ var FlvFixer = /* @__PURE__ */ function() {
6453
6320
  sampleDuration: vDelta
6454
6321
  });
6455
6322
  }
6456
- if (this._videoTimestampBreak >= TRACK_BROKEN_CHECK_TIME) {
6323
+ if (this._videoTimestampBreak >= TRACK_BREACKED_CHECK_TIME) {
6457
6324
  this._videoNextDts = firstSample.dts;
6458
6325
  this._videoTimestampBreak = 0;
6459
6326
  } else {
@@ -6476,7 +6343,7 @@ var FlvFixer = /* @__PURE__ */ function() {
6476
6343
  }
6477
6344
  if (sampleDuration > MAX_VIDEO_FRAME_DURATION$1 || sampleDuration < 0) {
6478
6345
  this._videoTimestampBreak++;
6479
- if (Math.abs(dts - this._lastVideoExceptionLargeGapDot) > VIDEO_EXCEPTION_LOG_EMIT_DURATION) {
6346
+ if (Math.abs(dts - this._lastVideoExceptionLargeGapDot) > VIDEO_EXCETION_LOG_EMIT_DURATION) {
6480
6347
  this._lastVideoExceptionLargeGapDot = dts;
6481
6348
  videoTrack.warnings.push({
6482
6349
  type: WarningType$1.LARGE_VIDEO_GAP,
@@ -6557,27 +6424,10 @@ var FlvFixer = /* @__PURE__ */ function() {
6557
6424
  key: "_doFixAudioInternal",
6558
6425
  value: function _doFixAudioInternal(audioTrack, samples, timescale) {
6559
6426
  if (!audioTrack.sampleDuration) {
6560
- switch (audioTrack.codecType) {
6561
- case AudioCodecType$2.AAC: {
6562
- audioTrack.sampleDuration = AAC$2.getFrameDuration(audioTrack.timescale, timescale);
6563
- break;
6564
- }
6565
- case AudioCodecType$2.OPUS: {
6566
- audioTrack.sampleDuration = OPUS.getFrameDuration(audioTrack.samples, timescale);
6567
- break;
6568
- }
6569
- case AudioCodecType$2.G711PCMA:
6570
- case AudioCodecType$2.G711PCMU: {
6571
- audioTrack.sampleDuration = this._getG711Duration(audioTrack);
6572
- break;
6573
- }
6574
- default:
6575
- console.error("can't fix audio codecType:", audioTrack.codecType);
6576
- break;
6577
- }
6427
+ audioTrack.sampleDuration = audioTrack.codecType === AudioCodecType$2.AAC ? AAC$2.getFrameDuration(audioTrack.timescale, timescale) : this._getG711Duration(audioTrack);
6578
6428
  }
6579
6429
  var refSampleDuration = audioTrack.sampleDuration;
6580
- var sampleDurationInSampleRate = audioTrack.codecType === AudioCodecType$2.OPUS ? 20 : audioTrack.codecType === AudioCodecType$2.AAC ? 1024 : refSampleDuration * audioTrack.timescale / 1e3;
6430
+ var sampleDurationInSampleRate = audioTrack.codecType === AudioCodecType$2.AAC ? 1024 : refSampleDuration * audioTrack.timescale / 1e3;
6581
6431
  if (this._audioNextPts === void 0) {
6582
6432
  var samp0 = samples[0];
6583
6433
  this._audioNextPts = samp0.pts;
@@ -6586,7 +6436,7 @@ var FlvFixer = /* @__PURE__ */ function() {
6586
6436
  var nextPts = this._audioNextPts;
6587
6437
  var sample = samples[i];
6588
6438
  var delta = sample.pts - nextPts;
6589
- if (i === 0 && this._audioTimestampBreak >= TRACK_BROKEN_CHECK_TIME && this._keyFrameInNextChunk) {
6439
+ if (i === 0 && this._audioTimestampBreak >= TRACK_BREACKED_CHECK_TIME && this._keyFrameInNextChunk) {
6590
6440
  nextPts = this._audioNextPts = sample.dts;
6591
6441
  delta = 0;
6592
6442
  this._audioTimestampBreak = 0;
@@ -6594,7 +6444,7 @@ var FlvFixer = /* @__PURE__ */ function() {
6594
6444
  if (!this._audioTimestampBreak && delta >= AUDIO_GAP_OVERLAP_THRESHOLD_COUNT$1 * refSampleDuration && delta <= MAX_SILENT_FRAME_DURATION$1 && !isSafari$1) {
6595
6445
  var silentFrame = this._getSilentFrame(audioTrack) || samples[0].data.subarray();
6596
6446
  var count = Math.floor(delta / refSampleDuration);
6597
- if (Math.abs(sample.pts - this._lastAudioExceptionGapDot) > AUDIO_EXCEPTION_LOG_EMIT_DURATION) {
6447
+ if (Math.abs(sample.pts - this._lastAudioExceptionGapDot) > AUDIO_EXCETION_LOG_EMIT_DURATION$1) {
6598
6448
  this._lastAudioExceptionGapDot = sample.pts;
6599
6449
  audioTrack.warnings.push({
6600
6450
  type: WarningType$1.AUDIO_FILLED,
@@ -6614,7 +6464,7 @@ var FlvFixer = /* @__PURE__ */ function() {
6614
6464
  }
6615
6465
  i--;
6616
6466
  } else if (delta <= -AUDIO_GAP_OVERLAP_THRESHOLD_COUNT$1 * refSampleDuration && delta >= -1 * MAX_SILENT_FRAME_DURATION$1) {
6617
- if (Math.abs(sample.pts - this._lastAudioExceptionOverlapDot) > AUDIO_EXCEPTION_LOG_EMIT_DURATION) {
6467
+ if (Math.abs(sample.pts - this._lastAudioExceptionOverlapDot) > AUDIO_EXCETION_LOG_EMIT_DURATION$1) {
6618
6468
  this._lastAudioExceptionOverlapDot = sample.pts;
6619
6469
  audioTrack.warnings.push({
6620
6470
  type: WarningType$1.AUDIO_DROPPED,
@@ -6629,7 +6479,7 @@ var FlvFixer = /* @__PURE__ */ function() {
6629
6479
  } else {
6630
6480
  if (Math.abs(delta) > MAX_SILENT_FRAME_DURATION$1) {
6631
6481
  this._audioTimestampBreak++;
6632
- if (Math.abs(sample.pts - this._lastAudioExceptionLargeGapDot) > AUDIO_EXCEPTION_LOG_EMIT_DURATION) {
6482
+ if (Math.abs(sample.pts - this._lastAudioExceptionLargeGapDot) > AUDIO_EXCETION_LOG_EMIT_DURATION$1) {
6633
6483
  this._lastAudioExceptionLargeGapDot = sample.pts;
6634
6484
  audioTrack.warnings.push({
6635
6485
  type: WarningType$1.LARGE_AUDIO_GAP,
@@ -6642,15 +6492,8 @@ var FlvFixer = /* @__PURE__ */ function() {
6642
6492
  });
6643
6493
  }
6644
6494
  }
6645
- if (audioTrack.codecType === AudioCodecType$2.OPUS) {
6646
- var lastSample = samples[samples.length - 1];
6647
- if (lastSample) {
6648
- lastSample.duration = sample.pts - lastSample.pts;
6649
- }
6650
- } else {
6651
- sample.dts = sample.pts = nextPts;
6652
- sample.duration = sampleDurationInSampleRate;
6653
- }
6495
+ sample.dts = sample.pts = nextPts;
6496
+ sample.duration = sampleDurationInSampleRate;
6654
6497
  this._audioNextPts += refSampleDuration;
6655
6498
  }
6656
6499
  }
@@ -7609,13 +7452,6 @@ var AMF = /* @__PURE__ */ function() {
7609
7452
  }]);
7610
7453
  return AMF2;
7611
7454
  }();
7612
- var FlvSoundFormat = {
7613
- MP3: 2,
7614
- G711A: 7,
7615
- G711M: 8,
7616
- AAC: 10,
7617
- OPUS: 13
7618
- };
7619
7455
  var logger$9 = new Logger$9("FlvDemuxer");
7620
7456
  var FlvDemuxer = /* @__PURE__ */ function() {
7621
7457
  function FlvDemuxer2(videoTrack, audioTrack, metadataTrack) {
@@ -7632,10 +7468,8 @@ var FlvDemuxer = /* @__PURE__ */ function() {
7632
7468
  _createClass$g(FlvDemuxer2, [{
7633
7469
  key: "demux",
7634
7470
  value: function demux(data2) {
7635
- var _scriptDataObject$dat;
7636
7471
  var discontinuity = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
7637
7472
  var contiguous = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : true;
7638
- var seamlessLoadingSwitching = arguments.length > 3 ? arguments[3] : void 0;
7639
7473
  var audioTrack = this.audioTrack, videoTrack = this.videoTrack, metadataTrack = this.metadataTrack;
7640
7474
  if (discontinuity || !contiguous) {
7641
7475
  this._remainingData = null;
@@ -7693,8 +7527,6 @@ var FlvDemuxer = /* @__PURE__ */ function() {
7693
7527
  if (tagType === 8) {
7694
7528
  this._parseAudio(bodyData, timestamp);
7695
7529
  } else if (tagType === 9) {
7696
- if (seamlessLoadingSwitching)
7697
- this.seamlessLoadingSwitching = true;
7698
7530
  this._parseVideo(bodyData, timestamp);
7699
7531
  } else if (tagType === 18) {
7700
7532
  this._parseScript(bodyData, timestamp);
@@ -7712,31 +7544,13 @@ var FlvDemuxer = /* @__PURE__ */ function() {
7712
7544
  this._remainingData = data2.subarray(offset);
7713
7545
  }
7714
7546
  audioTrack.formatTimescale = videoTrack.formatTimescale = videoTrack.timescale = metadataTrack.timescale = 1e3;
7715
- audioTrack.timescale = audioTrack.codecType === AudioCodecType$2.OPUS ? 1e3 : audioTrack.sampleRate || 0;
7547
+ audioTrack.timescale = audioTrack.sampleRate || 0;
7716
7548
  if (!audioTrack.exist() && audioTrack.hasSample()) {
7717
7549
  audioTrack.reset();
7718
7550
  }
7719
7551
  if (!videoTrack.exist() && videoTrack.hasSample()) {
7720
7552
  videoTrack.reset();
7721
7553
  }
7722
- var scriptDataObject = metadataTrack.flvScriptSamples[metadataTrack.flvScriptSamples.length - 1];
7723
- var metaData = scriptDataObject === null || scriptDataObject === void 0 ? void 0 : (_scriptDataObject$dat = scriptDataObject.data) === null || _scriptDataObject$dat === void 0 ? void 0 : _scriptDataObject$dat.onMetaData;
7724
- if (metaData) {
7725
- if (videoTrack !== null && videoTrack !== void 0 && videoTrack.exist()) {
7726
- if (metaData.hasOwnProperty("duration")) {
7727
- videoTrack.duration = metaData.duration * 1e3;
7728
- }
7729
- if (metaData.hasOwnProperty("width") && metaData.hasOwnProperty("height")) {
7730
- videoTrack.width = metaData.width;
7731
- videoTrack.height = metaData.height;
7732
- }
7733
- }
7734
- if (audioTrack !== null && audioTrack !== void 0 && audioTrack.exist()) {
7735
- if (metaData.hasOwnProperty("duration")) {
7736
- audioTrack.duration = metaData.duration * 1e3;
7737
- }
7738
- }
7739
- }
7740
7554
  return {
7741
7555
  videoTrack,
7742
7556
  audioTrack,
@@ -7755,8 +7569,8 @@ var FlvDemuxer = /* @__PURE__ */ function() {
7755
7569
  }
7756
7570
  }, {
7757
7571
  key: "demuxAndFix",
7758
- value: function demuxAndFix(data2, discontinuity, contiguous, startTime, seamlessLoadingSwitching) {
7759
- this.demux(data2, discontinuity, contiguous, seamlessLoadingSwitching);
7572
+ value: function demuxAndFix(data2, discontinuity, contiguous, startTime) {
7573
+ this.demux(data2, discontinuity, contiguous);
7760
7574
  return this.fix(startTime, discontinuity, contiguous);
7761
7575
  }
7762
7576
  }, {
@@ -7766,12 +7580,12 @@ var FlvDemuxer = /* @__PURE__ */ function() {
7766
7580
  return;
7767
7581
  var format2 = (data2[0] & 240) >>> 4;
7768
7582
  var track = this.audioTrack;
7769
- if (format2 !== FlvSoundFormat.AAC && format2 !== FlvSoundFormat.G711A && format2 !== FlvSoundFormat.G711M && format2 !== FlvSoundFormat.OPUS) {
7583
+ if (format2 !== 10 && format2 !== 7 && format2 !== 8) {
7770
7584
  logger$9.warn("Unsupported sound format: ".concat(format2));
7771
7585
  track.reset();
7772
7586
  return;
7773
7587
  }
7774
- if (format2 !== FlvSoundFormat.AAC && format2 !== FlvSoundFormat.OPUS) {
7588
+ if (format2 !== 10) {
7775
7589
  var soundRate = (data2[0] & 12) >> 2;
7776
7590
  var soundSize = (data2[0] & 2) >> 1;
7777
7591
  var soundType = data2[0] & 1;
@@ -7779,49 +7593,10 @@ var FlvDemuxer = /* @__PURE__ */ function() {
7779
7593
  track.sampleSize = soundSize ? 16 : 8;
7780
7594
  track.channelCount = soundType + 1;
7781
7595
  }
7782
- switch (format2) {
7783
- case FlvSoundFormat.G711A:
7784
- case FlvSoundFormat.G711M:
7785
- this._parseG711(data2, pts, format2);
7786
- break;
7787
- case FlvSoundFormat.AAC:
7788
- this._parseAac(data2, pts);
7789
- break;
7790
- case FlvSoundFormat.OPUS:
7791
- this._parseOpus(data2, pts);
7792
- break;
7793
- }
7794
- }
7795
- }, {
7796
- key: "_parseOpus",
7797
- value: function _parseOpus(data2, pts) {
7798
- var track = this.audioTrack;
7799
- var packetType = data2[1];
7800
- track.codecType = AudioCodecType$2.OPUS;
7801
- switch (packetType) {
7802
- case 0: {
7803
- var ret = OPUS.parseHeaderPackets(data2.subarray(2));
7804
- if (ret) {
7805
- track.codec = ret.codec;
7806
- track.channelCount = ret.channelCount;
7807
- track.sampleRate = ret.sampleRate;
7808
- track.config = ret.config;
7809
- track.sampleDuration = OPUS.getFrameDuration([], track.timescale);
7810
- } else {
7811
- track.reset();
7812
- logger$9.warn("Cannot parse AudioSpecificConfig", data2);
7813
- }
7814
- break;
7815
- }
7816
- case 1: {
7817
- if (pts === void 0 || pts === null)
7818
- return;
7819
- var newSample = new AudioSample$2(pts, data2.subarray(2), track.sampleDuration);
7820
- track.samples.push(newSample);
7821
- break;
7822
- }
7823
- default:
7824
- logger$9.warn("Unknown OpusPacketType: ".concat(packetType));
7596
+ if (format2 === 10) {
7597
+ this._parseAac(data2, pts);
7598
+ } else {
7599
+ this._parseG711(data2, pts, format2);
7825
7600
  }
7826
7601
  }
7827
7602
  }, {
@@ -7909,13 +7684,8 @@ var FlvDemuxer = /* @__PURE__ */ function() {
7909
7684
  units = this._checkAddMetaNalToUnits(isHevc, units, track);
7910
7685
  if (units && units.length) {
7911
7686
  var sample = new VideoSample$2(dts + cts, dts, units);
7912
- if (this.seamlessLoadingSwitching && dts < track.lastKeyFrameDts) {
7913
- return;
7914
- }
7915
- this.seamlessLoadingSwitching = false;
7916
7687
  if (frameType === 1) {
7917
7688
  sample.setToKeyframe();
7918
- track.lastKeyFrameDts = dts;
7919
7689
  }
7920
7690
  track.samples.push(sample);
7921
7691
  units.forEach(function(unit) {
@@ -8389,16 +8159,10 @@ var MP4$4 = /* @__PURE__ */ function() {
8389
8159
  if (track.useEME && track.enca) {
8390
8160
  content = MP42.enca(track);
8391
8161
  } else {
8392
- if (track.codecType === AudioCodecType$2.OPUS) {
8393
- content = MP42.opus(track);
8394
- } else {
8395
- content = MP42.mp4a(track);
8396
- }
8162
+ content = MP42.mp4a(track);
8397
8163
  }
8398
8164
  } else if (track.useEME && track.encv) {
8399
8165
  content = MP42.encv(track);
8400
- } else if (track.av1C) {
8401
- content = MP42.av01(track);
8402
8166
  } else {
8403
8167
  content = MP42.avc1hev1(track);
8404
8168
  }
@@ -8611,90 +8375,6 @@ var MP4$4 = /* @__PURE__ */ function() {
8611
8375
  var schi = MP42.schi(data2);
8612
8376
  return MP42.box(MP42.types.sinf, content, MP42.box(MP42.types.frma, frma), MP42.box(MP42.types.schm, schm), schi);
8613
8377
  }
8614
- }, {
8615
- key: "av01",
8616
- value: function av01(track) {
8617
- return MP42.box(MP42.types.av01, new Uint8Array([
8618
- 0,
8619
- 0,
8620
- 0,
8621
- 0,
8622
- 0,
8623
- 0,
8624
- 0,
8625
- 1,
8626
- 0,
8627
- 0,
8628
- 0,
8629
- 0,
8630
- 0,
8631
- 0,
8632
- 0,
8633
- 0,
8634
- 0,
8635
- 0,
8636
- 0,
8637
- 0,
8638
- 0,
8639
- 0,
8640
- 0,
8641
- 0,
8642
- track.width >> 8 & 255,
8643
- track.width & 255,
8644
- track.height >> 8 & 255,
8645
- track.height & 255,
8646
- 0,
8647
- 72,
8648
- 0,
8649
- 0,
8650
- 0,
8651
- 72,
8652
- 0,
8653
- 0,
8654
- 0,
8655
- 0,
8656
- 0,
8657
- 0,
8658
- 0,
8659
- 1,
8660
- 0,
8661
- 0,
8662
- 0,
8663
- 0,
8664
- 0,
8665
- 0,
8666
- 0,
8667
- 0,
8668
- 0,
8669
- 0,
8670
- 0,
8671
- 0,
8672
- 0,
8673
- 0,
8674
- 0,
8675
- 0,
8676
- 0,
8677
- 0,
8678
- 0,
8679
- 0,
8680
- 0,
8681
- 0,
8682
- 0,
8683
- 0,
8684
- 0,
8685
- 0,
8686
- 0,
8687
- 0,
8688
- 0,
8689
- 0,
8690
- 0,
8691
- 0,
8692
- 0,
8693
- 24,
8694
- 17,
8695
- 17
8696
- ]), track.av1C, track.colr);
8697
- }
8698
8378
  }, {
8699
8379
  key: "avc1hev1",
8700
8380
  value: function avc1hev1(track) {
@@ -9065,53 +8745,6 @@ var MP4$4 = /* @__PURE__ */ function() {
9065
8745
  )));
9066
8746
  return esds2;
9067
8747
  }
9068
- }, {
9069
- key: "opus",
9070
- value: function opus(track) {
9071
- var opusAudioDescription = new Uint8Array([
9072
- 0,
9073
- 0,
9074
- 0,
9075
- 0,
9076
- 0,
9077
- 0,
9078
- 0,
9079
- 1,
9080
- 0,
9081
- 0,
9082
- 0,
9083
- 0,
9084
- 0,
9085
- 0,
9086
- 0,
9087
- 0,
9088
- 0,
9089
- track.channelCount,
9090
- 0,
9091
- 16,
9092
- 0,
9093
- 0,
9094
- 0,
9095
- 0,
9096
- track.sampleRate >> 8 & 255,
9097
- track.sampleRate & 255,
9098
- 0,
9099
- 0
9100
- ]);
9101
- var opusSpecificConfig = track.config.length ? MP42.dOps(track) : [];
9102
- return MP42.box(MP42.types.Opus, opusAudioDescription, opusSpecificConfig);
9103
- }
9104
- }, {
9105
- key: "dOps",
9106
- value: function dOps(track) {
9107
- if (track.config) {
9108
- track.config[4] = track.sampleRate >>> 24 & 255;
9109
- track.config[5] = track.sampleRate >>> 16 & 255;
9110
- track.config[6] = track.sampleRate >>> 8 & 255;
9111
- track.config[7] = track.sampleRate & 255;
9112
- return MP42.box(MP42.types.dOps, track.config);
9113
- }
9114
- }
9115
8748
  }, {
9116
8749
  key: "mvex",
9117
8750
  value: function mvex(tracks) {
@@ -9714,7 +9347,7 @@ var MP4$4 = /* @__PURE__ */ function() {
9714
9347
  }]);
9715
9348
  return MP42;
9716
9349
  }();
9717
- _defineProperty$e(MP4$4, "types", ["Opus", "dOps", "av01", "av1C", "avc1", "avcC", "hvc1", "hvcC", "dinf", "dref", "esds", "ftyp", "hdlr", "mdat", "mdhd", "mdia", "mfhd", "minf", "moof", "moov", "mp4a", "mvex", "mvhd", "pasp", "stbl", "stco", "stsc", "stsd", "stsz", "stts", "tfdt", "tfhd", "traf", "trak", "trex", "tkhd", "vmhd", "smhd", "ctts", "stss", "styp", "pssh", "sidx", "sbgp", "saiz", "saio", "senc", "trun", "encv", "enca", "sinf", "btrt", "frma", "tenc", "schm", "schi", "mehd", "fiel", "sdtp"].reduce(function(p, c) {
9350
+ _defineProperty$e(MP4$4, "types", ["avc1", "avcC", "hvc1", "hvcC", "dinf", "dref", "esds", "ftyp", "hdlr", "mdat", "mdhd", "mdia", "mfhd", "minf", "moof", "moov", "mp4a", "mvex", "mvhd", "pasp", "stbl", "stco", "stsc", "stsd", "stsz", "stts", "tfdt", "tfhd", "traf", "trak", "trex", "tkhd", "vmhd", "smhd", "ctts", "stss", "styp", "pssh", "sidx", "sbgp", "saiz", "saio", "senc", "trun", "encv", "enca", "sinf", "btrt", "frma", "tenc", "schm", "schi", "mehd", "fiel", "sdtp"].reduce(function(p, c) {
9718
9351
  p[c] = [c.charCodeAt(0), c.charCodeAt(1), c.charCodeAt(2), c.charCodeAt(3)];
9719
9352
  return p;
9720
9353
  }, /* @__PURE__ */ Object.create(null)));
@@ -10049,46 +9682,30 @@ var FMP4Remuxer$3 = /* @__PURE__ */ function() {
10049
9682
  };
10050
9683
  }
10051
9684
  var samples = track.samples;
10052
- var isAV01 = /av01/.test(track.codec);
10053
9685
  var mdatSize = 0;
10054
- if (isAV01) {
10055
- samples.forEach(function(s) {
10056
- mdatSize += s.data.byteLength;
10057
- });
10058
- } else {
10059
- samples.forEach(function(s) {
10060
- mdatSize += s.units.reduce(function(t, c) {
10061
- return t + c.byteLength;
10062
- }, 0);
10063
- mdatSize += s.units.length * 4;
10064
- });
10065
- }
9686
+ samples.forEach(function(s) {
9687
+ mdatSize += s.units.reduce(function(t, c) {
9688
+ return t + c.byteLength;
9689
+ }, 0);
9690
+ mdatSize += s.units.length * 4;
9691
+ });
10066
9692
  var mdata = new Uint8Array(mdatSize);
10067
- if (isAV01) {
10068
- for (var i = 0, l = samples.length, offset = 0, sample; i < l; i++) {
10069
- sample = samples[i];
10070
- mdata.set(sample.data, offset);
10071
- sample.size = sample.data.byteLength;
10072
- offset += sample.size;
10073
- }
10074
- } else {
10075
- var mdatView = new DataView(mdata.buffer);
10076
- var _loop = function _loop2(_offset2, _sample2) {
10077
- _sample2 = samples[_i];
10078
- var sampleSize = 0;
10079
- _sample2.units.forEach(function(u) {
10080
- mdatView.setUint32(_offset2, u.byteLength);
10081
- _offset2 += 4;
10082
- mdata.set(u, _offset2);
10083
- _offset2 += u.byteLength;
10084
- sampleSize += 4 + u.byteLength;
10085
- });
10086
- _sample2.size = sampleSize;
10087
- _offset = _offset2, _sample = _sample2;
10088
- };
10089
- for (var _i = 0, _l = samples.length, _offset = 0, _sample; _i < _l; _i++) {
10090
- _loop(_offset, _sample);
10091
- }
9693
+ var mdatView = new DataView(mdata.buffer);
9694
+ var _loop = function _loop2(_offset, _sample) {
9695
+ _sample = samples[i];
9696
+ var sampleSize = 0;
9697
+ _sample.units.forEach(function(u) {
9698
+ mdatView.setUint32(_offset, u.byteLength);
9699
+ _offset += 4;
9700
+ mdata.set(u, _offset);
9701
+ _offset += u.byteLength;
9702
+ sampleSize += 4 + u.byteLength;
9703
+ });
9704
+ _sample.size = sampleSize;
9705
+ offset = _offset, sample = _sample;
9706
+ };
9707
+ for (var i = 0, l = samples.length, offset = 0, sample; i < l; i++) {
9708
+ _loop(offset, sample);
10092
9709
  }
10093
9710
  var mdat = MP4$4.mdat(mdata);
10094
9711
  var moof = MP4$4.moof([track]);
@@ -11785,55 +11402,6 @@ const NoPadding = {
11785
11402
  unpad() {
11786
11403
  }
11787
11404
  };
11788
- var TransferCost = /* @__PURE__ */ function() {
11789
- function TransferCost2() {
11790
- _classCallCheck$j(this, TransferCost2);
11791
- _defineProperty$h(this, "_ttfb", 0);
11792
- _defineProperty$h(this, "_demuxStart", 0);
11793
- _defineProperty$h(this, "_demuxEnd", 0);
11794
- _defineProperty$h(this, "_demuxCost", 0);
11795
- _defineProperty$h(this, "_remuxStart", 0);
11796
- _defineProperty$h(this, "_remuxEnd", 0);
11797
- _defineProperty$h(this, "_remuxCost", 0);
11798
- _defineProperty$h(this, "_appendStart", 0);
11799
- _defineProperty$h(this, "_appendEnd", 0);
11800
- _defineProperty$h(this, "_appendCost", 0);
11801
- }
11802
- _createClass$j(TransferCost2, [{
11803
- key: "set",
11804
- value: function set5(event, value2) {
11805
- this["_".concat(event)] = value2;
11806
- }
11807
- }, {
11808
- key: "start",
11809
- value: function start(event) {
11810
- this["_".concat(event, "Start")] = Date.now();
11811
- }
11812
- }, {
11813
- key: "end",
11814
- value: function end(event) {
11815
- this["_".concat(event, "End")] = Date.now();
11816
- this["_".concat(event, "Cost")] = this["_".concat(event, "Cost")] + (this["_".concat(event, "End")] - this["_".concat(event, "Start")]);
11817
- }
11818
- }, {
11819
- key: "transferCost",
11820
- get: function get3() {
11821
- return {
11822
- ttfbCost: this._ttfb,
11823
- demuxCost: this._demuxCost,
11824
- remuxCost: this._remuxCost,
11825
- appendCost: this._appendCost
11826
- };
11827
- }
11828
- }]);
11829
- return TransferCost2;
11830
- }();
11831
- var TRANSFER_EVENT = {
11832
- TTFB: "ttfb",
11833
- DEMUX: "demux",
11834
- REMUX: "remux",
11835
- APPEND: "append"
11836
- };
11837
11405
  var logger$8 = new Logger$a("BufferService");
11838
11406
  var BufferService$1 = /* @__PURE__ */ function() {
11839
11407
  function BufferService2(flv, softVideo) {
@@ -11921,8 +11489,7 @@ var BufferService$1 = /* @__PURE__ */ function() {
11921
11489
  this._contiguous = false;
11922
11490
  this._sourceCreated = false;
11923
11491
  this._initSegmentId = "";
11924
- this.resetSeamlessSwitchStats();
11925
- case 12:
11492
+ case 11:
11926
11493
  case "end":
11927
11494
  return _context.stop();
11928
11495
  }
@@ -11933,15 +11500,6 @@ var BufferService$1 = /* @__PURE__ */ function() {
11933
11500
  }
11934
11501
  return reset;
11935
11502
  }()
11936
- }, {
11937
- key: "resetSeamlessSwitchStats",
11938
- value: function resetSeamlessSwitchStats() {
11939
- this.seamlessLoadingSwitch = null;
11940
- this.seamlessLoadingSwitching = false;
11941
- if (this._demuxer) {
11942
- this._demuxer.seamlessLoadingSwitching = false;
11943
- }
11944
- }
11945
11503
  }, {
11946
11504
  key: "endOfStream",
11947
11505
  value: function() {
@@ -12047,56 +11605,32 @@ var BufferService$1 = /* @__PURE__ */ function() {
12047
11605
  key: "appendBuffer",
12048
11606
  value: function() {
12049
11607
  var _appendBuffer = _asyncToGenerator$a(/* @__PURE__ */ _regeneratorRuntime$a().mark(function _callee5(chunk) {
12050
- var _this = this;
12051
- var switchingNoReset, demuxer, videoTrack, audioTrack, metadataTrack, idx, videoExist, audioExist, duration, track, videoType, audioType, mse, afterAppend, newId, remuxResult, p;
11608
+ var demuxer, videoTrack, audioTrack, metadataTrack, videoExist, audioExist, duration, track, videoType, audioType, mse, newId, remuxResult, p;
12052
11609
  return _regeneratorRuntime$a().wrap(function _callee5$(_context5) {
12053
11610
  while (1)
12054
11611
  switch (_context5.prev = _context5.next) {
12055
11612
  case 0:
12056
- switchingNoReset = false;
12057
11613
  if (this._cachedBuffer) {
12058
11614
  chunk = concatUint8Array$6(this._cachedBuffer, chunk);
12059
11615
  this._cachedBuffer = null;
12060
11616
  }
12061
11617
  demuxer = this._demuxer;
12062
11618
  if (!(!chunk || !chunk.length || !demuxer)) {
12063
- _context5.next = 5;
11619
+ _context5.next = 4;
12064
11620
  break;
12065
11621
  }
12066
11622
  return _context5.abrupt("return");
12067
- case 5:
12068
- _context5.prev = 5;
12069
- this.flv._transferCost.start(TRANSFER_EVENT.DEMUX);
12070
- demuxer.demuxAndFix(chunk, this.seamlessLoadingSwitching || this._discontinuity, this._contiguous, this._demuxStartTime, this.seamlessLoadingSwitching);
12071
- this.seamlessLoadingSwitching = false;
12072
- this.flv._transferCost.end(TRANSFER_EVENT.DEMUX);
12073
- _context5.next = 15;
11623
+ case 4:
11624
+ _context5.prev = 4;
11625
+ demuxer.demuxAndFix(chunk, this._discontinuity, this._contiguous, this._demuxStartTime);
11626
+ _context5.next = 11;
12074
11627
  break;
12075
- case 12:
12076
- _context5.prev = 12;
12077
- _context5.t0 = _context5["catch"](5);
11628
+ case 8:
11629
+ _context5.prev = 8;
11630
+ _context5.t0 = _context5["catch"](4);
12078
11631
  throw new StreamingError$3(ERR$3.DEMUX, ERR$3.SUB_TYPES.FLV, _context5.t0);
12079
- case 15:
11632
+ case 11:
12080
11633
  videoTrack = demuxer.videoTrack, audioTrack = demuxer.audioTrack, metadataTrack = demuxer.metadataTrack;
12081
- if (!this.seamlessLoadingSwitch) {
12082
- _context5.next = 25;
12083
- break;
12084
- }
12085
- idx = videoTrack.samples.findIndex(function(sample) {
12086
- return sample.originDts === videoTrack.lastKeyFrameDts;
12087
- });
12088
- if (!(idx >= 0)) {
12089
- _context5.next = 25;
12090
- break;
12091
- }
12092
- videoTrack.samples.splice(idx);
12093
- _context5.next = 22;
12094
- return this.seamlessLoadingSwitch();
12095
- case 22:
12096
- this.seamlessLoadingSwitch = null;
12097
- chunk = null;
12098
- switchingNoReset = true;
12099
- case 25:
12100
11634
  videoExist = videoTrack.exist();
12101
11635
  audioExist = audioTrack.exist();
12102
11636
  if (this._opts.onlyAudio) {
@@ -12108,7 +11642,7 @@ var BufferService$1 = /* @__PURE__ */ function() {
12108
11642
  audioTrack.present = false;
12109
11643
  }
12110
11644
  if (!(!videoExist && videoTrack.present || !audioExist && audioTrack.present)) {
12111
- _context5.next = 42;
11645
+ _context5.next = 29;
12112
11646
  break;
12113
11647
  }
12114
11648
  duration = 0;
@@ -12117,7 +11651,7 @@ var BufferService$1 = /* @__PURE__ */ function() {
12117
11651
  duration = (track.samples[track.samples.length - 1].originPts - track.samples[0].originPts) / track.timescale * 1e3;
12118
11652
  }
12119
11653
  if (!(duration > this._opts.analyzeDuration)) {
12120
- _context5.next = 40;
11654
+ _context5.next = 27;
12121
11655
  break;
12122
11656
  }
12123
11657
  logger$8.warn("analyze duration exceeded, ".concat(duration, "ms"), track);
@@ -12126,28 +11660,19 @@ var BufferService$1 = /* @__PURE__ */ function() {
12126
11660
  this.flv.emit(EVENT$3.ANALYZE_DURATION_EXCEEDED, {
12127
11661
  duration
12128
11662
  });
12129
- _context5.next = 42;
11663
+ _context5.next = 29;
12130
11664
  break;
12131
- case 40:
11665
+ case 27:
12132
11666
  this._cachedBuffer = chunk;
12133
11667
  return _context5.abrupt("return");
12134
- case 42:
11668
+ case 29:
12135
11669
  videoType = videoTrack.type;
12136
11670
  audioType = audioTrack.type;
12137
11671
  this._fireEvents(videoTrack, audioTrack, metadataTrack);
12138
- if (!switchingNoReset) {
12139
- this._discontinuity = false;
12140
- this._contiguous = true;
12141
- this._demuxStartTime = 0;
12142
- }
11672
+ this._discontinuity = false;
11673
+ this._contiguous = true;
11674
+ this._demuxStartTime = 0;
12143
11675
  mse = this._mse;
12144
- afterAppend = function afterAppend2() {
12145
- var _this$flv;
12146
- if ((_this$flv = _this.flv) !== null && _this$flv !== void 0 && _this$flv.emit) {
12147
- var _this$flv2;
12148
- (_this$flv2 = _this.flv) === null || _this$flv2 === void 0 ? void 0 : _this$flv2.emit(EVENT$3.APPEND_BUFFER, {});
12149
- }
12150
- };
12151
11676
  this.flv.emit(EVENT$3.DEMUXED_TRACK, {
12152
11677
  videoTrack
12153
11678
  });
@@ -12158,16 +11683,16 @@ var BufferService$1 = /* @__PURE__ */ function() {
12158
11683
  this._emitMetaParsedEvent(videoTrack, audioTrack);
12159
11684
  }
12160
11685
  if (!mse) {
12161
- _context5.next = 81;
11686
+ _context5.next = 66;
12162
11687
  break;
12163
11688
  }
12164
11689
  if (this._sourceCreated) {
12165
- _context5.next = 59;
11690
+ _context5.next = 47;
12166
11691
  break;
12167
11692
  }
12168
- _context5.next = 55;
11693
+ _context5.next = 43;
12169
11694
  return mse.open();
12170
- case 55:
11695
+ case 43:
12171
11696
  if (videoExist) {
12172
11697
  logger$8.log("codec: video/mp4;codecs=".concat(videoTrack.codec));
12173
11698
  mse.createSource(videoType, "video/mp4;codecs=".concat(videoTrack.codec));
@@ -12178,28 +11703,26 @@ var BufferService$1 = /* @__PURE__ */ function() {
12178
11703
  }
12179
11704
  this._sourceCreated = true;
12180
11705
  this.flv.emit(EVENT$3.SOURCEBUFFER_CREATED);
12181
- case 59:
12182
- _context5.prev = 59;
11706
+ case 47:
11707
+ _context5.prev = 47;
12183
11708
  if (this._needInitSegment && !this._opts.mseLowLatency) {
12184
11709
  videoTrack.duration = this._opts.durationForMSELowLatencyOff * videoTrack.timescale;
12185
11710
  audioTrack.duration = this._opts.durationForMSELowLatencyOff * audioExist.timescale;
12186
11711
  }
12187
- this.flv._transferCost.start(TRANSFER_EVENT.REMUX);
12188
11712
  remuxResult = this._remuxer.remux(this._needInitSegment);
12189
- this.flv._transferCost.end(TRANSFER_EVENT.REMUX);
12190
- _context5.next = 69;
11713
+ _context5.next = 55;
12191
11714
  break;
12192
- case 66:
12193
- _context5.prev = 66;
12194
- _context5.t1 = _context5["catch"](59);
11715
+ case 52:
11716
+ _context5.prev = 52;
11717
+ _context5.t1 = _context5["catch"](47);
12195
11718
  throw new StreamingError$3(ERR$3.REMUX, ERR$3.SUB_TYPES.FMP4, _context5.t1);
12196
- case 69:
11719
+ case 55:
12197
11720
  if (!(this._needInitSegment && !remuxResult.videoInitSegment && !remuxResult.audioInitSegment)) {
12198
- _context5.next = 71;
11721
+ _context5.next = 57;
12199
11722
  break;
12200
11723
  }
12201
11724
  return _context5.abrupt("return");
12202
- case 71:
11725
+ case 57:
12203
11726
  this._needInitSegment = false;
12204
11727
  p = [];
12205
11728
  if (remuxResult.videoInitSegment)
@@ -12210,21 +11733,16 @@ var BufferService$1 = /* @__PURE__ */ function() {
12210
11733
  p.push(mse.append(videoType, remuxResult.videoSegment));
12211
11734
  if (remuxResult.audioSegment)
12212
11735
  p.push(mse.append(audioType, remuxResult.audioSegment));
12213
- this.flv._transferCost.start(TRANSFER_EVENT.APPEND);
12214
- return _context5.abrupt("return", Promise.all(p).then(afterAppend).then(function() {
12215
- _this.flv._transferCost.end(TRANSFER_EVENT.APPEND);
12216
- afterAppend();
12217
- }));
12218
- case 81:
11736
+ return _context5.abrupt("return", Promise.all(p));
11737
+ case 66:
12219
11738
  if (this._softVideo) {
12220
11739
  this._softVideo.appendBuffer(videoTrack, audioTrack);
12221
- afterAppend();
12222
11740
  }
12223
- case 82:
11741
+ case 67:
12224
11742
  case "end":
12225
11743
  return _context5.stop();
12226
11744
  }
12227
- }, _callee5, this, [[5, 12], [59, 66]]);
11745
+ }, _callee5, this, [[4, 8], [47, 52]]);
12228
11746
  }));
12229
11747
  function appendBuffer(_x2) {
12230
11748
  return _appendBuffer.apply(this, arguments);
@@ -12235,7 +11753,7 @@ var BufferService$1 = /* @__PURE__ */ function() {
12235
11753
  key: "evictBuffer",
12236
11754
  value: function() {
12237
11755
  var _evictBuffer = _asyncToGenerator$a(/* @__PURE__ */ _regeneratorRuntime$a().mark(function _callee6(bufferBehind) {
12238
- var _this2 = this;
11756
+ var _this = this;
12239
11757
  var media, currentTime, removeEnd, start;
12240
11758
  return _regeneratorRuntime$a().wrap(function _callee6$(_context6) {
12241
11759
  while (1)
@@ -12264,7 +11782,7 @@ var BufferService$1 = /* @__PURE__ */ function() {
12264
11782
  return _context6.abrupt("return");
12265
11783
  case 10:
12266
11784
  return _context6.abrupt("return", this._mse.clearBuffer(0, removeEnd).then(function() {
12267
- return _this2.flv.emit(EVENT$3.REMOVE_BUFFER, {
11785
+ return _this.flv.emit(EVENT$3.REMOVE_BUFFER, {
12268
11786
  removeEnd
12269
11787
  });
12270
11788
  }));
@@ -12314,16 +11832,16 @@ var BufferService$1 = /* @__PURE__ */ function() {
12314
11832
  }, {
12315
11833
  key: "_fireEvents",
12316
11834
  value: function _fireEvents(videoTrack, audioTrack, metadataTrack) {
12317
- var _this3 = this;
12318
- logger$8.debug("videoTrack samples count: ".concat(videoTrack.samples.length, ", audioTrack samples count: ").concat(audioTrack.samples.length));
11835
+ var _this2 = this;
11836
+ logger$8.debug(videoTrack.samples, audioTrack.samples);
12319
11837
  metadataTrack.flvScriptSamples.forEach(function(sample) {
12320
- _this3.flv.emit(EVENT$3.FLV_SCRIPT_DATA, sample);
11838
+ _this2.flv.emit(EVENT$3.FLV_SCRIPT_DATA, sample);
12321
11839
  logger$8.debug("flvScriptData", sample);
12322
11840
  });
12323
11841
  videoTrack.samples.forEach(function(sample) {
12324
11842
  if (sample.keyframe) {
12325
- _this3.flv.emit(EVENT$3.KEYFRAME, {
12326
- pts: sample.originPts
11843
+ _this2.flv.emit(EVENT$3.KEYFRAME, {
11844
+ pts: sample.pts
12327
11845
  });
12328
11846
  }
12329
11847
  });
@@ -12341,7 +11859,7 @@ var BufferService$1 = /* @__PURE__ */ function() {
12341
11859
  break;
12342
11860
  }
12343
11861
  if (type)
12344
- _this3.flv.emit(EVENT$3.STREAM_EXCEPTION, _objectSpread2$a(_objectSpread2$a({}, warn), {}, {
11862
+ _this2.flv.emit(EVENT$3.STREAM_EXCEPTION, _objectSpread2$a(_objectSpread2$a({}, warn), {}, {
12345
11863
  type
12346
11864
  }));
12347
11865
  logger$8.warn("video exception", warn);
@@ -12360,13 +11878,13 @@ var BufferService$1 = /* @__PURE__ */ function() {
12360
11878
  break;
12361
11879
  }
12362
11880
  if (type)
12363
- _this3.flv.emit(EVENT$3.STREAM_EXCEPTION, _objectSpread2$a(_objectSpread2$a({}, warn), {}, {
11881
+ _this2.flv.emit(EVENT$3.STREAM_EXCEPTION, _objectSpread2$a(_objectSpread2$a({}, warn), {}, {
12364
11882
  type
12365
11883
  }));
12366
11884
  logger$8.warn("audio exception", warn);
12367
11885
  });
12368
11886
  metadataTrack.seiSamples.forEach(function(sei) {
12369
- _this3.flv.emit(EVENT$3.SEI, _objectSpread2$a(_objectSpread2$a({}, sei), {}, {
11887
+ _this2.flv.emit(EVENT$3.SEI, _objectSpread2$a(_objectSpread2$a({}, sei), {}, {
12370
11888
  sei: {
12371
11889
  code: sei.data.type,
12372
11890
  content: sei.data.payload,
@@ -12401,8 +11919,7 @@ function getOption$1(opts) {
12401
11919
  durationForMSELowLatencyOff: 6,
12402
11920
  chunkCountForSpeed: 50,
12403
11921
  skipChunkSize: 1e3,
12404
- longtimeNoReceived: 3e3,
12405
- enableStartGapJump: true
11922
+ longtimeNoReceived: 3e3
12406
11923
  }, opts);
12407
11924
  if (ret.isLive) {
12408
11925
  if (ret.preloadTime) {
@@ -12470,7 +11987,7 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
12470
11987
  _defineProperty$h(_assertThisInitialized$f(_this), "_acceptRanges", true);
12471
11988
  _defineProperty$h(_assertThisInitialized$f(_this), "_onProgress", /* @__PURE__ */ function() {
12472
11989
  var _ref2 = _asyncToGenerator$a(/* @__PURE__ */ _regeneratorRuntime$a().mark(function _callee(chunk, done, _ref, response) {
12473
- var startTime, endTime, st, firstByteTime, _this$_mediaLoader, headers, elapsed, _this$_bufferService, remaining, maxReaderInterval;
11990
+ var startTime, endTime, st, firstByteTime, _this$_mediaLoader, headers, _this$_bufferService, remaining, maxReaderInterval;
12474
11991
  return _regeneratorRuntime$a().wrap(function _callee$(_context) {
12475
11992
  while (1)
12476
11993
  switch (_context.prev = _context.next) {
@@ -12478,7 +11995,7 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
12478
11995
  startTime = _ref.startTime, endTime = _ref.endTime, st = _ref.st, firstByteTime = _ref.firstByteTime;
12479
11996
  _this._loading = !done;
12480
11997
  if (_this._firstProgressEmit) {
12481
- _context.next = 13;
11998
+ _context.next = 11;
12482
11999
  break;
12483
12000
  }
12484
12001
  if (_this.media) {
@@ -12489,51 +12006,49 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
12489
12006
  return _context.abrupt("return");
12490
12007
  case 6:
12491
12008
  headers = response.headers;
12492
- elapsed = st ? firstByteTime - st : endTime - startTime;
12493
12009
  _this.emit(EVENT$3.TTFB, {
12494
12010
  url: _this._opts.url,
12495
12011
  responseUrl: response.url,
12496
- elapsed
12012
+ elapsed: st ? firstByteTime - st : endTime - startTime
12497
12013
  });
12498
12014
  _this.emit(EVENT$3.LOAD_RESPONSE_HEADERS, {
12499
12015
  headers
12500
12016
  });
12501
- _this._transferCost.set(TRANSFER_EVENT.TTFB, elapsed);
12502
12017
  _this._acceptRanges = !!(headers !== null && headers !== void 0 && headers.get("Accept-Ranges")) || !!(headers !== null && headers !== void 0 && headers.get("Content-Range"));
12503
12018
  _this._firstProgressEmit = true;
12504
- case 13:
12019
+ case 11:
12505
12020
  if (_this._bufferService) {
12506
- _context.next = 15;
12021
+ _context.next = 13;
12507
12022
  break;
12508
12023
  }
12509
12024
  return _context.abrupt("return");
12510
- case 15:
12025
+ case 13:
12511
12026
  clearTimeout(_this._maxChunkWaitTimer);
12512
12027
  _this._bandwidthService.addChunkRecord(chunk === null || chunk === void 0 ? void 0 : chunk.byteLength, endTime - startTime);
12513
- _context.prev = 17;
12514
- _context.next = 20;
12028
+ _context.prev = 15;
12029
+ _context.next = 18;
12515
12030
  return _this._bufferService.appendBuffer(chunk);
12516
- case 20:
12031
+ case 18:
12517
12032
  (_this$_bufferService = _this._bufferService) === null || _this$_bufferService === void 0 ? void 0 : _this$_bufferService.evictBuffer(_this._opts.bufferBehind);
12518
- _context.next = 33;
12033
+ _context.next = 31;
12519
12034
  break;
12520
- case 23:
12521
- _context.prev = 23;
12522
- _context.t0 = _context["catch"](17);
12035
+ case 21:
12036
+ _context.prev = 21;
12037
+ _context.t0 = _context["catch"](15);
12523
12038
  if (!(!_this.isLive && _this._bufferService.isFull())) {
12524
- _context.next = 32;
12039
+ _context.next = 30;
12525
12040
  break;
12526
12041
  }
12527
- _context.next = 28;
12042
+ _context.next = 26;
12528
12043
  return _this._mediaLoader.cancel();
12529
- case 28:
12044
+ case 26:
12530
12045
  _this._loading = false;
12531
12046
  remaining = _this.bufferInfo().remaining;
12532
12047
  _this._opts.preloadTime = parseInt(remaining) / 2;
12533
12048
  return _context.abrupt("return");
12534
- case 32:
12049
+ case 30:
12535
12050
  return _context.abrupt("return", _this._emitError(StreamingError$3.create(_context.t0)));
12536
- case 33:
12051
+ case 31:
12537
12052
  if (_this._urlSwitching) {
12538
12053
  _this._urlSwitching = false;
12539
12054
  _this.emit(EVENT$3.SWITCH_URL_SUCCESS, {
@@ -12545,7 +12060,7 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
12545
12060
  _this._tick();
12546
12061
  }
12547
12062
  if (!(done && !_this.media.seeking)) {
12548
- _context.next = 40;
12063
+ _context.next = 38;
12549
12064
  break;
12550
12065
  }
12551
12066
  _this.emit(EVENT$3.LOAD_COMPLETE);
@@ -12554,13 +12069,13 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
12554
12069
  _this._end();
12555
12070
  }
12556
12071
  return _context.abrupt("return");
12557
- case 40:
12072
+ case 38:
12558
12073
  if (_this.isLive) {
12559
- _context.next = 42;
12074
+ _context.next = 40;
12560
12075
  break;
12561
12076
  }
12562
12077
  return _context.abrupt("return");
12563
- case 42:
12078
+ case 40:
12564
12079
  maxReaderInterval = _this._opts.maxReaderInterval;
12565
12080
  if (maxReaderInterval && _this._firstProgressEmit) {
12566
12081
  clearTimeout(_this._maxChunkWaitTimer);
@@ -12574,11 +12089,11 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
12574
12089
  _this._end();
12575
12090
  }, maxReaderInterval);
12576
12091
  }
12577
- case 44:
12092
+ case 42:
12578
12093
  case "end":
12579
12094
  return _context.stop();
12580
12095
  }
12581
- }, _callee, null, [[17, 23]]);
12096
+ }, _callee, null, [[15, 21]]);
12582
12097
  }));
12583
12098
  return function(_x, _x2, _x3, _x4) {
12584
12099
  return _ref2.apply(this, arguments);
@@ -12611,19 +12126,19 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
12611
12126
  if (bufferEnd < MAX_HOLE || !media.readyState)
12612
12127
  return;
12613
12128
  var opts = _this._opts;
12614
- if (isMediaPlaying$1(media) && media.currentTime) {
12129
+ if (isMediaPlaying$1(media)) {
12615
12130
  if (_this._gapService) {
12616
12131
  _this._gapService.do(media, opts.maxJumpDistance, _this.isLive, 3);
12617
12132
  }
12618
12133
  } else {
12619
- if (!media.currentTime && _this._gapService && opts.enableStartGapJump) {
12134
+ if (!media.currentTime && _this._gapService) {
12620
12135
  var gapJump = _this._opts.mseLowLatency || _this._opts.mseLowLatency === false && _this.bufferInfo(MAX_START_GAP).nextStart;
12621
12136
  if (gapJump) {
12622
12137
  _this._gapService.do(media, opts.maxJumpDistance, _this.isLive, 3);
12623
12138
  }
12624
12139
  return;
12625
12140
  }
12626
- if (opts.isLive && media.readyState === 4 && bufferEnd - media.currentTime > opts.disconnectTime) {
12141
+ if (opts.isLive && media.readyState === 4 && bufferEnd > opts.disconnectTime) {
12627
12142
  _this.disconnect();
12628
12143
  }
12629
12144
  }
@@ -12772,7 +12287,6 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
12772
12287
  responseType: "arraybuffer"
12773
12288
  }));
12774
12289
  _this._disconnectRetryCount = _this._opts.disconnectRetryCount;
12775
- _this._transferCost = new TransferCost();
12776
12290
  _this._bufferService = new BufferService$1(_assertThisInitialized$f(_this), _this._opts.softDecode ? _this.media : void 0, _this._opts);
12777
12291
  _this._seiService = new SeiService$1(_assertThisInitialized$f(_this));
12778
12292
  _this._bandwidthService = new BandwidthService$1({
@@ -12796,7 +12310,7 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
12796
12310
  _createClass$j(Flv2, [{
12797
12311
  key: "version",
12798
12312
  get: function get3() {
12799
- return "3.0.20-rc.6";
12313
+ return "3.0.19-rc.0";
12800
12314
  }
12801
12315
  }, {
12802
12316
  key: "isLive",
@@ -12912,9 +12426,9 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
12912
12426
  return this._clear();
12913
12427
  case 8:
12914
12428
  setTimeout(function() {
12915
- _this2._seamlessSwitching = true;
12916
12429
  _this2._loadData(_this2._opts.url);
12917
12430
  _this2._bufferService.seamlessSwitch();
12431
+ _this2._seamlessSwitching = true;
12918
12432
  });
12919
12433
  _context5.next = 13;
12920
12434
  break;
@@ -12938,82 +12452,50 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
12938
12452
  }, {
12939
12453
  key: "disconnect",
12940
12454
  value: function disconnect() {
12941
- var _this$_bufferService4;
12942
12455
  logger$7.debug("disconnect!");
12943
- (_this$_bufferService4 = this._bufferService) === null || _this$_bufferService4 === void 0 ? void 0 : _this$_bufferService4.resetSeamlessSwitchStats();
12944
12456
  return this._clear();
12945
12457
  }
12946
12458
  }, {
12947
12459
  key: "switchURL",
12948
12460
  value: function() {
12949
- var _switchURL = _asyncToGenerator$a(/* @__PURE__ */ _regeneratorRuntime$a().mark(function _callee7(url, seamless) {
12461
+ var _switchURL = _asyncToGenerator$a(/* @__PURE__ */ _regeneratorRuntime$a().mark(function _callee6(url, seamless) {
12950
12462
  var _this3 = this;
12951
- return _regeneratorRuntime$a().wrap(function _callee7$(_context7) {
12463
+ return _regeneratorRuntime$a().wrap(function _callee6$(_context6) {
12952
12464
  while (1)
12953
- switch (_context7.prev = _context7.next) {
12465
+ switch (_context6.prev = _context6.next) {
12954
12466
  case 0:
12955
12467
  if (this._bufferService) {
12956
- _context7.next = 2;
12468
+ _context6.next = 2;
12957
12469
  break;
12958
12470
  }
12959
- return _context7.abrupt("return");
12471
+ return _context6.abrupt("return");
12960
12472
  case 2:
12961
12473
  this._resetDisconnectCount();
12962
- if (!(this._loading && seamless)) {
12963
- _context7.next = 6;
12964
- break;
12965
- }
12966
- this._bufferService.seamlessLoadingSwitch = /* @__PURE__ */ function() {
12967
- var _ref5 = _asyncToGenerator$a(/* @__PURE__ */ _regeneratorRuntime$a().mark(function _callee6(pts) {
12968
- return _regeneratorRuntime$a().wrap(function _callee6$(_context6) {
12969
- while (1)
12970
- switch (_context6.prev = _context6.next) {
12971
- case 0:
12972
- _context6.next = 2;
12973
- return _this3._clear();
12974
- case 2:
12975
- _this3._bufferService.seamlessLoadingSwitching = true;
12976
- _this3._urlSwitching = true;
12977
- _this3._seamlessSwitching = true;
12978
- _this3._bufferService.seamlessSwitch();
12979
- _this3._loadData(url);
12980
- case 7:
12981
- case "end":
12982
- return _context6.stop();
12983
- }
12984
- }, _callee6);
12985
- }));
12986
- return function(_x8) {
12987
- return _ref5.apply(this, arguments);
12988
- };
12989
- }();
12990
- return _context7.abrupt("return");
12991
- case 6:
12992
12474
  if (!(!seamless || !this._opts.isLive)) {
12993
- _context7.next = 11;
12475
+ _context6.next = 8;
12994
12476
  break;
12995
12477
  }
12996
- _context7.next = 9;
12478
+ _context6.next = 6;
12997
12479
  return this.load(url);
12998
- case 9:
12480
+ case 6:
12999
12481
  this._urlSwitching = true;
13000
- return _context7.abrupt("return", this.media.play(true).catch(function() {
12482
+ return _context6.abrupt("return", this.media.play(true).catch(function() {
13001
12483
  }));
13002
- case 11:
13003
- _context7.next = 13;
12484
+ case 8:
12485
+ _context6.next = 10;
13004
12486
  return this._clear();
13005
- case 13:
12487
+ case 10:
13006
12488
  setTimeout(function() {
13007
12489
  _this3._urlSwitching = true;
13008
12490
  _this3._seamlessSwitching = true;
13009
12491
  _this3._loadData(url);
13010
12492
  _this3._bufferService.seamlessSwitch();
13011
12493
  });
13012
- case 14:
12494
+ case 11:
13013
12495
  case "end":
13014
- return _context7.stop();
12496
+ return _context6.stop();
13015
12497
  }
13016
- }, _callee7, this);
12498
+ }, _callee6, this);
13017
12499
  }));
13018
12500
  function switchURL(_x6, _x7) {
13019
12501
  return _switchURL.apply(this, arguments);
@@ -13023,16 +12505,16 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
13023
12505
  }, {
13024
12506
  key: "destroy",
13025
12507
  value: function() {
13026
- var _destroy = _asyncToGenerator$a(/* @__PURE__ */ _regeneratorRuntime$a().mark(function _callee8() {
13027
- return _regeneratorRuntime$a().wrap(function _callee8$(_context8) {
12508
+ var _destroy = _asyncToGenerator$a(/* @__PURE__ */ _regeneratorRuntime$a().mark(function _callee7() {
12509
+ return _regeneratorRuntime$a().wrap(function _callee7$(_context7) {
13028
12510
  while (1)
13029
- switch (_context8.prev = _context8.next) {
12511
+ switch (_context7.prev = _context7.next) {
13030
12512
  case 0:
13031
12513
  if (this.media) {
13032
- _context8.next = 2;
12514
+ _context7.next = 2;
13033
12515
  break;
13034
12516
  }
13035
- return _context8.abrupt("return");
12517
+ return _context7.abrupt("return");
13036
12518
  case 2:
13037
12519
  this.removeAllListeners();
13038
12520
  this._seiService.reset();
@@ -13042,16 +12524,16 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
13042
12524
  this.media.removeEventListener("timeupdate", this._onTimeupdate);
13043
12525
  this.media.removeEventListener("waiting", this._onWaiting);
13044
12526
  this.media.removeEventListener("progress", this._onBufferUpdate);
13045
- _context8.next = 12;
12527
+ _context7.next = 12;
13046
12528
  return Promise.all([this._clear(), this._bufferService.destroy()]);
13047
12529
  case 12:
13048
12530
  this.media = null;
13049
12531
  this._bufferService = null;
13050
12532
  case 14:
13051
12533
  case "end":
13052
- return _context8.stop();
12534
+ return _context7.stop();
13053
12535
  }
13054
- }, _callee8, this);
12536
+ }, _callee7, this);
13055
12537
  }));
13056
12538
  function destroy() {
13057
12539
  return _destroy.apply(this, arguments);
@@ -13080,26 +12562,26 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
13080
12562
  }, {
13081
12563
  key: "_reset",
13082
12564
  value: function() {
13083
- var _reset2 = _asyncToGenerator$a(/* @__PURE__ */ _regeneratorRuntime$a().mark(function _callee9() {
13084
- var reuseMse, _args9 = arguments;
13085
- return _regeneratorRuntime$a().wrap(function _callee9$(_context9) {
12565
+ var _reset2 = _asyncToGenerator$a(/* @__PURE__ */ _regeneratorRuntime$a().mark(function _callee8() {
12566
+ var reuseMse, _args8 = arguments;
12567
+ return _regeneratorRuntime$a().wrap(function _callee8$(_context8) {
13086
12568
  while (1)
13087
- switch (_context9.prev = _context9.next) {
12569
+ switch (_context8.prev = _context8.next) {
13088
12570
  case 0:
13089
- reuseMse = _args9.length > 0 && _args9[0] !== void 0 ? _args9[0] : false;
12571
+ reuseMse = _args8.length > 0 && _args8[0] !== void 0 ? _args8[0] : false;
13090
12572
  this._seiService.reset();
13091
12573
  this._bandwidthService.reset();
13092
12574
  this._stats.reset();
13093
- _context9.next = 6;
12575
+ _context8.next = 6;
13094
12576
  return this._clear();
13095
12577
  case 6:
13096
- _context9.next = 8;
12578
+ _context8.next = 8;
13097
12579
  return this._bufferService.reset(reuseMse);
13098
12580
  case 8:
13099
12581
  case "end":
13100
- return _context9.stop();
12582
+ return _context8.stop();
13101
12583
  }
13102
- }, _callee9, this);
12584
+ }, _callee8, this);
13103
12585
  }));
13104
12586
  function _reset() {
13105
12587
  return _reset2.apply(this, arguments);
@@ -13109,17 +12591,17 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
13109
12591
  }, {
13110
12592
  key: "_loadData",
13111
12593
  value: function() {
13112
- var _loadData2 = _asyncToGenerator$a(/* @__PURE__ */ _regeneratorRuntime$a().mark(function _callee10(url, range) {
12594
+ var _loadData2 = _asyncToGenerator$a(/* @__PURE__ */ _regeneratorRuntime$a().mark(function _callee9(url, range) {
13113
12595
  var finnalUrl;
13114
- return _regeneratorRuntime$a().wrap(function _callee10$(_context10) {
12596
+ return _regeneratorRuntime$a().wrap(function _callee9$(_context9) {
13115
12597
  while (1)
13116
- switch (_context10.prev = _context10.next) {
12598
+ switch (_context9.prev = _context9.next) {
13117
12599
  case 0:
13118
12600
  if (url)
13119
12601
  this._opts.url = url;
13120
12602
  finnalUrl = url = this._opts.url;
13121
12603
  if (url) {
13122
- _context10.next = 4;
12604
+ _context9.next = 4;
13123
12605
  break;
13124
12606
  }
13125
12607
  throw new Error("Source url is missing");
@@ -13134,34 +12616,34 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
13134
12616
  });
13135
12617
  logger$7.debug("load data, loading:", this._loading, finnalUrl);
13136
12618
  if (!this._loading) {
13137
- _context10.next = 11;
12619
+ _context9.next = 11;
13138
12620
  break;
13139
12621
  }
13140
- _context10.next = 11;
12622
+ _context9.next = 11;
13141
12623
  return this._mediaLoader.cancel();
13142
12624
  case 11:
13143
12625
  this._loading = true;
13144
- _context10.prev = 12;
13145
- _context10.next = 15;
12626
+ _context9.prev = 12;
12627
+ _context9.next = 15;
13146
12628
  return this._mediaLoader.load({
13147
12629
  url: finnalUrl,
13148
12630
  range
13149
12631
  });
13150
12632
  case 15:
13151
- _context10.next = 21;
12633
+ _context9.next = 21;
13152
12634
  break;
13153
12635
  case 17:
13154
- _context10.prev = 17;
13155
- _context10.t0 = _context10["catch"](12);
12636
+ _context9.prev = 17;
12637
+ _context9.t0 = _context9["catch"](12);
13156
12638
  this._loading = false;
13157
- return _context10.abrupt("return", this._emitError(StreamingError$3.network(_context10.t0), false));
12639
+ return _context9.abrupt("return", this._emitError(StreamingError$3.network(_context9.t0), false));
13158
12640
  case 21:
13159
12641
  case "end":
13160
- return _context10.stop();
12642
+ return _context9.stop();
13161
12643
  }
13162
- }, _callee10, this, [[12, 17]]);
12644
+ }, _callee9, this, [[12, 17]]);
13163
12645
  }));
13164
- function _loadData(_x9, _x10) {
12646
+ function _loadData(_x8, _x9) {
13165
12647
  return _loadData2.apply(this, arguments);
13166
12648
  }
13167
12649
  return _loadData;
@@ -13169,16 +12651,16 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
13169
12651
  }, {
13170
12652
  key: "_clear",
13171
12653
  value: function() {
13172
- var _clear2 = _asyncToGenerator$a(/* @__PURE__ */ _regeneratorRuntime$a().mark(function _callee11() {
13173
- return _regeneratorRuntime$a().wrap(function _callee11$(_context11) {
12654
+ var _clear2 = _asyncToGenerator$a(/* @__PURE__ */ _regeneratorRuntime$a().mark(function _callee10() {
12655
+ return _regeneratorRuntime$a().wrap(function _callee10$(_context10) {
13174
12656
  while (1)
13175
- switch (_context11.prev = _context11.next) {
12657
+ switch (_context10.prev = _context10.next) {
13176
12658
  case 0:
13177
12659
  if (!this._mediaLoader) {
13178
- _context11.next = 3;
12660
+ _context10.next = 3;
13179
12661
  break;
13180
12662
  }
13181
- _context11.next = 3;
12663
+ _context10.next = 3;
13182
12664
  return this._mediaLoader.cancel();
13183
12665
  case 3:
13184
12666
  clearTimeout(this._maxChunkWaitTimer);
@@ -13187,9 +12669,9 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
13187
12669
  this._firstProgressEmit = false;
13188
12670
  case 7:
13189
12671
  case "end":
13190
- return _context11.stop();
12672
+ return _context10.stop();
13191
12673
  }
13192
- }, _callee11, this);
12674
+ }, _callee10, this);
13193
12675
  }));
13194
12676
  function _clear() {
13195
12677
  return _clear2.apply(this, arguments);
@@ -13276,13 +12758,9 @@ var PluginExtension$1 = /* @__PURE__ */ function() {
13276
12758
  _createClass$j(PluginExtension2, [{
13277
12759
  key: "_init",
13278
12760
  value: function _init() {
13279
- var _this$_opts2 = this._opts, media = _this$_opts2.media, isLive = _this$_opts2.isLive, preloadTime = _this$_opts2.preloadTime, innerDegrade = _this$_opts2.innerDegrade, decodeMode = _this$_opts2.decodeMode;
12761
+ var _this$_opts2 = this._opts, media = _this$_opts2.media, preloadTime = _this$_opts2.preloadTime, innerDegrade = _this$_opts2.innerDegrade, decodeMode = _this$_opts2.decodeMode;
13280
12762
  if (!media)
13281
12763
  return;
13282
- if (!isLive && media.setPlayMode) {
13283
- media.setPlayMode("VOD");
13284
- return;
13285
- }
13286
12764
  if (innerDegrade) {
13287
12765
  media.setAttribute("innerdegrade", innerDegrade);
13288
12766
  }
@@ -13320,7 +12798,6 @@ var FlvPlugin = /* @__PURE__ */ function(_BasePlugin) {
13320
12798
  args[_key] = arguments[_key];
13321
12799
  }
13322
12800
  _this = _super.call.apply(_super, [this].concat(args));
13323
- _defineProperty$h(_assertThisInitialized$f(_this), "logger", logger$7);
13324
12801
  _defineProperty$h(_assertThisInitialized$f(_this), "flv", null);
13325
12802
  _defineProperty$h(_assertThisInitialized$f(_this), "pluginExtension", null);
13326
12803
  _defineProperty$h(_assertThisInitialized$f(_this), "getStats", function() {
@@ -13388,17 +12865,11 @@ var FlvPlugin = /* @__PURE__ */ function(_BasePlugin) {
13388
12865
  var _this$flv3;
13389
12866
  return (_this$flv3 = this.flv) === null || _this$flv3 === void 0 ? void 0 : _this$flv3.loader;
13390
12867
  }
13391
- }, {
13392
- key: "transferCost",
13393
- get: function get3() {
13394
- return this.flv._transferCost.transferCost;
13395
- }
13396
12868
  }, {
13397
12869
  key: "beforePlayerInit",
13398
12870
  value: function beforePlayerInit() {
13399
12871
  var _this2 = this;
13400
12872
  var config = this.player.config;
13401
- var mediaElem = this.player.media || this.player.video;
13402
12873
  if (!config.url)
13403
12874
  return;
13404
12875
  if (this.flv)
@@ -13411,10 +12882,10 @@ var FlvPlugin = /* @__PURE__ */ function(_BasePlugin) {
13411
12882
  this.flv = new Flv(_objectSpread2$a({
13412
12883
  softDecode: this.softDecode,
13413
12884
  isLive: config.isLive,
13414
- media: mediaElem,
12885
+ media: this.player.video,
13415
12886
  preProcessUrl: function preProcessUrl(url, ext) {
13416
- var _this2$player, _this2$player$preProc;
13417
- return ((_this2$player = _this2.player) === null || _this2$player === void 0 ? void 0 : (_this2$player$preProc = _this2$player.preProcessUrl) === null || _this2$player$preProc === void 0 ? void 0 : _this2$player$preProc.call(_this2$player, url, ext)) || {
12887
+ var _this2$player$preProc, _this2$player;
12888
+ return ((_this2$player$preProc = (_this2$player = _this2.player).preProcessUrl) === null || _this2$player$preProc === void 0 ? void 0 : _this2$player$preProc.call(_this2$player, url, ext)) || {
13418
12889
  url,
13419
12890
  ext
13420
12891
  };
@@ -13433,8 +12904,7 @@ var FlvPlugin = /* @__PURE__ */ function(_BasePlugin) {
13433
12904
  }
13434
12905
  if (this.softDecode) {
13435
12906
  this.pluginExtension = new PluginExtension$1(_objectSpread2$a({
13436
- media: this.player.video,
13437
- isLive: config.isLive
12907
+ media: this.player.video
13438
12908
  }, config.flv), this);
13439
12909
  this.player.forceDegradeToVideo = function() {
13440
12910
  var _this2$pluginExtensio;
@@ -13461,7 +12931,6 @@ var FlvPlugin = /* @__PURE__ */ function(_BasePlugin) {
13461
12931
  this._transCoreEvent(EVENT$3.LOAD_RETRY);
13462
12932
  this._transCoreEvent(EVENT$3.SOURCEBUFFER_CREATED);
13463
12933
  this._transCoreEvent(EVENT$3.ANALYZE_DURATION_EXCEEDED);
13464
- this._transCoreEvent(EVENT$3.APPEND_BUFFER);
13465
12934
  this._transCoreEvent(EVENT$3.REMOVE_BUFFER);
13466
12935
  this._transCoreEvent(EVENT$3.BUFFEREOS);
13467
12936
  this._transCoreEvent(EVENT$3.KEYFRAME);
@@ -28459,7 +27928,7 @@ function _arrayLikeToArray$a(arr, len) {
28459
27928
  arr2[i] = arr[i];
28460
27929
  return arr2;
28461
27930
  }
28462
- function _createForOfIteratorHelper$3(o, allowArrayLike) {
27931
+ function _createForOfIteratorHelper$2(o, allowArrayLike) {
28463
27932
  var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
28464
27933
  if (!it) {
28465
27934
  if (Array.isArray(o) || (it = _unsupportedIterableToArray$a(o)) || allowArrayLike && o && typeof o.length === "number") {
@@ -29740,7 +29209,7 @@ var XhrLoader$2 = /* @__PURE__ */ function(_EventEmitter) {
29740
29209
  value: function _getHeaders(xhr) {
29741
29210
  var headerLines = xhr.getAllResponseHeaders().trim().split("\r\n");
29742
29211
  var headers = {};
29743
- var _iterator = _createForOfIteratorHelper$3(headerLines), _step;
29212
+ var _iterator = _createForOfIteratorHelper$2(headerLines), _step;
29744
29213
  try {
29745
29214
  for (_iterator.s(); !(_step = _iterator.n()).done; ) {
29746
29215
  var header = _step.value;
@@ -29762,7 +29231,7 @@ var XhrLoader$2 = /* @__PURE__ */ function(_EventEmitter) {
29762
29231
  }]);
29763
29232
  return XhrLoader2;
29764
29233
  }(EventEmitter$1);
29765
- var _excluded$5 = ["retry", "retryDelay", "onRetryError", "transformError"];
29234
+ var _excluded$4 = ["retry", "retryDelay", "onRetryError", "transformError"];
29766
29235
  var Task$2 = /* @__PURE__ */ function() {
29767
29236
  function Task2(type, config) {
29768
29237
  _classCallCheck$d(this, Task2);
@@ -29782,7 +29251,7 @@ var Task$2 = /* @__PURE__ */ function() {
29782
29251
  key: "exec",
29783
29252
  value: function exec2() {
29784
29253
  var _this = this;
29785
- var _this$_config = this._config, retry = _this$_config.retry, retryDelay = _this$_config.retryDelay, onRetryError = _this$_config.onRetryError, transformError = _this$_config.transformError, rest = _objectWithoutProperties$4(_this$_config, _excluded$5);
29254
+ var _this$_config = this._config, retry = _this$_config.retry, retryDelay = _this$_config.retryDelay, onRetryError = _this$_config.onRetryError, transformError = _this$_config.transformError, rest = _objectWithoutProperties$4(_this$_config, _excluded$4);
29786
29255
  var request = /* @__PURE__ */ function() {
29787
29256
  var _ref = _asyncToGenerator$7(/* @__PURE__ */ _regeneratorRuntime$7().mark(function _callee() {
29788
29257
  var response, error, isRetry;
@@ -32896,7 +32365,7 @@ function _arrayLikeToArray$8(arr, len) {
32896
32365
  arr2[i] = arr[i];
32897
32366
  return arr2;
32898
32367
  }
32899
- function _createForOfIteratorHelper$2(o, allowArrayLike) {
32368
+ function _createForOfIteratorHelper$1(o, allowArrayLike) {
32900
32369
  var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
32901
32370
  if (!it) {
32902
32371
  if (Array.isArray(o) || (it = _unsupportedIterableToArray$8(o)) || allowArrayLike && o && typeof o.length === "number") {
@@ -33084,21 +32553,6 @@ var Buffer$4 = /* @__PURE__ */ function() {
33084
32553
  length: Buffer22.totalLength && Buffer22.totalLength(buffers)
33085
32554
  };
33086
32555
  }
33087
- }, {
33088
- key: "isBuffered",
33089
- value: function isBuffered(media, pos) {
33090
- if (media) {
33091
- var buffered = Buffer22.get(media);
33092
- if (buffered !== null && buffered !== void 0 && buffered.length) {
33093
- for (var i = 0; i < buffered.length; i++) {
33094
- if (pos >= buffered.start(i) && pos <= buffered.end(i)) {
33095
- return true;
33096
- }
33097
- }
33098
- }
33099
- }
33100
- return false;
33101
- }
33102
32556
  }]);
33103
32557
  return Buffer22;
33104
32558
  }();
@@ -33251,7 +32705,7 @@ var Logger$6 = /* @__PURE__ */ function() {
33251
32705
  this.logCache.apply(this, [LogCacheLevel.DEBUG].concat(args));
33252
32706
  if (Logger2.disabled)
33253
32707
  return;
33254
- (_console = console).debug.apply(_console, ["[".concat(nowTime$4(), "]"), this._prefix].concat(args));
32708
+ (_console = console).debug.apply(_console, [this._prefix, nowTime$4()].concat(args));
33255
32709
  }
33256
32710
  }, {
33257
32711
  key: "log",
@@ -33263,7 +32717,7 @@ var Logger$6 = /* @__PURE__ */ function() {
33263
32717
  this.logCache.apply(this, [LogCacheLevel.LOG].concat(args));
33264
32718
  if (Logger2.disabled)
33265
32719
  return;
33266
- (_console2 = console).log.apply(_console2, ["[".concat(nowTime$4(), "]"), this._prefix].concat(args));
32720
+ (_console2 = console).log.apply(_console2, [this._prefix, nowTime$4()].concat(args));
33267
32721
  }
33268
32722
  }, {
33269
32723
  key: "warn",
@@ -33275,7 +32729,7 @@ var Logger$6 = /* @__PURE__ */ function() {
33275
32729
  this.logCache.apply(this, [LogCacheLevel.WARN].concat(args));
33276
32730
  if (Logger2.disabled)
33277
32731
  return;
33278
- (_console3 = console).warn.apply(_console3, ["[".concat(nowTime$4(), "]"), this._prefix].concat(args));
32732
+ (_console3 = console).warn.apply(_console3, [this._prefix, nowTime$4()].concat(args));
33279
32733
  }
33280
32734
  }, {
33281
32735
  key: "error",
@@ -33287,7 +32741,7 @@ var Logger$6 = /* @__PURE__ */ function() {
33287
32741
  this.logCache.apply(this, [LogCacheLevel.ERROR].concat(args));
33288
32742
  if (Logger2.disabled)
33289
32743
  return;
33290
- (_console4 = console).error.apply(_console4, ["[".concat(nowTime$4(), "]"), this._prefix].concat(args));
32744
+ (_console4 = console).error.apply(_console4, [this._prefix, nowTime$4()].concat(args));
33291
32745
  }
33292
32746
  }, {
33293
32747
  key: "logCache",
@@ -33302,7 +32756,7 @@ var Logger$6 = /* @__PURE__ */ function() {
33302
32756
  var finLogText = logText.map(function(item) {
33303
32757
  return logable(item);
33304
32758
  });
33305
- text = "[".concat(nowTime$4(), "]") + this._prefix + JSON.stringify(finLogText);
32759
+ text = this._prefix + nowTime$4() + JSON.stringify(finLogText);
33306
32760
  } catch (e) {
33307
32761
  return;
33308
32762
  }
@@ -34218,8 +33672,8 @@ function createResponse$1(data2, done, response, contentLength, age, startTime,
34218
33672
  response
34219
33673
  };
34220
33674
  }
34221
- function calculateSpeed$1(byteLen, milliSecond) {
34222
- return Math.round(byteLen * 8 * 1e3 / milliSecond / 1024);
33675
+ function calculateSpeed$1(byteLen, millisec) {
33676
+ return Math.round(byteLen * 8 * 1e3 / millisec / 1024);
34223
33677
  }
34224
33678
  var EVENT$1 = {
34225
33679
  ERROR: "error",
@@ -34231,7 +33685,6 @@ var EVENT$1 = {
34231
33685
  SOURCEBUFFER_CREATED: "core.sourcebuffercreated",
34232
33686
  MEDIASOURCE_OPENED: "core.mediasourceopened",
34233
33687
  ANALYZE_DURATION_EXCEEDED: "core.analyzedurationexceeded",
34234
- APPEND_BUFFER: "core.appendbuffer",
34235
33688
  REMOVE_BUFFER: "core.removebuffer",
34236
33689
  BUFFEREOS: "core.buffereos",
34237
33690
  KEYFRAME: "core.keyframe",
@@ -35004,7 +34457,7 @@ var XhrLoader$1 = /* @__PURE__ */ function(_EventEmitter) {
35004
34457
  value: function _getHeaders(xhr) {
35005
34458
  var headerLines = xhr.getAllResponseHeaders().trim().split("\r\n");
35006
34459
  var headers = {};
35007
- var _iterator = _createForOfIteratorHelper$2(headerLines), _step;
34460
+ var _iterator = _createForOfIteratorHelper$1(headerLines), _step;
35008
34461
  try {
35009
34462
  for (_iterator.s(); !(_step = _iterator.n()).done; ) {
35010
34463
  var header = _step.value;
@@ -35026,7 +34479,7 @@ var XhrLoader$1 = /* @__PURE__ */ function(_EventEmitter) {
35026
34479
  }]);
35027
34480
  return XhrLoader2;
35028
34481
  }(EventEmitter$1);
35029
- var _excluded$4 = ["retry", "retryDelay", "onRetryError", "transformError"];
34482
+ var _excluded$3 = ["retry", "retryDelay", "onRetryError", "transformError"];
35030
34483
  var Task$1 = /* @__PURE__ */ function() {
35031
34484
  function Task2(type, config) {
35032
34485
  _classCallCheck$b(this, Task2);
@@ -35046,7 +34499,7 @@ var Task$1 = /* @__PURE__ */ function() {
35046
34499
  key: "exec",
35047
34500
  value: function exec2() {
35048
34501
  var _this = this;
35049
- var _this$_config = this._config, retry = _this$_config.retry, retryDelay = _this$_config.retryDelay, onRetryError = _this$_config.onRetryError, transformError = _this$_config.transformError, rest = _objectWithoutProperties$2(_this$_config, _excluded$4);
34502
+ var _this$_config = this._config, retry = _this$_config.retry, retryDelay = _this$_config.retryDelay, onRetryError = _this$_config.onRetryError, transformError = _this$_config.transformError, rest = _objectWithoutProperties$2(_this$_config, _excluded$3);
35050
34503
  var request = /* @__PURE__ */ function() {
35051
34504
  var _ref = _asyncToGenerator$5(/* @__PURE__ */ _regeneratorRuntime$5().mark(function _callee() {
35052
34505
  var response, error, isRetry;
@@ -35842,60 +35295,6 @@ function _nonIterableSpread$6() {
35842
35295
  function _nonIterableRest$4() {
35843
35296
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
35844
35297
  }
35845
- function _createForOfIteratorHelper$1(o, allowArrayLike) {
35846
- var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
35847
- if (!it) {
35848
- if (Array.isArray(o) || (it = _unsupportedIterableToArray$7(o)) || allowArrayLike && o && typeof o.length === "number") {
35849
- if (it)
35850
- o = it;
35851
- var i = 0;
35852
- var F = function() {
35853
- };
35854
- return {
35855
- s: F,
35856
- n: function() {
35857
- if (i >= o.length)
35858
- return {
35859
- done: true
35860
- };
35861
- return {
35862
- done: false,
35863
- value: o[i++]
35864
- };
35865
- },
35866
- e: function(e) {
35867
- throw e;
35868
- },
35869
- f: F
35870
- };
35871
- }
35872
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
35873
- }
35874
- var normalCompletion = true, didErr = false, err;
35875
- return {
35876
- s: function() {
35877
- it = it.call(o);
35878
- },
35879
- n: function() {
35880
- var step = it.next();
35881
- normalCompletion = step.done;
35882
- return step;
35883
- },
35884
- e: function(e) {
35885
- didErr = true;
35886
- err = e;
35887
- },
35888
- f: function() {
35889
- try {
35890
- if (!normalCompletion && it.return != null)
35891
- it.return();
35892
- } finally {
35893
- if (didErr)
35894
- throw err;
35895
- }
35896
- }
35897
- };
35898
- }
35899
35298
  function _toPrimitive(input, hint) {
35900
35299
  if (typeof input !== "object" || input === null)
35901
35300
  return input;
@@ -35918,15 +35317,13 @@ var TrackType$2 = {
35918
35317
  METADATA: "metadata"
35919
35318
  };
35920
35319
  var VideoCodecType$2 = {
35921
- AV1: "av1",
35922
35320
  AVC: "avc",
35923
35321
  HEVC: "hevc"
35924
35322
  };
35925
35323
  var AudioCodecType$1 = {
35926
35324
  AAC: "aac",
35927
35325
  G711PCMA: "g7110a",
35928
- G711PCMU: "g7110m",
35929
- OPUS: "opus"
35326
+ G711PCMU: "g7110m"
35930
35327
  };
35931
35328
  var WarningType = {
35932
35329
  LARGE_AV_SHIFT: "LARGE_AV_SHIFT",
@@ -35966,7 +35363,6 @@ var VideoTrack$1 = /* @__PURE__ */ function() {
35966
35363
  _defineProperty$8(this, "isVideoEncryption", false);
35967
35364
  _defineProperty$8(this, "isAudioEncryption", false);
35968
35365
  _defineProperty$8(this, "isVideo", true);
35969
- _defineProperty$8(this, "lastKeyFrameDts", 0);
35970
35366
  _defineProperty$8(this, "kid", null);
35971
35367
  _defineProperty$8(this, "pssh", null);
35972
35368
  _defineProperty$8(this, "ext", void 0);
@@ -36009,9 +35405,6 @@ var VideoTrack$1 = /* @__PURE__ */ function() {
36009
35405
  }, {
36010
35406
  key: "exist",
36011
35407
  value: function exist() {
36012
- if (/av01/.test(this.codec)) {
36013
- return true;
36014
- }
36015
35408
  return !!(this.pps.length && this.sps.length && this.codec);
36016
35409
  }
36017
35410
  }, {
@@ -36075,7 +35468,7 @@ var AudioTrack$1 = /* @__PURE__ */ function() {
36075
35468
  }, {
36076
35469
  key: "exist",
36077
35470
  value: function exist() {
36078
- return !!(this.sampleRate && this.channelCount && this.codec && (this.codecType === AudioCodecType$1.AAC || this.codecType === AudioCodecType$1.G711PCMA || this.codecType === AudioCodecType$1.G711PCMU || this.codecType === AudioCodecType$1.OPUS));
35471
+ return !!(this.sampleRate && this.channelCount && this.codec && this.codecType === AudioCodecType$1.AAC);
36079
35472
  }
36080
35473
  }, {
36081
35474
  key: "hasSample",
@@ -36280,7 +35673,7 @@ var AAC$1 = /* @__PURE__ */ function() {
36280
35673
  continue;
36281
35674
  }
36282
35675
  frameLength = (data2[i + 3] & 3) << 11 | data2[i + 4] << 3 | (data2[i + 5] & 224) >> 5;
36283
- if (!frameLength || len - i < frameLength)
35676
+ if (len - i < frameLength)
36284
35677
  break;
36285
35678
  protectionSkipBytes = (~data2[i + 1] & 1) * 2;
36286
35679
  frames.push({
@@ -36474,15 +35867,6 @@ function parse$2(a) {
36474
35867
  return parseInt(item, 16);
36475
35868
  });
36476
35869
  }
36477
- function combineToFloat(integer, decimal) {
36478
- return Number(integer + "." + decimal);
36479
- }
36480
- function toDegree(matrix) {
36481
- if (matrix.length < 5)
36482
- return 0;
36483
- var scaled0 = Math.hypot(matrix[0], matrix[3]), scaled1 = Math.hypot(matrix[1], matrix[4]);
36484
- return 0 === scaled0 || 0 === scaled1 ? 0 : 180 * Math.atan2(matrix[1] / scaled1, matrix[0] / scaled0) / Math.PI;
36485
- }
36486
35870
  var NALu = /* @__PURE__ */ function() {
36487
35871
  function NALu2() {
36488
35872
  _classCallCheck$a(this, NALu2);
@@ -37145,16 +36529,13 @@ var MAX_SILENT_FRAME_DURATION = 9e4;
37145
36529
  var AUDIO_EXCETION_LOG_EMIT_DURATION = 5 * 9e4;
37146
36530
  var MAX_VIDEO_FRAME_DURATION = 9e4;
37147
36531
  var MAX_DTS_DELTA_WITH_NEXT_CHUNK = 9e4 / 2;
37148
- var LARGE_AV_FIRST_FRAME_FORCE_FIX_THRESHOLD = 9e4 * 5;
37149
36532
  var TsFixer = /* @__PURE__ */ function() {
37150
- function TsFixer2(videoTrack, audioTrack, metadataTrack, fixerConfig) {
36533
+ function TsFixer2(videoTrack, audioTrack, metadataTrack) {
37151
36534
  _classCallCheck$a(this, TsFixer2);
37152
36535
  this.videoTrack = videoTrack;
37153
36536
  this.audioTrack = audioTrack;
37154
36537
  this.metadataTrack = metadataTrack;
37155
36538
  this._baseDts = -1;
37156
- this._baseVideoDts = -1;
37157
- this._baseAudioDts = -1;
37158
36539
  this._baseDtsInited = false;
37159
36540
  this._audioNextPts = void 0;
37160
36541
  this._videoNextDts = void 0;
@@ -37163,8 +36544,6 @@ var TsFixer = /* @__PURE__ */ function() {
37163
36544
  this._lastAudioExceptionGapDot = 0;
37164
36545
  this._lastAudioExceptionOverlapDot = 0;
37165
36546
  this._lastAudioExceptionLargeGapDot = 0;
37166
- this._needForceFixLargeGap = fixerConfig === null || fixerConfig === void 0 ? void 0 : fixerConfig.forceFixLargeGap;
37167
- this._largeGapThreshold = (fixerConfig === null || fixerConfig === void 0 ? void 0 : fixerConfig.largeGapThreshold) || LARGE_AV_FIRST_FRAME_FORCE_FIX_THRESHOLD;
37168
36547
  }
37169
36548
  _createClass$a(TsFixer2, [{
37170
36549
  key: "fix",
@@ -37192,16 +36571,10 @@ var TsFixer = /* @__PURE__ */ function() {
37192
36571
  if (discontinuity) {
37193
36572
  this._calculateBaseDts(this.audioTrack, this.videoTrack);
37194
36573
  this._baseDts -= startTime;
37195
- this._baseAudioDts -= startTime;
37196
- this._baseVideoDts -= startTime;
37197
36574
  }
37198
36575
  if (!contiguous) {
37199
36576
  this._videoNextDts = vaDelta > 0 ? startTime + vaDelta : startTime;
37200
36577
  this._audioNextPts = vaDelta > 0 ? startTime : startTime - vaDelta;
37201
- if (this._needForceFixLargeGap) {
37202
- this._videoNextDts = 0;
37203
- this._audioNextPts = 0;
37204
- }
37205
36578
  var vDeltaToNextDts = firstVideoSample ? firstVideoSample.dts - this._baseDts - this._videoNextDts : 0;
37206
36579
  var aDeltaToNextDts = firstAudioSample ? firstAudioSample.pts - this._baseDts - this._audioNextPts : 0;
37207
36580
  if (Math.abs(vDeltaToNextDts || aDeltaToNextDts) > MAX_VIDEO_FRAME_DURATION) {
@@ -37234,8 +36607,8 @@ var TsFixer = /* @__PURE__ */ function() {
37234
36607
  if (!samples.length)
37235
36608
  return;
37236
36609
  samples.forEach(function(x2) {
37237
- x2.dts -= _this2._needForceFixLargeGap ? _this2._baseVideoDts : _this2._baseDts;
37238
- x2.pts -= _this2._needForceFixLargeGap ? _this2._baseVideoDts : _this2._baseDts;
36610
+ x2.dts -= _this2._baseDts;
36611
+ x2.pts -= _this2._baseDts;
37239
36612
  });
37240
36613
  if (this._videoNextDts === void 0) {
37241
36614
  var samp0 = samples[0];
@@ -37328,7 +36701,7 @@ var TsFixer = /* @__PURE__ */ function() {
37328
36701
  if (!samples.length)
37329
36702
  return;
37330
36703
  samples.forEach(function(x2) {
37331
- x2.pts -= _this3._needForceFixLargeGap ? _this3._baseAudioDts : _this3._baseDts;
36704
+ x2.pts -= _this3._baseDts;
37332
36705
  x2.dts = x2.pts;
37333
36706
  });
37334
36707
  this._doFixAudioInternal(audioTrack, samples, 9e4);
@@ -37345,15 +36718,12 @@ var TsFixer = /* @__PURE__ */ function() {
37345
36718
  var videoBaseDts = Infinity;
37346
36719
  if (audioSamps.length) {
37347
36720
  audioTrack.baseDts = audioBasePts = audioSamps[0].pts;
37348
- this._baseAudioDts = audioBasePts;
37349
36721
  }
37350
36722
  if (videoSamps.length) {
37351
36723
  videoTrack.baseDts = videoBaseDts = videoSamps[0].dts;
37352
- this._baseVideoDts = videoBaseDts;
37353
36724
  }
37354
36725
  this._baseDts = Math.min(audioBasePts, videoBaseDts);
37355
36726
  var delta = videoBaseDts - audioBasePts;
37356
- var largeGap = false;
37357
36727
  if (Number.isFinite(delta) && Math.abs(delta) > LARGE_AV_FIRST_FRAME_GAP) {
37358
36728
  videoTrack.warnings.push({
37359
36729
  type: WarningType.LARGE_AV_SHIFT,
@@ -37363,16 +36733,6 @@ var TsFixer = /* @__PURE__ */ function() {
37363
36733
  delta
37364
36734
  });
37365
36735
  }
37366
- if (Number.isFinite(delta) && Math.abs(delta) > this._largeGapThreshold * MAX_SILENT_FRAME_DURATION) {
37367
- largeGap = true;
37368
- }
37369
- if (!this._baseDtsInited) {
37370
- if (largeGap && this._needForceFixLargeGap) {
37371
- this._needForceFixLargeGap = true;
37372
- } else {
37373
- this._needForceFixLargeGap = false;
37374
- }
37375
- }
37376
36736
  this._baseDtsInited = true;
37377
36737
  return true;
37378
36738
  }
@@ -37466,7 +36826,6 @@ var TsFixer = /* @__PURE__ */ function() {
37466
36826
  var logger$5 = new Logger$5("TsDemuxer");
37467
36827
  var TsDemuxer = /* @__PURE__ */ function() {
37468
36828
  function TsDemuxer2(videoTrack, audioTrack, metadataTrack) {
37469
- var fixerConfig = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
37470
36829
  _classCallCheck$a(this, TsDemuxer2);
37471
36830
  _defineProperty$8(this, "_pmtId", -1);
37472
36831
  _defineProperty$8(this, "_remainingPacketData", null);
@@ -37476,7 +36835,7 @@ var TsDemuxer = /* @__PURE__ */ function() {
37476
36835
  this.videoTrack = videoTrack || new VideoTrack$1();
37477
36836
  this.audioTrack = audioTrack || new AudioTrack$1();
37478
36837
  this.metadataTrack = metadataTrack || new MetadataTrack$1();
37479
- this._fixer = new TsFixer(this.videoTrack, this.audioTrack, this.metadataTrack, fixerConfig);
36838
+ this._fixer = new TsFixer(this.videoTrack, this.audioTrack, this.metadataTrack);
37480
36839
  }
37481
36840
  _createClass$a(TsDemuxer2, [{
37482
36841
  key: "demux",
@@ -37823,207 +37182,6 @@ var TsDemuxer = /* @__PURE__ */ function() {
37823
37182
  }]);
37824
37183
  return TsDemuxer2;
37825
37184
  }();
37826
- var ByteReader = /* @__PURE__ */ function() {
37827
- function ByteReader2(buf, offset, len) {
37828
- _classCallCheck$a(this, ByteReader2);
37829
- this.dv = new DataView(buf);
37830
- this.start = this.offset = offset || this.dv.byteOffset;
37831
- this.end = len ? this.start + len : this.start + this.dv.byteLength;
37832
- }
37833
- _createClass$a(ByteReader2, [{
37834
- key: "buffer",
37835
- get: function get3() {
37836
- return this.dv.buffer;
37837
- }
37838
- }, {
37839
- key: "unreadLength",
37840
- get: function get3() {
37841
- return Math.max(this.end - this.offset, 0);
37842
- }
37843
- }, {
37844
- key: "size",
37845
- get: function get3() {
37846
- return this.end - this.start;
37847
- }
37848
- }, {
37849
- key: "readFloat",
37850
- value: function readFloat(byteNum) {
37851
- var val = 0;
37852
- switch (byteNum) {
37853
- case 4:
37854
- val = this.dv.getFloat32(this.offset);
37855
- break;
37856
- case 8:
37857
- val = this.dv.getFloat64(this.offset);
37858
- break;
37859
- default:
37860
- throw new Error("read ".concat(byteNum, "-byte float is not supported"));
37861
- }
37862
- this.offset += byteNum;
37863
- return val;
37864
- }
37865
- }, {
37866
- key: "back",
37867
- value: function back(byteNum) {
37868
- this.offset -= byteNum;
37869
- }
37870
- }, {
37871
- key: "skip",
37872
- value: function skip(byteNum) {
37873
- this.offset += byteNum;
37874
- }
37875
- }, {
37876
- key: "readInt",
37877
- value: function readInt(byteNum) {
37878
- var offset = this.offset;
37879
- this.offset += byteNum;
37880
- switch (byteNum) {
37881
- case 1:
37882
- return this.dv.getInt8(offset);
37883
- case 2:
37884
- return this.dv.getInt16(offset);
37885
- case 4:
37886
- return this.dv.getInt32(offset);
37887
- default:
37888
- throw new Error("read ".concat(byteNum, "-byte integers is not supported"));
37889
- }
37890
- }
37891
- }, {
37892
- key: "read",
37893
- value: function read(byteNum) {
37894
- var offset = this.offset;
37895
- this.offset += byteNum;
37896
- switch (byteNum) {
37897
- case 1:
37898
- return this.dv.getUint8(offset);
37899
- case 2:
37900
- return this.dv.getUint16(offset);
37901
- case 3:
37902
- return (this.dv.getUint16(offset) << 8) + this.dv.getUint8(offset + 2);
37903
- case 4:
37904
- return this.dv.getUint32(offset);
37905
- default:
37906
- this.back(byteNum - 4);
37907
- return this.read(byteNum - 4) + this.dv.getUint32(offset) * Math.pow(256, byteNum - 4);
37908
- }
37909
- }
37910
- }, {
37911
- key: "write",
37912
- value: function write(byteNum, val) {
37913
- var offset = this.offset;
37914
- this.offset += byteNum;
37915
- switch (byteNum) {
37916
- case 1:
37917
- return this.dv.setUint8(offset, val);
37918
- case 2:
37919
- return this.dv.setUint16(offset, val);
37920
- case 3:
37921
- return this.dv.setUint8(offset, val >>> 16), this.dv.setUint16(offset + 1, 65535 & val);
37922
- case 4:
37923
- return this.dv.setUint32(offset, val);
37924
- default:
37925
- throw new Error("write ".concat(byteNum, "-byte integers is not supported"));
37926
- }
37927
- }
37928
- }, {
37929
- key: "readToBuffer",
37930
- value: function readToBuffer(len) {
37931
- var buffer;
37932
- if (this.offset || len) {
37933
- buffer = this.dv.buffer.slice(this.offset, len ? this.offset + len : this.end);
37934
- } else {
37935
- buffer = this.dv.buffer;
37936
- }
37937
- this.offset += buffer.byteLength;
37938
- return buffer;
37939
- }
37940
- }, {
37941
- key: "readToUint8",
37942
- value: function readToUint8(len) {
37943
- var uint8 = new Uint8Array(this.dv.buffer, this.offset, len || this.unreadLength);
37944
- this.offset += uint8.byteLength;
37945
- return uint8;
37946
- }
37947
- }, {
37948
- key: "readString",
37949
- value: function readString(len) {
37950
- var i = 0, str2 = "";
37951
- for (; i < len; i++) {
37952
- str2 += String.fromCharCode(this.dv.getUint8(this.offset));
37953
- this.offset++;
37954
- }
37955
- return str2;
37956
- }
37957
- }], [{
37958
- key: "fromUint8",
37959
- value: function fromUint8(uint8) {
37960
- return new ByteReader2(uint8.buffer, uint8.byteOffset, uint8.byteLength);
37961
- }
37962
- }, {
37963
- key: "concatUint8s",
37964
- value: function concatUint8s(args) {
37965
- var uint8 = new Uint8Array(args.reduce(function(ret, v) {
37966
- return ret + v.byteLength;
37967
- }, 0));
37968
- var offset = 0;
37969
- args.forEach(function(v) {
37970
- uint8.set(v, offset);
37971
- offset += v.byteLength;
37972
- });
37973
- return uint8;
37974
- }
37975
- }, {
37976
- key: "concatUint8",
37977
- value: function concatUint8() {
37978
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
37979
- args[_key] = arguments[_key];
37980
- }
37981
- return this.concatUint8s(args);
37982
- }
37983
- }]);
37984
- return ByteReader2;
37985
- }();
37986
- var BitReader = /* @__PURE__ */ function() {
37987
- function BitReader2(val, size) {
37988
- _classCallCheck$a(this, BitReader2);
37989
- this.offset = 0;
37990
- this.val = val;
37991
- this.size = size;
37992
- }
37993
- _createClass$a(BitReader2, [{
37994
- key: "skip",
37995
- value: function skip(len) {
37996
- this.offset += len;
37997
- }
37998
- }, {
37999
- key: "read",
38000
- value: function read(len) {
38001
- var unreadLength = this.size - this.offset - len;
38002
- if (unreadLength >= 0) {
38003
- var bits = 0, i = 0;
38004
- this.offset += len;
38005
- if (this.size > 31) {
38006
- for (; i < len; i++) {
38007
- bits += Math.pow(2, i);
38008
- }
38009
- return this.val / Math.pow(2, unreadLength) & bits;
38010
- } else {
38011
- for (; i < len; i++) {
38012
- bits += 1 << i;
38013
- }
38014
- return this.val >>> unreadLength & bits;
38015
- }
38016
- }
38017
- throw new Error("the number of the read operation exceeds the total length limit of bits");
38018
- }
38019
- }], [{
38020
- key: "fromByte",
38021
- value: function fromByte(byte, len) {
38022
- return new BitReader2(byte.read(len), len << 3);
38023
- }
38024
- }]);
38025
- return BitReader2;
38026
- }();
38027
37185
  var MP4Parser$1 = /* @__PURE__ */ function() {
38028
37186
  function MP4Parser2() {
38029
37187
  _classCallCheck$a(this, MP4Parser2);
@@ -38181,36 +37339,18 @@ var MP4Parser$1 = /* @__PURE__ */ function() {
38181
37339
  key: "tkhd",
38182
37340
  value: function tkhd(box) {
38183
37341
  return parseBox$1(box, true, function(ret, data2) {
38184
- var byte = ByteReader.fromUint8(data2);
37342
+ var start = 0;
38185
37343
  if (ret.version === 1) {
38186
- byte.read(8);
38187
- byte.read(8);
38188
- ret.trackId = byte.read(4);
38189
- byte.read(4);
38190
- ret.duration = byte.read(8);
37344
+ ret.trackId = readBig32$1(data2, 16);
37345
+ ret.duration = readBig64$1(data2, 24);
37346
+ start += 32;
38191
37347
  } else {
38192
- byte.read(4);
38193
- byte.read(4);
38194
- ret.trackId = byte.read(4);
38195
- byte.read(4);
38196
- ret.duration = byte.read(4);
38197
- }
38198
- byte.skip(16);
38199
- ret.matrix = [];
38200
- for (var i = 0; i < 36; i++) {
38201
- ret.matrix.push(byte.read(1));
38202
- }
38203
- byte.back(36);
38204
- var caculatedMatrix = [];
38205
- for (var _i = 0, int32; _i < 3; _i++) {
38206
- caculatedMatrix.push(combineToFloat(byte.readInt(2), byte.readInt(2)));
38207
- caculatedMatrix.push(combineToFloat(byte.readInt(2), byte.readInt(2)));
38208
- int32 = byte.readInt(4);
38209
- caculatedMatrix.push(combineToFloat(int32 >> 30, int32 & 1073741823));
37348
+ ret.trackId = readBig32$1(data2, 8);
37349
+ ret.duration = readBig32$1(data2, 16);
37350
+ start += 20;
38210
37351
  }
38211
- ret.rotation = toDegree(caculatedMatrix);
38212
- ret.width = byte.read(4);
38213
- ret.height = byte.read(4);
37352
+ ret.width = readBig32$1(data2, start + 52);
37353
+ ret.height = readBig32$1(data2, start + 56);
38214
37354
  });
38215
37355
  }
38216
37356
  }, {
@@ -38340,7 +37480,7 @@ var MP4Parser$1 = /* @__PURE__ */ function() {
38340
37480
  if (ret.version > 0) {
38341
37481
  var numKeyIds = readBig32$1(data2, start);
38342
37482
  start += 4;
38343
- for (var _i2 = 0; _i2 < ("" + numKeyIds).length; _i2++) {
37483
+ for (var _i = 0; _i < ("" + numKeyIds).length; _i++) {
38344
37484
  for (var j = 0; j < 16; j++) {
38345
37485
  var keyId = data2[start];
38346
37486
  start += 1;
@@ -38363,8 +37503,6 @@ var MP4Parser$1 = /* @__PURE__ */ function() {
38363
37503
  ret.entryCount = readBig32$1(data2);
38364
37504
  ret.entries = MP4Parser2.findBox(data2.subarray(4), [], start + 4).map(function(b) {
38365
37505
  switch (b.type) {
38366
- case "av01":
38367
- return MP4Parser2.av01(b);
38368
37506
  case "avc1":
38369
37507
  case "avc2":
38370
37508
  case "avc3":
@@ -38444,69 +37582,6 @@ var MP4Parser$1 = /* @__PURE__ */ function() {
38444
37582
  }
38445
37583
  });
38446
37584
  }
38447
- }, {
38448
- key: "colr",
38449
- value: function colr(box) {
38450
- return parseBox$1(box, false, function(ret, data2) {
38451
- var byte = ByteReader.fromUint8(data2);
38452
- ret.data = box.data;
38453
- ret.colorType = byte.readString(4);
38454
- if (ret.colorType === "nclx") {
38455
- ret.colorPrimaries = byte.read(2);
38456
- ret.transferCharacteristics = byte.read(2);
38457
- ret.matrixCoefficients = byte.read(2);
38458
- ret.fullRangeFlag = byte.read(1) >> 7;
38459
- } else if (ret.colorType === "rICC" || ret.colorType === "prof") {
38460
- ret.iccProfile = data2.readToUint8();
38461
- }
38462
- });
38463
- }
38464
- }, {
38465
- key: "av01",
38466
- value: function av01(box) {
38467
- return parseBox$1(box, false, function(ret, data2, start) {
38468
- var bodyStart = parseVisualSampleEntry$1(ret, data2);
38469
- var bodyData = data2.subarray(bodyStart);
38470
- start += bodyStart;
38471
- ret.av1C = MP4Parser2.av1C(MP4Parser2.findBox(bodyData, ["av1C"], start)[0]);
38472
- ret.colr = MP4Parser2.colr(MP4Parser2.findBox(bodyData, ["colr"], start)[0]);
38473
- });
38474
- }
38475
- }, {
38476
- key: "av1C",
38477
- value: function av1C(box) {
38478
- return parseBox$1(box, false, function(ret, data2) {
38479
- ret.data = box.data;
38480
- var byte = ByteReader.fromUint8(data2);
38481
- var bit = BitReader.fromByte(byte, 4);
38482
- ret.marker = bit.read(1);
38483
- ret.version = bit.read(7);
38484
- ret.seqProfile = bit.read(3);
38485
- ret.seqLevelIdx0 = bit.read(5);
38486
- ret.seqTier0 = bit.read(1);
38487
- ret.highBitdepth = bit.read(1);
38488
- ret.twelveBit = bit.read(1);
38489
- ret.monochrome = bit.read(1);
38490
- ret.chromaSubsamplingX = bit.read(1);
38491
- ret.chromaSubsamplingY = bit.read(1);
38492
- ret.chromaSamplePosition = bit.read(2);
38493
- ret.reserved = bit.read(3);
38494
- ret.initialPresentationDelayPresent = bit.read(1);
38495
- if (ret.initialPresentationDelayPresent) {
38496
- ret.initialPresentationDelayMinusOne = bit.read(4);
38497
- } else {
38498
- ret.initialPresentationDelayMinusOne = 0;
38499
- }
38500
- ret.configOBUs = byte.readToUint8();
38501
- var bitdepth;
38502
- if (ret.seqLevelIdx0 === 2 && ret.highBitdepth === 1) {
38503
- bitdepth = ret.twelveBit === 1 ? "12" : "10";
38504
- } else if (ret.seqProfile <= 2) {
38505
- bitdepth = ret.highBitdepth === 1 ? "10" : "08";
38506
- }
38507
- ret.codec = ["av01", ret.seqProfile, (ret.seqLevelIdx0 < 10 ? "0" + ret.seqLevelIdx0 : ret.seqLevelIdx0) + (ret.seqTier0 ? "H" : "M"), bitdepth].join(".");
38508
- });
38509
- }
38510
37585
  }, {
38511
37586
  key: "avc1",
38512
37587
  value: function avc1(box) {
@@ -38541,7 +37616,7 @@ var MP4Parser$1 = /* @__PURE__ */ function() {
38541
37616
  ret.ppsLength = data2[start];
38542
37617
  start += 1;
38543
37618
  ret.pps = [];
38544
- for (var _i3 = 0; _i3 < ret.ppsLength; _i3++) {
37619
+ for (var _i2 = 0; _i2 < ret.ppsLength; _i2++) {
38545
37620
  var _size = readBig16$1(data2, start);
38546
37621
  start += 2;
38547
37622
  ret.pps.push(data2.subarray(start, start += _size));
@@ -38710,7 +37785,7 @@ var MP4Parser$1 = /* @__PURE__ */ function() {
38710
37785
  start += 8;
38711
37786
  }
38712
37787
  } else {
38713
- for (var _i4 = 0; _i4 < entryCount; _i4++) {
37788
+ for (var _i3 = 0; _i3 < entryCount; _i3++) {
38714
37789
  entries5.push({
38715
37790
  count: readBig32$1(data2, start),
38716
37791
  offset: -(~readBig32$1(data2, start + 4) + 1)
@@ -38932,20 +38007,13 @@ var MP4Parser$1 = /* @__PURE__ */ function() {
38932
38007
  v.mvhdTimecale = moov.mvhd.timescale;
38933
38008
  v.timescale = v.formatTimescale = vTrack.mdia.mdhd.timescale;
38934
38009
  v.duration = vTrack.mdia.mdhd.duration || v.mvhdDurtion / v.mvhdTimecale * v.timescale;
38935
- v.rotation = vTrack.tkhd.rotation;
38936
- v.matrix = vTrack.tkhd.matrix;
38937
38010
  var e1 = vTrack.mdia.minf.stbl.stsd.entries[0];
38938
38011
  v.width = e1.width;
38939
38012
  v.height = e1.height;
38940
38013
  if (e1.pasp) {
38941
38014
  v.sarRatio = [e1.pasp.hSpacing, e1.pasp.vSpacing];
38942
38015
  }
38943
- if (e1.av1C) {
38944
- v.codecType = VideoCodecType$2.AV1;
38945
- v.codec = e1.av1C.codec;
38946
- v.av1C = e1.av1C.data;
38947
- v.colr = e1.colr.data;
38948
- } else if (e1.hvcC) {
38016
+ if (e1.hvcC) {
38949
38017
  v.codecType = VideoCodecType$2.HEVC;
38950
38018
  v.codec = e1.hvcC.codec;
38951
38019
  v.vps = e1.hvcC.vps;
@@ -39264,9 +38332,8 @@ function parseAudioSampleEntry$1(ret, data2) {
39264
38332
  function parseBox$1(box, isFullBox, parse4) {
39265
38333
  if (!box)
39266
38334
  return;
39267
- if (box.size !== box.data.length) {
38335
+ if (box.size !== box.data.length)
39268
38336
  throw new Error("box ".concat(box.type, " size !== data.length"));
39269
- }
39270
38337
  var ret = {
39271
38338
  start: box.start,
39272
38339
  size: box.size,
@@ -39305,167 +38372,11 @@ var toHex$1 = function toHex2() {
39305
38372
  var FMP4Demuxer = /* @__PURE__ */ function() {
39306
38373
  function FMP4Demuxer2(videoTrack, audioTrack, metadataTrack) {
39307
38374
  _classCallCheck$a(this, FMP4Demuxer2);
39308
- _defineProperty$8(this, "__loadedMoofWraps", []);
39309
- _defineProperty$8(this, "__lastRemainData", null);
39310
- _defineProperty$8(this, "__lastRemainDataStart", 0);
39311
- _defineProperty$8(this, "__nextMoofStart", -1);
39312
38375
  this.videoTrack = videoTrack || new VideoTrack$1();
39313
38376
  this.audioTrack = audioTrack || new AudioTrack$1();
39314
38377
  this.metadataTrack = metadataTrack || new MetadataTrack$1();
39315
38378
  }
39316
38379
  _createClass$a(FMP4Demuxer2, [{
39317
- key: "demuxPart",
39318
- value: function demuxPart(partData, partDataStart, moov) {
39319
- var _this = this;
39320
- var videoTrack = this.videoTrack, audioTrack = this.audioTrack;
39321
- var videoExist = videoTrack.exist();
39322
- var audioExist = audioTrack.exist();
39323
- var isAV01 = /av01/.test(videoTrack.codec);
39324
- videoTrack.samples = [];
39325
- audioTrack.samples = [];
39326
- var data2 = partData;
39327
- var dataStart = partDataStart;
39328
- if (this.__lastRemainData) {
39329
- var lastRemainDataEnd = this.__lastRemainDataStart + this.__lastRemainData.byteLength;
39330
- var continuous = partDataStart <= lastRemainDataEnd && partDataStart > this.__lastRemainDataStart && partDataStart + partData.byteLength > lastRemainDataEnd;
39331
- if (continuous) {
39332
- var noDuplicateData = partData.subarray(this.__lastRemainData.byteLength + this.__lastRemainDataStart - partDataStart);
39333
- data2 = concatUint8Array$3(this.__lastRemainData, noDuplicateData);
39334
- dataStart = this.__lastRemainDataStart;
39335
- this.__lastRemainData = null;
39336
- } else {
39337
- this.__lastRemainData = null;
39338
- this.__lastRemainDataStart = 0;
39339
- this.__nextMoofStart = -1;
39340
- }
39341
- }
39342
- if (!moov) {
39343
- var moovBox = MP4Parser$1.findBox(data2, ["moov"])[0];
39344
- if (!moovBox)
39345
- throw new Error("cannot found moov box");
39346
- moov = MP4Parser$1.moov(moovBox);
39347
- }
39348
- if (data2) {
39349
- var dataEnd = dataStart + data2.byteLength;
39350
- if (!videoExist && !audioExist) {
39351
- MP4Parser$1.moovToTrack(moov, videoTrack, audioTrack);
39352
- }
39353
- var moofBoxes = [];
39354
- if (this.__nextMoofStart < 0) {
39355
- MP4Parser$1.findBox(data2, ["moof"], dataStart).forEach(function(v) {
39356
- return moofBoxes.push(v);
39357
- });
39358
- } else if (this.__nextMoofStart >= dataStart && this.__nextMoofStart <= dataEnd - 8) {
39359
- MP4Parser$1.findBox(data2.subarray(this.__nextMoofStart - dataStart), ["moof"], this.__nextMoofStart).forEach(function(v) {
39360
- return moofBoxes.push(v);
39361
- });
39362
- }
39363
- moofBoxes.filter(function(moofBox) {
39364
- return moofBox.size <= moofBox.data.length;
39365
- }).forEach(function(moofBox) {
39366
- var moof = MP4Parser$1.moof(moofBox);
39367
- _this.__nextMoofStart = moof.start + Math.max.apply(Math, _toConsumableArray$6(moof.traf.map(function(v) {
39368
- return v.trun.samples.reduce(function(ret, w) {
39369
- return ret + w.size;
39370
- }, v.trun.dataOffset || 0);
39371
- })));
39372
- _this.__loadedMoofWraps.push({
39373
- start: moof.start,
39374
- nextMoofStart: _this.__nextMoofStart,
39375
- moof
39376
- });
39377
- _this.__loadedMoofWraps.sort(function(p, n) {
39378
- return p.start - n.start;
39379
- });
39380
- });
39381
- var _iterator = _createForOfIteratorHelper$1(this.__loadedMoofWraps), _step;
39382
- try {
39383
- var _loop = function _loop2() {
39384
- var moofWrap = _step.value;
39385
- if (moofWrap.start > dataEnd || moofWrap.nextMoofStart < dataStart) {
39386
- return "continue";
39387
- }
39388
- var moofStart = moofWrap.start;
39389
- var tracks = MP4Parser$1.moofToSamples(moofWrap.moof, videoTrack, audioTrack);
39390
- var videoBaseMediaDecodeTime = videoTrack.baseMediaDecodeTime;
39391
- var audioBaseMediaDecodeTime = audioTrack.baseMediaDecodeTime;
39392
- var nalSize;
39393
- Object.keys(tracks).forEach(function(k) {
39394
- if (videoTrack.id == k) {
39395
- tracks[k].some(function(x2) {
39396
- var xStart = x2.offset += moofStart;
39397
- if (xStart < dataStart) {
39398
- return;
39399
- }
39400
- if (xStart + x2.size > dataEnd) {
39401
- return true;
39402
- }
39403
- var sample = new VideoSample$1((x2.pts || x2.dts) + videoBaseMediaDecodeTime, x2.dts + videoBaseMediaDecodeTime);
39404
- sample.duration = x2.duration;
39405
- sample.gopId = x2.gopId;
39406
- if (x2.keyframe)
39407
- sample.setToKeyframe();
39408
- var sampleData = data2.subarray(xStart - dataStart, xStart - dataStart + x2.size);
39409
- sample.data = sampleData;
39410
- if (!isAV01) {
39411
- var start = 0;
39412
- var len = sampleData.length - 1;
39413
- while (start < len) {
39414
- nalSize = readBig32$1(sampleData, start);
39415
- start += 4;
39416
- sample.units.push(sampleData.subarray(start, start + nalSize));
39417
- start += nalSize;
39418
- }
39419
- }
39420
- _this.__lastRemainDataStart = xStart + x2.size;
39421
- videoTrack.samples.push(sample);
39422
- });
39423
- } else if (audioTrack.id == k) {
39424
- tracks[k].some(function(x2) {
39425
- var xStart = x2.offset + moofStart;
39426
- if (xStart < dataStart) {
39427
- return;
39428
- }
39429
- if (xStart + x2.size > dataEnd) {
39430
- return true;
39431
- }
39432
- var sampleData = data2.subarray(xStart - dataStart, xStart - dataStart + x2.size);
39433
- audioTrack.samples.push(new AudioSample$1(x2.dts + audioBaseMediaDecodeTime, sampleData, x2.duration));
39434
- _this.__lastRemainDataStart = xStart + x2.size;
39435
- });
39436
- }
39437
- });
39438
- };
39439
- for (_iterator.s(); !(_step = _iterator.n()).done; ) {
39440
- var _ret = _loop();
39441
- if (_ret === "continue")
39442
- continue;
39443
- }
39444
- } catch (err) {
39445
- _iterator.e(err);
39446
- } finally {
39447
- _iterator.f();
39448
- }
39449
- }
39450
- if (this.__lastRemainDataStart > dataStart && this.__lastRemainDataStart < data2.byteLength + dataStart) {
39451
- this.__lastRemainData = data2.subarray(this.__lastRemainDataStart - dataStart);
39452
- } else {
39453
- this.__lastRemainData = data2;
39454
- this.__lastRemainDataStart = dataStart;
39455
- }
39456
- if (videoTrack.samples.length) {
39457
- videoTrack.baseMediaDecodeTime = videoTrack.samples[0].pts;
39458
- }
39459
- if (audioTrack.samples.length) {
39460
- audioTrack.baseMediaDecodeTime = audioTrack.samples[0].pts;
39461
- }
39462
- return {
39463
- videoTrack,
39464
- audioTrack,
39465
- metadataTrack: this.metadataTrack
39466
- };
39467
- }
39468
- }, {
39469
38380
  key: "demux",
39470
38381
  value: function demux(videoData, audioData) {
39471
38382
  var videoTrack = this.videoTrack, audioTrack = this.audioTrack;
@@ -39957,16 +38868,10 @@ var MP4$3 = /* @__PURE__ */ function() {
39957
38868
  if (track.useEME && track.enca) {
39958
38869
  content = MP42.enca(track);
39959
38870
  } else {
39960
- if (track.codecType === AudioCodecType$1.OPUS) {
39961
- content = MP42.opus(track);
39962
- } else {
39963
- content = MP42.mp4a(track);
39964
- }
38871
+ content = MP42.mp4a(track);
39965
38872
  }
39966
38873
  } else if (track.useEME && track.encv) {
39967
38874
  content = MP42.encv(track);
39968
- } else if (track.av1C) {
39969
- content = MP42.av01(track);
39970
38875
  } else {
39971
38876
  content = MP42.avc1hev1(track);
39972
38877
  }
@@ -40179,90 +39084,6 @@ var MP4$3 = /* @__PURE__ */ function() {
40179
39084
  var schi = MP42.schi(data2);
40180
39085
  return MP42.box(MP42.types.sinf, content, MP42.box(MP42.types.frma, frma), MP42.box(MP42.types.schm, schm), schi);
40181
39086
  }
40182
- }, {
40183
- key: "av01",
40184
- value: function av01(track) {
40185
- return MP42.box(MP42.types.av01, new Uint8Array([
40186
- 0,
40187
- 0,
40188
- 0,
40189
- 0,
40190
- 0,
40191
- 0,
40192
- 0,
40193
- 1,
40194
- 0,
40195
- 0,
40196
- 0,
40197
- 0,
40198
- 0,
40199
- 0,
40200
- 0,
40201
- 0,
40202
- 0,
40203
- 0,
40204
- 0,
40205
- 0,
40206
- 0,
40207
- 0,
40208
- 0,
40209
- 0,
40210
- track.width >> 8 & 255,
40211
- track.width & 255,
40212
- track.height >> 8 & 255,
40213
- track.height & 255,
40214
- 0,
40215
- 72,
40216
- 0,
40217
- 0,
40218
- 0,
40219
- 72,
40220
- 0,
40221
- 0,
40222
- 0,
40223
- 0,
40224
- 0,
40225
- 0,
40226
- 0,
40227
- 1,
40228
- 0,
40229
- 0,
40230
- 0,
40231
- 0,
40232
- 0,
40233
- 0,
40234
- 0,
40235
- 0,
40236
- 0,
40237
- 0,
40238
- 0,
40239
- 0,
40240
- 0,
40241
- 0,
40242
- 0,
40243
- 0,
40244
- 0,
40245
- 0,
40246
- 0,
40247
- 0,
40248
- 0,
40249
- 0,
40250
- 0,
40251
- 0,
40252
- 0,
40253
- 0,
40254
- 0,
40255
- 0,
40256
- 0,
40257
- 0,
40258
- 0,
40259
- 0,
40260
- 0,
40261
- 24,
40262
- 17,
40263
- 17
40264
- ]), track.av1C, track.colr);
40265
- }
40266
39087
  }, {
40267
39088
  key: "avc1hev1",
40268
39089
  value: function avc1hev1(track) {
@@ -40633,53 +39454,6 @@ var MP4$3 = /* @__PURE__ */ function() {
40633
39454
  )));
40634
39455
  return esds2;
40635
39456
  }
40636
- }, {
40637
- key: "opus",
40638
- value: function opus(track) {
40639
- var opusAudioDescription = new Uint8Array([
40640
- 0,
40641
- 0,
40642
- 0,
40643
- 0,
40644
- 0,
40645
- 0,
40646
- 0,
40647
- 1,
40648
- 0,
40649
- 0,
40650
- 0,
40651
- 0,
40652
- 0,
40653
- 0,
40654
- 0,
40655
- 0,
40656
- 0,
40657
- track.channelCount,
40658
- 0,
40659
- 16,
40660
- 0,
40661
- 0,
40662
- 0,
40663
- 0,
40664
- track.sampleRate >> 8 & 255,
40665
- track.sampleRate & 255,
40666
- 0,
40667
- 0
40668
- ]);
40669
- var opusSpecificConfig = track.config.length ? MP42.dOps(track) : [];
40670
- return MP42.box(MP42.types.Opus, opusAudioDescription, opusSpecificConfig);
40671
- }
40672
- }, {
40673
- key: "dOps",
40674
- value: function dOps(track) {
40675
- if (track.config) {
40676
- track.config[4] = track.sampleRate >>> 24 & 255;
40677
- track.config[5] = track.sampleRate >>> 16 & 255;
40678
- track.config[6] = track.sampleRate >>> 8 & 255;
40679
- track.config[7] = track.sampleRate & 255;
40680
- return MP42.box(MP42.types.dOps, track.config);
40681
- }
40682
- }
40683
39457
  }, {
40684
39458
  key: "mvex",
40685
39459
  value: function mvex(tracks) {
@@ -41282,7 +40056,7 @@ var MP4$3 = /* @__PURE__ */ function() {
41282
40056
  }]);
41283
40057
  return MP42;
41284
40058
  }();
41285
- _defineProperty$8(MP4$3, "types", ["Opus", "dOps", "av01", "av1C", "avc1", "avcC", "hvc1", "hvcC", "dinf", "dref", "esds", "ftyp", "hdlr", "mdat", "mdhd", "mdia", "mfhd", "minf", "moof", "moov", "mp4a", "mvex", "mvhd", "pasp", "stbl", "stco", "stsc", "stsd", "stsz", "stts", "tfdt", "tfhd", "traf", "trak", "trex", "tkhd", "vmhd", "smhd", "ctts", "stss", "styp", "pssh", "sidx", "sbgp", "saiz", "saio", "senc", "trun", "encv", "enca", "sinf", "btrt", "frma", "tenc", "schm", "schi", "mehd", "fiel", "sdtp"].reduce(function(p, c) {
40059
+ _defineProperty$8(MP4$3, "types", ["avc1", "avcC", "hvc1", "hvcC", "dinf", "dref", "esds", "ftyp", "hdlr", "mdat", "mdhd", "mdia", "mfhd", "minf", "moof", "moov", "mp4a", "mvex", "mvhd", "pasp", "stbl", "stco", "stsc", "stsd", "stsz", "stts", "tfdt", "tfhd", "traf", "trak", "trex", "tkhd", "vmhd", "smhd", "ctts", "stss", "styp", "pssh", "sidx", "sbgp", "saiz", "saio", "senc", "trun", "encv", "enca", "sinf", "btrt", "frma", "tenc", "schm", "schi", "mehd", "fiel", "sdtp"].reduce(function(p, c) {
41286
40060
  p[c] = [c.charCodeAt(0), c.charCodeAt(1), c.charCodeAt(2), c.charCodeAt(3)];
41287
40061
  return p;
41288
40062
  }, /* @__PURE__ */ Object.create(null)));
@@ -41617,46 +40391,30 @@ var FMP4Remuxer$2 = /* @__PURE__ */ function() {
41617
40391
  };
41618
40392
  }
41619
40393
  var samples = track.samples;
41620
- var isAV01 = /av01/.test(track.codec);
41621
40394
  var mdatSize = 0;
41622
- if (isAV01) {
41623
- samples.forEach(function(s) {
41624
- mdatSize += s.data.byteLength;
41625
- });
41626
- } else {
41627
- samples.forEach(function(s) {
41628
- mdatSize += s.units.reduce(function(t, c) {
41629
- return t + c.byteLength;
41630
- }, 0);
41631
- mdatSize += s.units.length * 4;
41632
- });
41633
- }
40395
+ samples.forEach(function(s) {
40396
+ mdatSize += s.units.reduce(function(t, c) {
40397
+ return t + c.byteLength;
40398
+ }, 0);
40399
+ mdatSize += s.units.length * 4;
40400
+ });
41634
40401
  var mdata = new Uint8Array(mdatSize);
41635
- if (isAV01) {
41636
- for (var i = 0, l = samples.length, offset = 0, sample; i < l; i++) {
41637
- sample = samples[i];
41638
- mdata.set(sample.data, offset);
41639
- sample.size = sample.data.byteLength;
41640
- offset += sample.size;
41641
- }
41642
- } else {
41643
- var mdatView = new DataView(mdata.buffer);
41644
- var _loop = function _loop2(_offset2, _sample2) {
41645
- _sample2 = samples[_i];
41646
- var sampleSize = 0;
41647
- _sample2.units.forEach(function(u) {
41648
- mdatView.setUint32(_offset2, u.byteLength);
41649
- _offset2 += 4;
41650
- mdata.set(u, _offset2);
41651
- _offset2 += u.byteLength;
41652
- sampleSize += 4 + u.byteLength;
41653
- });
41654
- _sample2.size = sampleSize;
41655
- _offset = _offset2, _sample = _sample2;
41656
- };
41657
- for (var _i = 0, _l = samples.length, _offset = 0, _sample; _i < _l; _i++) {
41658
- _loop(_offset, _sample);
41659
- }
40402
+ var mdatView = new DataView(mdata.buffer);
40403
+ var _loop = function _loop2(_offset, _sample) {
40404
+ _sample = samples[i];
40405
+ var sampleSize = 0;
40406
+ _sample.units.forEach(function(u) {
40407
+ mdatView.setUint32(_offset, u.byteLength);
40408
+ _offset += 4;
40409
+ mdata.set(u, _offset);
40410
+ _offset += u.byteLength;
40411
+ sampleSize += 4 + u.byteLength;
40412
+ });
40413
+ _sample.size = sampleSize;
40414
+ offset = _offset, sample = _sample;
40415
+ };
40416
+ for (var i = 0, l = samples.length, offset = 0, sample; i < l; i++) {
40417
+ _loop(offset, sample);
41660
40418
  }
41661
40419
  var mdat = MP4$3.mdat(mdata);
41662
40420
  var moof = MP4$3.moof([track]);
@@ -41815,11 +40573,11 @@ var Event$1 = _objectSpread2$5(_objectSpread2$5({}, EVENT$1), {}, {
41815
40573
  });
41816
40574
  var logger$4 = new Logger$6("Transmuxer");
41817
40575
  var Transmuxer = /* @__PURE__ */ function() {
41818
- function Transmuxer2(hls, isMP4, needRemux, fixerConfig) {
40576
+ function Transmuxer2(hls, isMP4, needRemux) {
41819
40577
  _classCallCheck$c(this, Transmuxer2);
41820
40578
  _defineProperty$a(this, "_initSegmentId", "");
41821
40579
  this.hls = hls;
41822
- this._demuxer = isMP4 ? new FMP4Demuxer() : new TsDemuxer(null, null, null, fixerConfig);
40580
+ this._demuxer = isMP4 ? new FMP4Demuxer() : new TsDemuxer();
41823
40581
  this._isMP4 = isMP4;
41824
40582
  if (needRemux)
41825
40583
  this._remuxer = new FMP4Remuxer$2(this._demuxer.videoTrack, this._demuxer.audioTrack);
@@ -41974,7 +40732,7 @@ var Transmuxer = /* @__PURE__ */ function() {
41974
40732
  }]);
41975
40733
  return Transmuxer2;
41976
40734
  }();
41977
- var _excluded$3 = ["data"], _excluded2 = ["data"];
40735
+ var _excluded$2 = ["data"], _excluded2 = ["data"];
41978
40736
  var logger$3 = new Logger$6("BufferService");
41979
40737
  var BufferService = /* @__PURE__ */ function() {
41980
40738
  function BufferService2(hls) {
@@ -42086,11 +40844,11 @@ var BufferService = /* @__PURE__ */ function() {
42086
40844
  return;
42087
40845
  if (TsDemuxer.probe(chunk)) {
42088
40846
  if (!this._transmuxer)
42089
- this._transmuxer = new Transmuxer(this.hls, false, !this._softVideo, this.hls.config.fixerConfig);
40847
+ this._transmuxer = new Transmuxer(this.hls, false, !this._softVideo);
42090
40848
  } else if (MP4Parser$1.probe(chunk)) {
42091
40849
  if (this._softVideo) {
42092
40850
  if (!this._transmuxer)
42093
- this._transmuxer = new Transmuxer(this.hls, true, null, this.hls.config.fixerConfig);
40851
+ this._transmuxer = new Transmuxer(this.hls, true);
42094
40852
  } else {
42095
40853
  this._directAppend = true;
42096
40854
  var mix = false;
@@ -42140,8 +40898,7 @@ var BufferService = /* @__PURE__ */ function() {
42140
40898
  key: "appendBuffer",
42141
40899
  value: function() {
42142
40900
  var _appendBuffer = _asyncToGenerator$6(/* @__PURE__ */ _regeneratorRuntime$6().mark(function _callee2(segment, audioSegment, videoChunk, audioChunk, discontinuity, contiguous, startTime) {
42143
- var _this2 = this;
42144
- var afterAppend, p, needInit, _this$_transmuxer$tra, _this$_transmuxer$tra2, video, audio, isFirstAppend, mse, _p, videoData, videoRest, audioData, audioRest;
40901
+ var p, needInit, _this$_transmuxer$tra, _this$_transmuxer$tra2, video, audio, isFirstAppend, mse, _p, videoData, videoRest, audioData, audioRest;
42145
40902
  return _regeneratorRuntime$6().wrap(function _callee2$(_context2) {
42146
40903
  while (1)
42147
40904
  switch (_context2.prev = _context2.next) {
@@ -42152,18 +40909,8 @@ var BufferService = /* @__PURE__ */ function() {
42152
40909
  }
42153
40910
  return _context2.abrupt("return");
42154
40911
  case 2:
42155
- afterAppend = function afterAppend2() {
42156
- var _this2$hls;
42157
- if ((_this2$hls = _this2.hls) !== null && _this2$hls !== void 0 && _this2$hls.emit) {
42158
- var _this2$hls2;
42159
- (_this2$hls2 = _this2.hls) === null || _this2$hls2 === void 0 ? void 0 : _this2$hls2.emit(EVENT$1.APPEND_BUFFER, {
42160
- start: segment.start,
42161
- end: segment.end
42162
- });
42163
- }
42164
- };
42165
40912
  if (!this._directAppend) {
42166
- _context2.next = 8;
40913
+ _context2.next = 7;
42167
40914
  break;
42168
40915
  }
42169
40916
  p = [];
@@ -42171,8 +40918,8 @@ var BufferService = /* @__PURE__ */ function() {
42171
40918
  p.push(this._mse.append(MSE$2.VIDEO, videoChunk));
42172
40919
  if (audioChunk)
42173
40920
  p.push(this._mse.append(MSE$2.AUDIO, audioChunk));
42174
- return _context2.abrupt("return", Promise.all(p).then(afterAppend));
42175
- case 8:
40921
+ return _context2.abrupt("return", Promise.all(p));
40922
+ case 7:
42176
40923
  needInit = this._needInitSegment || discontinuity;
42177
40924
  _this$_transmuxer$tra = this._transmuxer.transmux(videoChunk, audioChunk, needInit, contiguous, startTime, this._needInitSegment || discontinuity), _this$_transmuxer$tra2 = _slicedToArray$5(_this$_transmuxer$tra, 2), video = _this$_transmuxer$tra2[0], audio = _this$_transmuxer$tra2[1];
42178
40925
  if (audioChunk && audioSegment) {
@@ -42188,17 +40935,16 @@ var BufferService = /* @__PURE__ */ function() {
42188
40935
  this.hls.emit(Event$1.NO_AUDIO_TRACK);
42189
40936
  }
42190
40937
  if (!this._softVideo) {
42191
- _context2.next = 20;
40938
+ _context2.next = 18;
42192
40939
  break;
42193
40940
  }
42194
40941
  this._softVideo.appendBuffer(video, audio);
42195
40942
  this._needInitSegment = false;
42196
- afterAppend();
42197
- _context2.next = 30;
40943
+ _context2.next = 28;
42198
40944
  break;
42199
- case 20:
40945
+ case 18:
42200
40946
  if (!this._mse) {
42201
- _context2.next = 30;
40947
+ _context2.next = 28;
42202
40948
  break;
42203
40949
  }
42204
40950
  isFirstAppend = !this._sourceCreated;
@@ -42214,15 +40960,15 @@ var BufferService = /* @__PURE__ */ function() {
42214
40960
  });
42215
40961
  }
42216
40962
  if (video) {
42217
- videoData = video.data, videoRest = _objectWithoutProperties$3(video, _excluded$3);
40963
+ videoData = video.data, videoRest = _objectWithoutProperties$3(video, _excluded$2);
42218
40964
  _p.push(mse.append(MSE$2.VIDEO, videoData, videoRest));
42219
40965
  }
42220
40966
  if (audio) {
42221
40967
  audioData = audio.data, audioRest = _objectWithoutProperties$3(audio, _excluded2);
42222
40968
  _p.push(mse.append(MSE$2.AUDIO, audioData, audioRest));
42223
40969
  }
42224
- return _context2.abrupt("return", Promise.all(_p).then(afterAppend));
42225
- case 30:
40970
+ return _context2.abrupt("return", Promise.all(_p));
40971
+ case 28:
42226
40972
  case "end":
42227
40973
  return _context2.stop();
42228
40974
  }
@@ -42237,7 +40983,7 @@ var BufferService = /* @__PURE__ */ function() {
42237
40983
  key: "removeBuffer",
42238
40984
  value: function() {
42239
40985
  var _removeBuffer = _asyncToGenerator$6(/* @__PURE__ */ _regeneratorRuntime$6().mark(function _callee3() {
42240
- var _this3 = this;
40986
+ var _this2 = this;
42241
40987
  var start, end, media, _args3 = arguments;
42242
40988
  return _regeneratorRuntime$6().wrap(function _callee3$(_context3) {
42243
40989
  while (1)
@@ -42253,7 +40999,7 @@ var BufferService = /* @__PURE__ */ function() {
42253
40999
  return _context3.abrupt("return");
42254
41000
  case 5:
42255
41001
  return _context3.abrupt("return", this._mse.clearBuffer(start, end).then(function() {
42256
- return _this3.hls.emit(EVENT$1.REMOVE_BUFFER, {
41002
+ return _this2.hls.emit(EVENT$1.REMOVE_BUFFER, {
42257
41003
  start,
42258
41004
  end,
42259
41005
  removeEnd: end
@@ -42434,51 +41180,30 @@ var BufferService = /* @__PURE__ */ function() {
42434
41180
  return setLiveSeekableRange;
42435
41181
  }()
42436
41182
  }, {
42437
- key: "detachMedia",
41183
+ key: "destroy",
42438
41184
  value: function() {
42439
- var _detachMedia = _asyncToGenerator$6(/* @__PURE__ */ _regeneratorRuntime$6().mark(function _callee9() {
41185
+ var _destroy = _asyncToGenerator$6(/* @__PURE__ */ _regeneratorRuntime$6().mark(function _callee9() {
41186
+ var _this$_decryptor;
42440
41187
  return _regeneratorRuntime$6().wrap(function _callee9$(_context9) {
42441
41188
  while (1)
42442
41189
  switch (_context9.prev = _context9.next) {
42443
41190
  case 0:
41191
+ (_this$_decryptor = this._decryptor) === null || _this$_decryptor === void 0 ? void 0 : _this$_decryptor.destroy();
42444
41192
  if (!this._mse) {
42445
- _context9.next = 3;
41193
+ _context9.next = 4;
42446
41194
  break;
42447
41195
  }
42448
- _context9.next = 3;
41196
+ _context9.next = 4;
42449
41197
  return this._mse.unbindMedia();
42450
- case 3:
42451
- case "end":
42452
- return _context9.stop();
42453
- }
42454
- }, _callee9, this);
42455
- }));
42456
- function detachMedia() {
42457
- return _detachMedia.apply(this, arguments);
42458
- }
42459
- return detachMedia;
42460
- }()
42461
- }, {
42462
- key: "destroy",
42463
- value: function() {
42464
- var _destroy = _asyncToGenerator$6(/* @__PURE__ */ _regeneratorRuntime$6().mark(function _callee10() {
42465
- var _this$_decryptor;
42466
- return _regeneratorRuntime$6().wrap(function _callee10$(_context10) {
42467
- while (1)
42468
- switch (_context10.prev = _context10.next) {
42469
- case 0:
42470
- (_this$_decryptor = this._decryptor) === null || _this$_decryptor === void 0 ? void 0 : _this$_decryptor.destroy();
42471
- _context10.next = 3;
42472
- return this.detachMedia();
42473
- case 3:
41198
+ case 4:
42474
41199
  this._decryptor = null;
42475
41200
  this._mse = null;
42476
41201
  this._softVideo = null;
42477
- case 6:
41202
+ case 7:
42478
41203
  case "end":
42479
- return _context10.stop();
41204
+ return _context9.stop();
42480
41205
  }
42481
- }, _callee10, this);
41206
+ }, _callee9, this);
42482
41207
  }));
42483
41208
  function destroy() {
42484
41209
  return _destroy.apply(this, arguments);
@@ -42566,11 +41291,7 @@ function getConfig$2(cfg) {
42566
41291
  minSegmentsStartPlay: 3,
42567
41292
  preferMMS: false,
42568
41293
  preferMMSStreaming: false,
42569
- mseLowLatency: true,
42570
- fixerConfig: {
42571
- forceFixLargeGap: false,
42572
- largeGapThreshold: 5
42573
- }
41294
+ mseLowLatency: true
42574
41295
  }, cfg), {}, {
42575
41296
  media
42576
41297
  });
@@ -42685,8 +41406,6 @@ var MediaPlaylist = /* @__PURE__ */ _createClass$c(function MediaPlaylist2() {
42685
41406
  _defineProperty$a(this, "lowLatency", false);
42686
41407
  _defineProperty$a(this, "endPartIndex", 0);
42687
41408
  _defineProperty$a(this, "segments", []);
42688
- _defineProperty$a(this, "dateRanges", {});
42689
- _defineProperty$a(this, "skippedSegments", 0);
42690
41409
  });
42691
41410
  var MediaSegment = /* @__PURE__ */ function() {
42692
41411
  function MediaSegment2(parentUrl) {
@@ -42858,38 +41577,6 @@ function getCodecs(type, codecs) {
42858
41577
  }
42859
41578
  }
42860
41579
  }
42861
- function isValidDaterange(attr, dateRangeWithSameId) {
42862
- var _badValueForSameId;
42863
- if (dateRangeWithSameId) {
42864
- for (var key2 in dateRangeWithSameId) {
42865
- if (Object.prototype.hasOwnProperty.call(dateRangeWithSameId, key2) && attr[key2] !== dateRangeWithSameId[key2]) {
42866
- _badValueForSameId = key2;
42867
- break;
42868
- }
42869
- }
42870
- }
42871
- var duration = null;
42872
- if (attr.DURATION) {
42873
- duration = parseFloat(attr.DURATION);
42874
- if (!Number.isFinite(duration)) {
42875
- duration = null;
42876
- } else if (attr._endDate) {
42877
- duration = (attr._endDate.getTime() - attr._startDate.getTime()) / 1e3;
42878
- }
42879
- }
42880
- var cue = enumeratedStringList(attr.CUE || attr["X-CUE"], {
42881
- pre: false,
42882
- post: false,
42883
- once: false
42884
- });
42885
- return !!attr.ID && !_badValueForSameId && Number.isFinite(attr._startDate.getTime()) && (duration === null || duration >= 0) && (!(attr.END_ON_NEXT === "YES") || !!attr.CLASS) && (!attr.CUE || !cue.pre && !cue.post || cue.pre !== cue.post) && (!(attr.CLASS === "com.apple.hls.interstitial") || "X-ASSET-URI" in attr || "X-ASSET-LIST" in attr);
42886
- }
42887
- function enumeratedStringList(attrValue, dict) {
42888
- return (attrValue ? attrValue.split(/[ ,]+/) : []).reduce(function(result, identifier) {
42889
- result[identifier.toLowerCase()] = true;
42890
- return result;
42891
- }, dict);
42892
- }
42893
41580
  function parseMasterPlaylist(lines, parentUrl) {
42894
41581
  var master = new MasterPlaylist();
42895
41582
  var index2 = 0;
@@ -42998,6 +41685,9 @@ function parseMediaPlaylist(lines, parentUrl, useLowLatency) {
42998
41685
  var endOfList = false;
42999
41686
  var partSegmentIndex = 0;
43000
41687
  while (line = lines[index2++]) {
41688
+ if (endOfList) {
41689
+ break;
41690
+ }
43001
41691
  if (line[0] !== "#") {
43002
41692
  if (media.lowLatency) {
43003
41693
  curSN++;
@@ -43051,6 +41741,11 @@ function parseMediaPlaylist(lines, parentUrl, useLowLatency) {
43051
41741
  break;
43052
41742
  case "ENDLIST":
43053
41743
  {
41744
+ var _lastSegment = media.segments[media.segments.length - 1];
41745
+ if (_lastSegment) {
41746
+ _lastSegment.isLast = true;
41747
+ }
41748
+ media.live = false;
43054
41749
  endOfList = true;
43055
41750
  }
43056
41751
  break;
@@ -43147,29 +41842,6 @@ function parseMediaPlaylist(lines, parentUrl, useLowLatency) {
43147
41842
  curSegment = new MediaSegment(parentUrl);
43148
41843
  }
43149
41844
  break;
43150
- case "SKIP":
43151
- {
43152
- var _attr5 = parseAttr(data2);
43153
- var skippedSegments = parseInt(_attr5["SKIPPED-SEGMENTS"], 10);
43154
- if (skippedSegments <= Number.MAX_SAFE_INTEGER) {
43155
- media.skippedSegments += skippedSegments;
43156
- }
43157
- }
43158
- break;
43159
- case "DATERANGE":
43160
- {
43161
- var _attr6 = parseAttr(data2);
43162
- var dateRangeWithSameId = media.dateRanges[_attr6.ID];
43163
- _attr6._startDate = dateRangeWithSameId ? dateRangeWithSameId._startDate : new Date(_attr6["START-DATE"]);
43164
- var endDate = (dateRangeWithSameId === null || dateRangeWithSameId === void 0 ? void 0 : dateRangeWithSameId._endDate) || new Date(_attr6.END_DATE);
43165
- if (Number.isFinite(endDate)) {
43166
- _attr6._endDate = endDate;
43167
- }
43168
- if (isValidDaterange(_attr6, dateRangeWithSameId) || media.skippedSegments) {
43169
- media.dateRanges[_attr6.ID] = _attr6;
43170
- }
43171
- }
43172
- break;
43173
41845
  }
43174
41846
  }
43175
41847
  media.segments = media.segments.filter(function(x2) {
@@ -43177,14 +41849,11 @@ function parseMediaPlaylist(lines, parentUrl, useLowLatency) {
43177
41849
  });
43178
41850
  var lastSegment = media.segments[media.segments.length - 1];
43179
41851
  if (lastSegment) {
43180
- if (endOfList) {
43181
- lastSegment.isLast = true;
43182
- }
43183
41852
  media.endSN = lastSegment.sn;
43184
41853
  media.endPartIndex = lastSegment.partIndex;
43185
- }
43186
- if (endOfList) {
43187
- media.live = false;
41854
+ if (endOfList && !lastSegment.isLast) {
41855
+ lastSegment.isLast = true;
41856
+ }
43188
41857
  }
43189
41858
  media.totalDuration = totalDuration;
43190
41859
  media.endCC = curCC;
@@ -44281,7 +42950,7 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
44281
42950
  _defineProperty$a(_assertThisInitialized$9(_this), "_switchUrlOpts", null);
44282
42951
  _defineProperty$a(_assertThisInitialized$9(_this), "_isProcessQuotaExceeded", false);
44283
42952
  _defineProperty$a(_assertThisInitialized$9(_this), "_loadSegment", /* @__PURE__ */ _asyncToGenerator$6(/* @__PURE__ */ _regeneratorRuntime$6().mark(function _callee() {
44284
- var _this$_playlist, nextSegment, lastSegment, _assertThisInitialize, config, minFrameDuration, maxBufferThroughout, bInfo, bufferThroughout;
42953
+ var nextSeg, _assertThisInitialize, config, bInfo, bufferThroughout;
44285
42954
  return _regeneratorRuntime$6().wrap(function _callee$(_context) {
44286
42955
  while (1)
44287
42956
  switch (_context.prev = _context.next) {
@@ -44292,44 +42961,42 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
44292
42961
  }
44293
42962
  return _context.abrupt("return");
44294
42963
  case 2:
44295
- _this$_playlist = _this._playlist, nextSegment = _this$_playlist.nextSegment, lastSegment = _this$_playlist.lastSegment;
42964
+ nextSeg = _this._playlist.nextSegment;
44296
42965
  _assertThisInitialize = _assertThisInitialized$9(_this), config = _assertThisInitialize.config;
44297
- minFrameDuration = 0.016;
44298
- maxBufferThroughout = Math.min(Math.max((lastSegment === null || lastSegment === void 0 ? void 0 : lastSegment.duration) - minFrameDuration / 2 || 0, minFrameDuration), 0.1);
44299
- if (nextSegment) {
44300
- _context.next = 8;
42966
+ if (nextSeg) {
42967
+ _context.next = 6;
44301
42968
  break;
44302
42969
  }
44303
42970
  return _context.abrupt("return");
44304
- case 8:
42971
+ case 6:
44305
42972
  if (_this.isLive) {
44306
- _context.next = 18;
42973
+ _context.next = 16;
44307
42974
  break;
44308
42975
  }
44309
42976
  bInfo = _this.bufferInfo();
44310
42977
  if (_this.media.paused && !_this.media.currentTime) {
44311
42978
  bInfo = _this.bufferInfo(bInfo.nextStart || 0.5);
44312
42979
  }
44313
- bufferThroughout = Math.abs(bInfo.end - _this.media.duration) < maxBufferThroughout;
42980
+ bufferThroughout = Math.abs(bInfo.end - _this.media.duration) < 0.1;
44314
42981
  if (!(bInfo.remaining >= config.preloadTime || bufferThroughout)) {
44315
- _context.next = 15;
42982
+ _context.next = 13;
44316
42983
  break;
44317
42984
  }
44318
42985
  _this._tryEos();
44319
42986
  return _context.abrupt("return");
44320
- case 15:
42987
+ case 13:
44321
42988
  if (!(config.preferMMSStreaming && !_this._bufferService.msStreaming)) {
44322
- _context.next = 17;
42989
+ _context.next = 15;
44323
42990
  break;
44324
42991
  }
44325
42992
  return _context.abrupt("return");
44326
- case 17:
44327
- if (!_this._urlSwitching && _this._prevSegSn !== nextSegment.sn - 1 && bInfo.end && Math.abs(nextSegment.start - bInfo.end) > 1) {
42993
+ case 15:
42994
+ if (!_this._urlSwitching && _this._prevSegSn !== nextSeg.sn - 1 && bInfo.end && Math.abs(nextSeg.start - bInfo.end) > 1) {
44328
42995
  _this._playlist.setNextSegmentByIndex(_this._playlist.findSegmentIndexByTime(bInfo.end + 0.1));
44329
42996
  }
44330
- case 18:
42997
+ case 16:
44331
42998
  return _context.abrupt("return", _this._loadSegmentDirect());
44332
- case 19:
42999
+ case 17:
44333
43000
  case "end":
44334
43001
  return _context.stop();
44335
43002
  }
@@ -44577,12 +43244,6 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
44577
43244
  var _this$_bufferService;
44578
43245
  return (_this$_bufferService = this._bufferService) === null || _this$_bufferService === void 0 ? void 0 : _this$_bufferService.baseDts;
44579
43246
  }
44580
- }, {
44581
- key: "abrSwitchPoint",
44582
- get: function get3() {
44583
- var targetSeg = this._urlSwitching ? this._playlist.currentSegment : this._playlist.nextSegment;
44584
- return targetSeg ? targetSeg.start + targetSeg.duration / 2 : null;
44585
- }
44586
43247
  }, {
44587
43248
  key: "speedInfo",
44588
43249
  value: function speedInfo() {
@@ -44608,37 +43269,30 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
44608
43269
  }, {
44609
43270
  key: "load",
44610
43271
  value: function() {
44611
- var _load = _asyncToGenerator$6(/* @__PURE__ */ _regeneratorRuntime$6().mark(function _callee4() {
44612
- var url, options, reuseMse, _args4 = arguments;
43272
+ var _load = _asyncToGenerator$6(/* @__PURE__ */ _regeneratorRuntime$6().mark(function _callee4(url) {
43273
+ var reuseMse, _args4 = arguments;
44613
43274
  return _regeneratorRuntime$6().wrap(function _callee4$(_context4) {
44614
43275
  while (1)
44615
43276
  switch (_context4.prev = _context4.next) {
44616
43277
  case 0:
44617
- url = _args4.length > 0 && _args4[0] !== void 0 ? _args4[0] : "";
44618
- options = _args4.length > 1 && _args4[1] !== void 0 ? _args4[1] : {};
44619
- reuseMse = typeof options === "boolean" ? options : !!(options !== null && options !== void 0 && options.reuseMse);
44620
- if (_typeof$5(options) === "object" && options !== null && options !== void 0 && options.clearSwitchStatus) {
44621
- this._urlSwitching = false;
44622
- this._switchUrlOpts = null;
44623
- this.config.startTime = void 0;
44624
- }
43278
+ reuseMse = _args4.length > 1 && _args4[1] !== void 0 ? _args4[1] : false;
44625
43279
  if (url)
44626
43280
  this.config.url = url;
44627
43281
  url = this.config.url;
44628
- _context4.next = 8;
43282
+ _context4.next = 5;
44629
43283
  return this._reset(reuseMse);
44630
- case 8:
44631
- _context4.next = 10;
43284
+ case 5:
43285
+ _context4.next = 7;
44632
43286
  return this._loadData(url);
44633
- case 10:
43287
+ case 7:
44634
43288
  this._startTick();
44635
- case 11:
43289
+ case 8:
44636
43290
  case "end":
44637
43291
  return _context4.stop();
44638
43292
  }
44639
43293
  }, _callee4, this);
44640
43294
  }));
44641
- function load() {
43295
+ function load(_x) {
44642
43296
  return _load.apply(this, arguments);
44643
43297
  }
44644
43298
  return load;
@@ -44647,7 +43301,7 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
44647
43301
  key: "_loadData",
44648
43302
  value: function() {
44649
43303
  var _loadData2 = _asyncToGenerator$6(/* @__PURE__ */ _regeneratorRuntime$6().mark(function _callee5(url) {
44650
- var manifest, currentStream, preIndex, _this$_switchUrlOpts, _this$_switchUrlOpts3, _this$_switchUrlOpts4, _this$_switchUrlOpts2, switchTimePoint, segIdx, nextSeg, bufferClearStartPoint, startTime, _this$_switchUrlOpts5;
43304
+ var manifest, currentStream, _this$_switchUrlOpts, _this$_switchUrlOpts2, switchTimePoint, segIdx, nextSeg, bufferClearStartPoint, preIndex, startTime, _this$_switchUrlOpts3;
44651
43305
  return _regeneratorRuntime$6().wrap(function _callee5$(_context5) {
44652
43306
  while (1)
44653
43307
  switch (_context5.prev = _context5.next) {
@@ -44668,46 +43322,41 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
44668
43322
  case 5:
44669
43323
  manifest = _context5.sent;
44670
43324
  currentStream = this._playlist.currentStream;
44671
- if (!this._urlSwitching) {
44672
- _context5.next = 23;
43325
+ if (!(this._urlSwitching && !this.isLive)) {
43326
+ _context5.next = 17;
44673
43327
  break;
44674
43328
  }
44675
- if (!this.isLive) {
44676
- _context5.next = 14;
44677
- break;
44678
- }
44679
- preIndex = this._playlist.setNextSegmentBySN(this._prevSegSn);
44680
- logger$1.log("segment nb=".concat(this._prevSegSn, " index of ").concat(preIndex, " in the new playlist"));
44681
- if (preIndex === -1) {
44682
- this._prevSegCc = null;
44683
- this._prevSegSn = null;
44684
- }
44685
- _context5.next = 23;
44686
- break;
44687
- case 14:
44688
43329
  if (currentStream.bitrate === 0 && (_this$_switchUrlOpts = this._switchUrlOpts) !== null && _this$_switchUrlOpts !== void 0 && _this$_switchUrlOpts.bitrate) {
44689
43330
  currentStream.bitrate = (_this$_switchUrlOpts2 = this._switchUrlOpts) === null || _this$_switchUrlOpts2 === void 0 ? void 0 : _this$_switchUrlOpts2.bitrate;
44690
43331
  }
44691
- switchTimePoint = typeof ((_this$_switchUrlOpts3 = this._switchUrlOpts) === null || _this$_switchUrlOpts3 === void 0 ? void 0 : _this$_switchUrlOpts3.startTime) === "number" ? (_this$_switchUrlOpts4 = this._switchUrlOpts) === null || _this$_switchUrlOpts4 === void 0 ? void 0 : _this$_switchUrlOpts4.startTime : this._getSeamlessSwitchPoint();
43332
+ switchTimePoint = this._getSeamlessSwitchPoint();
44692
43333
  this.config.startTime = switchTimePoint;
44693
43334
  segIdx = this._playlist.findSegmentIndexByTime(switchTimePoint);
44694
43335
  nextSeg = this._playlist.getSegmentByIndex(segIdx + 1);
44695
43336
  if (!nextSeg) {
44696
- _context5.next = 23;
43337
+ _context5.next = 17;
44697
43338
  break;
44698
43339
  }
44699
43340
  bufferClearStartPoint = nextSeg.start;
44700
- _context5.next = 23;
43341
+ _context5.next = 17;
44701
43342
  return this._bufferService.removeBuffer(bufferClearStartPoint);
44702
- case 23:
43343
+ case 17:
43344
+ if (this._urlSwitching && this.isLive) {
43345
+ preIndex = this._playlist.setNextSegmentBySN(this._prevSegSn);
43346
+ logger$1.log("segment nb=".concat(this._prevSegSn, " index of ").concat(preIndex, " in the new playlist"));
43347
+ if (preIndex === -1) {
43348
+ this._prevSegCc = null;
43349
+ this._prevSegSn = null;
43350
+ }
43351
+ }
44703
43352
  if (manifest) {
44704
- _context5.next = 25;
43353
+ _context5.next = 20;
44705
43354
  break;
44706
43355
  }
44707
43356
  return _context5.abrupt("return");
44708
- case 25:
43357
+ case 20:
44709
43358
  if (!this.isLive) {
44710
- _context5.next = 36;
43359
+ _context5.next = 31;
44711
43360
  break;
44712
43361
  }
44713
43362
  this._bufferService.setLiveSeekableRange(0, 4294967295);
@@ -44720,35 +43369,35 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
44720
43369
  if (!manifest.isMaster)
44721
43370
  this._pollM3U8(url);
44722
43371
  if (!(this._playlist.nbSegments < this.config.minSegmentsStartPlay)) {
44723
- _context5.next = 33;
43372
+ _context5.next = 28;
44724
43373
  break;
44725
43374
  }
44726
43375
  return _context5.abrupt("return");
44727
- case 33:
44728
- _context5.next = 35;
43376
+ case 28:
43377
+ _context5.next = 30;
44729
43378
  return this._loadSegment();
44730
- case 35:
43379
+ case 30:
44731
43380
  return _context5.abrupt("return");
44732
- case 36:
44733
- _context5.next = 38;
43381
+ case 31:
43382
+ _context5.next = 33;
44734
43383
  return this._bufferService.updateDuration(currentStream.totalDuration);
44735
- case 38:
43384
+ case 33:
44736
43385
  startTime = this.config.startTime;
44737
43386
  if (startTime) {
44738
- if (!((_this$_switchUrlOpts5 = this._switchUrlOpts) !== null && _this$_switchUrlOpts5 !== void 0 && _this$_switchUrlOpts5.seamless)) {
43387
+ if (!((_this$_switchUrlOpts3 = this._switchUrlOpts) !== null && _this$_switchUrlOpts3 !== void 0 && _this$_switchUrlOpts3.seamless)) {
44739
43388
  this.media.currentTime = startTime;
44740
43389
  }
44741
43390
  this._playlist.setNextSegmentByIndex(this._playlist.findSegmentIndexByTime(startTime) || 0);
44742
43391
  }
44743
- _context5.next = 42;
43392
+ _context5.next = 37;
44744
43393
  return this._loadSegment();
44745
- case 42:
43394
+ case 37:
44746
43395
  case "end":
44747
43396
  return _context5.stop();
44748
43397
  }
44749
43398
  }, _callee5, this);
44750
43399
  }));
44751
- function _loadData(_x) {
43400
+ function _loadData(_x2) {
44752
43401
  return _loadData2.apply(this, arguments);
44753
43402
  }
44754
43403
  return _loadData;
@@ -44762,20 +43411,18 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
44762
43411
  switch (_context6.prev = _context6.next) {
44763
43412
  case 0:
44764
43413
  this.config.startTime = 0;
44765
- this._urlSwitching = false;
44766
- this._switchUrlOpts = null;
44767
- _context6.next = 5;
43414
+ _context6.next = 3;
44768
43415
  return this.load();
44769
- case 5:
43416
+ case 3:
44770
43417
  this._reloadOnPlay = false;
44771
43418
  return _context6.abrupt("return", this.media.play(!isPlayEmit));
44772
- case 7:
43419
+ case 5:
44773
43420
  case "end":
44774
43421
  return _context6.stop();
44775
43422
  }
44776
43423
  }, _callee6, this);
44777
43424
  }));
44778
- function replay(_x2) {
43425
+ function replay(_x3) {
44779
43426
  return _replay.apply(this, arguments);
44780
43427
  }
44781
43428
  return replay;
@@ -44880,7 +43527,7 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
44880
43527
  }
44881
43528
  }, _callee7, this, [[18, 29]]);
44882
43529
  }));
44883
- function switchURL(_x3) {
43530
+ function switchURL(_x4) {
44884
43531
  return _switchURL.apply(this, arguments);
44885
43532
  }
44886
43533
  return switchURL;
@@ -44966,7 +43613,7 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
44966
43613
  }
44967
43614
  }, _callee8, this, [[8, 16], [21, 31]]);
44968
43615
  }));
44969
- function switchStream(_x4) {
43616
+ function switchStream(_x5) {
44970
43617
  return _switchStream.apply(this, arguments);
44971
43618
  }
44972
43619
  return switchStream;
@@ -45052,7 +43699,7 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
45052
43699
  }
45053
43700
  }, _callee9, this, [[10, 18], [22, 32]]);
45054
43701
  }));
45055
- function switchAudioStream(_x5) {
43702
+ function switchAudioStream(_x6) {
45056
43703
  return _switchAudioStream.apply(this, arguments);
45057
43704
  }
45058
43705
  return switchAudioStream;
@@ -45077,50 +43724,25 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
45077
43724
  }
45078
43725
  }, _callee10, this);
45079
43726
  }));
45080
- function switchSubtitleStream(_x6) {
43727
+ function switchSubtitleStream(_x7) {
45081
43728
  return _switchSubtitleStream.apply(this, arguments);
45082
43729
  }
45083
43730
  return switchSubtitleStream;
45084
43731
  }()
45085
- }, {
45086
- key: "detachMedia",
45087
- value: function() {
45088
- var _detachMedia = _asyncToGenerator$6(/* @__PURE__ */ _regeneratorRuntime$6().mark(function _callee11() {
45089
- return _regeneratorRuntime$6().wrap(function _callee11$(_context11) {
45090
- while (1)
45091
- switch (_context11.prev = _context11.next) {
45092
- case 0:
45093
- if (!this._bufferService) {
45094
- _context11.next = 3;
45095
- break;
45096
- }
45097
- _context11.next = 3;
45098
- return this._bufferService.detachMedia();
45099
- case 3:
45100
- case "end":
45101
- return _context11.stop();
45102
- }
45103
- }, _callee11, this);
45104
- }));
45105
- function detachMedia() {
45106
- return _detachMedia.apply(this, arguments);
45107
- }
45108
- return detachMedia;
45109
- }()
45110
43732
  }, {
45111
43733
  key: "destroy",
45112
43734
  value: function() {
45113
- var _destroy = _asyncToGenerator$6(/* @__PURE__ */ _regeneratorRuntime$6().mark(function _callee12() {
43735
+ var _destroy = _asyncToGenerator$6(/* @__PURE__ */ _regeneratorRuntime$6().mark(function _callee11() {
45114
43736
  var _this$_seiService2;
45115
- return _regeneratorRuntime$6().wrap(function _callee12$(_context12) {
43737
+ return _regeneratorRuntime$6().wrap(function _callee11$(_context11) {
45116
43738
  while (1)
45117
- switch (_context12.prev = _context12.next) {
43739
+ switch (_context11.prev = _context11.next) {
45118
43740
  case 0:
45119
43741
  if (this.media) {
45120
- _context12.next = 2;
43742
+ _context11.next = 2;
45121
43743
  break;
45122
43744
  }
45123
- return _context12.abrupt("return");
43745
+ return _context11.abrupt("return");
45124
43746
  case 2:
45125
43747
  this.removeAllListeners();
45126
43748
  this._playlist.reset();
@@ -45131,15 +43753,15 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
45131
43753
  this.media.removeEventListener("pause", this._onPause);
45132
43754
  this.media.removeEventListener("seeking", this._onSeeking);
45133
43755
  this.media.removeEventListener("timeupdate", this._onTimeupdate);
45134
- _context12.next = 13;
43756
+ _context11.next = 13;
45135
43757
  return Promise.all([this._clear(), this._bufferService.destroy()]);
45136
43758
  case 13:
45137
43759
  this.media = null;
45138
43760
  case 14:
45139
43761
  case "end":
45140
- return _context12.stop();
43762
+ return _context11.stop();
45141
43763
  }
45142
- }, _callee12, this);
43764
+ }, _callee11, this);
45143
43765
  }));
45144
43766
  function destroy() {
45145
43767
  return _destroy.apply(this, arguments);
@@ -45149,48 +43771,48 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
45149
43771
  }, {
45150
43772
  key: "_loadM3U8",
45151
43773
  value: function() {
45152
- var _loadM3U = _asyncToGenerator$6(/* @__PURE__ */ _regeneratorRuntime$6().mark(function _callee13(url) {
43774
+ var _loadM3U = _asyncToGenerator$6(/* @__PURE__ */ _regeneratorRuntime$6().mark(function _callee12(url) {
45153
43775
  var playlist, _this$config$manifest, _this$config$manifest2, manifest, _ref4, _ref5, _this$_playlist$curre;
45154
- return _regeneratorRuntime$6().wrap(function _callee13$(_context13) {
43776
+ return _regeneratorRuntime$6().wrap(function _callee12$(_context12) {
45155
43777
  while (1)
45156
- switch (_context13.prev = _context13.next) {
43778
+ switch (_context12.prev = _context12.next) {
45157
43779
  case 0:
45158
- _context13.prev = 0;
43780
+ _context12.prev = 0;
45159
43781
  manifest = (_this$config$manifest = this.config.manifestList) === null || _this$config$manifest === void 0 ? void 0 : (_this$config$manifest2 = _this$config$manifest.filter(function(x2) {
45160
43782
  return x2.url === url;
45161
43783
  })[0]) === null || _this$config$manifest2 === void 0 ? void 0 : _this$config$manifest2.manifest;
45162
43784
  if (!manifest) {
45163
- _context13.next = 6;
43785
+ _context12.next = 6;
45164
43786
  break;
45165
43787
  }
45166
- _context13.t0 = this._manifestLoader.parseText(manifest, url);
45167
- _context13.next = 9;
43788
+ _context12.t0 = this._manifestLoader.parseText(manifest, url);
43789
+ _context12.next = 9;
45168
43790
  break;
45169
43791
  case 6:
45170
- _context13.next = 8;
43792
+ _context12.next = 8;
45171
43793
  return this._manifestLoader.load(url);
45172
43794
  case 8:
45173
- _context13.t0 = _context13.sent;
43795
+ _context12.t0 = _context12.sent;
45174
43796
  case 9:
45175
- _ref4 = _context13.t0;
43797
+ _ref4 = _context12.t0;
45176
43798
  _ref5 = _slicedToArray$5(_ref4, 1);
45177
43799
  playlist = _ref5[0];
45178
- _context13.next = 17;
43800
+ _context12.next = 17;
45179
43801
  break;
45180
43802
  case 14:
45181
- _context13.prev = 14;
45182
- _context13.t1 = _context13["catch"](0);
45183
- throw this._emitError(StreamingError$1.create(_context13.t1));
43803
+ _context12.prev = 14;
43804
+ _context12.t1 = _context12["catch"](0);
43805
+ throw this._emitError(StreamingError$1.create(_context12.t1));
45184
43806
  case 17:
45185
43807
  if (playlist) {
45186
- _context13.next = 19;
43808
+ _context12.next = 19;
45187
43809
  break;
45188
43810
  }
45189
- return _context13.abrupt("return");
43811
+ return _context12.abrupt("return");
45190
43812
  case 19:
45191
43813
  this._playlist.upsertPlaylist(playlist);
45192
43814
  if (!playlist.isMaster) {
45193
- _context13.next = 24;
43815
+ _context12.next = 24;
45194
43816
  break;
45195
43817
  }
45196
43818
  if ((_this$_playlist$curre = this._playlist.currentStream.subtitleStreams) !== null && _this$_playlist$curre !== void 0 && _this$_playlist$curre.length) {
@@ -45198,18 +43820,18 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
45198
43820
  list: this._playlist.currentStream.subtitleStreams
45199
43821
  });
45200
43822
  }
45201
- _context13.next = 24;
43823
+ _context12.next = 24;
45202
43824
  return this._refreshM3U8();
45203
43825
  case 24:
45204
43826
  this.emit(Event$1.STREAM_PARSED);
45205
- return _context13.abrupt("return", playlist);
43827
+ return _context12.abrupt("return", playlist);
45206
43828
  case 26:
45207
43829
  case "end":
45208
- return _context13.stop();
43830
+ return _context12.stop();
45209
43831
  }
45210
- }, _callee13, this, [[0, 14]]);
43832
+ }, _callee12, this, [[0, 14]]);
45211
43833
  }));
45212
- function _loadM3U8(_x7) {
43834
+ function _loadM3U8(_x8) {
45213
43835
  return _loadM3U.apply(this, arguments);
45214
43836
  }
45215
43837
  return _loadM3U8;
@@ -45243,7 +43865,7 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
45243
43865
  var isEmpty = this._playlist.isEmpty;
45244
43866
  var pollInterval;
45245
43867
  if (this._playlist.lowLatency) {
45246
- pollInterval = (this._playlist.currentStream.partTargetDuration || 0) * 1e3;
43868
+ pollInterval = (this._playlist.currentStream.partTargetDuration * 2 || 0) * 1e3;
45247
43869
  } else {
45248
43870
  var _this$_playlist$lastS;
45249
43871
  pollInterval = (((_this$_playlist$lastS = this._playlist.lastSegment) === null || _this$_playlist$lastS === void 0 ? void 0 : _this$_playlist$lastS.duration) || 0) * 1e3;
@@ -45271,53 +43893,53 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
45271
43893
  }, {
45272
43894
  key: "_loadSegmentDirect",
45273
43895
  value: function() {
45274
- var _loadSegmentDirect2 = _asyncToGenerator$6(/* @__PURE__ */ _regeneratorRuntime$6().mark(function _callee14(loadOnce) {
43896
+ var _loadSegmentDirect2 = _asyncToGenerator$6(/* @__PURE__ */ _regeneratorRuntime$6().mark(function _callee13(loadOnce) {
45275
43897
  var seg, appended, cachedError, _this$_playlist$curre2, bufferEnd, sameStream;
45276
- return _regeneratorRuntime$6().wrap(function _callee14$(_context14) {
43898
+ return _regeneratorRuntime$6().wrap(function _callee13$(_context13) {
45277
43899
  while (1)
45278
- switch (_context14.prev = _context14.next) {
43900
+ switch (_context13.prev = _context13.next) {
45279
43901
  case 0:
45280
43902
  seg = this._playlist.nextSegment;
45281
43903
  if (seg) {
45282
- _context14.next = 3;
43904
+ _context13.next = 3;
45283
43905
  break;
45284
43906
  }
45285
- return _context14.abrupt("return");
43907
+ return _context13.abrupt("return");
45286
43908
  case 3:
45287
43909
  appended = false;
45288
43910
  cachedError = null;
45289
- _context14.prev = 5;
43911
+ _context13.prev = 5;
45290
43912
  this._segmentProcessing = true;
45291
43913
  logger$1.log("load segment, sn:".concat(seg.sn, ", [").concat(seg.start, ", ").concat(seg.end, "], partIndex:").concat(seg.partIndex));
45292
- _context14.next = 10;
43914
+ _context13.next = 10;
45293
43915
  return this._reqAndBufferSegment(seg, this._playlist.getAudioSegment(seg));
45294
43916
  case 10:
45295
- appended = _context14.sent;
45296
- _context14.next = 16;
43917
+ appended = _context13.sent;
43918
+ _context13.next = 16;
45297
43919
  break;
45298
43920
  case 13:
45299
- _context14.prev = 13;
45300
- _context14.t0 = _context14["catch"](5);
45301
- cachedError = _context14.t0;
43921
+ _context13.prev = 13;
43922
+ _context13.t0 = _context13["catch"](5);
43923
+ cachedError = _context13.t0;
45302
43924
  case 16:
45303
- _context14.prev = 16;
43925
+ _context13.prev = 16;
45304
43926
  this._segmentProcessing = false;
45305
- return _context14.finish(16);
43927
+ return _context13.finish(16);
45306
43928
  case 19:
45307
43929
  if (!cachedError) {
45308
- _context14.next = 26;
43930
+ _context13.next = 26;
45309
43931
  break;
45310
43932
  }
45311
43933
  if (!this._bufferService.isFull()) {
45312
- _context14.next = 25;
43934
+ _context13.next = 25;
45313
43935
  break;
45314
43936
  }
45315
43937
  logger$1.log("load segment, sn:".concat(seg.sn, ", partIndex:").concat(seg.partIndex));
45316
43938
  this._segmentProcessing = true;
45317
43939
  this._isProcessQuotaExceeded = true;
45318
- return _context14.abrupt("return", false);
43940
+ return _context13.abrupt("return", false);
45319
43941
  case 25:
45320
- return _context14.abrupt("return", this._emitError(StreamingError$1.create(cachedError)));
43942
+ return _context13.abrupt("return", this._emitError(StreamingError$1.create(cachedError)));
45321
43943
  case 26:
45322
43944
  if (appended) {
45323
43945
  bufferEnd = this.bufferInfo().end;
@@ -45343,14 +43965,14 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
45343
43965
  this._loadSegment();
45344
43966
  }
45345
43967
  }
45346
- return _context14.abrupt("return", appended);
43968
+ return _context13.abrupt("return", appended);
45347
43969
  case 28:
45348
43970
  case "end":
45349
- return _context14.stop();
43971
+ return _context13.stop();
45350
43972
  }
45351
- }, _callee14, this, [[5, 13, 16, 19]]);
43973
+ }, _callee13, this, [[5, 13, 16, 19]]);
45352
43974
  }));
45353
- function _loadSegmentDirect(_x8) {
43975
+ function _loadSegmentDirect(_x9) {
45354
43976
  return _loadSegmentDirect2.apply(this, arguments);
45355
43977
  }
45356
43978
  return _loadSegmentDirect;
@@ -45358,45 +43980,45 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
45358
43980
  }, {
45359
43981
  key: "_reqAndBufferSegment",
45360
43982
  value: function() {
45361
- var _reqAndBufferSegment2 = _asyncToGenerator$6(/* @__PURE__ */ _regeneratorRuntime$6().mark(function _callee15(seg, audioSeg) {
43983
+ var _reqAndBufferSegment2 = _asyncToGenerator$6(/* @__PURE__ */ _regeneratorRuntime$6().mark(function _callee14(seg, audioSeg) {
45362
43984
  var _this$_bufferService2;
45363
43985
  var cc, discontinuity, responses, data2, sn, start, stream, before, contiguous, segStart;
45364
- return _regeneratorRuntime$6().wrap(function _callee15$(_context15) {
43986
+ return _regeneratorRuntime$6().wrap(function _callee14$(_context14) {
45365
43987
  while (1)
45366
- switch (_context15.prev = _context15.next) {
43988
+ switch (_context14.prev = _context14.next) {
45367
43989
  case 0:
45368
43990
  cc = seg ? seg.cc : audioSeg.cc;
45369
43991
  discontinuity = this._prevSegCc !== cc;
45370
43992
  responses = [];
45371
- _context15.prev = 3;
45372
- _context15.next = 6;
43993
+ _context14.prev = 3;
43994
+ _context14.next = 6;
45373
43995
  return this._segmentLoader.load(seg, audioSeg, discontinuity);
45374
43996
  case 6:
45375
- responses = _context15.sent;
45376
- _context15.next = 14;
43997
+ responses = _context14.sent;
43998
+ _context14.next = 14;
45377
43999
  break;
45378
44000
  case 9:
45379
- _context15.prev = 9;
45380
- _context15.t0 = _context15["catch"](3);
45381
- _context15.t0.fatal = false;
45382
- this._segmentLoader.error = _context15.t0;
45383
- throw _context15.t0;
44001
+ _context14.prev = 9;
44002
+ _context14.t0 = _context14["catch"](3);
44003
+ _context14.t0.fatal = false;
44004
+ this._segmentLoader.error = _context14.t0;
44005
+ throw _context14.t0;
45384
44006
  case 14:
45385
44007
  if (responses[0]) {
45386
- _context15.next = 16;
44008
+ _context14.next = 16;
45387
44009
  break;
45388
44010
  }
45389
- return _context15.abrupt("return");
44011
+ return _context14.abrupt("return");
45390
44012
  case 16:
45391
- _context15.next = 18;
44013
+ _context14.next = 18;
45392
44014
  return (_this$_bufferService2 = this._bufferService).decryptBuffer.apply(_this$_bufferService2, _toConsumableArray$7(responses));
45393
44015
  case 18:
45394
- data2 = _context15.sent;
44016
+ data2 = _context14.sent;
45395
44017
  if (data2) {
45396
- _context15.next = 21;
44018
+ _context14.next = 21;
45397
44019
  break;
45398
44020
  }
45399
- return _context15.abrupt("return");
44021
+ return _context14.abrupt("return");
45400
44022
  case 21:
45401
44023
  sn = seg ? seg.sn : audioSeg.sn;
45402
44024
  start = seg ? seg.start : audioSeg.start;
@@ -45410,26 +44032,26 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
45410
44032
  logger$1.warn("update the new playlist liveEdge, segment id=".concat(sn, ", buffer start=").concat(segStart, ", liveEdge=").concat(this._playlist.liveEdge));
45411
44033
  start = segStart;
45412
44034
  }
45413
- _context15.next = 30;
44035
+ _context14.next = 30;
45414
44036
  return this._bufferService.appendBuffer(seg, audioSeg, data2[0], data2[1], discontinuity, contiguous, start);
45415
44037
  case 30:
45416
44038
  this.emit(Event$1.APPEND_COST, {
45417
44039
  elapsed: Date.now() - before,
45418
44040
  url: seg.url
45419
44041
  });
45420
- _context15.next = 33;
44042
+ _context14.next = 33;
45421
44043
  return this._bufferService.evictBuffer(this.config.bufferBehind);
45422
44044
  case 33:
45423
44045
  this._prevSegCc = cc;
45424
44046
  this._prevSegSn = sn;
45425
- return _context15.abrupt("return", true);
44047
+ return _context14.abrupt("return", true);
45426
44048
  case 36:
45427
44049
  case "end":
45428
- return _context15.stop();
44050
+ return _context14.stop();
45429
44051
  }
45430
- }, _callee15, this, [[3, 9]]);
44052
+ }, _callee14, this, [[3, 9]]);
45431
44053
  }));
45432
- function _reqAndBufferSegment(_x9, _x10) {
44054
+ function _reqAndBufferSegment(_x10, _x11) {
45433
44055
  return _reqAndBufferSegment2.apply(this, arguments);
45434
44056
  }
45435
44057
  return _reqAndBufferSegment;
@@ -45437,11 +44059,11 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
45437
44059
  }, {
45438
44060
  key: "_onCheckQuotaExceeded",
45439
44061
  value: function() {
45440
- var _onCheckQuotaExceeded2 = _asyncToGenerator$6(/* @__PURE__ */ _regeneratorRuntime$6().mark(function _callee16() {
44062
+ var _onCheckQuotaExceeded2 = _asyncToGenerator$6(/* @__PURE__ */ _regeneratorRuntime$6().mark(function _callee15() {
45441
44063
  var seekTime, buffered, inBuffered, i, bufferBehind, mediaTime;
45442
- return _regeneratorRuntime$6().wrap(function _callee16$(_context16) {
44064
+ return _regeneratorRuntime$6().wrap(function _callee15$(_context15) {
45443
44065
  while (1)
45444
- switch (_context16.prev = _context16.next) {
44066
+ switch (_context15.prev = _context15.next) {
45445
44067
  case 0:
45446
44068
  seekTime = this.media.currentTime;
45447
44069
  buffered = this.media.buffered;
@@ -45449,37 +44071,37 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
45449
44071
  i = 0;
45450
44072
  case 4:
45451
44073
  if (!(i < buffered.length)) {
45452
- _context16.next = 11;
44074
+ _context15.next = 11;
45453
44075
  break;
45454
44076
  }
45455
44077
  if (!(buffered.start(0) >= seekTime && seekTime < buffered.end(i))) {
45456
- _context16.next = 8;
44078
+ _context15.next = 8;
45457
44079
  break;
45458
44080
  }
45459
44081
  inBuffered = true;
45460
- return _context16.abrupt("break", 11);
44082
+ return _context15.abrupt("break", 11);
45461
44083
  case 8:
45462
44084
  i++;
45463
- _context16.next = 4;
44085
+ _context15.next = 4;
45464
44086
  break;
45465
44087
  case 11:
45466
44088
  if (!this._bufferService.isFull()) {
45467
- _context16.next = 17;
44089
+ _context15.next = 17;
45468
44090
  break;
45469
44091
  }
45470
44092
  bufferBehind = inBuffered ? this.config.bufferBehind : 5;
45471
44093
  mediaTime = this.media.currentTime;
45472
44094
  if (!(mediaTime - bufferBehind > 0)) {
45473
- _context16.next = 17;
44095
+ _context15.next = 17;
45474
44096
  break;
45475
44097
  }
45476
- _context16.next = 17;
44098
+ _context15.next = 17;
45477
44099
  return this._bufferService.removeBuffer(0, mediaTime - bufferBehind);
45478
44100
  case 17:
45479
44101
  case "end":
45480
- return _context16.stop();
44102
+ return _context15.stop();
45481
44103
  }
45482
- }, _callee16, this);
44104
+ }, _callee15, this);
45483
44105
  }));
45484
44106
  function _onCheckQuotaExceeded() {
45485
44107
  return _onCheckQuotaExceeded2.apply(this, arguments);
@@ -45497,22 +44119,22 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
45497
44119
  }, {
45498
44120
  key: "_clear",
45499
44121
  value: function() {
45500
- var _clear2 = _asyncToGenerator$6(/* @__PURE__ */ _regeneratorRuntime$6().mark(function _callee17() {
45501
- return _regeneratorRuntime$6().wrap(function _callee17$(_context17) {
44122
+ var _clear2 = _asyncToGenerator$6(/* @__PURE__ */ _regeneratorRuntime$6().mark(function _callee16() {
44123
+ return _regeneratorRuntime$6().wrap(function _callee16$(_context16) {
45502
44124
  while (1)
45503
- switch (_context17.prev = _context17.next) {
44125
+ switch (_context16.prev = _context16.next) {
45504
44126
  case 0:
45505
44127
  clearTimeout(this._disconnectTimer);
45506
44128
  this._stopTick();
45507
- _context17.next = 4;
44129
+ _context16.next = 4;
45508
44130
  return Promise.all([this._segmentLoader.cancel(), this._manifestLoader.stopPoll()]);
45509
44131
  case 4:
45510
44132
  this._segmentProcessing = false;
45511
44133
  case 5:
45512
44134
  case "end":
45513
- return _context17.stop();
44135
+ return _context16.stop();
45514
44136
  }
45515
- }, _callee17, this);
44137
+ }, _callee16, this);
45516
44138
  }));
45517
44139
  function _clear() {
45518
44140
  return _clear2.apply(this, arguments);
@@ -45522,14 +44144,14 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
45522
44144
  }, {
45523
44145
  key: "_reset",
45524
44146
  value: function() {
45525
- var _reset2 = _asyncToGenerator$6(/* @__PURE__ */ _regeneratorRuntime$6().mark(function _callee18() {
44147
+ var _reset2 = _asyncToGenerator$6(/* @__PURE__ */ _regeneratorRuntime$6().mark(function _callee17() {
45526
44148
  var _this$_seiService3;
45527
- var reuseMse, _args18 = arguments;
45528
- return _regeneratorRuntime$6().wrap(function _callee18$(_context18) {
44149
+ var reuseMse, _args17 = arguments;
44150
+ return _regeneratorRuntime$6().wrap(function _callee17$(_context17) {
45529
44151
  while (1)
45530
- switch (_context18.prev = _context18.next) {
44152
+ switch (_context17.prev = _context17.next) {
45531
44153
  case 0:
45532
- reuseMse = _args18.length > 0 && _args18[0] !== void 0 ? _args18[0] : false;
44154
+ reuseMse = _args17.length > 0 && _args17[0] !== void 0 ? _args17[0] : false;
45533
44155
  this._reloadOnPlay = false;
45534
44156
  this._prevSegSn = null;
45535
44157
  this._prevSegCc = null;
@@ -45538,15 +44160,15 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
45538
44160
  this._segmentLoader.reset();
45539
44161
  (_this$_seiService3 = this._seiService) === null || _this$_seiService3 === void 0 ? void 0 : _this$_seiService3.reset();
45540
44162
  this._stats.reset();
45541
- _context18.next = 11;
44163
+ _context17.next = 11;
45542
44164
  return this._clear();
45543
44165
  case 11:
45544
- return _context18.abrupt("return", this._bufferService.reset(reuseMse));
44166
+ return _context17.abrupt("return", this._bufferService.reset(reuseMse));
45545
44167
  case 12:
45546
44168
  case "end":
45547
- return _context18.stop();
44169
+ return _context17.stop();
45548
44170
  }
45549
- }, _callee18, this);
44171
+ }, _callee17, this);
45550
44172
  }));
45551
44173
  function _reset() {
45552
44174
  return _reset2.apply(this, arguments);
@@ -45627,8 +44249,8 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
45627
44249
  value: function _tryEos() {
45628
44250
  var _this$_bufferService3, _this$_bufferService4;
45629
44251
  var media = this.media;
45630
- var _this$_playlist2 = this._playlist, nextSegment = _this$_playlist2.nextSegment, lastSegment = _this$_playlist2.lastSegment;
45631
- var eosAllowed = (!nextSegment || lastSegment && Buffer$4.isBuffered(media, lastSegment.start + lastSegment.duration / 2)) && media.readyState && media.duration > 0 && ((_this$_bufferService3 = this._bufferService) === null || _this$_bufferService3 === void 0 ? void 0 : _this$_bufferService3.msIsOpened) && !((_this$_bufferService4 = this._bufferService) !== null && _this$_bufferService4 !== void 0 && _this$_bufferService4.msHasOpTasks);
44252
+ var _this$_playlist = this._playlist, nextSegment = _this$_playlist.nextSegment, lastSegment = _this$_playlist.lastSegment;
44253
+ var eosAllowed = !nextSegment && media.readyState && media.duration > 0 && ((_this$_bufferService3 = this._bufferService) === null || _this$_bufferService3 === void 0 ? void 0 : _this$_bufferService3.msIsOpened) && !((_this$_bufferService4 = this._bufferService) !== null && _this$_bufferService4 !== void 0 && _this$_bufferService4.msHasOpTasks);
45632
44254
  if (!eosAllowed) {
45633
44255
  return;
45634
44256
  }
@@ -45664,7 +44286,7 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
45664
44286
  }]);
45665
44287
  return Hls2;
45666
44288
  }(EventEmitter$1);
45667
- _defineProperty$a(Hls, "version", "3.0.20-rc.6");
44289
+ _defineProperty$a(Hls, "version", "3.0.19-rc.0");
45668
44290
  try {
45669
44291
  if (localStorage.getItem("xgd")) {
45670
44292
  Hls.enableLogger();
@@ -45755,7 +44377,6 @@ var PluginExtension = /* @__PURE__ */ function() {
45755
44377
  }]);
45756
44378
  return PluginExtension2;
45757
44379
  }();
45758
- var _excluded$2 = ["currentTime"];
45759
44380
  function parseSwitchUrlArgs(args, plugin) {
45760
44381
  var player = plugin.player;
45761
44382
  var curTime = player.currentTime;
@@ -45766,14 +44387,9 @@ function parseSwitchUrlArgs(args, plugin) {
45766
44387
  case "boolean":
45767
44388
  options.seamless = args;
45768
44389
  break;
45769
- case "object": {
45770
- var currentTime = args.currentTime, rest = _objectWithoutProperties$3(args, _excluded$2);
45771
- Object.assign(options, rest);
45772
- if (typeof currentTime === "number") {
45773
- options.startTime = currentTime;
45774
- }
44390
+ case "object":
44391
+ Object.assign(options, args);
45775
44392
  break;
45776
- }
45777
44393
  }
45778
44394
  return options;
45779
44395
  }
@@ -45783,11 +44399,10 @@ var HlsPlugin = /* @__PURE__ */ function(_BasePlugin) {
45783
44399
  function HlsPlugin2() {
45784
44400
  var _this;
45785
44401
  _classCallCheck$c(this, HlsPlugin2);
45786
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
45787
- args[_key] = arguments[_key];
44402
+ for (var _len = arguments.length, _args = new Array(_len), _key = 0; _key < _len; _key++) {
44403
+ _args[_key] = arguments[_key];
45788
44404
  }
45789
- _this = _super.call.apply(_super, [this].concat(args));
45790
- _defineProperty$a(_assertThisInitialized$9(_this), "logger", logger$1);
44405
+ _this = _super.call.apply(_super, [this].concat(_args));
45791
44406
  _defineProperty$a(_assertThisInitialized$9(_this), "hls", null);
45792
44407
  _defineProperty$a(_assertThisInitialized$9(_this), "pluginExtension", null);
45793
44408
  _defineProperty$a(_assertThisInitialized$9(_this), "getStats", function() {
@@ -45799,6 +44414,24 @@ var HlsPlugin = /* @__PURE__ */ function(_BasePlugin) {
45799
44414
  var lang = _ref.lang;
45800
44415
  (_this$hls2 = _this.hls) === null || _this$hls2 === void 0 ? void 0 : _this$hls2.switchSubtitleStream(lang);
45801
44416
  });
44417
+ _defineProperty$a(_assertThisInitialized$9(_this), "_onSwitchURL", function(url, args) {
44418
+ return new Promise(function(resolve3, reject3) {
44419
+ var _assertThisInitialize = _assertThisInitialized$9(_this), player = _assertThisInitialize.player, hls = _assertThisInitialize.hls;
44420
+ if (hls) {
44421
+ var _this$player$config, _this$player$config$h;
44422
+ var options = parseSwitchUrlArgs(args, _assertThisInitialized$9(_this));
44423
+ player.config.url = url;
44424
+ hls.switchURL(url, options).then(function() {
44425
+ return resolve3(true);
44426
+ }).catch(reject3);
44427
+ if (!options.seamless && (_this$player$config = _this.player.config) !== null && _this$player$config !== void 0 && (_this$player$config$h = _this$player$config.hls) !== null && _this$player$config$h !== void 0 && _this$player$config$h.keepStatusAfterSwitch) {
44428
+ _this._keepPauseStatus();
44429
+ }
44430
+ } else {
44431
+ reject3();
44432
+ }
44433
+ });
44434
+ });
45802
44435
  _defineProperty$a(_assertThisInitialized$9(_this), "_keepPauseStatus", function() {
45803
44436
  var paused = _this.player.paused;
45804
44437
  if (!paused)
@@ -45823,8 +44456,8 @@ var HlsPlugin = /* @__PURE__ */ function(_BasePlugin) {
45823
44456
  }, {
45824
44457
  key: "softDecode",
45825
44458
  get: function get3() {
45826
- var _this$player, _this$player$config;
45827
- var mediaType = (_this$player = this.player) === null || _this$player === void 0 ? void 0 : (_this$player$config = _this$player.config) === null || _this$player$config === void 0 ? void 0 : _this$player$config.mediaType;
44459
+ var _this$player, _this$player$config2;
44460
+ var mediaType = (_this$player = this.player) === null || _this$player === void 0 ? void 0 : (_this$player$config2 = _this$player.config) === null || _this$player$config2 === void 0 ? void 0 : _this$player$config2.mediaType;
45828
44461
  return !!mediaType && mediaType !== "video" && mediaType !== "audio";
45829
44462
  }
45830
44463
  }, {
@@ -45832,35 +44465,13 @@ var HlsPlugin = /* @__PURE__ */ function(_BasePlugin) {
45832
44465
  value: function beforePlayerInit() {
45833
44466
  var _this2 = this;
45834
44467
  var config = this.player.config;
45835
- var mediaElem = this.player.media || this.player.video;
45836
44468
  var hlsOpts = config.hls || {};
45837
44469
  if (!config.url && !config.__allowHlsEmptyUrl__ || !hlsOpts.preferMMS && MSE$2.isMMSOnly()) {
45838
44470
  return;
45839
44471
  }
45840
44472
  if (this.hls)
45841
44473
  this.hls.destroy();
45842
- var descriptor = Object.getOwnPropertyDescriptor(this.player, "switchURL");
45843
- if (!descriptor || descriptor.writable) {
45844
- this.player.switchURL = function(url, args) {
45845
- return new Promise(function(resolve3, reject3) {
45846
- var player = _this2.player, hls = _this2.hls;
45847
- if (hls) {
45848
- var _this2$player$config, _this2$player$config$;
45849
- var options = parseSwitchUrlArgs(args, _this2);
45850
- player.config.url = url;
45851
- hls.switchURL(url, options).then(function() {
45852
- return resolve3(true);
45853
- }).catch(reject3);
45854
- if (!options.seamless && (_this2$player$config = _this2.player.config) !== null && _this2$player$config !== void 0 && (_this2$player$config$ = _this2$player$config.hls) !== null && _this2$player$config$ !== void 0 && _this2$player$config$.keepStatusAfterSwitch) {
45855
- _this2._keepPauseStatus();
45856
- }
45857
- } else {
45858
- reject3();
45859
- }
45860
- });
45861
- };
45862
- }
45863
- var onSwitchUrl = this.player.switchURL;
44474
+ this.player.switchURL = this._onSwitchURL;
45864
44475
  this.player.handleSource = false;
45865
44476
  hlsOpts.innerDegrade = hlsOpts.innerDegrade || config.innerDegrade;
45866
44477
  if (hlsOpts.disconnectTime === null || hlsOpts.disconnectTime === void 0)
@@ -45868,7 +44479,7 @@ var HlsPlugin = /* @__PURE__ */ function(_BasePlugin) {
45868
44479
  this.hls = new Hls(_objectSpread2$5({
45869
44480
  softDecode: this.softDecode,
45870
44481
  isLive: config.isLive,
45871
- media: mediaElem,
44482
+ media: this.player.media || this.player.video,
45872
44483
  startTime: config.startTime,
45873
44484
  url: config.url
45874
44485
  }, hlsOpts));
@@ -45886,7 +44497,7 @@ var HlsPlugin = /* @__PURE__ */ function(_BasePlugin) {
45886
44497
  if (this.softDecode) {
45887
44498
  this.pluginExtension = new PluginExtension(_objectSpread2$5({
45888
44499
  isLive: config.isLive,
45889
- media: mediaElem
44500
+ media: this.player.video
45890
44501
  }, hlsOpts), this);
45891
44502
  this.player.forceDegradeToVideo = function() {
45892
44503
  var _this2$pluginExtensio;
@@ -45903,8 +44514,8 @@ var HlsPlugin = /* @__PURE__ */ function(_BasePlugin) {
45903
44514
  return (_this2$hls2 = _this2.hls) === null || _this2$hls2 === void 0 ? void 0 : _this2$hls2.replay();
45904
44515
  });
45905
44516
  }
45906
- this.on(URL_CHANGE, onSwitchUrl);
45907
44517
  this.on(SWITCH_SUBTITLE, this._onSwitchSubtitle);
44518
+ this.on(URL_CHANGE, this._onSwitchURL);
45908
44519
  this.on(DESTROY, this.destroy.bind(this));
45909
44520
  this._transError();
45910
44521
  this._transCoreEvent(EVENT$1.TTFB);
@@ -45914,7 +44525,6 @@ var HlsPlugin = /* @__PURE__ */ function(_BasePlugin) {
45914
44525
  this._transCoreEvent(EVENT$1.LOAD_RETRY);
45915
44526
  this._transCoreEvent(EVENT$1.SOURCEBUFFER_CREATED);
45916
44527
  this._transCoreEvent(EVENT$1.MEDIASOURCE_OPENED);
45917
- this._transCoreEvent(EVENT$1.APPEND_BUFFER);
45918
44528
  this._transCoreEvent(EVENT$1.REMOVE_BUFFER);
45919
44529
  this._transCoreEvent(EVENT$1.BUFFEREOS);
45920
44530
  this._transCoreEvent(EVENT$1.KEYFRAME);
@@ -45934,9 +44544,7 @@ var HlsPlugin = /* @__PURE__ */ function(_BasePlugin) {
45934
44544
  this._transCoreEvent(Event$1.SUBTITLE_PLAYLIST);
45935
44545
  this._transCoreEvent(Event$1.APPEND_COST);
45936
44546
  if (config.url) {
45937
- this.hls.load(config.url, {
45938
- reuseMse: true
45939
- }).catch(function(e) {
44547
+ this.hls.load(config.url, true).catch(function(e) {
45940
44548
  });
45941
44549
  }
45942
44550
  }