@volcengine/veplayer-plugin 2.4.1-rc.0 → 2.5.0-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.
- package/esm/index.d.ts +1 -0
- package/esm/index.development.css +7 -0
- package/esm/index.development.js +31562 -23809
- package/esm/index.production.css +1 -1
- package/esm/index.production.js +13 -4
- package/esm/veplayer.plugin.abr.development.js +59 -3
- package/esm/veplayer.plugin.abr.production.js +1 -1
- package/esm/veplayer.plugin.ad.development.css +7 -0
- package/esm/veplayer.plugin.ad.development.js +9042 -0
- package/esm/veplayer.plugin.ad.production.css +1 -0
- package/esm/veplayer.plugin.ad.production.js +4 -0
- package/esm/veplayer.plugin.drm.development.js +59 -3
- package/esm/veplayer.plugin.drm.production.js +1 -1
- package/esm/veplayer.plugin.flv.development.js +63 -22
- package/esm/veplayer.plugin.flv.production.js +1 -1
- package/esm/veplayer.plugin.hls.development.js +398 -55
- package/esm/veplayer.plugin.hls.production.js +1 -1
- package/esm/veplayer.plugin.mp4.development.js +61 -5
- package/esm/veplayer.plugin.mp4.production.js +1 -1
- package/esm/veplayer.plugin.rtm.development.js +63 -13
- package/esm/veplayer.plugin.rtm.production.js +1 -1
- package/esm/veplayer.plugin.shaka.development.js +60 -4
- package/esm/veplayer.plugin.shaka.production.js +1 -1
- package/package.json +1 -1
- package/umd/index.d.ts +1 -0
- package/umd/veplayer.plugin.abr.development.js +59 -3
- package/umd/veplayer.plugin.abr.production.js +1 -1
- package/umd/veplayer.plugin.ad.development.css +7 -0
- package/umd/veplayer.plugin.ad.development.js +9045 -0
- package/umd/veplayer.plugin.ad.production.css +1 -0
- package/umd/veplayer.plugin.ad.production.js +1 -0
- package/umd/veplayer.plugin.drm.development.js +59 -3
- package/umd/veplayer.plugin.drm.production.js +1 -1
- package/umd/veplayer.plugin.flv.development.js +63 -22
- package/umd/veplayer.plugin.flv.production.js +1 -1
- package/umd/veplayer.plugin.hls.development.js +398 -55
- package/umd/veplayer.plugin.hls.production.js +1 -1
- package/umd/veplayer.plugin.mp4.development.js +61 -5
- package/umd/veplayer.plugin.mp4.production.js +1 -1
- package/umd/veplayer.plugin.rtm.development.js +63 -13
- package/umd/veplayer.plugin.rtm.production.js +1 -1
- package/umd/veplayer.plugin.shaka.development.js +60 -4
- package/umd/veplayer.plugin.shaka.production.js +1 -1
|
@@ -1640,7 +1640,7 @@ util.getCurrentTimeByOffset = function(offsetTime, segments) {
|
|
|
1640
1640
|
}
|
|
1641
1641
|
return offsetTime;
|
|
1642
1642
|
};
|
|
1643
|
-
var version = "3.0.
|
|
1643
|
+
var version = "3.0.20-alpha.4";
|
|
1644
1644
|
var ERROR_MAP = {
|
|
1645
1645
|
1: 5101,
|
|
1646
1646
|
2: 5102,
|
|
@@ -1749,8 +1749,7 @@ function hook(hookName, handler) {
|
|
|
1749
1749
|
}
|
|
1750
1750
|
if (this.__hooks && this.__hooks[hookName]) {
|
|
1751
1751
|
try {
|
|
1752
|
-
var
|
|
1753
|
-
var preRet = (_this$__hooks$hookNam = this.__hooks[hookName]).call.apply(_this$__hooks$hookNam, [this, this].concat(Array.prototype.slice.call(arguments)));
|
|
1752
|
+
var preRet = runHooks(this, hookName, handler);
|
|
1754
1753
|
if (preRet) {
|
|
1755
1754
|
if (preRet.then) {
|
|
1756
1755
|
preRet.then(function(isContinue) {
|
|
@@ -1775,6 +1774,19 @@ function hook(hookName, handler) {
|
|
|
1775
1774
|
}
|
|
1776
1775
|
}.bind(this);
|
|
1777
1776
|
}
|
|
1777
|
+
function findHookIndex(hookName, handler) {
|
|
1778
|
+
var __hooks = this.__hooks;
|
|
1779
|
+
if (!__hooks || !Array.isArray(__hooks[hookName])) {
|
|
1780
|
+
return -1;
|
|
1781
|
+
}
|
|
1782
|
+
var hookHandlers = __hooks[hookName];
|
|
1783
|
+
for (var i = 0; i < hookHandlers.length; i++) {
|
|
1784
|
+
if (hookHandlers[i] === handler) {
|
|
1785
|
+
return i;
|
|
1786
|
+
}
|
|
1787
|
+
}
|
|
1788
|
+
return -1;
|
|
1789
|
+
}
|
|
1778
1790
|
function useHooks(hookName, handler) {
|
|
1779
1791
|
var __hooks = this.__hooks;
|
|
1780
1792
|
if (!__hooks) {
|
|
@@ -1784,7 +1796,12 @@ function useHooks(hookName, handler) {
|
|
|
1784
1796
|
console.warn("has no supported hook which name [".concat(hookName, "]"));
|
|
1785
1797
|
return false;
|
|
1786
1798
|
}
|
|
1787
|
-
|
|
1799
|
+
if (!Array.isArray(__hooks[hookName])) {
|
|
1800
|
+
__hooks[hookName] = [];
|
|
1801
|
+
}
|
|
1802
|
+
if (findHookIndex.call(this, hookName, handler) === -1) {
|
|
1803
|
+
__hooks[hookName].push(handler);
|
|
1804
|
+
}
|
|
1788
1805
|
return true;
|
|
1789
1806
|
}
|
|
1790
1807
|
function removeHooks(hookName, handler) {
|
|
@@ -1792,6 +1809,13 @@ function removeHooks(hookName, handler) {
|
|
|
1792
1809
|
if (!__hooks) {
|
|
1793
1810
|
return;
|
|
1794
1811
|
}
|
|
1812
|
+
if (Array.isArray(__hooks[hookName])) {
|
|
1813
|
+
var hooks = __hooks[hookName];
|
|
1814
|
+
var index = findHookIndex.call(this, hookName, handler);
|
|
1815
|
+
if (index !== -1) {
|
|
1816
|
+
hooks.splice(index, 1);
|
|
1817
|
+
}
|
|
1818
|
+
}
|
|
1795
1819
|
delete __hooks[hookName];
|
|
1796
1820
|
}
|
|
1797
1821
|
function hooksDescriptor(instance) {
|
|
@@ -1813,6 +1837,38 @@ function hooksDescriptor(instance) {
|
|
|
1813
1837
|
function delHooksDescriptor(instance) {
|
|
1814
1838
|
instance.__hooks = null;
|
|
1815
1839
|
}
|
|
1840
|
+
function runHooks(obj, hookName, handler) {
|
|
1841
|
+
for (var _len5 = arguments.length, args = new Array(_len5 > 3 ? _len5 - 3 : 0), _key5 = 3; _key5 < _len5; _key5++) {
|
|
1842
|
+
args[_key5 - 3] = arguments[_key5];
|
|
1843
|
+
}
|
|
1844
|
+
if (obj.__hooks && Array.isArray(obj.__hooks[hookName])) {
|
|
1845
|
+
var hooks = obj.__hooks[hookName];
|
|
1846
|
+
var index = -1;
|
|
1847
|
+
var runHooksRecursive = function runHooksRecursive2(obj2, hookName2, handler2) {
|
|
1848
|
+
for (var _len6 = arguments.length, args2 = new Array(_len6 > 3 ? _len6 - 3 : 0), _key6 = 3; _key6 < _len6; _key6++) {
|
|
1849
|
+
args2[_key6 - 3] = arguments[_key6];
|
|
1850
|
+
}
|
|
1851
|
+
index++;
|
|
1852
|
+
if (hooks.length === 0 || index === hooks.length) {
|
|
1853
|
+
return handler2.call.apply(handler2, [obj2, obj2].concat(args2));
|
|
1854
|
+
}
|
|
1855
|
+
var hook2 = hooks[index];
|
|
1856
|
+
var ret = hook2.call.apply(hook2, [obj2, obj2].concat(args2));
|
|
1857
|
+
if (ret && ret.then) {
|
|
1858
|
+
return ret.then(function(data) {
|
|
1859
|
+
return data === false ? null : runHooksRecursive2.apply(void 0, [obj2, hookName2, handler2].concat(args2));
|
|
1860
|
+
}).catch(function(e) {
|
|
1861
|
+
console.warn("[runHooks]".concat(hookName2, " reject"), e.message);
|
|
1862
|
+
});
|
|
1863
|
+
} else if (ret !== false) {
|
|
1864
|
+
return runHooksRecursive2.apply(void 0, [obj2, hookName2, handler2].concat(args2));
|
|
1865
|
+
}
|
|
1866
|
+
};
|
|
1867
|
+
return runHooksRecursive.apply(void 0, [obj, hookName, handler].concat(args));
|
|
1868
|
+
} else {
|
|
1869
|
+
return handler.call.apply(handler, [obj, obj].concat(args));
|
|
1870
|
+
}
|
|
1871
|
+
}
|
|
1816
1872
|
function showErrorMsg(pluginName, msg) {
|
|
1817
1873
|
XG_DEBUG.logError("[".concat(pluginName, "] event or callback cant be undefined or null when call ").concat(msg));
|
|
1818
1874
|
}
|
|
@@ -2862,6 +2918,21 @@ var Buffer$1 = /* @__PURE__ */ function() {
|
|
|
2862
2918
|
length: Buffer2.totalLength && Buffer2.totalLength(buffers)
|
|
2863
2919
|
};
|
|
2864
2920
|
}
|
|
2921
|
+
}, {
|
|
2922
|
+
key: "isBuffered",
|
|
2923
|
+
value: function isBuffered(media, pos) {
|
|
2924
|
+
if (media) {
|
|
2925
|
+
var buffered = Buffer2.get(media);
|
|
2926
|
+
if (buffered !== null && buffered !== void 0 && buffered.length) {
|
|
2927
|
+
for (var i = 0; i < buffered.length; i++) {
|
|
2928
|
+
if (pos >= buffered.start(i) && pos <= buffered.end(i)) {
|
|
2929
|
+
return true;
|
|
2930
|
+
}
|
|
2931
|
+
}
|
|
2932
|
+
}
|
|
2933
|
+
}
|
|
2934
|
+
return false;
|
|
2935
|
+
}
|
|
2865
2936
|
}]);
|
|
2866
2937
|
return Buffer2;
|
|
2867
2938
|
}();
|
|
@@ -5982,7 +6053,7 @@ var AAC = /* @__PURE__ */ function() {
|
|
|
5982
6053
|
continue;
|
|
5983
6054
|
}
|
|
5984
6055
|
frameLength = (data[i + 3] & 3) << 11 | data[i + 4] << 3 | (data[i + 5] & 224) >> 5;
|
|
5985
|
-
if (len - i < frameLength)
|
|
6056
|
+
if (!frameLength || len - i < frameLength)
|
|
5986
6057
|
break;
|
|
5987
6058
|
protectionSkipBytes = (~data[i + 1] & 1) * 2;
|
|
5988
6059
|
frames.push({
|
|
@@ -6176,6 +6247,15 @@ function parse2(a) {
|
|
|
6176
6247
|
return parseInt(item, 16);
|
|
6177
6248
|
});
|
|
6178
6249
|
}
|
|
6250
|
+
function combineToFloat(integer, decimal) {
|
|
6251
|
+
return Number(integer + "." + decimal);
|
|
6252
|
+
}
|
|
6253
|
+
function toDegree(matrix) {
|
|
6254
|
+
if (matrix.length < 5)
|
|
6255
|
+
return 0;
|
|
6256
|
+
var scaled0 = Math.hypot(matrix[0], matrix[3]), scaled1 = Math.hypot(matrix[1], matrix[4]);
|
|
6257
|
+
return 0 === scaled0 || 0 === scaled1 ? 0 : 180 * Math.atan2(matrix[1] / scaled1, matrix[0] / scaled0) / Math.PI;
|
|
6258
|
+
}
|
|
6179
6259
|
var NALu = /* @__PURE__ */ function() {
|
|
6180
6260
|
function NALu2() {
|
|
6181
6261
|
_classCallCheck(this, NALu2);
|
|
@@ -6838,13 +6918,16 @@ var MAX_SILENT_FRAME_DURATION = 9e4;
|
|
|
6838
6918
|
var AUDIO_EXCETION_LOG_EMIT_DURATION = 5 * 9e4;
|
|
6839
6919
|
var MAX_VIDEO_FRAME_DURATION = 9e4;
|
|
6840
6920
|
var MAX_DTS_DELTA_WITH_NEXT_CHUNK = 9e4 / 2;
|
|
6921
|
+
var LARGE_AV_FIRST_FRAME_FORCE_FIX_THRESHOLD = 9e4 * 5;
|
|
6841
6922
|
var TsFixer = /* @__PURE__ */ function() {
|
|
6842
|
-
function TsFixer2(videoTrack, audioTrack, metadataTrack) {
|
|
6923
|
+
function TsFixer2(videoTrack, audioTrack, metadataTrack, fixerConfig) {
|
|
6843
6924
|
_classCallCheck(this, TsFixer2);
|
|
6844
6925
|
this.videoTrack = videoTrack;
|
|
6845
6926
|
this.audioTrack = audioTrack;
|
|
6846
6927
|
this.metadataTrack = metadataTrack;
|
|
6847
6928
|
this._baseDts = -1;
|
|
6929
|
+
this._baseVideoDts = -1;
|
|
6930
|
+
this._baseAudioDts = -1;
|
|
6848
6931
|
this._baseDtsInited = false;
|
|
6849
6932
|
this._audioNextPts = void 0;
|
|
6850
6933
|
this._videoNextDts = void 0;
|
|
@@ -6853,6 +6936,8 @@ var TsFixer = /* @__PURE__ */ function() {
|
|
|
6853
6936
|
this._lastAudioExceptionGapDot = 0;
|
|
6854
6937
|
this._lastAudioExceptionOverlapDot = 0;
|
|
6855
6938
|
this._lastAudioExceptionLargeGapDot = 0;
|
|
6939
|
+
this._needForceFixLargeGap = fixerConfig === null || fixerConfig === void 0 ? void 0 : fixerConfig.forceFixLargeGap;
|
|
6940
|
+
this._largeGapThreshold = (fixerConfig === null || fixerConfig === void 0 ? void 0 : fixerConfig.largeGapThreshold) || LARGE_AV_FIRST_FRAME_FORCE_FIX_THRESHOLD;
|
|
6856
6941
|
}
|
|
6857
6942
|
_createClass(TsFixer2, [{
|
|
6858
6943
|
key: "fix",
|
|
@@ -6880,10 +6965,16 @@ var TsFixer = /* @__PURE__ */ function() {
|
|
|
6880
6965
|
if (discontinuity) {
|
|
6881
6966
|
this._calculateBaseDts(this.audioTrack, this.videoTrack);
|
|
6882
6967
|
this._baseDts -= startTime;
|
|
6968
|
+
this._baseAudioDts -= startTime;
|
|
6969
|
+
this._baseVideoDts -= startTime;
|
|
6883
6970
|
}
|
|
6884
6971
|
if (!contiguous) {
|
|
6885
6972
|
this._videoNextDts = vaDelta > 0 ? startTime + vaDelta : startTime;
|
|
6886
6973
|
this._audioNextPts = vaDelta > 0 ? startTime : startTime - vaDelta;
|
|
6974
|
+
if (this._needForceFixLargeGap) {
|
|
6975
|
+
this._videoNextDts = 0;
|
|
6976
|
+
this._audioNextPts = 0;
|
|
6977
|
+
}
|
|
6887
6978
|
var vDeltaToNextDts = firstVideoSample ? firstVideoSample.dts - this._baseDts - this._videoNextDts : 0;
|
|
6888
6979
|
var aDeltaToNextDts = firstAudioSample ? firstAudioSample.pts - this._baseDts - this._audioNextPts : 0;
|
|
6889
6980
|
if (Math.abs(vDeltaToNextDts || aDeltaToNextDts) > MAX_VIDEO_FRAME_DURATION) {
|
|
@@ -6916,8 +7007,8 @@ var TsFixer = /* @__PURE__ */ function() {
|
|
|
6916
7007
|
if (!samples.length)
|
|
6917
7008
|
return;
|
|
6918
7009
|
samples.forEach(function(x) {
|
|
6919
|
-
x.dts -= _this2._baseDts;
|
|
6920
|
-
x.pts -= _this2._baseDts;
|
|
7010
|
+
x.dts -= _this2._needForceFixLargeGap ? _this2._baseVideoDts : _this2._baseDts;
|
|
7011
|
+
x.pts -= _this2._needForceFixLargeGap ? _this2._baseVideoDts : _this2._baseDts;
|
|
6921
7012
|
});
|
|
6922
7013
|
if (this._videoNextDts === void 0) {
|
|
6923
7014
|
var samp0 = samples[0];
|
|
@@ -7010,7 +7101,7 @@ var TsFixer = /* @__PURE__ */ function() {
|
|
|
7010
7101
|
if (!samples.length)
|
|
7011
7102
|
return;
|
|
7012
7103
|
samples.forEach(function(x) {
|
|
7013
|
-
x.pts -= _this3._baseDts;
|
|
7104
|
+
x.pts -= _this3._needForceFixLargeGap ? _this3._baseAudioDts : _this3._baseDts;
|
|
7014
7105
|
x.dts = x.pts;
|
|
7015
7106
|
});
|
|
7016
7107
|
this._doFixAudioInternal(audioTrack, samples, 9e4);
|
|
@@ -7027,12 +7118,15 @@ var TsFixer = /* @__PURE__ */ function() {
|
|
|
7027
7118
|
var videoBaseDts = Infinity;
|
|
7028
7119
|
if (audioSamps.length) {
|
|
7029
7120
|
audioTrack.baseDts = audioBasePts = audioSamps[0].pts;
|
|
7121
|
+
this._baseAudioDts = audioBasePts;
|
|
7030
7122
|
}
|
|
7031
7123
|
if (videoSamps.length) {
|
|
7032
7124
|
videoTrack.baseDts = videoBaseDts = videoSamps[0].dts;
|
|
7125
|
+
this._baseVideoDts = videoBaseDts;
|
|
7033
7126
|
}
|
|
7034
7127
|
this._baseDts = Math.min(audioBasePts, videoBaseDts);
|
|
7035
7128
|
var delta = videoBaseDts - audioBasePts;
|
|
7129
|
+
var largeGap = false;
|
|
7036
7130
|
if (Number.isFinite(delta) && Math.abs(delta) > LARGE_AV_FIRST_FRAME_GAP) {
|
|
7037
7131
|
videoTrack.warnings.push({
|
|
7038
7132
|
type: WarningType.LARGE_AV_SHIFT,
|
|
@@ -7042,6 +7136,16 @@ var TsFixer = /* @__PURE__ */ function() {
|
|
|
7042
7136
|
delta
|
|
7043
7137
|
});
|
|
7044
7138
|
}
|
|
7139
|
+
if (Number.isFinite(delta) && Math.abs(delta) > this._largeGapThreshold * MAX_SILENT_FRAME_DURATION) {
|
|
7140
|
+
largeGap = true;
|
|
7141
|
+
}
|
|
7142
|
+
if (!this._baseDtsInited) {
|
|
7143
|
+
if (largeGap && this._needForceFixLargeGap) {
|
|
7144
|
+
this._needForceFixLargeGap = true;
|
|
7145
|
+
} else {
|
|
7146
|
+
this._needForceFixLargeGap = false;
|
|
7147
|
+
}
|
|
7148
|
+
}
|
|
7045
7149
|
this._baseDtsInited = true;
|
|
7046
7150
|
return true;
|
|
7047
7151
|
}
|
|
@@ -7135,6 +7239,7 @@ var TsFixer = /* @__PURE__ */ function() {
|
|
|
7135
7239
|
var logger$4 = new Logger$1("TsDemuxer");
|
|
7136
7240
|
var TsDemuxer = /* @__PURE__ */ function() {
|
|
7137
7241
|
function TsDemuxer2(videoTrack, audioTrack, metadataTrack) {
|
|
7242
|
+
var fixerConfig = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
|
|
7138
7243
|
_classCallCheck(this, TsDemuxer2);
|
|
7139
7244
|
_defineProperty(this, "_pmtId", -1);
|
|
7140
7245
|
_defineProperty(this, "_remainingPacketData", null);
|
|
@@ -7144,7 +7249,7 @@ var TsDemuxer = /* @__PURE__ */ function() {
|
|
|
7144
7249
|
this.videoTrack = videoTrack || new VideoTrack();
|
|
7145
7250
|
this.audioTrack = audioTrack || new AudioTrack();
|
|
7146
7251
|
this.metadataTrack = metadataTrack || new MetadataTrack();
|
|
7147
|
-
this._fixer = new TsFixer(this.videoTrack, this.audioTrack, this.metadataTrack);
|
|
7252
|
+
this._fixer = new TsFixer(this.videoTrack, this.audioTrack, this.metadataTrack, fixerConfig);
|
|
7148
7253
|
}
|
|
7149
7254
|
_createClass(TsDemuxer2, [{
|
|
7150
7255
|
key: "demux",
|
|
@@ -7491,6 +7596,166 @@ var TsDemuxer = /* @__PURE__ */ function() {
|
|
|
7491
7596
|
}]);
|
|
7492
7597
|
return TsDemuxer2;
|
|
7493
7598
|
}();
|
|
7599
|
+
var ByteReader = /* @__PURE__ */ function() {
|
|
7600
|
+
function ByteReader2(buf, offset, len) {
|
|
7601
|
+
_classCallCheck(this, ByteReader2);
|
|
7602
|
+
this.dv = new DataView(buf);
|
|
7603
|
+
this.start = this.offset = offset || this.dv.byteOffset;
|
|
7604
|
+
this.end = len ? this.start + len : this.dv.byteLength;
|
|
7605
|
+
}
|
|
7606
|
+
_createClass(ByteReader2, [{
|
|
7607
|
+
key: "buffer",
|
|
7608
|
+
get: function get() {
|
|
7609
|
+
return this.dv.buffer;
|
|
7610
|
+
}
|
|
7611
|
+
}, {
|
|
7612
|
+
key: "unreadLength",
|
|
7613
|
+
get: function get() {
|
|
7614
|
+
return Math.max(this.end - this.offset, 0);
|
|
7615
|
+
}
|
|
7616
|
+
}, {
|
|
7617
|
+
key: "size",
|
|
7618
|
+
get: function get() {
|
|
7619
|
+
return this.end - this.start;
|
|
7620
|
+
}
|
|
7621
|
+
}, {
|
|
7622
|
+
key: "readFloat",
|
|
7623
|
+
value: function readFloat(byteNum) {
|
|
7624
|
+
var val = 0;
|
|
7625
|
+
switch (byteNum) {
|
|
7626
|
+
case 4:
|
|
7627
|
+
val = this.dv.getFloat32(this.offset);
|
|
7628
|
+
break;
|
|
7629
|
+
case 8:
|
|
7630
|
+
val = this.dv.getFloat64(this.offset);
|
|
7631
|
+
break;
|
|
7632
|
+
default:
|
|
7633
|
+
throw new Error("read ".concat(byteNum, "-byte float is not supported"));
|
|
7634
|
+
}
|
|
7635
|
+
this.offset += byteNum;
|
|
7636
|
+
return val;
|
|
7637
|
+
}
|
|
7638
|
+
}, {
|
|
7639
|
+
key: "back",
|
|
7640
|
+
value: function back(byteNum) {
|
|
7641
|
+
this.offset -= byteNum;
|
|
7642
|
+
}
|
|
7643
|
+
}, {
|
|
7644
|
+
key: "skip",
|
|
7645
|
+
value: function skip(byteNum) {
|
|
7646
|
+
this.offset += byteNum;
|
|
7647
|
+
}
|
|
7648
|
+
}, {
|
|
7649
|
+
key: "readInt",
|
|
7650
|
+
value: function readInt(byteNum) {
|
|
7651
|
+
var offset = this.offset;
|
|
7652
|
+
this.offset += byteNum;
|
|
7653
|
+
switch (byteNum) {
|
|
7654
|
+
case 1:
|
|
7655
|
+
return this.dv.getInt8(offset);
|
|
7656
|
+
case 2:
|
|
7657
|
+
return this.dv.getInt16(offset);
|
|
7658
|
+
case 4:
|
|
7659
|
+
return this.dv.getInt32(offset);
|
|
7660
|
+
default:
|
|
7661
|
+
throw new Error("read ".concat(byteNum, "-byte integers is not supported"));
|
|
7662
|
+
}
|
|
7663
|
+
}
|
|
7664
|
+
}, {
|
|
7665
|
+
key: "read",
|
|
7666
|
+
value: function read(byteNum) {
|
|
7667
|
+
var offset = this.offset;
|
|
7668
|
+
this.offset += byteNum;
|
|
7669
|
+
switch (byteNum) {
|
|
7670
|
+
case 1:
|
|
7671
|
+
return this.dv.getUint8(offset);
|
|
7672
|
+
case 2:
|
|
7673
|
+
return this.dv.getUint16(offset);
|
|
7674
|
+
case 3:
|
|
7675
|
+
return (this.dv.getUint16(offset) << 8) + this.dv.getUint8(offset + 2);
|
|
7676
|
+
case 4:
|
|
7677
|
+
return this.dv.getUint32(offset);
|
|
7678
|
+
default:
|
|
7679
|
+
this.back(byteNum - 4);
|
|
7680
|
+
return this.read(byteNum - 4) + this.dv.getUint32(offset) * Math.pow(256, byteNum - 4);
|
|
7681
|
+
}
|
|
7682
|
+
}
|
|
7683
|
+
}, {
|
|
7684
|
+
key: "write",
|
|
7685
|
+
value: function write(byteNum, val) {
|
|
7686
|
+
var offset = this.offset;
|
|
7687
|
+
this.offset += byteNum;
|
|
7688
|
+
switch (byteNum) {
|
|
7689
|
+
case 1:
|
|
7690
|
+
return this.dv.setUint8(offset, val);
|
|
7691
|
+
case 2:
|
|
7692
|
+
return this.dv.setUint16(offset, val);
|
|
7693
|
+
case 3:
|
|
7694
|
+
return this.dv.setUint8(offset, val >>> 16), this.dv.setUint16(offset + 1, 65535 & val);
|
|
7695
|
+
case 4:
|
|
7696
|
+
return this.dv.setUint32(offset, val);
|
|
7697
|
+
default:
|
|
7698
|
+
throw new Error("write ".concat(byteNum, "-byte integers is not supported"));
|
|
7699
|
+
}
|
|
7700
|
+
}
|
|
7701
|
+
}, {
|
|
7702
|
+
key: "readToBuffer",
|
|
7703
|
+
value: function readToBuffer(len) {
|
|
7704
|
+
var buffer;
|
|
7705
|
+
if (this.offset || len) {
|
|
7706
|
+
buffer = this.dv.buffer.slice(this.offset, len ? this.offset + len : void 0);
|
|
7707
|
+
} else {
|
|
7708
|
+
buffer = this.dv.buffer;
|
|
7709
|
+
}
|
|
7710
|
+
this.offset += buffer.byteLength;
|
|
7711
|
+
return buffer;
|
|
7712
|
+
}
|
|
7713
|
+
}, {
|
|
7714
|
+
key: "readToUint8",
|
|
7715
|
+
value: function readToUint8(len) {
|
|
7716
|
+
var uint8 = new Uint8Array(this.dv.buffer, this.offset, len || this.unreadLength);
|
|
7717
|
+
this.offset += uint8.byteLength;
|
|
7718
|
+
return uint8;
|
|
7719
|
+
}
|
|
7720
|
+
}, {
|
|
7721
|
+
key: "readString",
|
|
7722
|
+
value: function readString(len) {
|
|
7723
|
+
var i = 0, str = "";
|
|
7724
|
+
for (; i < len; i++) {
|
|
7725
|
+
str += String.fromCharCode(this.dv.getUint8(this.offset));
|
|
7726
|
+
this.offset++;
|
|
7727
|
+
}
|
|
7728
|
+
return str;
|
|
7729
|
+
}
|
|
7730
|
+
}], [{
|
|
7731
|
+
key: "fromUint8",
|
|
7732
|
+
value: function fromUint8(uint8) {
|
|
7733
|
+
return new ByteReader2(uint8.buffer, uint8.byteOffset, uint8.byteLength);
|
|
7734
|
+
}
|
|
7735
|
+
}, {
|
|
7736
|
+
key: "concatUint8s",
|
|
7737
|
+
value: function concatUint8s(args) {
|
|
7738
|
+
var uint8 = new Uint8Array(args.reduce(function(ret, v) {
|
|
7739
|
+
return ret + v.byteLength;
|
|
7740
|
+
}, 0));
|
|
7741
|
+
var offset = 0;
|
|
7742
|
+
args.forEach(function(v) {
|
|
7743
|
+
uint8.set(v, offset);
|
|
7744
|
+
offset += v.byteLength;
|
|
7745
|
+
});
|
|
7746
|
+
return uint8;
|
|
7747
|
+
}
|
|
7748
|
+
}, {
|
|
7749
|
+
key: "concatUint8",
|
|
7750
|
+
value: function concatUint8() {
|
|
7751
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
7752
|
+
args[_key] = arguments[_key];
|
|
7753
|
+
}
|
|
7754
|
+
return this.concatUint8s(args);
|
|
7755
|
+
}
|
|
7756
|
+
}]);
|
|
7757
|
+
return ByteReader2;
|
|
7758
|
+
}();
|
|
7494
7759
|
var MP4Parser = /* @__PURE__ */ function() {
|
|
7495
7760
|
function MP4Parser2() {
|
|
7496
7761
|
_classCallCheck(this, MP4Parser2);
|
|
@@ -7648,18 +7913,36 @@ var MP4Parser = /* @__PURE__ */ function() {
|
|
|
7648
7913
|
key: "tkhd",
|
|
7649
7914
|
value: function tkhd(box) {
|
|
7650
7915
|
return parseBox(box, true, function(ret, data) {
|
|
7651
|
-
var
|
|
7916
|
+
var byte = ByteReader.fromUint8(data);
|
|
7652
7917
|
if (ret.version === 1) {
|
|
7653
|
-
|
|
7654
|
-
|
|
7655
|
-
|
|
7918
|
+
byte.read(8);
|
|
7919
|
+
byte.read(8);
|
|
7920
|
+
ret.trackId = byte.read(4);
|
|
7921
|
+
byte.read(4);
|
|
7922
|
+
ret.duration = byte.read(8);
|
|
7656
7923
|
} else {
|
|
7657
|
-
|
|
7658
|
-
|
|
7659
|
-
|
|
7924
|
+
byte.read(4);
|
|
7925
|
+
byte.read(4);
|
|
7926
|
+
ret.trackId = byte.read(4);
|
|
7927
|
+
byte.read(4);
|
|
7928
|
+
ret.duration = byte.read(4);
|
|
7929
|
+
}
|
|
7930
|
+
byte.skip(16);
|
|
7931
|
+
ret.matrix = [];
|
|
7932
|
+
for (var i = 0; i < 36; i++) {
|
|
7933
|
+
ret.matrix.push(byte.read(1));
|
|
7934
|
+
}
|
|
7935
|
+
byte.back(36);
|
|
7936
|
+
var caculatedMatrix = [];
|
|
7937
|
+
for (var _i = 0, int32; _i < 3; _i++) {
|
|
7938
|
+
caculatedMatrix.push(combineToFloat(byte.readInt(2), byte.readInt(2)));
|
|
7939
|
+
caculatedMatrix.push(combineToFloat(byte.readInt(2), byte.readInt(2)));
|
|
7940
|
+
int32 = byte.readInt(4);
|
|
7941
|
+
caculatedMatrix.push(combineToFloat(int32 >> 30, int32 & 1073741823));
|
|
7660
7942
|
}
|
|
7661
|
-
ret.
|
|
7662
|
-
ret.
|
|
7943
|
+
ret.rotation = toDegree(caculatedMatrix);
|
|
7944
|
+
ret.width = byte.read(4);
|
|
7945
|
+
ret.height = byte.read(4);
|
|
7663
7946
|
});
|
|
7664
7947
|
}
|
|
7665
7948
|
}, {
|
|
@@ -7789,7 +8072,7 @@ var MP4Parser = /* @__PURE__ */ function() {
|
|
|
7789
8072
|
if (ret.version > 0) {
|
|
7790
8073
|
var numKeyIds = readBig32(data, start);
|
|
7791
8074
|
start += 4;
|
|
7792
|
-
for (var
|
|
8075
|
+
for (var _i2 = 0; _i2 < ("" + numKeyIds).length; _i2++) {
|
|
7793
8076
|
for (var j = 0; j < 16; j++) {
|
|
7794
8077
|
var keyId = data[start];
|
|
7795
8078
|
start += 1;
|
|
@@ -7925,7 +8208,7 @@ var MP4Parser = /* @__PURE__ */ function() {
|
|
|
7925
8208
|
ret.ppsLength = data[start];
|
|
7926
8209
|
start += 1;
|
|
7927
8210
|
ret.pps = [];
|
|
7928
|
-
for (var
|
|
8211
|
+
for (var _i3 = 0; _i3 < ret.ppsLength; _i3++) {
|
|
7929
8212
|
var _size = readBig16(data, start);
|
|
7930
8213
|
start += 2;
|
|
7931
8214
|
ret.pps.push(data.subarray(start, start += _size));
|
|
@@ -8094,7 +8377,7 @@ var MP4Parser = /* @__PURE__ */ function() {
|
|
|
8094
8377
|
start += 8;
|
|
8095
8378
|
}
|
|
8096
8379
|
} else {
|
|
8097
|
-
for (var
|
|
8380
|
+
for (var _i4 = 0; _i4 < entryCount; _i4++) {
|
|
8098
8381
|
entries.push({
|
|
8099
8382
|
count: readBig32(data, start),
|
|
8100
8383
|
offset: -(~readBig32(data, start + 4) + 1)
|
|
@@ -8316,6 +8599,8 @@ var MP4Parser = /* @__PURE__ */ function() {
|
|
|
8316
8599
|
v.mvhdTimecale = moov.mvhd.timescale;
|
|
8317
8600
|
v.timescale = v.formatTimescale = vTrack.mdia.mdhd.timescale;
|
|
8318
8601
|
v.duration = vTrack.mdia.mdhd.duration || v.mvhdDurtion / v.mvhdTimecale * v.timescale;
|
|
8602
|
+
v.rotation = vTrack.tkhd.rotation;
|
|
8603
|
+
v.matrix = vTrack.tkhd.matrix;
|
|
8319
8604
|
var e1 = vTrack.mdia.minf.stbl.stsd.entries[0];
|
|
8320
8605
|
v.width = e1.width;
|
|
8321
8606
|
v.height = e1.height;
|
|
@@ -10882,11 +11167,11 @@ var Event$1 = _objectSpread2$2(_objectSpread2$2({}, EVENT), {}, {
|
|
|
10882
11167
|
});
|
|
10883
11168
|
var logger$3 = new Logger$2("Transmuxer");
|
|
10884
11169
|
var Transmuxer = /* @__PURE__ */ function() {
|
|
10885
|
-
function Transmuxer2(hls, isMP4, needRemux) {
|
|
11170
|
+
function Transmuxer2(hls, isMP4, needRemux, fixerConfig) {
|
|
10886
11171
|
_classCallCheck$3(this, Transmuxer2);
|
|
10887
11172
|
_defineProperty$3(this, "_initSegmentId", "");
|
|
10888
11173
|
this.hls = hls;
|
|
10889
|
-
this._demuxer = isMP4 ? new FMP4Demuxer() : new TsDemuxer();
|
|
11174
|
+
this._demuxer = isMP4 ? new FMP4Demuxer() : new TsDemuxer(null, null, null, fixerConfig);
|
|
10890
11175
|
this._isMP4 = isMP4;
|
|
10891
11176
|
if (needRemux)
|
|
10892
11177
|
this._remuxer = new FMP4Remuxer(this._demuxer.videoTrack, this._demuxer.audioTrack);
|
|
@@ -11153,11 +11438,11 @@ var BufferService = /* @__PURE__ */ function() {
|
|
|
11153
11438
|
return;
|
|
11154
11439
|
if (TsDemuxer.probe(chunk)) {
|
|
11155
11440
|
if (!this._transmuxer)
|
|
11156
|
-
this._transmuxer = new Transmuxer(this.hls, false, !this._softVideo);
|
|
11441
|
+
this._transmuxer = new Transmuxer(this.hls, false, !this._softVideo, this.hls.config.fixerConfig);
|
|
11157
11442
|
} else if (MP4Parser.probe(chunk)) {
|
|
11158
11443
|
if (this._softVideo) {
|
|
11159
11444
|
if (!this._transmuxer)
|
|
11160
|
-
this._transmuxer = new Transmuxer(this.hls, true);
|
|
11445
|
+
this._transmuxer = new Transmuxer(this.hls, true, null, this.hls.config.fixerConfig);
|
|
11161
11446
|
} else {
|
|
11162
11447
|
this._directAppend = true;
|
|
11163
11448
|
var mix = false;
|
|
@@ -11600,7 +11885,11 @@ function getConfig(cfg) {
|
|
|
11600
11885
|
minSegmentsStartPlay: 3,
|
|
11601
11886
|
preferMMS: false,
|
|
11602
11887
|
preferMMSStreaming: false,
|
|
11603
|
-
mseLowLatency: true
|
|
11888
|
+
mseLowLatency: true,
|
|
11889
|
+
fixerConfig: {
|
|
11890
|
+
forceFixLargeGap: false,
|
|
11891
|
+
largeGapThreshold: 5
|
|
11892
|
+
}
|
|
11604
11893
|
}, cfg), {}, {
|
|
11605
11894
|
media
|
|
11606
11895
|
});
|
|
@@ -11715,6 +12004,8 @@ var MediaPlaylist = /* @__PURE__ */ _createClass$3(function MediaPlaylist2() {
|
|
|
11715
12004
|
_defineProperty$3(this, "lowLatency", false);
|
|
11716
12005
|
_defineProperty$3(this, "endPartIndex", 0);
|
|
11717
12006
|
_defineProperty$3(this, "segments", []);
|
|
12007
|
+
_defineProperty$3(this, "dateRanges", {});
|
|
12008
|
+
_defineProperty$3(this, "skippedSegments", 0);
|
|
11718
12009
|
});
|
|
11719
12010
|
var MediaSegment = /* @__PURE__ */ function() {
|
|
11720
12011
|
function MediaSegment2(parentUrl) {
|
|
@@ -11886,6 +12177,38 @@ function getCodecs(type, codecs) {
|
|
|
11886
12177
|
}
|
|
11887
12178
|
}
|
|
11888
12179
|
}
|
|
12180
|
+
function isValidDaterange(attr, dateRangeWithSameId) {
|
|
12181
|
+
var _badValueForSameId;
|
|
12182
|
+
if (dateRangeWithSameId) {
|
|
12183
|
+
for (var key in dateRangeWithSameId) {
|
|
12184
|
+
if (Object.prototype.hasOwnProperty.call(dateRangeWithSameId, key) && attr[key] !== dateRangeWithSameId[key]) {
|
|
12185
|
+
_badValueForSameId = key;
|
|
12186
|
+
break;
|
|
12187
|
+
}
|
|
12188
|
+
}
|
|
12189
|
+
}
|
|
12190
|
+
var duration = null;
|
|
12191
|
+
if (attr.DURATION) {
|
|
12192
|
+
duration = parseFloat(attr.DURATION);
|
|
12193
|
+
if (!Number.isFinite(duration)) {
|
|
12194
|
+
duration = null;
|
|
12195
|
+
} else if (attr._endDate) {
|
|
12196
|
+
duration = (attr._endDate.getTime() - attr._startDate.getTime()) / 1e3;
|
|
12197
|
+
}
|
|
12198
|
+
}
|
|
12199
|
+
var cue = enumeratedStringList(attr.CUE || attr["X-CUE"], {
|
|
12200
|
+
pre: false,
|
|
12201
|
+
post: false,
|
|
12202
|
+
once: false
|
|
12203
|
+
});
|
|
12204
|
+
return !!attr.ID && !_badValueForSameId && Number.isFinite(attr._startDate.getTime()) && (duration === null || duration >= 0) && (!(attr.END_ON_NEXT === "YES") || !!attr.CLASS) && (!attr.CUE || !cue.pre && !cue.post || cue.pre !== cue.post) && (!(attr.CLASS === "com.apple.hls.interstitial") || "X-ASSET-URI" in attr || "X-ASSET-LIST" in attr);
|
|
12205
|
+
}
|
|
12206
|
+
function enumeratedStringList(attrValue, dict) {
|
|
12207
|
+
return (attrValue ? attrValue.split(/[ ,]+/) : []).reduce(function(result, identifier) {
|
|
12208
|
+
result[identifier.toLowerCase()] = true;
|
|
12209
|
+
return result;
|
|
12210
|
+
}, dict);
|
|
12211
|
+
}
|
|
11889
12212
|
function parseMasterPlaylist(lines, parentUrl) {
|
|
11890
12213
|
var master = new MasterPlaylist();
|
|
11891
12214
|
var index = 0;
|
|
@@ -11994,9 +12317,6 @@ function parseMediaPlaylist(lines, parentUrl, useLowLatency) {
|
|
|
11994
12317
|
var endOfList = false;
|
|
11995
12318
|
var partSegmentIndex = 0;
|
|
11996
12319
|
while (line = lines[index++]) {
|
|
11997
|
-
if (endOfList) {
|
|
11998
|
-
break;
|
|
11999
|
-
}
|
|
12000
12320
|
if (line[0] !== "#") {
|
|
12001
12321
|
if (media.lowLatency) {
|
|
12002
12322
|
curSN++;
|
|
@@ -12050,11 +12370,6 @@ function parseMediaPlaylist(lines, parentUrl, useLowLatency) {
|
|
|
12050
12370
|
break;
|
|
12051
12371
|
case "ENDLIST":
|
|
12052
12372
|
{
|
|
12053
|
-
var _lastSegment = media.segments[media.segments.length - 1];
|
|
12054
|
-
if (_lastSegment) {
|
|
12055
|
-
_lastSegment.isLast = true;
|
|
12056
|
-
}
|
|
12057
|
-
media.live = false;
|
|
12058
12373
|
endOfList = true;
|
|
12059
12374
|
}
|
|
12060
12375
|
break;
|
|
@@ -12151,6 +12466,29 @@ function parseMediaPlaylist(lines, parentUrl, useLowLatency) {
|
|
|
12151
12466
|
curSegment = new MediaSegment(parentUrl);
|
|
12152
12467
|
}
|
|
12153
12468
|
break;
|
|
12469
|
+
case "SKIP":
|
|
12470
|
+
{
|
|
12471
|
+
var _attr5 = parseAttr(data);
|
|
12472
|
+
var skippedSegments = parseInt(_attr5["SKIPPED-SEGMENTS"], 10);
|
|
12473
|
+
if (skippedSegments <= Number.MAX_SAFE_INTEGER) {
|
|
12474
|
+
media.skippedSegments += skippedSegments;
|
|
12475
|
+
}
|
|
12476
|
+
}
|
|
12477
|
+
break;
|
|
12478
|
+
case "DATERANGE":
|
|
12479
|
+
{
|
|
12480
|
+
var _attr6 = parseAttr(data);
|
|
12481
|
+
var dateRangeWithSameId = media.dateRanges[_attr6.ID];
|
|
12482
|
+
_attr6._startDate = dateRangeWithSameId ? dateRangeWithSameId._startDate : new Date(_attr6["START-DATE"]);
|
|
12483
|
+
var endDate = (dateRangeWithSameId === null || dateRangeWithSameId === void 0 ? void 0 : dateRangeWithSameId._endDate) || new Date(_attr6.END_DATE);
|
|
12484
|
+
if (Number.isFinite(endDate)) {
|
|
12485
|
+
_attr6._endDate = endDate;
|
|
12486
|
+
}
|
|
12487
|
+
if (isValidDaterange(_attr6, dateRangeWithSameId) || media.skippedSegments) {
|
|
12488
|
+
media.dateRanges[_attr6.ID] = _attr6;
|
|
12489
|
+
}
|
|
12490
|
+
}
|
|
12491
|
+
break;
|
|
12154
12492
|
}
|
|
12155
12493
|
}
|
|
12156
12494
|
media.segments = media.segments.filter(function(x) {
|
|
@@ -12158,11 +12496,14 @@ function parseMediaPlaylist(lines, parentUrl, useLowLatency) {
|
|
|
12158
12496
|
});
|
|
12159
12497
|
var lastSegment = media.segments[media.segments.length - 1];
|
|
12160
12498
|
if (lastSegment) {
|
|
12161
|
-
|
|
12162
|
-
media.endPartIndex = lastSegment.partIndex;
|
|
12163
|
-
if (endOfList && !lastSegment.isLast) {
|
|
12499
|
+
if (endOfList) {
|
|
12164
12500
|
lastSegment.isLast = true;
|
|
12165
12501
|
}
|
|
12502
|
+
media.endSN = lastSegment.sn;
|
|
12503
|
+
media.endPartIndex = lastSegment.partIndex;
|
|
12504
|
+
}
|
|
12505
|
+
if (endOfList) {
|
|
12506
|
+
media.live = false;
|
|
12166
12507
|
}
|
|
12167
12508
|
media.totalDuration = totalDuration;
|
|
12168
12509
|
media.endCC = curCC;
|
|
@@ -13259,7 +13600,7 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
13259
13600
|
_defineProperty$3(_assertThisInitialized$2(_this), "_switchUrlOpts", null);
|
|
13260
13601
|
_defineProperty$3(_assertThisInitialized$2(_this), "_isProcessQuotaExceeded", false);
|
|
13261
13602
|
_defineProperty$3(_assertThisInitialized$2(_this), "_loadSegment", /* @__PURE__ */ _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee() {
|
|
13262
|
-
var
|
|
13603
|
+
var _this$_playlist, nextSegment, lastSegment, _assertThisInitialize, config, minFrameDuration, maxBufferThroughout, bInfo, bufferThroughout;
|
|
13263
13604
|
return _regeneratorRuntime$1().wrap(function _callee$(_context) {
|
|
13264
13605
|
while (1)
|
|
13265
13606
|
switch (_context.prev = _context.next) {
|
|
@@ -13270,42 +13611,44 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
13270
13611
|
}
|
|
13271
13612
|
return _context.abrupt("return");
|
|
13272
13613
|
case 2:
|
|
13273
|
-
|
|
13614
|
+
_this$_playlist = _this._playlist, nextSegment = _this$_playlist.nextSegment, lastSegment = _this$_playlist.lastSegment;
|
|
13274
13615
|
_assertThisInitialize = _assertThisInitialized$2(_this), config = _assertThisInitialize.config;
|
|
13275
|
-
|
|
13276
|
-
|
|
13616
|
+
minFrameDuration = 0.016;
|
|
13617
|
+
maxBufferThroughout = Math.min(Math.max((lastSegment === null || lastSegment === void 0 ? void 0 : lastSegment.duration) - minFrameDuration / 2 || 0, minFrameDuration), 0.1);
|
|
13618
|
+
if (nextSegment) {
|
|
13619
|
+
_context.next = 8;
|
|
13277
13620
|
break;
|
|
13278
13621
|
}
|
|
13279
13622
|
return _context.abrupt("return");
|
|
13280
|
-
case
|
|
13623
|
+
case 8:
|
|
13281
13624
|
if (_this.isLive) {
|
|
13282
|
-
_context.next =
|
|
13625
|
+
_context.next = 18;
|
|
13283
13626
|
break;
|
|
13284
13627
|
}
|
|
13285
13628
|
bInfo = _this.bufferInfo();
|
|
13286
13629
|
if (_this.media.paused && !_this.media.currentTime) {
|
|
13287
13630
|
bInfo = _this.bufferInfo(bInfo.nextStart || 0.5);
|
|
13288
13631
|
}
|
|
13289
|
-
bufferThroughout = Math.abs(bInfo.end - _this.media.duration) <
|
|
13632
|
+
bufferThroughout = Math.abs(bInfo.end - _this.media.duration) < maxBufferThroughout;
|
|
13290
13633
|
if (!(bInfo.remaining >= config.preloadTime || bufferThroughout)) {
|
|
13291
|
-
_context.next =
|
|
13634
|
+
_context.next = 15;
|
|
13292
13635
|
break;
|
|
13293
13636
|
}
|
|
13294
13637
|
_this._tryEos();
|
|
13295
13638
|
return _context.abrupt("return");
|
|
13296
|
-
case
|
|
13639
|
+
case 15:
|
|
13297
13640
|
if (!(config.preferMMSStreaming && !_this._bufferService.msStreaming)) {
|
|
13298
|
-
_context.next =
|
|
13641
|
+
_context.next = 17;
|
|
13299
13642
|
break;
|
|
13300
13643
|
}
|
|
13301
13644
|
return _context.abrupt("return");
|
|
13302
|
-
case
|
|
13303
|
-
if (!_this._urlSwitching && _this._prevSegSn !==
|
|
13645
|
+
case 17:
|
|
13646
|
+
if (!_this._urlSwitching && _this._prevSegSn !== nextSegment.sn - 1 && bInfo.end && Math.abs(nextSegment.start - bInfo.end) > 1) {
|
|
13304
13647
|
_this._playlist.setNextSegmentByIndex(_this._playlist.findSegmentIndexByTime(bInfo.end + 0.1));
|
|
13305
13648
|
}
|
|
13306
|
-
case
|
|
13649
|
+
case 18:
|
|
13307
13650
|
return _context.abrupt("return", _this._loadSegmentDirect());
|
|
13308
|
-
case
|
|
13651
|
+
case 19:
|
|
13309
13652
|
case "end":
|
|
13310
13653
|
return _context.stop();
|
|
13311
13654
|
}
|
|
@@ -14558,8 +14901,8 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
14558
14901
|
value: function _tryEos() {
|
|
14559
14902
|
var _this$_bufferService3, _this$_bufferService4;
|
|
14560
14903
|
var media = this.media;
|
|
14561
|
-
var _this$
|
|
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);
|
|
14904
|
+
var _this$_playlist2 = this._playlist, nextSegment = _this$_playlist2.nextSegment, lastSegment = _this$_playlist2.lastSegment;
|
|
14905
|
+
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);
|
|
14563
14906
|
if (!eosAllowed) {
|
|
14564
14907
|
return;
|
|
14565
14908
|
}
|
|
@@ -14595,7 +14938,7 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
14595
14938
|
}]);
|
|
14596
14939
|
return Hls2;
|
|
14597
14940
|
}(EventEmitter);
|
|
14598
|
-
_defineProperty$3(Hls, "version", "3.0.
|
|
14941
|
+
_defineProperty$3(Hls, "version", "3.0.20-alpha.2");
|
|
14599
14942
|
try {
|
|
14600
14943
|
if (localStorage.getItem("xgd")) {
|
|
14601
14944
|
Hls.enableLogger();
|