rx-player 3.33.4-dev.2024083000 → 3.33.4

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 (730) hide show
  1. package/.prettierignore +1 -0
  2. package/.prettierrc +4 -0
  3. package/.vscode/settings.json +9 -0
  4. package/CHANGELOG.md +1662 -1076
  5. package/MAINTAINERS.md +9 -12
  6. package/README.md +111 -127
  7. package/VERSION +1 -1
  8. package/dist/_esm5.processed/compat/add_class_name.js +4 -3
  9. package/dist/_esm5.processed/compat/add_text_track.d.ts +1 -1
  10. package/dist/_esm5.processed/compat/add_text_track.js +4 -4
  11. package/dist/_esm5.processed/compat/browser_compatibility_types.d.ts +2 -1
  12. package/dist/_esm5.processed/compat/browser_compatibility_types.js +15 -10
  13. package/dist/_esm5.processed/compat/browser_detection.d.ts +3 -1
  14. package/dist/_esm5.processed/compat/browser_detection.js +18 -10
  15. package/dist/_esm5.processed/compat/can_reuse_media_keys.d.ts +4 -0
  16. package/dist/_esm5.processed/compat/can_reuse_media_keys.js +6 -2
  17. package/dist/_esm5.processed/compat/change_source_buffer_type.d.ts +1 -1
  18. package/dist/_esm5.processed/compat/eme/close_session.d.ts +1 -1
  19. package/dist/_esm5.processed/compat/eme/close_session.js +17 -13
  20. package/dist/_esm5.processed/compat/eme/custom_key_system_access.d.ts +1 -1
  21. package/dist/_esm5.processed/compat/eme/custom_media_keys/ie11_media_keys.d.ts +1 -1
  22. package/dist/_esm5.processed/compat/eme/custom_media_keys/ie11_media_keys.js +8 -9
  23. package/dist/_esm5.processed/compat/eme/custom_media_keys/index.d.ts +3 -2
  24. package/dist/_esm5.processed/compat/eme/custom_media_keys/index.js +1 -1
  25. package/dist/_esm5.processed/compat/eme/custom_media_keys/moz_media_keys_constructor.d.ts +1 -1
  26. package/dist/_esm5.processed/compat/eme/custom_media_keys/old_webkit_media_keys.d.ts +1 -1
  27. package/dist/_esm5.processed/compat/eme/custom_media_keys/old_webkit_media_keys.js +7 -9
  28. package/dist/_esm5.processed/compat/eme/custom_media_keys/types.d.ts +4 -1
  29. package/dist/_esm5.processed/compat/eme/custom_media_keys/webkit_media_keys.d.ts +2 -2
  30. package/dist/_esm5.processed/compat/eme/custom_media_keys/webkit_media_keys.js +6 -12
  31. package/dist/_esm5.processed/compat/eme/custom_media_keys/webkit_media_keys_constructor.d.ts +2 -1
  32. package/dist/_esm5.processed/compat/eme/custom_media_keys/webkit_media_keys_constructor.js +3 -3
  33. package/dist/_esm5.processed/compat/eme/eme-api-implementation.d.ts +4 -4
  34. package/dist/_esm5.processed/compat/eme/eme-api-implementation.js +26 -11
  35. package/dist/_esm5.processed/compat/eme/generate_key_request.d.ts +1 -1
  36. package/dist/_esm5.processed/compat/eme/generate_key_request.js +17 -20
  37. package/dist/_esm5.processed/compat/eme/get_init_data.d.ts +3 -1
  38. package/dist/_esm5.processed/compat/eme/get_init_data.js +7 -9
  39. package/dist/_esm5.processed/compat/eme/get_uuid_kid_from_keystatus_kid.js +2 -3
  40. package/dist/_esm5.processed/compat/eme/get_webkit_fairplay_initdata.js +12 -13
  41. package/dist/_esm5.processed/compat/eme/index.d.ts +8 -5
  42. package/dist/_esm5.processed/compat/eme/index.js +1 -1
  43. package/dist/_esm5.processed/compat/eme/load_session.d.ts +1 -1
  44. package/dist/_esm5.processed/compat/enable_audio_track.d.ts +1 -1
  45. package/dist/_esm5.processed/compat/event_listeners.d.ts +26 -24
  46. package/dist/_esm5.processed/compat/event_listeners.js +14 -29
  47. package/dist/_esm5.processed/compat/fullscreen.d.ts +1 -1
  48. package/dist/_esm5.processed/compat/fullscreen.js +1 -1
  49. package/dist/_esm5.processed/compat/generate_init_data.js +3 -5
  50. package/dist/_esm5.processed/compat/index.d.ts +6 -3
  51. package/dist/_esm5.processed/compat/index.js +2 -2
  52. package/dist/_esm5.processed/compat/is_vtt_cue.d.ts +1 -1
  53. package/dist/_esm5.processed/compat/make_vtt_cue.d.ts +1 -1
  54. package/dist/_esm5.processed/compat/on_height_width_change.d.ts +2 -2
  55. package/dist/_esm5.processed/compat/on_height_width_change.js +3 -2
  56. package/dist/_esm5.processed/compat/patch_webkit_source_buffer.js +28 -29
  57. package/dist/_esm5.processed/compat/should_favour_custom_safari_EME.js +2 -2
  58. package/dist/_esm5.processed/compat/should_reload_media_source_on_decipherability_update.js +1 -2
  59. package/dist/_esm5.processed/config.d.ts +1 -1
  60. package/dist/_esm5.processed/config.js +0 -15
  61. package/dist/_esm5.processed/core/adaptive/adaptive_representation_selector.d.ts +7 -6
  62. package/dist/_esm5.processed/core/adaptive/adaptive_representation_selector.js +45 -22
  63. package/dist/_esm5.processed/core/adaptive/buffer_based_chooser.d.ts +1 -1
  64. package/dist/_esm5.processed/core/adaptive/buffer_based_chooser.js +11 -10
  65. package/dist/_esm5.processed/core/adaptive/guess_based_chooser.d.ts +4 -4
  66. package/dist/_esm5.processed/core/adaptive/guess_based_chooser.js +7 -6
  67. package/dist/_esm5.processed/core/adaptive/index.d.ts +3 -2
  68. package/dist/_esm5.processed/core/adaptive/network_analyzer.d.ts +4 -4
  69. package/dist/_esm5.processed/core/adaptive/network_analyzer.js +43 -38
  70. package/dist/_esm5.processed/core/adaptive/utils/bandwidth_estimator.js +1 -1
  71. package/dist/_esm5.processed/core/adaptive/utils/ewma.js +1 -2
  72. package/dist/_esm5.processed/core/adaptive/utils/filter_by_bitrate.d.ts +1 -1
  73. package/dist/_esm5.processed/core/adaptive/utils/filter_by_width.d.ts +1 -1
  74. package/dist/_esm5.processed/core/adaptive/utils/filter_by_width.js +3 -6
  75. package/dist/_esm5.processed/core/adaptive/utils/get_buffer_levels.js +7 -4
  76. package/dist/_esm5.processed/core/adaptive/utils/last_estimate_storage.d.ts +1 -1
  77. package/dist/_esm5.processed/core/adaptive/utils/pending_requests_store.d.ts +2 -1
  78. package/dist/_esm5.processed/core/adaptive/utils/representation_score_calculator.d.ts +1 -1
  79. package/dist/_esm5.processed/core/adaptive/utils/representation_score_calculator.js +8 -5
  80. package/dist/_esm5.processed/core/adaptive/utils/select_optimal_representation.d.ts +1 -1
  81. package/dist/_esm5.processed/core/adaptive/utils/select_optimal_representation.js +5 -3
  82. package/dist/_esm5.processed/core/api/debug/buffer_graph.d.ts +1 -1
  83. package/dist/_esm5.processed/core/api/debug/buffer_graph.js +3 -8
  84. package/dist/_esm5.processed/core/api/debug/buffer_size_graph.js +1 -2
  85. package/dist/_esm5.processed/core/api/debug/modules/general_info.d.ts +2 -2
  86. package/dist/_esm5.processed/core/api/debug/modules/general_info.js +17 -13
  87. package/dist/_esm5.processed/core/api/debug/modules/segment_buffer_content.d.ts +3 -3
  88. package/dist/_esm5.processed/core/api/debug/modules/segment_buffer_content.js +4 -2
  89. package/dist/_esm5.processed/core/api/debug/modules/segment_buffer_size.d.ts +2 -2
  90. package/dist/_esm5.processed/core/api/debug/modules/segment_buffer_size.js +1 -1
  91. package/dist/_esm5.processed/core/api/debug/render.d.ts +2 -2
  92. package/dist/_esm5.processed/core/api/debug/utils.d.ts +5 -5
  93. package/dist/_esm5.processed/core/api/index.d.ts +1 -1
  94. package/dist/_esm5.processed/core/api/option_utils.d.ts +3 -3
  95. package/dist/_esm5.processed/core/api/option_utils.js +85 -48
  96. package/dist/_esm5.processed/core/api/playback_observer.d.ts +16 -18
  97. package/dist/_esm5.processed/core/api/playback_observer.js +65 -42
  98. package/dist/_esm5.processed/core/api/public_api.d.ts +10 -9
  99. package/dist/_esm5.processed/core/api/public_api.js +103 -94
  100. package/dist/_esm5.processed/core/api/tracks_management/media_element_track_choice_manager.d.ts +1 -1
  101. package/dist/_esm5.processed/core/api/tracks_management/media_element_track_choice_manager.js +25 -14
  102. package/dist/_esm5.processed/core/api/tracks_management/track_choice_manager.d.ts +3 -3
  103. package/dist/_esm5.processed/core/api/tracks_management/track_choice_manager.js +72 -80
  104. package/dist/_esm5.processed/core/api/utils.d.ts +5 -5
  105. package/dist/_esm5.processed/core/api/utils.js +5 -8
  106. package/dist/_esm5.processed/core/decrypt/__tests__/__global__/utils.d.ts +12 -54
  107. package/dist/_esm5.processed/core/decrypt/__tests__/__global__/utils.js +55 -66
  108. package/dist/_esm5.processed/core/decrypt/attach_media_keys.d.ts +10 -5
  109. package/dist/_esm5.processed/core/decrypt/attach_media_keys.js +16 -8
  110. package/dist/_esm5.processed/core/decrypt/content_decryptor.d.ts +11 -2
  111. package/dist/_esm5.processed/core/decrypt/content_decryptor.js +136 -65
  112. package/dist/_esm5.processed/core/decrypt/create_or_load_session.d.ts +5 -4
  113. package/dist/_esm5.processed/core/decrypt/create_or_load_session.js +18 -7
  114. package/dist/_esm5.processed/core/decrypt/create_session.d.ts +5 -4
  115. package/dist/_esm5.processed/core/decrypt/create_session.js +6 -12
  116. package/dist/_esm5.processed/core/decrypt/dispose_decryption_resources.js +1 -2
  117. package/dist/_esm5.processed/core/decrypt/find_key_system.d.ts +13 -3
  118. package/dist/_esm5.processed/core/decrypt/find_key_system.js +45 -22
  119. package/dist/_esm5.processed/core/decrypt/get_key_system_configuration.js +1 -2
  120. package/dist/_esm5.processed/core/decrypt/get_media_keys.d.ts +9 -4
  121. package/dist/_esm5.processed/core/decrypt/get_media_keys.js +17 -6
  122. package/dist/_esm5.processed/core/decrypt/init_media_keys.d.ts +3 -3
  123. package/dist/_esm5.processed/core/decrypt/session_events_listener.d.ts +2 -2
  124. package/dist/_esm5.processed/core/decrypt/session_events_listener.js +12 -16
  125. package/dist/_esm5.processed/core/decrypt/set_server_certificate.d.ts +3 -3
  126. package/dist/_esm5.processed/core/decrypt/set_server_certificate.js +6 -7
  127. package/dist/_esm5.processed/core/decrypt/types.d.ts +11 -5
  128. package/dist/_esm5.processed/core/decrypt/utils/are_init_values_compatible.js +20 -12
  129. package/dist/_esm5.processed/core/decrypt/utils/check_key_statuses.d.ts +2 -2
  130. package/dist/_esm5.processed/core/decrypt/utils/check_key_statuses.js +5 -4
  131. package/dist/_esm5.processed/core/decrypt/utils/clean_old_loaded_sessions.d.ts +1 -1
  132. package/dist/_esm5.processed/core/decrypt/utils/clean_old_stored_persistent_info.d.ts +1 -1
  133. package/dist/_esm5.processed/core/decrypt/utils/init_data_values_container.d.ts +1 -1
  134. package/dist/_esm5.processed/core/decrypt/utils/init_data_values_container.js +16 -9
  135. package/dist/_esm5.processed/core/decrypt/utils/is_session_usable.d.ts +1 -1
  136. package/dist/_esm5.processed/core/decrypt/utils/is_session_usable.js +1 -2
  137. package/dist/_esm5.processed/core/decrypt/utils/key_session_record.d.ts +1 -1
  138. package/dist/_esm5.processed/core/decrypt/utils/key_session_record.js +1 -2
  139. package/dist/_esm5.processed/core/decrypt/utils/loaded_sessions_store.d.ts +11 -13
  140. package/dist/_esm5.processed/core/decrypt/utils/loaded_sessions_store.js +13 -13
  141. package/dist/_esm5.processed/core/decrypt/utils/media_keys_infos_store.d.ts +8 -3
  142. package/dist/_esm5.processed/core/decrypt/utils/media_keys_infos_store.js +1 -2
  143. package/dist/_esm5.processed/core/decrypt/utils/persistent_sessions_store.d.ts +3 -3
  144. package/dist/_esm5.processed/core/decrypt/utils/persistent_sessions_store.js +27 -16
  145. package/dist/_esm5.processed/core/decrypt/utils/serializable_bytes.js +1 -1
  146. package/dist/_esm5.processed/core/decrypt/utils/server_certificate_store.d.ts +1 -1
  147. package/dist/_esm5.processed/core/decrypt/utils/server_certificate_store.js +19 -12
  148. package/dist/_esm5.processed/core/fetchers/cdn_prioritizer.d.ts +2 -2
  149. package/dist/_esm5.processed/core/fetchers/cdn_prioritizer.js +5 -6
  150. package/dist/_esm5.processed/core/fetchers/index.d.ts +6 -3
  151. package/dist/_esm5.processed/core/fetchers/index.js +1 -1
  152. package/dist/_esm5.processed/core/fetchers/manifest/index.d.ts +3 -2
  153. package/dist/_esm5.processed/core/fetchers/manifest/manifest_fetcher.d.ts +2 -2
  154. package/dist/_esm5.processed/core/fetchers/manifest/manifest_fetcher.js +68 -61
  155. package/dist/_esm5.processed/core/fetchers/segment/index.d.ts +4 -3
  156. package/dist/_esm5.processed/core/fetchers/segment/prioritized_segment_fetcher.d.ts +4 -3
  157. package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.d.ts +9 -8
  158. package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.js +41 -29
  159. package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher_creator.d.ts +5 -5
  160. package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher_creator.js +2 -3
  161. package/dist/_esm5.processed/core/fetchers/segment/task_prioritizer.d.ts +1 -1
  162. package/dist/_esm5.processed/core/fetchers/segment/task_prioritizer.js +19 -18
  163. package/dist/_esm5.processed/core/fetchers/utils/error_selector.d.ts +1 -1
  164. package/dist/_esm5.processed/core/fetchers/utils/error_selector.js +1 -1
  165. package/dist/_esm5.processed/core/fetchers/utils/schedule_request.d.ts +3 -3
  166. package/dist/_esm5.processed/core/fetchers/utils/schedule_request.js +25 -25
  167. package/dist/_esm5.processed/core/init/directfile_content_initializer.d.ts +4 -4
  168. package/dist/_esm5.processed/core/init/directfile_content_initializer.js +21 -17
  169. package/dist/_esm5.processed/core/init/index.d.ts +2 -1
  170. package/dist/_esm5.processed/core/init/index.js +1 -1
  171. package/dist/_esm5.processed/core/init/media_source_content_initializer.d.ts +9 -9
  172. package/dist/_esm5.processed/core/init/media_source_content_initializer.js +64 -32
  173. package/dist/_esm5.processed/core/init/types.d.ts +10 -12
  174. package/dist/_esm5.processed/core/init/utils/content_time_boundaries_observer.d.ts +6 -5
  175. package/dist/_esm5.processed/core/init/utils/content_time_boundaries_observer.js +20 -19
  176. package/dist/_esm5.processed/core/init/utils/create_media_source.d.ts +1 -1
  177. package/dist/_esm5.processed/core/init/utils/create_media_source.js +2 -3
  178. package/dist/_esm5.processed/core/init/utils/create_stream_playback_observer.d.ts +6 -6
  179. package/dist/_esm5.processed/core/init/utils/create_stream_playback_observer.js +5 -3
  180. package/dist/_esm5.processed/core/init/utils/end_of_stream.d.ts +1 -1
  181. package/dist/_esm5.processed/core/init/utils/get_initial_time.d.ts +1 -1
  182. package/dist/_esm5.processed/core/init/utils/get_initial_time.js +12 -15
  183. package/dist/_esm5.processed/core/init/utils/get_loaded_reference.d.ts +3 -3
  184. package/dist/_esm5.processed/core/init/utils/get_loaded_reference.js +1 -2
  185. package/dist/_esm5.processed/core/init/utils/initial_seek_and_play.d.ts +9 -9
  186. package/dist/_esm5.processed/core/init/utils/initial_seek_and_play.js +39 -3
  187. package/dist/_esm5.processed/core/init/utils/initialize_content_decryption.d.ts +9 -8
  188. package/dist/_esm5.processed/core/init/utils/initialize_content_decryption.js +12 -9
  189. package/dist/_esm5.processed/core/init/utils/media_source_duration_updater.js +10 -7
  190. package/dist/_esm5.processed/core/init/utils/rebuffering_controller.d.ts +7 -6
  191. package/dist/_esm5.processed/core/init/utils/rebuffering_controller.js +24 -24
  192. package/dist/_esm5.processed/core/init/utils/stream_events_emitter/are_same_stream_events.js +1 -3
  193. package/dist/_esm5.processed/core/init/utils/stream_events_emitter/index.d.ts +1 -1
  194. package/dist/_esm5.processed/core/init/utils/stream_events_emitter/refresh_scheduled_events_list.d.ts +2 -2
  195. package/dist/_esm5.processed/core/init/utils/stream_events_emitter/refresh_scheduled_events_list.js +14 -6
  196. package/dist/_esm5.processed/core/init/utils/stream_events_emitter/stream_events_emitter.d.ts +3 -3
  197. package/dist/_esm5.processed/core/init/utils/stream_events_emitter/stream_events_emitter.js +12 -19
  198. package/dist/_esm5.processed/core/init/utils/stream_events_emitter/types.d.ts +1 -1
  199. package/dist/_esm5.processed/core/init/utils/throw_on_media_error.d.ts +1 -1
  200. package/dist/_esm5.processed/core/init/utils/throw_on_media_error.js +11 -6
  201. package/dist/_esm5.processed/core/segment_buffers/garbage_collector.d.ts +6 -6
  202. package/dist/_esm5.processed/core/segment_buffers/garbage_collector.js +12 -13
  203. package/dist/_esm5.processed/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.d.ts +3 -2
  204. package/dist/_esm5.processed/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.js +6 -9
  205. package/dist/_esm5.processed/core/segment_buffers/implementations/image/image_segment_buffer.d.ts +3 -2
  206. package/dist/_esm5.processed/core/segment_buffers/implementations/image/image_segment_buffer.js +1 -1
  207. package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/html_text_segment_buffer.d.ts +2 -1
  208. package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/html_text_segment_buffer.js +7 -7
  209. package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/text_track_cues_store.d.ts +1 -1
  210. package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/text_track_cues_store.js +4 -4
  211. package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/update_proportional_elements.js +1 -2
  212. package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/utils.d.ts +1 -1
  213. package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/utils.js +2 -6
  214. package/dist/_esm5.processed/core/segment_buffers/implementations/text/native/native_text_segment_buffer.d.ts +2 -1
  215. package/dist/_esm5.processed/core/segment_buffers/implementations/text/native/native_text_segment_buffer.js +2 -2
  216. package/dist/_esm5.processed/core/segment_buffers/implementations/text/native/parsers.d.ts +1 -1
  217. package/dist/_esm5.processed/core/segment_buffers/implementations/types.d.ts +5 -7
  218. package/dist/_esm5.processed/core/segment_buffers/implementations/utils/manual_time_ranges.js +1 -1
  219. package/dist/_esm5.processed/core/segment_buffers/index.d.ts +8 -4
  220. package/dist/_esm5.processed/core/segment_buffers/index.js +2 -2
  221. package/dist/_esm5.processed/core/segment_buffers/inventory/buffered_history.d.ts +1 -1
  222. package/dist/_esm5.processed/core/segment_buffers/inventory/index.d.ts +6 -4
  223. package/dist/_esm5.processed/core/segment_buffers/inventory/segment_inventory.d.ts +4 -4
  224. package/dist/_esm5.processed/core/segment_buffers/inventory/segment_inventory.js +63 -54
  225. package/dist/_esm5.processed/core/segment_buffers/inventory/types.d.ts +1 -1
  226. package/dist/_esm5.processed/core/segment_buffers/segment_buffers_store.d.ts +2 -2
  227. package/dist/_esm5.processed/core/segment_buffers/segment_buffers_store.js +17 -23
  228. package/dist/_esm5.processed/core/stream/adaptation/adaptation_stream.d.ts +3 -3
  229. package/dist/_esm5.processed/core/stream/adaptation/adaptation_stream.js +49 -22
  230. package/dist/_esm5.processed/core/stream/adaptation/types.d.ts +8 -7
  231. package/dist/_esm5.processed/core/stream/adaptation/utils/create_representation_estimator.d.ts +7 -6
  232. package/dist/_esm5.processed/core/stream/adaptation/utils/create_representation_estimator.js +2 -1
  233. package/dist/_esm5.processed/core/stream/index.d.ts +6 -5
  234. package/dist/_esm5.processed/core/stream/orchestrator/get_time_ranges_for_content.d.ts +3 -3
  235. package/dist/_esm5.processed/core/stream/orchestrator/get_time_ranges_for_content.js +2 -2
  236. package/dist/_esm5.processed/core/stream/orchestrator/index.d.ts +3 -2
  237. package/dist/_esm5.processed/core/stream/orchestrator/stream_orchestrator.d.ts +9 -7
  238. package/dist/_esm5.processed/core/stream/orchestrator/stream_orchestrator.js +47 -34
  239. package/dist/_esm5.processed/core/stream/period/period_stream.d.ts +3 -3
  240. package/dist/_esm5.processed/core/stream/period/period_stream.js +49 -16
  241. package/dist/_esm5.processed/core/stream/period/types.d.ts +15 -12
  242. package/dist/_esm5.processed/core/stream/period/utils/get_adaptation_switch_strategy.d.ts +9 -9
  243. package/dist/_esm5.processed/core/stream/period/utils/get_adaptation_switch_strategy.js +26 -25
  244. package/dist/_esm5.processed/core/stream/representation/representation_stream.d.ts +3 -3
  245. package/dist/_esm5.processed/core/stream/representation/representation_stream.js +47 -23
  246. package/dist/_esm5.processed/core/stream/representation/types.d.ts +9 -8
  247. package/dist/_esm5.processed/core/stream/representation/utils/append_segment_to_buffer.d.ts +4 -4
  248. package/dist/_esm5.processed/core/stream/representation/utils/append_segment_to_buffer.js +10 -7
  249. package/dist/_esm5.processed/core/stream/representation/utils/check_for_discontinuity.d.ts +4 -3
  250. package/dist/_esm5.processed/core/stream/representation/utils/check_for_discontinuity.js +16 -18
  251. package/dist/_esm5.processed/core/stream/representation/utils/downloading_queue.d.ts +7 -6
  252. package/dist/_esm5.processed/core/stream/representation/utils/downloading_queue.js +11 -11
  253. package/dist/_esm5.processed/core/stream/representation/utils/force_garbage_collection.d.ts +2 -2
  254. package/dist/_esm5.processed/core/stream/representation/utils/force_garbage_collection.js +6 -8
  255. package/dist/_esm5.processed/core/stream/representation/utils/get_buffer_status.d.ts +5 -4
  256. package/dist/_esm5.processed/core/stream/representation/utils/get_buffer_status.js +40 -19
  257. package/dist/_esm5.processed/core/stream/representation/utils/get_needed_segments.d.ts +4 -3
  258. package/dist/_esm5.processed/core/stream/representation/utils/get_needed_segments.js +27 -28
  259. package/dist/_esm5.processed/core/stream/representation/utils/push_init_segment.d.ts +6 -5
  260. package/dist/_esm5.processed/core/stream/representation/utils/push_init_segment.js +7 -5
  261. package/dist/_esm5.processed/core/stream/representation/utils/push_media_segment.d.ts +8 -7
  262. package/dist/_esm5.processed/core/stream/representation/utils/push_media_segment.js +13 -10
  263. package/dist/_esm5.processed/default_config.js +20 -16
  264. package/dist/_esm5.processed/errors/encrypted_media_error.d.ts +2 -2
  265. package/dist/_esm5.processed/errors/encrypted_media_error.js +1 -1
  266. package/dist/_esm5.processed/errors/error_codes.d.ts +1 -1
  267. package/dist/_esm5.processed/errors/error_codes.js +1 -1
  268. package/dist/_esm5.processed/errors/format_error.d.ts +2 -2
  269. package/dist/_esm5.processed/errors/format_error.js +1 -2
  270. package/dist/_esm5.processed/errors/index.d.ts +6 -3
  271. package/dist/_esm5.processed/errors/index.js +2 -2
  272. package/dist/_esm5.processed/errors/is_known_error.d.ts +1 -1
  273. package/dist/_esm5.processed/errors/is_known_error.js +2 -2
  274. package/dist/_esm5.processed/errors/media_error.d.ts +3 -3
  275. package/dist/_esm5.processed/errors/media_error.js +4 -7
  276. package/dist/_esm5.processed/errors/network_error.d.ts +2 -2
  277. package/dist/_esm5.processed/errors/network_error.js +3 -3
  278. package/dist/_esm5.processed/errors/other_error.d.ts +1 -1
  279. package/dist/_esm5.processed/errors/other_error.js +1 -1
  280. package/dist/_esm5.processed/errors/request_error.d.ts +1 -1
  281. package/dist/_esm5.processed/experimental/features/dash_wasm.d.ts +2 -2
  282. package/dist/_esm5.processed/experimental/features/debug_element.d.ts +1 -1
  283. package/dist/_esm5.processed/experimental/features/local.d.ts +1 -1
  284. package/dist/_esm5.processed/experimental/features/metaplaylist.d.ts +1 -1
  285. package/dist/_esm5.processed/experimental/index.d.ts +1 -1
  286. package/dist/_esm5.processed/experimental/index.js +1 -1
  287. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/features/dash.d.ts +1 -1
  288. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/features/metaplaylist.d.ts +1 -1
  289. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/index.d.ts +1 -1
  290. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/index.js +2 -2
  291. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/load_and_push_segment.d.ts +3 -3
  292. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/load_and_push_segment.js +7 -3
  293. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/prepare_source_buffer.d.ts +1 -1
  294. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/prepare_source_buffer.js +1 -2
  295. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/remove_buffer_around_time.d.ts +2 -2
  296. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/remove_buffer_around_time.js +2 -2
  297. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/types.d.ts +3 -2
  298. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.d.ts +2 -2
  299. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.js +12 -18
  300. package/dist/_esm5.processed/experimental/tools/createMetaplaylist/get_duration_from_manifest.js +13 -23
  301. package/dist/_esm5.processed/experimental/tools/createMetaplaylist/index.d.ts +1 -1
  302. package/dist/_esm5.processed/experimental/tools/createMetaplaylist/index.js +8 -7
  303. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/api/index.d.ts +1 -1
  304. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/api/index.js +9 -13
  305. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/api/probeMediaConfiguration.d.ts +4 -3
  306. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/api/probeMediaConfiguration.js +5 -3
  307. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/capabilities.d.ts +1 -1
  308. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/capabilities.js +10 -47
  309. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/DRMInfos.d.ts +2 -1
  310. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/DRMInfos.js +8 -5
  311. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/HDCPPolicy.d.ts +2 -1
  312. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/HDCPPolicy.js +21 -13
  313. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/decodingInfo.d.ts +2 -1
  314. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/decodingInfo.js +22 -18
  315. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/defaultCodecsFinder.js +4 -7
  316. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/index.d.ts +1 -1
  317. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/mediaContentType.d.ts +2 -1
  318. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/mediaContentType.js +3 -5
  319. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/mediaContentTypeWithFeatures/format.d.ts +1 -1
  320. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/mediaContentTypeWithFeatures/format.js +4 -10
  321. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/mediaContentTypeWithFeatures/index.d.ts +2 -1
  322. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/mediaContentTypeWithFeatures/index.js +2 -3
  323. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/mediaDisplayInfos.d.ts +2 -1
  324. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/mediaDisplayInfos.js +2 -3
  325. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/types.d.ts +2 -2
  326. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/utils.d.ts +1 -1
  327. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/utils.js +6 -6
  328. package/dist/_esm5.processed/experimental/tools/parseBIFThumbnails.js +5 -4
  329. package/dist/_esm5.processed/features/add_features.d.ts +1 -1
  330. package/dist/_esm5.processed/features/features_object.d.ts +1 -1
  331. package/dist/_esm5.processed/features/features_object.js +4 -3
  332. package/dist/_esm5.processed/features/index.d.ts +3 -2
  333. package/dist/_esm5.processed/features/index.js +1 -1
  334. package/dist/_esm5.processed/features/list/bif_parser.d.ts +1 -1
  335. package/dist/_esm5.processed/features/list/dash.d.ts +1 -1
  336. package/dist/_esm5.processed/features/list/directfile.d.ts +1 -1
  337. package/dist/_esm5.processed/features/list/eme.d.ts +1 -1
  338. package/dist/_esm5.processed/features/list/html_sami_parser.d.ts +1 -1
  339. package/dist/_esm5.processed/features/list/html_srt_parser.d.ts +1 -1
  340. package/dist/_esm5.processed/features/list/html_text_buffer.d.ts +1 -1
  341. package/dist/_esm5.processed/features/list/html_ttml_parser.d.ts +1 -1
  342. package/dist/_esm5.processed/features/list/html_vtt_parser.d.ts +1 -1
  343. package/dist/_esm5.processed/features/list/image_buffer.d.ts +1 -1
  344. package/dist/_esm5.processed/features/list/native_sami_parser.d.ts +1 -1
  345. package/dist/_esm5.processed/features/list/native_srt_parser.d.ts +1 -1
  346. package/dist/_esm5.processed/features/list/native_text_buffer.d.ts +1 -1
  347. package/dist/_esm5.processed/features/list/native_ttml_parser.d.ts +1 -1
  348. package/dist/_esm5.processed/features/list/native_vtt_parser.d.ts +1 -1
  349. package/dist/_esm5.processed/features/list/smooth.d.ts +1 -1
  350. package/dist/_esm5.processed/features/types.d.ts +11 -11
  351. package/dist/_esm5.processed/manifest/adaptation.d.ts +3 -3
  352. package/dist/_esm5.processed/manifest/adaptation.js +24 -14
  353. package/dist/_esm5.processed/manifest/index.d.ts +9 -5
  354. package/dist/_esm5.processed/manifest/index.js +4 -8
  355. package/dist/_esm5.processed/manifest/manifest.d.ts +8 -7
  356. package/dist/_esm5.processed/manifest/manifest.js +37 -33
  357. package/dist/_esm5.processed/manifest/period.d.ts +4 -4
  358. package/dist/_esm5.processed/manifest/period.js +7 -14
  359. package/dist/_esm5.processed/manifest/representation.d.ts +4 -4
  360. package/dist/_esm5.processed/manifest/representation.js +5 -5
  361. package/dist/_esm5.processed/manifest/representation_index/index.d.ts +3 -2
  362. package/dist/_esm5.processed/manifest/representation_index/index.js +1 -1
  363. package/dist/_esm5.processed/manifest/representation_index/static.d.ts +1 -1
  364. package/dist/_esm5.processed/manifest/representation_index/static.js +6 -2
  365. package/dist/_esm5.processed/manifest/representation_index/types.d.ts +6 -5
  366. package/dist/_esm5.processed/manifest/update_period_in_place.d.ts +3 -3
  367. package/dist/_esm5.processed/manifest/update_period_in_place.js +9 -9
  368. package/dist/_esm5.processed/manifest/update_periods.d.ts +2 -2
  369. package/dist/_esm5.processed/manifest/update_periods.js +6 -3
  370. package/dist/_esm5.processed/manifest/utils.d.ts +4 -4
  371. package/dist/_esm5.processed/manifest/utils.js +6 -4
  372. package/dist/_esm5.processed/parsers/containers/isobmff/create_box.d.ts +1 -1
  373. package/dist/_esm5.processed/parsers/containers/isobmff/create_box.js +5 -4
  374. package/dist/_esm5.processed/parsers/containers/isobmff/drm/playready.js +2 -3
  375. package/dist/_esm5.processed/parsers/containers/isobmff/get_box.js +3 -5
  376. package/dist/_esm5.processed/parsers/containers/isobmff/index.d.ts +5 -4
  377. package/dist/_esm5.processed/parsers/containers/isobmff/index.js +4 -4
  378. package/dist/_esm5.processed/parsers/containers/isobmff/read.d.ts +1 -1
  379. package/dist/_esm5.processed/parsers/containers/isobmff/read.js +9 -9
  380. package/dist/_esm5.processed/parsers/containers/isobmff/take_pssh_out.js +3 -4
  381. package/dist/_esm5.processed/parsers/containers/isobmff/utils.js +51 -41
  382. package/dist/_esm5.processed/parsers/containers/matroska/index.d.ts +2 -1
  383. package/dist/_esm5.processed/parsers/containers/matroska/index.js +1 -1
  384. package/dist/_esm5.processed/parsers/containers/matroska/utils.js +29 -16
  385. package/dist/_esm5.processed/parsers/images/bif.js +15 -5
  386. package/dist/_esm5.processed/parsers/manifest/dash/common/attach_trickmode_track.d.ts +1 -1
  387. package/dist/_esm5.processed/parsers/manifest/dash/common/convert_supplemental_codecs.js +1 -3
  388. package/dist/_esm5.processed/parsers/manifest/dash/common/flatten_overlapping_periods.d.ts +1 -1
  389. package/dist/_esm5.processed/parsers/manifest/dash/common/flatten_overlapping_periods.js +1 -1
  390. package/dist/_esm5.processed/parsers/manifest/dash/common/get_hdr_information.js +4 -12
  391. package/dist/_esm5.processed/parsers/manifest/dash/common/get_http_utc-timing_url.d.ts +1 -1
  392. package/dist/_esm5.processed/parsers/manifest/dash/common/get_http_utc-timing_url.js +4 -5
  393. package/dist/_esm5.processed/parsers/manifest/dash/common/get_minimum_and_maximum_positions.d.ts +1 -1
  394. package/dist/_esm5.processed/parsers/manifest/dash/common/get_minimum_and_maximum_positions.js +5 -2
  395. package/dist/_esm5.processed/parsers/manifest/dash/common/get_periods_time_infos.d.ts +1 -1
  396. package/dist/_esm5.processed/parsers/manifest/dash/common/get_periods_time_infos.js +5 -6
  397. package/dist/_esm5.processed/parsers/manifest/dash/common/index.d.ts +3 -2
  398. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/base.d.ts +4 -4
  399. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/base.js +34 -28
  400. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/get_init_segment.d.ts +2 -2
  401. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/get_init_segment.js +7 -4
  402. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/get_segments_from_timeline.d.ts +4 -4
  403. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/get_segments_from_timeline.js +15 -11
  404. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/index.d.ts +10 -5
  405. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/list.d.ts +2 -2
  406. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/list.js +30 -18
  407. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/template.d.ts +3 -3
  408. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/template.js +56 -55
  409. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_elements.d.ts +1 -1
  410. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_elements.js +2 -6
  411. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_previous_timeline.d.ts +1 -1
  412. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_previous_timeline.js +11 -15
  413. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/convert_element_to_index_segment.d.ts +1 -1
  414. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/convert_element_to_index_segment.js +12 -9
  415. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/find_first_common_start_time.d.ts +1 -1
  416. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/find_first_common_start_time.js +29 -19
  417. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/index.d.ts +3 -2
  418. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.d.ts +6 -6
  419. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.js +73 -59
  420. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/tokens.js +2 -4
  421. package/dist/_esm5.processed/parsers/manifest/dash/common/infer_adaptation_type.d.ts +1 -1
  422. package/dist/_esm5.processed/parsers/manifest/dash/common/manifest_bounds_calculator.js +7 -8
  423. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_adaptation_sets.d.ts +4 -4
  424. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_adaptation_sets.js +52 -50
  425. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_availability_start_time.d.ts +1 -1
  426. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_mpd.d.ts +6 -6
  427. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_mpd.js +52 -31
  428. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_periods.d.ts +4 -4
  429. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_periods.js +41 -30
  430. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representation_index.d.ts +4 -4
  431. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representation_index.js +1 -2
  432. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representations.d.ts +4 -4
  433. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representations.js +63 -64
  434. package/dist/_esm5.processed/parsers/manifest/dash/common/resolve_base_urls.d.ts +1 -1
  435. package/dist/_esm5.processed/parsers/manifest/dash/common/resolve_base_urls.js +4 -2
  436. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/AdaptationSet.d.ts +1 -1
  437. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/AdaptationSet.js +73 -37
  438. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/BaseURL.d.ts +1 -1
  439. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/BaseURL.js +1 -2
  440. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/ContentComponent.d.ts +1 -1
  441. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/ContentProtection.d.ts +1 -1
  442. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/EventStream.d.ts +1 -1
  443. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/EventStream.js +13 -7
  444. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/Initialization.d.ts +1 -1
  445. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/Initialization.js +5 -3
  446. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/MPD.d.ts +1 -1
  447. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/MPD.js +44 -27
  448. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/Period.d.ts +1 -1
  449. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/Period.js +14 -8
  450. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/Representation.d.ts +1 -1
  451. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/Representation.js +36 -18
  452. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/SegmentBase.d.ts +1 -1
  453. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/SegmentBase.js +36 -18
  454. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/SegmentList.d.ts +1 -1
  455. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/SegmentTemplate.d.ts +1 -1
  456. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/SegmentTemplate.js +17 -8
  457. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/SegmentTimeline.d.ts +1 -1
  458. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/SegmentURL.d.ts +1 -1
  459. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/SegmentURL.js +9 -5
  460. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/utils.d.ts +8 -26
  461. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/utils.js +6 -12
  462. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/parse_from_document.d.ts +2 -2
  463. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/parse_from_document.js +9 -4
  464. package/dist/_esm5.processed/parsers/manifest/dash/parsers_types.d.ts +2 -2
  465. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/index.d.ts +3 -2
  466. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/dash-wasm-parser.d.ts +1 -1
  467. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/dash-wasm-parser.js +29 -16
  468. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/AdaptationSet.d.ts +3 -2
  469. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/AdaptationSet.js +22 -35
  470. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/BaseURL.d.ts +2 -2
  471. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/ContentComponent.d.ts +2 -2
  472. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/ContentProtection.d.ts +2 -2
  473. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/ContentProtection.js +3 -1
  474. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/EventStream.d.ts +3 -2
  475. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/EventStream.js +2 -4
  476. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/Label.d.ts +3 -0
  477. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/Label.js +9 -0
  478. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/MPD.d.ts +3 -2
  479. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/MPD.js +5 -5
  480. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/Period.d.ts +3 -2
  481. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/Period.js +9 -6
  482. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/Representation.d.ts +3 -2
  483. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/Representation.js +8 -16
  484. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/Scheme.d.ts +2 -2
  485. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/SegmentBase.d.ts +2 -2
  486. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/SegmentBase.js +5 -10
  487. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/SegmentList.d.ts +3 -2
  488. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/SegmentTemplate.d.ts +2 -2
  489. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/SegmentTemplate.js +11 -18
  490. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/SegmentUrl.d.ts +2 -2
  491. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/SegmentUrl.js +2 -4
  492. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/XLink.d.ts +3 -2
  493. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/XLink.js +5 -5
  494. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/root.d.ts +2 -2
  495. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/root.js +5 -6
  496. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/parsers_stack.d.ts +1 -1
  497. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/parsers_stack.js +1 -2
  498. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/types.d.ts +2 -1
  499. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/utils.d.ts +1 -1
  500. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/utils.js +2 -4
  501. package/dist/_esm5.processed/parsers/manifest/local/index.d.ts +1 -1
  502. package/dist/_esm5.processed/parsers/manifest/local/parse_local_manifest.d.ts +2 -2
  503. package/dist/_esm5.processed/parsers/manifest/local/parse_local_manifest.js +25 -16
  504. package/dist/_esm5.processed/parsers/manifest/local/representation_index.d.ts +2 -2
  505. package/dist/_esm5.processed/parsers/manifest/local/representation_index.js +5 -10
  506. package/dist/_esm5.processed/parsers/manifest/metaplaylist/index.d.ts +3 -2
  507. package/dist/_esm5.processed/parsers/manifest/metaplaylist/metaplaylist_parser.d.ts +2 -2
  508. package/dist/_esm5.processed/parsers/manifest/metaplaylist/metaplaylist_parser.js +33 -29
  509. package/dist/_esm5.processed/parsers/manifest/metaplaylist/representation_index.d.ts +2 -2
  510. package/dist/_esm5.processed/parsers/manifest/metaplaylist/representation_index.js +9 -7
  511. package/dist/_esm5.processed/parsers/manifest/smooth/create_parser.d.ts +3 -3
  512. package/dist/_esm5.processed/parsers/manifest/smooth/create_parser.js +136 -109
  513. package/dist/_esm5.processed/parsers/manifest/smooth/get_codecs.js +3 -3
  514. package/dist/_esm5.processed/parsers/manifest/smooth/index.d.ts +4 -2
  515. package/dist/_esm5.processed/parsers/manifest/smooth/index.js +1 -1
  516. package/dist/_esm5.processed/parsers/manifest/smooth/parse_C_nodes.js +6 -6
  517. package/dist/_esm5.processed/parsers/manifest/smooth/parse_protection_node.js +12 -8
  518. package/dist/_esm5.processed/parsers/manifest/smooth/representation_index.d.ts +2 -2
  519. package/dist/_esm5.processed/parsers/manifest/smooth/representation_index.js +48 -53
  520. package/dist/_esm5.processed/parsers/manifest/smooth/utils/add_segment_infos.js +10 -7
  521. package/dist/_esm5.processed/parsers/manifest/smooth/utils/tokens.d.ts +1 -1
  522. package/dist/_esm5.processed/parsers/manifest/smooth/utils/tokens.js +2 -3
  523. package/dist/_esm5.processed/parsers/manifest/types.d.ts +2 -2
  524. package/dist/_esm5.processed/parsers/manifest/utils/check_manifest_ids.d.ts +1 -1
  525. package/dist/_esm5.processed/parsers/manifest/utils/clear_timeline_from_position.d.ts +1 -1
  526. package/dist/_esm5.processed/parsers/manifest/utils/clear_timeline_from_position.js +9 -6
  527. package/dist/_esm5.processed/parsers/manifest/utils/get_first_time_from_adaptation.d.ts +1 -1
  528. package/dist/_esm5.processed/parsers/manifest/utils/get_first_time_from_adaptation.js +5 -4
  529. package/dist/_esm5.processed/parsers/manifest/utils/get_last_time_from_adaptation.d.ts +1 -1
  530. package/dist/_esm5.processed/parsers/manifest/utils/get_last_time_from_adaptation.js +5 -4
  531. package/dist/_esm5.processed/parsers/manifest/utils/get_maximum_positions.d.ts +1 -1
  532. package/dist/_esm5.processed/parsers/manifest/utils/get_maximum_positions.js +10 -16
  533. package/dist/_esm5.processed/parsers/manifest/utils/get_minimum_position.d.ts +1 -1
  534. package/dist/_esm5.processed/parsers/manifest/utils/get_minimum_position.js +4 -10
  535. package/dist/_esm5.processed/parsers/manifest/utils/index_helpers.d.ts +1 -1
  536. package/dist/_esm5.processed/parsers/manifest/utils/index_helpers.js +4 -5
  537. package/dist/_esm5.processed/parsers/manifest/utils/update_segment_timeline.d.ts +1 -1
  538. package/dist/_esm5.processed/parsers/manifest/utils/update_segment_timeline.js +18 -18
  539. package/dist/_esm5.processed/parsers/texttracks/index.d.ts +1 -1
  540. package/dist/_esm5.processed/parsers/texttracks/sami/html.d.ts +1 -1
  541. package/dist/_esm5.processed/parsers/texttracks/sami/html.js +15 -15
  542. package/dist/_esm5.processed/parsers/texttracks/sami/native.d.ts +1 -1
  543. package/dist/_esm5.processed/parsers/texttracks/sami/native.js +7 -14
  544. package/dist/_esm5.processed/parsers/texttracks/srt/html.js +6 -6
  545. package/dist/_esm5.processed/parsers/texttracks/srt/native.d.ts +1 -1
  546. package/dist/_esm5.processed/parsers/texttracks/srt/native.js +1 -7
  547. package/dist/_esm5.processed/parsers/texttracks/srt/parse_cue.js +4 -8
  548. package/dist/_esm5.processed/parsers/texttracks/ttml/get_parameters.js +4 -8
  549. package/dist/_esm5.processed/parsers/texttracks/ttml/get_time_delimiters.d.ts +1 -1
  550. package/dist/_esm5.processed/parsers/texttracks/ttml/get_time_delimiters.js +6 -8
  551. package/dist/_esm5.processed/parsers/texttracks/ttml/html/apply_default_ttml_paragraph_style.js +2 -2
  552. package/dist/_esm5.processed/parsers/texttracks/ttml/html/apply_extent.js +2 -6
  553. package/dist/_esm5.processed/parsers/texttracks/ttml/html/apply_font_size.js +3 -4
  554. package/dist/_esm5.processed/parsers/texttracks/ttml/html/apply_origin.js +2 -6
  555. package/dist/_esm5.processed/parsers/texttracks/ttml/html/apply_padding.js +2 -6
  556. package/dist/_esm5.processed/parsers/texttracks/ttml/html/create_element.d.ts +2 -2
  557. package/dist/_esm5.processed/parsers/texttracks/ttml/html/create_element.js +22 -21
  558. package/dist/_esm5.processed/parsers/texttracks/ttml/html/generate_css_test_outline.js +2 -2
  559. package/dist/_esm5.processed/parsers/texttracks/ttml/html/parse_cue.d.ts +1 -1
  560. package/dist/_esm5.processed/parsers/texttracks/ttml/html/parse_cue.js +5 -3
  561. package/dist/_esm5.processed/parsers/texttracks/ttml/html/parse_ttml_to_div.d.ts +1 -1
  562. package/dist/_esm5.processed/parsers/texttracks/ttml/html/ttml_color_to_css_color.js +34 -19
  563. package/dist/_esm5.processed/parsers/texttracks/ttml/native/parse_cue.d.ts +2 -2
  564. package/dist/_esm5.processed/parsers/texttracks/ttml/native/parse_cue.js +9 -10
  565. package/dist/_esm5.processed/parsers/texttracks/ttml/native/parse_ttml_to_vtt.d.ts +1 -1
  566. package/dist/_esm5.processed/parsers/texttracks/ttml/parse_ttml.d.ts +3 -3
  567. package/dist/_esm5.processed/parsers/texttracks/ttml/parse_ttml.js +28 -16
  568. package/dist/_esm5.processed/parsers/texttracks/ttml/resolve_styles_inheritance.d.ts +1 -1
  569. package/dist/_esm5.processed/parsers/texttracks/ttml/time_parsing.d.ts +1 -1
  570. package/dist/_esm5.processed/parsers/texttracks/ttml/time_parsing.js +2 -2
  571. package/dist/_esm5.processed/parsers/texttracks/types.d.ts +1 -1
  572. package/dist/_esm5.processed/parsers/texttracks/webvtt/get_cue_blocks.js +1 -1
  573. package/dist/_esm5.processed/parsers/texttracks/webvtt/get_style_blocks.js +2 -1
  574. package/dist/_esm5.processed/parsers/texttracks/webvtt/html/convert_payload_to_html.d.ts +1 -1
  575. package/dist/_esm5.processed/parsers/texttracks/webvtt/html/create_default_style_elements.d.ts +1 -1
  576. package/dist/_esm5.processed/parsers/texttracks/webvtt/html/create_style_attribute.js +6 -12
  577. package/dist/_esm5.processed/parsers/texttracks/webvtt/html/create_styled_element.d.ts +1 -1
  578. package/dist/_esm5.processed/parsers/texttracks/webvtt/html/create_styled_element.js +7 -8
  579. package/dist/_esm5.processed/parsers/texttracks/webvtt/html/index.d.ts +1 -1
  580. package/dist/_esm5.processed/parsers/texttracks/webvtt/html/parse_style_block.js +4 -4
  581. package/dist/_esm5.processed/parsers/texttracks/webvtt/html/parse_webvtt_to_div.d.ts +1 -1
  582. package/dist/_esm5.processed/parsers/texttracks/webvtt/html/to_html.d.ts +1 -1
  583. package/dist/_esm5.processed/parsers/texttracks/webvtt/html/to_html.js +4 -10
  584. package/dist/_esm5.processed/parsers/texttracks/webvtt/native/parse_vtt_to_cues.d.ts +1 -1
  585. package/dist/_esm5.processed/parsers/texttracks/webvtt/native/parse_vtt_to_cues.js +2 -6
  586. package/dist/_esm5.processed/parsers/texttracks/webvtt/native/set_settings_on_cue.d.ts +1 -1
  587. package/dist/_esm5.processed/parsers/texttracks/webvtt/native/to_native_cue.d.ts +1 -1
  588. package/dist/_esm5.processed/parsers/texttracks/webvtt/native/to_native_cue.js +1 -1
  589. package/dist/_esm5.processed/parsers/texttracks/webvtt/parse_cue_block.js +2 -4
  590. package/dist/_esm5.processed/parsers/texttracks/webvtt/parse_timestamp.js +1 -2
  591. package/dist/_esm5.processed/parsers/texttracks/webvtt/utils.js +6 -6
  592. package/dist/_esm5.processed/public_types.d.ts +13 -11
  593. package/dist/_esm5.processed/tools/TextTrackRenderer/index.d.ts +3 -2
  594. package/dist/_esm5.processed/tools/TextTrackRenderer/text_track_renderer.d.ts +2 -2
  595. package/dist/_esm5.processed/tools/TextTrackRenderer/text_track_renderer.js +15 -10
  596. package/dist/_esm5.processed/transports/dash/add_segment_integrity_checks_to_loader.d.ts +1 -1
  597. package/dist/_esm5.processed/transports/dash/add_segment_integrity_checks_to_loader.js +2 -3
  598. package/dist/_esm5.processed/transports/dash/construct_segment_url.d.ts +2 -2
  599. package/dist/_esm5.processed/transports/dash/construct_segment_url.js +5 -3
  600. package/dist/_esm5.processed/transports/dash/extract_complete_chunks.js +2 -2
  601. package/dist/_esm5.processed/transports/dash/get_events_out_of_emsgs.d.ts +2 -2
  602. package/dist/_esm5.processed/transports/dash/get_events_out_of_emsgs.js +9 -10
  603. package/dist/_esm5.processed/transports/dash/image_pipelines.d.ts +3 -3
  604. package/dist/_esm5.processed/transports/dash/image_pipelines.js +32 -19
  605. package/dist/_esm5.processed/transports/dash/init_segment_loader.d.ts +3 -3
  606. package/dist/_esm5.processed/transports/dash/init_segment_loader.js +46 -22
  607. package/dist/_esm5.processed/transports/dash/low_latency_segment_loader.d.ts +2 -2
  608. package/dist/_esm5.processed/transports/dash/low_latency_segment_loader.js +13 -9
  609. package/dist/_esm5.processed/transports/dash/manifest_parser.d.ts +2 -2
  610. package/dist/_esm5.processed/transports/dash/manifest_parser.js +35 -22
  611. package/dist/_esm5.processed/transports/dash/pipelines.d.ts +1 -1
  612. package/dist/_esm5.processed/transports/dash/pipelines.js +11 -15
  613. package/dist/_esm5.processed/transports/dash/segment_loader.d.ts +4 -4
  614. package/dist/_esm5.processed/transports/dash/segment_loader.js +30 -21
  615. package/dist/_esm5.processed/transports/dash/segment_parser.d.ts +2 -2
  616. package/dist/_esm5.processed/transports/dash/segment_parser.js +47 -21
  617. package/dist/_esm5.processed/transports/dash/text_loader.d.ts +2 -2
  618. package/dist/_esm5.processed/transports/dash/text_loader.js +19 -19
  619. package/dist/_esm5.processed/transports/dash/text_parser.d.ts +2 -2
  620. package/dist/_esm5.processed/transports/dash/text_parser.js +45 -24
  621. package/dist/_esm5.processed/transports/local/pipelines.d.ts +1 -1
  622. package/dist/_esm5.processed/transports/local/pipelines.js +7 -8
  623. package/dist/_esm5.processed/transports/local/segment_loader.d.ts +3 -3
  624. package/dist/_esm5.processed/transports/local/segment_loader.js +14 -6
  625. package/dist/_esm5.processed/transports/local/segment_parser.d.ts +1 -1
  626. package/dist/_esm5.processed/transports/local/segment_parser.js +31 -13
  627. package/dist/_esm5.processed/transports/local/text_parser.d.ts +1 -1
  628. package/dist/_esm5.processed/transports/local/text_parser.js +44 -19
  629. package/dist/_esm5.processed/transports/metaplaylist/manifest_loader.d.ts +4 -4
  630. package/dist/_esm5.processed/transports/metaplaylist/manifest_loader.js +9 -5
  631. package/dist/_esm5.processed/transports/metaplaylist/pipelines.d.ts +1 -1
  632. package/dist/_esm5.processed/transports/metaplaylist/pipelines.js +25 -18
  633. package/dist/_esm5.processed/transports/smooth/extract_timings_infos.d.ts +2 -2
  634. package/dist/_esm5.processed/transports/smooth/extract_timings_infos.js +16 -15
  635. package/dist/_esm5.processed/transports/smooth/isobmff/create_audio_init_segment.js +3 -3
  636. package/dist/_esm5.processed/transports/smooth/isobmff/create_boxes.js +14 -32
  637. package/dist/_esm5.processed/transports/smooth/isobmff/create_init_segment.js +2 -2
  638. package/dist/_esm5.processed/transports/smooth/isobmff/create_traf_box.js +2 -2
  639. package/dist/_esm5.processed/transports/smooth/isobmff/get_aaces_header.js +4 -16
  640. package/dist/_esm5.processed/transports/smooth/isobmff/index.d.ts +4 -2
  641. package/dist/_esm5.processed/transports/smooth/isobmff/parse_tfrf.js +2 -2
  642. package/dist/_esm5.processed/transports/smooth/isobmff/parse_tfxd.js +1 -1
  643. package/dist/_esm5.processed/transports/smooth/isobmff/patch_segment.js +11 -10
  644. package/dist/_esm5.processed/transports/smooth/pipelines.d.ts +1 -1
  645. package/dist/_esm5.processed/transports/smooth/pipelines.js +121 -79
  646. package/dist/_esm5.processed/transports/smooth/segment_loader.d.ts +3 -3
  647. package/dist/_esm5.processed/transports/smooth/segment_loader.js +53 -27
  648. package/dist/_esm5.processed/transports/smooth/utils.d.ts +2 -2
  649. package/dist/_esm5.processed/transports/smooth/utils.js +7 -5
  650. package/dist/_esm5.processed/transports/types.d.ts +11 -25
  651. package/dist/_esm5.processed/transports/utils/byte_range.js +1 -2
  652. package/dist/_esm5.processed/transports/utils/call_custom_manifest_loader.d.ts +3 -3
  653. package/dist/_esm5.processed/transports/utils/call_custom_manifest_loader.js +13 -7
  654. package/dist/_esm5.processed/transports/utils/check_isobmff_integrity.js +3 -3
  655. package/dist/_esm5.processed/transports/utils/find_complete_box.js +3 -2
  656. package/dist/_esm5.processed/transports/utils/generate_manifest_loader.d.ts +3 -3
  657. package/dist/_esm5.processed/transports/utils/generate_manifest_loader.js +18 -6
  658. package/dist/_esm5.processed/transports/utils/get_isobmff_timing_infos.d.ts +2 -2
  659. package/dist/_esm5.processed/transports/utils/get_isobmff_timing_infos.js +12 -11
  660. package/dist/_esm5.processed/transports/utils/infer_segment_container.d.ts +1 -1
  661. package/dist/_esm5.processed/transports/utils/infer_segment_container.js +1 -3
  662. package/dist/_esm5.processed/transports/utils/parse_text_track.d.ts +4 -4
  663. package/dist/_esm5.processed/transports/utils/parse_text_track.js +9 -6
  664. package/dist/_esm5.processed/utils/are_codecs_compatible.js +5 -1
  665. package/dist/_esm5.processed/utils/array_includes.js +2 -6
  666. package/dist/_esm5.processed/utils/assert.js +3 -4
  667. package/dist/_esm5.processed/utils/base64.js +87 -29
  668. package/dist/_esm5.processed/utils/byte_parsing.js +60 -56
  669. package/dist/_esm5.processed/utils/cancellable_sleep.d.ts +1 -1
  670. package/dist/_esm5.processed/utils/create_cancellable_promise.d.ts +1 -1
  671. package/dist/_esm5.processed/utils/deep_merge.js +4 -4
  672. package/dist/_esm5.processed/utils/event_emitter.d.ts +1 -1
  673. package/dist/_esm5.processed/utils/get_fuzzed_delay.js +1 -1
  674. package/dist/_esm5.processed/utils/hash_buffer.js +1 -1
  675. package/dist/_esm5.processed/utils/initialization_segment_cache.d.ts +2 -2
  676. package/dist/_esm5.processed/utils/languages/index.d.ts +4 -2
  677. package/dist/_esm5.processed/utils/languages/index.js +2 -2
  678. package/dist/_esm5.processed/utils/languages/normalize.d.ts +2 -1
  679. package/dist/_esm5.processed/utils/languages/normalize.js +5 -3
  680. package/dist/_esm5.processed/utils/logger.js +7 -14
  681. package/dist/_esm5.processed/utils/object_assign.js +5 -5
  682. package/dist/_esm5.processed/utils/object_values.d.ts +1 -1
  683. package/dist/_esm5.processed/utils/object_values.js +2 -3
  684. package/dist/_esm5.processed/utils/ranges.d.ts +2 -1
  685. package/dist/_esm5.processed/utils/ranges.js +19 -23
  686. package/dist/_esm5.processed/utils/reference.d.ts +3 -3
  687. package/dist/_esm5.processed/utils/reference.js +1 -3
  688. package/dist/_esm5.processed/utils/request/fetch.d.ts +1 -1
  689. package/dist/_esm5.processed/utils/request/fetch.js +34 -23
  690. package/dist/_esm5.processed/utils/request/index.d.ts +6 -3
  691. package/dist/_esm5.processed/utils/request/index.js +2 -2
  692. package/dist/_esm5.processed/utils/request/xhr.d.ts +1 -1
  693. package/dist/_esm5.processed/utils/request/xhr.js +28 -17
  694. package/dist/_esm5.processed/utils/retry_promise_with_backoff.d.ts +2 -2
  695. package/dist/_esm5.processed/utils/slice_uint8array.js +3 -3
  696. package/dist/_esm5.processed/utils/starts_with.js +3 -3
  697. package/dist/_esm5.processed/utils/string_parsing.js +16 -18
  698. package/dist/_esm5.processed/utils/task_canceller.js +1 -2
  699. package/dist/_esm5.processed/utils/uniq.d.ts +1 -1
  700. package/dist/_esm5.processed/utils/uniq.js +4 -3
  701. package/dist/_esm5.processed/utils/weak_map_memory.js +0 -1
  702. package/dist/_esm5.processed/utils/wrapInPromise.d.ts +1 -1
  703. package/dist/mpd-parser.wasm +0 -0
  704. package/dist/rx-player.js +345 -236
  705. package/dist/rx-player.min.js +1 -1
  706. package/experimental/features/index.d.ts-E +16 -0
  707. package/experimental/features/index.js-E +16 -0
  708. package/experimental/index.d.ts +1 -1
  709. package/experimental/index.d.ts-E +16 -0
  710. package/experimental/index.js +1 -1
  711. package/experimental/index.js-E +16 -0
  712. package/experimental/tools/VideoThumbnailLoader/index.d.ts-E +18 -0
  713. package/experimental/tools/VideoThumbnailLoader/index.js-E +18 -0
  714. package/experimental/tools/index.d.ts-E +16 -0
  715. package/experimental/tools/index.js-E +16 -0
  716. package/features/index.d.ts-E +16 -0
  717. package/features/index.js-E +16 -0
  718. package/logger/index.d.ts-E +17 -0
  719. package/logger/index.js-E +17 -0
  720. package/minimal/index.d.ts-E +17 -0
  721. package/minimal/index.js-E +17 -0
  722. package/package.json +29 -14
  723. package/tools/TextTrackRenderer.d.ts-E +18 -0
  724. package/tools/TextTrackRenderer.js-E +18 -0
  725. package/tools/index.d.ts-E +16 -0
  726. package/tools/index.js-E +16 -0
  727. package/tools/string-utils.d.ts-E +18 -0
  728. package/tools/string-utils.js-E +18 -0
  729. package/types/index.d.ts-E +16 -0
  730. package/types/index.js-E +15 -0
@@ -15,7 +15,7 @@
15
15
  */
16
16
  import config from "../../../config";
17
17
  import log from "../../../log";
18
- import { areSameContent, } from "../../../manifest";
18
+ import { areSameContent } from "../../../manifest";
19
19
  import BufferedHistory from "./buffered_history";
20
20
  /**
21
21
  * Keep track of every chunk downloaded and currently in the linked media
@@ -66,7 +66,8 @@ var SegmentInventory = /** @class */ (function () {
66
66
  var bufferType = thisSegment === null || thisSegment === void 0 ? void 0 : thisSegment.infos.adaptation.type;
67
67
  var rangesLength = buffered.length;
68
68
  for (var i = 0; i < rangesLength; i++) {
69
- if (thisSegment === undefined) { // we arrived at the end of our inventory
69
+ if (thisSegment === undefined) {
70
+ // we arrived at the end of our inventory
70
71
  return;
71
72
  }
72
73
  // take the i'nth contiguous buffered TimeRange
@@ -82,8 +83,7 @@ var SegmentInventory = /** @class */ (function () {
82
83
  // skip until first segment with at least `MINIMUM_SEGMENT_SIZE` past the
83
84
  // start of that range.
84
85
  while (thisSegment !== undefined &&
85
- (((_a = thisSegment.bufferedEnd) !== null && _a !== void 0 ? _a : thisSegment.end)
86
- - rangeStart) < MINIMUM_SEGMENT_SIZE) {
86
+ ((_a = thisSegment.bufferedEnd) !== null && _a !== void 0 ? _a : thisSegment.end) - rangeStart < MINIMUM_SEGMENT_SIZE) {
87
87
  thisSegment = inventory[++inventoryIndex];
88
88
  }
89
89
  // Contains infos about the last garbage-collected segment before
@@ -93,8 +93,7 @@ var SegmentInventory = /** @class */ (function () {
93
93
  // (Those not in that TimeRange nor in the previous one)
94
94
  var numberOfSegmentToDelete = inventoryIndex - indexBefore;
95
95
  if (numberOfSegmentToDelete > 0) {
96
- var lastDeletedSegment = // last garbage-collected segment
97
- inventory[indexBefore + numberOfSegmentToDelete - 1];
96
+ var lastDeletedSegment = inventory[indexBefore + numberOfSegmentToDelete - 1]; // last garbage-collected segment
98
97
  lastDeletedSegmentInfos = {
99
98
  end: (_b = lastDeletedSegment.bufferedEnd) !== null && _b !== void 0 ? _b : lastDeletedSegment.end,
100
99
  precizeEnd: lastDeletedSegment.precizeEnd,
@@ -116,8 +115,8 @@ var SegmentInventory = /** @class */ (function () {
116
115
  }
117
116
  // If the current segment is actually completely outside that range (it
118
117
  // is contained in one of the next one), skip that part.
119
- if (rangeEnd - ((_c = thisSegment.bufferedStart) !== null && _c !== void 0 ? _c : thisSegment.start)
120
- >= MINIMUM_SEGMENT_SIZE) {
118
+ if (rangeEnd - ((_c = thisSegment.bufferedStart) !== null && _c !== void 0 ? _c : thisSegment.start) >=
119
+ MINIMUM_SEGMENT_SIZE) {
121
120
  guessBufferedStartFromRangeStart(thisSegment, rangeStart, lastDeletedSegmentInfos, bufferType);
122
121
  if (inventoryIndex === inventory.length - 1) {
123
122
  // This is the last segment in the inventory.
@@ -129,10 +128,9 @@ var SegmentInventory = /** @class */ (function () {
129
128
  // Make contiguous until first segment outside that range
130
129
  var thisSegmentStart = (_d = thisSegment.bufferedStart) !== null && _d !== void 0 ? _d : thisSegment.start;
131
130
  var thisSegmentEnd = (_e = thisSegment.bufferedEnd) !== null && _e !== void 0 ? _e : thisSegment.end;
132
- var nextRangeStart = i < rangesLength - 1 ? buffered.start(i + 1) :
133
- undefined;
131
+ var nextRangeStart = i < rangesLength - 1 ? buffered.start(i + 1) : undefined;
134
132
  while (thisSegment !== undefined &&
135
- (rangeEnd - thisSegmentStart) >= MINIMUM_SEGMENT_SIZE &&
133
+ rangeEnd - thisSegmentStart >= MINIMUM_SEGMENT_SIZE &&
136
134
  (nextRangeStart === undefined ||
137
135
  rangeEnd - thisSegmentStart >= thisSegmentEnd - nextRangeStart)) {
138
136
  var prevSegment = inventory[inventoryIndex - 1];
@@ -209,17 +207,24 @@ var SegmentInventory = /** @class */ (function () {
209
207
  return;
210
208
  }
211
209
  var inventory = this._inventory;
212
- var newSegment = { status: succeed ? 0 /* ChunkStatus.PartiallyPushed */ :
213
- 2 /* ChunkStatus.Failed */, insertionTs: insertionTs, chunkSize: chunkSize, splitted: false, start: start, end: end, precizeStart: false,
210
+ var newSegment = {
211
+ status: succeed ? 0 /* ChunkStatus.PartiallyPushed */ : 2 /* ChunkStatus.Failed */,
212
+ insertionTs: insertionTs,
213
+ chunkSize: chunkSize,
214
+ splitted: false,
215
+ start: start,
216
+ end: end,
217
+ precizeStart: false,
214
218
  precizeEnd: false,
215
219
  bufferedStart: undefined,
216
220
  bufferedEnd: undefined,
217
- infos: { segment: segment, period: period, adaptation: adaptation, representation: representation } };
221
+ infos: { segment: segment, period: period, adaptation: adaptation, representation: representation },
222
+ };
218
223
  // begin by the end as in most use cases this will be faster
219
224
  for (var i = inventory.length - 1; i >= 0; i--) {
220
225
  var segmentI = inventory[i];
221
- if ((segmentI.start) <= start) {
222
- if ((segmentI.end) <= start) {
226
+ if (segmentI.start <= start) {
227
+ if (segmentI.end <= start) {
223
228
  // our segment is after, push it after this one
224
229
  //
225
230
  // Case 1:
@@ -247,8 +252,8 @@ var SegmentInventory = /** @class */ (function () {
247
252
  log.debug("SI: Segment pushed updates the start of the next one", bufferType, newSegment.end, inventory[i].start);
248
253
  inventory[i].start = newSegment.end;
249
254
  inventory[i].bufferedStart = undefined;
250
- inventory[i].precizeStart = inventory[i].precizeStart &&
251
- newSegment.precizeEnd;
255
+ inventory[i].precizeStart =
256
+ inventory[i].precizeStart && newSegment.precizeEnd;
252
257
  return;
253
258
  }
254
259
  // The next segment was completely contained in newSegment.
@@ -299,8 +304,8 @@ var SegmentInventory = /** @class */ (function () {
299
304
  log.debug("SI: Segment pushed updates the start of the next one", bufferType, newSegment.end, inventory[i].start);
300
305
  inventory[i].start = newSegment.end;
301
306
  inventory[i].bufferedStart = undefined;
302
- inventory[i].precizeStart = inventory[i].precizeStart &&
303
- newSegment.precizeEnd;
307
+ inventory[i].precizeStart =
308
+ inventory[i].precizeStart && newSegment.precizeEnd;
304
309
  return;
305
310
  }
306
311
  // The next segment was completely contained in newSegment.
@@ -334,8 +339,7 @@ var SegmentInventory = /** @class */ (function () {
334
339
  inventory.splice(i, 0, newSegment);
335
340
  segmentI.start = newSegment.end;
336
341
  segmentI.bufferedStart = undefined;
337
- segmentI.precizeStart = segmentI.precizeStart &&
338
- newSegment.precizeEnd;
342
+ segmentI.precizeStart = segmentI.precizeStart && newSegment.precizeEnd;
339
343
  return;
340
344
  }
341
345
  }
@@ -357,8 +361,7 @@ var SegmentInventory = /** @class */ (function () {
357
361
  this._inventory.splice(i + 1, 0, newSegment);
358
362
  segmentI.end = newSegment.start;
359
363
  segmentI.bufferedEnd = undefined;
360
- segmentI.precizeEnd = segmentI.precizeEnd &&
361
- newSegment.precizeStart;
364
+ segmentI.precizeEnd = segmentI.precizeEnd && newSegment.precizeStart;
362
365
  i += 2; // Go to segment immediately after newSegment
363
366
  while (i < inventory.length && inventory[i].start < newSegment.end) {
364
367
  if (inventory[i].end > newSegment.end) {
@@ -372,8 +375,8 @@ var SegmentInventory = /** @class */ (function () {
372
375
  log.debug("SI: Segment pushed updates the start of the next one", bufferType, newSegment.end, inventory[i].start);
373
376
  inventory[i].start = newSegment.end;
374
377
  inventory[i].bufferedStart = undefined;
375
- inventory[i].precizeStart = inventory[i].precizeStart &&
376
- newSegment.precizeEnd;
378
+ inventory[i].precizeStart =
379
+ inventory[i].precizeStart && newSegment.precizeEnd;
377
380
  return;
378
381
  }
379
382
  // The next segment was completely contained in newSegment.
@@ -403,7 +406,8 @@ var SegmentInventory = /** @class */ (function () {
403
406
  // newSegment : |====|
404
407
  // ===> : |--|====|-|
405
408
  log.warn("SI: Segment pushed is contained in a previous one", bufferType, start, end, segmentI.start, segmentI.end);
406
- var nextSegment = { status: segmentI.status,
409
+ var nextSegment = {
410
+ status: segmentI.status,
407
411
  insertionTs: segmentI.insertionTs,
408
412
  /**
409
413
  * Note: this sadly means we're doing as if
@@ -415,18 +419,16 @@ var SegmentInventory = /** @class */ (function () {
415
419
  splitted: true,
416
420
  start: newSegment.end,
417
421
  end: segmentI.end,
418
- precizeStart: segmentI.precizeStart &&
419
- segmentI.precizeEnd &&
420
- newSegment.precizeEnd,
422
+ precizeStart: segmentI.precizeStart && segmentI.precizeEnd && newSegment.precizeEnd,
421
423
  precizeEnd: segmentI.precizeEnd,
422
424
  bufferedStart: undefined,
423
425
  bufferedEnd: segmentI.end,
424
- infos: segmentI.infos };
426
+ infos: segmentI.infos,
427
+ };
425
428
  segmentI.end = newSegment.start;
426
429
  segmentI.splitted = true;
427
430
  segmentI.bufferedEnd = undefined;
428
- segmentI.precizeEnd = segmentI.precizeEnd &&
429
- newSegment.precizeStart;
431
+ segmentI.precizeEnd = segmentI.precizeEnd && newSegment.precizeStart;
430
432
  inventory.splice(i + 1, 0, newSegment);
431
433
  inventory.splice(i + 2, 0, nextSegment);
432
434
  return;
@@ -438,7 +440,8 @@ var SegmentInventory = /** @class */ (function () {
438
440
  // if we got here, we are at the first segment
439
441
  // check bounds of the previous first segment
440
442
  var firstSegment = this._inventory[0];
441
- if (firstSegment === undefined) { // we do not have any segment yet
443
+ if (firstSegment === undefined) {
444
+ // we do not have any segment yet
442
445
  log.debug("SI: first segment pushed", bufferType, start, end);
443
446
  this._inventory.push(newSegment);
444
447
  return;
@@ -547,8 +550,7 @@ var SegmentInventory = /** @class */ (function () {
547
550
  var firstI = i;
548
551
  var segmentSize = inventory[i].chunkSize;
549
552
  i += 1;
550
- while (i < inventory.length &&
551
- areSameContent(inventory[i].infos, content)) {
553
+ while (i < inventory.length && areSameContent(inventory[i].infos, content)) {
552
554
  var chunkSize = inventory[i].chunkSize;
553
555
  if (segmentSize !== undefined && chunkSize !== undefined) {
554
556
  segmentSize += chunkSize;
@@ -582,8 +584,10 @@ var SegmentInventory = /** @class */ (function () {
582
584
  var seg = resSegments_1[_i];
583
585
  if (seg.bufferedStart !== undefined && seg.bufferedEnd !== undefined) {
584
586
  if (seg.status !== 2 /* ChunkStatus.Failed */) {
585
- this._bufferedHistory.addBufferedSegment(seg.infos, { start: seg.bufferedStart,
586
- end: seg.bufferedEnd });
587
+ this._bufferedHistory.addBufferedSegment(seg.infos, {
588
+ start: seg.bufferedStart,
589
+ end: seg.bufferedEnd,
590
+ });
587
591
  }
588
592
  }
589
593
  else {
@@ -637,12 +641,12 @@ function bufferedStartLooksCoherent(thisSegment) {
637
641
  var start = thisSegment.start, end = thisSegment.end;
638
642
  var duration = end - start;
639
643
  var _a = config.getCurrent(), MAX_MANIFEST_BUFFERED_START_END_DIFFERENCE = _a.MAX_MANIFEST_BUFFERED_START_END_DIFFERENCE, MAX_MANIFEST_BUFFERED_DURATION_DIFFERENCE = _a.MAX_MANIFEST_BUFFERED_DURATION_DIFFERENCE;
640
- return Math.abs(start - thisSegment.bufferedStart) <=
644
+ return (Math.abs(start - thisSegment.bufferedStart) <=
641
645
  MAX_MANIFEST_BUFFERED_START_END_DIFFERENCE &&
642
646
  (thisSegment.bufferedEnd === undefined ||
643
- thisSegment.bufferedEnd > thisSegment.bufferedStart &&
644
- Math.abs(thisSegment.bufferedEnd - thisSegment.bufferedStart -
645
- duration) <= Math.min(MAX_MANIFEST_BUFFERED_DURATION_DIFFERENCE, duration / 3));
647
+ (thisSegment.bufferedEnd > thisSegment.bufferedStart &&
648
+ Math.abs(thisSegment.bufferedEnd - thisSegment.bufferedStart - duration) <=
649
+ Math.min(MAX_MANIFEST_BUFFERED_DURATION_DIFFERENCE, duration / 3))));
646
650
  }
647
651
  /**
648
652
  * Returns `true` if the buffered end of the given chunk looks coherent enough
@@ -659,12 +663,12 @@ function bufferedEndLooksCoherent(thisSegment) {
659
663
  var start = thisSegment.start, end = thisSegment.end;
660
664
  var duration = end - start;
661
665
  var _a = config.getCurrent(), MAX_MANIFEST_BUFFERED_START_END_DIFFERENCE = _a.MAX_MANIFEST_BUFFERED_START_END_DIFFERENCE, MAX_MANIFEST_BUFFERED_DURATION_DIFFERENCE = _a.MAX_MANIFEST_BUFFERED_DURATION_DIFFERENCE;
662
- return Math.abs(end - thisSegment.bufferedEnd) <=
666
+ return (Math.abs(end - thisSegment.bufferedEnd) <=
663
667
  MAX_MANIFEST_BUFFERED_START_END_DIFFERENCE &&
664
668
  thisSegment.bufferedStart != null &&
665
669
  thisSegment.bufferedEnd > thisSegment.bufferedStart &&
666
- Math.abs(thisSegment.bufferedEnd - thisSegment.bufferedStart -
667
- duration) <= Math.min(MAX_MANIFEST_BUFFERED_DURATION_DIFFERENCE, duration / 3);
670
+ Math.abs(thisSegment.bufferedEnd - thisSegment.bufferedStart - duration) <=
671
+ Math.min(MAX_MANIFEST_BUFFERED_DURATION_DIFFERENCE, duration / 3));
668
672
  }
669
673
  /**
670
674
  * Evaluate the given buffered Chunk's buffered start from its range's start,
@@ -828,10 +832,12 @@ function prettyPrintInventory(inventory) {
828
832
  var lastLetter = null;
829
833
  function generateNewLetter(infos) {
830
834
  var currentLetter = String.fromCharCode(letters.length + 65);
831
- letters.push({ letter: currentLetter,
835
+ letters.push({
836
+ letter: currentLetter,
832
837
  periodId: infos.period.id,
833
838
  representationId: infos.representation.id,
834
- bitrate: infos.representation.bitrate });
839
+ bitrate: infos.representation.bitrate,
840
+ });
835
841
  return currentLetter;
836
842
  }
837
843
  var str = "";
@@ -858,13 +864,15 @@ function prettyPrintInventory(inventory) {
858
864
  }
859
865
  else if (lastLetter === currentLetter) {
860
866
  if (lastChunk.bufferedEnd + roundingError < chunk.bufferedStart) {
861
- str += "".concat(lastChunk.bufferedEnd.toFixed(2), " ~ ") +
862
- "".concat(chunk.bufferedStart.toFixed(2), "|").concat(currentLetter, "|");
867
+ str +=
868
+ "".concat(lastChunk.bufferedEnd.toFixed(2), " ~ ") +
869
+ "".concat(chunk.bufferedStart.toFixed(2), "|").concat(currentLetter, "|");
863
870
  }
864
871
  }
865
872
  else {
866
- str += "".concat(lastChunk.bufferedEnd.toFixed(2), " ~ ") +
867
- "".concat(chunk.bufferedStart.toFixed(2), "|").concat(currentLetter, "|");
873
+ str +=
874
+ "".concat(lastChunk.bufferedEnd.toFixed(2), " ~ ") +
875
+ "".concat(chunk.bufferedStart.toFixed(2), "|").concat(currentLetter, "|");
868
876
  }
869
877
  lastChunk = chunk;
870
878
  lastLetter = currentLetter;
@@ -875,9 +883,10 @@ function prettyPrintInventory(inventory) {
875
883
  }
876
884
  letters.forEach(function (letterInfo) {
877
885
  var _a;
878
- str += "\n[".concat(letterInfo.letter, "] ") +
879
- "P: ".concat(letterInfo.periodId, " || R: ").concat(letterInfo.representationId) +
880
- "(".concat((_a = letterInfo.bitrate) !== null && _a !== void 0 ? _a : "unknown bitrate", ")");
886
+ str +=
887
+ "\n[".concat(letterInfo.letter, "] ") +
888
+ "P: ".concat(letterInfo.periodId, " || R: ").concat(letterInfo.representationId) +
889
+ "(".concat((_a = letterInfo.bitrate) !== null && _a !== void 0 ? _a : "unknown bitrate", ")");
881
890
  });
882
891
  return str;
883
892
  }
@@ -13,7 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { Adaptation, ISegment, Period, Representation } from "../../../manifest";
16
+ import type { Adaptation, ISegment, Period, Representation } from "../../../manifest";
17
17
  /** Content information for a single buffered chunk */
18
18
  export interface IChunkContext {
19
19
  /** Adaptation this chunk is related to. */
@@ -13,8 +13,8 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { CancellationSignal } from "../../utils/task_canceller";
17
- import { IBufferType, SegmentBuffer } from "./implementations";
16
+ import type { CancellationSignal } from "../../utils/task_canceller";
17
+ import type { IBufferType, SegmentBuffer } from "./implementations";
18
18
  /** Options available for a "text" SegmentBuffer */
19
19
  export type ITextTrackSegmentBufferOptions = {
20
20
  textTrackMode?: "native";
@@ -16,12 +16,10 @@
16
16
  import { MediaError } from "../../errors";
17
17
  import features from "../../features";
18
18
  import log from "../../log";
19
+ import assert from "../../utils/assert";
19
20
  import createCancellablePromise from "../../utils/create_cancellable_promise";
20
- import { AudioVideoSegmentBuffer, } from "./implementations";
21
- var POSSIBLE_BUFFER_TYPES = ["audio",
22
- "video",
23
- "text",
24
- "image"];
21
+ import { AudioVideoSegmentBuffer } from "./implementations";
22
+ var POSSIBLE_BUFFER_TYPES = ["audio", "video", "text", "image"];
25
23
  /**
26
24
  * Allows to easily create and dispose SegmentBuffers, which are interfaces to
27
25
  * push and remove segments.
@@ -89,8 +87,7 @@ var SegmentBuffersStore = /** @class */ (function () {
89
87
  * @returns {Array.<string>}
90
88
  */
91
89
  SegmentBuffersStore.prototype.getNativeBufferTypes = function () {
92
- return this._mediaElement.nodeName === "AUDIO" ? ["audio"] :
93
- ["video", "audio"];
90
+ return this._mediaElement.nodeName === "AUDIO" ? ["audio"] : ["video", "audio"];
94
91
  };
95
92
  /**
96
93
  * Returns the current "status" of the SegmentBuffer linked to the buffer
@@ -116,10 +113,11 @@ var SegmentBuffersStore = /** @class */ (function () {
116
113
  */
117
114
  SegmentBuffersStore.prototype.getStatus = function (bufferType) {
118
115
  var initializedBuffer = this._initializedSegmentBuffers[bufferType];
119
- return initializedBuffer === undefined ? { type: "uninitialized" } :
120
- initializedBuffer === null ? { type: "disabled" } :
121
- { type: "initialized",
122
- value: initializedBuffer };
116
+ return initializedBuffer === undefined
117
+ ? { type: "uninitialized" }
118
+ : initializedBuffer === null
119
+ ? { type: "disabled" }
120
+ : { type: "initialized", value: initializedBuffer };
123
121
  };
124
122
  /**
125
123
  * Native media buffers (audio and video) needed for playing the current
@@ -179,7 +177,8 @@ var SegmentBuffersStore = /** @class */ (function () {
179
177
  }
180
178
  this._initializedSegmentBuffers[bufferType] = null;
181
179
  if (SegmentBuffersStore.isNative(bufferType)) {
182
- this._onNativeBufferAddedOrDisabled.forEach(function (cb) { return cb(); });
180
+ this._onNativeBufferAddedOrDisabled.slice().forEach(function (cb) { return cb(); });
181
+ assert(this._onNativeBufferAddedOrDisabled.length === 0);
183
182
  }
184
183
  };
185
184
  /**
@@ -212,7 +211,8 @@ var SegmentBuffersStore = /** @class */ (function () {
212
211
  log.info("SB: Adding native SegmentBuffer with codec", codec);
213
212
  var nativeSegmentBuffer = new AudioVideoSegmentBuffer(bufferType, codec, this._mediaSource);
214
213
  this._initializedSegmentBuffers[bufferType] = nativeSegmentBuffer;
215
- this._onNativeBufferAddedOrDisabled.forEach(function (cb) { return cb(); });
214
+ this._onNativeBufferAddedOrDisabled.slice().forEach(function (cb) { return cb(); });
215
+ assert(this._onNativeBufferAddedOrDisabled.length === 0);
216
216
  return nativeSegmentBuffer;
217
217
  }
218
218
  if (memorizedSegmentBuffer != null) {
@@ -232,8 +232,7 @@ var SegmentBuffersStore = /** @class */ (function () {
232
232
  if (features.nativeTextTracksBuffer == null) {
233
233
  throw new Error("Native Text track feature not activated");
234
234
  }
235
- segmentBuffer = new features
236
- .nativeTextTracksBuffer(this._mediaElement, options.hideNativeSubtitle === true);
235
+ segmentBuffer = new features.nativeTextTracksBuffer(this._mediaElement, options.hideNativeSubtitle === true);
237
236
  }
238
237
  this._initializedSegmentBuffers.text = segmentBuffer;
239
238
  return segmentBuffer;
@@ -248,8 +247,7 @@ var SegmentBuffersStore = /** @class */ (function () {
248
247
  return segmentBuffer;
249
248
  }
250
249
  log.error("SB: Unknown buffer type:", bufferType);
251
- throw new MediaError("BUFFER_TYPE_UNKNOWN", "The player wants to create a SegmentBuffer " +
252
- "of an unknown type.");
250
+ throw new MediaError("BUFFER_TYPE_UNKNOWN", "The player wants to create a SegmentBuffer " + "of an unknown type.");
253
251
  };
254
252
  /**
255
253
  * Dispose of the active SegmentBuffer for the given type.
@@ -283,16 +281,12 @@ var SegmentBuffersStore = /** @class */ (function () {
283
281
  SegmentBuffersStore.prototype._areNativeBuffersUsable = function () {
284
282
  var _this = this;
285
283
  var nativeBufferTypes = this.getNativeBufferTypes();
286
- var hasUnitializedBuffers = nativeBufferTypes.some(function (sbType) {
287
- return _this._initializedSegmentBuffers[sbType] === undefined;
288
- });
284
+ var hasUnitializedBuffers = nativeBufferTypes.some(function (sbType) { return _this._initializedSegmentBuffers[sbType] === undefined; });
289
285
  if (hasUnitializedBuffers) {
290
286
  // one is not yet initialized/disabled
291
287
  return false;
292
288
  }
293
- var areAllDisabled = nativeBufferTypes.every(function (sbType) {
294
- return _this._initializedSegmentBuffers[sbType] === null;
295
- });
289
+ var areAllDisabled = nativeBufferTypes.every(function (sbType) { return _this._initializedSegmentBuffers[sbType] === null; });
296
290
  if (areAllDisabled) {
297
291
  // they all are disabled: we can't play the content
298
292
  return false;
@@ -13,8 +13,8 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { CancellationSignal } from "../../../utils/task_canceller";
17
- import { IAdaptationStreamArguments, IAdaptationStreamCallbacks } from "./types";
16
+ import type { CancellationSignal } from "../../../utils/task_canceller";
17
+ import type { IAdaptationStreamArguments, IAdaptationStreamCallbacks } from "./types";
18
18
  /**
19
19
  * Create new `AdaptationStream` whose task will be to download the media data
20
20
  * for a given Adaptation (i.e. "track").
@@ -45,4 +45,4 @@ import { IAdaptationStreamArguments, IAdaptationStreamCallbacks } from "./types"
45
45
  * triggered, to immediately stop all operations the `AdaptationStream` is
46
46
  * doing.
47
47
  */
48
- export default function AdaptationStream<T>({ playbackObserver, content, options, representationEstimator, segmentBuffer, segmentFetcherCreator, wantedBufferAhead, maxVideoBufferSize }: IAdaptationStreamArguments, callbacks: IAdaptationStreamCallbacks<T>, parentCancelSignal: CancellationSignal): void;
48
+ export default function AdaptationStream<T>({ playbackObserver, content, options, representationEstimator, segmentBuffer, segmentFetcherCreator, wantedBufferAhead, maxVideoBufferSize, }: IAdaptationStreamArguments, callbacks: IAdaptationStreamCallbacks<T>, parentCancelSignal: CancellationSignal): void;
@@ -20,7 +20,7 @@ import log from "../../../log";
20
20
  import cancellableSleep from "../../../utils/cancellable_sleep";
21
21
  import noop from "../../../utils/noop";
22
22
  import objectAssign from "../../../utils/object_assign";
23
- import SharedReference, { createMappedReference, } from "../../../utils/reference";
23
+ import SharedReference, { createMappedReference } from "../../../utils/reference";
24
24
  import TaskCanceller from "../../../utils/task_canceller";
25
25
  import RepresentationStream from "../representation";
26
26
  import createRepresentationEstimator from "./utils/create_representation_estimator";
@@ -80,13 +80,14 @@ export default function AdaptationStream(_a, callbacks, parentCancelSignal) {
80
80
  callbacks.error(err);
81
81
  }, adapStreamCanceller.signal), estimateRef = _b.estimateRef, abrCallbacks = _b.abrCallbacks;
82
82
  /** Allows the `RepresentationStream` to easily fetch media segments. */
83
- var segmentFetcher = segmentFetcherCreator
84
- .createSegmentFetcher(adaptation.type,
83
+ var segmentFetcher = segmentFetcherCreator.createSegmentFetcher(adaptation.type,
85
84
  /* eslint-disable @typescript-eslint/unbound-method */
86
- { onRequestBegin: abrCallbacks.requestBegin,
85
+ {
86
+ onRequestBegin: abrCallbacks.requestBegin,
87
87
  onRequestEnd: abrCallbacks.requestEnd,
88
88
  onProgress: abrCallbacks.requestProgress,
89
- onMetrics: abrCallbacks.metrics });
89
+ onMetrics: abrCallbacks.metrics,
90
+ });
90
91
  /* eslint-enable @typescript-eslint/unbound-method */
91
92
  /** Stores the last emitted bitrate. */
92
93
  var previousBitrate;
@@ -143,7 +144,12 @@ export default function AdaptationStream(_a, callbacks, parentCancelSignal) {
143
144
  return;
144
145
  }
145
146
  var timeOffset = DELTA_POSITION_AFTER_RELOAD_1.bitrateSwitch;
146
- return callbacks.waitingMediaSourceReload({ bufferType: adaptation.type, period: period, timeOffset: timeOffset, stayInPeriod: true });
147
+ return callbacks.waitingMediaSourceReload({
148
+ bufferType: adaptation.type,
149
+ period: period,
150
+ timeOffset: timeOffset,
151
+ stayInPeriod: true,
152
+ });
147
153
  });
148
154
  }
149
155
  /**
@@ -239,11 +245,9 @@ export default function AdaptationStream(_a, callbacks, parentCancelSignal) {
239
245
  var terminatingRepStreamCanceller = new TaskCanceller();
240
246
  terminatingRepStreamCanceller.linkToSignal(adapStreamCanceller.signal);
241
247
  var bufferGoal = createMappedReference(wantedBufferAhead, function (prev) {
242
- return prev * getBufferGoalRatio(representation);
248
+ return getBufferGoal(representation, prev);
243
249
  }, terminatingRepStreamCanceller.signal);
244
- var maxBufferSize = adaptation.type === "video" ?
245
- maxVideoBufferSize :
246
- new SharedReference(Infinity);
250
+ var maxBufferSize = adaptation.type === "video" ? maxVideoBufferSize : new SharedReference(Infinity);
247
251
  log.info("Stream: changing representation", adaptation.type, representation.id, representation.bitrate);
248
252
  var updatedCallbacks = objectAssign({}, representationStreamCallbacks, {
249
253
  error: function (err) {
@@ -260,15 +264,18 @@ export default function AdaptationStream(_a, callbacks, parentCancelSignal) {
260
264
  var lastBufferGoalRatio = (_a = bufferGoalRatioMap.get(representation.id)) !== null && _a !== void 0 ? _a : 1;
261
265
  // 70%, 49%, 34.3%, 24%, 16.81%, 11.76%, 8.24% and 5.76%
262
266
  var newBufferGoalRatio = lastBufferGoalRatio * 0.7;
263
- if (newBufferGoalRatio <= 0.05 || wba * newBufferGoalRatio <= 2) {
264
- throw formattedError;
265
- }
266
267
  bufferGoalRatioMap.set(representation.id, newBufferGoalRatio);
268
+ if (newBufferGoalRatio <= 0.05 || getBufferGoal(representation, wba) <= 2) {
269
+ representationStreamCallbacks.error(formattedError);
270
+ return;
271
+ }
267
272
  // We wait 4 seconds to let the situation evolve by itself before
268
273
  // retrying loading segments with a lower buffer goal
269
- cancellableSleep(4000, adapStreamCanceller.signal).then(function () {
274
+ cancellableSleep(4000, adapStreamCanceller.signal)
275
+ .then(function () {
270
276
  return createRepresentationStream(representation, terminateCurrentStream, fastSwitchThreshold, representationStreamCallbacks);
271
- }).catch(noop);
277
+ })
278
+ .catch(noop);
272
279
  }
273
280
  },
274
281
  terminating: function () {
@@ -276,20 +283,40 @@ export default function AdaptationStream(_a, callbacks, parentCancelSignal) {
276
283
  representationStreamCallbacks.terminating();
277
284
  },
278
285
  });
279
- RepresentationStream({ playbackObserver: playbackObserver, content: { representation: representation, adaptation: adaptation, period: period, manifest: manifest }, segmentBuffer: segmentBuffer, segmentFetcher: segmentFetcher, terminate: terminateCurrentStream,
280
- options: { bufferGoal: bufferGoal, maxBufferSize: maxBufferSize, drmSystemId: options.drmSystemId, fastSwitchThreshold: fastSwitchThreshold } }, updatedCallbacks, adapStreamCanceller.signal);
286
+ RepresentationStream({
287
+ playbackObserver: playbackObserver,
288
+ content: { representation: representation, adaptation: adaptation, period: period, manifest: manifest },
289
+ segmentBuffer: segmentBuffer,
290
+ segmentFetcher: segmentFetcher,
291
+ terminate: terminateCurrentStream,
292
+ options: {
293
+ bufferGoal: bufferGoal,
294
+ maxBufferSize: maxBufferSize,
295
+ drmSystemId: options.drmSystemId,
296
+ fastSwitchThreshold: fastSwitchThreshold,
297
+ },
298
+ }, updatedCallbacks, adapStreamCanceller.signal);
281
299
  }
282
300
  /**
283
- * @param {Object} representation
301
+ * Returns how much media data should be pre-buffered for this
302
+ * `Representation`, according to the `wantedBufferAhead` setting and previous
303
+ * issues encountered with that `Representation`.
304
+ * @param {Object} representation - The `Representation` you want to buffer.
305
+ * @param {number} wba - The value of `wantedBufferAhead` set by the user.
284
306
  * @returns {number}
285
307
  */
286
- function getBufferGoalRatio(representation) {
308
+ function getBufferGoal(representation, wba) {
287
309
  var oldBufferGoalRatio = bufferGoalRatioMap.get(representation.id);
288
- var bufferGoalRatio = oldBufferGoalRatio !== undefined ? oldBufferGoalRatio :
289
- 1;
310
+ var bufferGoalRatio = oldBufferGoalRatio !== undefined ? oldBufferGoalRatio : 1;
290
311
  if (oldBufferGoalRatio === undefined) {
291
312
  bufferGoalRatioMap.set(representation.id, bufferGoalRatio);
292
313
  }
293
- return bufferGoalRatio;
314
+ if (bufferGoalRatio < 1 && wba === Infinity) {
315
+ // When `wba` is equal to `Infinity`, dividing it will still make it equal
316
+ // to `Infinity`. To make the `bufferGoalRatio` still have an effect, we
317
+ // just starts from a `wba` set to the high value of 5 minutes.
318
+ return 5 * 60 * 1000 * bufferGoalRatio;
319
+ }
320
+ return wba * bufferGoalRatio;
294
321
  }
295
322
  }
@@ -1,10 +1,11 @@
1
- import Manifest, { Adaptation, Period, Representation } from "../../../manifest";
2
- import { IReadOnlySharedReference } from "../../../utils/reference";
3
- import { IRepresentationEstimator } from "../../adaptive";
4
- import { IReadOnlyPlaybackObserver } from "../../api";
5
- import { SegmentFetcherCreator } from "../../fetchers";
6
- import { IBufferType, SegmentBuffer } from "../../segment_buffers";
7
- import { IRepresentationStreamCallbacks, IRepresentationStreamPlaybackObservation } from "../representation";
1
+ import type { Adaptation, Period, Representation } from "../../../manifest";
2
+ import type Manifest from "../../../manifest";
3
+ import type { IReadOnlySharedReference } from "../../../utils/reference";
4
+ import type { IRepresentationEstimator } from "../../adaptive";
5
+ import type { IReadOnlyPlaybackObserver } from "../../api";
6
+ import type { SegmentFetcherCreator } from "../../fetchers";
7
+ import type { IBufferType, SegmentBuffer } from "../../segment_buffers";
8
+ import type { IRepresentationStreamCallbacks, IRepresentationStreamPlaybackObservation } from "../representation";
8
9
  /** Callbacks called by the `AdaptationStream` on various events. */
9
10
  export interface IAdaptationStreamCallbacks<T> extends Omit<IRepresentationStreamCallbacks<T>, "terminating"> {
10
11
  /** Called as new bitrate estimates are done. */
@@ -13,12 +13,13 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import Manifest, { Adaptation, Period, Representation } from "../../../../manifest";
17
- import { IPlayerError } from "../../../../public_types";
18
- import { IReadOnlySharedReference } from "../../../../utils/reference";
19
- import { CancellationSignal } from "../../../../utils/task_canceller";
20
- import { IABREstimate, IRepresentationEstimatorPlaybackObservation, IRepresentationEstimator, IRepresentationEstimatorCallbacks } from "../../../adaptive";
21
- import { IReadOnlyPlaybackObserver } from "../../../api";
16
+ import type { Adaptation, Period, Representation } from "../../../../manifest";
17
+ import type Manifest from "../../../../manifest";
18
+ import type { IPlayerError } from "../../../../public_types";
19
+ import type { IReadOnlySharedReference } from "../../../../utils/reference";
20
+ import type { CancellationSignal } from "../../../../utils/task_canceller";
21
+ import type { IABREstimate, IRepresentationEstimatorPlaybackObservation, IRepresentationEstimator, IRepresentationEstimatorCallbacks } from "../../../adaptive";
22
+ import type { IReadOnlyPlaybackObserver } from "../../../api";
22
23
  /**
23
24
  * Produce estimates to know which Representation should be played.
24
25
  * @param {Object} content - The Manifest, Period and Adaptation wanted.
@@ -46,7 +46,8 @@ export default function getRepresentationEstimate(content, representationEstimat
46
46
  var newRepr = adaptation.getPlayableRepresentations();
47
47
  if (newRepr.length === 0) {
48
48
  var noRepErr = new MediaError("NO_PLAYABLE_REPRESENTATION", "No Representation in the chosen " +
49
- adaptation.type + " Adaptation can be played", { adaptation: adaptation });
49
+ adaptation.type +
50
+ " Adaptation can be played", { adaptation: adaptation });
50
51
  cleanUp();
51
52
  onFatalError(noRepErr);
52
53
  return;
@@ -13,9 +13,10 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import StreamOrchestrator, { INeedsMediaSourceReloadPayload, IStreamOrchestratorOptions, IStreamOrchestratorPlaybackObservation, IStreamOrchestratorCallbacks } from "./orchestrator";
17
- export { IAudioTrackSwitchingMode } from "./period";
18
- export { IInbandEvent, IStreamStatusPayload, } from "./representation";
19
- export { IWaitingMediaSourceReloadPayload, } from "./adaptation";
16
+ import type { INeedsMediaSourceReloadPayload, IStreamOrchestratorOptions, IStreamOrchestratorPlaybackObservation, IStreamOrchestratorCallbacks } from "./orchestrator";
17
+ import StreamOrchestrator from "./orchestrator";
18
+ export type { IAudioTrackSwitchingMode } from "./period";
19
+ export type { IInbandEvent, IStreamStatusPayload } from "./representation";
20
+ export type { IWaitingMediaSourceReloadPayload } from "./adaptation";
20
21
  export default StreamOrchestrator;
21
- export { INeedsMediaSourceReloadPayload, IStreamOrchestratorPlaybackObservation, IStreamOrchestratorOptions, IStreamOrchestratorCallbacks, };
22
+ export type { INeedsMediaSourceReloadPayload, IStreamOrchestratorPlaybackObservation, IStreamOrchestratorOptions, IStreamOrchestratorCallbacks, };