@volcengine/veplayer-plugin 2.4.3-rc.1 → 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 +530 -1967
  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 +368 -1342
  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 +335 -1309
  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
@@ -1542,7 +1542,7 @@
1542
1542
  }
1543
1543
  return offsetTime;
1544
1544
  };
1545
- var version = "3.0.20-rc.6";
1545
+ var version = "3.0.19-rc.0";
1546
1546
  var ERROR_MAP = {
1547
1547
  1: 5101,
1548
1548
  2: 5102,
@@ -1650,7 +1650,8 @@
1650
1650
  }
1651
1651
  if (this.__hooks && this.__hooks[hookName]) {
1652
1652
  try {
1653
- var preRet = runHooks(this, hookName, handler);
1653
+ var _this$__hooks$hookNam;
1654
+ var preRet = (_this$__hooks$hookNam = this.__hooks[hookName]).call.apply(_this$__hooks$hookNam, [this, this].concat(Array.prototype.slice.call(arguments)));
1654
1655
  if (preRet) {
1655
1656
  if (preRet.then) {
1656
1657
  preRet.then(function(isContinue) {
@@ -1675,19 +1676,6 @@
1675
1676
  }
1676
1677
  }.bind(this);
1677
1678
  }
1678
- function findHookIndex(hookName, handler) {
1679
- var __hooks = this.__hooks;
1680
- if (!__hooks || !Array.isArray(__hooks[hookName])) {
1681
- return -1;
1682
- }
1683
- var hookHandlers = __hooks[hookName];
1684
- for (var i = 0; i < hookHandlers.length; i++) {
1685
- if (hookHandlers[i] === handler) {
1686
- return i;
1687
- }
1688
- }
1689
- return -1;
1690
- }
1691
1679
  function useHooks(hookName, handler) {
1692
1680
  var __hooks = this.__hooks;
1693
1681
  if (!__hooks) {
@@ -1697,12 +1685,7 @@
1697
1685
  console.warn("has no supported hook which name [".concat(hookName, "]"));
1698
1686
  return false;
1699
1687
  }
1700
- if (!Array.isArray(__hooks[hookName])) {
1701
- __hooks[hookName] = [];
1702
- }
1703
- if (findHookIndex.call(this, hookName, handler) === -1) {
1704
- __hooks[hookName].push(handler);
1705
- }
1688
+ __hooks && (__hooks[hookName] = handler);
1706
1689
  return true;
1707
1690
  }
1708
1691
  function removeHooks(hookName, handler) {
@@ -1710,13 +1693,6 @@
1710
1693
  if (!__hooks) {
1711
1694
  return;
1712
1695
  }
1713
- if (Array.isArray(__hooks[hookName])) {
1714
- var hooks = __hooks[hookName];
1715
- var index = findHookIndex.call(this, hookName, handler);
1716
- if (index !== -1) {
1717
- hooks.splice(index, 1);
1718
- }
1719
- }
1720
1696
  delete __hooks[hookName];
1721
1697
  }
1722
1698
  function hooksDescriptor(instance) {
@@ -1738,38 +1714,6 @@
1738
1714
  function delHooksDescriptor(instance) {
1739
1715
  instance.__hooks = null;
1740
1716
  }
1741
- function runHooks(obj, hookName, handler) {
1742
- for (var _len5 = arguments.length, args = new Array(_len5 > 3 ? _len5 - 3 : 0), _key5 = 3; _key5 < _len5; _key5++) {
1743
- args[_key5 - 3] = arguments[_key5];
1744
- }
1745
- if (obj.__hooks && Array.isArray(obj.__hooks[hookName])) {
1746
- var hooks = obj.__hooks[hookName];
1747
- var index = -1;
1748
- var runHooksRecursive = function runHooksRecursive2(obj2, hookName2, handler2) {
1749
- for (var _len6 = arguments.length, args2 = new Array(_len6 > 3 ? _len6 - 3 : 0), _key6 = 3; _key6 < _len6; _key6++) {
1750
- args2[_key6 - 3] = arguments[_key6];
1751
- }
1752
- index++;
1753
- if (hooks.length === 0 || index === hooks.length) {
1754
- return handler2.call.apply(handler2, [obj2, obj2].concat(args2));
1755
- }
1756
- var hook2 = hooks[index];
1757
- var ret = hook2.call.apply(hook2, [obj2, obj2].concat(args2));
1758
- if (ret && ret.then) {
1759
- return ret.then(function(data) {
1760
- return data === false ? null : runHooksRecursive2.apply(void 0, [obj2, hookName2, handler2].concat(args2));
1761
- }).catch(function(e) {
1762
- console.warn("[runHooks]".concat(hookName2, " reject"), e.message);
1763
- });
1764
- } else if (ret !== false) {
1765
- return runHooksRecursive2.apply(void 0, [obj2, hookName2, handler2].concat(args2));
1766
- }
1767
- };
1768
- return runHooksRecursive.apply(void 0, [obj, hookName, handler].concat(args));
1769
- } else {
1770
- return handler.call.apply(handler, [obj, obj].concat(args));
1771
- }
1772
- }
1773
1717
  function showErrorMsg(pluginName, msg) {
1774
1718
  XG_DEBUG.logError("[".concat(pluginName, "] event or callback cant be undefined or null when call ").concat(msg));
1775
1719
  }
@@ -2009,18 +1953,6 @@
2009
1953
  }
2010
1954
  }
2011
1955
  }
2012
- }, {
2013
- key: "defineMethod",
2014
- value: function defineMethod(Obj, map) {
2015
- for (var key in map) {
2016
- if (Object.prototype.hasOwnProperty.call(map, key) && typeof map[key] === "function") {
2017
- Object.defineProperty(Obj, key, {
2018
- configurable: true,
2019
- value: map[key]
2020
- });
2021
- }
2022
- }
2023
- }
2024
1956
  }, {
2025
1957
  key: "defaultConfig",
2026
1958
  get: function get() {
@@ -2831,21 +2763,6 @@
2831
2763
  length: Buffer2.totalLength && Buffer2.totalLength(buffers)
2832
2764
  };
2833
2765
  }
2834
- }, {
2835
- key: "isBuffered",
2836
- value: function isBuffered(media, pos) {
2837
- if (media) {
2838
- var buffered = Buffer2.get(media);
2839
- if (buffered !== null && buffered !== void 0 && buffered.length) {
2840
- for (var i = 0; i < buffered.length; i++) {
2841
- if (pos >= buffered.start(i) && pos <= buffered.end(i)) {
2842
- return true;
2843
- }
2844
- }
2845
- }
2846
- }
2847
- return false;
2848
- }
2849
2766
  }]);
2850
2767
  return Buffer2;
2851
2768
  }();
@@ -2998,7 +2915,7 @@
2998
2915
  this.logCache.apply(this, [LogCacheLevel.DEBUG].concat(args));
2999
2916
  if (Logger2.disabled)
3000
2917
  return;
3001
- (_console = console).debug.apply(_console, ["[".concat(nowTime$1(), "]"), this._prefix].concat(args));
2918
+ (_console = console).debug.apply(_console, [this._prefix, nowTime$1()].concat(args));
3002
2919
  }
3003
2920
  }, {
3004
2921
  key: "log",
@@ -3010,7 +2927,7 @@
3010
2927
  this.logCache.apply(this, [LogCacheLevel.LOG].concat(args));
3011
2928
  if (Logger2.disabled)
3012
2929
  return;
3013
- (_console2 = console).log.apply(_console2, ["[".concat(nowTime$1(), "]"), this._prefix].concat(args));
2930
+ (_console2 = console).log.apply(_console2, [this._prefix, nowTime$1()].concat(args));
3014
2931
  }
3015
2932
  }, {
3016
2933
  key: "warn",
@@ -3022,7 +2939,7 @@
3022
2939
  this.logCache.apply(this, [LogCacheLevel.WARN].concat(args));
3023
2940
  if (Logger2.disabled)
3024
2941
  return;
3025
- (_console3 = console).warn.apply(_console3, ["[".concat(nowTime$1(), "]"), this._prefix].concat(args));
2942
+ (_console3 = console).warn.apply(_console3, [this._prefix, nowTime$1()].concat(args));
3026
2943
  }
3027
2944
  }, {
3028
2945
  key: "error",
@@ -3034,7 +2951,7 @@
3034
2951
  this.logCache.apply(this, [LogCacheLevel.ERROR].concat(args));
3035
2952
  if (Logger2.disabled)
3036
2953
  return;
3037
- (_console4 = console).error.apply(_console4, ["[".concat(nowTime$1(), "]"), this._prefix].concat(args));
2954
+ (_console4 = console).error.apply(_console4, [this._prefix, nowTime$1()].concat(args));
3038
2955
  }
3039
2956
  }, {
3040
2957
  key: "logCache",
@@ -3049,7 +2966,7 @@
3049
2966
  var finLogText = logText.map(function(item) {
3050
2967
  return logable(item);
3051
2968
  });
3052
- text = "[".concat(nowTime$1(), "]") + this._prefix + JSON.stringify(finLogText);
2969
+ text = this._prefix + nowTime$1() + JSON.stringify(finLogText);
3053
2970
  } catch (e) {
3054
2971
  return;
3055
2972
  }
@@ -3965,8 +3882,8 @@
3965
3882
  response
3966
3883
  };
3967
3884
  }
3968
- function calculateSpeed(byteLen, milliSecond) {
3969
- return Math.round(byteLen * 8 * 1e3 / milliSecond / 1024);
3885
+ function calculateSpeed(byteLen, millisec) {
3886
+ return Math.round(byteLen * 8 * 1e3 / millisec / 1024);
3970
3887
  }
3971
3888
  var EVENT = {
3972
3889
  ERROR: "error",
@@ -3978,7 +3895,6 @@
3978
3895
  SOURCEBUFFER_CREATED: "core.sourcebuffercreated",
3979
3896
  MEDIASOURCE_OPENED: "core.mediasourceopened",
3980
3897
  ANALYZE_DURATION_EXCEEDED: "core.analyzedurationexceeded",
3981
- APPEND_BUFFER: "core.appendbuffer",
3982
3898
  REMOVE_BUFFER: "core.removebuffer",
3983
3899
  BUFFEREOS: "core.buffereos",
3984
3900
  KEYFRAME: "core.keyframe",
@@ -5611,15 +5527,13 @@
5611
5527
  METADATA: "metadata"
5612
5528
  };
5613
5529
  var VideoCodecType = {
5614
- AV1: "av1",
5615
5530
  AVC: "avc",
5616
5531
  HEVC: "hevc"
5617
5532
  };
5618
5533
  var AudioCodecType = {
5619
5534
  AAC: "aac",
5620
5535
  G711PCMA: "g7110a",
5621
- G711PCMU: "g7110m",
5622
- OPUS: "opus"
5536
+ G711PCMU: "g7110m"
5623
5537
  };
5624
5538
  var WarningType = {
5625
5539
  LARGE_AV_SHIFT: "LARGE_AV_SHIFT",
@@ -5659,7 +5573,6 @@
5659
5573
  _defineProperty(this, "isVideoEncryption", false);
5660
5574
  _defineProperty(this, "isAudioEncryption", false);
5661
5575
  _defineProperty(this, "isVideo", true);
5662
- _defineProperty(this, "lastKeyFrameDts", 0);
5663
5576
  _defineProperty(this, "kid", null);
5664
5577
  _defineProperty(this, "pssh", null);
5665
5578
  _defineProperty(this, "ext", void 0);
@@ -5702,9 +5615,6 @@
5702
5615
  }, {
5703
5616
  key: "exist",
5704
5617
  value: function exist() {
5705
- if (/av01/.test(this.codec)) {
5706
- return true;
5707
- }
5708
5618
  return !!(this.pps.length && this.sps.length && this.codec);
5709
5619
  }
5710
5620
  }, {
@@ -5768,7 +5678,7 @@
5768
5678
  }, {
5769
5679
  key: "exist",
5770
5680
  value: function exist() {
5771
- return !!(this.sampleRate && this.channelCount && this.codec && (this.codecType === AudioCodecType.AAC || this.codecType === AudioCodecType.G711PCMA || this.codecType === AudioCodecType.G711PCMU || this.codecType === AudioCodecType.OPUS));
5681
+ return !!(this.sampleRate && this.channelCount && this.codec && this.codecType === AudioCodecType.AAC);
5772
5682
  }
5773
5683
  }, {
5774
5684
  key: "hasSample",
@@ -5982,7 +5892,7 @@
5982
5892
  continue;
5983
5893
  }
5984
5894
  frameLength = (data[i + 3] & 3) << 11 | data[i + 4] << 3 | (data[i + 5] & 224) >> 5;
5985
- if (!frameLength || len - i < frameLength)
5895
+ if (len - i < frameLength)
5986
5896
  break;
5987
5897
  protectionSkipBytes = (~data[i + 1] & 1) * 2;
5988
5898
  frames.push({
@@ -6116,57 +6026,14 @@
6116
6026
  return AAC2;
6117
6027
  }();
6118
6028
  _defineProperty(AAC, "FREQ", [96e3, 88200, 64e3, 48e3, 44100, 32e3, 24e3, 22050, 16e3, 12e3, 11025, 8e3, 7350]);
6119
- var OPUS = /* @__PURE__ */ function() {
6120
- function OPUS2() {
6121
- _classCallCheck$1(this, OPUS2);
6122
- }
6123
- _createClass$1(OPUS2, null, [{
6124
- key: "getFrameDuration",
6125
- value: function getFrameDuration(samples) {
6126
- return 20;
6127
- }
6128
- }, {
6129
- key: "parseHeaderPackets",
6130
- value: function parseHeaderPackets(data) {
6131
- if (!data.length)
6132
- return;
6133
- var dv = new DataView(data.buffer, data.byteOffset, data.byteLength);
6134
- var magicSignature = "";
6135
- for (var i = 0; i < 8; i++) {
6136
- magicSignature += String.fromCodePoint(data[i]);
6137
- }
6138
- if (magicSignature !== "OpusHead") {
6139
- throw new Error("Invalid Opus MagicSignature");
6140
- }
6141
- var channelCount = data[9];
6142
- console.log("Pre-skip", data[10], data[11]);
6143
- var sampleRate = dv.getUint32(12, true);
6144
- var outputGain = dv.getInt16(16, true);
6145
- if (!sampleRate)
6146
- return;
6147
- var codec = "opus";
6148
- var originCodec = "opus";
6149
- var config = new Uint8Array(data.buffer, data.byteOffset + 8, data.byteLength - 8);
6150
- return {
6151
- outputGain,
6152
- sampleRate,
6153
- channelCount,
6154
- config,
6155
- codec,
6156
- originCodec
6157
- };
6158
- }
6159
- }]);
6160
- return OPUS2;
6161
- }();
6162
6029
  var LARGE_AV_FIRST_FRAME_GAP = 500;
6163
6030
  var AUDIO_GAP_OVERLAP_THRESHOLD_COUNT = 3;
6164
6031
  var MAX_SILENT_FRAME_DURATION = 1e3;
6165
- var AUDIO_EXCEPTION_LOG_EMIT_DURATION = 5e3;
6032
+ var AUDIO_EXCETION_LOG_EMIT_DURATION = 5e3;
6166
6033
  var MAX_VIDEO_FRAME_DURATION = 1e3;
6167
6034
  var MAX_DTS_DELTA_WITH_NEXT_CHUNK = 200;
6168
- var VIDEO_EXCEPTION_LOG_EMIT_DURATION = 5e3;
6169
- var TRACK_BROKEN_CHECK_TIME = 5;
6035
+ var VIDEO_EXCETION_LOG_EMIT_DURATION = 5e3;
6036
+ var TRACK_BREACKED_CHECK_TIME = 5;
6170
6037
  var FlvFixer = /* @__PURE__ */ function() {
6171
6038
  function FlvFixer2(videoTrack, audioTrack, metadataTrack) {
6172
6039
  _classCallCheck$1(this, FlvFixer2);
@@ -6282,7 +6149,7 @@
6282
6149
  var firstSample = samples[0];
6283
6150
  var vDelta = this._videoNextDts - firstSample.dts;
6284
6151
  if (Math.abs(vDelta) > MAX_DTS_DELTA_WITH_NEXT_CHUNK) {
6285
- if (Math.abs(firstSample.dts - this._lastVideoExceptionChunkFirstDtsDot) > VIDEO_EXCEPTION_LOG_EMIT_DURATION) {
6152
+ if (Math.abs(firstSample.dts - this._lastVideoExceptionChunkFirstDtsDot) > VIDEO_EXCETION_LOG_EMIT_DURATION) {
6286
6153
  var _samples$;
6287
6154
  this._lastVideoExceptionChunkFirstDtsDot = firstSample.dts;
6288
6155
  videoTrack.warnings.push({
@@ -6293,7 +6160,7 @@
6293
6160
  sampleDuration: vDelta
6294
6161
  });
6295
6162
  }
6296
- if (this._videoTimestampBreak >= TRACK_BROKEN_CHECK_TIME) {
6163
+ if (this._videoTimestampBreak >= TRACK_BREACKED_CHECK_TIME) {
6297
6164
  this._videoNextDts = firstSample.dts;
6298
6165
  this._videoTimestampBreak = 0;
6299
6166
  } else {
@@ -6316,7 +6183,7 @@
6316
6183
  }
6317
6184
  if (sampleDuration > MAX_VIDEO_FRAME_DURATION || sampleDuration < 0) {
6318
6185
  this._videoTimestampBreak++;
6319
- if (Math.abs(dts - this._lastVideoExceptionLargeGapDot) > VIDEO_EXCEPTION_LOG_EMIT_DURATION) {
6186
+ if (Math.abs(dts - this._lastVideoExceptionLargeGapDot) > VIDEO_EXCETION_LOG_EMIT_DURATION) {
6320
6187
  this._lastVideoExceptionLargeGapDot = dts;
6321
6188
  videoTrack.warnings.push({
6322
6189
  type: WarningType.LARGE_VIDEO_GAP,
@@ -6397,27 +6264,10 @@
6397
6264
  key: "_doFixAudioInternal",
6398
6265
  value: function _doFixAudioInternal(audioTrack, samples, timescale) {
6399
6266
  if (!audioTrack.sampleDuration) {
6400
- switch (audioTrack.codecType) {
6401
- case AudioCodecType.AAC: {
6402
- audioTrack.sampleDuration = AAC.getFrameDuration(audioTrack.timescale, timescale);
6403
- break;
6404
- }
6405
- case AudioCodecType.OPUS: {
6406
- audioTrack.sampleDuration = OPUS.getFrameDuration(audioTrack.samples, timescale);
6407
- break;
6408
- }
6409
- case AudioCodecType.G711PCMA:
6410
- case AudioCodecType.G711PCMU: {
6411
- audioTrack.sampleDuration = this._getG711Duration(audioTrack);
6412
- break;
6413
- }
6414
- default:
6415
- console.error("can't fix audio codecType:", audioTrack.codecType);
6416
- break;
6417
- }
6267
+ audioTrack.sampleDuration = audioTrack.codecType === AudioCodecType.AAC ? AAC.getFrameDuration(audioTrack.timescale, timescale) : this._getG711Duration(audioTrack);
6418
6268
  }
6419
6269
  var refSampleDuration = audioTrack.sampleDuration;
6420
- var sampleDurationInSampleRate = audioTrack.codecType === AudioCodecType.OPUS ? 20 : audioTrack.codecType === AudioCodecType.AAC ? 1024 : refSampleDuration * audioTrack.timescale / 1e3;
6270
+ var sampleDurationInSampleRate = audioTrack.codecType === AudioCodecType.AAC ? 1024 : refSampleDuration * audioTrack.timescale / 1e3;
6421
6271
  if (this._audioNextPts === void 0) {
6422
6272
  var samp0 = samples[0];
6423
6273
  this._audioNextPts = samp0.pts;
@@ -6426,7 +6276,7 @@
6426
6276
  var nextPts = this._audioNextPts;
6427
6277
  var sample = samples[i];
6428
6278
  var delta = sample.pts - nextPts;
6429
- if (i === 0 && this._audioTimestampBreak >= TRACK_BROKEN_CHECK_TIME && this._keyFrameInNextChunk) {
6279
+ if (i === 0 && this._audioTimestampBreak >= TRACK_BREACKED_CHECK_TIME && this._keyFrameInNextChunk) {
6430
6280
  nextPts = this._audioNextPts = sample.dts;
6431
6281
  delta = 0;
6432
6282
  this._audioTimestampBreak = 0;
@@ -6434,7 +6284,7 @@
6434
6284
  if (!this._audioTimestampBreak && delta >= AUDIO_GAP_OVERLAP_THRESHOLD_COUNT * refSampleDuration && delta <= MAX_SILENT_FRAME_DURATION && !isSafari) {
6435
6285
  var silentFrame = this._getSilentFrame(audioTrack) || samples[0].data.subarray();
6436
6286
  var count = Math.floor(delta / refSampleDuration);
6437
- if (Math.abs(sample.pts - this._lastAudioExceptionGapDot) > AUDIO_EXCEPTION_LOG_EMIT_DURATION) {
6287
+ if (Math.abs(sample.pts - this._lastAudioExceptionGapDot) > AUDIO_EXCETION_LOG_EMIT_DURATION) {
6438
6288
  this._lastAudioExceptionGapDot = sample.pts;
6439
6289
  audioTrack.warnings.push({
6440
6290
  type: WarningType.AUDIO_FILLED,
@@ -6454,7 +6304,7 @@
6454
6304
  }
6455
6305
  i--;
6456
6306
  } else if (delta <= -AUDIO_GAP_OVERLAP_THRESHOLD_COUNT * refSampleDuration && delta >= -1 * MAX_SILENT_FRAME_DURATION) {
6457
- if (Math.abs(sample.pts - this._lastAudioExceptionOverlapDot) > AUDIO_EXCEPTION_LOG_EMIT_DURATION) {
6307
+ if (Math.abs(sample.pts - this._lastAudioExceptionOverlapDot) > AUDIO_EXCETION_LOG_EMIT_DURATION) {
6458
6308
  this._lastAudioExceptionOverlapDot = sample.pts;
6459
6309
  audioTrack.warnings.push({
6460
6310
  type: WarningType.AUDIO_DROPPED,
@@ -6469,7 +6319,7 @@
6469
6319
  } else {
6470
6320
  if (Math.abs(delta) > MAX_SILENT_FRAME_DURATION) {
6471
6321
  this._audioTimestampBreak++;
6472
- if (Math.abs(sample.pts - this._lastAudioExceptionLargeGapDot) > AUDIO_EXCEPTION_LOG_EMIT_DURATION) {
6322
+ if (Math.abs(sample.pts - this._lastAudioExceptionLargeGapDot) > AUDIO_EXCETION_LOG_EMIT_DURATION) {
6473
6323
  this._lastAudioExceptionLargeGapDot = sample.pts;
6474
6324
  audioTrack.warnings.push({
6475
6325
  type: WarningType.LARGE_AUDIO_GAP,
@@ -6482,15 +6332,8 @@
6482
6332
  });
6483
6333
  }
6484
6334
  }
6485
- if (audioTrack.codecType === AudioCodecType.OPUS) {
6486
- var lastSample = samples[samples.length - 1];
6487
- if (lastSample) {
6488
- lastSample.duration = sample.pts - lastSample.pts;
6489
- }
6490
- } else {
6491
- sample.dts = sample.pts = nextPts;
6492
- sample.duration = sampleDurationInSampleRate;
6493
- }
6335
+ sample.dts = sample.pts = nextPts;
6336
+ sample.duration = sampleDurationInSampleRate;
6494
6337
  this._audioNextPts += refSampleDuration;
6495
6338
  }
6496
6339
  }
@@ -7449,13 +7292,6 @@
7449
7292
  }]);
7450
7293
  return AMF2;
7451
7294
  }();
7452
- var FlvSoundFormat = {
7453
- MP3: 2,
7454
- G711A: 7,
7455
- G711M: 8,
7456
- AAC: 10,
7457
- OPUS: 13
7458
- };
7459
7295
  var logger$2 = new Logger$1("FlvDemuxer");
7460
7296
  var FlvDemuxer = /* @__PURE__ */ function() {
7461
7297
  function FlvDemuxer2(videoTrack, audioTrack, metadataTrack) {
@@ -7472,10 +7308,8 @@
7472
7308
  _createClass$1(FlvDemuxer2, [{
7473
7309
  key: "demux",
7474
7310
  value: function demux(data) {
7475
- var _scriptDataObject$dat;
7476
7311
  var discontinuity = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
7477
7312
  var contiguous = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : true;
7478
- var seamlessLoadingSwitching = arguments.length > 3 ? arguments[3] : void 0;
7479
7313
  var audioTrack = this.audioTrack, videoTrack = this.videoTrack, metadataTrack = this.metadataTrack;
7480
7314
  if (discontinuity || !contiguous) {
7481
7315
  this._remainingData = null;
@@ -7533,8 +7367,6 @@
7533
7367
  if (tagType === 8) {
7534
7368
  this._parseAudio(bodyData, timestamp);
7535
7369
  } else if (tagType === 9) {
7536
- if (seamlessLoadingSwitching)
7537
- this.seamlessLoadingSwitching = true;
7538
7370
  this._parseVideo(bodyData, timestamp);
7539
7371
  } else if (tagType === 18) {
7540
7372
  this._parseScript(bodyData, timestamp);
@@ -7552,31 +7384,13 @@
7552
7384
  this._remainingData = data.subarray(offset);
7553
7385
  }
7554
7386
  audioTrack.formatTimescale = videoTrack.formatTimescale = videoTrack.timescale = metadataTrack.timescale = 1e3;
7555
- audioTrack.timescale = audioTrack.codecType === AudioCodecType.OPUS ? 1e3 : audioTrack.sampleRate || 0;
7387
+ audioTrack.timescale = audioTrack.sampleRate || 0;
7556
7388
  if (!audioTrack.exist() && audioTrack.hasSample()) {
7557
7389
  audioTrack.reset();
7558
7390
  }
7559
7391
  if (!videoTrack.exist() && videoTrack.hasSample()) {
7560
7392
  videoTrack.reset();
7561
7393
  }
7562
- var scriptDataObject = metadataTrack.flvScriptSamples[metadataTrack.flvScriptSamples.length - 1];
7563
- var metaData = scriptDataObject === null || scriptDataObject === void 0 ? void 0 : (_scriptDataObject$dat = scriptDataObject.data) === null || _scriptDataObject$dat === void 0 ? void 0 : _scriptDataObject$dat.onMetaData;
7564
- if (metaData) {
7565
- if (videoTrack !== null && videoTrack !== void 0 && videoTrack.exist()) {
7566
- if (metaData.hasOwnProperty("duration")) {
7567
- videoTrack.duration = metaData.duration * 1e3;
7568
- }
7569
- if (metaData.hasOwnProperty("width") && metaData.hasOwnProperty("height")) {
7570
- videoTrack.width = metaData.width;
7571
- videoTrack.height = metaData.height;
7572
- }
7573
- }
7574
- if (audioTrack !== null && audioTrack !== void 0 && audioTrack.exist()) {
7575
- if (metaData.hasOwnProperty("duration")) {
7576
- audioTrack.duration = metaData.duration * 1e3;
7577
- }
7578
- }
7579
- }
7580
7394
  return {
7581
7395
  videoTrack,
7582
7396
  audioTrack,
@@ -7595,8 +7409,8 @@
7595
7409
  }
7596
7410
  }, {
7597
7411
  key: "demuxAndFix",
7598
- value: function demuxAndFix(data, discontinuity, contiguous, startTime, seamlessLoadingSwitching) {
7599
- this.demux(data, discontinuity, contiguous, seamlessLoadingSwitching);
7412
+ value: function demuxAndFix(data, discontinuity, contiguous, startTime) {
7413
+ this.demux(data, discontinuity, contiguous);
7600
7414
  return this.fix(startTime, discontinuity, contiguous);
7601
7415
  }
7602
7416
  }, {
@@ -7606,12 +7420,12 @@
7606
7420
  return;
7607
7421
  var format = (data[0] & 240) >>> 4;
7608
7422
  var track = this.audioTrack;
7609
- if (format !== FlvSoundFormat.AAC && format !== FlvSoundFormat.G711A && format !== FlvSoundFormat.G711M && format !== FlvSoundFormat.OPUS) {
7423
+ if (format !== 10 && format !== 7 && format !== 8) {
7610
7424
  logger$2.warn("Unsupported sound format: ".concat(format));
7611
7425
  track.reset();
7612
7426
  return;
7613
7427
  }
7614
- if (format !== FlvSoundFormat.AAC && format !== FlvSoundFormat.OPUS) {
7428
+ if (format !== 10) {
7615
7429
  var soundRate = (data[0] & 12) >> 2;
7616
7430
  var soundSize = (data[0] & 2) >> 1;
7617
7431
  var soundType = data[0] & 1;
@@ -7619,49 +7433,10 @@
7619
7433
  track.sampleSize = soundSize ? 16 : 8;
7620
7434
  track.channelCount = soundType + 1;
7621
7435
  }
7622
- switch (format) {
7623
- case FlvSoundFormat.G711A:
7624
- case FlvSoundFormat.G711M:
7625
- this._parseG711(data, pts, format);
7626
- break;
7627
- case FlvSoundFormat.AAC:
7628
- this._parseAac(data, pts);
7629
- break;
7630
- case FlvSoundFormat.OPUS:
7631
- this._parseOpus(data, pts);
7632
- break;
7633
- }
7634
- }
7635
- }, {
7636
- key: "_parseOpus",
7637
- value: function _parseOpus(data, pts) {
7638
- var track = this.audioTrack;
7639
- var packetType = data[1];
7640
- track.codecType = AudioCodecType.OPUS;
7641
- switch (packetType) {
7642
- case 0: {
7643
- var ret = OPUS.parseHeaderPackets(data.subarray(2));
7644
- if (ret) {
7645
- track.codec = ret.codec;
7646
- track.channelCount = ret.channelCount;
7647
- track.sampleRate = ret.sampleRate;
7648
- track.config = ret.config;
7649
- track.sampleDuration = OPUS.getFrameDuration([], track.timescale);
7650
- } else {
7651
- track.reset();
7652
- logger$2.warn("Cannot parse AudioSpecificConfig", data);
7653
- }
7654
- break;
7655
- }
7656
- case 1: {
7657
- if (pts === void 0 || pts === null)
7658
- return;
7659
- var newSample = new AudioSample(pts, data.subarray(2), track.sampleDuration);
7660
- track.samples.push(newSample);
7661
- break;
7662
- }
7663
- default:
7664
- logger$2.warn("Unknown OpusPacketType: ".concat(packetType));
7436
+ if (format === 10) {
7437
+ this._parseAac(data, pts);
7438
+ } else {
7439
+ this._parseG711(data, pts, format);
7665
7440
  }
7666
7441
  }
7667
7442
  }, {
@@ -7749,13 +7524,8 @@
7749
7524
  units = this._checkAddMetaNalToUnits(isHevc, units, track);
7750
7525
  if (units && units.length) {
7751
7526
  var sample = new VideoSample(dts + cts, dts, units);
7752
- if (this.seamlessLoadingSwitching && dts < track.lastKeyFrameDts) {
7753
- return;
7754
- }
7755
- this.seamlessLoadingSwitching = false;
7756
7527
  if (frameType === 1) {
7757
7528
  sample.setToKeyframe();
7758
- track.lastKeyFrameDts = dts;
7759
7529
  }
7760
7530
  track.samples.push(sample);
7761
7531
  units.forEach(function(unit) {
@@ -8229,16 +7999,10 @@
8229
7999
  if (track.useEME && track.enca) {
8230
8000
  content = MP42.enca(track);
8231
8001
  } else {
8232
- if (track.codecType === AudioCodecType.OPUS) {
8233
- content = MP42.opus(track);
8234
- } else {
8235
- content = MP42.mp4a(track);
8236
- }
8002
+ content = MP42.mp4a(track);
8237
8003
  }
8238
8004
  } else if (track.useEME && track.encv) {
8239
8005
  content = MP42.encv(track);
8240
- } else if (track.av1C) {
8241
- content = MP42.av01(track);
8242
8006
  } else {
8243
8007
  content = MP42.avc1hev1(track);
8244
8008
  }
@@ -8451,90 +8215,6 @@
8451
8215
  var schi = MP42.schi(data);
8452
8216
  return MP42.box(MP42.types.sinf, content, MP42.box(MP42.types.frma, frma), MP42.box(MP42.types.schm, schm), schi);
8453
8217
  }
8454
- }, {
8455
- key: "av01",
8456
- value: function av01(track) {
8457
- return MP42.box(MP42.types.av01, new Uint8Array([
8458
- 0,
8459
- 0,
8460
- 0,
8461
- 0,
8462
- 0,
8463
- 0,
8464
- 0,
8465
- 1,
8466
- 0,
8467
- 0,
8468
- 0,
8469
- 0,
8470
- 0,
8471
- 0,
8472
- 0,
8473
- 0,
8474
- 0,
8475
- 0,
8476
- 0,
8477
- 0,
8478
- 0,
8479
- 0,
8480
- 0,
8481
- 0,
8482
- track.width >> 8 & 255,
8483
- track.width & 255,
8484
- track.height >> 8 & 255,
8485
- track.height & 255,
8486
- 0,
8487
- 72,
8488
- 0,
8489
- 0,
8490
- 0,
8491
- 72,
8492
- 0,
8493
- 0,
8494
- 0,
8495
- 0,
8496
- 0,
8497
- 0,
8498
- 0,
8499
- 1,
8500
- 0,
8501
- 0,
8502
- 0,
8503
- 0,
8504
- 0,
8505
- 0,
8506
- 0,
8507
- 0,
8508
- 0,
8509
- 0,
8510
- 0,
8511
- 0,
8512
- 0,
8513
- 0,
8514
- 0,
8515
- 0,
8516
- 0,
8517
- 0,
8518
- 0,
8519
- 0,
8520
- 0,
8521
- 0,
8522
- 0,
8523
- 0,
8524
- 0,
8525
- 0,
8526
- 0,
8527
- 0,
8528
- 0,
8529
- 0,
8530
- 0,
8531
- 0,
8532
- 0,
8533
- 24,
8534
- 17,
8535
- 17
8536
- ]), track.av1C, track.colr);
8537
- }
8538
8218
  }, {
8539
8219
  key: "avc1hev1",
8540
8220
  value: function avc1hev1(track) {
@@ -8905,53 +8585,6 @@
8905
8585
  )));
8906
8586
  return esds2;
8907
8587
  }
8908
- }, {
8909
- key: "opus",
8910
- value: function opus(track) {
8911
- var opusAudioDescription = new Uint8Array([
8912
- 0,
8913
- 0,
8914
- 0,
8915
- 0,
8916
- 0,
8917
- 0,
8918
- 0,
8919
- 1,
8920
- 0,
8921
- 0,
8922
- 0,
8923
- 0,
8924
- 0,
8925
- 0,
8926
- 0,
8927
- 0,
8928
- 0,
8929
- track.channelCount,
8930
- 0,
8931
- 16,
8932
- 0,
8933
- 0,
8934
- 0,
8935
- 0,
8936
- track.sampleRate >> 8 & 255,
8937
- track.sampleRate & 255,
8938
- 0,
8939
- 0
8940
- ]);
8941
- var opusSpecificConfig = track.config.length ? MP42.dOps(track) : [];
8942
- return MP42.box(MP42.types.Opus, opusAudioDescription, opusSpecificConfig);
8943
- }
8944
- }, {
8945
- key: "dOps",
8946
- value: function dOps(track) {
8947
- if (track.config) {
8948
- track.config[4] = track.sampleRate >>> 24 & 255;
8949
- track.config[5] = track.sampleRate >>> 16 & 255;
8950
- track.config[6] = track.sampleRate >>> 8 & 255;
8951
- track.config[7] = track.sampleRate & 255;
8952
- return MP42.box(MP42.types.dOps, track.config);
8953
- }
8954
- }
8955
8588
  }, {
8956
8589
  key: "mvex",
8957
8590
  value: function mvex(tracks) {
@@ -9554,7 +9187,7 @@
9554
9187
  }]);
9555
9188
  return MP42;
9556
9189
  }();
9557
- _defineProperty(MP4, "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) {
9190
+ _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) {
9558
9191
  p[c] = [c.charCodeAt(0), c.charCodeAt(1), c.charCodeAt(2), c.charCodeAt(3)];
9559
9192
  return p;
9560
9193
  }, /* @__PURE__ */ Object.create(null)));
@@ -9889,46 +9522,30 @@
9889
9522
  };
9890
9523
  }
9891
9524
  var samples = track.samples;
9892
- var isAV01 = /av01/.test(track.codec);
9893
9525
  var mdatSize = 0;
9894
- if (isAV01) {
9895
- samples.forEach(function(s) {
9896
- mdatSize += s.data.byteLength;
9897
- });
9898
- } else {
9899
- samples.forEach(function(s) {
9900
- mdatSize += s.units.reduce(function(t, c) {
9901
- return t + c.byteLength;
9902
- }, 0);
9903
- mdatSize += s.units.length * 4;
9904
- });
9905
- }
9526
+ samples.forEach(function(s) {
9527
+ mdatSize += s.units.reduce(function(t, c) {
9528
+ return t + c.byteLength;
9529
+ }, 0);
9530
+ mdatSize += s.units.length * 4;
9531
+ });
9906
9532
  var mdata = new Uint8Array(mdatSize);
9907
- if (isAV01) {
9908
- for (var i = 0, l = samples.length, offset = 0, sample; i < l; i++) {
9909
- sample = samples[i];
9910
- mdata.set(sample.data, offset);
9911
- sample.size = sample.data.byteLength;
9912
- offset += sample.size;
9913
- }
9914
- } else {
9915
- var mdatView = new DataView(mdata.buffer);
9916
- var _loop = function _loop2(_offset2, _sample2) {
9917
- _sample2 = samples[_i];
9918
- var sampleSize = 0;
9919
- _sample2.units.forEach(function(u) {
9920
- mdatView.setUint32(_offset2, u.byteLength);
9921
- _offset2 += 4;
9922
- mdata.set(u, _offset2);
9923
- _offset2 += u.byteLength;
9924
- sampleSize += 4 + u.byteLength;
9925
- });
9926
- _sample2.size = sampleSize;
9927
- _offset = _offset2, _sample = _sample2;
9928
- };
9929
- for (var _i = 0, _l = samples.length, _offset = 0, _sample; _i < _l; _i++) {
9930
- _loop(_offset, _sample);
9931
- }
9533
+ var mdatView = new DataView(mdata.buffer);
9534
+ var _loop = function _loop2(_offset, _sample) {
9535
+ _sample = samples[i];
9536
+ var sampleSize = 0;
9537
+ _sample.units.forEach(function(u) {
9538
+ mdatView.setUint32(_offset, u.byteLength);
9539
+ _offset += 4;
9540
+ mdata.set(u, _offset);
9541
+ _offset += u.byteLength;
9542
+ sampleSize += 4 + u.byteLength;
9543
+ });
9544
+ _sample.size = sampleSize;
9545
+ offset = _offset, sample = _sample;
9546
+ };
9547
+ for (var i = 0, l = samples.length, offset = 0, sample; i < l; i++) {
9548
+ _loop(offset, sample);
9932
9549
  }
9933
9550
  var mdat = MP4.mdat(mdata);
9934
9551
  var moof = MP4.moof([track]);
@@ -9958,55 +9575,6 @@
9958
9575
  }]);
9959
9576
  return FMP4Remuxer2;
9960
9577
  }();
9961
- var TransferCost = /* @__PURE__ */ function() {
9962
- function TransferCost2() {
9963
- _classCallCheck$4(this, TransferCost2);
9964
- _defineProperty$3(this, "_ttfb", 0);
9965
- _defineProperty$3(this, "_demuxStart", 0);
9966
- _defineProperty$3(this, "_demuxEnd", 0);
9967
- _defineProperty$3(this, "_demuxCost", 0);
9968
- _defineProperty$3(this, "_remuxStart", 0);
9969
- _defineProperty$3(this, "_remuxEnd", 0);
9970
- _defineProperty$3(this, "_remuxCost", 0);
9971
- _defineProperty$3(this, "_appendStart", 0);
9972
- _defineProperty$3(this, "_appendEnd", 0);
9973
- _defineProperty$3(this, "_appendCost", 0);
9974
- }
9975
- _createClass$4(TransferCost2, [{
9976
- key: "set",
9977
- value: function set(event, value) {
9978
- this["_".concat(event)] = value;
9979
- }
9980
- }, {
9981
- key: "start",
9982
- value: function start(event) {
9983
- this["_".concat(event, "Start")] = Date.now();
9984
- }
9985
- }, {
9986
- key: "end",
9987
- value: function end(event) {
9988
- this["_".concat(event, "End")] = Date.now();
9989
- this["_".concat(event, "Cost")] = this["_".concat(event, "Cost")] + (this["_".concat(event, "End")] - this["_".concat(event, "Start")]);
9990
- }
9991
- }, {
9992
- key: "transferCost",
9993
- get: function get() {
9994
- return {
9995
- ttfbCost: this._ttfb,
9996
- demuxCost: this._demuxCost,
9997
- remuxCost: this._remuxCost,
9998
- appendCost: this._appendCost
9999
- };
10000
- }
10001
- }]);
10002
- return TransferCost2;
10003
- }();
10004
- var TRANSFER_EVENT = {
10005
- TTFB: "ttfb",
10006
- DEMUX: "demux",
10007
- REMUX: "remux",
10008
- APPEND: "append"
10009
- };
10010
9578
  var logger$1 = new Logger$2("BufferService");
10011
9579
  var BufferService = /* @__PURE__ */ function() {
10012
9580
  function BufferService2(flv, softVideo) {
@@ -10094,8 +9662,7 @@
10094
9662
  this._contiguous = false;
10095
9663
  this._sourceCreated = false;
10096
9664
  this._initSegmentId = "";
10097
- this.resetSeamlessSwitchStats();
10098
- case 12:
9665
+ case 11:
10099
9666
  case "end":
10100
9667
  return _context.stop();
10101
9668
  }
@@ -10106,15 +9673,6 @@
10106
9673
  }
10107
9674
  return reset;
10108
9675
  }()
10109
- }, {
10110
- key: "resetSeamlessSwitchStats",
10111
- value: function resetSeamlessSwitchStats() {
10112
- this.seamlessLoadingSwitch = null;
10113
- this.seamlessLoadingSwitching = false;
10114
- if (this._demuxer) {
10115
- this._demuxer.seamlessLoadingSwitching = false;
10116
- }
10117
- }
10118
9676
  }, {
10119
9677
  key: "endOfStream",
10120
9678
  value: function() {
@@ -10220,56 +9778,32 @@
10220
9778
  key: "appendBuffer",
10221
9779
  value: function() {
10222
9780
  var _appendBuffer = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee5(chunk) {
10223
- var _this = this;
10224
- var switchingNoReset, demuxer, videoTrack, audioTrack, metadataTrack, idx, videoExist, audioExist, duration, track, videoType, audioType, mse, afterAppend, newId, remuxResult, p;
9781
+ var demuxer, videoTrack, audioTrack, metadataTrack, videoExist, audioExist, duration, track, videoType, audioType, mse, newId, remuxResult, p;
10225
9782
  return _regeneratorRuntime$1().wrap(function _callee5$(_context5) {
10226
9783
  while (1)
10227
9784
  switch (_context5.prev = _context5.next) {
10228
9785
  case 0:
10229
- switchingNoReset = false;
10230
9786
  if (this._cachedBuffer) {
10231
9787
  chunk = concatUint8Array$1(this._cachedBuffer, chunk);
10232
9788
  this._cachedBuffer = null;
10233
9789
  }
10234
9790
  demuxer = this._demuxer;
10235
9791
  if (!(!chunk || !chunk.length || !demuxer)) {
10236
- _context5.next = 5;
9792
+ _context5.next = 4;
10237
9793
  break;
10238
9794
  }
10239
9795
  return _context5.abrupt("return");
10240
- case 5:
10241
- _context5.prev = 5;
10242
- this.flv._transferCost.start(TRANSFER_EVENT.DEMUX);
10243
- demuxer.demuxAndFix(chunk, this.seamlessLoadingSwitching || this._discontinuity, this._contiguous, this._demuxStartTime, this.seamlessLoadingSwitching);
10244
- this.seamlessLoadingSwitching = false;
10245
- this.flv._transferCost.end(TRANSFER_EVENT.DEMUX);
10246
- _context5.next = 15;
9796
+ case 4:
9797
+ _context5.prev = 4;
9798
+ demuxer.demuxAndFix(chunk, this._discontinuity, this._contiguous, this._demuxStartTime);
9799
+ _context5.next = 11;
10247
9800
  break;
10248
- case 12:
10249
- _context5.prev = 12;
10250
- _context5.t0 = _context5["catch"](5);
9801
+ case 8:
9802
+ _context5.prev = 8;
9803
+ _context5.t0 = _context5["catch"](4);
10251
9804
  throw new StreamingError(ERR.DEMUX, ERR.SUB_TYPES.FLV, _context5.t0);
10252
- case 15:
9805
+ case 11:
10253
9806
  videoTrack = demuxer.videoTrack, audioTrack = demuxer.audioTrack, metadataTrack = demuxer.metadataTrack;
10254
- if (!this.seamlessLoadingSwitch) {
10255
- _context5.next = 25;
10256
- break;
10257
- }
10258
- idx = videoTrack.samples.findIndex(function(sample) {
10259
- return sample.originDts === videoTrack.lastKeyFrameDts;
10260
- });
10261
- if (!(idx >= 0)) {
10262
- _context5.next = 25;
10263
- break;
10264
- }
10265
- videoTrack.samples.splice(idx);
10266
- _context5.next = 22;
10267
- return this.seamlessLoadingSwitch();
10268
- case 22:
10269
- this.seamlessLoadingSwitch = null;
10270
- chunk = null;
10271
- switchingNoReset = true;
10272
- case 25:
10273
9807
  videoExist = videoTrack.exist();
10274
9808
  audioExist = audioTrack.exist();
10275
9809
  if (this._opts.onlyAudio) {
@@ -10281,7 +9815,7 @@
10281
9815
  audioTrack.present = false;
10282
9816
  }
10283
9817
  if (!(!videoExist && videoTrack.present || !audioExist && audioTrack.present)) {
10284
- _context5.next = 42;
9818
+ _context5.next = 29;
10285
9819
  break;
10286
9820
  }
10287
9821
  duration = 0;
@@ -10290,7 +9824,7 @@
10290
9824
  duration = (track.samples[track.samples.length - 1].originPts - track.samples[0].originPts) / track.timescale * 1e3;
10291
9825
  }
10292
9826
  if (!(duration > this._opts.analyzeDuration)) {
10293
- _context5.next = 40;
9827
+ _context5.next = 27;
10294
9828
  break;
10295
9829
  }
10296
9830
  logger$1.warn("analyze duration exceeded, ".concat(duration, "ms"), track);
@@ -10299,28 +9833,19 @@
10299
9833
  this.flv.emit(EVENT.ANALYZE_DURATION_EXCEEDED, {
10300
9834
  duration
10301
9835
  });
10302
- _context5.next = 42;
9836
+ _context5.next = 29;
10303
9837
  break;
10304
- case 40:
9838
+ case 27:
10305
9839
  this._cachedBuffer = chunk;
10306
9840
  return _context5.abrupt("return");
10307
- case 42:
9841
+ case 29:
10308
9842
  videoType = videoTrack.type;
10309
9843
  audioType = audioTrack.type;
10310
9844
  this._fireEvents(videoTrack, audioTrack, metadataTrack);
10311
- if (!switchingNoReset) {
10312
- this._discontinuity = false;
10313
- this._contiguous = true;
10314
- this._demuxStartTime = 0;
10315
- }
9845
+ this._discontinuity = false;
9846
+ this._contiguous = true;
9847
+ this._demuxStartTime = 0;
10316
9848
  mse = this._mse;
10317
- afterAppend = function afterAppend2() {
10318
- var _this$flv;
10319
- if ((_this$flv = _this.flv) !== null && _this$flv !== void 0 && _this$flv.emit) {
10320
- var _this$flv2;
10321
- (_this$flv2 = _this.flv) === null || _this$flv2 === void 0 ? void 0 : _this$flv2.emit(EVENT.APPEND_BUFFER, {});
10322
- }
10323
- };
10324
9849
  this.flv.emit(EVENT.DEMUXED_TRACK, {
10325
9850
  videoTrack
10326
9851
  });
@@ -10331,16 +9856,16 @@
10331
9856
  this._emitMetaParsedEvent(videoTrack, audioTrack);
10332
9857
  }
10333
9858
  if (!mse) {
10334
- _context5.next = 81;
9859
+ _context5.next = 66;
10335
9860
  break;
10336
9861
  }
10337
9862
  if (this._sourceCreated) {
10338
- _context5.next = 59;
9863
+ _context5.next = 47;
10339
9864
  break;
10340
9865
  }
10341
- _context5.next = 55;
9866
+ _context5.next = 43;
10342
9867
  return mse.open();
10343
- case 55:
9868
+ case 43:
10344
9869
  if (videoExist) {
10345
9870
  logger$1.log("codec: video/mp4;codecs=".concat(videoTrack.codec));
10346
9871
  mse.createSource(videoType, "video/mp4;codecs=".concat(videoTrack.codec));
@@ -10351,28 +9876,26 @@
10351
9876
  }
10352
9877
  this._sourceCreated = true;
10353
9878
  this.flv.emit(EVENT.SOURCEBUFFER_CREATED);
10354
- case 59:
10355
- _context5.prev = 59;
9879
+ case 47:
9880
+ _context5.prev = 47;
10356
9881
  if (this._needInitSegment && !this._opts.mseLowLatency) {
10357
9882
  videoTrack.duration = this._opts.durationForMSELowLatencyOff * videoTrack.timescale;
10358
9883
  audioTrack.duration = this._opts.durationForMSELowLatencyOff * audioExist.timescale;
10359
9884
  }
10360
- this.flv._transferCost.start(TRANSFER_EVENT.REMUX);
10361
9885
  remuxResult = this._remuxer.remux(this._needInitSegment);
10362
- this.flv._transferCost.end(TRANSFER_EVENT.REMUX);
10363
- _context5.next = 69;
9886
+ _context5.next = 55;
10364
9887
  break;
10365
- case 66:
10366
- _context5.prev = 66;
10367
- _context5.t1 = _context5["catch"](59);
9888
+ case 52:
9889
+ _context5.prev = 52;
9890
+ _context5.t1 = _context5["catch"](47);
10368
9891
  throw new StreamingError(ERR.REMUX, ERR.SUB_TYPES.FMP4, _context5.t1);
10369
- case 69:
9892
+ case 55:
10370
9893
  if (!(this._needInitSegment && !remuxResult.videoInitSegment && !remuxResult.audioInitSegment)) {
10371
- _context5.next = 71;
9894
+ _context5.next = 57;
10372
9895
  break;
10373
9896
  }
10374
9897
  return _context5.abrupt("return");
10375
- case 71:
9898
+ case 57:
10376
9899
  this._needInitSegment = false;
10377
9900
  p = [];
10378
9901
  if (remuxResult.videoInitSegment)
@@ -10383,21 +9906,16 @@
10383
9906
  p.push(mse.append(videoType, remuxResult.videoSegment));
10384
9907
  if (remuxResult.audioSegment)
10385
9908
  p.push(mse.append(audioType, remuxResult.audioSegment));
10386
- this.flv._transferCost.start(TRANSFER_EVENT.APPEND);
10387
- return _context5.abrupt("return", Promise.all(p).then(afterAppend).then(function() {
10388
- _this.flv._transferCost.end(TRANSFER_EVENT.APPEND);
10389
- afterAppend();
10390
- }));
10391
- case 81:
9909
+ return _context5.abrupt("return", Promise.all(p));
9910
+ case 66:
10392
9911
  if (this._softVideo) {
10393
9912
  this._softVideo.appendBuffer(videoTrack, audioTrack);
10394
- afterAppend();
10395
9913
  }
10396
- case 82:
9914
+ case 67:
10397
9915
  case "end":
10398
9916
  return _context5.stop();
10399
9917
  }
10400
- }, _callee5, this, [[5, 12], [59, 66]]);
9918
+ }, _callee5, this, [[4, 8], [47, 52]]);
10401
9919
  }));
10402
9920
  function appendBuffer(_x2) {
10403
9921
  return _appendBuffer.apply(this, arguments);
@@ -10408,7 +9926,7 @@
10408
9926
  key: "evictBuffer",
10409
9927
  value: function() {
10410
9928
  var _evictBuffer = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee6(bufferBehind) {
10411
- var _this2 = this;
9929
+ var _this = this;
10412
9930
  var media, currentTime, removeEnd, start;
10413
9931
  return _regeneratorRuntime$1().wrap(function _callee6$(_context6) {
10414
9932
  while (1)
@@ -10437,7 +9955,7 @@
10437
9955
  return _context6.abrupt("return");
10438
9956
  case 10:
10439
9957
  return _context6.abrupt("return", this._mse.clearBuffer(0, removeEnd).then(function() {
10440
- return _this2.flv.emit(EVENT.REMOVE_BUFFER, {
9958
+ return _this.flv.emit(EVENT.REMOVE_BUFFER, {
10441
9959
  removeEnd
10442
9960
  });
10443
9961
  }));
@@ -10487,16 +10005,16 @@
10487
10005
  }, {
10488
10006
  key: "_fireEvents",
10489
10007
  value: function _fireEvents(videoTrack, audioTrack, metadataTrack) {
10490
- var _this3 = this;
10491
- logger$1.debug("videoTrack samples count: ".concat(videoTrack.samples.length, ", audioTrack samples count: ").concat(audioTrack.samples.length));
10008
+ var _this2 = this;
10009
+ logger$1.debug(videoTrack.samples, audioTrack.samples);
10492
10010
  metadataTrack.flvScriptSamples.forEach(function(sample) {
10493
- _this3.flv.emit(EVENT.FLV_SCRIPT_DATA, sample);
10011
+ _this2.flv.emit(EVENT.FLV_SCRIPT_DATA, sample);
10494
10012
  logger$1.debug("flvScriptData", sample);
10495
10013
  });
10496
10014
  videoTrack.samples.forEach(function(sample) {
10497
10015
  if (sample.keyframe) {
10498
- _this3.flv.emit(EVENT.KEYFRAME, {
10499
- pts: sample.originPts
10016
+ _this2.flv.emit(EVENT.KEYFRAME, {
10017
+ pts: sample.pts
10500
10018
  });
10501
10019
  }
10502
10020
  });
@@ -10514,7 +10032,7 @@
10514
10032
  break;
10515
10033
  }
10516
10034
  if (type)
10517
- _this3.flv.emit(EVENT.STREAM_EXCEPTION, _objectSpread2$2(_objectSpread2$2({}, warn), {}, {
10035
+ _this2.flv.emit(EVENT.STREAM_EXCEPTION, _objectSpread2$2(_objectSpread2$2({}, warn), {}, {
10518
10036
  type
10519
10037
  }));
10520
10038
  logger$1.warn("video exception", warn);
@@ -10533,13 +10051,13 @@
10533
10051
  break;
10534
10052
  }
10535
10053
  if (type)
10536
- _this3.flv.emit(EVENT.STREAM_EXCEPTION, _objectSpread2$2(_objectSpread2$2({}, warn), {}, {
10054
+ _this2.flv.emit(EVENT.STREAM_EXCEPTION, _objectSpread2$2(_objectSpread2$2({}, warn), {}, {
10537
10055
  type
10538
10056
  }));
10539
10057
  logger$1.warn("audio exception", warn);
10540
10058
  });
10541
10059
  metadataTrack.seiSamples.forEach(function(sei) {
10542
- _this3.flv.emit(EVENT.SEI, _objectSpread2$2(_objectSpread2$2({}, sei), {}, {
10060
+ _this2.flv.emit(EVENT.SEI, _objectSpread2$2(_objectSpread2$2({}, sei), {}, {
10543
10061
  sei: {
10544
10062
  code: sei.data.type,
10545
10063
  content: sei.data.payload,
@@ -10574,8 +10092,7 @@
10574
10092
  durationForMSELowLatencyOff: 6,
10575
10093
  chunkCountForSpeed: 50,
10576
10094
  skipChunkSize: 1e3,
10577
- longtimeNoReceived: 3e3,
10578
- enableStartGapJump: true
10095
+ longtimeNoReceived: 3e3
10579
10096
  }, opts);
10580
10097
  if (ret.isLive) {
10581
10098
  if (ret.preloadTime) {
@@ -10643,7 +10160,7 @@
10643
10160
  _defineProperty$3(_assertThisInitialized$3(_this), "_acceptRanges", true);
10644
10161
  _defineProperty$3(_assertThisInitialized$3(_this), "_onProgress", /* @__PURE__ */ function() {
10645
10162
  var _ref2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee(chunk, done, _ref, response) {
10646
- var startTime, endTime, st, firstByteTime, _this$_mediaLoader, headers, elapsed, _this$_bufferService, remaining, maxReaderInterval;
10163
+ var startTime, endTime, st, firstByteTime, _this$_mediaLoader, headers, _this$_bufferService, remaining, maxReaderInterval;
10647
10164
  return _regeneratorRuntime$1().wrap(function _callee$(_context) {
10648
10165
  while (1)
10649
10166
  switch (_context.prev = _context.next) {
@@ -10651,7 +10168,7 @@
10651
10168
  startTime = _ref.startTime, endTime = _ref.endTime, st = _ref.st, firstByteTime = _ref.firstByteTime;
10652
10169
  _this._loading = !done;
10653
10170
  if (_this._firstProgressEmit) {
10654
- _context.next = 13;
10171
+ _context.next = 11;
10655
10172
  break;
10656
10173
  }
10657
10174
  if (_this.media) {
@@ -10662,51 +10179,49 @@
10662
10179
  return _context.abrupt("return");
10663
10180
  case 6:
10664
10181
  headers = response.headers;
10665
- elapsed = st ? firstByteTime - st : endTime - startTime;
10666
10182
  _this.emit(EVENT.TTFB, {
10667
10183
  url: _this._opts.url,
10668
10184
  responseUrl: response.url,
10669
- elapsed
10185
+ elapsed: st ? firstByteTime - st : endTime - startTime
10670
10186
  });
10671
10187
  _this.emit(EVENT.LOAD_RESPONSE_HEADERS, {
10672
10188
  headers
10673
10189
  });
10674
- _this._transferCost.set(TRANSFER_EVENT.TTFB, elapsed);
10675
10190
  _this._acceptRanges = !!(headers !== null && headers !== void 0 && headers.get("Accept-Ranges")) || !!(headers !== null && headers !== void 0 && headers.get("Content-Range"));
10676
10191
  _this._firstProgressEmit = true;
10677
- case 13:
10192
+ case 11:
10678
10193
  if (_this._bufferService) {
10679
- _context.next = 15;
10194
+ _context.next = 13;
10680
10195
  break;
10681
10196
  }
10682
10197
  return _context.abrupt("return");
10683
- case 15:
10198
+ case 13:
10684
10199
  clearTimeout(_this._maxChunkWaitTimer);
10685
10200
  _this._bandwidthService.addChunkRecord(chunk === null || chunk === void 0 ? void 0 : chunk.byteLength, endTime - startTime);
10686
- _context.prev = 17;
10687
- _context.next = 20;
10201
+ _context.prev = 15;
10202
+ _context.next = 18;
10688
10203
  return _this._bufferService.appendBuffer(chunk);
10689
- case 20:
10204
+ case 18:
10690
10205
  (_this$_bufferService = _this._bufferService) === null || _this$_bufferService === void 0 ? void 0 : _this$_bufferService.evictBuffer(_this._opts.bufferBehind);
10691
- _context.next = 33;
10206
+ _context.next = 31;
10692
10207
  break;
10693
- case 23:
10694
- _context.prev = 23;
10695
- _context.t0 = _context["catch"](17);
10208
+ case 21:
10209
+ _context.prev = 21;
10210
+ _context.t0 = _context["catch"](15);
10696
10211
  if (!(!_this.isLive && _this._bufferService.isFull())) {
10697
- _context.next = 32;
10212
+ _context.next = 30;
10698
10213
  break;
10699
10214
  }
10700
- _context.next = 28;
10215
+ _context.next = 26;
10701
10216
  return _this._mediaLoader.cancel();
10702
- case 28:
10217
+ case 26:
10703
10218
  _this._loading = false;
10704
10219
  remaining = _this.bufferInfo().remaining;
10705
10220
  _this._opts.preloadTime = parseInt(remaining) / 2;
10706
10221
  return _context.abrupt("return");
10707
- case 32:
10222
+ case 30:
10708
10223
  return _context.abrupt("return", _this._emitError(StreamingError.create(_context.t0)));
10709
- case 33:
10224
+ case 31:
10710
10225
  if (_this._urlSwitching) {
10711
10226
  _this._urlSwitching = false;
10712
10227
  _this.emit(EVENT.SWITCH_URL_SUCCESS, {
@@ -10718,7 +10233,7 @@
10718
10233
  _this._tick();
10719
10234
  }
10720
10235
  if (!(done && !_this.media.seeking)) {
10721
- _context.next = 40;
10236
+ _context.next = 38;
10722
10237
  break;
10723
10238
  }
10724
10239
  _this.emit(EVENT.LOAD_COMPLETE);
@@ -10727,13 +10242,13 @@
10727
10242
  _this._end();
10728
10243
  }
10729
10244
  return _context.abrupt("return");
10730
- case 40:
10245
+ case 38:
10731
10246
  if (_this.isLive) {
10732
- _context.next = 42;
10247
+ _context.next = 40;
10733
10248
  break;
10734
10249
  }
10735
10250
  return _context.abrupt("return");
10736
- case 42:
10251
+ case 40:
10737
10252
  maxReaderInterval = _this._opts.maxReaderInterval;
10738
10253
  if (maxReaderInterval && _this._firstProgressEmit) {
10739
10254
  clearTimeout(_this._maxChunkWaitTimer);
@@ -10747,11 +10262,11 @@
10747
10262
  _this._end();
10748
10263
  }, maxReaderInterval);
10749
10264
  }
10750
- case 44:
10265
+ case 42:
10751
10266
  case "end":
10752
10267
  return _context.stop();
10753
10268
  }
10754
- }, _callee, null, [[17, 23]]);
10269
+ }, _callee, null, [[15, 21]]);
10755
10270
  }));
10756
10271
  return function(_x, _x2, _x3, _x4) {
10757
10272
  return _ref2.apply(this, arguments);
@@ -10784,19 +10299,19 @@
10784
10299
  if (bufferEnd < MAX_HOLE || !media.readyState)
10785
10300
  return;
10786
10301
  var opts = _this._opts;
10787
- if (isMediaPlaying(media) && media.currentTime) {
10302
+ if (isMediaPlaying(media)) {
10788
10303
  if (_this._gapService) {
10789
10304
  _this._gapService.do(media, opts.maxJumpDistance, _this.isLive, 3);
10790
10305
  }
10791
10306
  } else {
10792
- if (!media.currentTime && _this._gapService && opts.enableStartGapJump) {
10307
+ if (!media.currentTime && _this._gapService) {
10793
10308
  var gapJump = _this._opts.mseLowLatency || _this._opts.mseLowLatency === false && _this.bufferInfo(MAX_START_GAP).nextStart;
10794
10309
  if (gapJump) {
10795
10310
  _this._gapService.do(media, opts.maxJumpDistance, _this.isLive, 3);
10796
10311
  }
10797
10312
  return;
10798
10313
  }
10799
- if (opts.isLive && media.readyState === 4 && bufferEnd - media.currentTime > opts.disconnectTime) {
10314
+ if (opts.isLive && media.readyState === 4 && bufferEnd > opts.disconnectTime) {
10800
10315
  _this.disconnect();
10801
10316
  }
10802
10317
  }
@@ -10945,7 +10460,6 @@
10945
10460
  responseType: "arraybuffer"
10946
10461
  }));
10947
10462
  _this._disconnectRetryCount = _this._opts.disconnectRetryCount;
10948
- _this._transferCost = new TransferCost();
10949
10463
  _this._bufferService = new BufferService(_assertThisInitialized$3(_this), _this._opts.softDecode ? _this.media : void 0, _this._opts);
10950
10464
  _this._seiService = new SeiService(_assertThisInitialized$3(_this));
10951
10465
  _this._bandwidthService = new BandwidthService({
@@ -10969,7 +10483,7 @@
10969
10483
  _createClass$4(Flv2, [{
10970
10484
  key: "version",
10971
10485
  get: function get() {
10972
- return "3.0.20-rc.6";
10486
+ return "3.0.19-rc.0";
10973
10487
  }
10974
10488
  }, {
10975
10489
  key: "isLive",
@@ -11085,9 +10599,9 @@
11085
10599
  return this._clear();
11086
10600
  case 8:
11087
10601
  setTimeout(function() {
11088
- _this2._seamlessSwitching = true;
11089
10602
  _this2._loadData(_this2._opts.url);
11090
10603
  _this2._bufferService.seamlessSwitch();
10604
+ _this2._seamlessSwitching = true;
11091
10605
  });
11092
10606
  _context5.next = 13;
11093
10607
  break;
@@ -11111,82 +10625,50 @@
11111
10625
  }, {
11112
10626
  key: "disconnect",
11113
10627
  value: function disconnect() {
11114
- var _this$_bufferService4;
11115
10628
  logger.debug("disconnect!");
11116
- (_this$_bufferService4 = this._bufferService) === null || _this$_bufferService4 === void 0 ? void 0 : _this$_bufferService4.resetSeamlessSwitchStats();
11117
10629
  return this._clear();
11118
10630
  }
11119
10631
  }, {
11120
10632
  key: "switchURL",
11121
10633
  value: function() {
11122
- var _switchURL = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee7(url, seamless) {
10634
+ var _switchURL = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee6(url, seamless) {
11123
10635
  var _this3 = this;
11124
- return _regeneratorRuntime$1().wrap(function _callee7$(_context7) {
10636
+ return _regeneratorRuntime$1().wrap(function _callee6$(_context6) {
11125
10637
  while (1)
11126
- switch (_context7.prev = _context7.next) {
10638
+ switch (_context6.prev = _context6.next) {
11127
10639
  case 0:
11128
10640
  if (this._bufferService) {
11129
- _context7.next = 2;
10641
+ _context6.next = 2;
11130
10642
  break;
11131
10643
  }
11132
- return _context7.abrupt("return");
10644
+ return _context6.abrupt("return");
11133
10645
  case 2:
11134
10646
  this._resetDisconnectCount();
11135
- if (!(this._loading && seamless)) {
11136
- _context7.next = 6;
11137
- break;
11138
- }
11139
- this._bufferService.seamlessLoadingSwitch = /* @__PURE__ */ function() {
11140
- var _ref5 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee6(pts) {
11141
- return _regeneratorRuntime$1().wrap(function _callee6$(_context6) {
11142
- while (1)
11143
- switch (_context6.prev = _context6.next) {
11144
- case 0:
11145
- _context6.next = 2;
11146
- return _this3._clear();
11147
- case 2:
11148
- _this3._bufferService.seamlessLoadingSwitching = true;
11149
- _this3._urlSwitching = true;
11150
- _this3._seamlessSwitching = true;
11151
- _this3._bufferService.seamlessSwitch();
11152
- _this3._loadData(url);
11153
- case 7:
11154
- case "end":
11155
- return _context6.stop();
11156
- }
11157
- }, _callee6);
11158
- }));
11159
- return function(_x8) {
11160
- return _ref5.apply(this, arguments);
11161
- };
11162
- }();
11163
- return _context7.abrupt("return");
11164
- case 6:
11165
10647
  if (!(!seamless || !this._opts.isLive)) {
11166
- _context7.next = 11;
10648
+ _context6.next = 8;
11167
10649
  break;
11168
10650
  }
11169
- _context7.next = 9;
10651
+ _context6.next = 6;
11170
10652
  return this.load(url);
11171
- case 9:
10653
+ case 6:
11172
10654
  this._urlSwitching = true;
11173
- return _context7.abrupt("return", this.media.play(true).catch(function() {
10655
+ return _context6.abrupt("return", this.media.play(true).catch(function() {
11174
10656
  }));
11175
- case 11:
11176
- _context7.next = 13;
10657
+ case 8:
10658
+ _context6.next = 10;
11177
10659
  return this._clear();
11178
- case 13:
10660
+ case 10:
11179
10661
  setTimeout(function() {
11180
10662
  _this3._urlSwitching = true;
11181
10663
  _this3._seamlessSwitching = true;
11182
10664
  _this3._loadData(url);
11183
10665
  _this3._bufferService.seamlessSwitch();
11184
10666
  });
11185
- case 14:
10667
+ case 11:
11186
10668
  case "end":
11187
- return _context7.stop();
10669
+ return _context6.stop();
11188
10670
  }
11189
- }, _callee7, this);
10671
+ }, _callee6, this);
11190
10672
  }));
11191
10673
  function switchURL(_x6, _x7) {
11192
10674
  return _switchURL.apply(this, arguments);
@@ -11196,16 +10678,16 @@
11196
10678
  }, {
11197
10679
  key: "destroy",
11198
10680
  value: function() {
11199
- var _destroy = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee8() {
11200
- return _regeneratorRuntime$1().wrap(function _callee8$(_context8) {
10681
+ var _destroy = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee7() {
10682
+ return _regeneratorRuntime$1().wrap(function _callee7$(_context7) {
11201
10683
  while (1)
11202
- switch (_context8.prev = _context8.next) {
10684
+ switch (_context7.prev = _context7.next) {
11203
10685
  case 0:
11204
10686
  if (this.media) {
11205
- _context8.next = 2;
10687
+ _context7.next = 2;
11206
10688
  break;
11207
10689
  }
11208
- return _context8.abrupt("return");
10690
+ return _context7.abrupt("return");
11209
10691
  case 2:
11210
10692
  this.removeAllListeners();
11211
10693
  this._seiService.reset();
@@ -11215,16 +10697,16 @@
11215
10697
  this.media.removeEventListener("timeupdate", this._onTimeupdate);
11216
10698
  this.media.removeEventListener("waiting", this._onWaiting);
11217
10699
  this.media.removeEventListener("progress", this._onBufferUpdate);
11218
- _context8.next = 12;
10700
+ _context7.next = 12;
11219
10701
  return Promise.all([this._clear(), this._bufferService.destroy()]);
11220
10702
  case 12:
11221
10703
  this.media = null;
11222
10704
  this._bufferService = null;
11223
10705
  case 14:
11224
10706
  case "end":
11225
- return _context8.stop();
10707
+ return _context7.stop();
11226
10708
  }
11227
- }, _callee8, this);
10709
+ }, _callee7, this);
11228
10710
  }));
11229
10711
  function destroy() {
11230
10712
  return _destroy.apply(this, arguments);
@@ -11253,26 +10735,26 @@
11253
10735
  }, {
11254
10736
  key: "_reset",
11255
10737
  value: function() {
11256
- var _reset2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee9() {
11257
- var reuseMse, _args9 = arguments;
11258
- return _regeneratorRuntime$1().wrap(function _callee9$(_context9) {
10738
+ var _reset2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee8() {
10739
+ var reuseMse, _args8 = arguments;
10740
+ return _regeneratorRuntime$1().wrap(function _callee8$(_context8) {
11259
10741
  while (1)
11260
- switch (_context9.prev = _context9.next) {
10742
+ switch (_context8.prev = _context8.next) {
11261
10743
  case 0:
11262
- reuseMse = _args9.length > 0 && _args9[0] !== void 0 ? _args9[0] : false;
10744
+ reuseMse = _args8.length > 0 && _args8[0] !== void 0 ? _args8[0] : false;
11263
10745
  this._seiService.reset();
11264
10746
  this._bandwidthService.reset();
11265
10747
  this._stats.reset();
11266
- _context9.next = 6;
10748
+ _context8.next = 6;
11267
10749
  return this._clear();
11268
10750
  case 6:
11269
- _context9.next = 8;
10751
+ _context8.next = 8;
11270
10752
  return this._bufferService.reset(reuseMse);
11271
10753
  case 8:
11272
10754
  case "end":
11273
- return _context9.stop();
10755
+ return _context8.stop();
11274
10756
  }
11275
- }, _callee9, this);
10757
+ }, _callee8, this);
11276
10758
  }));
11277
10759
  function _reset() {
11278
10760
  return _reset2.apply(this, arguments);
@@ -11282,17 +10764,17 @@
11282
10764
  }, {
11283
10765
  key: "_loadData",
11284
10766
  value: function() {
11285
- var _loadData2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee10(url, range) {
10767
+ var _loadData2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee9(url, range) {
11286
10768
  var finnalUrl;
11287
- return _regeneratorRuntime$1().wrap(function _callee10$(_context10) {
10769
+ return _regeneratorRuntime$1().wrap(function _callee9$(_context9) {
11288
10770
  while (1)
11289
- switch (_context10.prev = _context10.next) {
10771
+ switch (_context9.prev = _context9.next) {
11290
10772
  case 0:
11291
10773
  if (url)
11292
10774
  this._opts.url = url;
11293
10775
  finnalUrl = url = this._opts.url;
11294
10776
  if (url) {
11295
- _context10.next = 4;
10777
+ _context9.next = 4;
11296
10778
  break;
11297
10779
  }
11298
10780
  throw new Error("Source url is missing");
@@ -11307,34 +10789,34 @@
11307
10789
  });
11308
10790
  logger.debug("load data, loading:", this._loading, finnalUrl);
11309
10791
  if (!this._loading) {
11310
- _context10.next = 11;
10792
+ _context9.next = 11;
11311
10793
  break;
11312
10794
  }
11313
- _context10.next = 11;
10795
+ _context9.next = 11;
11314
10796
  return this._mediaLoader.cancel();
11315
10797
  case 11:
11316
10798
  this._loading = true;
11317
- _context10.prev = 12;
11318
- _context10.next = 15;
10799
+ _context9.prev = 12;
10800
+ _context9.next = 15;
11319
10801
  return this._mediaLoader.load({
11320
10802
  url: finnalUrl,
11321
10803
  range
11322
10804
  });
11323
10805
  case 15:
11324
- _context10.next = 21;
10806
+ _context9.next = 21;
11325
10807
  break;
11326
10808
  case 17:
11327
- _context10.prev = 17;
11328
- _context10.t0 = _context10["catch"](12);
10809
+ _context9.prev = 17;
10810
+ _context9.t0 = _context9["catch"](12);
11329
10811
  this._loading = false;
11330
- return _context10.abrupt("return", this._emitError(StreamingError.network(_context10.t0), false));
10812
+ return _context9.abrupt("return", this._emitError(StreamingError.network(_context9.t0), false));
11331
10813
  case 21:
11332
10814
  case "end":
11333
- return _context10.stop();
10815
+ return _context9.stop();
11334
10816
  }
11335
- }, _callee10, this, [[12, 17]]);
10817
+ }, _callee9, this, [[12, 17]]);
11336
10818
  }));
11337
- function _loadData(_x9, _x10) {
10819
+ function _loadData(_x8, _x9) {
11338
10820
  return _loadData2.apply(this, arguments);
11339
10821
  }
11340
10822
  return _loadData;
@@ -11342,16 +10824,16 @@
11342
10824
  }, {
11343
10825
  key: "_clear",
11344
10826
  value: function() {
11345
- var _clear2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee11() {
11346
- return _regeneratorRuntime$1().wrap(function _callee11$(_context11) {
10827
+ var _clear2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee10() {
10828
+ return _regeneratorRuntime$1().wrap(function _callee10$(_context10) {
11347
10829
  while (1)
11348
- switch (_context11.prev = _context11.next) {
10830
+ switch (_context10.prev = _context10.next) {
11349
10831
  case 0:
11350
10832
  if (!this._mediaLoader) {
11351
- _context11.next = 3;
10833
+ _context10.next = 3;
11352
10834
  break;
11353
10835
  }
11354
- _context11.next = 3;
10836
+ _context10.next = 3;
11355
10837
  return this._mediaLoader.cancel();
11356
10838
  case 3:
11357
10839
  clearTimeout(this._maxChunkWaitTimer);
@@ -11360,9 +10842,9 @@
11360
10842
  this._firstProgressEmit = false;
11361
10843
  case 7:
11362
10844
  case "end":
11363
- return _context11.stop();
10845
+ return _context10.stop();
11364
10846
  }
11365
- }, _callee11, this);
10847
+ }, _callee10, this);
11366
10848
  }));
11367
10849
  function _clear() {
11368
10850
  return _clear2.apply(this, arguments);
@@ -11449,13 +10931,9 @@
11449
10931
  _createClass$4(PluginExtension2, [{
11450
10932
  key: "_init",
11451
10933
  value: function _init() {
11452
- 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;
10934
+ var _this$_opts2 = this._opts, media = _this$_opts2.media, preloadTime = _this$_opts2.preloadTime, innerDegrade = _this$_opts2.innerDegrade, decodeMode = _this$_opts2.decodeMode;
11453
10935
  if (!media)
11454
10936
  return;
11455
- if (!isLive && media.setPlayMode) {
11456
- media.setPlayMode("VOD");
11457
- return;
11458
- }
11459
10937
  if (innerDegrade) {
11460
10938
  media.setAttribute("innerdegrade", innerDegrade);
11461
10939
  }
@@ -11493,7 +10971,6 @@
11493
10971
  args[_key] = arguments[_key];
11494
10972
  }
11495
10973
  _this = _super.call.apply(_super, [this].concat(args));
11496
- _defineProperty$3(_assertThisInitialized$3(_this), "logger", logger);
11497
10974
  _defineProperty$3(_assertThisInitialized$3(_this), "flv", null);
11498
10975
  _defineProperty$3(_assertThisInitialized$3(_this), "pluginExtension", null);
11499
10976
  _defineProperty$3(_assertThisInitialized$3(_this), "getStats", function() {
@@ -11561,17 +11038,11 @@
11561
11038
  var _this$flv3;
11562
11039
  return (_this$flv3 = this.flv) === null || _this$flv3 === void 0 ? void 0 : _this$flv3.loader;
11563
11040
  }
11564
- }, {
11565
- key: "transferCost",
11566
- get: function get() {
11567
- return this.flv._transferCost.transferCost;
11568
- }
11569
11041
  }, {
11570
11042
  key: "beforePlayerInit",
11571
11043
  value: function beforePlayerInit() {
11572
11044
  var _this2 = this;
11573
11045
  var config = this.player.config;
11574
- var mediaElem = this.player.media || this.player.video;
11575
11046
  if (!config.url)
11576
11047
  return;
11577
11048
  if (this.flv)
@@ -11584,10 +11055,10 @@
11584
11055
  this.flv = new Flv(_objectSpread2$2({
11585
11056
  softDecode: this.softDecode,
11586
11057
  isLive: config.isLive,
11587
- media: mediaElem,
11058
+ media: this.player.video,
11588
11059
  preProcessUrl: function preProcessUrl(url, ext) {
11589
- var _this2$player, _this2$player$preProc;
11590
- 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)) || {
11060
+ var _this2$player$preProc, _this2$player;
11061
+ 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)) || {
11591
11062
  url,
11592
11063
  ext
11593
11064
  };
@@ -11606,8 +11077,7 @@
11606
11077
  }
11607
11078
  if (this.softDecode) {
11608
11079
  this.pluginExtension = new PluginExtension(_objectSpread2$2({
11609
- media: this.player.video,
11610
- isLive: config.isLive
11080
+ media: this.player.video
11611
11081
  }, config.flv), this);
11612
11082
  this.player.forceDegradeToVideo = function() {
11613
11083
  var _this2$pluginExtensio;
@@ -11634,7 +11104,6 @@
11634
11104
  this._transCoreEvent(EVENT.LOAD_RETRY);
11635
11105
  this._transCoreEvent(EVENT.SOURCEBUFFER_CREATED);
11636
11106
  this._transCoreEvent(EVENT.ANALYZE_DURATION_EXCEEDED);
11637
- this._transCoreEvent(EVENT.APPEND_BUFFER);
11638
11107
  this._transCoreEvent(EVENT.REMOVE_BUFFER);
11639
11108
  this._transCoreEvent(EVENT.BUFFEREOS);
11640
11109
  this._transCoreEvent(EVENT.KEYFRAME);