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.
Files changed (189) hide show
  1. package/VERSION +1 -1
  2. package/dist/commonjs/__GENERATED_CODE/embedded_dash_wasm.js +1 -1
  3. package/dist/commonjs/__GENERATED_CODE/embedded_worker.js +1 -1
  4. package/dist/commonjs/core/main/worker/worker_main.js +8 -9
  5. package/dist/commonjs/features/features_object.js +1 -1
  6. package/dist/commonjs/features/list/dash.js +2 -2
  7. package/dist/commonjs/features/types.d.ts +8 -3
  8. package/dist/commonjs/main_thread/api/public_api.js +2 -7
  9. package/dist/commonjs/multithread_types.d.ts +1 -1
  10. package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_elements.d.ts +4 -3
  11. package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_elements.js +11 -4
  12. package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_previous_timeline.d.ts +2 -1
  13. package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_previous_timeline.js +12 -3
  14. package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/find_first_common_start_time.d.ts +3 -2
  15. package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/find_first_common_start_time.js +22 -11
  16. package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/parse_s_element.d.ts +11 -2
  17. package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/parse_s_element.js +74 -3
  18. package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.d.ts +2 -1
  19. package/dist/commonjs/parsers/manifest/dash/common/parse_periods.js +3 -1
  20. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/index.d.ts +17 -0
  21. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/index.js +19 -0
  22. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/AdaptationSet.d.ts +24 -0
  23. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/AdaptationSet.js +400 -0
  24. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/BaseURL.d.ts +24 -0
  25. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/BaseURL.js +33 -0
  26. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/ContentComponent.d.ts +23 -0
  27. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/ContentComponent.js +70 -0
  28. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/ContentProtection.d.ts +22 -0
  29. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/ContentProtection.js +118 -0
  30. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/EventStream.d.ts +23 -0
  31. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/EventStream.js +154 -0
  32. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/Initialization.d.ts +22 -0
  33. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/Initialization.js +70 -0
  34. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/MPD.d.ts +23 -0
  35. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/MPD.js +221 -0
  36. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/Period.d.ts +23 -0
  37. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/Period.js +179 -0
  38. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/Representation.d.ts +22 -0
  39. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/Representation.js +256 -0
  40. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentBase.d.ts +23 -0
  41. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentBase.js +152 -0
  42. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentList.d.ts +22 -0
  43. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentList.js +60 -0
  44. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentTemplate.d.ts +24 -0
  45. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentTemplate.js +125 -0
  46. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentTimeline.d.ts +22 -0
  47. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentTimeline.js +36 -0
  48. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentURL.d.ts +24 -0
  49. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentURL.js +82 -0
  50. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/utils.d.ts +176 -0
  51. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/utils.js +382 -0
  52. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/parse_from_xml_string.d.ts +24 -0
  53. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/parse_from_xml_string.js +142 -0
  54. package/dist/commonjs/parsers/manifest/dash/node_parser_types.d.ts +5 -3
  55. package/dist/commonjs/public_types.d.ts +1 -1
  56. package/dist/commonjs/transports/dash/manifest_parser.js +33 -4
  57. package/dist/commonjs/utils/xml-parser.d.ts +70 -0
  58. package/dist/commonjs/utils/xml-parser.js +357 -0
  59. package/dist/es2017/__GENERATED_CODE/embedded_dash_wasm.js +1 -1
  60. package/dist/es2017/__GENERATED_CODE/embedded_worker.js +1 -1
  61. package/dist/es2017/core/main/worker/worker_main.js +8 -9
  62. package/dist/es2017/features/features_object.js +1 -1
  63. package/dist/es2017/features/list/dash.js +2 -2
  64. package/dist/es2017/features/types.d.ts +8 -3
  65. package/dist/es2017/main_thread/api/public_api.js +2 -7
  66. package/dist/es2017/multithread_types.d.ts +1 -1
  67. package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_elements.d.ts +4 -3
  68. package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_elements.js +12 -5
  69. package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_previous_timeline.d.ts +2 -1
  70. package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_previous_timeline.js +13 -4
  71. package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/find_first_common_start_time.d.ts +3 -2
  72. package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/find_first_common_start_time.js +22 -11
  73. package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/parse_s_element.d.ts +11 -2
  74. package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/parse_s_element.js +49 -2
  75. package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.d.ts +2 -1
  76. package/dist/es2017/parsers/manifest/dash/common/parse_periods.js +3 -1
  77. package/dist/es2017/parsers/manifest/dash/fast-js-parser/index.d.ts +17 -0
  78. package/dist/es2017/parsers/manifest/dash/fast-js-parser/index.js +17 -0
  79. package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/AdaptationSet.d.ts +24 -0
  80. package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/AdaptationSet.js +358 -0
  81. package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/BaseURL.d.ts +24 -0
  82. package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/BaseURL.js +30 -0
  83. package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/ContentComponent.d.ts +23 -0
  84. package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/ContentComponent.js +45 -0
  85. package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/ContentProtection.d.ts +22 -0
  86. package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/ContentProtection.js +77 -0
  87. package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/EventStream.d.ts +23 -0
  88. package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/EventStream.js +101 -0
  89. package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/Initialization.d.ts +22 -0
  90. package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/Initialization.js +45 -0
  91. package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/MPD.d.ts +23 -0
  92. package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/MPD.js +179 -0
  93. package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/Period.d.ts +23 -0
  94. package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/Period.js +137 -0
  95. package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/Representation.d.ts +22 -0
  96. package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/Representation.js +214 -0
  97. package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentBase.d.ts +23 -0
  98. package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentBase.js +111 -0
  99. package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentList.d.ts +22 -0
  100. package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentList.js +41 -0
  101. package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentTemplate.d.ts +24 -0
  102. package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentTemplate.js +84 -0
  103. package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentTimeline.d.ts +22 -0
  104. package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentTimeline.js +33 -0
  105. package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentURL.d.ts +24 -0
  106. package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentURL.js +57 -0
  107. package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/utils.d.ts +176 -0
  108. package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/utils.js +310 -0
  109. package/dist/es2017/parsers/manifest/dash/fast-js-parser/parse_from_xml_string.d.ts +24 -0
  110. package/dist/es2017/parsers/manifest/dash/fast-js-parser/parse_from_xml_string.js +114 -0
  111. package/dist/es2017/parsers/manifest/dash/node_parser_types.d.ts +5 -3
  112. package/dist/es2017/public_types.d.ts +1 -1
  113. package/dist/es2017/transports/dash/manifest_parser.js +33 -4
  114. package/dist/es2017/utils/xml-parser.d.ts +70 -0
  115. package/dist/es2017/utils/xml-parser.js +322 -0
  116. package/dist/mpd-parser.wasm +0 -0
  117. package/dist/rx-player.js +141 -65
  118. package/dist/rx-player.min.js +1 -1
  119. package/dist/worker.js +8 -3
  120. package/package.json +1 -1
  121. package/.vscode/settings.json +0 -9
  122. /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/index.d.ts +0 -0
  123. /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/index.js +0 -0
  124. /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/AdaptationSet.d.ts +0 -0
  125. /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/AdaptationSet.js +0 -0
  126. /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/BaseURL.d.ts +0 -0
  127. /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/BaseURL.js +0 -0
  128. /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/ContentComponent.d.ts +0 -0
  129. /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/ContentComponent.js +0 -0
  130. /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/ContentProtection.d.ts +0 -0
  131. /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/ContentProtection.js +0 -0
  132. /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/EventStream.d.ts +0 -0
  133. /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/EventStream.js +0 -0
  134. /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/Initialization.d.ts +0 -0
  135. /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/Initialization.js +0 -0
  136. /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/MPD.d.ts +0 -0
  137. /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/MPD.js +0 -0
  138. /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/Period.d.ts +0 -0
  139. /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/Period.js +0 -0
  140. /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/Representation.d.ts +0 -0
  141. /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/Representation.js +0 -0
  142. /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentBase.d.ts +0 -0
  143. /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentBase.js +0 -0
  144. /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentList.d.ts +0 -0
  145. /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentList.js +0 -0
  146. /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentTemplate.d.ts +0 -0
  147. /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentTemplate.js +0 -0
  148. /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentTimeline.d.ts +0 -0
  149. /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentTimeline.js +0 -0
  150. /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentURL.d.ts +0 -0
  151. /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentURL.js +0 -0
  152. /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/utils.d.ts +0 -0
  153. /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/utils.js +0 -0
  154. /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/parse_from_document.d.ts +0 -0
  155. /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/parse_from_document.js +0 -0
  156. /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/index.d.ts +0 -0
  157. /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/index.js +0 -0
  158. /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/AdaptationSet.d.ts +0 -0
  159. /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/AdaptationSet.js +0 -0
  160. /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/BaseURL.d.ts +0 -0
  161. /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/BaseURL.js +0 -0
  162. /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/ContentComponent.d.ts +0 -0
  163. /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/ContentComponent.js +0 -0
  164. /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/ContentProtection.d.ts +0 -0
  165. /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/ContentProtection.js +0 -0
  166. /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/EventStream.d.ts +0 -0
  167. /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/EventStream.js +0 -0
  168. /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/Initialization.d.ts +0 -0
  169. /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/Initialization.js +0 -0
  170. /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/MPD.d.ts +0 -0
  171. /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/MPD.js +0 -0
  172. /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/Period.d.ts +0 -0
  173. /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/Period.js +0 -0
  174. /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/Representation.d.ts +0 -0
  175. /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/Representation.js +0 -0
  176. /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentBase.d.ts +0 -0
  177. /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentBase.js +0 -0
  178. /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentList.d.ts +0 -0
  179. /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentList.js +0 -0
  180. /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentTemplate.d.ts +0 -0
  181. /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentTemplate.js +0 -0
  182. /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentTimeline.d.ts +0 -0
  183. /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentTimeline.js +0 -0
  184. /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentURL.d.ts +0 -0
  185. /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentURL.js +0 -0
  186. /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/utils.d.ts +0 -0
  187. /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/utils.js +0 -0
  188. /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/parse_from_document.d.ts +0 -0
  189. /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/parse_from_document.js +0 -0
@@ -0,0 +1,101 @@
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 isNullOrUndefined from "../../../../../utils/is_null_or_undefined";
17
+ import startsWith from "../../../../../utils/starts_with";
18
+ import { parseMPDInteger, ValueParser } from "./utils";
19
+ /**
20
+ * @param {Object} root
21
+ * @returns {Array}
22
+ */
23
+ function parseEventStreamAttributes(root) {
24
+ const res = {};
25
+ const warnings = [];
26
+ const parseValue = ValueParser(res, warnings);
27
+ for (const attributeName of Object.keys(root.attributes)) {
28
+ const attributeVal = root.attributes[attributeName];
29
+ if (isNullOrUndefined(attributeVal)) {
30
+ continue;
31
+ }
32
+ switch (attributeName) {
33
+ case "schemeIdUri":
34
+ res.schemeIdUri = attributeVal;
35
+ break;
36
+ case "value":
37
+ res.value = attributeVal;
38
+ break;
39
+ case "timescale":
40
+ parseValue(attributeVal, {
41
+ asKey: "timescale",
42
+ parser: parseMPDInteger,
43
+ dashName: "timescale",
44
+ });
45
+ break;
46
+ default:
47
+ if (startsWith(attributeName, "xmlns:")) {
48
+ if (res.namespaces === undefined) {
49
+ res.namespaces = [];
50
+ }
51
+ res.namespaces.push({
52
+ key: attributeName.substring(6),
53
+ value: attributeVal,
54
+ });
55
+ }
56
+ break;
57
+ }
58
+ }
59
+ return [res, warnings];
60
+ }
61
+ /**
62
+ * @param {Object} root
63
+ * @param {string} fullMpd
64
+ * @returns {Array}
65
+ */
66
+ export function createEventStreamIntermediateRepresentation(root, fullMpd) {
67
+ const [attributes, warnings] = parseEventStreamAttributes(root);
68
+ const events = [];
69
+ for (const child of root.children) {
70
+ if (typeof child !== "string" && child.tagName === "Event") {
71
+ const data = {};
72
+ if (!isNullOrUndefined(child.attributes.id)) {
73
+ data.id = child.attributes.id;
74
+ }
75
+ if (!isNullOrUndefined(child.attributes.presentationTime)) {
76
+ const [val, parsedWarning] = parseMPDInteger(child.attributes.presentationTime, "presentationTime");
77
+ if (parsedWarning !== null) {
78
+ warnings.push(parsedWarning);
79
+ }
80
+ if (val !== null) {
81
+ data.presentationTime = val;
82
+ }
83
+ }
84
+ if (!isNullOrUndefined(child.attributes.duration)) {
85
+ const [val, parsedWarning] = parseMPDInteger(child.attributes.duration, "duration");
86
+ if (parsedWarning !== null) {
87
+ warnings.push(parsedWarning);
88
+ }
89
+ if (val !== null) {
90
+ data.duration = val;
91
+ }
92
+ }
93
+ if (child.posStart < child.posEnd) {
94
+ const eventStr = fullMpd.substring(child.posStart, child.posEnd);
95
+ data.eventStreamData = eventStr;
96
+ }
97
+ events.push(data);
98
+ }
99
+ }
100
+ return [{ children: { events }, attributes }, warnings];
101
+ }
@@ -0,0 +1,22 @@
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 { ITNode } from "../../../../../utils/xml-parser";
17
+ import type { IInitializationAttributes } from "../../node_parser_types";
18
+ /**
19
+ * @param {Object} root
20
+ * @returns {Array.<Object>}
21
+ */
22
+ export default function parseInitialization(root: ITNode): [IInitializationAttributes, Error[]];
@@ -0,0 +1,45 @@
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 isNullOrUndefined from "../../../../../utils/is_null_or_undefined";
17
+ import { parseByteRange, ValueParser } from "./utils";
18
+ /**
19
+ * @param {Object} root
20
+ * @returns {Array.<Object>}
21
+ */
22
+ export default function parseInitialization(root) {
23
+ const parsedInitialization = {};
24
+ const warnings = [];
25
+ const parseValue = ValueParser(parsedInitialization, warnings);
26
+ for (const attributeName of Object.keys(root.attributes)) {
27
+ const attributeVal = root.attributes[attributeName];
28
+ if (isNullOrUndefined(attributeVal)) {
29
+ continue;
30
+ }
31
+ switch (attributeName) {
32
+ case "range":
33
+ parseValue(attributeVal, {
34
+ asKey: "range",
35
+ parser: parseByteRange,
36
+ dashName: "range",
37
+ });
38
+ break;
39
+ case "sourceURL":
40
+ parsedInitialization.media = attributeVal;
41
+ break;
42
+ }
43
+ }
44
+ return [parsedInitialization, warnings];
45
+ }
@@ -0,0 +1,23 @@
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 { ITNode } from "../../../../../utils/xml-parser";
17
+ import type { IMPDIntermediateRepresentation } from "../../node_parser_types";
18
+ /**
19
+ * @param {Object} root
20
+ * @param {string} fullMpd
21
+ * @returns {Array.<Object>}
22
+ */
23
+ export declare function createMPDIntermediateRepresentation(root: ITNode, fullMpd: string): [IMPDIntermediateRepresentation, Error[]];
@@ -0,0 +1,179 @@
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 isNullOrUndefined from "../../../../../utils/is_null_or_undefined";
17
+ import startsWith from "../../../../../utils/starts_with";
18
+ import parseBaseURL from "./BaseURL";
19
+ import { createPeriodIntermediateRepresentation } from "./Period";
20
+ import { parseDateTime, parseDuration, parseScheme, textContent, ValueParser, } from "./utils";
21
+ /**
22
+ * Parse children of the MPD's root into a simple object.
23
+ * @param {Array.<Object | string>} mpdChildren
24
+ * @returns {Array.<Object>}
25
+ */
26
+ function parseMPDChildren(mpdChildren, fullMpd) {
27
+ const baseURLs = [];
28
+ const locations = [];
29
+ const periods = [];
30
+ const utcTimings = [];
31
+ let warnings = [];
32
+ for (let i = 0; i < mpdChildren.length; i++) {
33
+ const currentNode = mpdChildren[i];
34
+ if (typeof currentNode === "string") {
35
+ continue;
36
+ }
37
+ switch (currentNode.tagName) {
38
+ case "BaseURL":
39
+ const [baseURLObj, baseURLWarnings] = parseBaseURL(currentNode);
40
+ if (baseURLObj !== undefined) {
41
+ baseURLs.push(baseURLObj);
42
+ }
43
+ warnings = warnings.concat(baseURLWarnings);
44
+ break;
45
+ case "Location":
46
+ locations.push(textContent(currentNode.children));
47
+ break;
48
+ case "Period":
49
+ const [period, periodWarnings] = createPeriodIntermediateRepresentation(currentNode, fullMpd);
50
+ periods.push(period);
51
+ warnings = warnings.concat(periodWarnings);
52
+ break;
53
+ case "UTCTiming":
54
+ const utcTiming = parseScheme(currentNode);
55
+ utcTimings.push(utcTiming);
56
+ break;
57
+ }
58
+ }
59
+ return [{ baseURLs, locations, periods, utcTimings }, warnings];
60
+ }
61
+ /**
62
+ * @param {Object} root
63
+ * @returns {Array.<Object>}
64
+ */
65
+ function parseMPDAttributes(root) {
66
+ const res = {};
67
+ const warnings = [];
68
+ const parseValue = ValueParser(res, warnings);
69
+ for (const attributeName of Object.keys(root.attributes)) {
70
+ const attributeVal = root.attributes[attributeName];
71
+ if (isNullOrUndefined(attributeVal)) {
72
+ continue;
73
+ }
74
+ switch (attributeName) {
75
+ case "id":
76
+ res.id = attributeVal;
77
+ break;
78
+ case "profiles":
79
+ res.profiles = attributeVal;
80
+ break;
81
+ case "type":
82
+ res.type = attributeVal;
83
+ break;
84
+ case "availabilityStartTime":
85
+ parseValue(attributeVal, {
86
+ asKey: "availabilityStartTime",
87
+ parser: parseDateTime,
88
+ dashName: "availabilityStartTime",
89
+ });
90
+ break;
91
+ case "availabilityEndTime":
92
+ parseValue(attributeVal, {
93
+ asKey: "availabilityEndTime",
94
+ parser: parseDateTime,
95
+ dashName: "availabilityEndTime",
96
+ });
97
+ break;
98
+ case "publishTime":
99
+ parseValue(attributeVal, {
100
+ asKey: "publishTime",
101
+ parser: parseDateTime,
102
+ dashName: "publishTime",
103
+ });
104
+ break;
105
+ case "mediaPresentationDuration":
106
+ parseValue(attributeVal, {
107
+ asKey: "duration",
108
+ parser: parseDuration,
109
+ dashName: "mediaPresentationDuration",
110
+ });
111
+ break;
112
+ case "minimumUpdatePeriod":
113
+ parseValue(attributeVal, {
114
+ asKey: "minimumUpdatePeriod",
115
+ parser: parseDuration,
116
+ dashName: "minimumUpdatePeriod",
117
+ });
118
+ break;
119
+ case "minBufferTime":
120
+ parseValue(attributeVal, {
121
+ asKey: "minBufferTime",
122
+ parser: parseDuration,
123
+ dashName: "minBufferTime",
124
+ });
125
+ break;
126
+ case "timeShiftBufferDepth":
127
+ parseValue(attributeVal, {
128
+ asKey: "timeShiftBufferDepth",
129
+ parser: parseDuration,
130
+ dashName: "timeShiftBufferDepth",
131
+ });
132
+ break;
133
+ case "suggestedPresentationDelay":
134
+ parseValue(attributeVal, {
135
+ asKey: "suggestedPresentationDelay",
136
+ parser: parseDuration,
137
+ dashName: "suggestedPresentationDelay",
138
+ });
139
+ break;
140
+ case "maxSegmentDuration":
141
+ parseValue(attributeVal, {
142
+ asKey: "maxSegmentDuration",
143
+ parser: parseDuration,
144
+ dashName: "maxSegmentDuration",
145
+ });
146
+ break;
147
+ case "maxSubsegmentDuration":
148
+ parseValue(attributeVal, {
149
+ asKey: "maxSubsegmentDuration",
150
+ parser: parseDuration,
151
+ dashName: "maxSubsegmentDuration",
152
+ });
153
+ break;
154
+ default:
155
+ if (startsWith(attributeName, "xmlns:")) {
156
+ if (res.namespaces === undefined) {
157
+ res.namespaces = [];
158
+ }
159
+ res.namespaces.push({
160
+ key: attributeName.substring(6),
161
+ value: attributeVal,
162
+ });
163
+ }
164
+ break;
165
+ }
166
+ }
167
+ return [res, warnings];
168
+ }
169
+ /**
170
+ * @param {Object} root
171
+ * @param {string} fullMpd
172
+ * @returns {Array.<Object>}
173
+ */
174
+ export function createMPDIntermediateRepresentation(root, fullMpd) {
175
+ const [children, childrenWarnings] = parseMPDChildren(root.children, fullMpd);
176
+ const [attributes, attrsWarnings] = parseMPDAttributes(root);
177
+ const warnings = childrenWarnings.concat(attrsWarnings);
178
+ return [{ children, attributes }, warnings];
179
+ }
@@ -0,0 +1,23 @@
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 { ITNode } from "../../../../../utils/xml-parser";
17
+ import type { IPeriodIntermediateRepresentation } from "../../node_parser_types";
18
+ /**
19
+ * @param {Object} periodElement
20
+ * @param {string} fullMpd
21
+ * @returns {Array}
22
+ */
23
+ export declare function createPeriodIntermediateRepresentation(periodElement: ITNode, fullMpd: string): [IPeriodIntermediateRepresentation, Error[]];
@@ -0,0 +1,137 @@
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 isNullOrUndefined from "../../../../../utils/is_null_or_undefined";
17
+ import startsWith from "../../../../../utils/starts_with";
18
+ import { createAdaptationSetIntermediateRepresentation } from "./AdaptationSet";
19
+ import parseBaseURL from "./BaseURL";
20
+ import { createEventStreamIntermediateRepresentation } from "./EventStream";
21
+ import parseSegmentTemplate from "./SegmentTemplate";
22
+ import { parseBoolean, parseDuration, ValueParser } from "./utils";
23
+ /**
24
+ * @param {Array.<Object | string>} periodChildren
25
+ * @param {string} fullMpd
26
+ * @returns {Array}
27
+ */
28
+ function parsePeriodChildren(periodChildren, fullMpd) {
29
+ const baseURLs = [];
30
+ const adaptations = [];
31
+ let segmentTemplate;
32
+ let warnings = [];
33
+ const eventStreams = [];
34
+ for (let i = 0; i < periodChildren.length; i++) {
35
+ const currentElement = periodChildren[i];
36
+ if (typeof currentElement === "string") {
37
+ continue;
38
+ }
39
+ switch (currentElement.tagName) {
40
+ case "BaseURL":
41
+ const [baseURLObj, baseURLWarnings] = parseBaseURL(currentElement);
42
+ if (baseURLObj !== undefined) {
43
+ baseURLs.push(baseURLObj);
44
+ }
45
+ warnings = warnings.concat(baseURLWarnings);
46
+ break;
47
+ case "AdaptationSet":
48
+ const [adaptation, adaptationWarnings] = createAdaptationSetIntermediateRepresentation(currentElement);
49
+ adaptations.push(adaptation);
50
+ warnings = warnings.concat(adaptationWarnings);
51
+ break;
52
+ case "EventStream":
53
+ const [eventStream, eventStreamWarnings] = createEventStreamIntermediateRepresentation(currentElement, fullMpd);
54
+ eventStreams.push(eventStream);
55
+ warnings = warnings.concat(eventStreamWarnings);
56
+ break;
57
+ case "SegmentTemplate":
58
+ const [parsedSegmentTemplate, segmentTemplateWarnings] = parseSegmentTemplate(currentElement);
59
+ segmentTemplate = parsedSegmentTemplate;
60
+ if (segmentTemplateWarnings.length > 0) {
61
+ warnings = warnings.concat(segmentTemplateWarnings);
62
+ }
63
+ break;
64
+ }
65
+ }
66
+ return [{ baseURLs, adaptations, eventStreams, segmentTemplate }, warnings];
67
+ }
68
+ /**
69
+ * @param {Object} root
70
+ * @returns {Array}
71
+ */
72
+ function parsePeriodAttributes(root) {
73
+ const res = {};
74
+ const warnings = [];
75
+ const parseValue = ValueParser(res, warnings);
76
+ for (const attributeName of Object.keys(root.attributes)) {
77
+ const attributeVal = root.attributes[attributeName];
78
+ if (isNullOrUndefined(attributeVal)) {
79
+ continue;
80
+ }
81
+ switch (attributeName) {
82
+ case "id":
83
+ res.id = attributeVal;
84
+ break;
85
+ case "start":
86
+ parseValue(attributeVal, {
87
+ asKey: "start",
88
+ parser: parseDuration,
89
+ dashName: "start",
90
+ });
91
+ break;
92
+ case "duration":
93
+ parseValue(attributeVal, {
94
+ asKey: "duration",
95
+ parser: parseDuration,
96
+ dashName: "duration",
97
+ });
98
+ break;
99
+ case "bitstreamSwitching":
100
+ parseValue(attributeVal, {
101
+ asKey: "bitstreamSwitching",
102
+ parser: parseBoolean,
103
+ dashName: "bitstreamSwitching",
104
+ });
105
+ break;
106
+ case "xlink:href":
107
+ res.xlinkHref = attributeVal;
108
+ break;
109
+ case "xlink:actuate":
110
+ res.xlinkActuate = attributeVal;
111
+ break;
112
+ default:
113
+ if (startsWith(attributeName, "xmlns:")) {
114
+ if (res.namespaces === undefined) {
115
+ res.namespaces = [];
116
+ }
117
+ res.namespaces.push({
118
+ key: attributeName.substring(6),
119
+ value: attributeVal,
120
+ });
121
+ }
122
+ break;
123
+ }
124
+ }
125
+ return [res, warnings];
126
+ }
127
+ /**
128
+ * @param {Object} periodElement
129
+ * @param {string} fullMpd
130
+ * @returns {Array}
131
+ */
132
+ export function createPeriodIntermediateRepresentation(periodElement, fullMpd) {
133
+ const [children, childrenWarnings] = parsePeriodChildren(periodElement.children, fullMpd);
134
+ const [attributes, attrsWarnings] = parsePeriodAttributes(periodElement);
135
+ const warnings = childrenWarnings.concat(attrsWarnings);
136
+ return [{ children, attributes }, warnings];
137
+ }
@@ -0,0 +1,22 @@
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 { ITNode } from "../../../../../utils/xml-parser";
17
+ import type { IRepresentationIntermediateRepresentation } from "../../node_parser_types";
18
+ /**
19
+ * @param {Object} representationElement
20
+ * @returns {Array}
21
+ */
22
+ export declare function createRepresentationIntermediateRepresentation(representationElement: ITNode): [IRepresentationIntermediateRepresentation, Error[]];