rx-player 4.0.0-dev.2023110700 → 4.0.0-dev.2023120600

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 (479) hide show
  1. package/CHANGELOG.md +18 -226
  2. package/FILES.md +1 -1
  3. package/VERSION +1 -1
  4. package/dist/_esm5.processed/compat/add_text_track.d.ts +1 -3
  5. package/dist/_esm5.processed/compat/add_text_track.js +4 -7
  6. package/dist/_esm5.processed/compat/browser_compatibility_types.d.ts +0 -7
  7. package/dist/_esm5.processed/compat/event_listeners.d.ts +2 -15
  8. package/dist/_esm5.processed/compat/event_listeners.js +2 -37
  9. package/dist/_esm5.processed/compat/index.d.ts +1 -3
  10. package/dist/_esm5.processed/compat/index.js +1 -3
  11. package/dist/_esm5.processed/config.d.ts +9 -21
  12. package/dist/_esm5.processed/core/adaptive/adaptive_representation_selector.d.ts +0 -58
  13. package/dist/_esm5.processed/core/adaptive/adaptive_representation_selector.js +14 -54
  14. package/dist/_esm5.processed/core/adaptive/utils/select_optimal_representation.d.ts +2 -8
  15. package/dist/_esm5.processed/core/adaptive/utils/select_optimal_representation.js +2 -11
  16. package/dist/_esm5.processed/core/api/debug/buffer_graph.js +2 -6
  17. package/dist/_esm5.processed/core/api/debug/modules/general_info.js +13 -32
  18. package/dist/_esm5.processed/core/api/debug/modules/segment_buffer_content.js +3 -3
  19. package/dist/_esm5.processed/core/api/debug/modules/segment_buffer_size.js +1 -1
  20. package/dist/_esm5.processed/core/api/option_utils.d.ts +14 -35
  21. package/dist/_esm5.processed/core/api/option_utils.js +47 -230
  22. package/dist/_esm5.processed/core/api/public_api.d.ts +92 -266
  23. package/dist/_esm5.processed/core/api/public_api.js +451 -807
  24. package/dist/_esm5.processed/core/{segment_buffers/implementations/image → api/track_management}/index.d.ts +3 -2
  25. package/dist/_esm5.processed/core/{segment_buffers/implementations/image → api/track_management}/index.js +3 -2
  26. package/dist/_esm5.processed/core/api/{tracks_management/media_element_track_choice_manager.d.ts → track_management/media_element_tracks_store.d.ts} +15 -75
  27. package/dist/_esm5.processed/core/api/{tracks_management/media_element_track_choice_manager.js → track_management/media_element_tracks_store.js} +74 -193
  28. package/dist/_esm5.processed/core/api/track_management/track_dispatcher.d.ts +84 -0
  29. package/dist/_esm5.processed/core/api/track_management/track_dispatcher.js +158 -0
  30. package/dist/_esm5.processed/core/api/track_management/tracks_store.d.ts +406 -0
  31. package/dist/_esm5.processed/core/api/track_management/tracks_store.js +932 -0
  32. package/dist/_esm5.processed/core/api/utils.d.ts +1 -0
  33. package/dist/_esm5.processed/core/api/utils.js +28 -11
  34. package/dist/_esm5.processed/core/decrypt/content_decryptor.js +3 -3
  35. package/dist/_esm5.processed/core/decrypt/find_key_system.js +83 -71
  36. package/dist/_esm5.processed/core/decrypt/get_media_keys.js +6 -5
  37. package/dist/_esm5.processed/core/decrypt/session_events_listener.js +10 -72
  38. package/dist/_esm5.processed/core/decrypt/utils/persistent_sessions_store.d.ts +4 -4
  39. package/dist/_esm5.processed/core/decrypt/utils/persistent_sessions_store.js +6 -4
  40. package/dist/_esm5.processed/core/fetchers/manifest/manifest_fetcher.d.ts +1 -3
  41. package/dist/_esm5.processed/core/fetchers/manifest/manifest_fetcher.js +7 -26
  42. package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.d.ts +3 -9
  43. package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.js +16 -9
  44. package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher_creator.d.ts +1 -3
  45. package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher_creator.js +1 -1
  46. package/dist/_esm5.processed/core/fetchers/utils/schedule_request.d.ts +1 -6
  47. package/dist/_esm5.processed/core/fetchers/utils/schedule_request.js +4 -41
  48. package/dist/_esm5.processed/core/init/directfile_content_initializer.js +1 -1
  49. package/dist/_esm5.processed/core/init/media_source_content_initializer.d.ts +1 -8
  50. package/dist/_esm5.processed/core/init/media_source_content_initializer.js +5 -19
  51. package/dist/_esm5.processed/core/init/types.d.ts +5 -15
  52. package/dist/_esm5.processed/core/init/utils/rebuffering_controller.d.ts +2 -36
  53. package/dist/_esm5.processed/core/init/utils/rebuffering_controller.js +2 -82
  54. package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/text_track_cues_store.js +54 -6
  55. package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/utils.d.ts +2 -1
  56. package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/utils.js +19 -2
  57. package/dist/_esm5.processed/core/segment_buffers/implementations/text/native/native_text_segment_buffer.d.ts +1 -2
  58. package/dist/_esm5.processed/core/segment_buffers/implementations/text/native/native_text_segment_buffer.js +2 -3
  59. package/dist/_esm5.processed/core/segment_buffers/implementations/types.d.ts +2 -2
  60. package/dist/_esm5.processed/core/segment_buffers/index.d.ts +2 -2
  61. package/dist/_esm5.processed/core/segment_buffers/index.js +2 -1
  62. package/dist/_esm5.processed/core/segment_buffers/inventory/index.d.ts +1 -0
  63. package/dist/_esm5.processed/core/segment_buffers/inventory/index.js +1 -0
  64. package/dist/_esm5.processed/core/segment_buffers/inventory/utils.d.ts +33 -0
  65. package/dist/_esm5.processed/core/segment_buffers/inventory/utils.js +49 -0
  66. package/dist/_esm5.processed/core/segment_buffers/segment_buffers_store.d.ts +0 -1
  67. package/dist/_esm5.processed/core/segment_buffers/segment_buffers_store.js +2 -16
  68. package/dist/_esm5.processed/core/stream/adaptation/adaptation_stream.d.ts +0 -15
  69. package/dist/_esm5.processed/core/stream/adaptation/adaptation_stream.js +183 -93
  70. package/dist/_esm5.processed/core/stream/adaptation/get_representations_switch_strategy.d.ts +39 -0
  71. package/dist/_esm5.processed/core/stream/adaptation/get_representations_switch_strategy.js +133 -0
  72. package/dist/_esm5.processed/core/stream/adaptation/types.d.ts +27 -13
  73. package/dist/_esm5.processed/core/stream/index.d.ts +2 -3
  74. package/dist/_esm5.processed/core/stream/orchestrator/stream_orchestrator.d.ts +2 -0
  75. package/dist/_esm5.processed/core/stream/orchestrator/stream_orchestrator.js +5 -7
  76. package/dist/_esm5.processed/core/stream/period/period_stream.js +13 -12
  77. package/dist/_esm5.processed/core/stream/period/types.d.ts +5 -14
  78. package/dist/_esm5.processed/core/stream/period/utils/get_adaptation_switch_strategy.d.ts +2 -4
  79. package/dist/_esm5.processed/core/stream/period/utils/get_adaptation_switch_strategy.js +10 -46
  80. package/dist/_esm5.processed/core/stream/representation/representation_stream.js +29 -23
  81. package/dist/_esm5.processed/core/stream/representation/types.d.ts +11 -1
  82. package/dist/_esm5.processed/default_config.d.ts +35 -98
  83. package/dist/_esm5.processed/default_config.js +36 -113
  84. package/dist/_esm5.processed/errors/custom_loader_error.d.ts +1 -3
  85. package/dist/_esm5.processed/errors/custom_loader_error.js +1 -3
  86. package/dist/_esm5.processed/errors/media_error.js +2 -2
  87. package/dist/_esm5.processed/errors/network_error.d.ts +0 -1
  88. package/dist/_esm5.processed/errors/network_error.js +0 -1
  89. package/dist/_esm5.processed/errors/request_error.d.ts +2 -3
  90. package/dist/_esm5.processed/errors/request_error.js +2 -5
  91. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.js +3 -3
  92. package/dist/_esm5.processed/features/features_object.js +0 -2
  93. package/dist/_esm5.processed/features/list/directfile.js +2 -5
  94. package/dist/_esm5.processed/features/list/index.d.ts +0 -2
  95. package/dist/_esm5.processed/features/list/index.js +0 -2
  96. package/dist/_esm5.processed/features/types.d.ts +3 -27
  97. package/dist/_esm5.processed/manifest/adaptation.d.ts +9 -11
  98. package/dist/_esm5.processed/manifest/adaptation.js +41 -30
  99. package/dist/_esm5.processed/manifest/index.d.ts +3 -4
  100. package/dist/_esm5.processed/manifest/manifest.d.ts +5 -54
  101. package/dist/_esm5.processed/manifest/manifest.js +5 -110
  102. package/dist/_esm5.processed/manifest/period.d.ts +4 -5
  103. package/dist/_esm5.processed/manifest/representation.d.ts +10 -5
  104. package/dist/_esm5.processed/manifest/representation.js +33 -10
  105. package/dist/_esm5.processed/manifest/representation_index/index.d.ts +2 -2
  106. package/dist/_esm5.processed/manifest/representation_index/static.d.ts +2 -0
  107. package/dist/_esm5.processed/manifest/representation_index/static.js +6 -0
  108. package/dist/_esm5.processed/manifest/representation_index/types.d.ts +42 -21
  109. package/dist/_esm5.processed/manifest/types.d.ts +0 -2
  110. package/dist/_esm5.processed/parsers/manifest/dash/common/convert_supplemental_codecs.d.ts +17 -0
  111. package/dist/_esm5.processed/parsers/manifest/dash/common/convert_supplemental_codecs.js +26 -0
  112. package/dist/_esm5.processed/parsers/manifest/dash/common/flatten_overlapping_periods.js +5 -0
  113. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/base.d.ts +17 -31
  114. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/base.js +26 -19
  115. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/list.d.ts +2 -0
  116. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/list.js +7 -1
  117. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/template.d.ts +2 -6
  118. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/template.js +11 -8
  119. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.d.ts +2 -0
  120. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.js +6 -0
  121. package/dist/_esm5.processed/parsers/manifest/dash/common/infer_adaptation_type.d.ts +2 -2
  122. package/dist/_esm5.processed/parsers/manifest/dash/common/infer_adaptation_type.js +1 -6
  123. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_adaptation_sets.js +3 -5
  124. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_mpd.d.ts +0 -2
  125. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_mpd.js +1 -1
  126. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_periods.js +2 -2
  127. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representation_index.d.ts +0 -2
  128. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representation_index.js +2 -2
  129. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representations.js +29 -17
  130. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/AdaptationSet.js +13 -6
  131. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/Representation.js +7 -2
  132. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/utils.d.ts +10 -1
  133. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/utils.js +18 -2
  134. package/dist/_esm5.processed/parsers/manifest/dash/node_parser_types.d.ts +6 -4
  135. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/AdaptationSet.js +7 -6
  136. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/Representation.js +5 -2
  137. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/types.d.ts +2 -1
  138. package/dist/_esm5.processed/parsers/manifest/local/representation_index.d.ts +2 -0
  139. package/dist/_esm5.processed/parsers/manifest/local/representation_index.js +6 -0
  140. package/dist/_esm5.processed/parsers/manifest/metaplaylist/metaplaylist_parser.js +6 -6
  141. package/dist/_esm5.processed/parsers/manifest/metaplaylist/representation_index.d.ts +12 -3
  142. package/dist/_esm5.processed/parsers/manifest/metaplaylist/representation_index.js +11 -2
  143. package/dist/_esm5.processed/parsers/manifest/smooth/create_parser.d.ts +0 -1
  144. package/dist/_esm5.processed/parsers/manifest/smooth/create_parser.js +11 -17
  145. package/dist/_esm5.processed/parsers/manifest/smooth/representation_index.d.ts +21 -83
  146. package/dist/_esm5.processed/parsers/manifest/smooth/representation_index.js +53 -125
  147. package/dist/_esm5.processed/parsers/manifest/smooth/shared_smooth_segment_timeline.d.ts +119 -0
  148. package/dist/_esm5.processed/parsers/manifest/smooth/shared_smooth_segment_timeline.js +159 -0
  149. package/dist/_esm5.processed/parsers/manifest/smooth/utils/add_segment_infos.d.ts +3 -6
  150. package/dist/_esm5.processed/parsers/manifest/smooth/utils/add_segment_infos.js +4 -4
  151. package/dist/_esm5.processed/parsers/manifest/types.d.ts +4 -3
  152. package/dist/_esm5.processed/parsers/texttracks/ttml/html/apply_extent.js +1 -8
  153. package/dist/_esm5.processed/parsers/texttracks/ttml/html/apply_origin.js +1 -9
  154. package/dist/_esm5.processed/public_types.d.ts +396 -308
  155. package/dist/_esm5.processed/tools/TextTrackRenderer/text_track_renderer.d.ts +5 -4
  156. package/dist/_esm5.processed/tools/TextTrackRenderer/text_track_renderer.js +5 -4
  157. package/dist/_esm5.processed/transports/dash/add_segment_integrity_checks_to_loader.js +4 -4
  158. package/dist/_esm5.processed/transports/dash/manifest_parser.js +2 -3
  159. package/dist/_esm5.processed/transports/dash/pipelines.js +1 -4
  160. package/dist/_esm5.processed/transports/dash/segment_loader.d.ts +2 -2
  161. package/dist/_esm5.processed/transports/dash/segment_loader.js +26 -20
  162. package/dist/_esm5.processed/transports/dash/segment_parser.js +19 -24
  163. package/dist/_esm5.processed/transports/dash/text_loader.js +5 -5
  164. package/dist/_esm5.processed/transports/dash/text_parser.js +28 -33
  165. package/dist/_esm5.processed/transports/local/pipelines.js +1 -10
  166. package/dist/_esm5.processed/transports/local/segment_loader.js +2 -2
  167. package/dist/_esm5.processed/transports/local/segment_parser.d.ts +1 -1
  168. package/dist/_esm5.processed/transports/local/segment_parser.js +10 -10
  169. package/dist/_esm5.processed/transports/local/text_parser.d.ts +2 -2
  170. package/dist/_esm5.processed/transports/local/text_parser.js +23 -23
  171. package/dist/_esm5.processed/transports/metaplaylist/pipelines.js +34 -52
  172. package/dist/_esm5.processed/{utils/list_to_map.d.ts → transports/smooth/is_mp4_embedded_track.d.ts} +5 -5
  173. package/dist/_esm5.processed/{features/list/image_buffer.d.ts → transports/smooth/is_mp4_embedded_track.js} +7 -6
  174. package/dist/_esm5.processed/transports/smooth/pipelines.js +33 -190
  175. package/dist/_esm5.processed/transports/smooth/segment_loader.d.ts +1 -1
  176. package/dist/_esm5.processed/transports/smooth/segment_loader.js +28 -22
  177. package/dist/_esm5.processed/transports/smooth/utils.d.ts +1 -26
  178. package/dist/_esm5.processed/transports/smooth/utils.js +1 -55
  179. package/dist/_esm5.processed/transports/types.d.ts +94 -89
  180. package/dist/_esm5.processed/transports/utils/call_custom_manifest_loader.js +3 -3
  181. package/dist/_esm5.processed/transports/utils/infer_segment_container.d.ts +3 -3
  182. package/dist/_esm5.processed/transports/utils/infer_segment_container.js +5 -7
  183. package/dist/_esm5.processed/transports/utils/parse_text_track.d.ts +8 -12
  184. package/dist/_esm5.processed/transports/utils/parse_text_track.js +19 -21
  185. package/dist/_esm5.processed/utils/array_includes.d.ts +2 -1
  186. package/dist/_esm5.processed/utils/array_includes.js +30 -28
  187. package/dist/_esm5.processed/utils/request/xhr.js +5 -5
  188. package/dist/commonjs/compat/is_codec_supported.js +22 -1
  189. package/dist/commonjs/compat/patch_webkit_source_buffer.js +2 -2
  190. package/dist/commonjs/config.d.ts +1 -0
  191. package/dist/commonjs/core/api/debug/buffer_graph.js +2 -6
  192. package/dist/commonjs/core/api/debug/modules/general_info.js +17 -10
  193. package/dist/commonjs/core/api/option_utils.d.ts +4 -0
  194. package/dist/commonjs/core/api/option_utils.js +8 -3
  195. package/dist/commonjs/core/api/public_api.d.ts +11 -1
  196. package/dist/commonjs/core/api/public_api.js +46 -11
  197. package/dist/commonjs/core/fetchers/manifest/manifest_fetcher.d.ts +6 -0
  198. package/dist/commonjs/core/fetchers/manifest/manifest_fetcher.js +11 -3
  199. package/dist/commonjs/core/fetchers/segment/segment_fetcher.d.ts +8 -1
  200. package/dist/commonjs/core/fetchers/segment/segment_fetcher.js +8 -4
  201. package/dist/commonjs/core/fetchers/segment/segment_fetcher_creator.d.ts +1 -0
  202. package/dist/commonjs/core/fetchers/utils/schedule_request.js +1 -1
  203. package/dist/commonjs/core/init/directfile_content_initializer.js +24 -7
  204. package/dist/commonjs/core/init/media_source_content_initializer.d.ts +6 -0
  205. package/dist/commonjs/core/init/media_source_content_initializer.js +4 -6
  206. package/dist/commonjs/core/init/utils/content_time_boundaries_observer.d.ts +13 -12
  207. package/dist/commonjs/core/init/utils/content_time_boundaries_observer.js +16 -17
  208. package/dist/commonjs/core/init/utils/get_initial_time.d.ts +17 -3
  209. package/dist/commonjs/core/init/utils/get_initial_time.js +9 -7
  210. package/dist/commonjs/core/segment_buffers/implementations/text/html/text_track_cues_store.js +54 -6
  211. package/dist/commonjs/core/segment_buffers/implementations/text/html/utils.d.ts +2 -1
  212. package/dist/commonjs/core/segment_buffers/implementations/text/html/utils.js +19 -2
  213. package/dist/commonjs/core/stream/adaptation/adaptation_stream.js +2 -2
  214. package/dist/commonjs/core/stream/orchestrator/stream_orchestrator.js +3 -3
  215. package/dist/commonjs/core/stream/period/period_stream.js +2 -2
  216. package/dist/commonjs/core/stream/representation/utils/get_buffer_status.js +3 -3
  217. package/dist/commonjs/core/stream/representation/utils/get_needed_segments.js +1 -1
  218. package/dist/commonjs/default_config.d.ts +5 -0
  219. package/dist/commonjs/default_config.js +5 -0
  220. package/dist/commonjs/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.js +3 -1
  221. package/dist/commonjs/experimental/tools/createMetaplaylist/get_duration_from_manifest.js +2 -0
  222. package/dist/commonjs/manifest/representation.js +18 -5
  223. package/dist/commonjs/manifest/representation_index/static.d.ts +1 -1
  224. package/dist/commonjs/manifest/representation_index/static.js +2 -2
  225. package/dist/commonjs/manifest/representation_index/types.d.ts +4 -4
  226. package/dist/commonjs/parsers/manifest/dash/common/convert_supplemental_codecs.d.ts +17 -0
  227. package/dist/commonjs/parsers/manifest/dash/common/convert_supplemental_codecs.js +30 -0
  228. package/dist/commonjs/parsers/manifest/dash/common/flatten_overlapping_periods.js +5 -0
  229. package/dist/commonjs/parsers/manifest/dash/common/indexes/base.d.ts +6 -1
  230. package/dist/commonjs/parsers/manifest/dash/common/indexes/base.js +4 -3
  231. package/dist/commonjs/parsers/manifest/dash/common/indexes/get_segments_from_timeline.d.ts +5 -2
  232. package/dist/commonjs/parsers/manifest/dash/common/indexes/get_segments_from_timeline.js +15 -4
  233. package/dist/commonjs/parsers/manifest/dash/common/indexes/index.d.ts +5 -5
  234. package/dist/commonjs/parsers/manifest/dash/common/indexes/list.d.ts +1 -1
  235. package/dist/commonjs/parsers/manifest/dash/common/indexes/list.js +2 -2
  236. package/dist/commonjs/parsers/manifest/dash/common/indexes/template.d.ts +12 -5
  237. package/dist/commonjs/parsers/manifest/dash/common/indexes/template.js +42 -29
  238. package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/index.d.ts +2 -1
  239. package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.d.ts +99 -6
  240. package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.js +250 -51
  241. package/dist/commonjs/parsers/manifest/dash/common/manifest_bounds_calculator.d.ts +40 -17
  242. package/dist/commonjs/parsers/manifest/dash/common/manifest_bounds_calculator.js +38 -18
  243. package/dist/commonjs/parsers/manifest/dash/common/parse_adaptation_sets.js +13 -10
  244. package/dist/commonjs/parsers/manifest/dash/common/parse_mpd.js +27 -14
  245. package/dist/commonjs/parsers/manifest/dash/common/parse_periods.d.ts +1 -1
  246. package/dist/commonjs/parsers/manifest/dash/common/parse_periods.js +17 -18
  247. package/dist/commonjs/parsers/manifest/dash/common/parse_representation_index.d.ts +19 -6
  248. package/dist/commonjs/parsers/manifest/dash/common/parse_representation_index.js +21 -8
  249. package/dist/commonjs/parsers/manifest/dash/common/parse_representations.js +36 -20
  250. package/dist/commonjs/parsers/manifest/dash/js-parser/node_parsers/AdaptationSet.js +3 -0
  251. package/dist/commonjs/parsers/manifest/dash/js-parser/node_parsers/Representation.js +3 -0
  252. package/dist/commonjs/parsers/manifest/dash/node_parser_types.d.ts +2 -0
  253. package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/AdaptationSet.js +4 -0
  254. package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/Representation.js +4 -0
  255. package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/types.d.ts +2 -1
  256. package/dist/commonjs/parsers/manifest/local/representation_index.d.ts +1 -1
  257. package/dist/commonjs/parsers/manifest/local/representation_index.js +3 -3
  258. package/dist/commonjs/parsers/manifest/metaplaylist/representation_index.d.ts +1 -1
  259. package/dist/commonjs/parsers/manifest/metaplaylist/representation_index.js +2 -2
  260. package/dist/commonjs/parsers/manifest/smooth/representation_index.d.ts +5 -5
  261. package/dist/commonjs/parsers/manifest/smooth/representation_index.js +25 -9
  262. package/dist/commonjs/parsers/manifest/types.d.ts +1 -0
  263. package/dist/commonjs/parsers/manifest/utils/index_helpers.js +1 -1
  264. package/dist/commonjs/public_types.d.ts +78 -34
  265. package/dist/commonjs/transports/dash/init_segment_loader.js +10 -5
  266. package/dist/commonjs/transports/dash/manifest_parser.js +5 -2
  267. package/dist/commonjs/transports/dash/segment_loader.js +2 -1
  268. package/dist/commonjs/transports/dash/text_loader.js +2 -0
  269. package/dist/commonjs/transports/metaplaylist/manifest_loader.js +2 -1
  270. package/dist/commonjs/transports/metaplaylist/pipelines.js +4 -1
  271. package/dist/commonjs/transports/smooth/pipelines.js +4 -2
  272. package/dist/commonjs/transports/smooth/segment_loader.js +2 -1
  273. package/dist/commonjs/transports/types.d.ts +12 -0
  274. package/dist/commonjs/transports/utils/generate_manifest_loader.js +6 -3
  275. package/dist/commonjs/utils/queue_microtask.d.ts +2 -0
  276. package/dist/commonjs/utils/queue_microtask.js +7 -0
  277. package/dist/commonjs/utils/request/fetch.d.ts +6 -0
  278. package/dist/commonjs/utils/request/fetch.js +29 -8
  279. package/dist/commonjs/utils/request/xhr.d.ts +11 -5
  280. package/dist/commonjs/utils/request/xhr.js +29 -8
  281. package/dist/es2017/compat/is_codec_supported.js +22 -1
  282. package/dist/es2017/compat/patch_webkit_source_buffer.js +2 -2
  283. package/dist/es2017/config.d.ts +1 -0
  284. package/dist/es2017/core/api/debug/buffer_graph.js +2 -6
  285. package/dist/es2017/core/api/debug/modules/general_info.js +17 -10
  286. package/dist/es2017/core/api/option_utils.d.ts +4 -0
  287. package/dist/es2017/core/api/option_utils.js +8 -3
  288. package/dist/es2017/core/api/public_api.d.ts +11 -1
  289. package/dist/es2017/core/api/public_api.js +44 -9
  290. package/dist/es2017/core/fetchers/manifest/manifest_fetcher.d.ts +6 -0
  291. package/dist/es2017/core/fetchers/manifest/manifest_fetcher.js +11 -3
  292. package/dist/es2017/core/fetchers/segment/segment_fetcher.d.ts +8 -1
  293. package/dist/es2017/core/fetchers/segment/segment_fetcher.js +8 -4
  294. package/dist/es2017/core/fetchers/segment/segment_fetcher_creator.d.ts +1 -0
  295. package/dist/es2017/core/fetchers/utils/schedule_request.js +1 -1
  296. package/dist/es2017/core/init/directfile_content_initializer.js +24 -7
  297. package/dist/es2017/core/init/media_source_content_initializer.d.ts +6 -0
  298. package/dist/es2017/core/init/media_source_content_initializer.js +4 -6
  299. package/dist/es2017/core/init/utils/content_time_boundaries_observer.d.ts +13 -12
  300. package/dist/es2017/core/init/utils/content_time_boundaries_observer.js +16 -15
  301. package/dist/es2017/core/init/utils/get_initial_time.d.ts +17 -3
  302. package/dist/es2017/core/init/utils/get_initial_time.js +9 -7
  303. package/dist/es2017/core/segment_buffers/implementations/text/html/text_track_cues_store.js +54 -6
  304. package/dist/es2017/core/segment_buffers/implementations/text/html/utils.d.ts +2 -1
  305. package/dist/es2017/core/segment_buffers/implementations/text/html/utils.js +18 -2
  306. package/dist/es2017/core/stream/adaptation/adaptation_stream.js +2 -2
  307. package/dist/es2017/core/stream/orchestrator/stream_orchestrator.js +3 -3
  308. package/dist/es2017/core/stream/period/period_stream.js +2 -2
  309. package/dist/es2017/core/stream/representation/utils/get_buffer_status.js +3 -3
  310. package/dist/es2017/core/stream/representation/utils/get_needed_segments.js +1 -1
  311. package/dist/es2017/default_config.d.ts +5 -0
  312. package/dist/es2017/default_config.js +5 -0
  313. package/dist/es2017/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.js +3 -1
  314. package/dist/es2017/experimental/tools/createMetaplaylist/get_duration_from_manifest.js +2 -0
  315. package/dist/es2017/manifest/representation.js +18 -5
  316. package/dist/es2017/manifest/representation_index/static.d.ts +1 -1
  317. package/dist/es2017/manifest/representation_index/static.js +2 -2
  318. package/dist/es2017/manifest/representation_index/types.d.ts +4 -4
  319. package/dist/es2017/parsers/manifest/dash/common/convert_supplemental_codecs.d.ts +17 -0
  320. package/dist/es2017/parsers/manifest/dash/common/convert_supplemental_codecs.js +26 -0
  321. package/dist/es2017/parsers/manifest/dash/common/flatten_overlapping_periods.js +5 -0
  322. package/dist/es2017/parsers/manifest/dash/common/indexes/base.d.ts +6 -1
  323. package/dist/es2017/parsers/manifest/dash/common/indexes/base.js +4 -3
  324. package/dist/es2017/parsers/manifest/dash/common/indexes/get_segments_from_timeline.d.ts +5 -2
  325. package/dist/es2017/parsers/manifest/dash/common/indexes/get_segments_from_timeline.js +15 -4
  326. package/dist/es2017/parsers/manifest/dash/common/indexes/index.d.ts +5 -5
  327. package/dist/es2017/parsers/manifest/dash/common/indexes/list.d.ts +1 -1
  328. package/dist/es2017/parsers/manifest/dash/common/indexes/list.js +2 -2
  329. package/dist/es2017/parsers/manifest/dash/common/indexes/template.d.ts +12 -5
  330. package/dist/es2017/parsers/manifest/dash/common/indexes/template.js +40 -27
  331. package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/index.d.ts +2 -1
  332. package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.d.ts +99 -6
  333. package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.js +246 -51
  334. package/dist/es2017/parsers/manifest/dash/common/manifest_bounds_calculator.d.ts +40 -17
  335. package/dist/es2017/parsers/manifest/dash/common/manifest_bounds_calculator.js +38 -18
  336. package/dist/es2017/parsers/manifest/dash/common/parse_adaptation_sets.js +11 -8
  337. package/dist/es2017/parsers/manifest/dash/common/parse_mpd.js +27 -13
  338. package/dist/es2017/parsers/manifest/dash/common/parse_periods.d.ts +1 -1
  339. package/dist/es2017/parsers/manifest/dash/common/parse_periods.js +13 -16
  340. package/dist/es2017/parsers/manifest/dash/common/parse_representation_index.d.ts +19 -6
  341. package/dist/es2017/parsers/manifest/dash/common/parse_representation_index.js +10 -8
  342. package/dist/es2017/parsers/manifest/dash/common/parse_representations.js +36 -20
  343. package/dist/es2017/parsers/manifest/dash/js-parser/node_parsers/AdaptationSet.js +3 -0
  344. package/dist/es2017/parsers/manifest/dash/js-parser/node_parsers/Representation.js +3 -0
  345. package/dist/es2017/parsers/manifest/dash/node_parser_types.d.ts +2 -0
  346. package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/AdaptationSet.js +4 -0
  347. package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/Representation.js +4 -0
  348. package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/types.d.ts +2 -1
  349. package/dist/es2017/parsers/manifest/local/representation_index.d.ts +1 -1
  350. package/dist/es2017/parsers/manifest/local/representation_index.js +3 -3
  351. package/dist/es2017/parsers/manifest/metaplaylist/representation_index.d.ts +1 -1
  352. package/dist/es2017/parsers/manifest/metaplaylist/representation_index.js +2 -2
  353. package/dist/es2017/parsers/manifest/smooth/representation_index.d.ts +5 -5
  354. package/dist/es2017/parsers/manifest/smooth/representation_index.js +25 -9
  355. package/dist/es2017/parsers/manifest/types.d.ts +1 -0
  356. package/dist/es2017/parsers/manifest/utils/index_helpers.js +1 -1
  357. package/dist/es2017/public_types.d.ts +78 -34
  358. package/dist/es2017/transports/dash/init_segment_loader.js +5 -0
  359. package/dist/es2017/transports/dash/manifest_parser.js +3 -0
  360. package/dist/es2017/transports/dash/segment_loader.js +1 -0
  361. package/dist/es2017/transports/dash/text_loader.js +2 -0
  362. package/dist/es2017/transports/metaplaylist/manifest_loader.js +1 -0
  363. package/dist/es2017/transports/metaplaylist/pipelines.js +4 -1
  364. package/dist/es2017/transports/smooth/pipelines.js +2 -0
  365. package/dist/es2017/transports/smooth/segment_loader.js +1 -0
  366. package/dist/es2017/transports/types.d.ts +12 -0
  367. package/dist/es2017/transports/utils/generate_manifest_loader.js +3 -0
  368. package/dist/es2017/utils/queue_microtask.d.ts +2 -0
  369. package/dist/es2017/utils/queue_microtask.js +5 -0
  370. package/dist/es2017/utils/request/fetch.d.ts +6 -0
  371. package/dist/es2017/utils/request/fetch.js +29 -8
  372. package/dist/es2017/utils/request/xhr.d.ts +11 -5
  373. package/dist/es2017/utils/request/xhr.js +30 -9
  374. package/dist/mpd-parser.wasm +0 -0
  375. package/dist/rx-player.js +900 -492
  376. package/dist/rx-player.min.js +1 -1
  377. package/package.json +3 -7
  378. package/scripts/update-version +2 -0
  379. package/sonar-project.properties +1 -1
  380. package/src/compat/is_codec_supported.ts +23 -1
  381. package/src/compat/patch_webkit_source_buffer.ts +2 -2
  382. package/src/core/api/debug/buffer_graph.ts +2 -5
  383. package/src/core/api/debug/modules/general_info.ts +15 -10
  384. package/src/core/api/option_utils.ts +11 -3
  385. package/src/core/api/public_api.ts +48 -8
  386. package/src/core/fetchers/manifest/manifest_fetcher.ts +21 -3
  387. package/src/core/fetchers/segment/segment_fetcher.ts +19 -5
  388. package/src/core/fetchers/segment/segment_fetcher_creator.ts +1 -0
  389. package/src/core/fetchers/utils/schedule_request.ts +1 -1
  390. package/src/core/init/directfile_content_initializer.ts +23 -7
  391. package/src/core/init/media_source_content_initializer.ts +13 -7
  392. package/src/core/init/utils/content_time_boundaries_observer.ts +23 -22
  393. package/src/core/init/utils/get_initial_time.ts +25 -12
  394. package/src/core/segment_buffers/implementations/text/html/__tests__/utils.test.ts +15 -0
  395. package/src/core/segment_buffers/implementations/text/html/text_track_cues_store.ts +57 -6
  396. package/src/core/segment_buffers/implementations/text/html/utils.ts +19 -2
  397. package/src/core/stream/adaptation/adaptation_stream.ts +2 -2
  398. package/src/core/stream/orchestrator/stream_orchestrator.ts +3 -3
  399. package/src/core/stream/period/period_stream.ts +2 -2
  400. package/src/core/stream/representation/utils/get_buffer_status.ts +3 -3
  401. package/src/core/stream/representation/utils/get_needed_segments.ts +2 -2
  402. package/src/default_config.ts +5 -0
  403. package/src/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.ts +3 -1
  404. package/src/experimental/tools/createMetaplaylist/get_duration_from_manifest.ts +2 -0
  405. package/src/manifest/representation.ts +19 -6
  406. package/src/manifest/representation_index/static.ts +2 -2
  407. package/src/manifest/representation_index/types.ts +4 -4
  408. package/src/parsers/manifest/dash/common/__tests__/convert_supplemental_codecs.test.ts +37 -0
  409. package/src/parsers/manifest/dash/common/__tests__/flatten_overlapping_period.test.ts +20 -0
  410. package/src/parsers/manifest/dash/common/__tests__/manifest_bounds_calculator.test.ts +182 -36
  411. package/src/parsers/manifest/dash/common/convert_supplemental_codecs.ts +32 -0
  412. package/src/parsers/manifest/dash/common/flatten_overlapping_periods.ts +5 -0
  413. package/src/parsers/manifest/dash/common/indexes/base.ts +12 -4
  414. package/src/parsers/manifest/dash/common/indexes/get_segments_from_timeline.ts +19 -5
  415. package/src/parsers/manifest/dash/common/indexes/index.ts +16 -4
  416. package/src/parsers/manifest/dash/common/indexes/list.ts +2 -2
  417. package/src/parsers/manifest/dash/common/indexes/template.ts +52 -31
  418. package/src/parsers/manifest/dash/common/indexes/timeline/index.ts +4 -1
  419. package/src/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.ts +366 -60
  420. package/src/parsers/manifest/dash/common/manifest_bounds_calculator.ts +63 -25
  421. package/src/parsers/manifest/dash/common/parse_adaptation_sets.ts +10 -4
  422. package/src/parsers/manifest/dash/common/parse_mpd.ts +28 -15
  423. package/src/parsers/manifest/dash/common/parse_periods.ts +12 -17
  424. package/src/parsers/manifest/dash/common/parse_representation_index.ts +50 -26
  425. package/src/parsers/manifest/dash/common/parse_representations.ts +39 -20
  426. package/src/parsers/manifest/dash/js-parser/node_parsers/AdaptationSet.ts +4 -0
  427. package/src/parsers/manifest/dash/js-parser/node_parsers/Representation.ts +4 -0
  428. package/src/parsers/manifest/dash/node_parser_types.ts +2 -0
  429. package/src/parsers/manifest/dash/wasm-parser/rs/events.rs +2 -0
  430. package/src/parsers/manifest/dash/wasm-parser/rs/processor/attributes.rs +2 -0
  431. package/src/parsers/manifest/dash/wasm-parser/ts/generators/AdaptationSet.ts +4 -0
  432. package/src/parsers/manifest/dash/wasm-parser/ts/generators/Representation.ts +4 -0
  433. package/src/parsers/manifest/dash/wasm-parser/ts/types.ts +2 -0
  434. package/src/parsers/manifest/local/representation_index.ts +3 -3
  435. package/src/parsers/manifest/metaplaylist/representation_index.ts +2 -2
  436. package/src/parsers/manifest/smooth/representation_index.ts +23 -9
  437. package/src/parsers/manifest/types.ts +2 -0
  438. package/src/parsers/manifest/utils/__tests__/get_first_time_from_adaptations.test.ts +1 -1
  439. package/src/parsers/manifest/utils/__tests__/get_last_time_from_adaptation.test.ts +1 -1
  440. package/src/parsers/manifest/utils/index_helpers.ts +1 -1
  441. package/src/public_types.ts +79 -34
  442. package/src/transports/dash/init_segment_loader.ts +5 -0
  443. package/src/transports/dash/manifest_parser.ts +6 -0
  444. package/src/transports/dash/segment_loader.ts +1 -0
  445. package/src/transports/dash/text_loader.ts +2 -0
  446. package/src/transports/metaplaylist/manifest_loader.ts +1 -0
  447. package/src/transports/metaplaylist/pipelines.ts +4 -1
  448. package/src/transports/smooth/pipelines.ts +2 -0
  449. package/src/transports/smooth/segment_loader.ts +1 -0
  450. package/src/transports/types.ts +12 -0
  451. package/src/transports/utils/generate_manifest_loader.ts +3 -0
  452. package/src/utils/queue_microtask.ts +7 -0
  453. package/src/utils/request/fetch.ts +35 -8
  454. package/src/utils/request/xhr.ts +45 -14
  455. package/dist/_esm5.processed/compat/fullscreen.d.ts +0 -32
  456. package/dist/_esm5.processed/compat/fullscreen.js +0 -78
  457. package/dist/_esm5.processed/compat/is_offline.d.ts +0 -39
  458. package/dist/_esm5.processed/compat/is_offline.js +0 -43
  459. package/dist/_esm5.processed/core/api/tracks_management/track_choice_manager.d.ts +0 -258
  460. package/dist/_esm5.processed/core/api/tracks_management/track_choice_manager.js +0 -989
  461. package/dist/_esm5.processed/core/segment_buffers/implementations/image/image_segment_buffer.d.ts +0 -75
  462. package/dist/_esm5.processed/core/segment_buffers/implementations/image/image_segment_buffer.js +0 -133
  463. package/dist/_esm5.processed/features/list/bif_parser.d.ts +0 -23
  464. package/dist/_esm5.processed/features/list/bif_parser.js +0 -27
  465. package/dist/_esm5.processed/features/list/image_buffer.js +0 -25
  466. package/dist/_esm5.processed/transports/dash/image_pipelines.d.ts +0 -38
  467. package/dist/_esm5.processed/transports/dash/image_pipelines.js +0 -129
  468. package/dist/_esm5.processed/utils/list_to_map.js +0 -28
  469. package/dist/_esm5.processed/utils/simple_set.d.ts +0 -51
  470. package/dist/_esm5.processed/utils/simple_set.js +0 -57
  471. package/dist/_esm5.processed/utils/uniq.d.ts +0 -36
  472. package/dist/_esm5.processed/utils/uniq.js +0 -43
  473. package/dist/commonjs/parsers/manifest/utils/is_segment_still_available.d.ts +0 -29
  474. package/dist/commonjs/parsers/manifest/utils/is_segment_still_available.js +0 -54
  475. package/dist/es2017/parsers/manifest/utils/is_segment_still_available.d.ts +0 -29
  476. package/dist/es2017/parsers/manifest/utils/is_segment_still_available.js +0 -51
  477. package/src/parsers/manifest/utils/is_segment_still_available.ts +0 -58
  478. package/src/typings/next-tick.d.ts +0 -23
  479. package/src/typings/object-assign.d.ts +0 -48
@@ -49,8 +49,8 @@ var task_canceller_1 = require("../../../utils/task_canceller");
49
49
  /**
50
50
  * Observes what's being played and take care of media events relating to time
51
51
  * boundaries:
52
- * - Emits a `durationUpdate` when the duration of the current content is
53
- * known and every time it changes.
52
+ * - Emits a `endingPositionChange` when the known maximum playable position
53
+ * of the current content is known and every time it changes.
54
54
  * - Emits `endOfStream` API once segments have been pushed until the end and
55
55
  * `resumeStream` if downloads starts back.
56
56
  * - Emits a `periodChange` event when the currently-playing Period seemed to
@@ -95,7 +95,7 @@ var ContentTimeBoundariesObserver = /** @class */ (function (_super) {
95
95
  }
96
96
  }, { includeLastObservation: true, clearSignal: cancelSignal });
97
97
  manifest.addEventListener("manifestUpdate", function () {
98
- _this.trigger("durationUpdate", _this._getManifestDuration());
98
+ _this.trigger("endingPositionChange", _this._getManifestEndTime());
99
99
  if (cancelSignal.isCancelled()) {
100
100
  return;
101
101
  }
@@ -104,11 +104,12 @@ var ContentTimeBoundariesObserver = /** @class */ (function (_super) {
104
104
  return _this;
105
105
  }
106
106
  /**
107
- * Returns an estimate of the current duration of the content.
107
+ * Returns an estimate of the current last position which may be played in
108
+ * the content at the moment.
108
109
  * @returns {Object}
109
110
  */
110
- ContentTimeBoundariesObserver.prototype.getCurrentDuration = function () {
111
- return this._getManifestDuration();
111
+ ContentTimeBoundariesObserver.prototype.getCurrentEndingTime = function () {
112
+ return this._getManifestEndTime();
112
113
  };
113
114
  /**
114
115
  * Method to call any time an Adaptation has been selected.
@@ -137,12 +138,12 @@ var ContentTimeBoundariesObserver = /** @class */ (function (_super) {
137
138
  .updateLastVideoAdaptation(adaptation);
138
139
  }
139
140
  var endingPosition = this._maximumPositionCalculator.getEndingPosition();
140
- var newDuration = endingPosition !== undefined ?
141
- { isEnd: true,
142
- duration: endingPosition } :
141
+ var newEndingPosition = endingPosition !== undefined ?
142
+ { isEnd: true, endingPosition: endingPosition } :
143
143
  { isEnd: false,
144
- duration: this._maximumPositionCalculator.getMaximumAvailablePosition() };
145
- this.trigger("durationUpdate", newDuration);
144
+ endingPosition: this._maximumPositionCalculator
145
+ .getMaximumAvailablePosition() };
146
+ this.trigger("endingPositionChange", newEndingPosition);
146
147
  }
147
148
  }
148
149
  }
@@ -286,13 +287,12 @@ var ContentTimeBoundariesObserver = /** @class */ (function (_super) {
286
287
  finally { if (e_1) throw e_1.error; }
287
288
  }
288
289
  };
289
- ContentTimeBoundariesObserver.prototype._getManifestDuration = function () {
290
+ ContentTimeBoundariesObserver.prototype._getManifestEndTime = function () {
290
291
  var endingPosition = this._maximumPositionCalculator.getEndingPosition();
291
292
  return endingPosition !== undefined ?
292
- { isEnd: true,
293
- duration: endingPosition } :
293
+ { isEnd: true, endingPosition: endingPosition } :
294
294
  { isEnd: false,
295
- duration: this._maximumPositionCalculator.getMaximumAvailablePosition() };
295
+ endingPosition: this._maximumPositionCalculator.getMaximumAvailablePosition() };
296
296
  };
297
297
  ContentTimeBoundariesObserver.prototype._lazilyCreateActiveStreamInfo = function (bufferType) {
298
298
  var streamInfo = this._activeStreams.get(bufferType);
@@ -366,9 +366,8 @@ var MaximumPositionCalculator = /** @class */ (function () {
366
366
  * @returns {number}
367
367
  */
368
368
  MaximumPositionCalculator.prototype.getMaximumAvailablePosition = function () {
369
- var _a;
370
369
  if (this._manifest.isDynamic) {
371
- return (_a = this._manifest.getLivePosition()) !== null && _a !== void 0 ? _a : this._manifest.getMaximumSafePosition();
370
+ return this._manifest.getMaximumSafePosition();
372
371
  }
373
372
  if (this._lastVideoAdaptation === undefined ||
374
373
  this._lastAudioAdaptation === undefined) {
@@ -37,11 +37,25 @@ export interface IInitialTimeOptions {
37
37
  */
38
38
  fromFirstPosition?: number | null | undefined;
39
39
  /**
40
- * If set, we should begin at this position relative to the content's end,
41
- * in seconds.
40
+ * If set, we should begin at this position relative to the content's maximum
41
+ * seekable position, in seconds.
42
+ *
43
+ * It should consequently in most cases be a negative value.
42
44
  */
43
45
  fromLastPosition?: number | null | undefined;
44
- /** If set, we should begin at this position relative to the whole duration of
46
+ /**
47
+ * If set, we should begin at this position relative to the content's live
48
+ * edge if it makes sense, in seconds.
49
+ *
50
+ * It should consequently in most cases be a negative value.
51
+ *
52
+ * If the live edge is unknown or if it does not make sense for the current
53
+ * content, that position is relative to the content's maximum position
54
+ * instead.
55
+ */
56
+ fromLivePosition?: number | null | undefined;
57
+ /**
58
+ * If set, we should begin at this position relative to the whole duration of
45
59
  * the content, in percentage.
46
60
  */
47
61
  percentage?: number | null | undefined;
@@ -33,15 +33,10 @@ var monotonic_timestamp_1 = require("../../../utils/monotonic_timestamp");
33
33
  * @returns {Number}
34
34
  */
35
35
  function getInitialTime(manifest, lowLatencyMode, startAt) {
36
+ var _a;
36
37
  if (!(0, is_null_or_undefined_1.default)(startAt)) {
37
38
  var min = manifest.getMinimumSafePosition();
38
- var max = void 0;
39
- if (manifest.isLive) {
40
- max = manifest.getLivePosition();
41
- }
42
- if (max === undefined) {
43
- max = manifest.getMaximumSafePosition();
44
- }
39
+ var max = manifest.getMaximumSafePosition();
45
40
  if (!(0, is_null_or_undefined_1.default)(startAt.position)) {
46
41
  log_1.default.debug("Init: using startAt.minimumPosition");
47
42
  return Math.max(Math.min(startAt.position, max), min);
@@ -66,6 +61,13 @@ function getInitialTime(manifest, lowLatencyMode, startAt) {
66
61
  return fromLastPosition >= 0 ? max :
67
62
  Math.max(min, max + fromLastPosition);
68
63
  }
64
+ else if (!(0, is_null_or_undefined_1.default)(startAt.fromLivePosition)) {
65
+ log_1.default.debug("Init: using startAt.fromLivePosition");
66
+ var livePosition = (_a = manifest.getLivePosition()) !== null && _a !== void 0 ? _a : max;
67
+ var fromLivePosition = startAt.fromLivePosition;
68
+ return fromLivePosition >= 0 ? livePosition :
69
+ Math.max(min, livePosition + fromLivePosition);
70
+ }
69
71
  else if (!(0, is_null_or_undefined_1.default)(startAt.percentage)) {
70
72
  log_1.default.debug("Init: using startAt.percentage");
71
73
  var percentage = startAt.percentage;
@@ -33,6 +33,22 @@ var __read = (this && this.__read) || function (o, n) {
33
33
  Object.defineProperty(exports, "__esModule", { value: true });
34
34
  var assert_1 = require("../../../../../utils/assert");
35
35
  var utils_1 = require("./utils");
36
+ /**
37
+ * first or last IHTMLCue in a group can have a slighlty different start
38
+ * or end time than the start or end time of the ICuesGroup due to parsing
39
+ * approximation.
40
+ * DELTA_CUES_GROUP defines the tolerance level when comparing the start/end
41
+ * of a IHTMLCue to the start/end of a ICuesGroup.
42
+ * Having this value too high may lead to have unwanted subtitle displayed
43
+ * Having this value too low may lead to have subtitles not displayed
44
+ */
45
+ var DELTA_CUES_GROUP = 1e-3;
46
+ /**
47
+ * segment_duration / RELATIVE_DELTA_RATIO = relative_delta
48
+ *
49
+ * relative_delta is the tolerance to determine if two segements are the same
50
+ */
51
+ var RELATIVE_DELTA_RATIO = 5;
36
52
  /**
37
53
  * Manage the buffer of the HTMLTextSegmentBuffer.
38
54
  * Allows to add, remove and recuperate cues at given times.
@@ -75,6 +91,18 @@ var TextTrackCuesStore = /** @class */ (function () {
75
91
  ret.push(cues[j].element);
76
92
  }
77
93
  }
94
+ // first or last IHTMLCue in a group can have a slighlty different start
95
+ // or end time than the start or end time of the ICuesGroup due to parsing
96
+ // approximation.
97
+ // Add a tolerance of 1ms to fix this issue
98
+ if (ret.length === 0 && cues.length > 0) {
99
+ for (var j = 0; j < cues.length; j++) {
100
+ if ((0, utils_1.areNearlyEqual)(time, cues[j].start, DELTA_CUES_GROUP)
101
+ || (0, utils_1.areNearlyEqual)(time, cues[j].end, DELTA_CUES_GROUP)) {
102
+ ret.push(cues[j].element);
103
+ }
104
+ }
105
+ }
78
106
  return ret;
79
107
  }
80
108
  }
@@ -161,6 +189,11 @@ var TextTrackCuesStore = /** @class */ (function () {
161
189
  TextTrackCuesStore.prototype.insert = function (cues, start, end) {
162
190
  var cuesBuffer = this._cuesBuffer;
163
191
  var cuesInfosToInsert = { start: start, end: end, cues: cues };
192
+ // it's preferable to have a delta depending on the duration of the segment
193
+ // if the delta is one fifth of the length of the segment:
194
+ // a segment of [0, 2] is the "same" segment as [0, 2.1]
195
+ // but [0, 0.04] is not the "same" segement as [0,04, 0.08]
196
+ var relativeDelta = Math.abs(start - end) / RELATIVE_DELTA_RATIO;
164
197
  /**
165
198
  * Called when we found the index of the next cue relative to the cue we
166
199
  * want to insert (that is a cue starting after its start or at the same
@@ -172,7 +205,7 @@ var TextTrackCuesStore = /** @class */ (function () {
172
205
  function onIndexOfNextCueFound(indexOfNextCue) {
173
206
  var nextCue = cuesBuffer[indexOfNextCue];
174
207
  if (nextCue === undefined || // no cue
175
- (0, utils_1.areNearlyEqual)(cuesInfosToInsert.end, nextCue.end)) // samey end
208
+ (0, utils_1.areNearlyEqual)(cuesInfosToInsert.end, nextCue.end, relativeDelta)) // samey end
176
209
  {
177
210
  // ours: |AAAAA|
178
211
  // the current one: |BBBBB|
@@ -208,8 +241,8 @@ var TextTrackCuesStore = /** @class */ (function () {
208
241
  for (var cueIdx = 0; cueIdx < cuesBuffer.length; cueIdx++) {
209
242
  var cuesInfos = cuesBuffer[cueIdx];
210
243
  if (start < cuesInfos.end) {
211
- if ((0, utils_1.areNearlyEqual)(start, cuesInfos.start)) {
212
- if ((0, utils_1.areNearlyEqual)(end, cuesInfos.end)) {
244
+ if ((0, utils_1.areNearlyEqual)(start, cuesInfos.start, relativeDelta)) {
245
+ if ((0, utils_1.areNearlyEqual)(end, cuesInfos.end, relativeDelta)) {
213
246
  // exact same segment
214
247
  // ours: |AAAAA|
215
248
  // the current one: |BBBBB|
@@ -257,7 +290,7 @@ var TextTrackCuesStore = /** @class */ (function () {
257
290
  cuesBuffer.splice(cueIdx, 0, cuesInfosToInsert);
258
291
  return;
259
292
  }
260
- else if ((0, utils_1.areNearlyEqual)(end, cuesInfos.start)) {
293
+ else if ((0, utils_1.areNearlyEqual)(end, cuesInfos.start, relativeDelta)) {
261
294
  // our cue goes just before the current one:
262
295
  // ours: |AAAAAAA|
263
296
  // the current one: |BBBB|
@@ -269,7 +302,7 @@ var TextTrackCuesStore = /** @class */ (function () {
269
302
  cuesBuffer.splice(cueIdx, 0, cuesInfosToInsert);
270
303
  return;
271
304
  }
272
- else if ((0, utils_1.areNearlyEqual)(end, cuesInfos.end)) {
305
+ else if ((0, utils_1.areNearlyEqual)(end, cuesInfos.end, relativeDelta)) {
273
306
  // ours: |AAAAAAA|
274
307
  // the current one: |BBBB|
275
308
  // Result: |AAAAAAA|
@@ -297,7 +330,7 @@ var TextTrackCuesStore = /** @class */ (function () {
297
330
  return;
298
331
  }
299
332
  // else -> start > cuesInfos.start
300
- if ((0, utils_1.areNearlyEqual)(cuesInfos.end, end)) {
333
+ if ((0, utils_1.areNearlyEqual)(cuesInfos.end, end, relativeDelta)) {
301
334
  // ours: |AAAAAA|
302
335
  // the current one: |BBBBBBBB|
303
336
  // Result: |BBAAAAAA|
@@ -333,6 +366,21 @@ var TextTrackCuesStore = /** @class */ (function () {
333
366
  }
334
367
  }
335
368
  }
369
+ if (cuesBuffer.length) {
370
+ var lastCue = cuesBuffer[cuesBuffer.length - 1];
371
+ if ((0, utils_1.areNearlyEqual)(lastCue.end, start, relativeDelta)) {
372
+ // Match the end of the previous cue to the start of the following one
373
+ // if they are close enough. If there is a small gap between two segments
374
+ // it can lead to having no subtitles for a short time, this is noticeable when
375
+ // two successive segments displays the same text, making it diseappear
376
+ // and reappear quickly, which gives the impression of blinking
377
+ //
378
+ // ours: |AAAAA|
379
+ // the current one: |BBBBB|...
380
+ // Result: |BBBBBBBAAAAA|
381
+ lastCue.end = start;
382
+ }
383
+ }
336
384
  // no cues group has the end after our current start.
337
385
  // These cues should be the last one
338
386
  cuesBuffer.push(cuesInfosToInsert);
@@ -18,9 +18,10 @@ import { ICuesGroup, IHTMLCue } from "./types";
18
18
  * @see MAX_DELTA_BUFFER_TIME
19
19
  * @param {Number} a
20
20
  * @param {Number} b
21
+ * @param {Number} delta
21
22
  * @returns {Boolean}
22
23
  */
23
- export declare function areNearlyEqual(a: number, b: number): boolean;
24
+ export declare function areNearlyEqual(a: number, b: number, delta?: number): boolean;
24
25
  /**
25
26
  * Get all cues which have data before the given time.
26
27
  * @param {Object} cues
@@ -47,6 +47,21 @@ exports.removeCuesInfosBetween = exports.getCuesAfter = exports.getCuesBefore =
47
47
  * Setting a value too high might lead to two segments targeting different times
48
48
  * to be wrongly believed to target the same time. In worst case scenarios, this
49
49
  * could lead to wanted text tracks being removed.
50
+ *
51
+ * When comparing 2 segments s1 and s2, you may want to take into account the duration
52
+ * of the segments:
53
+ * - if s1 is [0, 2] and s2 is [0, 2.1] s1 and s2 can be considered as nearly equal as
54
+ * there is a relative difference of: (2.1-2) / 2 = 5%;
55
+ * Formula: (end_s1 - end_s2) / duration_s2 = relative_difference
56
+ * - if s1 is [0, 0.04] and s2 is [0.04, 0.08] s1 and s2 may not considered as nearly
57
+ * equal as there is a relative difference of: (0.04-0.08) / 0.04 = 100%
58
+ *
59
+ * To compare relatively to the duration of a segment you can provide and additional
60
+ * parameter "delta" that remplace MAX_DELTA_BUFFER_TIME.
61
+ * If parameter "delta" is higher than MAX_DELTA_BUFFER_TIME, MAX_DELTA_BUFFER_TIME
62
+ * is used instead of delta. This ensure that segments are nearly equal when comparing
63
+ * relatively AND absolutely.
64
+ *
50
65
  * @type Number
51
66
  */
52
67
  var MAX_DELTA_BUFFER_TIME = 0.2;
@@ -54,10 +69,12 @@ var MAX_DELTA_BUFFER_TIME = 0.2;
54
69
  * @see MAX_DELTA_BUFFER_TIME
55
70
  * @param {Number} a
56
71
  * @param {Number} b
72
+ * @param {Number} delta
57
73
  * @returns {Boolean}
58
74
  */
59
- function areNearlyEqual(a, b) {
60
- return Math.abs(a - b) <= MAX_DELTA_BUFFER_TIME;
75
+ function areNearlyEqual(a, b, delta) {
76
+ if (delta === void 0) { delta = MAX_DELTA_BUFFER_TIME; }
77
+ return Math.abs(a - b) <= Math.min(delta, MAX_DELTA_BUFFER_TIME);
61
78
  }
62
79
  exports.areNearlyEqual = areNearlyEqual;
63
80
  /**
@@ -47,7 +47,6 @@ var __values = (this && this.__values) || function(o) {
47
47
  throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
48
48
  };
49
49
  Object.defineProperty(exports, "__esModule", { value: true });
50
- var next_tick_1 = require("next-tick");
51
50
  var config_1 = require("../../../config");
52
51
  var errors_1 = require("../../../errors");
53
52
  var log_1 = require("../../../log");
@@ -55,6 +54,7 @@ var assert_unreachable_1 = require("../../../utils/assert_unreachable");
55
54
  var cancellable_sleep_1 = require("../../../utils/cancellable_sleep");
56
55
  var noop_1 = require("../../../utils/noop");
57
56
  var object_assign_1 = require("../../../utils/object_assign");
57
+ var queue_microtask_1 = require("../../../utils/queue_microtask");
58
58
  var reference_1 = require("../../../utils/reference");
59
59
  var task_canceller_1 = require("../../../utils/task_canceller");
60
60
  var representation_1 = require("../representation");
@@ -194,7 +194,7 @@ function AdaptationStream(_a, callbacks, parentCancelSignal) {
194
194
  // conditions where the inner logic would be called synchronously before
195
195
  // the next observation (which may reflect very different playback conditions)
196
196
  // is actually received.
197
- return [2 /*return*/, (0, next_tick_1.default)(function () {
197
+ return [2 /*return*/, (0, queue_microtask_1.default)(function () {
198
198
  playbackObserver.listen(function () {
199
199
  if (fnCancelSignal.isCancelled()) {
200
200
  return;
@@ -98,10 +98,10 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
98
98
  return to.concat(ar || Array.prototype.slice.call(from));
99
99
  };
100
100
  Object.defineProperty(exports, "__esModule", { value: true });
101
- var next_tick_1 = require("next-tick");
102
101
  var config_1 = require("../../../config");
103
102
  var errors_1 = require("../../../errors");
104
103
  var log_1 = require("../../../log");
104
+ var queue_microtask_1 = require("../../../utils/queue_microtask");
105
105
  var reference_1 = require("../../../utils/reference");
106
106
  var sorted_list_1 = require("../../../utils/sorted_list");
107
107
  var task_canceller_1 = require("../../../utils/task_canceller");
@@ -381,7 +381,7 @@ function StreamOrchestrator(content, playbackObserver, representationEstimator,
381
381
  // Schedule micro task before checking the last playback observation
382
382
  // to reduce the risk of race conditions where the next observation
383
383
  // was going to be emitted synchronously.
384
- (0, next_tick_1.default)(function () {
384
+ (0, queue_microtask_1.default)(function () {
385
385
  var _a;
386
386
  if (orchestratorCancelSignal.isCancelled()) {
387
387
  return;
@@ -538,7 +538,7 @@ function StreamOrchestrator(content, playbackObserver, representationEstimator,
538
538
  // conditions where the inner logic would be called synchronously before
539
539
  // the next observation (which may reflect very different playback
540
540
  // conditions) is actually received.
541
- return (0, next_tick_1.default)(function () {
541
+ return (0, queue_microtask_1.default)(function () {
542
542
  if (innerCancelSignal.isCancelled()) {
543
543
  return;
544
544
  }
@@ -73,11 +73,11 @@ var __values = (this && this.__values) || function(o) {
73
73
  throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
74
74
  };
75
75
  Object.defineProperty(exports, "__esModule", { value: true });
76
- var next_tick_1 = require("next-tick");
77
76
  var config_1 = require("../../../config");
78
77
  var errors_1 = require("../../../errors");
79
78
  var log_1 = require("../../../log");
80
79
  var object_assign_1 = require("../../../utils/object_assign");
80
+ var queue_microtask_1 = require("../../../utils/queue_microtask");
81
81
  var ranges_1 = require("../../../utils/ranges");
82
82
  var reference_1 = require("../../../utils/reference");
83
83
  var task_canceller_1 = require("../../../utils/task_canceller");
@@ -355,7 +355,7 @@ function PeriodStream(_a, callbacks, parentCancelSignal) {
355
355
  // is actually received.
356
356
  // It can happen when `askForMediaSourceReload` is called as a side-effect of
357
357
  // the same event that triggers the playback observation to be emitted.
358
- (0, next_tick_1.default)(function () {
358
+ (0, queue_microtask_1.default)(function () {
359
359
  playbackObserver.listen(function () {
360
360
  if (cancelSignal.isCancelled()) {
361
361
  return;
@@ -96,7 +96,7 @@ function getBufferStatus(content, initialWantedTime, playbackObserver, fastSwitc
96
96
  * needed segments for this Representation until the end of the Period.
97
97
  */
98
98
  var hasFinishedLoading = representation.index.isInitialized() &&
99
- representation.index.isFinished() &&
99
+ !representation.index.isStillAwaitingFutureSegments() &&
100
100
  neededRange.hasReachedPeriodEnd &&
101
101
  prioritizedNeededSegments.length === 0 &&
102
102
  segmentsOnHold.length === 0;
@@ -147,7 +147,7 @@ function getRangeOfNeededSegments(content, initialWantedTime, bufferGoal) {
147
147
  segment_buffers_1.default.isNative(content.adaptation.type) &&
148
148
  initialWantedTime >= lastIndexPosition &&
149
149
  representationIndex.isInitialized() &&
150
- representationIndex.isFinished() &&
150
+ !representationIndex.isStillAwaitingFutureSegments() &&
151
151
  isPeriodTheCurrentAndLastOne(manifest, period, initialWantedTime)) {
152
152
  wantedStartPosition = lastIndexPosition - 1;
153
153
  }
@@ -157,7 +157,7 @@ function getRangeOfNeededSegments(content, initialWantedTime, bufferGoal) {
157
157
  var wantedEndPosition = wantedStartPosition + bufferGoal;
158
158
  var hasReachedPeriodEnd;
159
159
  if (!representation.index.isInitialized() ||
160
- !representation.index.isFinished() ||
160
+ representation.index.isStillAwaitingFutureSegments() ||
161
161
  period.end === undefined) {
162
162
  hasReachedPeriodEnd = false;
163
163
  }
@@ -324,7 +324,7 @@ function doesEndSeemGarbageCollected(currentSeg, nextSeg, minimumEndTime) {
324
324
  }
325
325
  if (minimumEndTime > currentSeg.bufferedEnd &&
326
326
  currentSeg.end - currentSeg.bufferedEnd > MAX_TIME_MISSING_FROM_COMPLETE_SEGMENT) {
327
- log_1.default.info("Stream: The end of the wanted segment has been garbage collected", currentSeg.start, currentSeg.bufferedStart);
327
+ log_1.default.info("Stream: The end of the wanted segment has been garbage collected", currentSeg.end, currentSeg.bufferedEnd);
328
328
  return true;
329
329
  }
330
330
  return false;
@@ -21,6 +21,11 @@ declare const DEFAULT_CONFIG: {
21
21
  * @type {Number}
22
22
  */
23
23
  DEFAULT_REQUEST_TIMEOUT: number;
24
+ /**
25
+ * Default connection time after which a request will timeout, in ms.
26
+ * @type {Number}
27
+ */
28
+ DEFAULT_CONNECTION_TIMEOUT: number;
24
29
  /**
25
30
  * Can be either:
26
31
  * - "native": Subtitles are all displayed in a <track> element
@@ -23,6 +23,11 @@ var DEFAULT_CONFIG = {
23
23
  * @type {Number}
24
24
  */
25
25
  DEFAULT_REQUEST_TIMEOUT: 30 * 1000,
26
+ /**
27
+ * Default connection time after which a request will timeout, in ms.
28
+ * @type {Number}
29
+ */
30
+ DEFAULT_CONNECTION_TIMEOUT: 15 * 1000,
26
31
  /**
27
32
  * Can be either:
28
33
  * - "native": Subtitles are all displayed in a <track> element
@@ -181,7 +181,9 @@ var VideoThumbnailLoader = /** @class */ (function () {
181
181
  {}, { baseDelay: 0,
182
182
  maxDelay: 0,
183
183
  maxRetry: 0,
184
- requestTimeout: config_1.default.getCurrent().DEFAULT_REQUEST_TIMEOUT });
184
+ requestTimeout: config_1.default.getCurrent().DEFAULT_REQUEST_TIMEOUT,
185
+ connectionTimeout: config_1.default.getCurrent().DEFAULT_CONNECTION_TIMEOUT,
186
+ });
185
187
  var initSegment_1 = content.representation.index.getInitSegment();
186
188
  var initSegmentUniqueId_1 = initSegment_1 !== null ?
187
189
  content.representation.uniqueId :
@@ -112,6 +112,7 @@ function getDurationFromManifest(url, transport) {
112
112
  url: url,
113
113
  responseType: "document",
114
114
  timeout: config_1.default.getCurrent().DEFAULT_REQUEST_TIMEOUT,
115
+ connectionTimeout: config_1.default.getCurrent().DEFAULT_CONNECTION_TIMEOUT,
115
116
  // We won't cancel
116
117
  cancelSignal: new task_canceller_1.default().signal,
117
118
  })];
@@ -148,6 +149,7 @@ function getDurationFromManifest(url, transport) {
148
149
  url: url,
149
150
  responseType: "text",
150
151
  timeout: config_1.default.getCurrent().DEFAULT_REQUEST_TIMEOUT,
152
+ connectionTimeout: config_1.default.getCurrent().DEFAULT_CONNECTION_TIMEOUT,
151
153
  // We won't cancel
152
154
  cancelSignal: new task_canceller_1.default().signal,
153
155
  })];
@@ -40,6 +40,7 @@ var Representation = /** @class */ (function () {
40
40
  * @param {Object} args
41
41
  */
42
42
  function Representation(args, opts) {
43
+ var _a;
43
44
  this.id = args.id;
44
45
  this.uniqueId = generateRepresentationUniqueId();
45
46
  this.bitrate = args.bitrate;
@@ -68,12 +69,24 @@ var Representation = /** @class */ (function () {
68
69
  this.cdnMetadata = args.cdnMetadata;
69
70
  this.index = args.index;
70
71
  if (opts.type === "audio" || opts.type === "video") {
71
- var mimeTypeStr = this.getMimeTypeString();
72
- var isSupported = (0, compat_1.isCodecSupported)(mimeTypeStr);
73
- if (!isSupported) {
74
- log_1.default.info("Unsupported Representation", mimeTypeStr, this.id, this.bitrate);
72
+ this.isSupported = false;
73
+ // Supplemental codecs are defined as backwards-compatible codecs enhancing
74
+ // the experience of a base layer codec
75
+ if (args.supplementalCodecs !== undefined) {
76
+ var supplementalCodecMimeTypeStr = "".concat((_a = this.mimeType) !== null && _a !== void 0 ? _a : "", ";codecs=\"").concat(args.supplementalCodecs, "\"");
77
+ if ((0, compat_1.isCodecSupported)(supplementalCodecMimeTypeStr)) {
78
+ this.codec = args.supplementalCodecs;
79
+ this.isSupported = true;
80
+ }
81
+ }
82
+ if (!this.isSupported) {
83
+ var mimeTypeStr = this.getMimeTypeString();
84
+ var isSupported = (0, compat_1.isCodecSupported)(mimeTypeStr);
85
+ if (!isSupported) {
86
+ log_1.default.info("Unsupported Representation", mimeTypeStr, this.id, this.bitrate);
87
+ }
88
+ this.isSupported = isSupported;
75
89
  }
76
- this.isSupported = isSupported;
77
90
  }
78
91
  else {
79
92
  this.isSupported = true; // TODO for other types
@@ -89,7 +89,7 @@ export default class StaticRepresentationIndex implements IRepresentationIndex {
89
89
  /**
90
90
  * @returns {Boolean}
91
91
  */
92
- isFinished(): true;
92
+ isStillAwaitingFutureSegments(): false;
93
93
  /**
94
94
  * @returns {Boolean}
95
95
  */
@@ -117,8 +117,8 @@ var StaticRepresentationIndex = /** @class */ (function () {
117
117
  /**
118
118
  * @returns {Boolean}
119
119
  */
120
- StaticRepresentationIndex.prototype.isFinished = function () {
121
- return true;
120
+ StaticRepresentationIndex.prototype.isStillAwaitingFutureSegments = function () {
121
+ return false;
122
122
  };
123
123
  /**
124
124
  * @returns {Boolean}
@@ -304,7 +304,7 @@ export interface IRepresentationIndex {
304
304
  getLastAvailablePosition(): number | null | undefined;
305
305
  /**
306
306
  * Returns the ending time, in seconds, of the Representation once it is
307
- * "finished" (@see isFinished).
307
+ * "finished" (@see isStillAwaitingFutureSegments).
308
308
  * Should thus be equivalent to `getLastAvailablePosition` once finished.
309
309
  *
310
310
  * Returns `null` if nothing is in the index
@@ -352,13 +352,13 @@ export interface IRepresentationIndex {
352
352
  */
353
353
  checkDiscontinuity(time: number): number | null;
354
354
  /**
355
- * Returns `true` if the last segments in this index have already been
355
+ * Returns `false` if the last segments in this index have already been
356
356
  * generated so that we can freely go to the next period.
357
- * Returns `false` if the index is still waiting on future segments to be
357
+ * Returns `true` if the index is still waiting on future segments to be
358
358
  * generated.
359
359
  * @returns {boolean}
360
360
  */
361
- isFinished(): boolean;
361
+ isStillAwaitingFutureSegments(): boolean;
362
362
  /**
363
363
  * Returns `true` if this index has all the data it needs to give the list
364
364
  * of available segments.
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Converts SCTE 214 supplemental codec string into RFC4281 codec string
3
+ *
4
+ * The returned value is a codec string respecting RFC6381
5
+ *
6
+ * SCTE 214 defines supplemental codecs as a whitespace-separated multiple list of
7
+ * codec strings
8
+ *
9
+ * RFC6381 defines codecs as a comma-separated list of codec strings.
10
+ *
11
+ * This two syntax differs and this parser is used to convert SCTE214
12
+ * to be compliant with what MSE APIs expect
13
+ *
14
+ * @param {string} val - The codec string to parse
15
+ * @returns { Array.<string | undefined | null>}
16
+ */
17
+ export declare function convertSupplementalCodecsToRFC6381(val: string): string;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.convertSupplementalCodecsToRFC6381 = void 0;
4
+ var is_non_empty_string_1 = require("../../../../utils/is_non_empty_string");
5
+ var supplementalCodecSeparator = /[, ]+/g;
6
+ /**
7
+ * Converts SCTE 214 supplemental codec string into RFC4281 codec string
8
+ *
9
+ * The returned value is a codec string respecting RFC6381
10
+ *
11
+ * SCTE 214 defines supplemental codecs as a whitespace-separated multiple list of
12
+ * codec strings
13
+ *
14
+ * RFC6381 defines codecs as a comma-separated list of codec strings.
15
+ *
16
+ * This two syntax differs and this parser is used to convert SCTE214
17
+ * to be compliant with what MSE APIs expect
18
+ *
19
+ * @param {string} val - The codec string to parse
20
+ * @returns { Array.<string | undefined | null>}
21
+ */
22
+ function convertSupplementalCodecsToRFC6381(val) {
23
+ if ((0, is_non_empty_string_1.default)(val)) {
24
+ return val
25
+ .trim()
26
+ .replace(supplementalCodecSeparator, ", ");
27
+ }
28
+ return "";
29
+ }
30
+ exports.convertSupplementalCodecsToRFC6381 = convertSupplementalCodecsToRFC6381;
@@ -67,6 +67,11 @@ function flattenOverlappingPeriods(parsedPeriods) {
67
67
  // `lastFlattenedPeriod` has now a negative or `0` duration.
68
68
  // Remove it, consider the next Period in its place, and re-start the loop.
69
69
  flattenedPeriods.pop();
70
+ if (flattenedPeriods.length === 0) {
71
+ // There's no remaining Period to compare to `parsedPeriod`
72
+ break;
73
+ }
74
+ // Take the previous Period as reference and compare it now to `parsedPeriod`
70
75
  lastFlattenedPeriod = flattenedPeriods[flattenedPeriods.length - 1];
71
76
  }
72
77
  }