rx-player 3.26.2 → 3.26.3-dev.2022021400

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 (218) hide show
  1. package/.github/workflows/perfs.yml +22 -0
  2. package/CHANGELOG.md +19 -1
  3. package/VERSION +1 -1
  4. package/dist/_esm5.processed/compat/eme/custom_media_keys/index.js +6 -2
  5. package/dist/_esm5.processed/core/abr/buffer_based_chooser.d.ts +28 -6
  6. package/dist/_esm5.processed/core/abr/buffer_based_chooser.js +63 -12
  7. package/dist/_esm5.processed/core/abr/network_analyzer.d.ts +1 -1
  8. package/dist/_esm5.processed/core/abr/pending_requests_store.js +3 -5
  9. package/dist/_esm5.processed/core/abr/representation_estimator.d.ts +1 -1
  10. package/dist/_esm5.processed/core/abr/representation_estimator.js +2 -2
  11. package/dist/_esm5.processed/core/api/media_element_track_choice_manager.d.ts +6 -0
  12. package/dist/_esm5.processed/core/api/media_element_track_choice_manager.js +20 -3
  13. package/dist/_esm5.processed/core/api/public_api.d.ts +3 -3
  14. package/dist/_esm5.processed/core/api/public_api.js +2 -2
  15. package/dist/_esm5.processed/core/api/track_choice_manager.d.ts +6 -6
  16. package/dist/_esm5.processed/core/eme/__tests__/__global__/utils.d.ts +0 -2
  17. package/dist/_esm5.processed/core/eme/__tests__/__global__/utils.js +5 -10
  18. package/dist/_esm5.processed/core/eme/find_key_system.js +15 -5
  19. package/dist/_esm5.processed/core/eme/types.d.ts +2 -2
  20. package/dist/_esm5.processed/core/fetchers/manifest/manifest_fetcher.d.ts +4 -4
  21. package/dist/_esm5.processed/core/fetchers/manifest/manifest_fetcher.js +1 -1
  22. package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.d.ts +2 -2
  23. package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.js +5 -1
  24. package/dist/_esm5.processed/core/fetchers/utils/try_urls_with_backoff.js +1 -1
  25. package/dist/_esm5.processed/core/init/initialize_directfile.d.ts +2 -2
  26. package/dist/_esm5.processed/core/init/initialize_media_source.d.ts +1 -1
  27. package/dist/_esm5.processed/core/init/manifest_update_scheduler.d.ts +4 -4
  28. package/dist/_esm5.processed/core/init/stream_events_emitter/are_same_stream_events.d.ts +4 -4
  29. package/dist/_esm5.processed/core/init/stream_events_emitter/types.d.ts +2 -2
  30. package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/html_text_segment_buffer.d.ts +3 -3
  31. package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/text_track_cues_store.js +32 -31
  32. package/dist/_esm5.processed/core/segment_buffers/implementations/text/native/native_text_segment_buffer.d.ts +4 -4
  33. package/dist/_esm5.processed/core/stream/representation/force_garbage_collection.js +3 -4
  34. package/dist/_esm5.processed/errors/request_error.js +3 -1
  35. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/thumbnail_loader.d.ts +2 -2
  36. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/thumbnail_loader.js +1 -3
  37. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/api/probeMediaConfiguration.d.ts +1 -1
  38. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/api/probeMediaConfiguration.js +1 -1
  39. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/types.d.ts +3 -3
  40. package/dist/_esm5.processed/manifest/adaptation.d.ts +2 -2
  41. package/dist/_esm5.processed/manifest/adaptation.js +3 -1
  42. package/dist/_esm5.processed/manifest/manifest.d.ts +9 -9
  43. package/dist/_esm5.processed/manifest/period.d.ts +3 -3
  44. package/dist/_esm5.processed/manifest/representation.d.ts +2 -2
  45. package/dist/_esm5.processed/manifest/representation_index/types.d.ts +18 -18
  46. package/dist/_esm5.processed/manifest/types.d.ts +3 -3
  47. package/dist/_esm5.processed/parsers/manifest/dash/common/get_hdr_information.d.ts +1 -1
  48. package/dist/_esm5.processed/parsers/manifest/dash/common/get_periods_time_infos.d.ts +3 -3
  49. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/base.d.ts +6 -6
  50. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/get_init_segment.d.ts +3 -3
  51. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/get_segments_from_timeline.d.ts +2 -2
  52. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/list.d.ts +14 -14
  53. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/template.d.ts +17 -17
  54. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_elements.js +1 -1
  55. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.d.ts +28 -20
  56. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.js +19 -4
  57. package/dist/_esm5.processed/parsers/manifest/dash/common/infer_adaptation_type.d.ts +2 -2
  58. package/dist/_esm5.processed/parsers/manifest/dash/common/manifest_bounds_calculator.d.ts +1 -1
  59. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_adaptation_sets.d.ts +17 -35
  60. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_adaptation_sets.js +24 -23
  61. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_mpd.d.ts +8 -8
  62. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_periods.d.ts +18 -27
  63. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_periods.js +25 -23
  64. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representation_index.d.ts +21 -15
  65. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representation_index.js +19 -19
  66. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representations.d.ts +15 -38
  67. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representations.js +8 -8
  68. package/dist/_esm5.processed/parsers/manifest/dash/node_parser_types.d.ts +30 -30
  69. package/dist/_esm5.processed/parsers/manifest/dash/parsers_types.d.ts +3 -3
  70. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/dash-wasm-parser.js +1 -1
  71. package/dist/_esm5.processed/parsers/manifest/metaplaylist/metaplaylist_parser.d.ts +2 -2
  72. package/dist/_esm5.processed/parsers/manifest/smooth/create_parser.d.ts +7 -7
  73. package/dist/_esm5.processed/parsers/manifest/smooth/representation_index.d.ts +8 -8
  74. package/dist/_esm5.processed/parsers/manifest/types.d.ts +28 -28
  75. package/dist/_esm5.processed/parsers/manifest/utils/clear_timeline_from_position.d.ts +3 -2
  76. package/dist/_esm5.processed/parsers/manifest/utils/clear_timeline_from_position.js +15 -5
  77. package/dist/_esm5.processed/parsers/manifest/utils/index_helpers.d.ts +2 -2
  78. package/dist/_esm5.processed/parsers/manifest/utils/update_segment_timeline.d.ts +11 -1
  79. package/dist/_esm5.processed/parsers/manifest/utils/update_segment_timeline.js +31 -19
  80. package/dist/_esm5.processed/parsers/texttracks/webvtt/html/to_html.d.ts +2 -2
  81. package/dist/_esm5.processed/parsers/texttracks/webvtt/parse_cue_block.d.ts +1 -1
  82. package/dist/_esm5.processed/transports/dash/add_segment_integrity_checks_to_loader.js +2 -1
  83. package/dist/_esm5.processed/transports/dash/image_pipelines.js +1 -1
  84. package/dist/_esm5.processed/transports/dash/init_segment_loader.js +1 -1
  85. package/dist/_esm5.processed/transports/dash/manifest_parser.js +1 -1
  86. package/dist/_esm5.processed/transports/dash/segment_loader.d.ts +2 -2
  87. package/dist/_esm5.processed/transports/dash/segment_loader.js +2 -2
  88. package/dist/_esm5.processed/transports/dash/segment_parser.d.ts +1 -1
  89. package/dist/_esm5.processed/transports/dash/text_loader.d.ts +1 -1
  90. package/dist/_esm5.processed/transports/dash/text_loader.js +1 -1
  91. package/dist/_esm5.processed/transports/dash/text_parser.d.ts +1 -1
  92. package/dist/_esm5.processed/transports/local/segment_loader.d.ts +1 -2
  93. package/dist/_esm5.processed/transports/local/segment_loader.js +1 -1
  94. package/dist/_esm5.processed/transports/metaplaylist/manifest_loader.d.ts +1 -1
  95. package/dist/_esm5.processed/transports/metaplaylist/pipelines.js +1 -1
  96. package/dist/_esm5.processed/transports/smooth/pipelines.js +1 -1
  97. package/dist/_esm5.processed/transports/smooth/segment_loader.d.ts +0 -1
  98. package/dist/_esm5.processed/transports/smooth/segment_loader.js +2 -2
  99. package/dist/_esm5.processed/transports/types.d.ts +36 -30
  100. package/dist/_esm5.processed/transports/utils/call_custom_manifest_loader.js +1 -1
  101. package/dist/_esm5.processed/transports/utils/generate_manifest_loader.d.ts +1 -1
  102. package/dist/_esm5.processed/utils/cancellable_sleep.js +1 -1
  103. package/dist/_esm5.processed/utils/cast_to_observable.d.ts +1 -2
  104. package/dist/_esm5.processed/utils/cast_to_observable.js +1 -1
  105. package/dist/_esm5.processed/utils/request/fetch.d.ts +4 -5
  106. package/dist/_esm5.processed/utils/request/fetch.js +7 -4
  107. package/dist/_esm5.processed/utils/request/xhr.d.ts +6 -6
  108. package/dist/_esm5.processed/utils/request/xhr.js +2 -1
  109. package/dist/_esm5.processed/utils/rx-from_cancellable_promise.d.ts +1 -2
  110. package/dist/rx-player.js +404 -321
  111. package/dist/rx-player.min.js +1 -1
  112. package/package.json +3 -4
  113. package/scripts/doc-generator/generate_header_html.js +6 -7
  114. package/scripts/doc-generator/generate_page_html.js +3 -4
  115. package/scripts/doc-generator/generate_page_list_html.js +4 -5
  116. package/scripts/doc-generator/generate_sidebar_html.js +4 -7
  117. package/scripts/doc-generator/utils.js +0 -11
  118. package/scripts/generate_demo_list.js +3 -3
  119. package/scripts/generate_documentation_list.js +3 -3
  120. package/scripts/launch_static_server.js +127 -67
  121. package/scripts/run_standalone_demo.js +1 -0
  122. package/scripts/start_demo_web_server.js +1 -0
  123. package/sonar-project.properties +1 -1
  124. package/src/compat/__tests__/fullscreen.test.ts +7 -7
  125. package/src/compat/__tests__/is_vtt_cue.test.ts +1 -1
  126. package/src/compat/eme/custom_media_keys/ie11_media_keys.ts +1 -1
  127. package/src/compat/eme/custom_media_keys/index.ts +7 -3
  128. package/src/core/abr/__tests__/{get_estimate_from_buffer_levels.test.ts → buffer_based_chooser.test.ts} +94 -123
  129. package/src/core/abr/buffer_based_chooser.ts +85 -20
  130. package/src/core/abr/network_analyzer.ts +1 -1
  131. package/src/core/abr/pending_requests_store.ts +3 -5
  132. package/src/core/abr/representation_estimator.ts +6 -3
  133. package/src/core/api/media_element_track_choice_manager.ts +22 -3
  134. package/src/core/api/public_api.ts +6 -6
  135. package/src/core/api/track_choice_manager.ts +10 -9
  136. package/src/core/eme/__tests__/__global__/utils.ts +5 -10
  137. package/src/core/eme/find_key_system.ts +14 -12
  138. package/src/core/eme/types.ts +2 -2
  139. package/src/core/fetchers/manifest/manifest_fetcher.ts +5 -5
  140. package/src/core/fetchers/segment/segment_fetcher.ts +6 -3
  141. package/src/core/fetchers/utils/try_urls_with_backoff.ts +1 -1
  142. package/src/core/init/initialize_directfile.ts +2 -2
  143. package/src/core/init/initialize_media_source.ts +2 -2
  144. package/src/core/init/manifest_update_scheduler.ts +7 -7
  145. package/src/core/init/stream_events_emitter/are_same_stream_events.ts +4 -4
  146. package/src/core/init/stream_events_emitter/types.ts +2 -2
  147. package/src/core/segment_buffers/implementations/text/html/html_text_segment_buffer.ts +3 -3
  148. package/src/core/segment_buffers/implementations/text/html/text_track_cues_store.ts +32 -31
  149. package/src/core/segment_buffers/implementations/text/native/native_text_segment_buffer.ts +4 -4
  150. package/src/core/stream/representation/force_garbage_collection.ts +3 -5
  151. package/src/errors/request_error.ts +4 -1
  152. package/src/experimental/tools/VideoThumbnailLoader/thumbnail_loader.ts +3 -6
  153. package/src/experimental/tools/mediaCapabilitiesProber/api/index.ts +1 -1
  154. package/src/experimental/tools/mediaCapabilitiesProber/api/probeMediaConfiguration.ts +3 -3
  155. package/src/experimental/tools/mediaCapabilitiesProber/types.ts +3 -3
  156. package/src/manifest/adaptation.ts +6 -4
  157. package/src/manifest/manifest.ts +10 -10
  158. package/src/manifest/period.ts +3 -3
  159. package/src/manifest/representation.ts +2 -2
  160. package/src/manifest/representation_index/types.ts +18 -18
  161. package/src/manifest/types.ts +3 -3
  162. package/src/parsers/manifest/dash/common/__tests__/manifest_bounds_calculator.test.ts +1 -0
  163. package/src/parsers/manifest/dash/common/get_hdr_information.ts +1 -1
  164. package/src/parsers/manifest/dash/common/get_periods_time_infos.ts +3 -3
  165. package/src/parsers/manifest/dash/common/indexes/base.ts +6 -6
  166. package/src/parsers/manifest/dash/common/indexes/get_init_segment.ts +4 -2
  167. package/src/parsers/manifest/dash/common/indexes/get_segments_from_timeline.ts +2 -2
  168. package/src/parsers/manifest/dash/common/indexes/list.ts +14 -14
  169. package/src/parsers/manifest/dash/common/indexes/template.ts +17 -16
  170. package/src/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_elements.ts +1 -1
  171. package/src/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.ts +50 -22
  172. package/src/parsers/manifest/dash/common/infer_adaptation_type.ts +2 -2
  173. package/src/parsers/manifest/dash/common/manifest_bounds_calculator.ts +1 -1
  174. package/src/parsers/manifest/dash/common/parse_adaptation_sets.ts +58 -70
  175. package/src/parsers/manifest/dash/common/parse_mpd.ts +8 -8
  176. package/src/parsers/manifest/dash/common/parse_periods.ts +80 -79
  177. package/src/parsers/manifest/dash/common/parse_representation_index.ts +83 -75
  178. package/src/parsers/manifest/dash/common/parse_representations.ts +44 -63
  179. package/src/parsers/manifest/dash/node_parser_types.ts +30 -30
  180. package/src/parsers/manifest/dash/parsers_types.ts +3 -3
  181. package/src/parsers/manifest/dash/wasm-parser/ts/dash-wasm-parser.ts +1 -1
  182. package/src/parsers/manifest/metaplaylist/metaplaylist_parser.ts +4 -4
  183. package/src/parsers/manifest/smooth/create_parser.ts +23 -21
  184. package/src/parsers/manifest/smooth/representation_index.ts +14 -14
  185. package/src/parsers/manifest/types.ts +28 -28
  186. package/src/parsers/manifest/utils/__tests__/update_segment_timeline.test.ts +31 -33
  187. package/src/parsers/manifest/utils/clear_timeline_from_position.ts +15 -6
  188. package/src/parsers/manifest/utils/index_helpers.ts +2 -2
  189. package/src/parsers/manifest/utils/update_segment_timeline.ts +32 -21
  190. package/src/parsers/texttracks/webvtt/html/to_html.ts +2 -2
  191. package/src/parsers/texttracks/webvtt/parse_cue_block.ts +1 -1
  192. package/src/transports/dash/add_segment_integrity_checks_to_loader.ts +2 -2
  193. package/src/transports/dash/image_pipelines.ts +1 -1
  194. package/src/transports/dash/init_segment_loader.ts +1 -1
  195. package/src/transports/dash/manifest_parser.ts +1 -1
  196. package/src/transports/dash/segment_loader.ts +7 -7
  197. package/src/transports/dash/segment_parser.ts +3 -1
  198. package/src/transports/dash/text_loader.ts +2 -2
  199. package/src/transports/dash/text_parser.ts +3 -1
  200. package/src/transports/local/segment_loader.ts +4 -4
  201. package/src/transports/metaplaylist/manifest_loader.ts +1 -1
  202. package/src/transports/metaplaylist/pipelines.ts +1 -1
  203. package/src/transports/smooth/pipelines.ts +7 -7
  204. package/src/transports/smooth/segment_loader.ts +8 -8
  205. package/src/transports/types.ts +37 -30
  206. package/src/transports/utils/call_custom_manifest_loader.ts +6 -6
  207. package/src/transports/utils/generate_manifest_loader.ts +1 -1
  208. package/src/utils/__tests__/flat_map.test.ts +12 -7
  209. package/src/utils/cancellable_sleep.ts +1 -1
  210. package/src/utils/cast_to_observable.ts +1 -2
  211. package/src/utils/request/fetch.ts +16 -13
  212. package/src/utils/request/xhr.ts +9 -7
  213. package/src/utils/rx-from_cancellable_promise.ts +1 -2
  214. package/tsconfig.json +1 -2
  215. package/tsconfig.modules.json +1 -2
  216. package/dist/_esm5.processed/core/abr/get_estimate_from_buffer_levels.d.ts +0 -29
  217. package/dist/_esm5.processed/core/abr/get_estimate_from_buffer_levels.js +0 -67
  218. package/src/core/abr/get_estimate_from_buffer_levels.ts +0 -85
@@ -16,33 +16,29 @@
16
16
  import Manifest from "../../../../manifest";
17
17
  import { IParsedPeriod } from "../../types";
18
18
  import { IPeriodIntermediateRepresentation } from "../node_parser_types";
19
- import { IResolvedBaseUrl } from "./resolve_base_urls";
19
+ import { IAdaptationSetContext } from "./parse_adaptation_sets";
20
20
  /** Information about each linked Xlink. */
21
21
  export declare type IXLinkInfos = WeakMap<IPeriodIntermediateRepresentation, {
22
22
  /** Real URL (post-redirection) used to download this xlink. */
23
- url?: string;
23
+ url?: string | undefined;
24
24
  /** Time at which the request was sent (since the time origin), in ms. */
25
- sendingTime?: number;
25
+ sendingTime?: number | undefined;
26
26
  /** Time at which the request was received (since the time origin), in ms. */
27
- receivedTime?: number;
27
+ receivedTime?: number | undefined;
28
28
  }>;
29
+ /**
30
+ * Process intermediate periods to create final parsed periods.
31
+ * @param {Array.<Object>} periodsIR
32
+ * @param {Object} context
33
+ * @returns {Array.<Object>}
34
+ */
35
+ export default function parsePeriods(periodsIR: IPeriodIntermediateRepresentation[], context: IPeriodContext): IParsedPeriod[];
29
36
  /** Context needed when calling `parsePeriods`. */
30
- export interface IPeriodsContextInfos {
31
- /** Whether we should request new segments even if they are not yet finished. */
32
- aggressiveMode: boolean;
37
+ export interface IPeriodContext extends IInheritedAdaptationContext {
33
38
  availabilityStartTime: number;
34
- baseURLs: IResolvedBaseUrl[];
35
- clockOffset?: number;
36
- duration?: number;
37
- isDynamic: boolean;
38
- manifestProfiles?: string;
39
- /**
40
- * Time (in terms of `performance.now`) at which the XML file containing this
41
- * Period was received.
42
- */
43
- receivedTime?: number;
44
- /** Depth of the buffer for the whole content, in seconds. */
45
- timeShiftBufferDepth?: number;
39
+ clockOffset?: number | undefined;
40
+ /** Duration (mediaPresentationDuration) of the whole MPD, in seconds. */
41
+ duration?: number | undefined;
46
42
  /**
47
43
  * The parser should take this Manifest - which is a previously parsed
48
44
  * Manifest for the same dynamic content - as a base to speed-up the parsing
@@ -61,12 +57,7 @@ export interface IPeriodsContextInfos {
61
57
  xmlNamespaces?: Array<{
62
58
  key: string;
63
59
  value: string;
64
- }>;
60
+ }> | undefined;
65
61
  }
66
- /**
67
- * Process intermediate periods to create final parsed periods.
68
- * @param {Array.<Object>} periodsIR
69
- * @param {Object} contextInfos
70
- * @returns {Array.<Object>}
71
- */
72
- export default function parsePeriods(periodsIR: IPeriodIntermediateRepresentation[], contextInfos: IPeriodsContextInfos): IParsedPeriod[];
62
+ declare type IInheritedAdaptationContext = Omit<IAdaptationSetContext, "availabilityTimeComplete" | "availabilityTimeOffset" | "duration" | "isLastPeriod" | "manifestBoundsCalculator" | "start" | "unsafelyBaseOnPreviousPeriod">;
63
+ export {};
@@ -28,25 +28,26 @@ var generatePeriodID = idGenerator();
28
28
  /**
29
29
  * Process intermediate periods to create final parsed periods.
30
30
  * @param {Array.<Object>} periodsIR
31
- * @param {Object} contextInfos
31
+ * @param {Object} context
32
32
  * @returns {Array.<Object>}
33
33
  */
34
- export default function parsePeriods(periodsIR, contextInfos) {
34
+ export default function parsePeriods(periodsIR, context) {
35
35
  var _a, _b, _c, _d, _e, _f;
36
36
  var parsedPeriods = [];
37
- var periodsTimeInformation = getPeriodsTimeInformation(periodsIR, contextInfos);
37
+ var periodsTimeInformation = getPeriodsTimeInformation(periodsIR, context);
38
38
  if (periodsTimeInformation.length !== periodsIR.length) {
39
39
  throw new Error("MPD parsing error: the time information are incoherent.");
40
40
  }
41
- var isDynamic = contextInfos.isDynamic, timeShiftBufferDepth = contextInfos.timeShiftBufferDepth;
41
+ var isDynamic = context.isDynamic, timeShiftBufferDepth = context.timeShiftBufferDepth;
42
42
  var manifestBoundsCalculator = new ManifestBoundsCalculator({ isDynamic: isDynamic, timeShiftBufferDepth: timeShiftBufferDepth });
43
- if (!isDynamic && contextInfos.duration != null) {
44
- manifestBoundsCalculator.setLastPosition(contextInfos.duration);
43
+ if (!isDynamic && context.duration != null) {
44
+ manifestBoundsCalculator.setLastPosition(context.duration);
45
45
  }
46
46
  var _loop_1 = function (i) {
47
+ var isLastPeriod = i === periodsIR.length - 1;
47
48
  var periodIR = periodsIR[i];
48
- var xlinkInfos = contextInfos.xlinkInfos.get(periodIR);
49
- var periodBaseURLs = resolveBaseURLs(contextInfos.baseURLs, periodIR.children.baseURLs);
49
+ var xlinkInfos = context.xlinkInfos.get(periodIR);
50
+ var periodBaseURLs = resolveBaseURLs(context.baseURLs, periodIR.children.baseURLs);
50
51
  var _g = periodsTimeInformation[i], periodStart = _g.periodStart, periodDuration = _g.periodDuration, periodEnd = _g.periodEnd;
51
52
  var periodID;
52
53
  if (periodIR.attributes.id == null) {
@@ -61,15 +62,16 @@ export default function parsePeriods(periodsIR, contextInfos) {
61
62
  periodID += "-dup";
62
63
  }
63
64
  var receivedTime = xlinkInfos !== undefined ? xlinkInfos.receivedTime :
64
- contextInfos.receivedTime;
65
- var unsafelyBaseOnPreviousPeriod = (_b = (_a = contextInfos
65
+ context.receivedTime;
66
+ var unsafelyBaseOnPreviousPeriod = (_b = (_a = context
66
67
  .unsafelyBaseOnPreviousManifest) === null || _a === void 0 ? void 0 : _a.getPeriod(periodID)) !== null && _b !== void 0 ? _b : null;
67
68
  var availabilityTimeComplete = (_c = periodIR.attributes.availabilityTimeComplete) !== null && _c !== void 0 ? _c : true;
68
69
  var availabilityTimeOffset = (_d = periodIR.attributes.availabilityTimeOffset) !== null && _d !== void 0 ? _d : 0;
69
- var periodInfos = { aggressiveMode: contextInfos.aggressiveMode, availabilityTimeComplete: availabilityTimeComplete, availabilityTimeOffset: availabilityTimeOffset, baseURLs: periodBaseURLs, manifestBoundsCalculator: manifestBoundsCalculator, end: periodEnd, isDynamic: isDynamic, manifestProfiles: contextInfos.manifestProfiles, receivedTime: receivedTime, segmentTemplate: periodIR.children.segmentTemplate,
70
- start: periodStart, timeShiftBufferDepth: timeShiftBufferDepth, unsafelyBaseOnPreviousPeriod: unsafelyBaseOnPreviousPeriod };
71
- var adaptations = parseAdaptationSets(periodIR.children.adaptations, periodInfos);
72
- var namespaces = ((_e = contextInfos.xmlNamespaces) !== null && _e !== void 0 ? _e : [])
70
+ var aggressiveMode = context.aggressiveMode, manifestProfiles = context.manifestProfiles;
71
+ var segmentTemplate = periodIR.children.segmentTemplate;
72
+ var adapCtxt = { aggressiveMode: aggressiveMode, availabilityTimeComplete: availabilityTimeComplete, availabilityTimeOffset: availabilityTimeOffset, baseURLs: periodBaseURLs, manifestBoundsCalculator: manifestBoundsCalculator, end: periodEnd, isDynamic: isDynamic, isLastPeriod: isLastPeriod, manifestProfiles: manifestProfiles, receivedTime: receivedTime, segmentTemplate: segmentTemplate, start: periodStart, timeShiftBufferDepth: timeShiftBufferDepth, unsafelyBaseOnPreviousPeriod: unsafelyBaseOnPreviousPeriod };
73
+ var adaptations = parseAdaptationSets(periodIR.children.adaptations, adapCtxt);
74
+ var namespaces = ((_e = context.xmlNamespaces) !== null && _e !== void 0 ? _e : [])
73
75
  .concat((_f = periodIR.attributes.namespaces) !== null && _f !== void 0 ? _f : []);
74
76
  var streamEvents = generateStreamEvents(periodIR.children.eventStreams, periodStart, namespaces);
75
77
  var parsedPeriod = { id: periodID,
@@ -90,7 +92,7 @@ export default function parsePeriods(periodsIR, contextInfos) {
90
92
  manifestBoundsCalculator.setLastPosition(lastPosition, positionTime);
91
93
  }
92
94
  else {
93
- var guessedLastPositionFromClock = guessLastPositionFromClock(contextInfos, periodStart);
95
+ var guessedLastPositionFromClock = guessLastPositionFromClock(context, periodStart);
94
96
  if (guessedLastPositionFromClock !== undefined) {
95
97
  var guessedLastPosition = guessedLastPositionFromClock[0], guessedPositionTime = guessedLastPositionFromClock[1];
96
98
  manifestBoundsCalculator.setLastPosition(guessedLastPosition, guessedPositionTime);
@@ -104,9 +106,9 @@ export default function parsePeriods(periodsIR, contextInfos) {
104
106
  for (var i = periodsIR.length - 1; i >= 0; i--) {
105
107
  _loop_1(i);
106
108
  }
107
- if (contextInfos.isDynamic && !manifestBoundsCalculator.lastPositionIsKnown()) {
109
+ if (context.isDynamic && !manifestBoundsCalculator.lastPositionIsKnown()) {
108
110
  // Guess a last time the last position
109
- var guessedLastPositionFromClock = guessLastPositionFromClock(contextInfos, 0);
111
+ var guessedLastPositionFromClock = guessLastPositionFromClock(context, 0);
110
112
  if (guessedLastPositionFromClock !== undefined) {
111
113
  var lastPosition = guessedLastPositionFromClock[0], positionTime = guessedLastPositionFromClock[1];
112
114
  manifestBoundsCalculator.setLastPosition(lastPosition, positionTime);
@@ -137,14 +139,14 @@ export default function parsePeriods(periodsIR, contextInfos) {
137
139
  * the live time more directly from that previous one, we might be better off
138
140
  * than just using the clock.
139
141
  *
140
- * @param {Object} contextInfos
142
+ * @param {Object} context
141
143
  * @param {number} minimumTime
142
144
  * @returns {Array.<number|undefined>}
143
145
  */
144
- function guessLastPositionFromClock(contextInfos, minimumTime) {
145
- if (contextInfos.clockOffset != null) {
146
- var lastPosition = contextInfos.clockOffset / 1000 -
147
- contextInfos.availabilityStartTime;
146
+ function guessLastPositionFromClock(context, minimumTime) {
147
+ if (context.clockOffset != null) {
148
+ var lastPosition = context.clockOffset / 1000 -
149
+ context.availabilityStartTime;
148
150
  var positionTime = performance.now() / 1000;
149
151
  var timeInSec = positionTime + lastPosition;
150
152
  if (timeInSec >= minimumTime) {
@@ -156,7 +158,7 @@ function guessLastPositionFromClock(contextInfos, minimumTime) {
156
158
  if (now >= minimumTime) {
157
159
  log.warn("DASH Parser: no clock synchronization mechanism found." +
158
160
  " Using the system clock instead.");
159
- var lastPosition = now - contextInfos.availabilityStartTime;
161
+ var lastPosition = now - context.availabilityStartTime;
160
162
  var positionTime = performance.now() / 1000;
161
163
  return [lastPosition, positionTime];
162
164
  }
@@ -17,21 +17,37 @@ import { IRepresentationIndex, Representation } from "../../../../manifest";
17
17
  import { IAdaptationSetIntermediateRepresentation, IRepresentationIntermediateRepresentation, ISegmentTemplateIntermediateRepresentation, IScheme } from "../node_parser_types";
18
18
  import ManifestBoundsCalculator from "./manifest_bounds_calculator";
19
19
  import { IResolvedBaseUrl } from "./resolve_base_urls";
20
+ /**
21
+ * Parse the specific segment indexing information found in a representation
22
+ * into a IRepresentationIndex implementation.
23
+ * @param {Array.<Object>} representation
24
+ * @param {Object} context
25
+ * @returns {Array.<Object>}
26
+ */
27
+ export default function parseRepresentationIndex(representation: IRepresentationIntermediateRepresentation, context: IRepresentationIndexContext): IRepresentationIndex;
20
28
  /** Supplementary context needed to parse a RepresentationIndex. */
21
- export interface IRepresentationInfos {
29
+ export interface IRepresentationIndexContext {
22
30
  /** Parsed AdaptationSet which contains the Representation. */
23
31
  adaptation: IAdaptationSetIntermediateRepresentation;
24
32
  /** Whether we should request new segments even if they are not yet finished. */
25
33
  aggressiveMode: boolean;
34
+ /** If false, declared segments in the MPD might still be not completely generated. */
26
35
  availabilityTimeComplete: boolean;
27
36
  /** availability time offset of the concerned Adaptation. */
28
37
  availabilityTimeOffset: number;
29
38
  /** Eventual URLs from which every relative URL will be based on. */
30
39
  baseURLs: IResolvedBaseUrl[];
40
+ /** End time of the current Period, in seconds. */
41
+ end?: number | undefined;
42
+ /** List of inband event streams that are present on the representation */
43
+ inbandEventStreams: IScheme[] | undefined;
44
+ /**
45
+ * Set to `true` if the linked Period is the chronologically last one in the
46
+ * Manifest.
47
+ */
48
+ isLastPeriod: boolean;
31
49
  /** Allows to obtain the first/last available position of a dynamic content. */
32
50
  manifestBoundsCalculator: ManifestBoundsCalculator;
33
- /** End time of the current period, in seconds. */
34
- end?: number;
35
51
  /** Whether the Manifest can evolve with time. */
36
52
  isDynamic: boolean;
37
53
  /**
@@ -44,11 +60,11 @@ export interface IRepresentationInfos {
44
60
  * Time (in terms of `performance.now`) at which the XML file containing this
45
61
  * Representation was received.
46
62
  */
47
- receivedTime?: number;
63
+ receivedTime?: number | undefined;
48
64
  /** Start time of the current period, in seconds. */
49
65
  start: number;
50
66
  /** Depth of the buffer for the whole content, in seconds. */
51
- timeShiftBufferDepth?: number;
67
+ timeShiftBufferDepth?: number | undefined;
52
68
  /**
53
69
  * The parser should take this Representation - which is the same as this one
54
70
  * parsed at an earlier time - as a base to speed-up the parsing process.
@@ -56,14 +72,4 @@ export interface IRepresentationInfos {
56
72
  * de-synchronization with what is actually on the server.
57
73
  */
58
74
  unsafelyBaseOnPreviousRepresentation: Representation | null;
59
- /** List of inband event streams that are present on the representation */
60
- inbandEventStreams: IScheme[] | undefined;
61
75
  }
62
- /**
63
- * Parse the specific segment indexing information found in a representation
64
- * into a IRepresentationIndex implementation.
65
- * @param {Array.<Object>} representation
66
- * @param {Object} representationInfos
67
- * @returns {Array.<Object>}
68
- */
69
- export default function parseRepresentationIndex(representation: IRepresentationIntermediateRepresentation, representationInfos: IRepresentationInfos): IRepresentationIndex;
@@ -29,13 +29,13 @@ import resolveBaseURLs from "./resolve_base_urls";
29
29
  * Parse the specific segment indexing information found in a representation
30
30
  * into a IRepresentationIndex implementation.
31
31
  * @param {Array.<Object>} representation
32
- * @param {Object} representationInfos
32
+ * @param {Object} context
33
33
  * @returns {Array.<Object>}
34
34
  */
35
- export default function parseRepresentationIndex(representation, representationInfos) {
35
+ export default function parseRepresentationIndex(representation, context) {
36
36
  var _a, _b;
37
- var representationBaseURLs = resolveBaseURLs(representationInfos.baseURLs, representation.children.baseURLs);
38
- var aggressiveMode = representationInfos.aggressiveMode, availabilityTimeOffset = representationInfos.availabilityTimeOffset, manifestBoundsCalculator = representationInfos.manifestBoundsCalculator, isDynamic = representationInfos.isDynamic, periodEnd = representationInfos.end, periodStart = representationInfos.start, receivedTime = representationInfos.receivedTime, timeShiftBufferDepth = representationInfos.timeShiftBufferDepth, unsafelyBaseOnPreviousRepresentation = representationInfos.unsafelyBaseOnPreviousRepresentation, inbandEventStreams = representationInfos.inbandEventStreams;
37
+ var representationBaseURLs = resolveBaseURLs(context.baseURLs, representation.children.baseURLs);
38
+ var aggressiveMode = context.aggressiveMode, availabilityTimeOffset = context.availabilityTimeOffset, manifestBoundsCalculator = context.manifestBoundsCalculator, isDynamic = context.isDynamic, periodEnd = context.end, periodStart = context.start, receivedTime = context.receivedTime, timeShiftBufferDepth = context.timeShiftBufferDepth, unsafelyBaseOnPreviousRepresentation = context.unsafelyBaseOnPreviousRepresentation, inbandEventStreams = context.inbandEventStreams, isLastPeriod = context.isLastPeriod;
39
39
  var isEMSGWhitelisted = function (inbandEvent) {
40
40
  if (inbandEventStreams === undefined) {
41
41
  return false;
@@ -46,44 +46,44 @@ export default function parseRepresentationIndex(representation, representationI
46
46
  return schemeIdUri === inbandEvent.schemeIdUri;
47
47
  });
48
48
  };
49
- var context = { aggressiveMode: aggressiveMode, availabilityTimeComplete: true, availabilityTimeOffset: availabilityTimeOffset, unsafelyBaseOnPreviousRepresentation: unsafelyBaseOnPreviousRepresentation, isEMSGWhitelisted: isEMSGWhitelisted, manifestBoundsCalculator: manifestBoundsCalculator, isDynamic: isDynamic, periodEnd: periodEnd, periodStart: periodStart, receivedTime: receivedTime, representationBaseURLs: representationBaseURLs, representationBitrate: representation.attributes.bitrate,
49
+ var reprIndexCtxt = { aggressiveMode: aggressiveMode, availabilityTimeComplete: true, availabilityTimeOffset: availabilityTimeOffset, unsafelyBaseOnPreviousRepresentation: unsafelyBaseOnPreviousRepresentation, isEMSGWhitelisted: isEMSGWhitelisted, isLastPeriod: isLastPeriod, manifestBoundsCalculator: manifestBoundsCalculator, isDynamic: isDynamic, periodEnd: periodEnd, periodStart: periodStart, receivedTime: receivedTime, representationBaseURLs: representationBaseURLs, representationBitrate: representation.attributes.bitrate,
50
50
  representationId: representation.attributes.id, timeShiftBufferDepth: timeShiftBufferDepth };
51
51
  var representationIndex;
52
52
  if (representation.children.segmentBase !== undefined) {
53
53
  var segmentBase = representation.children.segmentBase;
54
- representationIndex = new BaseRepresentationIndex(segmentBase, context);
54
+ representationIndex = new BaseRepresentationIndex(segmentBase, reprIndexCtxt);
55
55
  }
56
56
  else if (representation.children.segmentList !== undefined) {
57
57
  var segmentList = representation.children.segmentList;
58
- representationIndex = new ListRepresentationIndex(segmentList, context);
58
+ representationIndex = new ListRepresentationIndex(segmentList, reprIndexCtxt);
59
59
  }
60
60
  else if (representation.children.segmentTemplate !== undefined ||
61
- representationInfos.parentSegmentTemplates.length > 0) {
62
- var segmentTemplates = representationInfos.parentSegmentTemplates.slice();
61
+ context.parentSegmentTemplates.length > 0) {
62
+ var segmentTemplates = context.parentSegmentTemplates.slice();
63
63
  var childSegmentTemplate = representation.children.segmentTemplate;
64
64
  if (childSegmentTemplate !== undefined) {
65
65
  segmentTemplates.push(childSegmentTemplate);
66
66
  }
67
67
  var segmentTemplate = objectAssign.apply(void 0, __spreadArray([{}], segmentTemplates /* Ugly TS Hack */, false));
68
- context.availabilityTimeComplete =
69
- (_a = segmentTemplate.availabilityTimeComplete) !== null && _a !== void 0 ? _a : representationInfos.availabilityTimeComplete;
70
- context.availabilityTimeOffset =
68
+ reprIndexCtxt.availabilityTimeComplete =
69
+ (_a = segmentTemplate.availabilityTimeComplete) !== null && _a !== void 0 ? _a : context.availabilityTimeComplete;
70
+ reprIndexCtxt.availabilityTimeOffset =
71
71
  ((_b = segmentTemplate.availabilityTimeOffset) !== null && _b !== void 0 ? _b : 0) +
72
- representationInfos.availabilityTimeOffset;
72
+ context.availabilityTimeOffset;
73
73
  representationIndex = TimelineRepresentationIndex
74
74
  .isTimelineIndexArgument(segmentTemplate) ?
75
- new TimelineRepresentationIndex(segmentTemplate, context) :
76
- new TemplateRepresentationIndex(segmentTemplate, context);
75
+ new TimelineRepresentationIndex(segmentTemplate, reprIndexCtxt) :
76
+ new TemplateRepresentationIndex(segmentTemplate, reprIndexCtxt);
77
77
  }
78
78
  else {
79
- var adaptationChildren = representationInfos.adaptation.children;
79
+ var adaptationChildren = context.adaptation.children;
80
80
  if (adaptationChildren.segmentBase !== undefined) {
81
81
  var segmentBase = adaptationChildren.segmentBase;
82
- representationIndex = new BaseRepresentationIndex(segmentBase, context);
82
+ representationIndex = new BaseRepresentationIndex(segmentBase, reprIndexCtxt);
83
83
  }
84
84
  else if (adaptationChildren.segmentList !== undefined) {
85
85
  var segmentList = adaptationChildren.segmentList;
86
- representationIndex = new ListRepresentationIndex(segmentList, context);
86
+ representationIndex = new ListRepresentationIndex(segmentList, reprIndexCtxt);
87
87
  }
88
88
  else {
89
89
  representationIndex = new TemplateRepresentationIndex({
@@ -91,7 +91,7 @@ export default function parseRepresentationIndex(representation, representationI
91
91
  timescale: 1,
92
92
  startNumber: 0,
93
93
  media: "",
94
- }, context);
94
+ }, reprIndexCtxt);
95
95
  }
96
96
  }
97
97
  return representationIndex;
@@ -15,41 +15,19 @@
15
15
  */
16
16
  import { Adaptation } from "../../../../manifest";
17
17
  import { IParsedRepresentation } from "../../types";
18
- import { IAdaptationSetIntermediateRepresentation, IRepresentationIntermediateRepresentation, ISegmentTemplateIntermediateRepresentation } from "../node_parser_types";
19
- import ManifestBoundsCalculator from "./manifest_bounds_calculator";
20
- import { IResolvedBaseUrl } from "./resolve_base_urls";
18
+ import { IAdaptationSetIntermediateRepresentation, IRepresentationIntermediateRepresentation } from "../node_parser_types";
19
+ import { IRepresentationIndexContext } from "./parse_representation_index";
20
+ /**
21
+ * Process intermediate representations to create final parsed representations.
22
+ * @param {Array.<Object>} representationsIR
23
+ * @param {Object} context
24
+ * @returns {Array.<Object>}
25
+ */
26
+ export default function parseRepresentations(representationsIR: IRepresentationIntermediateRepresentation[], adaptation: IAdaptationSetIntermediateRepresentation, context: IRepresentationContext): IParsedRepresentation[];
21
27
  /** Supplementary context needed to parse a Representation. */
22
- export interface IAdaptationInfos {
23
- /** Whether we should request new segments even if they are not yet finished. */
24
- aggressiveMode: boolean;
25
- availabilityTimeComplete: boolean;
26
- /** availability time offset of the concerned Adaptation. */
27
- availabilityTimeOffset: number;
28
- /** Eventual URLs from which every relative URL will be based on. */
29
- baseURLs: IResolvedBaseUrl[];
30
- /** Allows to obtain the first/last available position of a dynamic content. */
31
- manifestBoundsCalculator: ManifestBoundsCalculator;
32
- /** End time of the current period, in seconds. */
33
- end?: number;
34
- /** Whether the Manifest can evolve with time. */
35
- isDynamic: boolean;
28
+ export interface IRepresentationContext extends IInheritedRepresentationIndexContext {
36
29
  /** Manifest DASH profiles used for signalling some features */
37
- manifestProfiles?: string;
38
- /**
39
- * Parent parsed SegmentTemplate elements.
40
- * Sorted by provenance from higher level (e.g. Period) to lower-lever (e.g.
41
- * AdaptationSet).
42
- */
43
- parentSegmentTemplates: ISegmentTemplateIntermediateRepresentation[];
44
- /**
45
- * Time (in terms of `performance.now`) at which the XML file containing this
46
- * Representation was received.
47
- */
48
- receivedTime?: number;
49
- /** Start time of the current period, in seconds. */
50
- start: number;
51
- /** Depth of the buffer for the whole content, in seconds. */
52
- timeShiftBufferDepth?: number;
30
+ manifestProfiles?: string | undefined;
53
31
  /**
54
32
  * The parser should take this Adaptation - which is from a previously parsed
55
33
  * Manifest for the same dynamic content - as a base to speed-up the parsing
@@ -61,9 +39,8 @@ export interface IAdaptationInfos {
61
39
  unsafelyBaseOnPreviousAdaptation: Adaptation | null;
62
40
  }
63
41
  /**
64
- * Process intermediate representations to create final parsed representations.
65
- * @param {Array.<Object>} representationsIR
66
- * @param {Object} adaptationInfos
67
- * @returns {Array.<Object>}
42
+ * Supplementary context needed to parse a Representation common with
43
+ * `IRepresentationIndexContext`.
68
44
  */
69
- export default function parseRepresentations(representationsIR: IRepresentationIntermediateRepresentation[], adaptation: IAdaptationSetIntermediateRepresentation, adaptationInfos: IAdaptationInfos): IParsedRepresentation[];
45
+ declare type IInheritedRepresentationIndexContext = Omit<IRepresentationIndexContext, "adaptation" | "unsafelyBaseOnPreviousRepresentation" | "inbandEventStreams">;
46
+ export {};
@@ -64,10 +64,10 @@ function getHDRInformation(_a) {
64
64
  /**
65
65
  * Process intermediate representations to create final parsed representations.
66
66
  * @param {Array.<Object>} representationsIR
67
- * @param {Object} adaptationInfos
67
+ * @param {Object} context
68
68
  * @returns {Array.<Object>}
69
69
  */
70
- export default function parseRepresentations(representationsIR, adaptation, adaptationInfos) {
70
+ export default function parseRepresentations(representationsIR, adaptation, context) {
71
71
  var _a, _b, _c, _d;
72
72
  var parsedRepresentations = [];
73
73
  var _loop_1 = function (representation) {
@@ -92,14 +92,14 @@ export default function parseRepresentations(representationsIR, adaptation, adap
92
92
  representationID += "-dup";
93
93
  }
94
94
  // Retrieve previous version of the Representation, if one.
95
- var unsafelyBaseOnPreviousRepresentation = (_b = (_a = adaptationInfos
95
+ var unsafelyBaseOnPreviousRepresentation = (_b = (_a = context
96
96
  .unsafelyBaseOnPreviousAdaptation) === null || _a === void 0 ? void 0 : _a.getRepresentation(representationID)) !== null && _b !== void 0 ? _b : null;
97
97
  var inbandEventStreams = combineInbandEventStreams(representation, adaptation);
98
- var availabilityTimeComplete = (_c = representation.attributes.availabilityTimeComplete) !== null && _c !== void 0 ? _c : adaptationInfos.availabilityTimeComplete;
98
+ var availabilityTimeComplete = (_c = representation.attributes.availabilityTimeComplete) !== null && _c !== void 0 ? _c : context.availabilityTimeComplete;
99
99
  var availabilityTimeOffset = ((_d = representation.attributes.availabilityTimeOffset) !== null && _d !== void 0 ? _d : 0) +
100
- adaptationInfos.availabilityTimeOffset;
101
- var representationInfos = objectAssign({}, adaptationInfos, { availabilityTimeOffset: availabilityTimeOffset, availabilityTimeComplete: availabilityTimeComplete, unsafelyBaseOnPreviousRepresentation: unsafelyBaseOnPreviousRepresentation, adaptation: adaptation, inbandEventStreams: inbandEventStreams });
102
- var representationIndex = parseRepresentationIndex(representation, representationInfos);
100
+ context.availabilityTimeOffset;
101
+ var reprIndexCtxt = objectAssign({}, context, { availabilityTimeOffset: availabilityTimeOffset, availabilityTimeComplete: availabilityTimeComplete, unsafelyBaseOnPreviousRepresentation: unsafelyBaseOnPreviousRepresentation, adaptation: adaptation, inbandEventStreams: inbandEventStreams });
102
+ var representationIndex = parseRepresentationIndex(representation, reprIndexCtxt);
103
103
  // Find bitrate
104
104
  var representationBitrate = void 0;
105
105
  if (representation.attributes.bitrate == null) {
@@ -203,7 +203,7 @@ export default function parseRepresentations(representationsIR, adaptation, adap
203
203
  }
204
204
  parsedRepresentation.hdrInfo =
205
205
  getHDRInformation({ adaptationProfiles: adaptation.attributes.profiles,
206
- manifestProfiles: adaptationInfos.manifestProfiles, codecs: codecs });
206
+ manifestProfiles: context.manifestProfiles, codecs: codecs });
207
207
  parsedRepresentations.push(parsedRepresentation);
208
208
  };
209
209
  for (var _i = 0, representationsIR_1 = representationsIR; _i < representationsIR_1.length; _i++) {
@@ -125,7 +125,7 @@ export interface IPeriodChildren {
125
125
  /**
126
126
  * Provide a template with which we will be able to request segments.
127
127
  */
128
- segmentTemplate?: ISegmentTemplateIntermediateRepresentation;
128
+ segmentTemplate?: ISegmentTemplateIntermediateRepresentation | undefined;
129
129
  /**
130
130
  * Allows to signal events linked to this Period.
131
131
  *
@@ -177,16 +177,16 @@ export interface IAdaptationSetIntermediateRepresentation {
177
177
  export interface IAdaptationSetChildren {
178
178
  baseURLs: IBaseUrlIntermediateRepresentation[];
179
179
  representations: IRepresentationIntermediateRepresentation[];
180
- accessibilities?: IScheme[];
181
- contentComponent?: IContentComponentAttributes;
182
- contentProtections?: IContentProtectionIntermediateRepresentation[];
183
- essentialProperties?: IScheme[];
184
- inbandEventStreams?: IScheme[];
180
+ accessibilities?: IScheme[] | undefined;
181
+ contentComponent?: IContentComponentAttributes | undefined;
182
+ contentProtections?: IContentProtectionIntermediateRepresentation[] | undefined;
183
+ essentialProperties?: IScheme[] | undefined;
184
+ inbandEventStreams?: IScheme[] | undefined;
185
185
  roles?: IScheme[];
186
- supplementalProperties?: IScheme[];
187
- segmentBase?: ISegmentBaseIntermediateRepresentation;
188
- segmentList?: ISegmentListIntermediateRepresentation;
189
- segmentTemplate?: ISegmentTemplateIntermediateRepresentation;
186
+ supplementalProperties?: IScheme[] | undefined;
187
+ segmentBase?: ISegmentBaseIntermediateRepresentation | undefined;
188
+ segmentList?: ISegmentListIntermediateRepresentation | undefined;
189
+ segmentTemplate?: ISegmentTemplateIntermediateRepresentation | undefined;
190
190
  }
191
191
  export interface IAdaptationSetAttributes {
192
192
  audioSamplingRate?: string;
@@ -305,22 +305,22 @@ export interface IContentProtectionAttributes {
305
305
  keyId?: Uint8Array;
306
306
  }
307
307
  export interface ISegmentTemplateIntermediateRepresentation {
308
- availabilityTimeComplete?: boolean;
309
- availabilityTimeOffset?: number;
310
- bitstreamSwitching?: boolean;
311
- duration?: number;
312
- index?: string;
313
- indexRange?: [number, number];
314
- indexRangeExact?: boolean;
315
- media?: string;
316
- presentationTimeOffset?: number;
317
- startNumber?: number;
318
- timescale?: number;
308
+ availabilityTimeComplete?: boolean | undefined;
309
+ availabilityTimeOffset?: number | undefined;
310
+ bitstreamSwitching?: boolean | undefined;
311
+ duration?: number | undefined;
312
+ index?: string | undefined;
313
+ indexRange?: [number, number] | undefined;
314
+ indexRangeExact?: boolean | undefined;
315
+ media?: string | undefined;
316
+ presentationTimeOffset?: number | undefined;
317
+ startNumber?: number | undefined;
318
+ timescale?: number | undefined;
319
319
  initialization?: {
320
320
  media?: string;
321
- };
322
- timeline?: ISegmentTimelineElement[];
323
- timelineParser?: ITimelineParser;
321
+ } | undefined;
322
+ timeline?: ISegmentTimelineElement[] | undefined;
323
+ timelineParser?: ITimelineParser | undefined;
324
324
  }
325
325
  export interface ISegmentTimelineElement {
326
326
  start: number;
@@ -349,9 +349,9 @@ export interface IScheme {
349
349
  *
350
350
  * `undefined` if no `schemeIdUri` attribute has been found.
351
351
  */
352
- schemeIdUri?: string;
352
+ schemeIdUri?: string | undefined;
353
353
  /** Inner content of that scheme. */
354
- value?: string;
354
+ value?: string | undefined;
355
355
  }
356
356
  export interface IEventStreamIntermediateRepresentation {
357
357
  /** Contains data about the element's children. */
@@ -360,9 +360,9 @@ export interface IEventStreamIntermediateRepresentation {
360
360
  attributes: IEventStreamAttributes;
361
361
  }
362
362
  export interface IEventStreamAttributes {
363
- schemeIdUri?: string;
364
- timescale?: number;
365
- value?: string;
363
+ schemeIdUri?: string | undefined;
364
+ timescale?: number | undefined;
365
+ value?: string | undefined;
366
366
  /**
367
367
  * XML namespaces linked to the `<EventStream>` element.
368
368
  *
@@ -373,7 +373,7 @@ export interface IEventStreamAttributes {
373
373
  namespaces?: Array<{
374
374
  key: string;
375
375
  value: string;
376
- }>;
376
+ }> | undefined;
377
377
  }
378
378
  export interface IEventStreamChildren {
379
379
  events: IEventStreamEventIntermediateRepresentation[];
@@ -63,19 +63,19 @@ export interface ILoadedResource<T extends string | ArrayBuffer> {
63
63
  * The URL of the loaded resource (post-redirection if one).
64
64
  * `undefined` if unknown or inexistant.
65
65
  */
66
- url?: string;
66
+ url?: string | undefined;
67
67
  /**
68
68
  * The time, in terms of `performance.now()`, at which the resource was
69
69
  * starting to be fetched.
70
70
  * `undefined` if unknown or not applicable.
71
71
  */
72
- sendingTime?: number;
72
+ sendingTime?: number | undefined;
73
73
  /**
74
74
  * The time, in terms of `performance.now()`, at which the resource was
75
75
  * fully-fetched.
76
76
  * `undefined` if unknown or not applicable.
77
77
  */
78
- receivedTime?: number;
78
+ receivedTime?: number | undefined;
79
79
  /** The loaded resource itself, under the right format.
80
80
  * Or an error, when fetching ressources.
81
81
  */
@@ -49,10 +49,10 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
49
49
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
50
50
  }
51
51
  };
52
- import PPromise from "pinkie";
53
52
  import log from "../../../../../log";
54
53
  import assertUnreachable from "../../../../../utils/assert_unreachable";
55
54
  import noop from "../../../../../utils/noop";
55
+ import PPromise from "../../../../../utils/promise";
56
56
  import parseMpdIr from "../../common";
57
57
  import { generateRootChildrenParser } from "./generators";
58
58
  import { generateXLinkChildrenParser } from "./generators/XLink";
@@ -56,9 +56,9 @@ export interface IMetaPlaylist {
56
56
  * @returns {Object}
57
57
  */
58
58
  export default function parseMetaPlaylist(data: unknown, parserOptions: {
59
- url?: string;
59
+ url?: string | undefined;
60
60
  serverSyncInfos?: {
61
61
  serverTimestamp: number;
62
62
  clientTime: number;
63
- };
63
+ } | undefined;
64
64
  }): IParserResponse<IParsedManifest>;
@@ -16,19 +16,19 @@
16
16
  import { IParsedManifest } from "../types";
17
17
  import { IKeySystem } from "./parse_protection_node";
18
18
  export interface IHSSParserConfiguration {
19
- aggressiveMode?: boolean;
20
- suggestedPresentationDelay?: number;
21
- referenceDateTime?: number;
22
- minRepresentationBitrate?: number;
23
- keySystems?: (hex?: Uint8Array) => IKeySystem[];
19
+ aggressiveMode?: boolean | undefined;
20
+ suggestedPresentationDelay?: number | undefined;
21
+ referenceDateTime?: number | undefined;
22
+ minRepresentationBitrate?: number | undefined;
23
+ keySystems?: ((hex: Uint8Array | undefined) => IKeySystem[]) | undefined;
24
24
  serverSyncInfos?: {
25
25
  serverTimestamp: number;
26
26
  clientTime: number;
27
- };
27
+ } | undefined;
28
28
  }
29
29
  /**
30
30
  * @param {Object|undefined} parserOptions
31
31
  * @returns {Function}
32
32
  */
33
- declare function createSmoothStreamingParser(parserOptions?: IHSSParserConfiguration): (manifest: Document, url?: string, manifestReceivedTime?: number) => IParsedManifest;
33
+ declare function createSmoothStreamingParser(parserOptions?: IHSSParserConfiguration): (manifest: Document, url?: string | undefined, manifestReceivedTime?: number | undefined) => IParsedManifest;
34
34
  export default createSmoothStreamingParser;