rx-player 4.0.0-dev.2023110700 → 4.0.0-dev.2023111400
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/CHANGELOG.md +9 -1
- package/VERSION +1 -1
- package/dist/_esm5.processed/core/api/option_utils.d.ts +2 -0
- package/dist/_esm5.processed/core/api/option_utils.js +6 -0
- package/dist/_esm5.processed/core/api/public_api.d.ts +2 -1
- package/dist/_esm5.processed/core/api/public_api.js +14 -4
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/text_track_cues_store.js +54 -6
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/utils.d.ts +2 -1
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/utils.js +19 -2
- package/dist/_esm5.processed/manifest/representation.js +18 -5
- package/dist/_esm5.processed/parsers/manifest/dash/common/convert_supplemental_codecs.d.ts +17 -0
- package/dist/_esm5.processed/parsers/manifest/dash/common/convert_supplemental_codecs.js +26 -0
- package/dist/_esm5.processed/parsers/manifest/dash/common/flatten_overlapping_periods.js +5 -0
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representations.js +29 -17
- package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/AdaptationSet.js +3 -0
- package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/Representation.js +3 -0
- package/dist/_esm5.processed/parsers/manifest/dash/node_parser_types.d.ts +2 -0
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/AdaptationSet.js +4 -0
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/Representation.js +4 -0
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/types.d.ts +2 -1
- package/dist/_esm5.processed/parsers/manifest/types.d.ts +1 -0
- package/dist/commonjs/compat/patch_webkit_source_buffer.js +2 -2
- package/dist/commonjs/core/api/option_utils.d.ts +2 -0
- package/dist/commonjs/core/api/option_utils.js +6 -0
- package/dist/commonjs/core/api/public_api.d.ts +2 -1
- package/dist/commonjs/core/api/public_api.js +14 -4
- package/dist/commonjs/core/segment_buffers/implementations/text/html/text_track_cues_store.js +54 -6
- package/dist/commonjs/core/segment_buffers/implementations/text/html/utils.d.ts +2 -1
- package/dist/commonjs/core/segment_buffers/implementations/text/html/utils.js +19 -2
- package/dist/commonjs/core/stream/adaptation/adaptation_stream.js +2 -2
- package/dist/commonjs/core/stream/orchestrator/stream_orchestrator.js +3 -3
- package/dist/commonjs/core/stream/period/period_stream.js +2 -2
- package/dist/commonjs/manifest/representation.js +18 -5
- package/dist/commonjs/parsers/manifest/dash/common/convert_supplemental_codecs.d.ts +17 -0
- package/dist/commonjs/parsers/manifest/dash/common/convert_supplemental_codecs.js +30 -0
- package/dist/commonjs/parsers/manifest/dash/common/flatten_overlapping_periods.js +5 -0
- package/dist/commonjs/parsers/manifest/dash/common/parse_representations.js +29 -17
- package/dist/commonjs/parsers/manifest/dash/js-parser/node_parsers/AdaptationSet.js +3 -0
- package/dist/commonjs/parsers/manifest/dash/js-parser/node_parsers/Representation.js +3 -0
- package/dist/commonjs/parsers/manifest/dash/node_parser_types.d.ts +2 -0
- package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/AdaptationSet.js +4 -0
- package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/Representation.js +4 -0
- package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/types.d.ts +2 -1
- package/dist/commonjs/parsers/manifest/types.d.ts +1 -0
- package/dist/commonjs/utils/queue_microtask.d.ts +2 -0
- package/dist/commonjs/utils/queue_microtask.js +7 -0
- package/dist/es2017/compat/patch_webkit_source_buffer.js +2 -2
- package/dist/es2017/core/api/option_utils.d.ts +2 -0
- package/dist/es2017/core/api/option_utils.js +6 -0
- package/dist/es2017/core/api/public_api.d.ts +2 -1
- package/dist/es2017/core/api/public_api.js +13 -3
- package/dist/es2017/core/segment_buffers/implementations/text/html/text_track_cues_store.js +54 -6
- package/dist/es2017/core/segment_buffers/implementations/text/html/utils.d.ts +2 -1
- package/dist/es2017/core/segment_buffers/implementations/text/html/utils.js +18 -2
- package/dist/es2017/core/stream/adaptation/adaptation_stream.js +2 -2
- package/dist/es2017/core/stream/orchestrator/stream_orchestrator.js +3 -3
- package/dist/es2017/core/stream/period/period_stream.js +2 -2
- package/dist/es2017/manifest/representation.js +18 -5
- package/dist/es2017/parsers/manifest/dash/common/convert_supplemental_codecs.d.ts +17 -0
- package/dist/es2017/parsers/manifest/dash/common/convert_supplemental_codecs.js +26 -0
- package/dist/es2017/parsers/manifest/dash/common/flatten_overlapping_periods.js +5 -0
- package/dist/es2017/parsers/manifest/dash/common/parse_representations.js +29 -17
- package/dist/es2017/parsers/manifest/dash/js-parser/node_parsers/AdaptationSet.js +3 -0
- package/dist/es2017/parsers/manifest/dash/js-parser/node_parsers/Representation.js +3 -0
- package/dist/es2017/parsers/manifest/dash/node_parser_types.d.ts +2 -0
- package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/AdaptationSet.js +4 -0
- package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/Representation.js +4 -0
- package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/types.d.ts +2 -1
- package/dist/es2017/parsers/manifest/types.d.ts +1 -0
- package/dist/es2017/utils/queue_microtask.d.ts +2 -0
- package/dist/es2017/utils/queue_microtask.js +5 -0
- package/dist/mpd-parser.wasm +0 -0
- package/dist/rx-player.js +179 -118
- package/dist/rx-player.min.js +1 -1
- package/package.json +1 -4
- package/sonar-project.properties +1 -1
- package/src/compat/patch_webkit_source_buffer.ts +2 -2
- package/src/core/api/option_utils.ts +8 -0
- package/src/core/api/public_api.ts +15 -3
- package/src/core/segment_buffers/implementations/text/html/__tests__/utils.test.ts +15 -0
- package/src/core/segment_buffers/implementations/text/html/text_track_cues_store.ts +57 -6
- package/src/core/segment_buffers/implementations/text/html/utils.ts +19 -2
- package/src/core/stream/adaptation/adaptation_stream.ts +2 -2
- package/src/core/stream/orchestrator/stream_orchestrator.ts +3 -3
- package/src/core/stream/period/period_stream.ts +2 -2
- package/src/manifest/representation.ts +19 -6
- package/src/parsers/manifest/dash/common/__tests__/convert_supplemental_codecs.test.ts +37 -0
- package/src/parsers/manifest/dash/common/__tests__/flatten_overlapping_period.test.ts +20 -0
- package/src/parsers/manifest/dash/common/convert_supplemental_codecs.ts +32 -0
- package/src/parsers/manifest/dash/common/flatten_overlapping_periods.ts +5 -0
- package/src/parsers/manifest/dash/common/parse_representations.ts +30 -17
- package/src/parsers/manifest/dash/js-parser/node_parsers/AdaptationSet.ts +4 -0
- package/src/parsers/manifest/dash/js-parser/node_parsers/Representation.ts +4 -0
- package/src/parsers/manifest/dash/node_parser_types.ts +2 -0
- package/src/parsers/manifest/dash/wasm-parser/rs/events.rs +2 -0
- package/src/parsers/manifest/dash/wasm-parser/rs/processor/attributes.rs +2 -0
- package/src/parsers/manifest/dash/wasm-parser/ts/generators/AdaptationSet.ts +4 -0
- package/src/parsers/manifest/dash/wasm-parser/ts/generators/Representation.ts +4 -0
- package/src/parsers/manifest/dash/wasm-parser/ts/types.ts +2 -0
- package/src/parsers/manifest/types.ts +2 -0
- package/src/utils/queue_microtask.ts +7 -0
- package/src/typings/next-tick.d.ts +0 -23
package/dist/mpd-parser.wasm
CHANGED
|
Binary file
|
package/dist/rx-player.js
CHANGED
|
@@ -11,88 +11,6 @@
|
|
|
11
11
|
return /******/ (function() { // webpackBootstrap
|
|
12
12
|
/******/ var __webpack_modules__ = ({
|
|
13
13
|
|
|
14
|
-
/***/ 473:
|
|
15
|
-
/***/ (function(module) {
|
|
16
|
-
|
|
17
|
-
"use strict";
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
var ensureCallable = function (fn) {
|
|
21
|
-
if (typeof fn !== 'function') throw new TypeError(fn + " is not a function");
|
|
22
|
-
return fn;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
var byObserver = function (Observer) {
|
|
26
|
-
var node = document.createTextNode(''), queue, currentQueue, i = 0;
|
|
27
|
-
new Observer(function () {
|
|
28
|
-
var callback;
|
|
29
|
-
if (!queue) {
|
|
30
|
-
if (!currentQueue) return;
|
|
31
|
-
queue = currentQueue;
|
|
32
|
-
} else if (currentQueue) {
|
|
33
|
-
queue = currentQueue.concat(queue);
|
|
34
|
-
}
|
|
35
|
-
currentQueue = queue;
|
|
36
|
-
queue = null;
|
|
37
|
-
if (typeof currentQueue === 'function') {
|
|
38
|
-
callback = currentQueue;
|
|
39
|
-
currentQueue = null;
|
|
40
|
-
callback();
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
node.data = (i = ++i % 2); // Invoke other batch, to handle leftover callbacks in case of crash
|
|
44
|
-
while (currentQueue) {
|
|
45
|
-
callback = currentQueue.shift();
|
|
46
|
-
if (!currentQueue.length) currentQueue = null;
|
|
47
|
-
callback();
|
|
48
|
-
}
|
|
49
|
-
}).observe(node, { characterData: true });
|
|
50
|
-
return function (fn) {
|
|
51
|
-
ensureCallable(fn);
|
|
52
|
-
if (queue) {
|
|
53
|
-
if (typeof queue === 'function') queue = [queue, fn];
|
|
54
|
-
else queue.push(fn);
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
queue = fn;
|
|
58
|
-
node.data = (i = ++i % 2);
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
module.exports = (function () {
|
|
63
|
-
// Node.js
|
|
64
|
-
if ((typeof process === 'object') && process && (typeof process.nextTick === 'function')) {
|
|
65
|
-
return process.nextTick;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// queueMicrotask
|
|
69
|
-
if (typeof queueMicrotask === "function") {
|
|
70
|
-
return function (cb) { queueMicrotask(ensureCallable(cb)); };
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// MutationObserver
|
|
74
|
-
if ((typeof document === 'object') && document) {
|
|
75
|
-
if (typeof MutationObserver === 'function') return byObserver(MutationObserver);
|
|
76
|
-
if (typeof WebKitMutationObserver === 'function') return byObserver(WebKitMutationObserver);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
// W3C Draft
|
|
80
|
-
// http://dvcs.w3.org/hg/webperf/raw-file/tip/specs/setImmediate/Overview.html
|
|
81
|
-
if (typeof setImmediate === 'function') {
|
|
82
|
-
return function (cb) { setImmediate(ensureCallable(cb)); };
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// Wide available standard
|
|
86
|
-
if ((typeof setTimeout === 'function') || (typeof setTimeout === 'object')) {
|
|
87
|
-
return function (cb) { setTimeout(ensureCallable(cb), 0); };
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
return null;
|
|
91
|
-
}());
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
/***/ }),
|
|
95
|
-
|
|
96
14
|
/***/ 61:
|
|
97
15
|
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
98
16
|
|
|
@@ -5206,6 +5124,12 @@ function checkReloadOptions(options) {
|
|
|
5206
5124
|
if (typeof ((_c = options === null || options === void 0 ? void 0 : options.reloadAt) === null || _c === void 0 ? void 0 : _c.relative) !== "number" && ((_d = options === null || options === void 0 ? void 0 : options.reloadAt) === null || _d === void 0 ? void 0 : _d.relative) !== undefined) {
|
|
5207
5125
|
throw new Error("API: reload - Invalid 'reloadAt.relative' option format.");
|
|
5208
5126
|
}
|
|
5127
|
+
if (!Array.isArray(options === null || options === void 0 ? void 0 : options.keySystems) && (options === null || options === void 0 ? void 0 : options.keySystems) !== undefined) {
|
|
5128
|
+
throw new Error("API: reload - Invalid 'keySystems' option format.");
|
|
5129
|
+
}
|
|
5130
|
+
if ((options === null || options === void 0 ? void 0 : options.autoPlay) !== undefined && typeof options.autoPlay !== "boolean") {
|
|
5131
|
+
throw new Error("API: reload - Invalid 'autoPlay' option format.");
|
|
5132
|
+
}
|
|
5209
5133
|
}
|
|
5210
5134
|
/**
|
|
5211
5135
|
* Parse options given to loadVideo and set default options as found
|
|
@@ -7375,7 +7299,7 @@ var Player = /*#__PURE__*/function (_EventEmitter) {
|
|
|
7375
7299
|
// Workaround to support Firefox autoplay on FF 42.
|
|
7376
7300
|
// See: https://bugzilla.mozilla.org/show_bug.cgi?id=1194624
|
|
7377
7301
|
videoElement.preload = "auto";
|
|
7378
|
-
_this.version = /* PLAYER_VERSION */"4.0.0-dev.
|
|
7302
|
+
_this.version = /* PLAYER_VERSION */"4.0.0-dev.2023111400";
|
|
7379
7303
|
_this.log = src_log;
|
|
7380
7304
|
_this.state = "STOPPED";
|
|
7381
7305
|
_this.videoElement = videoElement;
|
|
@@ -7474,7 +7398,7 @@ var Player = /*#__PURE__*/function (_EventEmitter) {
|
|
|
7474
7398
|
* @param {Object} reloadOpts
|
|
7475
7399
|
*/;
|
|
7476
7400
|
_proto.reload = function reload(reloadOpts) {
|
|
7477
|
-
var _a, _b;
|
|
7401
|
+
var _a, _b, _c;
|
|
7478
7402
|
var _this$_priv_reloading = this._priv_reloadingMetadata,
|
|
7479
7403
|
options = _this$_priv_reloading.options,
|
|
7480
7404
|
manifest = _this$_priv_reloading.manifest,
|
|
@@ -7508,6 +7432,12 @@ var Player = /*#__PURE__*/function (_EventEmitter) {
|
|
|
7508
7432
|
} else if (reloadInPause !== undefined) {
|
|
7509
7433
|
autoPlay = !reloadInPause;
|
|
7510
7434
|
}
|
|
7435
|
+
var keySystems;
|
|
7436
|
+
if ((reloadOpts === null || reloadOpts === void 0 ? void 0 : reloadOpts.keySystems) !== undefined) {
|
|
7437
|
+
keySystems = reloadOpts.keySystems;
|
|
7438
|
+
} else if (((_c = this._priv_reloadingMetadata.options) === null || _c === void 0 ? void 0 : _c.keySystems) !== undefined) {
|
|
7439
|
+
keySystems = this._priv_reloadingMetadata.options.keySystems;
|
|
7440
|
+
}
|
|
7511
7441
|
var newOptions = Object.assign(Object.assign({}, options), {
|
|
7512
7442
|
initialManifest: manifest
|
|
7513
7443
|
});
|
|
@@ -7517,6 +7447,9 @@ var Player = /*#__PURE__*/function (_EventEmitter) {
|
|
|
7517
7447
|
if (autoPlay !== undefined) {
|
|
7518
7448
|
newOptions.autoPlay = autoPlay;
|
|
7519
7449
|
}
|
|
7450
|
+
if (keySystems !== undefined) {
|
|
7451
|
+
newOptions.keySystems = keySystems;
|
|
7452
|
+
}
|
|
7520
7453
|
this._priv_initializeContentPlayback(newOptions);
|
|
7521
7454
|
};
|
|
7522
7455
|
_proto.createDebugElement = function createDebugElement(element) {
|
|
@@ -9573,7 +9506,7 @@ var Player = /*#__PURE__*/function (_EventEmitter) {
|
|
|
9573
9506
|
}]);
|
|
9574
9507
|
return Player;
|
|
9575
9508
|
}(EventEmitter);
|
|
9576
|
-
Player.version = /* PLAYER_VERSION */"4.0.0-dev.
|
|
9509
|
+
Player.version = /* PLAYER_VERSION */"4.0.0-dev.2023111400";
|
|
9577
9510
|
/* harmony default export */ var public_api = (Player);
|
|
9578
9511
|
;// CONCATENATED MODULE: ./src/core/api/index.ts
|
|
9579
9512
|
/**
|
|
@@ -12024,6 +11957,7 @@ var Representation = /*#__PURE__*/function () {
|
|
|
12024
11957
|
* @param {Object} args
|
|
12025
11958
|
*/
|
|
12026
11959
|
function Representation(args, opts) {
|
|
11960
|
+
var _a;
|
|
12027
11961
|
this.id = args.id;
|
|
12028
11962
|
this.uniqueId = generateRepresentationUniqueId();
|
|
12029
11963
|
this.bitrate = args.bitrate;
|
|
@@ -12052,12 +11986,24 @@ var Representation = /*#__PURE__*/function () {
|
|
|
12052
11986
|
this.cdnMetadata = args.cdnMetadata;
|
|
12053
11987
|
this.index = args.index;
|
|
12054
11988
|
if (opts.type === "audio" || opts.type === "video") {
|
|
12055
|
-
|
|
12056
|
-
|
|
12057
|
-
|
|
12058
|
-
|
|
11989
|
+
this.isSupported = false;
|
|
11990
|
+
// Supplemental codecs are defined as backwards-compatible codecs enhancing
|
|
11991
|
+
// the experience of a base layer codec
|
|
11992
|
+
if (args.supplementalCodecs !== undefined) {
|
|
11993
|
+
var supplementalCodecMimeTypeStr = ((_a = this.mimeType) !== null && _a !== void 0 ? _a : "") + ";codecs=\"" + args.supplementalCodecs + "\"";
|
|
11994
|
+
if (isCodecSupported(supplementalCodecMimeTypeStr)) {
|
|
11995
|
+
this.codec = args.supplementalCodecs;
|
|
11996
|
+
this.isSupported = true;
|
|
11997
|
+
}
|
|
11998
|
+
}
|
|
11999
|
+
if (!this.isSupported) {
|
|
12000
|
+
var mimeTypeStr = this.getMimeTypeString();
|
|
12001
|
+
var isSupported = isCodecSupported(mimeTypeStr);
|
|
12002
|
+
if (!isSupported) {
|
|
12003
|
+
src_log.info("Unsupported Representation", mimeTypeStr, this.id, this.bitrate);
|
|
12004
|
+
}
|
|
12005
|
+
this.isSupported = isSupported;
|
|
12059
12006
|
}
|
|
12060
|
-
this.isSupported = isSupported;
|
|
12061
12007
|
} else {
|
|
12062
12008
|
this.isSupported = true; // TODO for other types
|
|
12063
12009
|
}
|
|
@@ -17514,9 +17460,12 @@ function shouldHaveNativeBuffer(bufferType) {
|
|
|
17514
17460
|
|
|
17515
17461
|
/* harmony default export */ var segment_buffers = (SegmentBuffersStore);
|
|
17516
17462
|
|
|
17517
|
-
|
|
17518
|
-
var
|
|
17519
|
-
|
|
17463
|
+
;// CONCATENATED MODULE: ./src/utils/queue_microtask.ts
|
|
17464
|
+
/* harmony default export */ var queue_microtask = (typeof queueMicrotask === "function" ? queueMicrotask : function queueMicrotaskPonyfill(cb) {
|
|
17465
|
+
Promise.resolve().then(cb, function () {
|
|
17466
|
+
return cb();
|
|
17467
|
+
});
|
|
17468
|
+
});
|
|
17520
17469
|
;// CONCATENATED MODULE: ./src/utils/sorted_list.ts
|
|
17521
17470
|
/**
|
|
17522
17471
|
* Copyright 2015 CANAL+ Group
|
|
@@ -20514,7 +20463,7 @@ function AdaptationStream(_ref, callbacks, parentCancelSignal) {
|
|
|
20514
20463
|
case 4:
|
|
20515
20464
|
return _context.abrupt("break", 21);
|
|
20516
20465
|
case 5:
|
|
20517
|
-
return _context.abrupt("return",
|
|
20466
|
+
return _context.abrupt("return", queue_microtask(function () {
|
|
20518
20467
|
playbackObserver.listen(function () {
|
|
20519
20468
|
if (fnCancelSignal.isCancelled()) {
|
|
20520
20469
|
return;
|
|
@@ -21447,7 +21396,7 @@ function PeriodStream(_ref, callbacks, parentCancelSignal) {
|
|
|
21447
21396
|
// is actually received.
|
|
21448
21397
|
// It can happen when `askForMediaSourceReload` is called as a side-effect of
|
|
21449
21398
|
// the same event that triggers the playback observation to be emitted.
|
|
21450
|
-
|
|
21399
|
+
queue_microtask(function () {
|
|
21451
21400
|
playbackObserver.listen(function () {
|
|
21452
21401
|
if (cancelSignal.isCancelled()) {
|
|
21453
21402
|
return;
|
|
@@ -21979,7 +21928,7 @@ function StreamOrchestrator(content, playbackObserver, representationEstimator,
|
|
|
21979
21928
|
// Schedule micro task before checking the last playback observation
|
|
21980
21929
|
// to reduce the risk of race conditions where the next observation
|
|
21981
21930
|
// was going to be emitted synchronously.
|
|
21982
|
-
|
|
21931
|
+
queue_microtask(function () {
|
|
21983
21932
|
var _a;
|
|
21984
21933
|
if (orchestratorCancelSignal.isCancelled()) {
|
|
21985
21934
|
return;
|
|
@@ -22166,7 +22115,7 @@ function StreamOrchestrator(content, playbackObserver, representationEstimator,
|
|
|
22166
22115
|
// conditions where the inner logic would be called synchronously before
|
|
22167
22116
|
// the next observation (which may reflect very different playback
|
|
22168
22117
|
// conditions) is actually received.
|
|
22169
|
-
return
|
|
22118
|
+
return queue_microtask(function () {
|
|
22170
22119
|
if (innerCancelSignal.isCancelled()) {
|
|
22171
22120
|
return;
|
|
22172
22121
|
}
|
|
@@ -31679,6 +31628,11 @@ function flattenOverlappingPeriods(parsedPeriods) {
|
|
|
31679
31628
|
// `lastFlattenedPeriod` has now a negative or `0` duration.
|
|
31680
31629
|
// Remove it, consider the next Period in its place, and re-start the loop.
|
|
31681
31630
|
flattenedPeriods.pop();
|
|
31631
|
+
if (flattenedPeriods.length === 0) {
|
|
31632
|
+
// There's no remaining Period to compare to `parsedPeriod`
|
|
31633
|
+
break;
|
|
31634
|
+
}
|
|
31635
|
+
// Take the previous Period as reference and compare it now to `parsedPeriod`
|
|
31682
31636
|
lastFlattenedPeriod = flattenedPeriods[flattenedPeriods.length - 1];
|
|
31683
31637
|
}
|
|
31684
31638
|
}
|
|
@@ -32019,6 +31973,31 @@ function inferAdaptationType(representations, adaptationMimeType, adaptationCode
|
|
|
32019
31973
|
}
|
|
32020
31974
|
return undefined;
|
|
32021
31975
|
}
|
|
31976
|
+
;// CONCATENATED MODULE: ./src/parsers/manifest/dash/common/convert_supplemental_codecs.ts
|
|
31977
|
+
|
|
31978
|
+
var supplementalCodecSeparator = /[, ]+/g;
|
|
31979
|
+
/**
|
|
31980
|
+
* Converts SCTE 214 supplemental codec string into RFC4281 codec string
|
|
31981
|
+
*
|
|
31982
|
+
* The returned value is a codec string respecting RFC6381
|
|
31983
|
+
*
|
|
31984
|
+
* SCTE 214 defines supplemental codecs as a whitespace-separated multiple list of
|
|
31985
|
+
* codec strings
|
|
31986
|
+
*
|
|
31987
|
+
* RFC6381 defines codecs as a comma-separated list of codec strings.
|
|
31988
|
+
*
|
|
31989
|
+
* This two syntax differs and this parser is used to convert SCTE214
|
|
31990
|
+
* to be compliant with what MSE APIs expect
|
|
31991
|
+
*
|
|
31992
|
+
* @param {string} val - The codec string to parse
|
|
31993
|
+
* @returns { Array.<string | undefined | null>}
|
|
31994
|
+
*/
|
|
31995
|
+
function convertSupplementalCodecsToRFC6381(val) {
|
|
31996
|
+
if (isNonEmptyString(val)) {
|
|
31997
|
+
return val.trim().replace(supplementalCodecSeparator, ", ");
|
|
31998
|
+
}
|
|
31999
|
+
return "";
|
|
32000
|
+
}
|
|
32022
32001
|
;// CONCATENATED MODULE: ./src/parsers/manifest/dash/common/get_hdr_information.ts
|
|
32023
32002
|
/**
|
|
32024
32003
|
* Copyright 2015 CANAL+ Group
|
|
@@ -34287,6 +34266,7 @@ function parse_representations_arrayLikeToArray(arr, len) { if (len == null || l
|
|
|
34287
34266
|
|
|
34288
34267
|
|
|
34289
34268
|
|
|
34269
|
+
|
|
34290
34270
|
/**
|
|
34291
34271
|
* Combine inband event streams from representation and
|
|
34292
34272
|
* adaptation data.
|
|
@@ -34362,7 +34342,7 @@ function parseRepresentations(representationsIR, adaptation, context) {
|
|
|
34362
34342
|
var _loop = function _loop() {
|
|
34363
34343
|
var representation = _step.value;
|
|
34364
34344
|
// Compute Representation ID
|
|
34365
|
-
var representationID = representation.attributes.id
|
|
34345
|
+
var representationID = representation.attributes.id !== undefined ? representation.attributes.id : String(representation.attributes.bitrate) + (representation.attributes.height !== undefined ? "-" + representation.attributes.height : "") + (representation.attributes.width !== undefined ? "-" + representation.attributes.width : "") + (representation.attributes.mimeType !== undefined ? "-" + representation.attributes.mimeType : "") + (representation.attributes.codecs !== undefined ? "-" + representation.attributes.codecs : "");
|
|
34366
34346
|
// Avoid duplicate IDs
|
|
34367
34347
|
while (parsedRepresentations.some(function (r) {
|
|
34368
34348
|
return r.id === representationID;
|
|
@@ -34384,7 +34364,7 @@ function parseRepresentations(representationsIR, adaptation, context) {
|
|
|
34384
34364
|
var representationIndex = parseRepresentationIndex(representation, reprIndexCtxt);
|
|
34385
34365
|
// Find bitrate
|
|
34386
34366
|
var representationBitrate;
|
|
34387
|
-
if (representation.attributes.bitrate
|
|
34367
|
+
if (representation.attributes.bitrate === undefined) {
|
|
34388
34368
|
src_log.warn("DASH: No usable bitrate found in the Representation.");
|
|
34389
34369
|
representationBitrate = 0;
|
|
34390
34370
|
} else {
|
|
@@ -34419,33 +34399,42 @@ function parseRepresentations(representationsIR, adaptation, context) {
|
|
|
34419
34399
|
}
|
|
34420
34400
|
// Add optional attributes
|
|
34421
34401
|
var codecs;
|
|
34422
|
-
if (representation.attributes.codecs
|
|
34402
|
+
if (representation.attributes.codecs !== undefined) {
|
|
34423
34403
|
codecs = representation.attributes.codecs;
|
|
34424
|
-
} else if (adaptation.attributes.codecs
|
|
34404
|
+
} else if (adaptation.attributes.codecs !== undefined) {
|
|
34425
34405
|
codecs = adaptation.attributes.codecs;
|
|
34426
34406
|
}
|
|
34427
|
-
if (codecs
|
|
34407
|
+
if (codecs !== undefined) {
|
|
34428
34408
|
codecs = codecs === "mp4a.40.02" ? "mp4a.40.2" : codecs;
|
|
34429
34409
|
parsedRepresentation.codecs = codecs;
|
|
34430
34410
|
}
|
|
34431
|
-
|
|
34411
|
+
var supplementalCodecs;
|
|
34412
|
+
if (representation.attributes.supplementalCodecs !== undefined) {
|
|
34413
|
+
supplementalCodecs = representation.attributes.supplementalCodecs;
|
|
34414
|
+
} else if (adaptation.attributes.supplementalCodecs !== undefined) {
|
|
34415
|
+
supplementalCodecs = adaptation.attributes.supplementalCodecs;
|
|
34416
|
+
}
|
|
34417
|
+
if (supplementalCodecs !== undefined) {
|
|
34418
|
+
parsedRepresentation.supplementalCodecs = convertSupplementalCodecsToRFC6381(supplementalCodecs);
|
|
34419
|
+
}
|
|
34420
|
+
if (representation.attributes.frameRate !== undefined) {
|
|
34432
34421
|
parsedRepresentation.frameRate = representation.attributes.frameRate;
|
|
34433
|
-
} else if (adaptation.attributes.frameRate
|
|
34422
|
+
} else if (adaptation.attributes.frameRate !== undefined) {
|
|
34434
34423
|
parsedRepresentation.frameRate = adaptation.attributes.frameRate;
|
|
34435
34424
|
}
|
|
34436
|
-
if (representation.attributes.height
|
|
34425
|
+
if (representation.attributes.height !== undefined) {
|
|
34437
34426
|
parsedRepresentation.height = representation.attributes.height;
|
|
34438
|
-
} else if (adaptation.attributes.height
|
|
34427
|
+
} else if (adaptation.attributes.height !== undefined) {
|
|
34439
34428
|
parsedRepresentation.height = adaptation.attributes.height;
|
|
34440
34429
|
}
|
|
34441
|
-
if (representation.attributes.mimeType
|
|
34430
|
+
if (representation.attributes.mimeType !== undefined) {
|
|
34442
34431
|
parsedRepresentation.mimeType = representation.attributes.mimeType;
|
|
34443
|
-
} else if (adaptation.attributes.mimeType
|
|
34432
|
+
} else if (adaptation.attributes.mimeType !== undefined) {
|
|
34444
34433
|
parsedRepresentation.mimeType = adaptation.attributes.mimeType;
|
|
34445
34434
|
}
|
|
34446
|
-
if (representation.attributes.width
|
|
34435
|
+
if (representation.attributes.width !== undefined) {
|
|
34447
34436
|
parsedRepresentation.width = representation.attributes.width;
|
|
34448
|
-
} else if (adaptation.attributes.width
|
|
34437
|
+
} else if (adaptation.attributes.width !== undefined) {
|
|
34449
34438
|
parsedRepresentation.width = adaptation.attributes.width;
|
|
34450
34439
|
}
|
|
34451
34440
|
var contentProtectionsIr = adaptation.children.contentProtections !== undefined ? adaptation.children.contentProtections : [];
|
|
@@ -36490,6 +36479,9 @@ function parseRepresentationAttributes(representationElement) {
|
|
|
36490
36479
|
dashName: "qualityRanking"
|
|
36491
36480
|
});
|
|
36492
36481
|
break;
|
|
36482
|
+
case "scte214:supplementalCodecs":
|
|
36483
|
+
attributes.supplementalCodecs = attr.value;
|
|
36484
|
+
break;
|
|
36493
36485
|
case "segmentProfiles":
|
|
36494
36486
|
attributes.segmentProfiles = attr.value;
|
|
36495
36487
|
break;
|
|
@@ -36816,6 +36808,9 @@ function parseAdaptationSetAttributes(root) {
|
|
|
36816
36808
|
case "codecs":
|
|
36817
36809
|
parsedAdaptation.codecs = attribute.value;
|
|
36818
36810
|
break;
|
|
36811
|
+
case "scte214:supplementalCodecs":
|
|
36812
|
+
parsedAdaptation.supplementalCodecs = attribute.value;
|
|
36813
|
+
break;
|
|
36819
36814
|
case "codingDependency":
|
|
36820
36815
|
parseValue(attribute.value, {
|
|
36821
36816
|
asKey: "codingDependency",
|
|
@@ -49548,6 +49543,21 @@ function parseTextTrackToElements(type, data, timestampOffset, language) {
|
|
|
49548
49543
|
* Setting a value too high might lead to two segments targeting different times
|
|
49549
49544
|
* to be wrongly believed to target the same time. In worst case scenarios, this
|
|
49550
49545
|
* could lead to wanted text tracks being removed.
|
|
49546
|
+
*
|
|
49547
|
+
* When comparing 2 segments s1 and s2, you may want to take into account the duration
|
|
49548
|
+
* of the segments:
|
|
49549
|
+
* - if s1 is [0, 2] and s2 is [0, 2.1] s1 and s2 can be considered as nearly equal as
|
|
49550
|
+
* there is a relative difference of: (2.1-2) / 2 = 5%;
|
|
49551
|
+
* Formula: (end_s1 - end_s2) / duration_s2 = relative_difference
|
|
49552
|
+
* - if s1 is [0, 0.04] and s2 is [0.04, 0.08] s1 and s2 may not considered as nearly
|
|
49553
|
+
* equal as there is a relative difference of: (0.04-0.08) / 0.04 = 100%
|
|
49554
|
+
*
|
|
49555
|
+
* To compare relatively to the duration of a segment you can provide and additional
|
|
49556
|
+
* parameter "delta" that remplace MAX_DELTA_BUFFER_TIME.
|
|
49557
|
+
* If parameter "delta" is higher than MAX_DELTA_BUFFER_TIME, MAX_DELTA_BUFFER_TIME
|
|
49558
|
+
* is used instead of delta. This ensure that segments are nearly equal when comparing
|
|
49559
|
+
* relatively AND absolutely.
|
|
49560
|
+
*
|
|
49551
49561
|
* @type Number
|
|
49552
49562
|
*/
|
|
49553
49563
|
var MAX_DELTA_BUFFER_TIME = 0.2;
|
|
@@ -49555,10 +49565,14 @@ var MAX_DELTA_BUFFER_TIME = 0.2;
|
|
|
49555
49565
|
* @see MAX_DELTA_BUFFER_TIME
|
|
49556
49566
|
* @param {Number} a
|
|
49557
49567
|
* @param {Number} b
|
|
49568
|
+
* @param {Number} delta
|
|
49558
49569
|
* @returns {Boolean}
|
|
49559
49570
|
*/
|
|
49560
|
-
function areNearlyEqual(a, b) {
|
|
49561
|
-
|
|
49571
|
+
function areNearlyEqual(a, b, delta) {
|
|
49572
|
+
if (delta === void 0) {
|
|
49573
|
+
delta = MAX_DELTA_BUFFER_TIME;
|
|
49574
|
+
}
|
|
49575
|
+
return Math.abs(a - b) <= Math.min(delta, MAX_DELTA_BUFFER_TIME);
|
|
49562
49576
|
}
|
|
49563
49577
|
/**
|
|
49564
49578
|
* Get all cues which have data before the given time.
|
|
@@ -49631,6 +49645,22 @@ function removeCuesInfosBetween(cuesInfos, start, end) {
|
|
|
49631
49645
|
*/
|
|
49632
49646
|
|
|
49633
49647
|
|
|
49648
|
+
/**
|
|
49649
|
+
* first or last IHTMLCue in a group can have a slighlty different start
|
|
49650
|
+
* or end time than the start or end time of the ICuesGroup due to parsing
|
|
49651
|
+
* approximation.
|
|
49652
|
+
* DELTA_CUES_GROUP defines the tolerance level when comparing the start/end
|
|
49653
|
+
* of a IHTMLCue to the start/end of a ICuesGroup.
|
|
49654
|
+
* Having this value too high may lead to have unwanted subtitle displayed
|
|
49655
|
+
* Having this value too low may lead to have subtitles not displayed
|
|
49656
|
+
*/
|
|
49657
|
+
var DELTA_CUES_GROUP = 1e-3;
|
|
49658
|
+
/**
|
|
49659
|
+
* segment_duration / RELATIVE_DELTA_RATIO = relative_delta
|
|
49660
|
+
*
|
|
49661
|
+
* relative_delta is the tolerance to determine if two segements are the same
|
|
49662
|
+
*/
|
|
49663
|
+
var RELATIVE_DELTA_RATIO = 5;
|
|
49634
49664
|
/**
|
|
49635
49665
|
* Manage the buffer of the HTMLTextSegmentBuffer.
|
|
49636
49666
|
* Allows to add, remove and recuperate cues at given times.
|
|
@@ -49674,6 +49704,17 @@ var TextTrackCuesStore = /*#__PURE__*/function () {
|
|
|
49674
49704
|
ret.push(cues[j].element);
|
|
49675
49705
|
}
|
|
49676
49706
|
}
|
|
49707
|
+
// first or last IHTMLCue in a group can have a slighlty different start
|
|
49708
|
+
// or end time than the start or end time of the ICuesGroup due to parsing
|
|
49709
|
+
// approximation.
|
|
49710
|
+
// Add a tolerance of 1ms to fix this issue
|
|
49711
|
+
if (ret.length === 0 && cues.length > 0) {
|
|
49712
|
+
for (var _j = 0; _j < cues.length; _j++) {
|
|
49713
|
+
if (areNearlyEqual(time, cues[_j].start, DELTA_CUES_GROUP) || areNearlyEqual(time, cues[_j].end, DELTA_CUES_GROUP)) {
|
|
49714
|
+
ret.push(cues[_j].element);
|
|
49715
|
+
}
|
|
49716
|
+
}
|
|
49717
|
+
}
|
|
49677
49718
|
return ret;
|
|
49678
49719
|
}
|
|
49679
49720
|
}
|
|
@@ -49760,6 +49801,11 @@ var TextTrackCuesStore = /*#__PURE__*/function () {
|
|
|
49760
49801
|
end: end,
|
|
49761
49802
|
cues: cues
|
|
49762
49803
|
};
|
|
49804
|
+
// it's preferable to have a delta depending on the duration of the segment
|
|
49805
|
+
// if the delta is one fifth of the length of the segment:
|
|
49806
|
+
// a segment of [0, 2] is the "same" segment as [0, 2.1]
|
|
49807
|
+
// but [0, 0.04] is not the "same" segement as [0,04, 0.08]
|
|
49808
|
+
var relativeDelta = Math.abs(start - end) / RELATIVE_DELTA_RATIO;
|
|
49763
49809
|
/**
|
|
49764
49810
|
* Called when we found the index of the next cue relative to the cue we
|
|
49765
49811
|
* want to insert (that is a cue starting after its start or at the same
|
|
@@ -49772,7 +49818,7 @@ var TextTrackCuesStore = /*#__PURE__*/function () {
|
|
|
49772
49818
|
var nextCue = cuesBuffer[indexOfNextCue];
|
|
49773
49819
|
if (nextCue === undefined ||
|
|
49774
49820
|
// no cue
|
|
49775
|
-
areNearlyEqual(cuesInfosToInsert.end, nextCue.end))
|
|
49821
|
+
areNearlyEqual(cuesInfosToInsert.end, nextCue.end, relativeDelta))
|
|
49776
49822
|
// samey end
|
|
49777
49823
|
{
|
|
49778
49824
|
// ours: |AAAAA|
|
|
@@ -49807,8 +49853,8 @@ var TextTrackCuesStore = /*#__PURE__*/function () {
|
|
|
49807
49853
|
for (var cueIdx = 0; cueIdx < cuesBuffer.length; cueIdx++) {
|
|
49808
49854
|
var cuesInfos = cuesBuffer[cueIdx];
|
|
49809
49855
|
if (start < cuesInfos.end) {
|
|
49810
|
-
if (areNearlyEqual(start, cuesInfos.start)) {
|
|
49811
|
-
if (areNearlyEqual(end, cuesInfos.end)) {
|
|
49856
|
+
if (areNearlyEqual(start, cuesInfos.start, relativeDelta)) {
|
|
49857
|
+
if (areNearlyEqual(end, cuesInfos.end, relativeDelta)) {
|
|
49812
49858
|
// exact same segment
|
|
49813
49859
|
// ours: |AAAAA|
|
|
49814
49860
|
// the current one: |BBBBB|
|
|
@@ -49853,7 +49899,7 @@ var TextTrackCuesStore = /*#__PURE__*/function () {
|
|
|
49853
49899
|
// - add ours before the current one
|
|
49854
49900
|
cuesBuffer.splice(cueIdx, 0, cuesInfosToInsert);
|
|
49855
49901
|
return;
|
|
49856
|
-
} else if (areNearlyEqual(end, cuesInfos.start)) {
|
|
49902
|
+
} else if (areNearlyEqual(end, cuesInfos.start, relativeDelta)) {
|
|
49857
49903
|
// our cue goes just before the current one:
|
|
49858
49904
|
// ours: |AAAAAAA|
|
|
49859
49905
|
// the current one: |BBBB|
|
|
@@ -49864,7 +49910,7 @@ var TextTrackCuesStore = /*#__PURE__*/function () {
|
|
|
49864
49910
|
cuesInfos.start = end;
|
|
49865
49911
|
cuesBuffer.splice(cueIdx, 0, cuesInfosToInsert);
|
|
49866
49912
|
return;
|
|
49867
|
-
} else if (areNearlyEqual(end, cuesInfos.end)) {
|
|
49913
|
+
} else if (areNearlyEqual(end, cuesInfos.end, relativeDelta)) {
|
|
49868
49914
|
// ours: |AAAAAAA|
|
|
49869
49915
|
// the current one: |BBBB|
|
|
49870
49916
|
// Result: |AAAAAAA|
|
|
@@ -49891,7 +49937,7 @@ var TextTrackCuesStore = /*#__PURE__*/function () {
|
|
|
49891
49937
|
return;
|
|
49892
49938
|
}
|
|
49893
49939
|
// else -> start > cuesInfos.start
|
|
49894
|
-
if (areNearlyEqual(cuesInfos.end, end)) {
|
|
49940
|
+
if (areNearlyEqual(cuesInfos.end, end, relativeDelta)) {
|
|
49895
49941
|
// ours: |AAAAAA|
|
|
49896
49942
|
// the current one: |BBBBBBBB|
|
|
49897
49943
|
// Result: |BBAAAAAA|
|
|
@@ -49927,6 +49973,21 @@ var TextTrackCuesStore = /*#__PURE__*/function () {
|
|
|
49927
49973
|
}
|
|
49928
49974
|
}
|
|
49929
49975
|
}
|
|
49976
|
+
if (cuesBuffer.length) {
|
|
49977
|
+
var lastCue = cuesBuffer[cuesBuffer.length - 1];
|
|
49978
|
+
if (areNearlyEqual(lastCue.end, start, relativeDelta)) {
|
|
49979
|
+
// Match the end of the previous cue to the start of the following one
|
|
49980
|
+
// if they are close enough. If there is a small gap between two segments
|
|
49981
|
+
// it can lead to having no subtitles for a short time, this is noticeable when
|
|
49982
|
+
// two successive segments displays the same text, making it diseappear
|
|
49983
|
+
// and reappear quickly, which gives the impression of blinking
|
|
49984
|
+
//
|
|
49985
|
+
// ours: |AAAAA|
|
|
49986
|
+
// the current one: |BBBBB|...
|
|
49987
|
+
// Result: |BBBBBBBAAAAA|
|
|
49988
|
+
lastCue.end = start;
|
|
49989
|
+
}
|
|
49990
|
+
}
|
|
49930
49991
|
// no cues group has the end after our current start.
|
|
49931
49992
|
// These cues should be the last one
|
|
49932
49993
|
cuesBuffer.push(cuesInfosToInsert);
|