rx-player 4.0.0-dev.202402213 → 4.0.0-dev.2024022300
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/VERSION +1 -1
- package/dist/commonjs/__GENERATED_CODE/embedded_dash_wasm.js +1 -1
- package/dist/commonjs/__GENERATED_CODE/embedded_worker.js +1 -1
- package/dist/commonjs/core/main/worker/worker_main.js +8 -9
- package/dist/commonjs/features/features_object.js +1 -1
- package/dist/commonjs/features/list/dash.js +2 -2
- package/dist/commonjs/features/types.d.ts +8 -3
- package/dist/commonjs/main_thread/api/public_api.js +2 -7
- package/dist/commonjs/multithread_types.d.ts +1 -1
- package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_elements.d.ts +4 -3
- package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_elements.js +11 -4
- package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_previous_timeline.d.ts +2 -1
- package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_previous_timeline.js +12 -3
- package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/find_first_common_start_time.d.ts +3 -2
- package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/find_first_common_start_time.js +22 -11
- package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/parse_s_element.d.ts +11 -2
- package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/parse_s_element.js +74 -3
- package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.d.ts +2 -1
- package/dist/commonjs/parsers/manifest/dash/common/parse_periods.js +3 -1
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/index.d.ts +17 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/index.js +19 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/AdaptationSet.d.ts +24 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/AdaptationSet.js +400 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/BaseURL.d.ts +24 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/BaseURL.js +33 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/ContentComponent.d.ts +23 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/ContentComponent.js +70 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/ContentProtection.d.ts +22 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/ContentProtection.js +118 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/EventStream.d.ts +23 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/EventStream.js +154 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/Initialization.d.ts +22 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/Initialization.js +70 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/MPD.d.ts +23 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/MPD.js +221 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/Period.d.ts +23 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/Period.js +179 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/Representation.d.ts +22 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/Representation.js +256 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentBase.d.ts +23 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentBase.js +152 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentList.d.ts +22 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentList.js +60 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentTemplate.d.ts +24 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentTemplate.js +125 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentTimeline.d.ts +22 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentTimeline.js +36 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentURL.d.ts +24 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentURL.js +82 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/utils.d.ts +176 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/utils.js +382 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/parse_from_xml_string.d.ts +24 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/parse_from_xml_string.js +142 -0
- package/dist/commonjs/parsers/manifest/dash/node_parser_types.d.ts +5 -3
- package/dist/commonjs/public_types.d.ts +1 -1
- package/dist/commonjs/transports/dash/manifest_parser.js +33 -4
- package/dist/commonjs/utils/xml-parser.d.ts +70 -0
- package/dist/commonjs/utils/xml-parser.js +357 -0
- package/dist/es2017/__GENERATED_CODE/embedded_dash_wasm.js +1 -1
- package/dist/es2017/__GENERATED_CODE/embedded_worker.js +1 -1
- package/dist/es2017/core/main/worker/worker_main.js +8 -9
- package/dist/es2017/features/features_object.js +1 -1
- package/dist/es2017/features/list/dash.js +2 -2
- package/dist/es2017/features/types.d.ts +8 -3
- package/dist/es2017/main_thread/api/public_api.js +2 -7
- package/dist/es2017/multithread_types.d.ts +1 -1
- package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_elements.d.ts +4 -3
- package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_elements.js +12 -5
- package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_previous_timeline.d.ts +2 -1
- package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_previous_timeline.js +13 -4
- package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/find_first_common_start_time.d.ts +3 -2
- package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/find_first_common_start_time.js +22 -11
- package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/parse_s_element.d.ts +11 -2
- package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/parse_s_element.js +49 -2
- package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.d.ts +2 -1
- package/dist/es2017/parsers/manifest/dash/common/parse_periods.js +3 -1
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/index.d.ts +17 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/index.js +17 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/AdaptationSet.d.ts +24 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/AdaptationSet.js +358 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/BaseURL.d.ts +24 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/BaseURL.js +30 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/ContentComponent.d.ts +23 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/ContentComponent.js +45 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/ContentProtection.d.ts +22 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/ContentProtection.js +77 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/EventStream.d.ts +23 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/EventStream.js +101 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/Initialization.d.ts +22 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/Initialization.js +45 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/MPD.d.ts +23 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/MPD.js +179 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/Period.d.ts +23 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/Period.js +137 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/Representation.d.ts +22 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/Representation.js +214 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentBase.d.ts +23 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentBase.js +111 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentList.d.ts +22 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentList.js +41 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentTemplate.d.ts +24 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentTemplate.js +84 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentTimeline.d.ts +22 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentTimeline.js +33 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentURL.d.ts +24 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentURL.js +57 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/utils.d.ts +176 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/utils.js +310 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/parse_from_xml_string.d.ts +24 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/parse_from_xml_string.js +114 -0
- package/dist/es2017/parsers/manifest/dash/node_parser_types.d.ts +5 -3
- package/dist/es2017/public_types.d.ts +1 -1
- package/dist/es2017/transports/dash/manifest_parser.js +33 -4
- package/dist/es2017/utils/xml-parser.d.ts +70 -0
- package/dist/es2017/utils/xml-parser.js +322 -0
- package/dist/mpd-parser.wasm +0 -0
- package/dist/rx-player.js +141 -65
- package/dist/rx-player.min.js +1 -1
- package/dist/worker.js +8 -3
- package/package.json +1 -1
- package/.vscode/settings.json +0 -9
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/index.d.ts +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/index.js +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/AdaptationSet.d.ts +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/AdaptationSet.js +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/BaseURL.d.ts +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/BaseURL.js +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/ContentComponent.d.ts +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/ContentComponent.js +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/ContentProtection.d.ts +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/ContentProtection.js +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/EventStream.d.ts +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/EventStream.js +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/Initialization.d.ts +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/Initialization.js +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/MPD.d.ts +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/MPD.js +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/Period.d.ts +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/Period.js +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/Representation.d.ts +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/Representation.js +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentBase.d.ts +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentBase.js +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentList.d.ts +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentList.js +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentTemplate.d.ts +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentTemplate.js +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentTimeline.d.ts +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentTimeline.js +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentURL.d.ts +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentURL.js +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/utils.d.ts +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/utils.js +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/parse_from_document.d.ts +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/parse_from_document.js +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/index.d.ts +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/index.js +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/AdaptationSet.d.ts +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/AdaptationSet.js +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/BaseURL.d.ts +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/BaseURL.js +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/ContentComponent.d.ts +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/ContentComponent.js +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/ContentProtection.d.ts +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/ContentProtection.js +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/EventStream.d.ts +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/EventStream.js +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/Initialization.d.ts +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/Initialization.js +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/MPD.d.ts +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/MPD.js +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/Period.d.ts +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/Period.js +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/Representation.d.ts +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/Representation.js +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentBase.d.ts +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentBase.js +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentList.d.ts +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentList.js +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentTemplate.d.ts +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentTemplate.js +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentTimeline.d.ts +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentTimeline.js +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentURL.d.ts +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentURL.js +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/utils.d.ts +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/utils.js +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/parse_from_document.d.ts +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/parse_from_document.js +0 -0
|
@@ -0,0 +1,382 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright 2015 CANAL+ Group
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
var __extends = (this && this.__extends) || (function () {
|
|
18
|
+
var extendStatics = function (d, b) {
|
|
19
|
+
extendStatics = Object.setPrototypeOf ||
|
|
20
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
21
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
22
|
+
return extendStatics(d, b);
|
|
23
|
+
};
|
|
24
|
+
return function (d, b) {
|
|
25
|
+
if (typeof b !== "function" && b !== null)
|
|
26
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
27
|
+
extendStatics(d, b);
|
|
28
|
+
function __() { this.constructor = d; }
|
|
29
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
30
|
+
};
|
|
31
|
+
})();
|
|
32
|
+
var __values = (this && this.__values) || function(o) {
|
|
33
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
34
|
+
if (m) return m.call(o);
|
|
35
|
+
if (o && typeof o.length === "number") return {
|
|
36
|
+
next: function () {
|
|
37
|
+
if (o && i >= o.length) o = void 0;
|
|
38
|
+
return { value: o && o[i++], done: !o };
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
42
|
+
};
|
|
43
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
44
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
45
|
+
if (!m) return o;
|
|
46
|
+
var i = m.call(o), r, ar = [], e;
|
|
47
|
+
try {
|
|
48
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
49
|
+
}
|
|
50
|
+
catch (error) { e = { error: error }; }
|
|
51
|
+
finally {
|
|
52
|
+
try {
|
|
53
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
54
|
+
}
|
|
55
|
+
finally { if (e) throw e.error; }
|
|
56
|
+
}
|
|
57
|
+
return ar;
|
|
58
|
+
};
|
|
59
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
60
|
+
exports.parseScheme = exports.parseMPDInteger = exports.parseMPDFloat = exports.parseMaybeDividedNumber = exports.parseIntOrBoolean = exports.parseDuration = exports.parseDateTime = exports.parseByteRange = exports.parseBoolean = exports.parseBase64 = exports.ValueParser = exports.MPDError = exports.textContent = void 0;
|
|
61
|
+
// XML-Schema
|
|
62
|
+
// <http://standards.iso.org/ittf/PubliclyAvailableStandards/MPEG-DASH_schema_files/DASH-MPD.xsd>
|
|
63
|
+
var log_1 = require("../../../../../log");
|
|
64
|
+
var base64_1 = require("../../../../../utils/base64");
|
|
65
|
+
var is_non_empty_string_1 = require("../../../../../utils/is_non_empty_string");
|
|
66
|
+
var is_null_or_undefined_1 = require("../../../../../utils/is_null_or_undefined");
|
|
67
|
+
var xml_parser_1 = require("../../../../../utils/xml-parser");
|
|
68
|
+
var iso8601Duration = /^P(([\d.]*)Y)?(([\d.]*)M)?(([\d.]*)D)?T?(([\d.]*)H)?(([\d.]*)M)?(([\d.]*)S)?/;
|
|
69
|
+
var rangeRe = /([0-9]+)-([0-9]+)/;
|
|
70
|
+
/**
|
|
71
|
+
* Parse MPD boolean attributes.
|
|
72
|
+
*
|
|
73
|
+
* The returned value is a tuple of two elements where:
|
|
74
|
+
* 1. the first value is the parsed boolean - or `null` if we could not parse
|
|
75
|
+
* it
|
|
76
|
+
* 2. the second value is a possible error encountered while parsing this
|
|
77
|
+
* value - set to `null` if no error was encountered.
|
|
78
|
+
* @param {string} val - The value to parse
|
|
79
|
+
* @param {string} displayName - The name of the property. Used for error
|
|
80
|
+
* formatting.
|
|
81
|
+
* @returns {Array.<Boolean | Error | null>}
|
|
82
|
+
*/
|
|
83
|
+
function parseBoolean(val, displayName) {
|
|
84
|
+
if (val === "true") {
|
|
85
|
+
return [true, null];
|
|
86
|
+
}
|
|
87
|
+
if (val === "false") {
|
|
88
|
+
return [false, null];
|
|
89
|
+
}
|
|
90
|
+
var error = new MPDError("`".concat(displayName, "` property is not a boolean value but \"").concat(val, "\""));
|
|
91
|
+
return [false, error];
|
|
92
|
+
}
|
|
93
|
+
exports.parseBoolean = parseBoolean;
|
|
94
|
+
/**
|
|
95
|
+
* Parse MPD integer attributes.
|
|
96
|
+
*
|
|
97
|
+
* The returned value is a tuple of two elements where:
|
|
98
|
+
* 1. the first value is the parsed boolean - or `null` if we could not parse
|
|
99
|
+
* it
|
|
100
|
+
* 2. the second value is a possible error encountered while parsing this
|
|
101
|
+
* value - set to `null` if no error was encountered.
|
|
102
|
+
* @param {string} val - The value to parse
|
|
103
|
+
* @param {string} displayName - The name of the property. Used for error
|
|
104
|
+
* formatting.
|
|
105
|
+
* @returns {Array.<number | Error | null>}
|
|
106
|
+
*/
|
|
107
|
+
function parseMPDInteger(val, displayName) {
|
|
108
|
+
var toInt = parseInt(val, 10);
|
|
109
|
+
if (isNaN(toInt)) {
|
|
110
|
+
var error = new MPDError("`".concat(displayName, "` property is not an integer value but \"").concat(val, "\""));
|
|
111
|
+
return [null, error];
|
|
112
|
+
}
|
|
113
|
+
return [toInt, null];
|
|
114
|
+
}
|
|
115
|
+
exports.parseMPDInteger = parseMPDInteger;
|
|
116
|
+
/**
|
|
117
|
+
* Parse MPD float attributes.
|
|
118
|
+
*
|
|
119
|
+
* The returned value is a tuple of two elements where:
|
|
120
|
+
* 1. the first value is the parsed boolean - or `null` if we could not parse
|
|
121
|
+
* it
|
|
122
|
+
* 2. the second value is a possible error encountered while parsing this
|
|
123
|
+
* value - set to `null` if no error was encountered.
|
|
124
|
+
* @param {string} val - The value to parse
|
|
125
|
+
* @param {string} displayName - The name of the property. Used for error
|
|
126
|
+
* formatting.
|
|
127
|
+
* @returns {Array.<number | Error | null>}
|
|
128
|
+
*/
|
|
129
|
+
function parseMPDFloat(val, displayName) {
|
|
130
|
+
if (val === "INF") {
|
|
131
|
+
return [Infinity, null];
|
|
132
|
+
}
|
|
133
|
+
var toInt = parseFloat(val);
|
|
134
|
+
if (isNaN(toInt)) {
|
|
135
|
+
var error = new MPDError("`".concat(displayName, "` property is invalid: \"").concat(val, "\""));
|
|
136
|
+
return [null, error];
|
|
137
|
+
}
|
|
138
|
+
return [toInt, null];
|
|
139
|
+
}
|
|
140
|
+
exports.parseMPDFloat = parseMPDFloat;
|
|
141
|
+
/**
|
|
142
|
+
* Parse MPD attributes which are either integer or boolean values.
|
|
143
|
+
*
|
|
144
|
+
* The returned value is a tuple of two elements where:
|
|
145
|
+
* 1. the first value is the parsed value - or `null` if we could not parse
|
|
146
|
+
* it
|
|
147
|
+
* 2. the second value is a possible error encountered while parsing this
|
|
148
|
+
* value - set to `null` if no error was encountered.
|
|
149
|
+
* @param {string} val - The value to parse
|
|
150
|
+
* @param {string} displayName - The name of the property. Used for error
|
|
151
|
+
* formatting.
|
|
152
|
+
* @returns {Array.<Boolean | number | Error | null>}
|
|
153
|
+
*/
|
|
154
|
+
function parseIntOrBoolean(val, displayName) {
|
|
155
|
+
if (val === "true") {
|
|
156
|
+
return [true, null];
|
|
157
|
+
}
|
|
158
|
+
if (val === "false") {
|
|
159
|
+
return [false, null];
|
|
160
|
+
}
|
|
161
|
+
var toInt = parseInt(val, 10);
|
|
162
|
+
if (isNaN(toInt)) {
|
|
163
|
+
var error = new MPDError("`".concat(displayName, "` property is not a boolean nor an integer but \"").concat(val, "\""));
|
|
164
|
+
return [null, error];
|
|
165
|
+
}
|
|
166
|
+
return [toInt, null];
|
|
167
|
+
}
|
|
168
|
+
exports.parseIntOrBoolean = parseIntOrBoolean;
|
|
169
|
+
/**
|
|
170
|
+
* Parse MPD date attributes.
|
|
171
|
+
*
|
|
172
|
+
* The returned value is a tuple of two elements where:
|
|
173
|
+
* 1. the first value is the parsed value - or `null` if we could not parse
|
|
174
|
+
* it
|
|
175
|
+
* 2. the second value is a possible error encountered while parsing this
|
|
176
|
+
* value - set to `null` if no error was encountered.
|
|
177
|
+
* @param {string} val - The value to parse
|
|
178
|
+
* @param {string} displayName - The name of the property. Used for error
|
|
179
|
+
* formatting.
|
|
180
|
+
* @returns {Array.<Date | null | Error>}
|
|
181
|
+
*/
|
|
182
|
+
function parseDateTime(val, displayName) {
|
|
183
|
+
var parsed = Date.parse(val);
|
|
184
|
+
if (isNaN(parsed)) {
|
|
185
|
+
var error = new MPDError("`".concat(displayName, "` is in an invalid date format: \"").concat(val, "\""));
|
|
186
|
+
return [null, error];
|
|
187
|
+
}
|
|
188
|
+
return [new Date(Date.parse(val)).getTime() / 1000, null];
|
|
189
|
+
}
|
|
190
|
+
exports.parseDateTime = parseDateTime;
|
|
191
|
+
/**
|
|
192
|
+
* Parse MPD ISO8601 duration attributes into seconds.
|
|
193
|
+
*
|
|
194
|
+
* The returned value is a tuple of two elements where:
|
|
195
|
+
* 1. the first value is the parsed value - or `null` if we could not parse
|
|
196
|
+
* it
|
|
197
|
+
* 2. the second value is a possible error encountered while parsing this
|
|
198
|
+
* value - set to `null` if no error was encountered.
|
|
199
|
+
* @param {string} val - The value to parse
|
|
200
|
+
* @param {string} displayName - The name of the property. Used for error
|
|
201
|
+
* formatting.
|
|
202
|
+
* @returns {Array.<number | Error | null>}
|
|
203
|
+
*/
|
|
204
|
+
function parseDuration(val, displayName) {
|
|
205
|
+
if (!(0, is_non_empty_string_1.default)(val)) {
|
|
206
|
+
var error = new MPDError("`".concat(displayName, "` property is empty"));
|
|
207
|
+
return [0, error];
|
|
208
|
+
}
|
|
209
|
+
var match = iso8601Duration.exec(val);
|
|
210
|
+
if (match === null) {
|
|
211
|
+
var error = new MPDError("`".concat(displayName, "` property has an unrecognized format \"").concat(val, "\""));
|
|
212
|
+
return [null, error];
|
|
213
|
+
}
|
|
214
|
+
var duration = parseFloat((0, is_non_empty_string_1.default)(match[2]) ? match[2] : "0") * 365 * 24 * 60 * 60 +
|
|
215
|
+
parseFloat((0, is_non_empty_string_1.default)(match[4]) ? match[4] : "0") * 30 * 24 * 60 * 60 +
|
|
216
|
+
parseFloat((0, is_non_empty_string_1.default)(match[6]) ? match[6] : "0") * 24 * 60 * 60 +
|
|
217
|
+
parseFloat((0, is_non_empty_string_1.default)(match[8]) ? match[8] : "0") * 60 * 60 +
|
|
218
|
+
parseFloat((0, is_non_empty_string_1.default)(match[10]) ? match[10] : "0") * 60 +
|
|
219
|
+
parseFloat((0, is_non_empty_string_1.default)(match[12]) ? match[12] : "0");
|
|
220
|
+
return [duration, null];
|
|
221
|
+
}
|
|
222
|
+
exports.parseDuration = parseDuration;
|
|
223
|
+
/**
|
|
224
|
+
* Parse MPD byterange attributes into arrays of two elements: the start and
|
|
225
|
+
* the end.
|
|
226
|
+
*
|
|
227
|
+
* The returned value is a tuple of two elements where:
|
|
228
|
+
* 1. the first value is the parsed value - or `null` if we could not parse
|
|
229
|
+
* it
|
|
230
|
+
* 2. the second value is a possible error encountered while parsing this
|
|
231
|
+
* value - set to `null` if no error was encountered.
|
|
232
|
+
* @param {string} val
|
|
233
|
+
* @param {string} displayName
|
|
234
|
+
* @returns {Array.<Array.<number> | Error | null>}
|
|
235
|
+
*/
|
|
236
|
+
function parseByteRange(val, displayName) {
|
|
237
|
+
var match = rangeRe.exec(val);
|
|
238
|
+
if (match === null) {
|
|
239
|
+
var error = new MPDError("`".concat(displayName, "` property has an unrecognized format \"").concat(val, "\""));
|
|
240
|
+
return [null, error];
|
|
241
|
+
}
|
|
242
|
+
else {
|
|
243
|
+
return [[+match[1], +match[2]], null];
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
exports.parseByteRange = parseByteRange;
|
|
247
|
+
/**
|
|
248
|
+
* Parse MPD base64 attribute into an Uint8Array.
|
|
249
|
+
* the end.
|
|
250
|
+
*
|
|
251
|
+
* The returned value is a tuple of two elements where:
|
|
252
|
+
* 1. the first value is the parsed value - or `null` if we could not parse
|
|
253
|
+
* it
|
|
254
|
+
* 2. the second value is a possible error encountered while parsing this
|
|
255
|
+
* value - set to `null` if no error was encountered.
|
|
256
|
+
* @param {string} val
|
|
257
|
+
* @param {string} displayName
|
|
258
|
+
* @returns {Uint8Array | Error | null>}
|
|
259
|
+
*/
|
|
260
|
+
function parseBase64(val, displayName) {
|
|
261
|
+
try {
|
|
262
|
+
return [(0, base64_1.base64ToBytes)(val), null];
|
|
263
|
+
}
|
|
264
|
+
catch (_) {
|
|
265
|
+
var error = new MPDError("`".concat(displayName, "` is not a valid base64 string: \"").concat(val, "\""));
|
|
266
|
+
return [null, error];
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
exports.parseBase64 = parseBase64;
|
|
270
|
+
/**
|
|
271
|
+
* Some values in the MPD can be expressed as divisions of integers (e.g. frame
|
|
272
|
+
* rates).
|
|
273
|
+
* This function tries to convert it to a floating point value.
|
|
274
|
+
* @param {string} val
|
|
275
|
+
* @param {string} displayName
|
|
276
|
+
* @returns {Array.<number | Error | null>}
|
|
277
|
+
*/
|
|
278
|
+
function parseMaybeDividedNumber(val, displayName) {
|
|
279
|
+
var matches = /^(\d+)\/(\d+)$/.exec(val);
|
|
280
|
+
if (matches !== null) {
|
|
281
|
+
// No need to check, we know both are numbers
|
|
282
|
+
return [+matches[1] / +matches[2], null];
|
|
283
|
+
}
|
|
284
|
+
return parseMPDFloat(val, displayName);
|
|
285
|
+
}
|
|
286
|
+
exports.parseMaybeDividedNumber = parseMaybeDividedNumber;
|
|
287
|
+
/**
|
|
288
|
+
* @param {Object} root
|
|
289
|
+
* @returns {Object}
|
|
290
|
+
*/
|
|
291
|
+
function parseScheme(root) {
|
|
292
|
+
var e_1, _a;
|
|
293
|
+
var schemeIdUri;
|
|
294
|
+
var value;
|
|
295
|
+
try {
|
|
296
|
+
for (var _b = __values(Object.keys(root.attributes)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
297
|
+
var attributeName = _c.value;
|
|
298
|
+
var attributeVal = root.attributes[attributeName];
|
|
299
|
+
if ((0, is_null_or_undefined_1.default)(attributeVal)) {
|
|
300
|
+
continue;
|
|
301
|
+
}
|
|
302
|
+
switch (attributeName) {
|
|
303
|
+
case "schemeIdUri":
|
|
304
|
+
schemeIdUri = attributeVal;
|
|
305
|
+
break;
|
|
306
|
+
case "value":
|
|
307
|
+
value = attributeVal;
|
|
308
|
+
break;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
313
|
+
finally {
|
|
314
|
+
try {
|
|
315
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
316
|
+
}
|
|
317
|
+
finally { if (e_1) throw e_1.error; }
|
|
318
|
+
}
|
|
319
|
+
return { schemeIdUri: schemeIdUri, value: value };
|
|
320
|
+
}
|
|
321
|
+
exports.parseScheme = parseScheme;
|
|
322
|
+
/**
|
|
323
|
+
* Create a function to factorize the MPD parsing logic.
|
|
324
|
+
* @param {Object} dest - The destination object which will contain the parsed
|
|
325
|
+
* values.
|
|
326
|
+
* @param {Array.<Error>} warnings - An array which will contain every parsing
|
|
327
|
+
* error encountered.
|
|
328
|
+
* @return {Function}
|
|
329
|
+
*/
|
|
330
|
+
function ValueParser(dest, warnings) {
|
|
331
|
+
/**
|
|
332
|
+
* Parse a single value and add it to the `dest` objects.
|
|
333
|
+
* If an error arised while parsing, add it at the end of the `warnings` array.
|
|
334
|
+
* @param {string} objKey - The key which will be added to the `dest` object.
|
|
335
|
+
* @param {string} val - The value found in the MPD which we should parse.
|
|
336
|
+
* @param {Function} parsingFn - The parsing function adapted for this value.
|
|
337
|
+
* @param {string} displayName - The name of the key as it appears in the MPD.
|
|
338
|
+
* This is used only in error formatting,
|
|
339
|
+
*/
|
|
340
|
+
return function (val, _a) {
|
|
341
|
+
var asKey = _a.asKey, parser = _a.parser, dashName = _a.dashName;
|
|
342
|
+
var _b = __read(parser(val, dashName), 2), parsingResult = _b[0], parsingError = _b[1];
|
|
343
|
+
if (parsingError !== null) {
|
|
344
|
+
log_1.default.warn(parsingError.message);
|
|
345
|
+
warnings.push(parsingError);
|
|
346
|
+
}
|
|
347
|
+
if (parsingResult !== null) {
|
|
348
|
+
dest[asKey] = parsingResult;
|
|
349
|
+
}
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
exports.ValueParser = ValueParser;
|
|
353
|
+
/**
|
|
354
|
+
* Error arising when parsing the MPD.
|
|
355
|
+
* @class MPDError
|
|
356
|
+
* @extends Error
|
|
357
|
+
*/
|
|
358
|
+
var MPDError = /** @class */ (function (_super) {
|
|
359
|
+
__extends(MPDError, _super);
|
|
360
|
+
/**
|
|
361
|
+
* @param {string} message
|
|
362
|
+
*/
|
|
363
|
+
function MPDError(message) {
|
|
364
|
+
var _this = _super.call(this) || this;
|
|
365
|
+
// @see https://stackoverflow.com/questions/41102060/typescript-extending-error-class
|
|
366
|
+
Object.setPrototypeOf(_this, MPDError.prototype);
|
|
367
|
+
_this.name = "MPDError";
|
|
368
|
+
_this.message = message;
|
|
369
|
+
return _this;
|
|
370
|
+
}
|
|
371
|
+
return MPDError;
|
|
372
|
+
}(Error));
|
|
373
|
+
exports.MPDError = MPDError;
|
|
374
|
+
/**
|
|
375
|
+
* Obtain the equivalent of the `textContent` HTMLElement call for that node.
|
|
376
|
+
* @param {Array} children
|
|
377
|
+
* @returns {string}
|
|
378
|
+
*/
|
|
379
|
+
function textContent(children) {
|
|
380
|
+
return (0, xml_parser_1.toContentString)(children);
|
|
381
|
+
}
|
|
382
|
+
exports.textContent = textContent;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2015 CANAL+ Group
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type { IMPDParserArguments } from "../common";
|
|
17
|
+
import type { IDashParserResponse } from "../parsers_types";
|
|
18
|
+
/**
|
|
19
|
+
* Parse MPD through the Fast JS parser.
|
|
20
|
+
* @param {string} xml - MPD under a string format
|
|
21
|
+
* @param {Object} args - Various parsing options and information.
|
|
22
|
+
* @returns {Object} - Response returned by the DASH-JS parser.
|
|
23
|
+
*/
|
|
24
|
+
export default function parseFromString(xml: string, args: IMPDParserArguments): IDashParserResponse<string>;
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright 2015 CANAL+ Group
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
18
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
19
|
+
if (!m) return o;
|
|
20
|
+
var i = m.call(o), r, ar = [], e;
|
|
21
|
+
try {
|
|
22
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
23
|
+
}
|
|
24
|
+
catch (error) { e = { error: error }; }
|
|
25
|
+
finally {
|
|
26
|
+
try {
|
|
27
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
28
|
+
}
|
|
29
|
+
finally { if (e) throw e.error; }
|
|
30
|
+
}
|
|
31
|
+
return ar;
|
|
32
|
+
};
|
|
33
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
34
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
35
|
+
if (ar || !(i in from)) {
|
|
36
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
37
|
+
ar[i] = from[i];
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
41
|
+
};
|
|
42
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
|
+
var assert_1 = require("../../../../utils/assert");
|
|
44
|
+
var xml_parser_1 = require("../../../../utils/xml-parser");
|
|
45
|
+
var common_1 = require("../common");
|
|
46
|
+
var MPD_1 = require("./node_parsers/MPD");
|
|
47
|
+
var Period_1 = require("./node_parsers/Period");
|
|
48
|
+
/**
|
|
49
|
+
* Parse MPD through the Fast JS parser.
|
|
50
|
+
* @param {string} xml - MPD under a string format
|
|
51
|
+
* @param {Object} args - Various parsing options and information.
|
|
52
|
+
* @returns {Object} - Response returned by the DASH-JS parser.
|
|
53
|
+
*/
|
|
54
|
+
function parseFromString(xml, args) {
|
|
55
|
+
var root = (0, xml_parser_1.parseXml)(xml);
|
|
56
|
+
var lastChild = root[root.length - 1];
|
|
57
|
+
if (lastChild === undefined ||
|
|
58
|
+
typeof lastChild === "string" ||
|
|
59
|
+
lastChild.tagName !== "MPD") {
|
|
60
|
+
throw new Error("DASH Parser: document root should be MPD");
|
|
61
|
+
}
|
|
62
|
+
var _a = __read((0, MPD_1.createMPDIntermediateRepresentation)(lastChild, xml), 2), mpdIR = _a[0], warnings = _a[1];
|
|
63
|
+
var ret = (0, common_1.default)(mpdIR, args, warnings);
|
|
64
|
+
return processReturn(ret);
|
|
65
|
+
/**
|
|
66
|
+
* Handle `parseMpdIr` return values, asking for resources if they are needed
|
|
67
|
+
* and pre-processing them before continuing parsing.
|
|
68
|
+
*
|
|
69
|
+
* @param {Object} initialRes
|
|
70
|
+
* @returns {Object}
|
|
71
|
+
*/
|
|
72
|
+
function processReturn(initialRes) {
|
|
73
|
+
if (initialRes.type === "done") {
|
|
74
|
+
return initialRes;
|
|
75
|
+
}
|
|
76
|
+
else if (initialRes.type === "needs-clock") {
|
|
77
|
+
return {
|
|
78
|
+
type: "needs-resources",
|
|
79
|
+
value: {
|
|
80
|
+
urls: [initialRes.value.url],
|
|
81
|
+
format: "string",
|
|
82
|
+
continue: function (loadedClock) {
|
|
83
|
+
if (loadedClock.length !== 1) {
|
|
84
|
+
throw new Error("DASH parser: wrong number of loaded ressources.");
|
|
85
|
+
}
|
|
86
|
+
var newRet = initialRes.value.continue(loadedClock[0].responseData);
|
|
87
|
+
return processReturn(newRet);
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
else if (initialRes.type === "needs-xlinks") {
|
|
93
|
+
return {
|
|
94
|
+
type: "needs-resources",
|
|
95
|
+
value: {
|
|
96
|
+
urls: initialRes.value.xlinksUrls,
|
|
97
|
+
format: "string",
|
|
98
|
+
continue: function (loadedXlinks) {
|
|
99
|
+
var resourceInfos = [];
|
|
100
|
+
for (var i = 0; i < loadedXlinks.length; i++) {
|
|
101
|
+
var _a = loadedXlinks[i], xlinkResp = _a.responseData, receivedTime = _a.receivedTime, sendingTime = _a.sendingTime, url = _a.url;
|
|
102
|
+
if (!xlinkResp.success) {
|
|
103
|
+
throw xlinkResp.error;
|
|
104
|
+
}
|
|
105
|
+
var wrappedData = "<root>" + xlinkResp.data + "</root>";
|
|
106
|
+
var dataAsXML = (0, xml_parser_1.parseXml)(wrappedData);
|
|
107
|
+
var innerParsed = dataAsXML[dataAsXML.length - 1];
|
|
108
|
+
if (innerParsed === undefined || typeof innerParsed === "string") {
|
|
109
|
+
throw new Error("DASH parser: Invalid external ressources");
|
|
110
|
+
}
|
|
111
|
+
var periods = innerParsed.children;
|
|
112
|
+
var periodsIR = [];
|
|
113
|
+
var periodsIRWarnings = [];
|
|
114
|
+
for (var j = 0; j < periods.length; j++) {
|
|
115
|
+
var period = periods[j];
|
|
116
|
+
if (typeof period === "string" || period.tagName !== "Period") {
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
var _b = __read((0, Period_1.createPeriodIntermediateRepresentation)(period, wrappedData), 2), periodIR = _b[0], periodWarnings = _b[1];
|
|
120
|
+
periodsIRWarnings.push.apply(periodsIRWarnings, __spreadArray([], __read(periodWarnings), false));
|
|
121
|
+
periodsIR.push(periodIR);
|
|
122
|
+
}
|
|
123
|
+
resourceInfos.push({
|
|
124
|
+
url: url,
|
|
125
|
+
receivedTime: receivedTime,
|
|
126
|
+
sendingTime: sendingTime,
|
|
127
|
+
parsed: periodsIR,
|
|
128
|
+
warnings: periodsIRWarnings,
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
var newRet = initialRes.value.continue(resourceInfos);
|
|
132
|
+
return processReturn(newRet);
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
(0, assert_1.assertUnreachable)(initialRes);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
exports.default = parseFromString;
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
import type { ITNode } from "../../../utils/xml-parser";
|
|
16
17
|
/**
|
|
17
18
|
* Those are types used when generating the MPD "Intermediate Representation"
|
|
18
19
|
* which is an intermediate step between parsing the MPD (in XML) and generating
|
|
@@ -386,10 +387,11 @@ export interface IEventStreamEventIntermediateRepresentation {
|
|
|
386
387
|
duration?: number;
|
|
387
388
|
/**
|
|
388
389
|
* The `<Event>` element itself.
|
|
389
|
-
* Can be
|
|
390
|
+
* Can be under any of those forms:
|
|
390
391
|
* - Either as an Element instance directly
|
|
391
392
|
* - Either as the Element's UTF-8 textual representation.
|
|
393
|
+
* - Either as the Element's string representation.
|
|
392
394
|
*/
|
|
393
|
-
eventStreamData?: Element | ArrayBuffer;
|
|
395
|
+
eventStreamData?: Element | ArrayBuffer | string;
|
|
394
396
|
}
|
|
395
|
-
export type ITimelineParser = () => HTMLCollection;
|
|
397
|
+
export type ITimelineParser = () => ITNode[] | HTMLCollection;
|
|
@@ -15,7 +15,7 @@ export type IRxPlayerMode = "auto" | "main" | "multithread";
|
|
|
15
15
|
/** Argument of the `attachWorker` method. */
|
|
16
16
|
export interface IWorkerSettings {
|
|
17
17
|
workerUrl: string | Blob;
|
|
18
|
-
dashWasmUrl
|
|
18
|
+
dashWasmUrl?: string | ArrayBuffer | undefined;
|
|
19
19
|
}
|
|
20
20
|
/** Every options that can be given to the RxPlayer's constructor. */
|
|
21
21
|
export interface IConstructorOptions {
|
|
@@ -86,12 +86,19 @@ function generateManifestParser(options) {
|
|
|
86
86
|
* @returns {Object|Promise.<Object>}
|
|
87
87
|
*/
|
|
88
88
|
function runDefaultJsParser() {
|
|
89
|
-
if (parsers.
|
|
89
|
+
if (parsers.fastJs !== null) {
|
|
90
|
+
var manifestStr = getManifestAsString(responseData);
|
|
91
|
+
var parsedManifest = parsers.fastJs(manifestStr, dashParserOpts);
|
|
92
|
+
return processMpdParserResponse(parsedManifest);
|
|
93
|
+
}
|
|
94
|
+
else if (parsers.native !== null) {
|
|
95
|
+
var manifestDocument = getManifestAsDocument(responseData);
|
|
96
|
+
var parsedManifest = parsers.native(manifestDocument, dashParserOpts);
|
|
97
|
+
return processMpdParserResponse(parsedManifest);
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
90
100
|
throw new Error("No MPD parser is imported");
|
|
91
101
|
}
|
|
92
|
-
var manifestDoc = getManifestAsDocument(responseData);
|
|
93
|
-
var parsedManifest = parsers.js(manifestDoc, dashParserOpts);
|
|
94
|
-
return processMpdParserResponse(parsedManifest);
|
|
95
102
|
}
|
|
96
103
|
/**
|
|
97
104
|
* Process return of one of the MPD parser.
|
|
@@ -229,6 +236,28 @@ function assertLoadedResourcesFormatArrayBuffer(loadedResources) {
|
|
|
229
236
|
throw new Error("Invalid data given to the LoadedRessource");
|
|
230
237
|
});
|
|
231
238
|
}
|
|
239
|
+
/**
|
|
240
|
+
* Try to convert a Manifest from an unknown format to an array of nodes as
|
|
241
|
+
* parsed by our XML DOM parser.
|
|
242
|
+
*
|
|
243
|
+
* Throws if the format cannot be converted.
|
|
244
|
+
* @param {*} manifestSrc
|
|
245
|
+
* @returns {Array.<Object | string>}
|
|
246
|
+
*/
|
|
247
|
+
function getManifestAsString(manifestSrc) {
|
|
248
|
+
if (manifestSrc instanceof ArrayBuffer) {
|
|
249
|
+
return (0, string_parsing_1.utf8ToStr)(new Uint8Array(manifestSrc));
|
|
250
|
+
}
|
|
251
|
+
else if (typeof manifestSrc === "string") {
|
|
252
|
+
return manifestSrc;
|
|
253
|
+
}
|
|
254
|
+
else if (manifestSrc instanceof Document) {
|
|
255
|
+
return manifestSrc.documentElement.outerHTML;
|
|
256
|
+
}
|
|
257
|
+
else {
|
|
258
|
+
throw new Error("DASH Manifest Parser: Unrecognized Manifest format");
|
|
259
|
+
}
|
|
260
|
+
}
|
|
232
261
|
/**
|
|
233
262
|
* Try to convert a Manifest from an unknown format to a `Document` format.
|
|
234
263
|
* Useful to exploit DOM-parsing APIs to quickly parse an XML Manifest.
|