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