@byteplus/veplayer-plugin 2.4.1-rc.1 → 2.4.2-rc.1

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.
@@ -1640,7 +1640,7 @@ util.getCurrentTimeByOffset = function(offsetTime, segments) {
1640
1640
  }
1641
1641
  return offsetTime;
1642
1642
  };
1643
- var version = "3.0.20-rc.3";
1643
+ var version = "3.0.19-rc.0";
1644
1644
  var ERROR_MAP = {
1645
1645
  1: 5101,
1646
1646
  2: 5102,
@@ -2674,7 +2674,7 @@ function _arrayLikeToArray$1(arr, len) {
2674
2674
  arr2[i] = arr[i];
2675
2675
  return arr2;
2676
2676
  }
2677
- function _createForOfIteratorHelper$1(o, allowArrayLike) {
2677
+ function _createForOfIteratorHelper(o, allowArrayLike) {
2678
2678
  var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
2679
2679
  if (!it) {
2680
2680
  if (Array.isArray(o) || (it = _unsupportedIterableToArray$1(o)) || allowArrayLike && o && typeof o.length === "number") {
@@ -2862,21 +2862,6 @@ var Buffer$1 = /* @__PURE__ */ function() {
2862
2862
  length: Buffer2.totalLength && Buffer2.totalLength(buffers)
2863
2863
  };
2864
2864
  }
2865
- }, {
2866
- key: "isBuffered",
2867
- value: function isBuffered(media, pos) {
2868
- if (media) {
2869
- var buffered = Buffer2.get(media);
2870
- if (buffered !== null && buffered !== void 0 && buffered.length) {
2871
- for (var i = 0; i < buffered.length; i++) {
2872
- if (pos >= buffered.start(i) && pos <= buffered.end(i)) {
2873
- return true;
2874
- }
2875
- }
2876
- }
2877
- }
2878
- return false;
2879
- }
2880
2865
  }]);
2881
2866
  return Buffer2;
2882
2867
  }();
@@ -4781,7 +4766,7 @@ var XhrLoader = /* @__PURE__ */ function(_EventEmitter) {
4781
4766
  value: function _getHeaders(xhr) {
4782
4767
  var headerLines = xhr.getAllResponseHeaders().trim().split("\r\n");
4783
4768
  var headers = {};
4784
- var _iterator = _createForOfIteratorHelper$1(headerLines), _step;
4769
+ var _iterator = _createForOfIteratorHelper(headerLines), _step;
4785
4770
  try {
4786
4771
  for (_iterator.s(); !(_step = _iterator.n()).done; ) {
4787
4772
  var header = _step.value;
@@ -5619,60 +5604,6 @@ function _nonIterableSpread() {
5619
5604
  function _nonIterableRest() {
5620
5605
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
5621
5606
  }
5622
- function _createForOfIteratorHelper(o, allowArrayLike) {
5623
- var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
5624
- if (!it) {
5625
- if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
5626
- if (it)
5627
- o = it;
5628
- var i = 0;
5629
- var F = function() {
5630
- };
5631
- return {
5632
- s: F,
5633
- n: function() {
5634
- if (i >= o.length)
5635
- return {
5636
- done: true
5637
- };
5638
- return {
5639
- done: false,
5640
- value: o[i++]
5641
- };
5642
- },
5643
- e: function(e) {
5644
- throw e;
5645
- },
5646
- f: F
5647
- };
5648
- }
5649
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
5650
- }
5651
- var normalCompletion = true, didErr = false, err;
5652
- return {
5653
- s: function() {
5654
- it = it.call(o);
5655
- },
5656
- n: function() {
5657
- var step = it.next();
5658
- normalCompletion = step.done;
5659
- return step;
5660
- },
5661
- e: function(e) {
5662
- didErr = true;
5663
- err = e;
5664
- },
5665
- f: function() {
5666
- try {
5667
- if (!normalCompletion && it.return != null)
5668
- it.return();
5669
- } finally {
5670
- if (didErr)
5671
- throw err;
5672
- }
5673
- }
5674
- };
5675
- }
5676
5607
  function _toPrimitive(input, hint) {
5677
5608
  if (typeof input !== "object" || input === null)
5678
5609
  return input;
@@ -5695,7 +5626,6 @@ var TrackType = {
5695
5626
  METADATA: "metadata"
5696
5627
  };
5697
5628
  var VideoCodecType = {
5698
- AV1: "av1",
5699
5629
  AVC: "avc",
5700
5630
  HEVC: "hevc"
5701
5631
  };
@@ -5742,7 +5672,6 @@ var VideoTrack = /* @__PURE__ */ function() {
5742
5672
  _defineProperty(this, "isVideoEncryption", false);
5743
5673
  _defineProperty(this, "isAudioEncryption", false);
5744
5674
  _defineProperty(this, "isVideo", true);
5745
- _defineProperty(this, "lastKeyFrameDts", 0);
5746
5675
  _defineProperty(this, "kid", null);
5747
5676
  _defineProperty(this, "pssh", null);
5748
5677
  _defineProperty(this, "ext", void 0);
@@ -5785,9 +5714,6 @@ var VideoTrack = /* @__PURE__ */ function() {
5785
5714
  }, {
5786
5715
  key: "exist",
5787
5716
  value: function exist() {
5788
- if (/av01/.test(this.codec)) {
5789
- return true;
5790
- }
5791
5717
  return !!(this.pps.length && this.sps.length && this.codec);
5792
5718
  }
5793
5719
  }, {
@@ -6056,7 +5982,7 @@ var AAC = /* @__PURE__ */ function() {
6056
5982
  continue;
6057
5983
  }
6058
5984
  frameLength = (data[i + 3] & 3) << 11 | data[i + 4] << 3 | (data[i + 5] & 224) >> 5;
6059
- if (!frameLength || len - i < frameLength)
5985
+ if (len - i < frameLength)
6060
5986
  break;
6061
5987
  protectionSkipBytes = (~data[i + 1] & 1) * 2;
6062
5988
  frames.push({
@@ -6250,15 +6176,6 @@ function parse2(a) {
6250
6176
  return parseInt(item, 16);
6251
6177
  });
6252
6178
  }
6253
- function combineToFloat(integer, decimal) {
6254
- return Number(integer + "." + decimal);
6255
- }
6256
- function toDegree(matrix) {
6257
- if (matrix.length < 5)
6258
- return 0;
6259
- var scaled0 = Math.hypot(matrix[0], matrix[3]), scaled1 = Math.hypot(matrix[1], matrix[4]);
6260
- return 0 === scaled0 || 0 === scaled1 ? 0 : 180 * Math.atan2(matrix[1] / scaled1, matrix[0] / scaled0) / Math.PI;
6261
- }
6262
6179
  var NALu = /* @__PURE__ */ function() {
6263
6180
  function NALu2() {
6264
6181
  _classCallCheck(this, NALu2);
@@ -6921,16 +6838,13 @@ var MAX_SILENT_FRAME_DURATION = 9e4;
6921
6838
  var AUDIO_EXCETION_LOG_EMIT_DURATION = 5 * 9e4;
6922
6839
  var MAX_VIDEO_FRAME_DURATION = 9e4;
6923
6840
  var MAX_DTS_DELTA_WITH_NEXT_CHUNK = 9e4 / 2;
6924
- var LARGE_AV_FIRST_FRAME_FORCE_FIX_THRESHOLD = 9e4 * 5;
6925
6841
  var TsFixer = /* @__PURE__ */ function() {
6926
- function TsFixer2(videoTrack, audioTrack, metadataTrack, fixerConfig) {
6842
+ function TsFixer2(videoTrack, audioTrack, metadataTrack) {
6927
6843
  _classCallCheck(this, TsFixer2);
6928
6844
  this.videoTrack = videoTrack;
6929
6845
  this.audioTrack = audioTrack;
6930
6846
  this.metadataTrack = metadataTrack;
6931
6847
  this._baseDts = -1;
6932
- this._baseVideoDts = -1;
6933
- this._baseAudioDts = -1;
6934
6848
  this._baseDtsInited = false;
6935
6849
  this._audioNextPts = void 0;
6936
6850
  this._videoNextDts = void 0;
@@ -6939,8 +6853,6 @@ var TsFixer = /* @__PURE__ */ function() {
6939
6853
  this._lastAudioExceptionGapDot = 0;
6940
6854
  this._lastAudioExceptionOverlapDot = 0;
6941
6855
  this._lastAudioExceptionLargeGapDot = 0;
6942
- this._needForceFixLargeGap = fixerConfig === null || fixerConfig === void 0 ? void 0 : fixerConfig.forceFixLargeGap;
6943
- this._largeGapThreshold = (fixerConfig === null || fixerConfig === void 0 ? void 0 : fixerConfig.largeGapThreshold) || LARGE_AV_FIRST_FRAME_FORCE_FIX_THRESHOLD;
6944
6856
  }
6945
6857
  _createClass(TsFixer2, [{
6946
6858
  key: "fix",
@@ -6968,16 +6880,10 @@ var TsFixer = /* @__PURE__ */ function() {
6968
6880
  if (discontinuity) {
6969
6881
  this._calculateBaseDts(this.audioTrack, this.videoTrack);
6970
6882
  this._baseDts -= startTime;
6971
- this._baseAudioDts -= startTime;
6972
- this._baseVideoDts -= startTime;
6973
6883
  }
6974
6884
  if (!contiguous) {
6975
6885
  this._videoNextDts = vaDelta > 0 ? startTime + vaDelta : startTime;
6976
6886
  this._audioNextPts = vaDelta > 0 ? startTime : startTime - vaDelta;
6977
- if (this._needForceFixLargeGap) {
6978
- this._videoNextDts = 0;
6979
- this._audioNextPts = 0;
6980
- }
6981
6887
  var vDeltaToNextDts = firstVideoSample ? firstVideoSample.dts - this._baseDts - this._videoNextDts : 0;
6982
6888
  var aDeltaToNextDts = firstAudioSample ? firstAudioSample.pts - this._baseDts - this._audioNextPts : 0;
6983
6889
  if (Math.abs(vDeltaToNextDts || aDeltaToNextDts) > MAX_VIDEO_FRAME_DURATION) {
@@ -7010,8 +6916,8 @@ var TsFixer = /* @__PURE__ */ function() {
7010
6916
  if (!samples.length)
7011
6917
  return;
7012
6918
  samples.forEach(function(x) {
7013
- x.dts -= _this2._needForceFixLargeGap ? _this2._baseVideoDts : _this2._baseDts;
7014
- x.pts -= _this2._needForceFixLargeGap ? _this2._baseVideoDts : _this2._baseDts;
6919
+ x.dts -= _this2._baseDts;
6920
+ x.pts -= _this2._baseDts;
7015
6921
  });
7016
6922
  if (this._videoNextDts === void 0) {
7017
6923
  var samp0 = samples[0];
@@ -7104,7 +7010,7 @@ var TsFixer = /* @__PURE__ */ function() {
7104
7010
  if (!samples.length)
7105
7011
  return;
7106
7012
  samples.forEach(function(x) {
7107
- x.pts -= _this3._needForceFixLargeGap ? _this3._baseAudioDts : _this3._baseDts;
7013
+ x.pts -= _this3._baseDts;
7108
7014
  x.dts = x.pts;
7109
7015
  });
7110
7016
  this._doFixAudioInternal(audioTrack, samples, 9e4);
@@ -7121,15 +7027,12 @@ var TsFixer = /* @__PURE__ */ function() {
7121
7027
  var videoBaseDts = Infinity;
7122
7028
  if (audioSamps.length) {
7123
7029
  audioTrack.baseDts = audioBasePts = audioSamps[0].pts;
7124
- this._baseAudioDts = audioBasePts;
7125
7030
  }
7126
7031
  if (videoSamps.length) {
7127
7032
  videoTrack.baseDts = videoBaseDts = videoSamps[0].dts;
7128
- this._baseVideoDts = videoBaseDts;
7129
7033
  }
7130
7034
  this._baseDts = Math.min(audioBasePts, videoBaseDts);
7131
7035
  var delta = videoBaseDts - audioBasePts;
7132
- var largeGap = false;
7133
7036
  if (Number.isFinite(delta) && Math.abs(delta) > LARGE_AV_FIRST_FRAME_GAP) {
7134
7037
  videoTrack.warnings.push({
7135
7038
  type: WarningType.LARGE_AV_SHIFT,
@@ -7139,16 +7042,6 @@ var TsFixer = /* @__PURE__ */ function() {
7139
7042
  delta
7140
7043
  });
7141
7044
  }
7142
- if (Number.isFinite(delta) && Math.abs(delta) > this._largeGapThreshold * MAX_SILENT_FRAME_DURATION) {
7143
- largeGap = true;
7144
- }
7145
- if (!this._baseDtsInited) {
7146
- if (largeGap && this._needForceFixLargeGap) {
7147
- this._needForceFixLargeGap = true;
7148
- } else {
7149
- this._needForceFixLargeGap = false;
7150
- }
7151
- }
7152
7045
  this._baseDtsInited = true;
7153
7046
  return true;
7154
7047
  }
@@ -7242,7 +7135,6 @@ var TsFixer = /* @__PURE__ */ function() {
7242
7135
  var logger$4 = new Logger$1("TsDemuxer");
7243
7136
  var TsDemuxer = /* @__PURE__ */ function() {
7244
7137
  function TsDemuxer2(videoTrack, audioTrack, metadataTrack) {
7245
- var fixerConfig = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
7246
7138
  _classCallCheck(this, TsDemuxer2);
7247
7139
  _defineProperty(this, "_pmtId", -1);
7248
7140
  _defineProperty(this, "_remainingPacketData", null);
@@ -7252,7 +7144,7 @@ var TsDemuxer = /* @__PURE__ */ function() {
7252
7144
  this.videoTrack = videoTrack || new VideoTrack();
7253
7145
  this.audioTrack = audioTrack || new AudioTrack();
7254
7146
  this.metadataTrack = metadataTrack || new MetadataTrack();
7255
- this._fixer = new TsFixer(this.videoTrack, this.audioTrack, this.metadataTrack, fixerConfig);
7147
+ this._fixer = new TsFixer(this.videoTrack, this.audioTrack, this.metadataTrack);
7256
7148
  }
7257
7149
  _createClass(TsDemuxer2, [{
7258
7150
  key: "demux",
@@ -7599,207 +7491,6 @@ var TsDemuxer = /* @__PURE__ */ function() {
7599
7491
  }]);
7600
7492
  return TsDemuxer2;
7601
7493
  }();
7602
- var ByteReader = /* @__PURE__ */ function() {
7603
- function ByteReader2(buf, offset, len) {
7604
- _classCallCheck(this, ByteReader2);
7605
- this.dv = new DataView(buf);
7606
- this.start = this.offset = offset || this.dv.byteOffset;
7607
- this.end = len ? this.start + len : this.start + this.dv.byteLength;
7608
- }
7609
- _createClass(ByteReader2, [{
7610
- key: "buffer",
7611
- get: function get() {
7612
- return this.dv.buffer;
7613
- }
7614
- }, {
7615
- key: "unreadLength",
7616
- get: function get() {
7617
- return Math.max(this.end - this.offset, 0);
7618
- }
7619
- }, {
7620
- key: "size",
7621
- get: function get() {
7622
- return this.end - this.start;
7623
- }
7624
- }, {
7625
- key: "readFloat",
7626
- value: function readFloat(byteNum) {
7627
- var val = 0;
7628
- switch (byteNum) {
7629
- case 4:
7630
- val = this.dv.getFloat32(this.offset);
7631
- break;
7632
- case 8:
7633
- val = this.dv.getFloat64(this.offset);
7634
- break;
7635
- default:
7636
- throw new Error("read ".concat(byteNum, "-byte float is not supported"));
7637
- }
7638
- this.offset += byteNum;
7639
- return val;
7640
- }
7641
- }, {
7642
- key: "back",
7643
- value: function back(byteNum) {
7644
- this.offset -= byteNum;
7645
- }
7646
- }, {
7647
- key: "skip",
7648
- value: function skip(byteNum) {
7649
- this.offset += byteNum;
7650
- }
7651
- }, {
7652
- key: "readInt",
7653
- value: function readInt(byteNum) {
7654
- var offset = this.offset;
7655
- this.offset += byteNum;
7656
- switch (byteNum) {
7657
- case 1:
7658
- return this.dv.getInt8(offset);
7659
- case 2:
7660
- return this.dv.getInt16(offset);
7661
- case 4:
7662
- return this.dv.getInt32(offset);
7663
- default:
7664
- throw new Error("read ".concat(byteNum, "-byte integers is not supported"));
7665
- }
7666
- }
7667
- }, {
7668
- key: "read",
7669
- value: function read(byteNum) {
7670
- var offset = this.offset;
7671
- this.offset += byteNum;
7672
- switch (byteNum) {
7673
- case 1:
7674
- return this.dv.getUint8(offset);
7675
- case 2:
7676
- return this.dv.getUint16(offset);
7677
- case 3:
7678
- return (this.dv.getUint16(offset) << 8) + this.dv.getUint8(offset + 2);
7679
- case 4:
7680
- return this.dv.getUint32(offset);
7681
- default:
7682
- this.back(byteNum - 4);
7683
- return this.read(byteNum - 4) + this.dv.getUint32(offset) * Math.pow(256, byteNum - 4);
7684
- }
7685
- }
7686
- }, {
7687
- key: "write",
7688
- value: function write(byteNum, val) {
7689
- var offset = this.offset;
7690
- this.offset += byteNum;
7691
- switch (byteNum) {
7692
- case 1:
7693
- return this.dv.setUint8(offset, val);
7694
- case 2:
7695
- return this.dv.setUint16(offset, val);
7696
- case 3:
7697
- return this.dv.setUint8(offset, val >>> 16), this.dv.setUint16(offset + 1, 65535 & val);
7698
- case 4:
7699
- return this.dv.setUint32(offset, val);
7700
- default:
7701
- throw new Error("write ".concat(byteNum, "-byte integers is not supported"));
7702
- }
7703
- }
7704
- }, {
7705
- key: "readToBuffer",
7706
- value: function readToBuffer(len) {
7707
- var buffer;
7708
- if (this.offset || len) {
7709
- buffer = this.dv.buffer.slice(this.offset, len ? this.offset + len : this.end);
7710
- } else {
7711
- buffer = this.dv.buffer;
7712
- }
7713
- this.offset += buffer.byteLength;
7714
- return buffer;
7715
- }
7716
- }, {
7717
- key: "readToUint8",
7718
- value: function readToUint8(len) {
7719
- var uint8 = new Uint8Array(this.dv.buffer, this.offset, len || this.unreadLength);
7720
- this.offset += uint8.byteLength;
7721
- return uint8;
7722
- }
7723
- }, {
7724
- key: "readString",
7725
- value: function readString(len) {
7726
- var i = 0, str = "";
7727
- for (; i < len; i++) {
7728
- str += String.fromCharCode(this.dv.getUint8(this.offset));
7729
- this.offset++;
7730
- }
7731
- return str;
7732
- }
7733
- }], [{
7734
- key: "fromUint8",
7735
- value: function fromUint8(uint8) {
7736
- return new ByteReader2(uint8.buffer, uint8.byteOffset, uint8.byteLength);
7737
- }
7738
- }, {
7739
- key: "concatUint8s",
7740
- value: function concatUint8s(args) {
7741
- var uint8 = new Uint8Array(args.reduce(function(ret, v) {
7742
- return ret + v.byteLength;
7743
- }, 0));
7744
- var offset = 0;
7745
- args.forEach(function(v) {
7746
- uint8.set(v, offset);
7747
- offset += v.byteLength;
7748
- });
7749
- return uint8;
7750
- }
7751
- }, {
7752
- key: "concatUint8",
7753
- value: function concatUint8() {
7754
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
7755
- args[_key] = arguments[_key];
7756
- }
7757
- return this.concatUint8s(args);
7758
- }
7759
- }]);
7760
- return ByteReader2;
7761
- }();
7762
- var BitReader = /* @__PURE__ */ function() {
7763
- function BitReader2(val, size) {
7764
- _classCallCheck(this, BitReader2);
7765
- this.offset = 0;
7766
- this.val = val;
7767
- this.size = size;
7768
- }
7769
- _createClass(BitReader2, [{
7770
- key: "skip",
7771
- value: function skip(len) {
7772
- this.offset += len;
7773
- }
7774
- }, {
7775
- key: "read",
7776
- value: function read(len) {
7777
- var unreadLength = this.size - this.offset - len;
7778
- if (unreadLength >= 0) {
7779
- var bits = 0, i = 0;
7780
- this.offset += len;
7781
- if (this.size > 31) {
7782
- for (; i < len; i++) {
7783
- bits += Math.pow(2, i);
7784
- }
7785
- return this.val / Math.pow(2, unreadLength) & bits;
7786
- } else {
7787
- for (; i < len; i++) {
7788
- bits += 1 << i;
7789
- }
7790
- return this.val >>> unreadLength & bits;
7791
- }
7792
- }
7793
- throw new Error("the number of the read operation exceeds the total length limit of bits");
7794
- }
7795
- }], [{
7796
- key: "fromByte",
7797
- value: function fromByte(byte, len) {
7798
- return new BitReader2(byte.read(len), len << 3);
7799
- }
7800
- }]);
7801
- return BitReader2;
7802
- }();
7803
7494
  var MP4Parser = /* @__PURE__ */ function() {
7804
7495
  function MP4Parser2() {
7805
7496
  _classCallCheck(this, MP4Parser2);
@@ -7957,36 +7648,18 @@ var MP4Parser = /* @__PURE__ */ function() {
7957
7648
  key: "tkhd",
7958
7649
  value: function tkhd(box) {
7959
7650
  return parseBox(box, true, function(ret, data) {
7960
- var byte = ByteReader.fromUint8(data);
7651
+ var start = 0;
7961
7652
  if (ret.version === 1) {
7962
- byte.read(8);
7963
- byte.read(8);
7964
- ret.trackId = byte.read(4);
7965
- byte.read(4);
7966
- ret.duration = byte.read(8);
7653
+ ret.trackId = readBig32(data, 16);
7654
+ ret.duration = readBig64(data, 24);
7655
+ start += 32;
7967
7656
  } else {
7968
- byte.read(4);
7969
- byte.read(4);
7970
- ret.trackId = byte.read(4);
7971
- byte.read(4);
7972
- ret.duration = byte.read(4);
7973
- }
7974
- byte.skip(16);
7975
- ret.matrix = [];
7976
- for (var i = 0; i < 36; i++) {
7977
- ret.matrix.push(byte.read(1));
7978
- }
7979
- byte.back(36);
7980
- var caculatedMatrix = [];
7981
- for (var _i = 0, int32; _i < 3; _i++) {
7982
- caculatedMatrix.push(combineToFloat(byte.readInt(2), byte.readInt(2)));
7983
- caculatedMatrix.push(combineToFloat(byte.readInt(2), byte.readInt(2)));
7984
- int32 = byte.readInt(4);
7985
- caculatedMatrix.push(combineToFloat(int32 >> 30, int32 & 1073741823));
7657
+ ret.trackId = readBig32(data, 8);
7658
+ ret.duration = readBig32(data, 16);
7659
+ start += 20;
7986
7660
  }
7987
- ret.rotation = toDegree(caculatedMatrix);
7988
- ret.width = byte.read(4);
7989
- ret.height = byte.read(4);
7661
+ ret.width = readBig32(data, start + 52);
7662
+ ret.height = readBig32(data, start + 56);
7990
7663
  });
7991
7664
  }
7992
7665
  }, {
@@ -8116,7 +7789,7 @@ var MP4Parser = /* @__PURE__ */ function() {
8116
7789
  if (ret.version > 0) {
8117
7790
  var numKeyIds = readBig32(data, start);
8118
7791
  start += 4;
8119
- for (var _i2 = 0; _i2 < ("" + numKeyIds).length; _i2++) {
7792
+ for (var _i = 0; _i < ("" + numKeyIds).length; _i++) {
8120
7793
  for (var j = 0; j < 16; j++) {
8121
7794
  var keyId = data[start];
8122
7795
  start += 1;
@@ -8139,8 +7812,6 @@ var MP4Parser = /* @__PURE__ */ function() {
8139
7812
  ret.entryCount = readBig32(data);
8140
7813
  ret.entries = MP4Parser2.findBox(data.subarray(4), [], start + 4).map(function(b) {
8141
7814
  switch (b.type) {
8142
- case "av01":
8143
- return MP4Parser2.av01(b);
8144
7815
  case "avc1":
8145
7816
  case "avc2":
8146
7817
  case "avc3":
@@ -8220,69 +7891,6 @@ var MP4Parser = /* @__PURE__ */ function() {
8220
7891
  }
8221
7892
  });
8222
7893
  }
8223
- }, {
8224
- key: "colr",
8225
- value: function colr(box) {
8226
- return parseBox(box, false, function(ret, data) {
8227
- var byte = ByteReader.fromUint8(data);
8228
- ret.data = box.data;
8229
- ret.colorType = byte.readString(4);
8230
- if (ret.colorType === "nclx") {
8231
- ret.colorPrimaries = byte.read(2);
8232
- ret.transferCharacteristics = byte.read(2);
8233
- ret.matrixCoefficients = byte.read(2);
8234
- ret.fullRangeFlag = byte.read(1) >> 7;
8235
- } else if (ret.colorType === "rICC" || ret.colorType === "prof") {
8236
- ret.iccProfile = data.readToUint8();
8237
- }
8238
- });
8239
- }
8240
- }, {
8241
- key: "av01",
8242
- value: function av01(box) {
8243
- return parseBox(box, false, function(ret, data, start) {
8244
- var bodyStart = parseVisualSampleEntry(ret, data);
8245
- var bodyData = data.subarray(bodyStart);
8246
- start += bodyStart;
8247
- ret.av1C = MP4Parser2.av1C(MP4Parser2.findBox(bodyData, ["av1C"], start)[0]);
8248
- ret.colr = MP4Parser2.colr(MP4Parser2.findBox(bodyData, ["colr"], start)[0]);
8249
- });
8250
- }
8251
- }, {
8252
- key: "av1C",
8253
- value: function av1C(box) {
8254
- return parseBox(box, false, function(ret, data) {
8255
- ret.data = box.data;
8256
- var byte = ByteReader.fromUint8(data);
8257
- var bit = BitReader.fromByte(byte, 4);
8258
- ret.marker = bit.read(1);
8259
- ret.version = bit.read(7);
8260
- ret.seqProfile = bit.read(3);
8261
- ret.seqLevelIdx0 = bit.read(5);
8262
- ret.seqTier0 = bit.read(1);
8263
- ret.highBitdepth = bit.read(1);
8264
- ret.twelveBit = bit.read(1);
8265
- ret.monochrome = bit.read(1);
8266
- ret.chromaSubsamplingX = bit.read(1);
8267
- ret.chromaSubsamplingY = bit.read(1);
8268
- ret.chromaSamplePosition = bit.read(2);
8269
- ret.reserved = bit.read(3);
8270
- ret.initialPresentationDelayPresent = bit.read(1);
8271
- if (ret.initialPresentationDelayPresent) {
8272
- ret.initialPresentationDelayMinusOne = bit.read(4);
8273
- } else {
8274
- ret.initialPresentationDelayMinusOne = 0;
8275
- }
8276
- ret.configOBUs = byte.readToUint8();
8277
- var bitdepth;
8278
- if (ret.seqLevelIdx0 === 2 && ret.highBitdepth === 1) {
8279
- bitdepth = ret.twelveBit === 1 ? "12" : "10";
8280
- } else if (ret.seqProfile <= 2) {
8281
- bitdepth = ret.highBitdepth === 1 ? "10" : "08";
8282
- }
8283
- ret.codec = ["av01", ret.seqProfile, (ret.seqLevelIdx0 < 10 ? "0" + ret.seqLevelIdx0 : ret.seqLevelIdx0) + (ret.seqTier0 ? "H" : "M"), bitdepth].join(".");
8284
- });
8285
- }
8286
7894
  }, {
8287
7895
  key: "avc1",
8288
7896
  value: function avc1(box) {
@@ -8317,7 +7925,7 @@ var MP4Parser = /* @__PURE__ */ function() {
8317
7925
  ret.ppsLength = data[start];
8318
7926
  start += 1;
8319
7927
  ret.pps = [];
8320
- for (var _i3 = 0; _i3 < ret.ppsLength; _i3++) {
7928
+ for (var _i2 = 0; _i2 < ret.ppsLength; _i2++) {
8321
7929
  var _size = readBig16(data, start);
8322
7930
  start += 2;
8323
7931
  ret.pps.push(data.subarray(start, start += _size));
@@ -8486,7 +8094,7 @@ var MP4Parser = /* @__PURE__ */ function() {
8486
8094
  start += 8;
8487
8095
  }
8488
8096
  } else {
8489
- for (var _i4 = 0; _i4 < entryCount; _i4++) {
8097
+ for (var _i3 = 0; _i3 < entryCount; _i3++) {
8490
8098
  entries.push({
8491
8099
  count: readBig32(data, start),
8492
8100
  offset: -(~readBig32(data, start + 4) + 1)
@@ -8708,20 +8316,13 @@ var MP4Parser = /* @__PURE__ */ function() {
8708
8316
  v.mvhdTimecale = moov.mvhd.timescale;
8709
8317
  v.timescale = v.formatTimescale = vTrack.mdia.mdhd.timescale;
8710
8318
  v.duration = vTrack.mdia.mdhd.duration || v.mvhdDurtion / v.mvhdTimecale * v.timescale;
8711
- v.rotation = vTrack.tkhd.rotation;
8712
- v.matrix = vTrack.tkhd.matrix;
8713
8319
  var e1 = vTrack.mdia.minf.stbl.stsd.entries[0];
8714
8320
  v.width = e1.width;
8715
8321
  v.height = e1.height;
8716
8322
  if (e1.pasp) {
8717
8323
  v.sarRatio = [e1.pasp.hSpacing, e1.pasp.vSpacing];
8718
8324
  }
8719
- if (e1.av1C) {
8720
- v.codecType = VideoCodecType.AV1;
8721
- v.codec = e1.av1C.codec;
8722
- v.av1C = e1.av1C.data;
8723
- v.colr = e1.colr.data;
8724
- } else if (e1.hvcC) {
8325
+ if (e1.hvcC) {
8725
8326
  v.codecType = VideoCodecType.HEVC;
8726
8327
  v.codec = e1.hvcC.codec;
8727
8328
  v.vps = e1.hvcC.vps;
@@ -9040,9 +8641,8 @@ function parseAudioSampleEntry(ret, data) {
9040
8641
  function parseBox(box, isFullBox, parse3) {
9041
8642
  if (!box)
9042
8643
  return;
9043
- if (box.size !== box.data.length) {
8644
+ if (box.size !== box.data.length)
9044
8645
  throw new Error("box ".concat(box.type, " size !== data.length"));
9045
- }
9046
8646
  var ret = {
9047
8647
  start: box.start,
9048
8648
  size: box.size,
@@ -9081,167 +8681,11 @@ var toHex = function toHex2() {
9081
8681
  var FMP4Demuxer = /* @__PURE__ */ function() {
9082
8682
  function FMP4Demuxer2(videoTrack, audioTrack, metadataTrack) {
9083
8683
  _classCallCheck(this, FMP4Demuxer2);
9084
- _defineProperty(this, "__loadedMoofWraps", []);
9085
- _defineProperty(this, "__lastRemainData", null);
9086
- _defineProperty(this, "__lastRemainDataStart", 0);
9087
- _defineProperty(this, "__nextMoofStart", -1);
9088
8684
  this.videoTrack = videoTrack || new VideoTrack();
9089
8685
  this.audioTrack = audioTrack || new AudioTrack();
9090
8686
  this.metadataTrack = metadataTrack || new MetadataTrack();
9091
8687
  }
9092
8688
  _createClass(FMP4Demuxer2, [{
9093
- key: "demuxPart",
9094
- value: function demuxPart(partData, partDataStart, moov) {
9095
- var _this = this;
9096
- var videoTrack = this.videoTrack, audioTrack = this.audioTrack;
9097
- var videoExist = videoTrack.exist();
9098
- var audioExist = audioTrack.exist();
9099
- var isAV01 = /av01/.test(videoTrack.codec);
9100
- videoTrack.samples = [];
9101
- audioTrack.samples = [];
9102
- var data = partData;
9103
- var dataStart = partDataStart;
9104
- if (this.__lastRemainData) {
9105
- var lastRemainDataEnd = this.__lastRemainDataStart + this.__lastRemainData.byteLength;
9106
- var continuous = partDataStart <= lastRemainDataEnd && partDataStart > this.__lastRemainDataStart && partDataStart + partData.byteLength > lastRemainDataEnd;
9107
- if (continuous) {
9108
- var noDuplicateData = partData.subarray(this.__lastRemainData.byteLength + this.__lastRemainDataStart - partDataStart);
9109
- data = concatUint8Array(this.__lastRemainData, noDuplicateData);
9110
- dataStart = this.__lastRemainDataStart;
9111
- this.__lastRemainData = null;
9112
- } else {
9113
- this.__lastRemainData = null;
9114
- this.__lastRemainDataStart = 0;
9115
- this.__nextMoofStart = -1;
9116
- }
9117
- }
9118
- if (!moov) {
9119
- var moovBox = MP4Parser.findBox(data, ["moov"])[0];
9120
- if (!moovBox)
9121
- throw new Error("cannot found moov box");
9122
- moov = MP4Parser.moov(moovBox);
9123
- }
9124
- if (data) {
9125
- var dataEnd = dataStart + data.byteLength;
9126
- if (!videoExist && !audioExist) {
9127
- MP4Parser.moovToTrack(moov, videoTrack, audioTrack);
9128
- }
9129
- var moofBoxes = [];
9130
- if (this.__nextMoofStart < 0) {
9131
- MP4Parser.findBox(data, ["moof"], dataStart).forEach(function(v) {
9132
- return moofBoxes.push(v);
9133
- });
9134
- } else if (this.__nextMoofStart >= dataStart && this.__nextMoofStart <= dataEnd - 8) {
9135
- MP4Parser.findBox(data.subarray(this.__nextMoofStart - dataStart), ["moof"], this.__nextMoofStart).forEach(function(v) {
9136
- return moofBoxes.push(v);
9137
- });
9138
- }
9139
- moofBoxes.filter(function(moofBox) {
9140
- return moofBox.size <= moofBox.data.length;
9141
- }).forEach(function(moofBox) {
9142
- var moof = MP4Parser.moof(moofBox);
9143
- _this.__nextMoofStart = moof.start + Math.max.apply(Math, _toConsumableArray(moof.traf.map(function(v) {
9144
- return v.trun.samples.reduce(function(ret, w) {
9145
- return ret + w.size;
9146
- }, v.trun.dataOffset || 0);
9147
- })));
9148
- _this.__loadedMoofWraps.push({
9149
- start: moof.start,
9150
- nextMoofStart: _this.__nextMoofStart,
9151
- moof
9152
- });
9153
- _this.__loadedMoofWraps.sort(function(p, n) {
9154
- return p.start - n.start;
9155
- });
9156
- });
9157
- var _iterator = _createForOfIteratorHelper(this.__loadedMoofWraps), _step;
9158
- try {
9159
- var _loop = function _loop2() {
9160
- var moofWrap = _step.value;
9161
- if (moofWrap.start > dataEnd || moofWrap.nextMoofStart < dataStart) {
9162
- return "continue";
9163
- }
9164
- var moofStart = moofWrap.start;
9165
- var tracks = MP4Parser.moofToSamples(moofWrap.moof, videoTrack, audioTrack);
9166
- var videoBaseMediaDecodeTime = videoTrack.baseMediaDecodeTime;
9167
- var audioBaseMediaDecodeTime = audioTrack.baseMediaDecodeTime;
9168
- var nalSize;
9169
- Object.keys(tracks).forEach(function(k) {
9170
- if (videoTrack.id == k) {
9171
- tracks[k].some(function(x) {
9172
- var xStart = x.offset += moofStart;
9173
- if (xStart < dataStart) {
9174
- return;
9175
- }
9176
- if (xStart + x.size > dataEnd) {
9177
- return true;
9178
- }
9179
- var sample = new VideoSample((x.pts || x.dts) + videoBaseMediaDecodeTime, x.dts + videoBaseMediaDecodeTime);
9180
- sample.duration = x.duration;
9181
- sample.gopId = x.gopId;
9182
- if (x.keyframe)
9183
- sample.setToKeyframe();
9184
- var sampleData = data.subarray(xStart - dataStart, xStart - dataStart + x.size);
9185
- sample.data = sampleData;
9186
- if (!isAV01) {
9187
- var start = 0;
9188
- var len = sampleData.length - 1;
9189
- while (start < len) {
9190
- nalSize = readBig32(sampleData, start);
9191
- start += 4;
9192
- sample.units.push(sampleData.subarray(start, start + nalSize));
9193
- start += nalSize;
9194
- }
9195
- }
9196
- _this.__lastRemainDataStart = xStart + x.size;
9197
- videoTrack.samples.push(sample);
9198
- });
9199
- } else if (audioTrack.id == k) {
9200
- tracks[k].some(function(x) {
9201
- var xStart = x.offset + moofStart;
9202
- if (xStart < dataStart) {
9203
- return;
9204
- }
9205
- if (xStart + x.size > dataEnd) {
9206
- return true;
9207
- }
9208
- var sampleData = data.subarray(xStart - dataStart, xStart - dataStart + x.size);
9209
- audioTrack.samples.push(new AudioSample(x.dts + audioBaseMediaDecodeTime, sampleData, x.duration));
9210
- _this.__lastRemainDataStart = xStart + x.size;
9211
- });
9212
- }
9213
- });
9214
- };
9215
- for (_iterator.s(); !(_step = _iterator.n()).done; ) {
9216
- var _ret = _loop();
9217
- if (_ret === "continue")
9218
- continue;
9219
- }
9220
- } catch (err) {
9221
- _iterator.e(err);
9222
- } finally {
9223
- _iterator.f();
9224
- }
9225
- }
9226
- if (this.__lastRemainDataStart > dataStart && this.__lastRemainDataStart < data.byteLength + dataStart) {
9227
- this.__lastRemainData = data.subarray(this.__lastRemainDataStart - dataStart);
9228
- } else {
9229
- this.__lastRemainData = data;
9230
- this.__lastRemainDataStart = dataStart;
9231
- }
9232
- if (videoTrack.samples.length) {
9233
- videoTrack.baseMediaDecodeTime = videoTrack.samples[0].pts;
9234
- }
9235
- if (audioTrack.samples.length) {
9236
- audioTrack.baseMediaDecodeTime = audioTrack.samples[0].pts;
9237
- }
9238
- return {
9239
- videoTrack,
9240
- audioTrack,
9241
- metadataTrack: this.metadataTrack
9242
- };
9243
- }
9244
- }, {
9245
8689
  key: "demux",
9246
8690
  value: function demux(videoData, audioData) {
9247
8691
  var videoTrack = this.videoTrack, audioTrack = this.audioTrack;
@@ -9737,8 +9181,6 @@ var MP4 = /* @__PURE__ */ function() {
9737
9181
  }
9738
9182
  } else if (track.useEME && track.encv) {
9739
9183
  content = MP42.encv(track);
9740
- } else if (track.av1C) {
9741
- content = MP42.av01(track);
9742
9184
  } else {
9743
9185
  content = MP42.avc1hev1(track);
9744
9186
  }
@@ -9951,90 +9393,6 @@ var MP4 = /* @__PURE__ */ function() {
9951
9393
  var schi = MP42.schi(data);
9952
9394
  return MP42.box(MP42.types.sinf, content, MP42.box(MP42.types.frma, frma), MP42.box(MP42.types.schm, schm), schi);
9953
9395
  }
9954
- }, {
9955
- key: "av01",
9956
- value: function av01(track) {
9957
- return MP42.box(MP42.types.av01, new Uint8Array([
9958
- 0,
9959
- 0,
9960
- 0,
9961
- 0,
9962
- 0,
9963
- 0,
9964
- 0,
9965
- 1,
9966
- 0,
9967
- 0,
9968
- 0,
9969
- 0,
9970
- 0,
9971
- 0,
9972
- 0,
9973
- 0,
9974
- 0,
9975
- 0,
9976
- 0,
9977
- 0,
9978
- 0,
9979
- 0,
9980
- 0,
9981
- 0,
9982
- track.width >> 8 & 255,
9983
- track.width & 255,
9984
- track.height >> 8 & 255,
9985
- track.height & 255,
9986
- 0,
9987
- 72,
9988
- 0,
9989
- 0,
9990
- 0,
9991
- 72,
9992
- 0,
9993
- 0,
9994
- 0,
9995
- 0,
9996
- 0,
9997
- 0,
9998
- 0,
9999
- 1,
10000
- 0,
10001
- 0,
10002
- 0,
10003
- 0,
10004
- 0,
10005
- 0,
10006
- 0,
10007
- 0,
10008
- 0,
10009
- 0,
10010
- 0,
10011
- 0,
10012
- 0,
10013
- 0,
10014
- 0,
10015
- 0,
10016
- 0,
10017
- 0,
10018
- 0,
10019
- 0,
10020
- 0,
10021
- 0,
10022
- 0,
10023
- 0,
10024
- 0,
10025
- 0,
10026
- 0,
10027
- 0,
10028
- 0,
10029
- 0,
10030
- 0,
10031
- 0,
10032
- 0,
10033
- 24,
10034
- 17,
10035
- 17
10036
- ]), track.av1C, track.colr);
10037
- }
10038
9396
  }, {
10039
9397
  key: "avc1hev1",
10040
9398
  value: function avc1hev1(track) {
@@ -11007,7 +10365,7 @@ var MP4 = /* @__PURE__ */ function() {
11007
10365
  }]);
11008
10366
  return MP42;
11009
10367
  }();
11010
- _defineProperty(MP4, "types", ["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) {
10368
+ _defineProperty(MP4, "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) {
11011
10369
  p[c] = [c.charCodeAt(0), c.charCodeAt(1), c.charCodeAt(2), c.charCodeAt(3)];
11012
10370
  return p;
11013
10371
  }, /* @__PURE__ */ Object.create(null)));
@@ -11342,46 +10700,30 @@ var FMP4Remuxer = /* @__PURE__ */ function() {
11342
10700
  };
11343
10701
  }
11344
10702
  var samples = track.samples;
11345
- var isAV01 = /av01/.test(track.codec);
11346
10703
  var mdatSize = 0;
11347
- if (isAV01) {
11348
- samples.forEach(function(s) {
11349
- mdatSize += s.data.byteLength;
11350
- });
11351
- } else {
11352
- samples.forEach(function(s) {
11353
- mdatSize += s.units.reduce(function(t, c) {
11354
- return t + c.byteLength;
11355
- }, 0);
11356
- mdatSize += s.units.length * 4;
11357
- });
11358
- }
10704
+ samples.forEach(function(s) {
10705
+ mdatSize += s.units.reduce(function(t, c) {
10706
+ return t + c.byteLength;
10707
+ }, 0);
10708
+ mdatSize += s.units.length * 4;
10709
+ });
11359
10710
  var mdata = new Uint8Array(mdatSize);
11360
- if (isAV01) {
11361
- for (var i = 0, l = samples.length, offset = 0, sample; i < l; i++) {
11362
- sample = samples[i];
11363
- mdata.set(sample.data, offset);
11364
- sample.size = sample.data.byteLength;
11365
- offset += sample.size;
11366
- }
11367
- } else {
11368
- var mdatView = new DataView(mdata.buffer);
11369
- var _loop = function _loop2(_offset2, _sample2) {
11370
- _sample2 = samples[_i];
11371
- var sampleSize = 0;
11372
- _sample2.units.forEach(function(u) {
11373
- mdatView.setUint32(_offset2, u.byteLength);
11374
- _offset2 += 4;
11375
- mdata.set(u, _offset2);
11376
- _offset2 += u.byteLength;
11377
- sampleSize += 4 + u.byteLength;
11378
- });
11379
- _sample2.size = sampleSize;
11380
- _offset = _offset2, _sample = _sample2;
11381
- };
11382
- for (var _i = 0, _l = samples.length, _offset = 0, _sample; _i < _l; _i++) {
11383
- _loop(_offset, _sample);
11384
- }
10711
+ var mdatView = new DataView(mdata.buffer);
10712
+ var _loop = function _loop2(_offset, _sample) {
10713
+ _sample = samples[i];
10714
+ var sampleSize = 0;
10715
+ _sample.units.forEach(function(u) {
10716
+ mdatView.setUint32(_offset, u.byteLength);
10717
+ _offset += 4;
10718
+ mdata.set(u, _offset);
10719
+ _offset += u.byteLength;
10720
+ sampleSize += 4 + u.byteLength;
10721
+ });
10722
+ _sample.size = sampleSize;
10723
+ offset = _offset, sample = _sample;
10724
+ };
10725
+ for (var i = 0, l = samples.length, offset = 0, sample; i < l; i++) {
10726
+ _loop(offset, sample);
11385
10727
  }
11386
10728
  var mdat = MP4.mdat(mdata);
11387
10729
  var moof = MP4.moof([track]);
@@ -11540,11 +10882,11 @@ var Event$1 = _objectSpread2$2(_objectSpread2$2({}, EVENT), {}, {
11540
10882
  });
11541
10883
  var logger$3 = new Logger$2("Transmuxer");
11542
10884
  var Transmuxer = /* @__PURE__ */ function() {
11543
- function Transmuxer2(hls, isMP4, needRemux, fixerConfig) {
10885
+ function Transmuxer2(hls, isMP4, needRemux) {
11544
10886
  _classCallCheck$3(this, Transmuxer2);
11545
10887
  _defineProperty$3(this, "_initSegmentId", "");
11546
10888
  this.hls = hls;
11547
- this._demuxer = isMP4 ? new FMP4Demuxer() : new TsDemuxer(null, null, null, fixerConfig);
10889
+ this._demuxer = isMP4 ? new FMP4Demuxer() : new TsDemuxer();
11548
10890
  this._isMP4 = isMP4;
11549
10891
  if (needRemux)
11550
10892
  this._remuxer = new FMP4Remuxer(this._demuxer.videoTrack, this._demuxer.audioTrack);
@@ -11811,11 +11153,11 @@ var BufferService = /* @__PURE__ */ function() {
11811
11153
  return;
11812
11154
  if (TsDemuxer.probe(chunk)) {
11813
11155
  if (!this._transmuxer)
11814
- this._transmuxer = new Transmuxer(this.hls, false, !this._softVideo, this.hls.config.fixerConfig);
11156
+ this._transmuxer = new Transmuxer(this.hls, false, !this._softVideo);
11815
11157
  } else if (MP4Parser.probe(chunk)) {
11816
11158
  if (this._softVideo) {
11817
11159
  if (!this._transmuxer)
11818
- this._transmuxer = new Transmuxer(this.hls, true, null, this.hls.config.fixerConfig);
11160
+ this._transmuxer = new Transmuxer(this.hls, true);
11819
11161
  } else {
11820
11162
  this._directAppend = true;
11821
11163
  var mix = false;
@@ -12258,11 +11600,7 @@ function getConfig(cfg) {
12258
11600
  minSegmentsStartPlay: 3,
12259
11601
  preferMMS: false,
12260
11602
  preferMMSStreaming: false,
12261
- mseLowLatency: true,
12262
- fixerConfig: {
12263
- forceFixLargeGap: false,
12264
- largeGapThreshold: 5
12265
- }
11603
+ mseLowLatency: true
12266
11604
  }, cfg), {}, {
12267
11605
  media
12268
11606
  });
@@ -12656,6 +11994,9 @@ function parseMediaPlaylist(lines, parentUrl, useLowLatency) {
12656
11994
  var endOfList = false;
12657
11995
  var partSegmentIndex = 0;
12658
11996
  while (line = lines[index++]) {
11997
+ if (endOfList) {
11998
+ break;
11999
+ }
12659
12000
  if (line[0] !== "#") {
12660
12001
  if (media.lowLatency) {
12661
12002
  curSN++;
@@ -12709,6 +12050,11 @@ function parseMediaPlaylist(lines, parentUrl, useLowLatency) {
12709
12050
  break;
12710
12051
  case "ENDLIST":
12711
12052
  {
12053
+ var _lastSegment = media.segments[media.segments.length - 1];
12054
+ if (_lastSegment) {
12055
+ _lastSegment.isLast = true;
12056
+ }
12057
+ media.live = false;
12712
12058
  endOfList = true;
12713
12059
  }
12714
12060
  break;
@@ -12812,14 +12158,11 @@ function parseMediaPlaylist(lines, parentUrl, useLowLatency) {
12812
12158
  });
12813
12159
  var lastSegment = media.segments[media.segments.length - 1];
12814
12160
  if (lastSegment) {
12815
- if (endOfList) {
12816
- lastSegment.isLast = true;
12817
- }
12818
12161
  media.endSN = lastSegment.sn;
12819
12162
  media.endPartIndex = lastSegment.partIndex;
12820
- }
12821
- if (endOfList) {
12822
- media.live = false;
12163
+ if (endOfList && !lastSegment.isLast) {
12164
+ lastSegment.isLast = true;
12165
+ }
12823
12166
  }
12824
12167
  media.totalDuration = totalDuration;
12825
12168
  media.endCC = curCC;
@@ -13916,7 +13259,7 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
13916
13259
  _defineProperty$3(_assertThisInitialized$2(_this), "_switchUrlOpts", null);
13917
13260
  _defineProperty$3(_assertThisInitialized$2(_this), "_isProcessQuotaExceeded", false);
13918
13261
  _defineProperty$3(_assertThisInitialized$2(_this), "_loadSegment", /* @__PURE__ */ _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee() {
13919
- var _this$_playlist, nextSegment, lastSegment, _assertThisInitialize, config, minFrameDuration, maxBufferThroughout, bInfo, bufferThroughout;
13262
+ var nextSeg, _assertThisInitialize, config, bInfo, bufferThroughout;
13920
13263
  return _regeneratorRuntime$1().wrap(function _callee$(_context) {
13921
13264
  while (1)
13922
13265
  switch (_context.prev = _context.next) {
@@ -13927,44 +13270,42 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
13927
13270
  }
13928
13271
  return _context.abrupt("return");
13929
13272
  case 2:
13930
- _this$_playlist = _this._playlist, nextSegment = _this$_playlist.nextSegment, lastSegment = _this$_playlist.lastSegment;
13273
+ nextSeg = _this._playlist.nextSegment;
13931
13274
  _assertThisInitialize = _assertThisInitialized$2(_this), config = _assertThisInitialize.config;
13932
- minFrameDuration = 0.016;
13933
- maxBufferThroughout = Math.min(Math.max((lastSegment === null || lastSegment === void 0 ? void 0 : lastSegment.duration) - minFrameDuration / 2 || 0, minFrameDuration), 0.1);
13934
- if (nextSegment) {
13935
- _context.next = 8;
13275
+ if (nextSeg) {
13276
+ _context.next = 6;
13936
13277
  break;
13937
13278
  }
13938
13279
  return _context.abrupt("return");
13939
- case 8:
13280
+ case 6:
13940
13281
  if (_this.isLive) {
13941
- _context.next = 18;
13282
+ _context.next = 16;
13942
13283
  break;
13943
13284
  }
13944
13285
  bInfo = _this.bufferInfo();
13945
13286
  if (_this.media.paused && !_this.media.currentTime) {
13946
13287
  bInfo = _this.bufferInfo(bInfo.nextStart || 0.5);
13947
13288
  }
13948
- bufferThroughout = Math.abs(bInfo.end - _this.media.duration) < maxBufferThroughout;
13289
+ bufferThroughout = Math.abs(bInfo.end - _this.media.duration) < 0.1;
13949
13290
  if (!(bInfo.remaining >= config.preloadTime || bufferThroughout)) {
13950
- _context.next = 15;
13291
+ _context.next = 13;
13951
13292
  break;
13952
13293
  }
13953
13294
  _this._tryEos();
13954
13295
  return _context.abrupt("return");
13955
- case 15:
13296
+ case 13:
13956
13297
  if (!(config.preferMMSStreaming && !_this._bufferService.msStreaming)) {
13957
- _context.next = 17;
13298
+ _context.next = 15;
13958
13299
  break;
13959
13300
  }
13960
13301
  return _context.abrupt("return");
13961
- case 17:
13962
- if (!_this._urlSwitching && _this._prevSegSn !== nextSegment.sn - 1 && bInfo.end && Math.abs(nextSegment.start - bInfo.end) > 1) {
13302
+ case 15:
13303
+ if (!_this._urlSwitching && _this._prevSegSn !== nextSeg.sn - 1 && bInfo.end && Math.abs(nextSeg.start - bInfo.end) > 1) {
13963
13304
  _this._playlist.setNextSegmentByIndex(_this._playlist.findSegmentIndexByTime(bInfo.end + 0.1));
13964
13305
  }
13965
- case 18:
13306
+ case 16:
13966
13307
  return _context.abrupt("return", _this._loadSegmentDirect());
13967
- case 19:
13308
+ case 17:
13968
13309
  case "end":
13969
13310
  return _context.stop();
13970
13311
  }
@@ -15217,8 +14558,8 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
15217
14558
  value: function _tryEos() {
15218
14559
  var _this$_bufferService3, _this$_bufferService4;
15219
14560
  var media = this.media;
15220
- var _this$_playlist2 = this._playlist, nextSegment = _this$_playlist2.nextSegment, lastSegment = _this$_playlist2.lastSegment;
15221
- var eosAllowed = (!nextSegment || lastSegment && Buffer$1.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);
14561
+ var _this$_playlist = this._playlist, nextSegment = _this$_playlist.nextSegment, lastSegment = _this$_playlist.lastSegment;
14562
+ 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);
15222
14563
  if (!eosAllowed) {
15223
14564
  return;
15224
14565
  }
@@ -15254,7 +14595,7 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
15254
14595
  }]);
15255
14596
  return Hls2;
15256
14597
  }(EventEmitter);
15257
- _defineProperty$3(Hls, "version", "3.0.20-rc.3");
14598
+ _defineProperty$3(Hls, "version", "3.0.19-rc.0");
15258
14599
  try {
15259
14600
  if (localStorage.getItem("xgd")) {
15260
14601
  Hls.enableLogger();