rx-player 4.0.0-beta.2 → 4.0.0-beta.3

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 (909) hide show
  1. package/.eslintrc.js +9 -0
  2. package/CHANGELOG.md +173 -63
  3. package/CONTRIBUTING.md +27 -13
  4. package/FILES.md +0 -4
  5. package/README.md +0 -25
  6. package/VERSION +1 -1
  7. package/dist/_esm5.processed/compat/add_class_name.js +6 -3
  8. package/dist/_esm5.processed/compat/add_text_track.js +11 -8
  9. package/dist/_esm5.processed/compat/browser_compatibility_types.d.ts +0 -1
  10. package/dist/_esm5.processed/compat/browser_compatibility_types.js +16 -11
  11. package/dist/_esm5.processed/compat/browser_detection.js +49 -33
  12. package/dist/_esm5.processed/compat/browser_version.js +11 -8
  13. package/dist/_esm5.processed/compat/can_patch_isobmff.js +6 -3
  14. package/dist/_esm5.processed/compat/can_rely_on_video_visibility_and_size.js +9 -6
  15. package/dist/_esm5.processed/compat/can_reuse_media_keys.js +6 -3
  16. package/dist/_esm5.processed/compat/change_source_buffer_type.js +6 -3
  17. package/dist/_esm5.processed/compat/clear_element_src.js +12 -9
  18. package/dist/_esm5.processed/compat/eme/close_session.js +45 -106
  19. package/dist/_esm5.processed/compat/eme/constants.js +6 -3
  20. package/dist/_esm5.processed/compat/eme/custom_key_system_access.js +18 -22
  21. package/dist/_esm5.processed/compat/eme/custom_media_keys/ie11_media_keys.d.ts +2 -2
  22. package/dist/_esm5.processed/compat/eme/custom_media_keys/ie11_media_keys.js +81 -101
  23. package/dist/_esm5.processed/compat/eme/custom_media_keys/index.d.ts +6 -27
  24. package/dist/_esm5.processed/compat/eme/custom_media_keys/index.js +16 -159
  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/moz_media_keys_constructor.js +31 -26
  27. package/dist/_esm5.processed/compat/eme/custom_media_keys/ms_media_keys_constructor.js +14 -14
  28. package/dist/_esm5.processed/compat/eme/custom_media_keys/old_webkit_media_keys.d.ts +2 -2
  29. package/dist/_esm5.processed/compat/eme/custom_media_keys/old_webkit_media_keys.js +75 -89
  30. package/dist/_esm5.processed/compat/eme/custom_media_keys/types.d.ts +1 -1
  31. package/dist/_esm5.processed/compat/eme/custom_media_keys/types.js +2 -1
  32. package/dist/_esm5.processed/compat/eme/custom_media_keys/webkit_media_keys.d.ts +2 -2
  33. package/dist/_esm5.processed/compat/eme/custom_media_keys/webkit_media_keys.js +97 -119
  34. package/dist/_esm5.processed/compat/eme/custom_media_keys/webkit_media_keys_constructor.js +14 -16
  35. package/dist/_esm5.processed/compat/eme/eme-api-implementation.d.ts +78 -0
  36. package/dist/_esm5.processed/compat/eme/eme-api-implementation.js +198 -0
  37. package/dist/_esm5.processed/compat/eme/generate_key_request.js +36 -31
  38. package/dist/_esm5.processed/compat/eme/get_init_data.js +28 -25
  39. package/dist/_esm5.processed/compat/eme/get_uuid_kid_from_keystatus_kid.js +8 -5
  40. package/dist/_esm5.processed/compat/eme/get_webkit_fairplay_initdata.js +17 -14
  41. package/dist/_esm5.processed/compat/eme/index.d.ts +5 -3
  42. package/dist/_esm5.processed/compat/eme/index.js +13 -7
  43. package/dist/_esm5.processed/compat/eme/load_session.js +26 -69
  44. package/dist/_esm5.processed/compat/enable_audio_track.js +7 -4
  45. package/dist/_esm5.processed/compat/event_listeners.d.ts +13 -5
  46. package/dist/_esm5.processed/compat/event_listeners.js +132 -108
  47. package/dist/_esm5.processed/compat/get_start_date.js +7 -4
  48. package/dist/_esm5.processed/compat/global_scope.d.ts +9 -0
  49. package/dist/_esm5.processed/compat/global_scope.js +15 -0
  50. package/dist/_esm5.processed/compat/has_issues_with_high_media_source_duration.js +6 -3
  51. package/dist/_esm5.processed/compat/index.d.ts +2 -3
  52. package/dist/_esm5.processed/compat/index.js +47 -25
  53. package/dist/_esm5.processed/compat/is_codec_supported.js +8 -5
  54. package/dist/_esm5.processed/compat/is_debug_mode_enabled.d.ts +7 -0
  55. package/dist/_esm5.processed/compat/is_debug_mode_enabled.js +12 -0
  56. package/dist/_esm5.processed/compat/is_node.d.ts +1 -0
  57. package/dist/_esm5.processed/compat/is_node.js +6 -2
  58. package/dist/_esm5.processed/compat/is_seeking_approximate.js +5 -3
  59. package/dist/_esm5.processed/compat/is_vtt_cue.js +6 -2
  60. package/dist/_esm5.processed/compat/is_worker.d.ts +5 -0
  61. package/dist/_esm5.processed/compat/is_worker.js +7 -0
  62. package/dist/_esm5.processed/compat/make_vtt_cue.js +10 -6
  63. package/dist/_esm5.processed/compat/on_height_width_change.js +25 -27
  64. package/dist/_esm5.processed/compat/patch_webkit_source_buffer.js +19 -16
  65. package/dist/_esm5.processed/compat/remove_cue.js +12 -9
  66. package/dist/_esm5.processed/compat/should_favour_custom_safari_EME.js +7 -4
  67. package/dist/_esm5.processed/compat/should_reload_media_source_on_decipherability_update.js +4 -1
  68. package/dist/_esm5.processed/compat/should_renew_media_key_system_access.js +6 -3
  69. package/dist/_esm5.processed/compat/should_unset_media_keys.js +6 -3
  70. package/dist/_esm5.processed/compat/should_validate_metadata.js +6 -3
  71. package/dist/_esm5.processed/compat/should_wait_for_data_before_loaded.js +6 -3
  72. package/dist/_esm5.processed/compat/should_wait_for_have_enough_data.d.ts +13 -0
  73. package/dist/_esm5.processed/compat/should_wait_for_have_enough_data.js +19 -0
  74. package/dist/_esm5.processed/config.js +15 -14
  75. package/dist/_esm5.processed/core/adaptive/adaptive_representation_selector.js +136 -104
  76. package/dist/_esm5.processed/core/adaptive/buffer_based_chooser.d.ts +19 -3
  77. package/dist/_esm5.processed/core/adaptive/buffer_based_chooser.js +66 -46
  78. package/dist/_esm5.processed/core/adaptive/guess_based_chooser.js +37 -43
  79. package/dist/_esm5.processed/core/adaptive/index.js +4 -2
  80. package/dist/_esm5.processed/core/adaptive/network_analyzer.js +75 -73
  81. package/dist/_esm5.processed/core/adaptive/utils/bandwidth_estimator.js +24 -23
  82. package/dist/_esm5.processed/core/adaptive/utils/ewma.js +13 -12
  83. package/dist/_esm5.processed/core/adaptive/utils/filter_by_bitrate.js +9 -6
  84. package/dist/_esm5.processed/core/adaptive/utils/filter_by_resolution.js +18 -19
  85. package/dist/_esm5.processed/core/adaptive/utils/get_buffer_levels.js +10 -7
  86. package/dist/_esm5.processed/core/adaptive/utils/last_estimate_storage.js +8 -7
  87. package/dist/_esm5.processed/core/adaptive/utils/pending_requests_store.d.ts +13 -3
  88. package/dist/_esm5.processed/core/adaptive/utils/pending_requests_store.js +26 -23
  89. package/dist/_esm5.processed/core/adaptive/utils/representation_score_calculator.js +25 -23
  90. package/dist/_esm5.processed/core/adaptive/utils/select_optimal_representation.js +6 -3
  91. package/dist/_esm5.processed/core/api/debug/buffer_graph.js +41 -40
  92. package/dist/_esm5.processed/core/api/debug/buffer_size_graph.js +31 -29
  93. package/dist/_esm5.processed/core/api/debug/constants.js +4 -1
  94. package/dist/_esm5.processed/core/api/debug/index.js +4 -2
  95. package/dist/_esm5.processed/core/api/debug/modules/general_info.js +64 -72
  96. package/dist/_esm5.processed/core/api/debug/modules/segment_buffer_content.js +49 -46
  97. package/dist/_esm5.processed/core/api/debug/modules/segment_buffer_size.js +15 -12
  98. package/dist/_esm5.processed/core/api/debug/render.js +16 -13
  99. package/dist/_esm5.processed/core/api/debug/utils.js +18 -13
  100. package/dist/_esm5.processed/core/api/index.js +7 -4
  101. package/dist/_esm5.processed/core/api/option_utils.d.ts +1 -1
  102. package/dist/_esm5.processed/core/api/option_utils.js +86 -59
  103. package/dist/_esm5.processed/core/api/playback_observer.d.ts +8 -2
  104. package/dist/_esm5.processed/core/api/playback_observer.js +135 -123
  105. package/dist/_esm5.processed/core/api/public_api.d.ts +6 -0
  106. package/dist/_esm5.processed/core/api/public_api.js +614 -676
  107. package/dist/_esm5.processed/core/api/track_management/index.js +19 -3
  108. package/dist/_esm5.processed/core/api/track_management/media_element_tracks_store.js +233 -248
  109. package/dist/_esm5.processed/core/api/track_management/track_dispatcher.d.ts +2 -2
  110. package/dist/_esm5.processed/core/api/track_management/track_dispatcher.js +47 -58
  111. package/dist/_esm5.processed/core/api/track_management/tracks_store.d.ts +50 -29
  112. package/dist/_esm5.processed/core/api/track_management/tracks_store.js +325 -351
  113. package/dist/_esm5.processed/core/api/utils.js +32 -24
  114. package/dist/_esm5.processed/core/decrypt/__tests__/__global__/utils.d.ts +3 -3
  115. package/dist/_esm5.processed/core/decrypt/__tests__/__global__/utils.js +167 -190
  116. package/dist/_esm5.processed/core/decrypt/attach_media_keys.d.ts +8 -2
  117. package/dist/_esm5.processed/core/decrypt/attach_media_keys.js +44 -72
  118. package/dist/_esm5.processed/core/decrypt/clear_on_stop.d.ts +1 -1
  119. package/dist/_esm5.processed/core/decrypt/clear_on_stop.js +15 -12
  120. package/dist/_esm5.processed/core/decrypt/content_decryptor.d.ts +9 -67
  121. package/dist/_esm5.processed/core/decrypt/content_decryptor.js +400 -542
  122. package/dist/_esm5.processed/core/decrypt/create_or_load_session.d.ts +1 -1
  123. package/dist/_esm5.processed/core/decrypt/create_or_load_session.js +44 -90
  124. package/dist/_esm5.processed/core/decrypt/create_session.d.ts +1 -1
  125. package/dist/_esm5.processed/core/decrypt/create_session.js +90 -149
  126. package/dist/_esm5.processed/core/decrypt/dispose_decryption_resources.d.ts +1 -1
  127. package/dist/_esm5.processed/core/decrypt/dispose_decryption_resources.js +24 -60
  128. package/dist/_esm5.processed/core/decrypt/find_key_system.d.ts +1 -1
  129. package/dist/_esm5.processed/core/decrypt/find_key_system.js +104 -162
  130. package/dist/_esm5.processed/core/decrypt/get_key_system_configuration.js +6 -3
  131. package/dist/_esm5.processed/core/decrypt/get_media_keys.d.ts +1 -1
  132. package/dist/_esm5.processed/core/decrypt/get_media_keys.js +59 -109
  133. package/dist/_esm5.processed/core/decrypt/index.d.ts +2 -2
  134. package/dist/_esm5.processed/core/decrypt/index.js +26 -7
  135. package/dist/_esm5.processed/core/decrypt/init_media_keys.js +17 -59
  136. package/dist/_esm5.processed/core/decrypt/session_events_listener.d.ts +1 -1
  137. package/dist/_esm5.processed/core/decrypt/session_events_listener.js +84 -155
  138. package/dist/_esm5.processed/core/decrypt/set_server_certificate.d.ts +1 -1
  139. package/dist/_esm5.processed/core/decrypt/set_server_certificate.js +50 -103
  140. package/dist/_esm5.processed/core/decrypt/types.d.ts +61 -0
  141. package/dist/_esm5.processed/core/decrypt/types.js +43 -1
  142. package/dist/_esm5.processed/core/decrypt/utils/are_init_values_compatible.js +22 -19
  143. package/dist/_esm5.processed/core/decrypt/utils/check_key_statuses.d.ts +1 -1
  144. package/dist/_esm5.processed/core/decrypt/utils/check_key_statuses.js +40 -61
  145. package/dist/_esm5.processed/core/decrypt/utils/clean_old_loaded_sessions.js +17 -61
  146. package/dist/_esm5.processed/core/decrypt/utils/clean_old_stored_persistent_info.js +8 -5
  147. package/dist/_esm5.processed/core/decrypt/utils/get_drm_system_id.js +8 -5
  148. package/dist/_esm5.processed/core/decrypt/utils/init_data_values_container.js +23 -23
  149. package/dist/_esm5.processed/core/decrypt/utils/is_session_usable.d.ts +1 -1
  150. package/dist/_esm5.processed/core/decrypt/utils/is_session_usable.js +15 -12
  151. package/dist/_esm5.processed/core/decrypt/utils/key_id_comparison.d.ts +0 -13
  152. package/dist/_esm5.processed/core/decrypt/utils/key_id_comparison.js +14 -38
  153. package/dist/_esm5.processed/core/decrypt/utils/key_session_record.js +26 -26
  154. package/dist/_esm5.processed/core/decrypt/utils/loaded_sessions_store.d.ts +1 -1
  155. package/dist/_esm5.processed/core/decrypt/utils/loaded_sessions_store.js +206 -310
  156. package/dist/_esm5.processed/core/decrypt/utils/media_keys_infos_store.d.ts +2 -1
  157. package/dist/_esm5.processed/core/decrypt/utils/media_keys_infos_store.js +8 -6
  158. package/dist/_esm5.processed/core/decrypt/utils/persistent_sessions_store.d.ts +1 -1
  159. package/dist/_esm5.processed/core/decrypt/utils/persistent_sessions_store.js +103 -103
  160. package/dist/_esm5.processed/core/decrypt/utils/serializable_bytes.js +13 -12
  161. package/dist/_esm5.processed/core/decrypt/utils/server_certificate_store.d.ts +1 -1
  162. package/dist/_esm5.processed/core/decrypt/utils/server_certificate_store.js +18 -16
  163. package/dist/_esm5.processed/core/fetchers/cdn_prioritizer.js +37 -56
  164. package/dist/_esm5.processed/core/fetchers/index.js +7 -3
  165. package/dist/_esm5.processed/core/fetchers/manifest/index.js +4 -2
  166. package/dist/_esm5.processed/core/fetchers/manifest/manifest_fetcher.js +233 -312
  167. package/dist/_esm5.processed/core/fetchers/segment/index.js +4 -2
  168. package/dist/_esm5.processed/core/fetchers/segment/prioritized_segment_fetcher.js +12 -9
  169. package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.js +218 -233
  170. package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher_creator.js +20 -19
  171. package/dist/_esm5.processed/core/fetchers/segment/task_prioritizer.js +73 -74
  172. package/dist/_esm5.processed/core/fetchers/utils/error_selector.js +8 -5
  173. package/dist/_esm5.processed/core/fetchers/utils/schedule_request.js +210 -260
  174. package/dist/_esm5.processed/core/init/directfile_content_initializer.d.ts +60 -1
  175. package/dist/_esm5.processed/core/init/directfile_content_initializer.js +122 -105
  176. package/dist/_esm5.processed/core/init/index.d.ts +1 -4
  177. package/dist/_esm5.processed/core/init/index.js +5 -3
  178. package/dist/_esm5.processed/core/init/media_source_content_initializer.js +269 -307
  179. package/dist/_esm5.processed/core/init/types.d.ts +3 -17
  180. package/dist/_esm5.processed/core/init/types.js +7 -24
  181. package/dist/_esm5.processed/core/init/utils/content_time_boundaries_observer.js +109 -135
  182. package/dist/_esm5.processed/core/init/utils/create_media_source.js +35 -27
  183. package/dist/_esm5.processed/core/init/utils/create_stream_playback_observer.d.ts +9 -4
  184. package/dist/_esm5.processed/core/init/utils/create_stream_playback_observer.js +22 -14
  185. package/dist/_esm5.processed/core/init/utils/end_of_stream.js +30 -25
  186. package/dist/_esm5.processed/core/init/utils/get_initial_time.js +41 -37
  187. package/dist/_esm5.processed/core/init/utils/get_loaded_reference.js +15 -10
  188. package/dist/_esm5.processed/core/init/utils/initial_seek_and_play.js +31 -28
  189. package/dist/_esm5.processed/core/init/utils/initialize_content_decryption.d.ts +3 -3
  190. package/dist/_esm5.processed/core/init/utils/initialize_content_decryption.js +48 -53
  191. package/dist/_esm5.processed/core/init/utils/media_source_duration_updater.js +61 -58
  192. package/dist/_esm5.processed/core/init/utils/rebuffering_controller.d.ts +3 -3
  193. package/dist/_esm5.processed/core/init/utils/rebuffering_controller.js +141 -160
  194. package/dist/_esm5.processed/core/init/utils/stream_events_emitter/are_same_stream_events.js +3 -1
  195. package/dist/_esm5.processed/core/init/utils/stream_events_emitter/index.js +4 -2
  196. package/dist/_esm5.processed/core/init/utils/stream_events_emitter/refresh_scheduled_events_list.js +28 -14
  197. package/dist/_esm5.processed/core/init/utils/stream_events_emitter/stream_events_emitter.d.ts +31 -9
  198. package/dist/_esm5.processed/core/init/utils/stream_events_emitter/stream_events_emitter.js +103 -79
  199. package/dist/_esm5.processed/core/init/utils/stream_events_emitter/types.js +2 -1
  200. package/dist/_esm5.processed/core/init/utils/throw_on_media_error.js +16 -13
  201. package/dist/_esm5.processed/core/segment_buffers/garbage_collector.js +75 -126
  202. package/dist/_esm5.processed/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.js +131 -140
  203. package/dist/_esm5.processed/core/segment_buffers/implementations/audio_video/index.js +4 -2
  204. package/dist/_esm5.processed/core/segment_buffers/implementations/index.js +20 -3
  205. package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/html_text_segment_buffer.d.ts +2 -2
  206. package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/html_text_segment_buffer.js +109 -128
  207. package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/index.js +4 -2
  208. package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/parsers.js +11 -8
  209. package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/text_track_cues_store.js +48 -47
  210. package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/types.js +2 -1
  211. package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/update_proportional_elements.js +18 -15
  212. package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/utils.js +22 -15
  213. package/dist/_esm5.processed/core/segment_buffers/implementations/text/native/index.js +4 -2
  214. package/dist/_esm5.processed/core/segment_buffers/implementations/text/native/native_text_segment_buffer.js +65 -82
  215. package/dist/_esm5.processed/core/segment_buffers/implementations/text/native/parsers.js +11 -8
  216. package/dist/_esm5.processed/core/segment_buffers/implementations/types.js +19 -17
  217. package/dist/_esm5.processed/core/segment_buffers/implementations/utils/manual_time_ranges.js +23 -22
  218. package/dist/_esm5.processed/core/segment_buffers/index.js +13 -6
  219. package/dist/_esm5.processed/core/segment_buffers/inventory/buffered_history.d.ts +2 -2
  220. package/dist/_esm5.processed/core/segment_buffers/inventory/buffered_history.js +25 -22
  221. package/dist/_esm5.processed/core/segment_buffers/inventory/index.js +8 -3
  222. package/dist/_esm5.processed/core/segment_buffers/inventory/segment_inventory.js +152 -150
  223. package/dist/_esm5.processed/core/segment_buffers/inventory/types.js +2 -1
  224. package/dist/_esm5.processed/core/segment_buffers/inventory/utils.js +9 -4
  225. package/dist/_esm5.processed/core/segment_buffers/segment_buffers_store.js +82 -89
  226. package/dist/_esm5.processed/core/stream/adaptation/adaptation_stream.d.ts +1 -1
  227. package/dist/_esm5.processed/core/stream/adaptation/adaptation_stream.js +130 -171
  228. package/dist/_esm5.processed/core/stream/adaptation/get_representations_switch_strategy.js +31 -28
  229. package/dist/_esm5.processed/core/stream/adaptation/index.js +19 -3
  230. package/dist/_esm5.processed/core/stream/adaptation/types.d.ts +14 -8
  231. package/dist/_esm5.processed/core/stream/adaptation/types.js +2 -1
  232. package/dist/_esm5.processed/core/stream/index.d.ts +2 -2
  233. package/dist/_esm5.processed/core/stream/index.js +4 -2
  234. package/dist/_esm5.processed/core/stream/orchestrator/get_time_ranges_for_content.js +14 -21
  235. package/dist/_esm5.processed/core/stream/orchestrator/index.d.ts +2 -2
  236. package/dist/_esm5.processed/core/stream/orchestrator/index.js +4 -2
  237. package/dist/_esm5.processed/core/stream/orchestrator/stream_orchestrator.d.ts +15 -29
  238. package/dist/_esm5.processed/core/stream/orchestrator/stream_orchestrator.js +193 -235
  239. package/dist/_esm5.processed/core/stream/period/index.js +19 -3
  240. package/dist/_esm5.processed/core/stream/period/period_stream.js +204 -228
  241. package/dist/_esm5.processed/core/stream/period/types.d.ts +3 -3
  242. package/dist/_esm5.processed/core/stream/period/types.js +2 -1
  243. package/dist/_esm5.processed/core/stream/period/utils/get_adaptation_switch_strategy.d.ts +18 -4
  244. package/dist/_esm5.processed/core/stream/period/utils/get_adaptation_switch_strategy.js +34 -33
  245. package/dist/_esm5.processed/core/stream/representation/index.js +19 -3
  246. package/dist/_esm5.processed/core/stream/representation/representation_stream.d.ts +1 -1
  247. package/dist/_esm5.processed/core/stream/representation/representation_stream.js +81 -68
  248. package/dist/_esm5.processed/core/stream/representation/types.d.ts +3 -4
  249. package/dist/_esm5.processed/core/stream/representation/types.js +2 -1
  250. package/dist/_esm5.processed/core/stream/representation/utils/append_segment_to_buffer.js +33 -84
  251. package/dist/_esm5.processed/core/stream/representation/utils/check_for_discontinuity.js +32 -29
  252. package/dist/_esm5.processed/core/stream/representation/utils/downloading_queue.d.ts +1 -1
  253. package/dist/_esm5.processed/core/stream/representation/utils/downloading_queue.js +126 -145
  254. package/dist/_esm5.processed/core/stream/representation/utils/force_garbage_collection.js +32 -88
  255. package/dist/_esm5.processed/core/stream/representation/utils/get_buffer_status.js +61 -47
  256. package/dist/_esm5.processed/core/stream/representation/utils/get_needed_segments.js +71 -69
  257. package/dist/_esm5.processed/core/stream/representation/utils/get_segment_priority.js +8 -5
  258. package/dist/_esm5.processed/core/stream/representation/utils/push_init_segment.d.ts +2 -2
  259. package/dist/_esm5.processed/core/stream/representation/utils/push_init_segment.js +22 -63
  260. package/dist/_esm5.processed/core/stream/representation/utils/push_media_segment.d.ts +1 -1
  261. package/dist/_esm5.processed/core/stream/representation/utils/push_media_segment.js +49 -86
  262. package/dist/_esm5.processed/default_config.js +4 -2
  263. package/dist/_esm5.processed/errors/assertion_error.js +10 -26
  264. package/dist/_esm5.processed/errors/custom_loader_error.js +12 -28
  265. package/dist/_esm5.processed/errors/encrypted_media_error.js +16 -32
  266. package/dist/_esm5.processed/errors/error_codes.js +9 -4
  267. package/dist/_esm5.processed/errors/error_message.d.ts +1 -2
  268. package/dist/_esm5.processed/errors/error_message.js +5 -3
  269. package/dist/_esm5.processed/errors/format_error.js +9 -7
  270. package/dist/_esm5.processed/errors/index.js +25 -11
  271. package/dist/_esm5.processed/errors/is_known_error.js +14 -11
  272. package/dist/_esm5.processed/errors/media_error.d.ts +2 -2
  273. package/dist/_esm5.processed/errors/media_error.js +34 -47
  274. package/dist/_esm5.processed/errors/network_error.js +21 -37
  275. package/dist/_esm5.processed/errors/other_error.js +15 -31
  276. package/dist/_esm5.processed/errors/request_error.js +27 -29
  277. package/dist/_esm5.processed/experimental/features/dash_wasm.js +15 -9
  278. package/dist/_esm5.processed/experimental/features/debug_element.js +7 -4
  279. package/dist/_esm5.processed/experimental/features/index.d.ts +0 -1
  280. package/dist/_esm5.processed/experimental/features/index.js +9 -4
  281. package/dist/_esm5.processed/experimental/features/local.js +10 -4
  282. package/dist/_esm5.processed/experimental/features/metaplaylist.js +10 -4
  283. package/dist/_esm5.processed/experimental/index.js +5 -2
  284. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/features/dash.js +6 -3
  285. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/features/metaplaylist.js +6 -3
  286. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/index.js +7 -3
  287. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/load_and_push_segment.js +22 -16
  288. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/prepare_source_buffer.js +22 -19
  289. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/remove_buffer_around_time.js +6 -3
  290. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/types.js +2 -1
  291. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.js +125 -186
  292. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader_error.js +11 -27
  293. package/dist/_esm5.processed/experimental/tools/createMetaplaylist/get_duration_from_manifest.js +76 -119
  294. package/dist/_esm5.processed/experimental/tools/createMetaplaylist/index.js +24 -15
  295. package/dist/_esm5.processed/experimental/tools/index.js +11 -5
  296. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/api/index.d.ts +1 -1
  297. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/api/index.js +39 -44
  298. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/api/probeMediaConfiguration.d.ts +1 -1
  299. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/api/probeMediaConfiguration.js +34 -36
  300. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/capabilities.js +21 -18
  301. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/index.js +4 -2
  302. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/log.js +5 -3
  303. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/DRMInfos.d.ts +1 -1
  304. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/DRMInfos.js +21 -17
  305. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/HDCPPolicy.js +21 -17
  306. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/decodingInfo.js +13 -10
  307. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/defaultCodecsFinder.js +16 -13
  308. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/index.js +16 -14
  309. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/mediaContentType.js +14 -11
  310. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/mediaContentTypeWithFeatures/format.js +14 -11
  311. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/mediaContentTypeWithFeatures/index.js +19 -15
  312. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/mediaDisplayInfos.js +11 -7
  313. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/types.js +5 -2
  314. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/utils.js +25 -22
  315. package/dist/_esm5.processed/experimental/tools/parseBIFThumbnails.js +7 -4
  316. package/dist/_esm5.processed/features/add_features.js +11 -8
  317. package/dist/_esm5.processed/features/features_object.js +6 -3
  318. package/dist/_esm5.processed/features/index.js +7 -4
  319. package/dist/_esm5.processed/features/list/dash.js +12 -6
  320. package/dist/_esm5.processed/features/list/directfile.js +9 -5
  321. package/dist/_esm5.processed/features/list/eme.js +7 -4
  322. package/dist/_esm5.processed/features/list/html_sami_parser.js +9 -4
  323. package/dist/_esm5.processed/features/list/html_srt_parser.js +9 -4
  324. package/dist/_esm5.processed/features/list/html_text_buffer.js +7 -4
  325. package/dist/_esm5.processed/features/list/html_ttml_parser.js +9 -4
  326. package/dist/_esm5.processed/features/list/html_vtt_parser.js +9 -4
  327. package/dist/_esm5.processed/features/list/index.js +31 -14
  328. package/dist/_esm5.processed/features/list/native_sami_parser.js +10 -4
  329. package/dist/_esm5.processed/features/list/native_srt_parser.js +10 -4
  330. package/dist/_esm5.processed/features/list/native_text_buffer.js +8 -4
  331. package/dist/_esm5.processed/features/list/native_ttml_parser.js +10 -4
  332. package/dist/_esm5.processed/features/list/native_vtt_parser.js +10 -4
  333. package/dist/_esm5.processed/features/list/smooth.js +10 -4
  334. package/dist/_esm5.processed/features/types.d.ts +84 -7
  335. package/dist/_esm5.processed/features/types.js +2 -1
  336. package/dist/_esm5.processed/index.d.ts +0 -4
  337. package/dist/_esm5.processed/index.js +24 -8
  338. package/dist/_esm5.processed/log.js +5 -3
  339. package/dist/_esm5.processed/manifest/adaptation.js +52 -55
  340. package/dist/_esm5.processed/manifest/index.js +32 -13
  341. package/dist/_esm5.processed/manifest/manifest.d.ts +4 -7
  342. package/dist/_esm5.processed/manifest/manifest.js +117 -135
  343. package/dist/_esm5.processed/manifest/period.d.ts +2 -7
  344. package/dist/_esm5.processed/manifest/period.js +39 -46
  345. package/dist/_esm5.processed/manifest/representation.d.ts +12 -0
  346. package/dist/_esm5.processed/manifest/representation.js +81 -63
  347. package/dist/_esm5.processed/manifest/representation_index/index.js +5 -2
  348. package/dist/_esm5.processed/manifest/representation_index/static.js +43 -42
  349. package/dist/_esm5.processed/manifest/representation_index/types.js +2 -1
  350. package/dist/_esm5.processed/manifest/types.js +5 -2
  351. package/dist/_esm5.processed/manifest/update_period_in_place.js +38 -48
  352. package/dist/_esm5.processed/manifest/update_periods.js +59 -69
  353. package/dist/_esm5.processed/manifest/utils.js +14 -9
  354. package/dist/_esm5.processed/minimal.d.ts +1 -17
  355. package/dist/_esm5.processed/minimal.js +9 -39
  356. package/dist/_esm5.processed/parsers/containers/isobmff/constants.js +4 -1
  357. package/dist/_esm5.processed/parsers/containers/isobmff/create_box.js +14 -10
  358. package/dist/_esm5.processed/parsers/containers/isobmff/drm/index.js +5 -1
  359. package/dist/_esm5.processed/parsers/containers/isobmff/drm/playready.js +15 -11
  360. package/dist/_esm5.processed/parsers/containers/isobmff/get_box.js +48 -40
  361. package/dist/_esm5.processed/parsers/containers/isobmff/index.js +27 -6
  362. package/dist/_esm5.processed/parsers/containers/isobmff/read.js +20 -14
  363. package/dist/_esm5.processed/parsers/containers/isobmff/take_pssh_out.js +25 -20
  364. package/dist/_esm5.processed/parsers/containers/isobmff/utils.js +130 -112
  365. package/dist/_esm5.processed/parsers/containers/matroska/index.js +6 -1
  366. package/dist/_esm5.processed/parsers/containers/matroska/utils.js +67 -63
  367. package/dist/_esm5.processed/parsers/images/bif.js +40 -29
  368. package/dist/_esm5.processed/parsers/manifest/dash/common/attach_trickmode_track.js +10 -12
  369. package/dist/_esm5.processed/parsers/manifest/dash/common/flatten_overlapping_periods.js +10 -7
  370. package/dist/_esm5.processed/parsers/manifest/dash/common/get_clock_offset.d.ts +3 -3
  371. package/dist/_esm5.processed/parsers/manifest/dash/common/get_clock_offset.js +11 -7
  372. package/dist/_esm5.processed/parsers/manifest/dash/common/get_hdr_information.js +10 -6
  373. package/dist/_esm5.processed/parsers/manifest/dash/common/get_http_utc-timing_url.js +7 -6
  374. package/dist/_esm5.processed/parsers/manifest/dash/common/get_minimum_and_maximum_positions.js +10 -6
  375. package/dist/_esm5.processed/parsers/manifest/dash/common/get_periods_time_infos.js +14 -9
  376. package/dist/_esm5.processed/parsers/manifest/dash/common/index.js +10 -4
  377. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/base.js +73 -67
  378. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/get_init_segment.js +9 -4
  379. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/get_segments_from_timeline.js +32 -25
  380. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/index.js +11 -5
  381. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/list.js +81 -70
  382. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/template.js +130 -123
  383. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_elements.js +15 -12
  384. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_previous_timeline.js +35 -32
  385. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/convert_element_to_index_segment.js +14 -9
  386. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/find_first_common_start_time.js +30 -22
  387. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/index.js +4 -2
  388. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/parse_s_element.js +14 -11
  389. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.d.ts +5 -3
  390. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.js +131 -128
  391. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/tokens.js +16 -10
  392. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/utils.js +7 -3
  393. package/dist/_esm5.processed/parsers/manifest/dash/common/infer_adaptation_type.js +19 -18
  394. package/dist/_esm5.processed/parsers/manifest/dash/common/manifest_bounds_calculator.d.ts +8 -4
  395. package/dist/_esm5.processed/parsers/manifest/dash/common/manifest_bounds_calculator.js +22 -19
  396. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_adaptation_sets.js +111 -108
  397. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_availability_start_time.js +4 -1
  398. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_mpd.d.ts +6 -3
  399. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_mpd.js +86 -84
  400. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_periods.d.ts +4 -0
  401. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_periods.js +101 -84
  402. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representation_index.d.ts +2 -2
  403. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representation_index.js +39 -37
  404. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representations.js +64 -65
  405. package/dist/_esm5.processed/parsers/manifest/dash/common/resolve_base_urls.js +12 -9
  406. package/dist/_esm5.processed/parsers/manifest/dash/index.js +8 -1
  407. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/index.js +4 -2
  408. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/AdaptationSet.js +66 -62
  409. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/BaseURL.js +7 -4
  410. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/ContentComponent.js +7 -4
  411. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/ContentProtection.js +22 -19
  412. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/EventStream.js +22 -19
  413. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/Initialization.js +11 -8
  414. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/MPD.js +38 -34
  415. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/Period.js +34 -30
  416. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/Representation.js +50 -38
  417. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/SegmentBase.js +24 -21
  418. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/SegmentList.js +15 -12
  419. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/SegmentTemplate.js +21 -18
  420. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/SegmentTimeline.js +6 -3
  421. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/SegmentURL.js +12 -9
  422. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/utils.js +60 -64
  423. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/parse_from_document.js +33 -27
  424. package/dist/_esm5.processed/parsers/manifest/dash/node_parser_types.d.ts +1 -0
  425. package/dist/_esm5.processed/parsers/manifest/dash/node_parser_types.js +2 -1
  426. package/dist/_esm5.processed/parsers/manifest/dash/parsers_types.d.ts +4 -4
  427. package/dist/_esm5.processed/parsers/manifest/dash/parsers_types.js +2 -1
  428. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/index.js +4 -2
  429. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/dash-wasm-parser.js +192 -237
  430. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/AdaptationSet.js +67 -62
  431. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/BaseURL.js +8 -4
  432. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/ContentComponent.js +11 -7
  433. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/ContentProtection.js +17 -13
  434. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/EventStream.js +29 -24
  435. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/MPD.js +38 -33
  436. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/Period.js +37 -32
  437. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/Representation.js +50 -35
  438. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/Scheme.js +9 -5
  439. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/SegmentBase.js +16 -12
  440. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/SegmentList.js +11 -7
  441. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/SegmentTemplate.js +20 -16
  442. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/SegmentUrl.js +11 -7
  443. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/XLink.js +11 -7
  444. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/index.js +5 -1
  445. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/root.js +10 -6
  446. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/parsers_stack.js +22 -20
  447. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/types.js +2 -1
  448. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/utils.js +6 -2
  449. package/dist/_esm5.processed/parsers/manifest/index.js +17 -1
  450. package/dist/_esm5.processed/parsers/manifest/local/index.js +4 -2
  451. package/dist/_esm5.processed/parsers/manifest/local/parse_local_manifest.js +31 -26
  452. package/dist/_esm5.processed/parsers/manifest/local/representation_index.js +71 -84
  453. package/dist/_esm5.processed/parsers/manifest/local/types.d.ts +2 -0
  454. package/dist/_esm5.processed/parsers/manifest/local/types.js +2 -1
  455. package/dist/_esm5.processed/parsers/manifest/metaplaylist/index.js +4 -2
  456. package/dist/_esm5.processed/parsers/manifest/metaplaylist/metaplaylist_parser.js +76 -71
  457. package/dist/_esm5.processed/parsers/manifest/metaplaylist/representation_index.js +52 -52
  458. package/dist/_esm5.processed/parsers/manifest/smooth/create_parser.js +200 -175
  459. package/dist/_esm5.processed/parsers/manifest/smooth/get_codecs.js +13 -8
  460. package/dist/_esm5.processed/parsers/manifest/smooth/index.js +7 -4
  461. package/dist/_esm5.processed/parsers/manifest/smooth/parse_C_nodes.js +17 -14
  462. package/dist/_esm5.processed/parsers/manifest/smooth/parse_protection_node.js +17 -15
  463. package/dist/_esm5.processed/parsers/manifest/smooth/representation_index.d.ts +3 -3
  464. package/dist/_esm5.processed/parsers/manifest/smooth/representation_index.js +102 -97
  465. package/dist/_esm5.processed/parsers/manifest/smooth/shared_smooth_segment_timeline.d.ts +3 -3
  466. package/dist/_esm5.processed/parsers/manifest/smooth/shared_smooth_segment_timeline.js +49 -47
  467. package/dist/_esm5.processed/parsers/manifest/smooth/utils/add_segment_infos.js +10 -7
  468. package/dist/_esm5.processed/parsers/manifest/smooth/utils/parseBoolean.js +4 -1
  469. package/dist/_esm5.processed/parsers/manifest/smooth/utils/reduceChildren.js +6 -3
  470. package/dist/_esm5.processed/parsers/manifest/smooth/utils/tokens.js +5 -1
  471. package/dist/_esm5.processed/parsers/manifest/types.d.ts +6 -4
  472. package/dist/_esm5.processed/parsers/manifest/types.js +2 -1
  473. package/dist/_esm5.processed/parsers/manifest/utils/check_manifest_ids.js +27 -24
  474. package/dist/_esm5.processed/parsers/manifest/utils/clear_timeline_from_position.js +10 -7
  475. package/dist/_esm5.processed/parsers/manifest/utils/get_first_time_from_adaptation.js +8 -5
  476. package/dist/_esm5.processed/parsers/manifest/utils/get_last_time_from_adaptation.js +8 -5
  477. package/dist/_esm5.processed/parsers/manifest/utils/get_maximum_positions.js +15 -12
  478. package/dist/_esm5.processed/parsers/manifest/utils/get_minimum_position.js +15 -12
  479. package/dist/_esm5.processed/parsers/manifest/utils/index_helpers.js +31 -22
  480. package/dist/_esm5.processed/parsers/manifest/utils/is_segment_still_available.js +9 -6
  481. package/dist/_esm5.processed/parsers/manifest/utils/update_segment_timeline.js +38 -45
  482. package/dist/_esm5.processed/parsers/texttracks/index.js +2 -1
  483. package/dist/_esm5.processed/parsers/texttracks/sami/html.js +45 -43
  484. package/dist/_esm5.processed/parsers/texttracks/sami/native.js +41 -39
  485. package/dist/_esm5.processed/parsers/texttracks/srt/find_end_of_cue_block.js +7 -4
  486. package/dist/_esm5.processed/parsers/texttracks/srt/get_cue_blocks.js +11 -8
  487. package/dist/_esm5.processed/parsers/texttracks/srt/html.js +32 -29
  488. package/dist/_esm5.processed/parsers/texttracks/srt/native.js +16 -13
  489. package/dist/_esm5.processed/parsers/texttracks/srt/parse_cue.js +21 -18
  490. package/dist/_esm5.processed/parsers/texttracks/srt/parse_timestamp.js +10 -7
  491. package/dist/_esm5.processed/parsers/texttracks/ttml/get_parameters.js +37 -30
  492. package/dist/_esm5.processed/parsers/texttracks/ttml/get_styling.js +48 -48
  493. package/dist/_esm5.processed/parsers/texttracks/ttml/get_time_delimiters.js +14 -11
  494. package/dist/_esm5.processed/parsers/texttracks/ttml/html/apply_default_ttml_paragraph_style.js +7 -2
  495. package/dist/_esm5.processed/parsers/texttracks/ttml/html/apply_extent.js +15 -12
  496. package/dist/_esm5.processed/parsers/texttracks/ttml/html/apply_font_size.js +15 -12
  497. package/dist/_esm5.processed/parsers/texttracks/ttml/html/apply_line_height.js +11 -8
  498. package/dist/_esm5.processed/parsers/texttracks/ttml/html/apply_origin.js +15 -12
  499. package/dist/_esm5.processed/parsers/texttracks/ttml/html/apply_padding.js +25 -22
  500. package/dist/_esm5.processed/parsers/texttracks/ttml/html/create_element.js +117 -124
  501. package/dist/_esm5.processed/parsers/texttracks/ttml/html/generate_css_test_outline.js +11 -8
  502. package/dist/_esm5.processed/parsers/texttracks/ttml/html/index.js +4 -2
  503. package/dist/_esm5.processed/parsers/texttracks/ttml/html/parse_cue.js +12 -8
  504. package/dist/_esm5.processed/parsers/texttracks/ttml/html/parse_ttml_to_div.js +14 -11
  505. package/dist/_esm5.processed/parsers/texttracks/ttml/html/ttml_color_to_css_color.js +10 -7
  506. package/dist/_esm5.processed/parsers/texttracks/ttml/native/index.js +4 -2
  507. package/dist/_esm5.processed/parsers/texttracks/ttml/native/parse_cue.js +38 -35
  508. package/dist/_esm5.processed/parsers/texttracks/ttml/native/parse_ttml_to_vtt.js +11 -8
  509. package/dist/_esm5.processed/parsers/texttracks/ttml/parse_ttml.js +58 -58
  510. package/dist/_esm5.processed/parsers/texttracks/ttml/regexps.js +27 -13
  511. package/dist/_esm5.processed/parsers/texttracks/ttml/resolve_styles_inheritance.js +18 -18
  512. package/dist/_esm5.processed/parsers/texttracks/ttml/time_parsing.js +28 -26
  513. package/dist/_esm5.processed/parsers/texttracks/ttml/xml_utils.js +37 -25
  514. package/dist/_esm5.processed/parsers/texttracks/types.js +2 -1
  515. package/dist/_esm5.processed/parsers/texttracks/webvtt/get_cue_blocks.js +12 -9
  516. package/dist/_esm5.processed/parsers/texttracks/webvtt/get_style_blocks.js +14 -11
  517. package/dist/_esm5.processed/parsers/texttracks/webvtt/html/convert_payload_to_html.js +11 -8
  518. package/dist/_esm5.processed/parsers/texttracks/webvtt/html/create_default_style_elements.js +8 -5
  519. package/dist/_esm5.processed/parsers/texttracks/webvtt/html/create_style_attribute.js +60 -60
  520. package/dist/_esm5.processed/parsers/texttracks/webvtt/html/create_styled_element.js +30 -27
  521. package/dist/_esm5.processed/parsers/texttracks/webvtt/html/index.js +4 -2
  522. package/dist/_esm5.processed/parsers/texttracks/webvtt/html/parse_style_block.js +23 -26
  523. package/dist/_esm5.processed/parsers/texttracks/webvtt/html/parse_webvtt_to_div.js +20 -17
  524. package/dist/_esm5.processed/parsers/texttracks/webvtt/html/to_html.js +23 -18
  525. package/dist/_esm5.processed/parsers/texttracks/webvtt/native/index.js +4 -2
  526. package/dist/_esm5.processed/parsers/texttracks/webvtt/native/parse_vtt_to_cues.js +19 -16
  527. package/dist/_esm5.processed/parsers/texttracks/webvtt/native/set_settings_on_cue.js +20 -17
  528. package/dist/_esm5.processed/parsers/texttracks/webvtt/native/to_native_cue.js +8 -5
  529. package/dist/_esm5.processed/parsers/texttracks/webvtt/parse_cue_block.js +26 -18
  530. package/dist/_esm5.processed/parsers/texttracks/webvtt/parse_timestamp.js +10 -7
  531. package/dist/_esm5.processed/parsers/texttracks/webvtt/utils.js +15 -7
  532. package/dist/_esm5.processed/public_types.d.ts +6 -8
  533. package/dist/_esm5.processed/public_types.js +2 -1
  534. package/dist/_esm5.processed/tools/TextTrackRenderer/index.js +13 -6
  535. package/dist/_esm5.processed/tools/TextTrackRenderer/text_track_renderer.js +26 -24
  536. package/dist/_esm5.processed/tools/index.js +6 -4
  537. package/dist/_esm5.processed/tools/string_utils.js +10 -1
  538. package/dist/_esm5.processed/transports/dash/add_segment_integrity_checks_to_loader.js +16 -24
  539. package/dist/_esm5.processed/transports/dash/construct_segment_url.js +6 -3
  540. package/dist/_esm5.processed/transports/dash/extract_complete_chunks.js +17 -14
  541. package/dist/_esm5.processed/transports/dash/get_events_out_of_emsgs.js +19 -16
  542. package/dist/_esm5.processed/transports/dash/index.js +4 -2
  543. package/dist/_esm5.processed/transports/dash/init_segment_loader.js +47 -27
  544. package/dist/_esm5.processed/transports/dash/low_latency_segment_loader.js +23 -16
  545. package/dist/_esm5.processed/transports/dash/manifest_parser.js +68 -59
  546. package/dist/_esm5.processed/transports/dash/pipelines.js +20 -17
  547. package/dist/_esm5.processed/transports/dash/segment_loader.js +49 -39
  548. package/dist/_esm5.processed/transports/dash/segment_parser.js +58 -39
  549. package/dist/_esm5.processed/transports/dash/text_loader.js +36 -30
  550. package/dist/_esm5.processed/transports/dash/text_parser.js +39 -29
  551. package/dist/_esm5.processed/transports/index.js +17 -1
  552. package/dist/_esm5.processed/transports/local/index.js +4 -2
  553. package/dist/_esm5.processed/transports/local/pipelines.js +26 -22
  554. package/dist/_esm5.processed/transports/local/segment_loader.js +26 -23
  555. package/dist/_esm5.processed/transports/local/segment_parser.js +36 -25
  556. package/dist/_esm5.processed/transports/local/text_parser.js +42 -27
  557. package/dist/_esm5.processed/transports/metaplaylist/index.js +4 -2
  558. package/dist/_esm5.processed/transports/metaplaylist/manifest_loader.js +11 -7
  559. package/dist/_esm5.processed/transports/metaplaylist/pipelines.js +92 -96
  560. package/dist/_esm5.processed/transports/smooth/extract_timings_infos.js +26 -20
  561. package/dist/_esm5.processed/transports/smooth/index.js +4 -2
  562. package/dist/_esm5.processed/transports/smooth/is_mp4_embedded_track.js +4 -1
  563. package/dist/_esm5.processed/transports/smooth/isobmff/create_audio_init_segment.js +22 -19
  564. package/dist/_esm5.processed/transports/smooth/isobmff/create_boxes.js +92 -67
  565. package/dist/_esm5.processed/transports/smooth/isobmff/create_init_segment.js +29 -26
  566. package/dist/_esm5.processed/transports/smooth/isobmff/create_traf_box.js +9 -6
  567. package/dist/_esm5.processed/transports/smooth/isobmff/create_video_init_segment.js +23 -20
  568. package/dist/_esm5.processed/transports/smooth/isobmff/get_aaces_header.js +10 -7
  569. package/dist/_esm5.processed/transports/smooth/isobmff/index.js +13 -6
  570. package/dist/_esm5.processed/transports/smooth/isobmff/parse_tfrf.js +19 -16
  571. package/dist/_esm5.processed/transports/smooth/isobmff/parse_tfxd.js +9 -6
  572. package/dist/_esm5.processed/transports/smooth/isobmff/patch_segment.js +41 -38
  573. package/dist/_esm5.processed/transports/smooth/pipelines.js +107 -96
  574. package/dist/_esm5.processed/transports/smooth/segment_loader.js +149 -153
  575. package/dist/_esm5.processed/transports/smooth/utils.js +7 -3
  576. package/dist/_esm5.processed/transports/types.d.ts +17 -8
  577. package/dist/_esm5.processed/transports/types.js +2 -1
  578. package/dist/_esm5.processed/transports/utils/byte_range.js +6 -4
  579. package/dist/_esm5.processed/transports/utils/call_custom_manifest_loader.js +23 -17
  580. package/dist/_esm5.processed/transports/utils/check_isobmff_integrity.js +14 -11
  581. package/dist/_esm5.processed/transports/utils/find_complete_box.js +11 -8
  582. package/dist/_esm5.processed/transports/utils/generate_manifest_loader.js +22 -14
  583. package/dist/_esm5.processed/transports/utils/get_isobmff_timing_infos.d.ts +0 -3
  584. package/dist/_esm5.processed/transports/utils/get_isobmff_timing_infos.js +13 -13
  585. package/dist/_esm5.processed/transports/utils/infer_segment_container.js +4 -1
  586. package/dist/_esm5.processed/transports/utils/parse_text_track.js +40 -26
  587. package/dist/_esm5.processed/utils/are_arrays_of_numbers_equal.js +8 -2
  588. package/dist/_esm5.processed/utils/are_codecs_compatible.js +11 -9
  589. package/dist/_esm5.processed/utils/array_find.js +7 -4
  590. package/dist/_esm5.processed/utils/array_find_index.js +6 -3
  591. package/dist/_esm5.processed/utils/array_includes.js +12 -11
  592. package/dist/_esm5.processed/utils/assert.js +15 -10
  593. package/dist/_esm5.processed/utils/assert_unreachable.js +6 -3
  594. package/dist/_esm5.processed/utils/base64.js +23 -18
  595. package/dist/_esm5.processed/utils/byte_parsing.js +30 -17
  596. package/dist/_esm5.processed/utils/cancellable_sleep.js +8 -5
  597. package/dist/_esm5.processed/utils/create_cancellable_promise.js +7 -4
  598. package/dist/_esm5.processed/utils/deep_merge.d.ts +2 -5
  599. package/dist/_esm5.processed/utils/deep_merge.js +10 -21
  600. package/dist/_esm5.processed/utils/event_emitter.js +24 -24
  601. package/dist/_esm5.processed/utils/flat_map.js +7 -4
  602. package/dist/_esm5.processed/utils/get_fuzzed_delay.js +6 -3
  603. package/dist/_esm5.processed/utils/hash_buffer.js +7 -4
  604. package/dist/_esm5.processed/utils/id_generator.js +6 -3
  605. package/dist/_esm5.processed/utils/initialization_segment_cache.js +11 -12
  606. package/dist/_esm5.processed/utils/is_non_empty_string.js +4 -1
  607. package/dist/_esm5.processed/utils/is_null_or_undefined.js +4 -1
  608. package/dist/_esm5.processed/utils/languages/ISO_639-1_to_ISO_639-3.js +4 -2
  609. package/dist/_esm5.processed/utils/languages/ISO_639-2_to_ISO_639-3.js +4 -2
  610. package/dist/_esm5.processed/utils/languages/index.js +7 -3
  611. package/dist/_esm5.processed/utils/languages/normalize.js +26 -20
  612. package/dist/_esm5.processed/utils/logger.js +24 -23
  613. package/dist/_esm5.processed/utils/monotonic_timestamp.d.ts +9 -0
  614. package/dist/_esm5.processed/utils/monotonic_timestamp.js +15 -0
  615. package/dist/_esm5.processed/utils/noop.js +4 -1
  616. package/dist/_esm5.processed/utils/object_assign.js +8 -10
  617. package/dist/_esm5.processed/utils/object_values.js +6 -3
  618. package/dist/_esm5.processed/utils/ranges.d.ts +50 -8
  619. package/dist/_esm5.processed/utils/ranges.js +163 -64
  620. package/dist/_esm5.processed/utils/reference.d.ts +78 -37
  621. package/dist/_esm5.processed/utils/reference.js +235 -155
  622. package/dist/_esm5.processed/utils/request/fetch.d.ts +4 -4
  623. package/dist/_esm5.processed/utils/request/fetch.js +79 -107
  624. package/dist/_esm5.processed/utils/request/index.js +9 -4
  625. package/dist/_esm5.processed/utils/request/xhr.js +49 -36
  626. package/dist/_esm5.processed/utils/resolve_url.js +18 -18
  627. package/dist/_esm5.processed/utils/retry_promise_with_backoff.js +34 -81
  628. package/dist/_esm5.processed/utils/sleep.js +5 -2
  629. package/dist/_esm5.processed/utils/slice_uint8array.js +3 -1
  630. package/dist/_esm5.processed/utils/sorted_list.js +37 -40
  631. package/dist/_esm5.processed/utils/starts_with.js +5 -2
  632. package/dist/_esm5.processed/utils/string_parsing.js +84 -72
  633. package/dist/_esm5.processed/utils/take_first_set.js +9 -10
  634. package/dist/_esm5.processed/utils/task_canceller.js +51 -71
  635. package/dist/_esm5.processed/utils/warn_once.js +7 -4
  636. package/dist/_esm5.processed/utils/weak_map_memory.js +12 -11
  637. package/dist/_esm5.processed/utils/wrapInPromise.d.ts +7 -0
  638. package/dist/_esm5.processed/utils/wrapInPromise.js +25 -0
  639. package/dist/mpd-parser.wasm +0 -0
  640. package/dist/rx-player.js +42885 -44008
  641. package/dist/rx-player.min.js +1 -1
  642. package/jest.config.js +1 -22
  643. package/package.json +56 -57
  644. package/scripts/build/constants.d.ts +1 -23
  645. package/scripts/build/generate_build.js +1 -1
  646. package/scripts/check_nodejs_import_compatibility.js +1 -1
  647. package/scripts/list-npm-scripts.js +146 -38
  648. package/scripts/update-version +1 -4
  649. package/sonar-project.properties +1 -1
  650. package/src/compat/__tests__/browser_compatibility_types.test.ts +51 -72
  651. package/src/compat/__tests__/is_vtt_cue.test.ts +20 -16
  652. package/src/compat/__tests__/make_vtt_cue.test.ts +11 -9
  653. package/src/compat/__tests__/patch_webkit_source_buffer.test.ts +26 -25
  654. package/src/compat/__tests__/should_favour_custom_safari_EME.test.ts +11 -9
  655. package/src/compat/__tests__/should_wait_for_have_enough_data.test.ts +36 -0
  656. package/src/compat/browser_compatibility_types.ts +9 -16
  657. package/src/compat/browser_detection.ts +11 -8
  658. package/src/compat/eme/custom_media_keys/ie11_media_keys.ts +11 -8
  659. package/src/compat/eme/custom_media_keys/index.ts +8 -184
  660. package/src/compat/eme/custom_media_keys/moz_media_keys_constructor.ts +26 -22
  661. package/src/compat/eme/custom_media_keys/ms_media_keys_constructor.ts +13 -15
  662. package/src/compat/eme/custom_media_keys/old_webkit_media_keys.ts +11 -8
  663. package/src/compat/eme/custom_media_keys/types.ts +1 -1
  664. package/src/compat/eme/custom_media_keys/webkit_media_keys.ts +15 -11
  665. package/src/compat/eme/custom_media_keys/webkit_media_keys_constructor.ts +14 -16
  666. package/src/compat/eme/eme-api-implementation.ts +319 -0
  667. package/src/compat/eme/index.ts +8 -6
  668. package/src/compat/event_listeners.ts +32 -39
  669. package/src/compat/global_scope.ts +18 -0
  670. package/src/compat/index.ts +2 -24
  671. package/src/compat/is_debug_mode_enabled.ts +12 -0
  672. package/src/compat/is_node.ts +4 -1
  673. package/src/compat/is_vtt_cue.ts +2 -1
  674. package/src/compat/is_worker.ts +9 -0
  675. package/src/compat/make_vtt_cue.ts +3 -2
  676. package/src/compat/on_height_width_change.ts +4 -9
  677. package/src/compat/patch_webkit_source_buffer.ts +4 -3
  678. package/src/compat/should_wait_for_have_enough_data.ts +17 -0
  679. package/src/core/adaptive/__tests__/buffer_based_chooser.test.ts +245 -102
  680. package/src/core/adaptive/adaptive_representation_selector.ts +52 -35
  681. package/src/core/adaptive/buffer_based_chooser.ts +41 -13
  682. package/src/core/adaptive/guess_based_chooser.ts +4 -3
  683. package/src/core/adaptive/network_analyzer.ts +8 -6
  684. package/src/core/adaptive/utils/pending_requests_store.ts +15 -5
  685. package/src/core/api/debug/buffer_size_graph.ts +3 -1
  686. package/src/core/api/option_utils.ts +2 -2
  687. package/src/core/api/playback_observer.ts +16 -9
  688. package/src/core/api/public_api.ts +47 -31
  689. package/src/core/api/track_management/track_dispatcher.ts +9 -6
  690. package/src/core/api/track_management/tracks_store.ts +112 -90
  691. package/src/core/api/utils.ts +3 -3
  692. package/src/core/decrypt/__tests__/__global__/get_license.test.ts +3 -3
  693. package/src/core/decrypt/__tests__/__global__/init_data.test.ts +24 -14
  694. package/src/core/decrypt/__tests__/__global__/media_key_system_access.test.ts +74 -48
  695. package/src/core/decrypt/__tests__/__global__/media_keys.test.ts +21 -15
  696. package/src/core/decrypt/__tests__/__global__/server_certificate.test.ts +16 -13
  697. package/src/core/decrypt/__tests__/__global__/utils.ts +39 -24
  698. package/src/core/decrypt/attach_media_keys.ts +33 -8
  699. package/src/core/decrypt/clear_on_stop.ts +1 -1
  700. package/src/core/decrypt/content_decryptor.ts +213 -262
  701. package/src/core/decrypt/create_or_load_session.ts +1 -1
  702. package/src/core/decrypt/create_session.ts +1 -1
  703. package/src/core/decrypt/dispose_decryption_resources.ts +19 -4
  704. package/src/core/decrypt/find_key_system.ts +24 -19
  705. package/src/core/decrypt/get_media_keys.ts +2 -2
  706. package/src/core/decrypt/index.ts +1 -6
  707. package/src/core/decrypt/session_events_listener.ts +3 -4
  708. package/src/core/decrypt/set_server_certificate.ts +1 -1
  709. package/src/core/decrypt/types.ts +69 -0
  710. package/src/core/decrypt/utils/check_key_statuses.ts +1 -1
  711. package/src/core/decrypt/utils/is_session_usable.ts +1 -1
  712. package/src/core/decrypt/utils/key_id_comparison.ts +2 -27
  713. package/src/core/decrypt/utils/key_session_record.ts +3 -5
  714. package/src/core/decrypt/utils/loaded_sessions_store.ts +2 -2
  715. package/src/core/decrypt/utils/media_keys_infos_store.ts +4 -1
  716. package/src/core/decrypt/utils/persistent_sessions_store.ts +2 -5
  717. package/src/core/decrypt/utils/server_certificate_store.ts +1 -1
  718. package/src/core/fetchers/cdn_prioritizer.ts +1 -1
  719. package/src/core/fetchers/manifest/manifest_fetcher.ts +22 -18
  720. package/src/core/fetchers/segment/segment_fetcher.ts +3 -2
  721. package/src/core/fetchers/utils/schedule_request.ts +6 -5
  722. package/src/core/init/directfile_content_initializer.ts +85 -21
  723. package/src/core/init/index.ts +6 -7
  724. package/src/core/init/media_source_content_initializer.ts +56 -26
  725. package/src/core/init/types.ts +2 -16
  726. package/src/core/init/utils/__tests__/refresh_scheduled_events_list.test.ts +22 -8
  727. package/src/core/init/utils/create_media_source.ts +4 -1
  728. package/src/core/init/utils/create_stream_playback_observer.ts +24 -14
  729. package/src/core/init/utils/end_of_stream.ts +1 -0
  730. package/src/core/init/utils/get_initial_time.ts +3 -1
  731. package/src/core/init/utils/get_loaded_reference.ts +6 -3
  732. package/src/core/init/utils/initial_seek_and_play.ts +7 -7
  733. package/src/core/init/utils/initialize_content_decryption.ts +32 -39
  734. package/src/core/init/utils/media_source_duration_updater.ts +13 -9
  735. package/src/core/init/utils/rebuffering_controller.ts +13 -10
  736. package/src/core/init/utils/stream_events_emitter/refresh_scheduled_events_list.ts +7 -4
  737. package/src/core/init/utils/stream_events_emitter/stream_events_emitter.ts +113 -73
  738. package/src/core/segment_buffers/garbage_collector.ts +3 -3
  739. package/src/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.ts +10 -2
  740. package/src/core/segment_buffers/implementations/text/html/html_text_segment_buffer.ts +17 -17
  741. package/src/core/segment_buffers/implementations/text/html/text_track_cues_store.ts +1 -1
  742. package/src/core/segment_buffers/implementations/text/native/native_text_segment_buffer.ts +2 -2
  743. package/src/core/segment_buffers/implementations/utils/manual_time_ranges.ts +2 -2
  744. package/src/core/segment_buffers/inventory/buffered_history.ts +4 -3
  745. package/src/core/segment_buffers/inventory/segment_inventory.ts +1 -0
  746. package/src/core/stream/adaptation/adaptation_stream.ts +43 -28
  747. package/src/core/stream/adaptation/types.ts +15 -9
  748. package/src/core/stream/index.ts +2 -0
  749. package/src/core/stream/orchestrator/get_time_ranges_for_content.ts +1 -6
  750. package/src/core/stream/orchestrator/index.ts +2 -0
  751. package/src/core/stream/orchestrator/stream_orchestrator.ts +38 -42
  752. package/src/core/stream/period/period_stream.ts +62 -23
  753. package/src/core/stream/period/types.ts +5 -3
  754. package/src/core/stream/period/utils/get_adaptation_switch_strategy.ts +10 -0
  755. package/src/core/stream/representation/representation_stream.ts +6 -3
  756. package/src/core/stream/representation/types.ts +5 -5
  757. package/src/core/stream/representation/utils/append_segment_to_buffer.ts +2 -2
  758. package/src/core/stream/representation/utils/downloading_queue.ts +4 -5
  759. package/src/core/stream/representation/utils/force_garbage_collection.ts +3 -3
  760. package/src/core/stream/representation/utils/get_buffer_status.ts +2 -1
  761. package/src/core/stream/representation/utils/push_init_segment.ts +2 -3
  762. package/src/core/stream/representation/utils/push_media_segment.ts +2 -2
  763. package/src/errors/__tests__/encrypted_media_error.test.ts +2 -2
  764. package/src/errors/__tests__/error_message.test.ts +1 -1
  765. package/src/errors/__tests__/format_error.test.ts +2 -2
  766. package/src/errors/__tests__/media_error.test.ts +3 -3
  767. package/src/errors/__tests__/network_error.test.ts +10 -9
  768. package/src/errors/__tests__/other_error.test.ts +3 -3
  769. package/src/errors/__tests__/request_error.test.ts +4 -4
  770. package/src/errors/custom_loader_error.ts +0 -1
  771. package/src/errors/encrypted_media_error.ts +4 -2
  772. package/src/errors/error_message.ts +2 -7
  773. package/src/errors/media_error.ts +26 -20
  774. package/src/errors/network_error.ts +1 -1
  775. package/src/errors/other_error.ts +1 -1
  776. package/src/errors/request_error.ts +16 -1
  777. package/src/experimental/features/__tests__/dash_wasm.test.ts +4 -12
  778. package/src/experimental/features/__tests__/debug_element.test.ts +7 -21
  779. package/src/experimental/features/__tests__/local.test.ts +14 -23
  780. package/src/experimental/features/__tests__/metaplaylist.test.ts +14 -21
  781. package/src/experimental/features/dash_wasm.ts +3 -0
  782. package/src/experimental/features/index.ts +0 -1
  783. package/src/experimental/features/local.ts +3 -0
  784. package/src/experimental/features/metaplaylist.ts +3 -0
  785. package/src/experimental/tools/mediaCapabilitiesProber/__tests__/probers/DRMInfos.test.ts +10 -9
  786. package/src/experimental/tools/mediaCapabilitiesProber/__tests__/probers/HDCPPolicy.test.ts +26 -18
  787. package/src/experimental/tools/mediaCapabilitiesProber/__tests__/probers/mediaDisplayInfos.test.ts +24 -23
  788. package/src/experimental/tools/mediaCapabilitiesProber/api/index.ts +2 -4
  789. package/src/experimental/tools/mediaCapabilitiesProber/api/probeMediaConfiguration.ts +7 -4
  790. package/src/experimental/tools/mediaCapabilitiesProber/probers/DRMInfos.ts +5 -4
  791. package/src/experimental/tools/mediaCapabilitiesProber/probers/HDCPPolicy.ts +4 -3
  792. package/src/experimental/tools/mediaCapabilitiesProber/probers/mediaContentTypeWithFeatures/index.ts +4 -3
  793. package/src/experimental/tools/mediaCapabilitiesProber/probers/mediaDisplayInfos.ts +3 -2
  794. package/src/features/features_object.ts +2 -1
  795. package/src/features/list/__tests__/dash.test.ts +15 -15
  796. package/src/features/list/__tests__/directfile.test.ts +4 -13
  797. package/src/features/list/__tests__/eme.test.ts +4 -12
  798. package/src/features/list/__tests__/html_sami_parser.test.ts +9 -14
  799. package/src/features/list/__tests__/html_srt_parser.test.ts +5 -10
  800. package/src/features/list/__tests__/html_text_buffer.test.ts +10 -19
  801. package/src/features/list/__tests__/html_ttml_parser.test.ts +5 -10
  802. package/src/features/list/__tests__/html_vtt_parser.test.ts +5 -10
  803. package/src/features/list/__tests__/native_sami_parser.test.ts +9 -14
  804. package/src/features/list/__tests__/native_srt_parser.test.ts +5 -10
  805. package/src/features/list/__tests__/native_text_buffer.test.ts +5 -13
  806. package/src/features/list/__tests__/native_ttml_parser.test.ts +5 -10
  807. package/src/features/list/__tests__/native_vtt_parser.test.ts +5 -10
  808. package/src/features/list/__tests__/smooth.test.ts +10 -10
  809. package/src/features/list/dash.ts +3 -0
  810. package/src/features/list/eme.ts +1 -1
  811. package/src/features/list/html_sami_parser.ts +2 -0
  812. package/src/features/list/html_srt_parser.ts +2 -0
  813. package/src/features/list/html_text_buffer.ts +2 -2
  814. package/src/features/list/html_ttml_parser.ts +2 -0
  815. package/src/features/list/html_vtt_parser.ts +2 -0
  816. package/src/features/list/native_sami_parser.ts +3 -0
  817. package/src/features/list/native_srt_parser.ts +3 -0
  818. package/src/features/list/native_text_buffer.ts +3 -2
  819. package/src/features/list/native_ttml_parser.ts +3 -0
  820. package/src/features/list/native_vtt_parser.ts +3 -0
  821. package/src/features/list/smooth.ts +3 -0
  822. package/src/features/types.ts +89 -18
  823. package/src/index.ts +31 -5
  824. package/src/manifest/__tests__/manifest.test.ts +134 -75
  825. package/src/manifest/__tests__/period.test.ts +82 -55
  826. package/src/manifest/__tests__/update_periods.test.ts +4 -4
  827. package/src/manifest/manifest.ts +30 -20
  828. package/src/manifest/period.ts +3 -14
  829. package/src/manifest/representation.ts +21 -3
  830. package/src/minimal.ts +4 -18
  831. package/src/parsers/manifest/dash/common/__tests__/get_clock_offset.test.ts +2 -1
  832. package/src/parsers/manifest/dash/common/get_clock_offset.ts +5 -4
  833. package/src/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.ts +7 -4
  834. package/src/parsers/manifest/dash/common/manifest_bounds_calculator.ts +11 -5
  835. package/src/parsers/manifest/dash/common/parse_adaptation_sets.ts +1 -0
  836. package/src/parsers/manifest/dash/common/parse_mpd.ts +9 -5
  837. package/src/parsers/manifest/dash/common/parse_periods.ts +12 -6
  838. package/src/parsers/manifest/dash/common/parse_representation_index.ts +2 -2
  839. package/src/parsers/manifest/dash/common/parse_representations.ts +10 -0
  840. package/src/parsers/manifest/dash/js-parser/node_parsers/Representation.ts +7 -0
  841. package/src/parsers/manifest/dash/node_parser_types.ts +1 -0
  842. package/src/parsers/manifest/dash/parsers_types.ts +4 -4
  843. package/src/parsers/manifest/dash/wasm-parser/Cargo.lock +2 -2
  844. package/src/parsers/manifest/dash/wasm-parser/Cargo.toml +1 -1
  845. package/src/parsers/manifest/dash/wasm-parser/rs/errors.rs +3 -3
  846. package/src/parsers/manifest/dash/wasm-parser/rs/events.rs +37 -67
  847. package/src/parsers/manifest/dash/wasm-parser/rs/lib.rs +7 -7
  848. package/src/parsers/manifest/dash/wasm-parser/rs/processor/attributes.rs +94 -105
  849. package/src/parsers/manifest/dash/wasm-parser/rs/processor/mod.rs +119 -109
  850. package/src/parsers/manifest/dash/wasm-parser/rs/processor/s_element.rs +24 -26
  851. package/src/parsers/manifest/dash/wasm-parser/rs/reader.rs +2 -2
  852. package/src/parsers/manifest/dash/wasm-parser/rs/reportable.rs +42 -18
  853. package/src/parsers/manifest/dash/wasm-parser/rs/utils.rs +29 -29
  854. package/src/parsers/manifest/dash/wasm-parser/ts/dash-wasm-parser.ts +2 -1
  855. package/src/parsers/manifest/dash/wasm-parser/ts/generators/BaseURL.ts +1 -1
  856. package/src/parsers/manifest/dash/wasm-parser/ts/generators/Representation.ts +12 -0
  857. package/src/parsers/manifest/local/parse_local_manifest.ts +3 -1
  858. package/src/parsers/manifest/local/types.ts +2 -0
  859. package/src/parsers/manifest/metaplaylist/metaplaylist_parser.ts +3 -1
  860. package/src/parsers/manifest/smooth/create_parser.ts +4 -3
  861. package/src/parsers/manifest/smooth/representation_index.ts +6 -5
  862. package/src/parsers/manifest/smooth/shared_smooth_segment_timeline.ts +6 -5
  863. package/src/parsers/manifest/types.ts +6 -4
  864. package/src/parsers/manifest/utils/__tests__/update_segment_timeline.test.ts +1 -2
  865. package/src/parsers/texttracks/ttml/html/__tests__/__global__/html_ttml_parser.test.test.ts +2 -1
  866. package/src/parsers/texttracks/webvtt/html/__tests__/convert_payload_to_html.test.ts +9 -7
  867. package/src/public_types.ts +11 -9
  868. package/src/transports/dash/manifest_parser.ts +8 -5
  869. package/src/transports/local/pipelines.ts +4 -3
  870. package/src/transports/metaplaylist/pipelines.ts +5 -3
  871. package/src/transports/smooth/pipelines.ts +4 -2
  872. package/src/transports/smooth/segment_loader.ts +1 -1
  873. package/src/transports/types.ts +17 -7
  874. package/src/transports/utils/__tests__/check_isobmff_integrity.test.ts +8 -8
  875. package/src/transports/utils/call_custom_manifest_loader.ts +2 -1
  876. package/src/transports/utils/get_isobmff_timing_infos.ts +0 -3
  877. package/src/typings/globals.d.ts +0 -44
  878. package/src/utils/__tests__/base64.test.ts +4 -2
  879. package/src/utils/__tests__/id_generator.test.ts +7 -4
  880. package/src/utils/__tests__/ranges.test.ts +354 -47
  881. package/src/utils/are_arrays_of_numbers_equal.ts +5 -1
  882. package/src/utils/assert.ts +4 -1
  883. package/src/utils/deep_merge.ts +2 -2
  884. package/src/utils/monotonic_timestamp.ts +12 -0
  885. package/src/utils/ranges.ts +110 -14
  886. package/src/utils/reference.ts +235 -237
  887. package/src/utils/request/fetch.ts +11 -9
  888. package/src/utils/request/xhr.ts +6 -5
  889. package/src/utils/string_parsing.ts +5 -4
  890. package/src/utils/wrapInPromise.ts +24 -0
  891. package/tsconfig.json +1 -1
  892. package/tsconfig.modules.json +3 -3
  893. package/appveyor.yml +0 -24
  894. package/dist/_esm5.processed/compat/has_eme_apis.d.ts +0 -21
  895. package/dist/_esm5.processed/compat/has_eme_apis.js +0 -24
  896. package/dist/_esm5.processed/core/stream/adaptation/utils/create_representation_estimator.d.ts +0 -47
  897. package/dist/_esm5.processed/core/stream/adaptation/utils/create_representation_estimator.js +0 -70
  898. package/dist/_esm5.processed/core/stream/utils/create_reload_request.d.ts +0 -32
  899. package/dist/_esm5.processed/core/stream/utils/create_reload_request.js +0 -54
  900. package/dist/_esm5.processed/features/initialize_features.d.ts +0 -19
  901. package/dist/_esm5.processed/features/initialize_features.js +0 -100
  902. package/dist/rx-player.d.ts +0 -3
  903. package/dist/rx-player.min.d.ts +0 -3
  904. package/src/compat/__tests__/has_eme_apis.test.ts +0 -56
  905. package/src/compat/has_eme_apis.ts +0 -26
  906. package/src/core/stream/adaptation/utils/create_representation_estimator.ts +0 -114
  907. package/src/core/stream/utils/create_reload_request.ts +0 -69
  908. package/src/features/__tests__/initialize_features.test.ts +0 -477
  909. package/src/features/initialize_features.ts +0 -120
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  /**
2
3
  * Copyright 2015 CANAL+ Group
3
4
  *
@@ -13,149 +14,115 @@
13
14
  * See the License for the specific language governing permissions and
14
15
  * limitations under the License.
15
16
  */
16
- var __extends = (this && this.__extends) || (function () {
17
- var extendStatics = function (d, b) {
18
- extendStatics = Object.setPrototypeOf ||
19
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
20
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
21
- return extendStatics(d, b);
22
- };
23
- return function (d, b) {
24
- if (typeof b !== "function" && b !== null)
25
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
26
- extendStatics(d, b);
27
- function __() { this.constructor = d; }
28
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
29
- };
30
- })();
31
- var __assign = (this && this.__assign) || function () {
32
- __assign = Object.assign || function(t) {
33
- for (var s, i = 1, n = arguments.length; i < n; i++) {
34
- s = arguments[i];
35
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
36
- t[p] = s[p];
37
- }
38
- return t;
39
- };
40
- return __assign.apply(this, arguments);
41
- };
17
+ Object.defineProperty(exports, "__esModule", { value: true });
42
18
  /**
43
19
  * This file defines the public API for the RxPlayer.
44
20
  * It also starts the different sub-parts of the player on various API calls.
45
21
  */
46
- import { events, getStartDate, } from "../../compat";
22
+ const compat_1 = require("../../compat");
47
23
  /* eslint-disable-next-line max-len */
48
- import canRelyOnVideoVisibilityAndSize from "../../compat/can_rely_on_video_visibility_and_size";
49
- import config from "../../config";
50
- import { ErrorCodes, ErrorTypes, formatError, MediaError, } from "../../errors";
51
- import features from "../../features";
52
- import log from "../../log";
53
- import arrayFind from "../../utils/array_find";
54
- import arrayIncludes from "../../utils/array_includes";
55
- import assert from "../../utils/assert";
56
- import assertUnreachable from "../../utils/assert_unreachable";
57
- import EventEmitter from "../../utils/event_emitter";
58
- import idGenerator from "../../utils/id_generator";
59
- import isNullOrUndefined from "../../utils/is_null_or_undefined";
60
- import objectAssign from "../../utils/object_assign";
61
- import { getLeftSizeOfRange } from "../../utils/ranges";
62
- import createSharedReference, { createMappedReference, } from "../../utils/reference";
63
- import TaskCanceller from "../../utils/task_canceller";
64
- import { clearOnStop, disposeDecryptionResources, getKeySystemConfiguration, } from "../decrypt";
65
- import MediaSourceContentInitializer from "../init/media_source_content_initializer";
66
- import { checkReloadOptions, parseConstructorOptions, parseLoadVideoOptions, } from "./option_utils";
67
- import PlaybackObserver from "./playback_observer";
68
- import TracksStore from "./track_management/tracks_store";
69
- import { constructPlayerStateReference, emitPlayPauseEvents, emitSeekEvents, isLoadedState, } from "./utils";
24
+ const can_rely_on_video_visibility_and_size_1 = require("../../compat/can_rely_on_video_visibility_and_size");
25
+ const config_1 = require("../../config");
26
+ const errors_1 = require("../../errors");
27
+ const features_1 = require("../../features");
28
+ const log_1 = require("../../log");
29
+ const array_find_1 = require("../../utils/array_find");
30
+ const array_includes_1 = require("../../utils/array_includes");
31
+ const assert_1 = require("../../utils/assert");
32
+ const assert_unreachable_1 = require("../../utils/assert_unreachable");
33
+ const event_emitter_1 = require("../../utils/event_emitter");
34
+ const id_generator_1 = require("../../utils/id_generator");
35
+ const is_null_or_undefined_1 = require("../../utils/is_null_or_undefined");
36
+ const object_assign_1 = require("../../utils/object_assign");
37
+ const ranges_1 = require("../../utils/ranges");
38
+ const reference_1 = require("../../utils/reference");
39
+ const task_canceller_1 = require("../../utils/task_canceller");
40
+ const decrypt_1 = require("../decrypt");
41
+ const option_utils_1 = require("./option_utils");
42
+ const playback_observer_1 = require("./playback_observer");
43
+ const tracks_store_1 = require("./track_management/tracks_store");
44
+ const utils_1 = require("./utils");
70
45
  /* eslint-disable @typescript-eslint/naming-convention */
71
- var generateContentId = idGenerator();
72
- var getPictureOnPictureStateRef = events.getPictureOnPictureStateRef, getVideoVisibilityRef = events.getVideoVisibilityRef, getElementResolutionRef = events.getElementResolutionRef, getScreenResolutionRef = events.getScreenResolutionRef;
46
+ const generateContentId = (0, id_generator_1.default)();
47
+ const { getPictureOnPictureStateRef, getVideoVisibilityRef, getElementResolutionRef, getScreenResolutionRef } = compat_1.events;
73
48
  /**
74
49
  * @class Player
75
50
  * @extends EventEmitter
76
51
  */
77
- var Player = /** @class */ (function (_super) {
78
- __extends(Player, _super);
52
+ class Player extends event_emitter_1.default {
53
+ /** All possible Error types emitted by the RxPlayer. */
54
+ static get ErrorTypes() {
55
+ return errors_1.ErrorTypes;
56
+ }
57
+ /** All possible Error codes emitted by the RxPlayer. */
58
+ static get ErrorCodes() {
59
+ return errors_1.ErrorCodes;
60
+ }
61
+ /**
62
+ * Current log level.
63
+ * Update current log level.
64
+ * Should be either (by verbosity ascending):
65
+ * - "NONE"
66
+ * - "ERROR"
67
+ * - "WARNING"
68
+ * - "INFO"
69
+ * - "DEBUG"
70
+ * Any other value will be translated to "NONE".
71
+ */
72
+ static get LogLevel() {
73
+ return log_1.default.getLevel();
74
+ }
75
+ static set LogLevel(logLevel) {
76
+ log_1.default.setLevel(logLevel);
77
+ }
78
+ /**
79
+ * Add feature(s) to the RxPlayer.
80
+ * @param {Array.<Object>} featureList - Features wanted.
81
+ */
82
+ static addFeatures(featureList) {
83
+ (0, features_1.addFeatures)(featureList);
84
+ }
79
85
  /**
80
86
  * @constructor
81
87
  * @param {Object} options
82
88
  */
83
- function Player(options) {
84
- if (options === void 0) { options = {}; }
85
- var _this = _super.call(this) || this;
86
- var _a = parseConstructorOptions(options), baseBandwidth = _a.baseBandwidth, videoResolutionLimit = _a.videoResolutionLimit, maxBufferAhead = _a.maxBufferAhead, maxBufferBehind = _a.maxBufferBehind, throttleVideoBitrateWhenHidden = _a.throttleVideoBitrateWhenHidden, videoElement = _a.videoElement, wantedBufferAhead = _a.wantedBufferAhead, maxVideoBufferSize = _a.maxVideoBufferSize;
87
- var DEFAULT_UNMUTED_VOLUME = config.getCurrent().DEFAULT_UNMUTED_VOLUME;
89
+ constructor(options = {}) {
90
+ super();
91
+ const { baseBandwidth, videoResolutionLimit, maxBufferAhead, maxBufferBehind, throttleVideoBitrateWhenHidden, videoElement, wantedBufferAhead, maxVideoBufferSize } = (0, option_utils_1.parseConstructorOptions)(options);
92
+ const { DEFAULT_UNMUTED_VOLUME } = config_1.default.getCurrent();
88
93
  // Workaround to support Firefox autoplay on FF 42.
89
94
  // See: https://bugzilla.mozilla.org/show_bug.cgi?id=1194624
90
95
  videoElement.preload = "auto";
91
- _this.version = /* PLAYER_VERSION */ "4.0.0-beta.2";
92
- _this.log = log;
93
- _this.state = "STOPPED";
94
- _this.videoElement = videoElement;
95
- var destroyCanceller = new TaskCanceller();
96
- _this._destroyCanceller = destroyCanceller;
97
- _this._priv_pictureInPictureRef = getPictureOnPictureStateRef(videoElement, destroyCanceller.signal);
98
- _this._priv_speed = createSharedReference(videoElement.playbackRate, _this._destroyCanceller.signal);
99
- _this._priv_preferTrickModeTracks = false;
100
- _this._priv_contentLock = createSharedReference(false, _this._destroyCanceller.signal);
101
- _this._priv_bufferOptions = {
102
- wantedBufferAhead: createSharedReference(wantedBufferAhead, _this._destroyCanceller.signal),
103
- maxBufferAhead: createSharedReference(maxBufferAhead, _this._destroyCanceller.signal),
104
- maxBufferBehind: createSharedReference(maxBufferBehind, _this._destroyCanceller.signal),
105
- maxVideoBufferSize: createSharedReference(maxVideoBufferSize, _this._destroyCanceller.signal),
96
+ this.version = /* PLAYER_VERSION */ "4.0.0-beta.3";
97
+ this.log = log_1.default;
98
+ this.state = "STOPPED";
99
+ this.videoElement = videoElement;
100
+ const destroyCanceller = new task_canceller_1.default();
101
+ this._destroyCanceller = destroyCanceller;
102
+ this._priv_pictureInPictureRef = getPictureOnPictureStateRef(videoElement, destroyCanceller.signal);
103
+ this._priv_speed = new reference_1.default(videoElement.playbackRate, this._destroyCanceller.signal);
104
+ this._priv_preferTrickModeTracks = false;
105
+ this._priv_contentLock = new reference_1.default(false, this._destroyCanceller.signal);
106
+ this._priv_bufferOptions = {
107
+ wantedBufferAhead: new reference_1.default(wantedBufferAhead, this._destroyCanceller.signal),
108
+ maxBufferAhead: new reference_1.default(maxBufferAhead, this._destroyCanceller.signal),
109
+ maxBufferBehind: new reference_1.default(maxBufferBehind, this._destroyCanceller.signal),
110
+ maxVideoBufferSize: new reference_1.default(maxVideoBufferSize, this._destroyCanceller.signal),
106
111
  };
107
- _this._priv_bitrateInfos = {
112
+ this._priv_bitrateInfos = {
108
113
  lastBitrates: { audio: baseBandwidth,
109
114
  video: baseBandwidth },
110
115
  };
111
- _this._priv_throttleVideoBitrateWhenHidden = throttleVideoBitrateWhenHidden;
112
- _this._priv_videoResolutionLimit = videoResolutionLimit;
113
- _this._priv_mutedMemory = DEFAULT_UNMUTED_VOLUME;
114
- _this._priv_currentError = null;
115
- _this._priv_contentInfos = null;
116
- _this._priv_contentEventsMemory = {};
117
- _this._priv_setPlayerState("STOPPED" /* PLAYER_STATES.STOPPED */);
118
- _this._priv_reloadingMetadata = {};
119
- _this._priv_lastAutoPlay = false;
120
- return _this;
121
- }
122
- Object.defineProperty(Player, "ErrorTypes", {
123
- /** All possible Error types emitted by the RxPlayer. */
124
- get: function () {
125
- return ErrorTypes;
126
- },
127
- enumerable: false,
128
- configurable: true
129
- });
130
- Object.defineProperty(Player, "ErrorCodes", {
131
- /** All possible Error codes emitted by the RxPlayer. */
132
- get: function () {
133
- return ErrorCodes;
134
- },
135
- enumerable: false,
136
- configurable: true
137
- });
138
- Object.defineProperty(Player, "LogLevel", {
139
- /**
140
- * Current log level.
141
- * Update current log level.
142
- * Should be either (by verbosity ascending):
143
- * - "NONE"
144
- * - "ERROR"
145
- * - "WARNING"
146
- * - "INFO"
147
- * - "DEBUG"
148
- * Any other value will be translated to "NONE".
149
- */
150
- get: function () {
151
- return log.getLevel();
152
- },
153
- set: function (logLevel) {
154
- log.setLevel(logLevel);
155
- },
156
- enumerable: false,
157
- configurable: true
158
- });
116
+ this._priv_throttleVideoBitrateWhenHidden = throttleVideoBitrateWhenHidden;
117
+ this._priv_videoResolutionLimit = videoResolutionLimit;
118
+ this._priv_mutedMemory = DEFAULT_UNMUTED_VOLUME;
119
+ this._priv_currentError = null;
120
+ this._priv_contentInfos = null;
121
+ this._priv_contentEventsMemory = {};
122
+ this._priv_setPlayerState("STOPPED" /* PLAYER_STATES.STOPPED */);
123
+ this._priv_reloadingMetadata = {};
124
+ this._priv_lastAutoPlay = false;
125
+ }
159
126
  /**
160
127
  * Register a new callback for a player event event.
161
128
  *
@@ -164,17 +131,17 @@ var Player = /** @class */ (function (_super) {
164
131
  * The callback will take as argument the eventual payload of the event
165
132
  * (single argument).
166
133
  */
167
- Player.prototype.addEventListener = function (evt, fn) {
134
+ addEventListener(evt, fn) {
168
135
  // The EventEmitter's `addEventListener` method takes an optional third
169
136
  // argument that we do not want to expose in the public API.
170
137
  // We thus overwrite that function to remove any possible usage of that
171
138
  // third argument.
172
- return _super.prototype.addEventListener.call(this, evt, fn);
173
- };
139
+ return super.addEventListener(evt, fn);
140
+ }
174
141
  /**
175
142
  * Stop the playback for the current content.
176
143
  */
177
- Player.prototype.stop = function () {
144
+ stop() {
178
145
  if (this._priv_contentInfos !== null) {
179
146
  this._priv_contentInfos.currentContentCanceller.cancel();
180
147
  }
@@ -182,21 +149,21 @@ var Player = /** @class */ (function (_super) {
182
149
  if (this.state !== "STOPPED" /* PLAYER_STATES.STOPPED */) {
183
150
  this._priv_setPlayerState("STOPPED" /* PLAYER_STATES.STOPPED */);
184
151
  }
185
- };
152
+ }
186
153
  /**
187
154
  * Free the resources used by the player.
188
155
  * /!\ The player cannot be "used" anymore after this method has been called.
189
156
  */
190
- Player.prototype.dispose = function () {
157
+ dispose() {
191
158
  // free resources linked to the loaded content
192
159
  this.stop();
193
160
  if (this.videoElement !== null) {
194
161
  // free resources used for decryption management
195
- disposeDecryptionResources(this.videoElement)
196
- .catch(function (err) {
197
- var message = err instanceof Error ? err.message :
162
+ (0, decrypt_1.disposeDecryptionResources)(this.videoElement)
163
+ .catch((err) => {
164
+ const message = err instanceof Error ? err.message :
198
165
  "Unknown error";
199
- log.error("API: Could not dispose decryption resources: " + message);
166
+ log_1.default.error("API: Could not dispose decryption resources: " + message);
200
167
  });
201
168
  }
202
169
  // free resources linked to the Player instance
@@ -204,30 +171,30 @@ var Player = /** @class */ (function (_super) {
204
171
  this._priv_reloadingMetadata = {};
205
172
  // un-attach video element
206
173
  this.videoElement = null;
207
- };
174
+ }
208
175
  /**
209
176
  * Load a new video.
210
177
  * @param {Object} opts
211
178
  */
212
- Player.prototype.loadVideo = function (opts) {
213
- var options = parseLoadVideoOptions(opts);
214
- log.info("API: Calling loadvideo", options.url, options.transport);
215
- this._priv_reloadingMetadata = { options: options };
179
+ loadVideo(opts) {
180
+ const options = (0, option_utils_1.parseLoadVideoOptions)(opts);
181
+ log_1.default.info("API: Calling loadvideo", options.url, options.transport);
182
+ this._priv_reloadingMetadata = { options };
216
183
  this._priv_initializeContentPlayback(options);
217
184
  this._priv_lastAutoPlay = options.autoPlay;
218
- };
185
+ }
219
186
  /**
220
187
  * Reload the last loaded content.
221
188
  * @param {Object} reloadOpts
222
189
  */
223
- Player.prototype.reload = function (reloadOpts) {
190
+ reload(reloadOpts) {
224
191
  var _a, _b;
225
- var _c = this._priv_reloadingMetadata, options = _c.options, manifest = _c.manifest, reloadPosition = _c.reloadPosition, reloadInPause = _c.reloadInPause;
192
+ const { options, manifest, reloadPosition, reloadInPause } = this._priv_reloadingMetadata;
226
193
  if (options === undefined) {
227
194
  throw new Error("API: Can't reload without having previously loaded a content.");
228
195
  }
229
- checkReloadOptions(reloadOpts);
230
- var startAt;
196
+ (0, option_utils_1.checkReloadOptions)(reloadOpts);
197
+ let startAt;
231
198
  if (((_a = reloadOpts === null || reloadOpts === void 0 ? void 0 : reloadOpts.reloadAt) === null || _a === void 0 ? void 0 : _a.position) !== undefined) {
232
199
  startAt = { position: reloadOpts.reloadAt.position };
233
200
  }
@@ -242,14 +209,14 @@ var Player = /** @class */ (function (_super) {
242
209
  else if (reloadPosition !== undefined) {
243
210
  startAt = { position: reloadPosition };
244
211
  }
245
- var autoPlay;
212
+ let autoPlay;
246
213
  if ((reloadOpts === null || reloadOpts === void 0 ? void 0 : reloadOpts.autoPlay) !== undefined) {
247
214
  autoPlay = reloadOpts.autoPlay;
248
215
  }
249
216
  else if (reloadInPause !== undefined) {
250
217
  autoPlay = !reloadInPause;
251
218
  }
252
- var newOptions = __assign(__assign({}, options), { initialManifest: manifest });
219
+ const newOptions = Object.assign(Object.assign({}, options), { initialManifest: manifest });
253
220
  if (startAt !== undefined) {
254
221
  newOptions.startAt = startAt;
255
222
  }
@@ -257,66 +224,79 @@ var Player = /** @class */ (function (_super) {
257
224
  newOptions.autoPlay = autoPlay;
258
225
  }
259
226
  this._priv_initializeContentPlayback(newOptions);
260
- };
261
- Player.prototype.createDebugElement = function (element) {
262
- if (features.createDebugElement === null) {
227
+ }
228
+ createDebugElement(element) {
229
+ if (features_1.default.createDebugElement === null) {
263
230
  throw new Error("Feature `DEBUG_ELEMENT` not added to the RxPlayer");
264
231
  }
265
- var canceller = new TaskCanceller();
266
- features.createDebugElement(element, this, canceller.signal);
232
+ const canceller = new task_canceller_1.default();
233
+ features_1.default.createDebugElement(element, this, canceller.signal);
267
234
  return {
268
- dispose: function () {
235
+ dispose() {
269
236
  canceller.cancel();
270
237
  },
271
238
  };
272
- };
239
+ }
273
240
  /**
274
241
  * From given options, initialize content playback.
275
242
  * @param {Object} options
276
243
  */
277
- Player.prototype._priv_initializeContentPlayback = function (options) {
278
- var _this = this;
244
+ _priv_initializeContentPlayback(options) {
279
245
  var _a, _b, _c, _d;
280
- var autoPlay = options.autoPlay, defaultAudioTrackSwitchingMode = options.defaultAudioTrackSwitchingMode, enableFastSwitching = options.enableFastSwitching, initialManifest = options.initialManifest, keySystems = options.keySystems, lowLatencyMode = options.lowLatencyMode, minimumManifestUpdateInterval = options.minimumManifestUpdateInterval, requestConfig = options.requestConfig, onCodecSwitch = options.onCodecSwitch, startAt = options.startAt, transport = options.transport, checkMediaSegmentIntegrity = options.checkMediaSegmentIntegrity, manifestLoader = options.manifestLoader, manifestUpdateUrl = options.manifestUpdateUrl, referenceDateTime = options.referenceDateTime, representationFilter = options.representationFilter, segmentLoader = options.segmentLoader, serverSyncInfos = options.serverSyncInfos, __priv_patchLastSegmentInSidx = options.__priv_patchLastSegmentInSidx, url = options.url;
246
+ const { autoPlay, defaultAudioTrackSwitchingMode, enableFastSwitching, initialManifest, keySystems, lowLatencyMode, minimumManifestUpdateInterval, requestConfig, onCodecSwitch, startAt, transport, checkMediaSegmentIntegrity, manifestLoader, referenceDateTime, representationFilter, segmentLoader, serverSyncInfos, __priv_manifestUpdateUrl, __priv_patchLastSegmentInSidx, url } = options;
281
247
  // Perform multiple checks on the given options
282
248
  if (this.videoElement === null) {
283
249
  throw new Error("the attached video element is disposed");
284
250
  }
285
- var isDirectFile = transport === "directfile";
251
+ const isDirectFile = transport === "directfile";
286
252
  /** Emit to stop the current content. */
287
- var currentContentCanceller = new TaskCanceller();
288
- var videoElement = this.videoElement;
289
- var initializer;
290
- var mediaElementTracksStore = null;
253
+ const currentContentCanceller = new task_canceller_1.default();
254
+ const videoElement = this.videoElement;
255
+ let initializer;
256
+ let mediaElementTracksStore = null;
291
257
  if (!isDirectFile) {
292
- var transportFn = features.transports[transport];
258
+ const transportFn = features_1.default.transports[transport];
293
259
  if (typeof transportFn !== "function") {
294
260
  // Stop previous content and reset its state
295
261
  this.stop();
296
262
  this._priv_currentError = null;
297
- throw new Error("transport \"".concat(transport, "\" not supported"));
263
+ throw new Error(`transport "${transport}" not supported`);
298
264
  }
299
- var transportPipelines = transportFn({ lowLatencyMode: lowLatencyMode, checkMediaSegmentIntegrity: checkMediaSegmentIntegrity, manifestLoader: manifestLoader, manifestUpdateUrl: manifestUpdateUrl, referenceDateTime: referenceDateTime, representationFilter: representationFilter, segmentLoader: segmentLoader, serverSyncInfos: serverSyncInfos, __priv_patchLastSegmentInSidx: __priv_patchLastSegmentInSidx });
265
+ if (features_1.default.mediaSourceInit === null) {
266
+ throw new Error("MediaSource streaming not supported");
267
+ }
268
+ const transportPipelines = transportFn({ lowLatencyMode,
269
+ checkMediaSegmentIntegrity,
270
+ manifestLoader,
271
+ referenceDateTime,
272
+ representationFilter,
273
+ segmentLoader,
274
+ serverSyncInfos,
275
+ __priv_manifestUpdateUrl,
276
+ __priv_patchLastSegmentInSidx });
300
277
  /** Interface used to load and refresh the Manifest. */
301
- var manifestRequestSettings = { lowLatencyMode: lowLatencyMode, maxRetry: (_a = requestConfig.manifest) === null || _a === void 0 ? void 0 : _a.maxRetry,
302
- requestTimeout: (_b = requestConfig.manifest) === null || _b === void 0 ? void 0 : _b.timeout, minimumManifestUpdateInterval: minimumManifestUpdateInterval, initialManifest: initialManifest };
303
- var relyOnVideoVisibilityAndSize = canRelyOnVideoVisibilityAndSize();
304
- var throttlers = { throttleBitrate: {},
278
+ const manifestRequestSettings = { lowLatencyMode,
279
+ maxRetry: (_a = requestConfig.manifest) === null || _a === void 0 ? void 0 : _a.maxRetry,
280
+ requestTimeout: (_b = requestConfig.manifest) === null || _b === void 0 ? void 0 : _b.timeout,
281
+ minimumManifestUpdateInterval,
282
+ initialManifest };
283
+ const relyOnVideoVisibilityAndSize = (0, can_rely_on_video_visibility_and_size_1.default)();
284
+ const throttlers = { throttleBitrate: {},
305
285
  limitResolution: {} };
306
286
  if (this._priv_throttleVideoBitrateWhenHidden) {
307
287
  if (!relyOnVideoVisibilityAndSize) {
308
- log.warn("API: Can't apply throttleVideoBitrateWhenHidden because " +
288
+ log_1.default.warn("API: Can't apply throttleVideoBitrateWhenHidden because " +
309
289
  "browser can't be trusted for visibility.");
310
290
  }
311
291
  else {
312
292
  throttlers.throttleBitrate = {
313
- video: createMappedReference(getVideoVisibilityRef(this._priv_pictureInPictureRef, currentContentCanceller.signal), function (isActive) { return isActive ? Infinity : 0; }, currentContentCanceller.signal),
293
+ video: (0, reference_1.createMappedReference)(getVideoVisibilityRef(this._priv_pictureInPictureRef, currentContentCanceller.signal), isActive => isActive ? Infinity : 0, currentContentCanceller.signal),
314
294
  };
315
295
  }
316
296
  }
317
297
  if (this._priv_videoResolutionLimit === "videoElement") {
318
298
  if (!relyOnVideoVisibilityAndSize) {
319
- log.warn("API: Can't apply videoResolutionLimit because browser can't be " +
299
+ log_1.default.warn("API: Can't apply videoResolutionLimit because browser can't be " +
320
300
  "trusted for video size.");
321
301
  }
322
302
  else {
@@ -331,113 +311,102 @@ var Player = /** @class */ (function (_super) {
331
311
  };
332
312
  }
333
313
  /** Options used by the adaptive logic. */
334
- var adaptiveOptions = {
314
+ const adaptiveOptions = {
335
315
  initialBitrates: this._priv_bitrateInfos.lastBitrates,
336
- lowLatencyMode: lowLatencyMode,
337
- throttlers: throttlers,
316
+ lowLatencyMode,
317
+ throttlers,
338
318
  };
339
319
  /** Options used by the TextTrack SegmentBuffer. */
340
- var textTrackOptions = options.textTrackMode === "native" ?
320
+ const textTrackOptions = options.textTrackMode === "native" ?
341
321
  { textTrackMode: "native" } :
342
322
  { textTrackMode: "html",
343
323
  textTrackElement: options.textTrackElement };
344
- var bufferOptions = objectAssign({ enableFastSwitching: enableFastSwitching, onCodecSwitch: onCodecSwitch }, this._priv_bufferOptions);
345
- var segmentRequestOptions = { lowLatencyMode: lowLatencyMode, maxRetry: (_c = requestConfig.segment) === null || _c === void 0 ? void 0 : _c.maxRetry,
324
+ const bufferOptions = (0, object_assign_1.default)({ enableFastSwitching,
325
+ onCodecSwitch }, this._priv_bufferOptions);
326
+ const segmentRequestOptions = { lowLatencyMode,
327
+ maxRetry: (_c = requestConfig.segment) === null || _c === void 0 ? void 0 : _c.maxRetry,
346
328
  requestTimeout: (_d = requestConfig.segment) === null || _d === void 0 ? void 0 : _d.timeout };
347
- initializer = new MediaSourceContentInitializer({
348
- adaptiveOptions: adaptiveOptions,
349
- autoPlay: autoPlay,
350
- bufferOptions: bufferOptions,
351
- keySystems: keySystems,
352
- lowLatencyMode: lowLatencyMode,
353
- manifestRequestSettings: manifestRequestSettings,
329
+ initializer = new features_1.default.mediaSourceInit({
330
+ adaptiveOptions,
331
+ autoPlay,
332
+ bufferOptions,
333
+ keySystems,
334
+ lowLatencyMode,
335
+ manifestRequestSettings,
354
336
  transport: transportPipelines,
355
- segmentRequestOptions: segmentRequestOptions,
337
+ segmentRequestOptions,
356
338
  speed: this._priv_speed,
357
- startAt: startAt,
358
- textTrackOptions: textTrackOptions,
359
- url: url,
339
+ startAt,
340
+ textTrackOptions,
341
+ url,
360
342
  });
361
343
  }
362
344
  else {
363
- if (features.directfile === null) {
345
+ if (features_1.default.directfile === null) {
364
346
  this.stop();
365
347
  this._priv_currentError = null;
366
348
  throw new Error("DirectFile feature not activated in your build.");
367
349
  }
350
+ else if ((0, is_null_or_undefined_1.default)(url)) {
351
+ throw new Error("No URL for a DirectFile content");
352
+ }
368
353
  mediaElementTracksStore =
369
354
  this._priv_initializeMediaElementTracksStore(currentContentCanceller.signal);
370
355
  if (currentContentCanceller.isUsed()) {
371
356
  return;
372
357
  }
373
- initializer = new features.directfile.initDirectFile({ autoPlay: autoPlay, keySystems: keySystems, speed: this._priv_speed, startAt: startAt, url: url });
358
+ initializer = new features_1.default.directfile.initDirectFile({ autoPlay,
359
+ keySystems,
360
+ speed: this._priv_speed,
361
+ startAt,
362
+ url });
374
363
  }
375
364
  /** Future `this._priv_contentInfos` related to this content. */
376
- var contentInfos = {
365
+ const contentInfos = {
377
366
  contentId: generateContentId(),
378
367
  originalUrl: url,
379
- currentContentCanceller: currentContentCanceller,
380
- defaultAudioTrackSwitchingMode: defaultAudioTrackSwitchingMode,
381
- initializer: initializer,
382
- isDirectFile: isDirectFile,
368
+ currentContentCanceller,
369
+ defaultAudioTrackSwitchingMode,
370
+ initializer,
371
+ isDirectFile,
383
372
  segmentBuffersStore: null,
384
373
  manifest: null,
385
374
  currentPeriod: null,
386
375
  activeAdaptations: null,
387
376
  activeRepresentations: null,
388
377
  tracksStore: null,
389
- mediaElementTracksStore: mediaElementTracksStore,
378
+ mediaElementTracksStore,
390
379
  };
391
380
  // Bind events
392
- initializer.addEventListener("error", function (error) {
393
- _this._priv_onFatalError(error, contentInfos);
381
+ initializer.addEventListener("error", (error) => {
382
+ this._priv_onFatalError(error, contentInfos);
394
383
  });
395
- initializer.addEventListener("warning", function (error) {
396
- var formattedError = formatError(error, {
384
+ initializer.addEventListener("warning", (error) => {
385
+ const formattedError = (0, errors_1.formatError)(error, {
397
386
  defaultCode: "NONE",
398
387
  defaultReason: "An unknown error happened.",
399
388
  });
400
- log.warn("API: Sending warning:", formattedError);
401
- _this.trigger("warning", formattedError);
389
+ log_1.default.warn("API: Sending warning:", formattedError);
390
+ this.trigger("warning", formattedError);
402
391
  });
403
- initializer.addEventListener("reloadingMediaSource", function (payload) {
392
+ initializer.addEventListener("reloadingMediaSource", (payload) => {
404
393
  contentInfos.segmentBuffersStore = null;
405
394
  if (contentInfos.tracksStore !== null) {
406
395
  contentInfos.tracksStore.resetPeriodObjects();
407
396
  }
408
- _this._priv_lastAutoPlay = payload.autoPlay;
409
- });
410
- initializer.addEventListener("inbandEvents", function (inbandEvents) {
411
- return _this.trigger("inbandEvents", inbandEvents);
412
- });
413
- initializer.addEventListener("streamEvent", function (streamEvent) {
414
- return _this.trigger("streamEvent", streamEvent);
415
- });
416
- initializer.addEventListener("streamEventSkip", function (streamEventSkip) {
417
- return _this.trigger("streamEventSkip", streamEventSkip);
418
- });
419
- initializer.addEventListener("activePeriodChanged", function (periodInfo) {
420
- return _this._priv_onActivePeriodChanged(contentInfos, periodInfo);
421
- });
422
- initializer.addEventListener("periodStreamReady", function (periodReadyInfo) {
423
- return _this._priv_onPeriodStreamReady(contentInfos, periodReadyInfo);
424
- });
425
- initializer.addEventListener("periodStreamCleared", function (periodClearedInfo) {
426
- return _this._priv_onPeriodStreamCleared(contentInfos, periodClearedInfo);
427
- });
428
- initializer.addEventListener("representationChange", function (representationInfo) {
429
- return _this._priv_onRepresentationChange(contentInfos, representationInfo);
397
+ this._priv_lastAutoPlay = payload.autoPlay;
430
398
  });
431
- initializer.addEventListener("adaptationChange", function (adaptationInfo) {
432
- return _this._priv_onAdaptationChange(contentInfos, adaptationInfo);
433
- });
434
- initializer.addEventListener("bitrateEstimateChange", function (bitrateEstimateInfo) {
435
- return _this._priv_onBitrateEstimateChange(bitrateEstimateInfo);
436
- });
437
- initializer.addEventListener("manifestReady", function (manifest) {
438
- return _this._priv_onManifestReady(contentInfos, manifest);
439
- });
440
- initializer.addEventListener("loaded", function (evt) {
399
+ initializer.addEventListener("inbandEvents", (inbandEvents) => this.trigger("inbandEvents", inbandEvents));
400
+ initializer.addEventListener("streamEvent", (streamEvent) => this.trigger("streamEvent", streamEvent));
401
+ initializer.addEventListener("streamEventSkip", (streamEventSkip) => this.trigger("streamEventSkip", streamEventSkip));
402
+ initializer.addEventListener("activePeriodChanged", (periodInfo) => this._priv_onActivePeriodChanged(contentInfos, periodInfo));
403
+ initializer.addEventListener("periodStreamReady", (periodReadyInfo) => this._priv_onPeriodStreamReady(contentInfos, periodReadyInfo));
404
+ initializer.addEventListener("periodStreamCleared", (periodClearedInfo) => this._priv_onPeriodStreamCleared(contentInfos, periodClearedInfo));
405
+ initializer.addEventListener("representationChange", (representationInfo) => this._priv_onRepresentationChange(contentInfos, representationInfo));
406
+ initializer.addEventListener("adaptationChange", (adaptationInfo) => this._priv_onAdaptationChange(contentInfos, adaptationInfo));
407
+ initializer.addEventListener("bitrateEstimateChange", (bitrateEstimateInfo) => this._priv_onBitrateEstimateChange(bitrateEstimateInfo));
408
+ initializer.addEventListener("manifestReady", (manifest) => this._priv_onManifestReady(contentInfos, manifest));
409
+ initializer.addEventListener("loaded", (evt) => {
441
410
  contentInfos.segmentBuffersStore = evt.segmentBuffersStore;
442
411
  });
443
412
  // Now, that most events are linked, prepare the next content.
@@ -453,16 +422,16 @@ var Player = /** @class */ (function (_super) {
453
422
  // content.
454
423
  this.stop();
455
424
  /** Global "playback observer" which will emit playback conditions */
456
- var playbackObserver = new PlaybackObserver(videoElement, {
425
+ const playbackObserver = new playback_observer_1.default(videoElement, {
457
426
  withMediaSource: !isDirectFile,
458
- lowLatencyMode: lowLatencyMode,
427
+ lowLatencyMode,
459
428
  });
460
- currentContentCanceller.signal.register(function () {
429
+ currentContentCanceller.signal.register(() => {
461
430
  playbackObserver.stop();
462
431
  });
463
432
  // Update the RxPlayer's state at the right events
464
- var playerStateRef = constructPlayerStateReference(initializer, videoElement, playbackObserver, currentContentCanceller.signal);
465
- currentContentCanceller.signal.register(function () {
433
+ const playerStateRef = (0, utils_1.constructPlayerStateReference)(initializer, videoElement, playbackObserver, currentContentCanceller.signal);
434
+ currentContentCanceller.signal.register(() => {
466
435
  initializer.dispose();
467
436
  });
468
437
  /**
@@ -471,21 +440,21 @@ var Player = /** @class */ (function (_super) {
471
440
  * To call when either might change.
472
441
  * @param {string} state - The player state we're about to switch to.
473
442
  */
474
- var updateReloadingMetadata = function (state) {
443
+ const updateReloadingMetadata = (state) => {
475
444
  switch (state) {
476
445
  case "STOPPED":
477
446
  case "RELOADING":
478
447
  case "LOADING":
479
448
  break; // keep previous metadata
480
449
  case "ENDED":
481
- _this._priv_reloadingMetadata.reloadInPause = true;
482
- _this._priv_reloadingMetadata.reloadPosition =
450
+ this._priv_reloadingMetadata.reloadInPause = true;
451
+ this._priv_reloadingMetadata.reloadPosition =
483
452
  playbackObserver.getReference().getValue().position;
484
453
  break;
485
454
  default:
486
- var o = playbackObserver.getReference().getValue();
487
- _this._priv_reloadingMetadata.reloadInPause = o.paused;
488
- _this._priv_reloadingMetadata.reloadPosition = o.position;
455
+ const o = playbackObserver.getReference().getValue();
456
+ this._priv_reloadingMetadata.reloadInPause = o.paused;
457
+ this._priv_reloadingMetadata.reloadPosition = o.position;
489
458
  break;
490
459
  }
491
460
  };
@@ -494,41 +463,41 @@ var Player = /** @class */ (function (_super) {
494
463
  * events.
495
464
  * `null` when such events are not emitted currently.
496
465
  */
497
- var playPauseEventsCanceller = null;
466
+ let playPauseEventsCanceller = null;
498
467
  /**
499
468
  * Callback emitting `"play"` and `"pause`" events once the content is
500
469
  * loaded, starting from the state indicated in argument.
501
470
  * @param {boolean} willAutoPlay - If `false`, we're currently paused.
502
471
  */
503
- var triggerPlayPauseEventsWhenReady = function (willAutoPlay) {
472
+ const triggerPlayPauseEventsWhenReady = (willAutoPlay) => {
504
473
  if (playPauseEventsCanceller !== null) {
505
474
  playPauseEventsCanceller.cancel(); // cancel previous logic
506
475
  playPauseEventsCanceller = null;
507
476
  }
508
- playerStateRef.onUpdate(function (val, stopListeningToStateUpdates) {
509
- if (!isLoadedState(val)) {
477
+ playerStateRef.onUpdate((val, stopListeningToStateUpdates) => {
478
+ if (!(0, utils_1.isLoadedState)(val)) {
510
479
  return; // content not loaded yet: no event
511
480
  }
512
481
  stopListeningToStateUpdates();
513
482
  if (playPauseEventsCanceller !== null) {
514
483
  playPauseEventsCanceller.cancel();
515
484
  }
516
- playPauseEventsCanceller = new TaskCanceller();
485
+ playPauseEventsCanceller = new task_canceller_1.default();
517
486
  playPauseEventsCanceller.linkToSignal(currentContentCanceller.signal);
518
487
  if (willAutoPlay !== !videoElement.paused) {
519
488
  // paused status is not at the expected value on load: emit event
520
489
  if (videoElement.paused) {
521
- _this.trigger("pause", null);
490
+ this.trigger("pause", null);
522
491
  }
523
492
  else {
524
- _this.trigger("play", null);
493
+ this.trigger("play", null);
525
494
  }
526
495
  }
527
- emitPlayPauseEvents(videoElement, function () { return _this.trigger("play", null); }, function () { return _this.trigger("pause", null); }, currentContentCanceller.signal);
496
+ (0, utils_1.emitPlayPauseEvents)(videoElement, () => this.trigger("play", null), () => this.trigger("pause", null), currentContentCanceller.signal);
528
497
  }, { emitCurrentValue: false, clearSignal: currentContentCanceller.signal });
529
498
  };
530
499
  triggerPlayPauseEventsWhenReady(autoPlay);
531
- initializer.addEventListener("reloadingMediaSource", function (payload) {
500
+ initializer.addEventListener("reloadingMediaSource", (payload) => {
532
501
  triggerPlayPauseEventsWhenReady(payload.autoPlay);
533
502
  });
534
503
  /**
@@ -536,53 +505,53 @@ var Player = /** @class */ (function (_super) {
536
505
  * events.
537
506
  * `null` when such events are not emitted currently.
538
507
  */
539
- var seekEventsCanceller = null;
508
+ let seekEventsCanceller = null;
540
509
  // React to player state change
541
- playerStateRef.onUpdate(function (newState) {
510
+ playerStateRef.onUpdate((newState) => {
542
511
  updateReloadingMetadata(newState);
543
- _this._priv_setPlayerState(newState);
512
+ this._priv_setPlayerState(newState);
544
513
  if (currentContentCanceller.isUsed()) {
545
514
  return;
546
515
  }
547
516
  if (seekEventsCanceller !== null) {
548
- if (!isLoadedState(_this.state)) {
517
+ if (!(0, utils_1.isLoadedState)(this.state)) {
549
518
  seekEventsCanceller.cancel();
550
519
  seekEventsCanceller = null;
551
520
  }
552
521
  }
553
- else if (isLoadedState(_this.state)) {
554
- seekEventsCanceller = new TaskCanceller();
522
+ else if ((0, utils_1.isLoadedState)(this.state)) {
523
+ seekEventsCanceller = new task_canceller_1.default();
555
524
  seekEventsCanceller.linkToSignal(currentContentCanceller.signal);
556
- emitSeekEvents(videoElement, playbackObserver, function () { return _this.trigger("seeking", null); }, function () { return _this.trigger("seeked", null); }, seekEventsCanceller.signal);
525
+ (0, utils_1.emitSeekEvents)(videoElement, playbackObserver, () => this.trigger("seeking", null), () => this.trigger("seeked", null), seekEventsCanceller.signal);
557
526
  }
558
527
  }, { emitCurrentValue: true, clearSignal: currentContentCanceller.signal });
559
528
  // React to playback conditions change
560
- playbackObserver.listen(function (observation) {
561
- updateReloadingMetadata(_this.state);
562
- _this._priv_triggerPositionUpdate(contentInfos, observation);
529
+ playbackObserver.listen((observation) => {
530
+ updateReloadingMetadata(this.state);
531
+ this._priv_triggerPositionUpdate(contentInfos, observation);
563
532
  }, { clearSignal: currentContentCanceller.signal });
564
533
  this._priv_currentError = null;
565
534
  this._priv_contentInfos = contentInfos;
566
- currentContentCanceller.signal.register(function () {
535
+ currentContentCanceller.signal.register(() => {
567
536
  initializer.removeEventListener();
568
537
  });
569
538
  // initialize the content only when the lock is inactive
570
- this._priv_contentLock.onUpdate(function (isLocked, stopListeningToLock) {
539
+ this._priv_contentLock.onUpdate((isLocked, stopListeningToLock) => {
571
540
  if (!isLocked) {
572
541
  stopListeningToLock();
573
542
  // start playback!
574
543
  initializer.start(videoElement, playbackObserver);
575
544
  }
576
545
  }, { emitCurrentValue: true, clearSignal: currentContentCanceller.signal });
577
- };
546
+ }
578
547
  /**
579
548
  * Returns fatal error if one for the current content.
580
549
  * null otherwise.
581
550
  * @returns {Object|null} - The current Error (`null` when no error).
582
551
  */
583
- Player.prototype.getError = function () {
552
+ getError() {
584
553
  return this._priv_currentError;
585
- };
554
+ }
586
555
  /**
587
556
  * Returns the media DOM element used by the player.
588
557
  * You should not its HTML5 API directly and use the player's method instead,
@@ -590,30 +559,30 @@ var Player = /** @class */ (function (_super) {
590
559
  * @returns {HTMLMediaElement|null} - The HTMLMediaElement used (`null` when
591
560
  * disposed)
592
561
  */
593
- Player.prototype.getVideoElement = function () {
562
+ getVideoElement() {
594
563
  return this.videoElement;
595
- };
564
+ }
596
565
  /**
597
566
  * Returns the player's current state.
598
567
  * @returns {string} - The current Player's state
599
568
  */
600
- Player.prototype.getPlayerState = function () {
569
+ getPlayerState() {
601
570
  return this.state;
602
- };
571
+ }
603
572
  /**
604
573
  * Returns true if a content is loaded.
605
574
  * @returns {Boolean} - `true` if a content is loaded, `false` otherwise.
606
575
  */
607
- Player.prototype.isContentLoaded = function () {
608
- return !arrayIncludes(["LOADING", "RELOADING", "STOPPED"], this.state);
609
- };
576
+ isContentLoaded() {
577
+ return !(0, array_includes_1.default)(["LOADING", "RELOADING", "STOPPED"], this.state);
578
+ }
610
579
  /**
611
580
  * Returns true if the player is buffering.
612
581
  * @returns {Boolean} - `true` if the player is buffering, `false` otherwise.
613
582
  */
614
- Player.prototype.isBuffering = function () {
615
- return arrayIncludes(["BUFFERING", "SEEKING", "LOADING", "RELOADING"], this.state);
616
- };
583
+ isBuffering() {
584
+ return (0, array_includes_1.default)(["BUFFERING", "SEEKING", "LOADING", "RELOADING"], this.state);
585
+ }
617
586
  /**
618
587
  * Returns the play/pause status of the player :
619
588
  * - when `LOADING` or `RELOADING`, returns the scheduled play/pause condition
@@ -623,9 +592,9 @@ var Player = /** @class */ (function (_super) {
623
592
  * @returns {Boolean} - `true` if the player is paused or will be after loading,
624
593
  * `false` otherwise.
625
594
  */
626
- Player.prototype.isPaused = function () {
595
+ isPaused() {
627
596
  if (this.videoElement) {
628
- if (arrayIncludes(["LOADING", "RELOADING"], this.state)) {
597
+ if ((0, array_includes_1.default)(["LOADING", "RELOADING"], this.state)) {
629
598
  return !this._priv_lastAutoPlay;
630
599
  }
631
600
  else {
@@ -633,43 +602,43 @@ var Player = /** @class */ (function (_super) {
633
602
  }
634
603
  }
635
604
  return true;
636
- };
605
+ }
637
606
  /**
638
607
  * Returns true if both:
639
608
  * - a content is loaded
640
609
  * - the content loaded is a live content
641
610
  * @returns {Boolean} - `true` if we're playing a live content, `false` otherwise.
642
611
  */
643
- Player.prototype.isLive = function () {
612
+ isLive() {
644
613
  if (this._priv_contentInfos === null) {
645
614
  return false;
646
615
  }
647
- var _a = this._priv_contentInfos, isDirectFile = _a.isDirectFile, manifest = _a.manifest;
616
+ const { isDirectFile, manifest } = this._priv_contentInfos;
648
617
  if (isDirectFile || manifest === null) {
649
618
  return false;
650
619
  }
651
620
  return manifest.isLive;
652
- };
621
+ }
653
622
  /**
654
623
  * Returns `true` if trickmode playback is active (usually through the usage
655
624
  * of the `setPlaybackRate` method), which means that the RxPlayer selects
656
625
  * "trickmode" video tracks in priority.
657
626
  * @returns {Boolean}
658
627
  */
659
- Player.prototype.areTrickModeTracksEnabled = function () {
628
+ areTrickModeTracksEnabled() {
660
629
  return this._priv_preferTrickModeTracks;
661
- };
630
+ }
662
631
  /**
663
632
  * Returns the URL(s) of the currently considered Manifest, or of the content for
664
633
  * directfile content.
665
634
  * @returns {Array.<string>|undefined} - Current URL. `undefined` if not known
666
635
  * or no URL yet.
667
636
  */
668
- Player.prototype.getContentUrls = function () {
637
+ getContentUrls() {
669
638
  if (this._priv_contentInfos === null) {
670
639
  return undefined;
671
640
  }
672
- var _a = this._priv_contentInfos, isDirectFile = _a.isDirectFile, manifest = _a.manifest, originalUrl = _a.originalUrl;
641
+ const { isDirectFile, manifest, originalUrl } = this._priv_contentInfos;
673
642
  if (isDirectFile) {
674
643
  return originalUrl === undefined ? undefined :
675
644
  [originalUrl];
@@ -678,7 +647,7 @@ var Player = /** @class */ (function (_super) {
678
647
  return manifest.getUrls();
679
648
  }
680
649
  return undefined;
681
- };
650
+ }
682
651
  /**
683
652
  * Update URL of the content currently being played (e.g. DASH's MPD).
684
653
  * @param {Array.<string>|undefined} urls - URLs to reach that content /
@@ -687,41 +656,41 @@ var Player = /** @class */ (function (_super) {
687
656
  * @param {boolean} params.refresh - If `true` the resource in question
688
657
  * (e.g. DASH's MPD) will be refreshed immediately.
689
658
  */
690
- Player.prototype.updateContentUrls = function (urls, params) {
659
+ updateContentUrls(urls, params) {
691
660
  if (this._priv_contentInfos === null) {
692
661
  throw new Error("No content loaded");
693
662
  }
694
- var refreshNow = (params === null || params === void 0 ? void 0 : params.refresh) === true;
663
+ const refreshNow = (params === null || params === void 0 ? void 0 : params.refresh) === true;
695
664
  this._priv_contentInfos.initializer.updateContentUrls(urls, refreshNow);
696
- };
665
+ }
697
666
  /**
698
667
  * Returns the video duration, in seconds.
699
668
  * NaN if no video is playing.
700
669
  * @returns {Number}
701
670
  */
702
- Player.prototype.getMediaDuration = function () {
671
+ getMediaDuration() {
703
672
  if (this.videoElement === null) {
704
673
  throw new Error("Disposed player");
705
674
  }
706
675
  return this.videoElement.duration;
707
- };
676
+ }
708
677
  /**
709
678
  * Returns in seconds the difference between:
710
679
  * - the end of the current contiguous loaded range.
711
680
  * - the current time
712
681
  * @returns {Number}
713
682
  */
714
- Player.prototype.getCurrentBufferGap = function () {
683
+ getCurrentBufferGap() {
715
684
  if (this.videoElement === null) {
716
685
  throw new Error("Disposed player");
717
686
  }
718
- var videoElement = this.videoElement;
719
- var bufferGap = getLeftSizeOfRange(videoElement.buffered, videoElement.currentTime);
687
+ const videoElement = this.videoElement;
688
+ const bufferGap = (0, ranges_1.getLeftSizeOfBufferedTimeRange)(videoElement.buffered, videoElement.currentTime);
720
689
  if (bufferGap === Infinity) {
721
690
  return 0;
722
691
  }
723
692
  return bufferGap;
724
- };
693
+ }
725
694
  /**
726
695
  * Get the current position, in s, in wall-clock time.
727
696
  * That is:
@@ -736,27 +705,27 @@ var Player = /** @class */ (function (_super) {
736
705
  *
737
706
  * @returns {Number}
738
707
  */
739
- Player.prototype.getWallClockTime = function () {
708
+ getWallClockTime() {
740
709
  if (this.videoElement === null) {
741
710
  throw new Error("Disposed player");
742
711
  }
743
712
  if (this._priv_contentInfos === null) {
744
713
  return this.videoElement.currentTime;
745
714
  }
746
- var _a = this._priv_contentInfos, isDirectFile = _a.isDirectFile, manifest = _a.manifest;
715
+ const { isDirectFile, manifest } = this._priv_contentInfos;
747
716
  if (isDirectFile) {
748
- var startDate = getStartDate(this.videoElement);
717
+ const startDate = (0, compat_1.getStartDate)(this.videoElement);
749
718
  return (startDate !== null && startDate !== void 0 ? startDate : 0) + this.videoElement.currentTime;
750
719
  }
751
720
  if (manifest !== null) {
752
- var currentTime = this.videoElement.currentTime;
753
- var ast = manifest.availabilityStartTime !== undefined ?
721
+ const currentTime = this.videoElement.currentTime;
722
+ const ast = manifest.availabilityStartTime !== undefined ?
754
723
  manifest.availabilityStartTime :
755
724
  0;
756
725
  return currentTime + ast;
757
726
  }
758
727
  return 0;
759
- };
728
+ }
760
729
  /**
761
730
  * Get the current position, in seconds, of the video element.
762
731
  *
@@ -768,27 +737,27 @@ var Player = /** @class */ (function (_super) {
768
737
  *
769
738
  * @returns {Number}
770
739
  */
771
- Player.prototype.getPosition = function () {
740
+ getPosition() {
772
741
  if (this.videoElement === null) {
773
742
  throw new Error("Disposed player");
774
743
  }
775
744
  return this.videoElement.currentTime;
776
- };
745
+ }
777
746
  /**
778
747
  * Returns the last stored content position, in seconds.
779
748
  *
780
749
  * @returns {number|undefined}
781
750
  */
782
- Player.prototype.getLastStoredContentPosition = function () {
751
+ getLastStoredContentPosition() {
783
752
  return this._priv_reloadingMetadata.reloadPosition;
784
- };
753
+ }
785
754
  /**
786
755
  * Returns the current playback rate at which the video plays.
787
756
  * @returns {Number}
788
757
  */
789
- Player.prototype.getPlaybackRate = function () {
758
+ getPlaybackRate() {
790
759
  return this._priv_speed.getValue();
791
- };
760
+ }
792
761
  /**
793
762
  * Update the playback rate of the video.
794
763
  *
@@ -845,18 +814,18 @@ var Player = /** @class */ (function (_super) {
845
814
  * @param {Number} rate
846
815
  * @param {Object} opts
847
816
  */
848
- Player.prototype.setPlaybackRate = function (rate, opts) {
817
+ setPlaybackRate(rate, opts) {
849
818
  var _a;
850
819
  if (rate !== this._priv_speed.getValue()) {
851
820
  this._priv_speed.setValue(rate);
852
821
  }
853
- var preferTrickModeTracks = opts === null || opts === void 0 ? void 0 : opts.preferTrickModeTracks;
822
+ const preferTrickModeTracks = opts === null || opts === void 0 ? void 0 : opts.preferTrickModeTracks;
854
823
  if (typeof preferTrickModeTracks !== "boolean") {
855
824
  return;
856
825
  }
857
826
  this._priv_preferTrickModeTracks = preferTrickModeTracks;
858
- var tracksStore = (_a = this._priv_contentInfos) === null || _a === void 0 ? void 0 : _a.tracksStore;
859
- if (!isNullOrUndefined(tracksStore)) {
827
+ const tracksStore = (_a = this._priv_contentInfos) === null || _a === void 0 ? void 0 : _a.tracksStore;
828
+ if (!(0, is_null_or_undefined_1.default)(tracksStore)) {
860
829
  if (preferTrickModeTracks && !tracksStore.isTrickModeEnabled()) {
861
830
  tracksStore.enableVideoTrickModeTracks();
862
831
  }
@@ -864,7 +833,7 @@ var Player = /** @class */ (function (_super) {
864
833
  tracksStore.disableVideoTrickModeTracks();
865
834
  }
866
835
  }
867
- };
836
+ }
868
837
  /**
869
838
  * Returns video Representation currently considered for the current Period.
870
839
  *
@@ -874,13 +843,13 @@ var Player = /** @class */ (function (_super) {
874
843
  * when we don't know which Representation is playing.
875
844
  * @returns {Object|null|undefined}
876
845
  */
877
- Player.prototype.getVideoRepresentation = function () {
878
- var representations = this.__priv_getCurrentRepresentations();
846
+ getVideoRepresentation() {
847
+ const representations = this.__priv_getCurrentRepresentations();
879
848
  if (representations === null) {
880
849
  return undefined;
881
850
  }
882
851
  return representations.video;
883
- };
852
+ }
884
853
  /**
885
854
  * Returns audio Representation currently considered for the current Period.
886
855
  *
@@ -890,51 +859,50 @@ var Player = /** @class */ (function (_super) {
890
859
  * when we don't know which Representation is playing.
891
860
  * @returns {Object|null|undefined}
892
861
  */
893
- Player.prototype.getAudioRepresentation = function () {
894
- var representations = this.__priv_getCurrentRepresentations();
862
+ getAudioRepresentation() {
863
+ const representations = this.__priv_getCurrentRepresentations();
895
864
  if (representations === null) {
896
865
  return undefined;
897
866
  }
898
867
  return representations.audio;
899
- };
868
+ }
900
869
  /**
901
870
  * Play/Resume the current video.
902
871
  * @returns {Promise}
903
872
  */
904
- Player.prototype.play = function () {
905
- var _this = this;
873
+ play() {
906
874
  if (this.videoElement === null) {
907
875
  throw new Error("Disposed player");
908
876
  }
909
- var playPromise = this.videoElement.play();
877
+ const playPromise = this.videoElement.play();
910
878
  /* eslint-disable @typescript-eslint/unbound-method */
911
- if (isNullOrUndefined(playPromise) || typeof playPromise.catch !== "function") {
879
+ if ((0, is_null_or_undefined_1.default)(playPromise) || typeof playPromise.catch !== "function") {
912
880
  /* eslint-enable @typescript-eslint/unbound-method */
913
881
  return Promise.resolve();
914
882
  }
915
- return playPromise.catch(function (error) {
883
+ return playPromise.catch((error) => {
916
884
  if (error.name === "NotAllowedError") {
917
- var warning = new MediaError("MEDIA_ERR_PLAY_NOT_ALLOWED", error.toString());
918
- _this.trigger("warning", warning);
885
+ const warning = new errors_1.MediaError("MEDIA_ERR_PLAY_NOT_ALLOWED", error.toString());
886
+ this.trigger("warning", warning);
919
887
  }
920
888
  throw error;
921
889
  });
922
- };
890
+ }
923
891
  /**
924
892
  * Pause the current video.
925
893
  */
926
- Player.prototype.pause = function () {
894
+ pause() {
927
895
  if (this.videoElement === null) {
928
896
  throw new Error("Disposed player");
929
897
  }
930
898
  this.videoElement.pause();
931
- };
899
+ }
932
900
  /**
933
901
  * Seek to a given absolute position.
934
902
  * @param {Number|Object} time
935
903
  * @returns {Number} - The time the player has seek to
936
904
  */
937
- Player.prototype.seekTo = function (time) {
905
+ seekTo(time) {
938
906
  var _a;
939
907
  if (this.videoElement === null) {
940
908
  throw new Error("Disposed player");
@@ -942,29 +910,29 @@ var Player = /** @class */ (function (_super) {
942
910
  if (this._priv_contentInfos === null) {
943
911
  throw new Error("player: no content loaded");
944
912
  }
945
- var _b = this._priv_contentInfos, isDirectFile = _b.isDirectFile, manifest = _b.manifest;
913
+ const { isDirectFile, manifest } = this._priv_contentInfos;
946
914
  if (!isDirectFile && manifest === null) {
947
915
  throw new Error("player: the content did not load yet");
948
916
  }
949
- var positionWanted;
917
+ let positionWanted;
950
918
  if (typeof time === "number") {
951
919
  positionWanted = time;
952
920
  }
953
921
  else if (typeof time === "object") {
954
- var timeObj = time;
955
- var currentTs = this.videoElement.currentTime;
956
- if (!isNullOrUndefined(timeObj.relative)) {
922
+ const timeObj = time;
923
+ const currentTs = this.videoElement.currentTime;
924
+ if (!(0, is_null_or_undefined_1.default)(timeObj.relative)) {
957
925
  positionWanted = currentTs + timeObj.relative;
958
926
  }
959
- else if (!isNullOrUndefined(timeObj.position)) {
927
+ else if (!(0, is_null_or_undefined_1.default)(timeObj.position)) {
960
928
  positionWanted = timeObj.position;
961
929
  }
962
- else if (!isNullOrUndefined(timeObj.wallClockTime)) {
930
+ else if (!(0, is_null_or_undefined_1.default)(timeObj.wallClockTime)) {
963
931
  if (manifest !== null) {
964
932
  positionWanted = timeObj.wallClockTime - ((_a = manifest.availabilityStartTime) !== null && _a !== void 0 ? _a : 0);
965
933
  }
966
934
  else if (isDirectFile && this.videoElement !== null) {
967
- var startDate = getStartDate(this.videoElement);
935
+ const startDate = (0, compat_1.getStartDate)(this.videoElement);
968
936
  if (startDate !== undefined) {
969
937
  positionWanted = timeObj.wallClockTime - startDate;
970
938
  }
@@ -982,129 +950,129 @@ var Player = /** @class */ (function (_super) {
982
950
  if (positionWanted === undefined) {
983
951
  throw new Error("invalid time given");
984
952
  }
985
- log.info("API: API Seek to", positionWanted);
953
+ log_1.default.info("API: API Seek to", positionWanted);
986
954
  this.videoElement.currentTime = positionWanted;
987
955
  return positionWanted;
988
- };
956
+ }
989
957
  /**
990
958
  * Returns the current player's audio volume on the media element.
991
959
  * From 0 (no audio) to 1 (maximum volume).
992
960
  * @returns {Number}
993
961
  */
994
- Player.prototype.getVolume = function () {
962
+ getVolume() {
995
963
  if (this.videoElement === null) {
996
964
  throw new Error("Disposed player");
997
965
  }
998
966
  return this.videoElement.volume;
999
- };
967
+ }
1000
968
  /**
1001
969
  * Set the player's audio volume. From 0 (no volume) to 1 (maximum volume).
1002
970
  * @param {Number} volume
1003
971
  */
1004
- Player.prototype.setVolume = function (volume) {
972
+ setVolume(volume) {
1005
973
  if (this.videoElement === null) {
1006
974
  throw new Error("Disposed player");
1007
975
  }
1008
- var videoElement = this.videoElement;
976
+ const videoElement = this.videoElement;
1009
977
  if (volume !== videoElement.volume) {
1010
978
  videoElement.volume = volume;
1011
979
  this.trigger("volumeChange", volume);
1012
980
  }
1013
- };
981
+ }
1014
982
  /**
1015
983
  * Returns true if the volume is set to 0. false otherwise.
1016
984
  * @returns {Boolean}
1017
985
  */
1018
- Player.prototype.isMute = function () {
986
+ isMute() {
1019
987
  return this.getVolume() === 0;
1020
- };
988
+ }
1021
989
  /**
1022
990
  * Set the volume to 0 and save current one for when unmuted.
1023
991
  */
1024
- Player.prototype.mute = function () {
992
+ mute() {
1025
993
  this._priv_mutedMemory = this.getVolume();
1026
994
  this.setVolume(0);
1027
- };
995
+ }
1028
996
  /**
1029
997
  * Set the volume back to when it was when mute was last called.
1030
998
  * If the volume was set to 0, set a default volume instead (see config).
1031
999
  */
1032
- Player.prototype.unMute = function () {
1033
- var DEFAULT_UNMUTED_VOLUME = config.getCurrent().DEFAULT_UNMUTED_VOLUME;
1034
- var vol = this.getVolume();
1000
+ unMute() {
1001
+ const { DEFAULT_UNMUTED_VOLUME } = config_1.default.getCurrent();
1002
+ const vol = this.getVolume();
1035
1003
  if (vol === 0) {
1036
1004
  this.setVolume(this._priv_mutedMemory === 0 ? DEFAULT_UNMUTED_VOLUME :
1037
1005
  this._priv_mutedMemory);
1038
1006
  }
1039
- };
1007
+ }
1040
1008
  /**
1041
1009
  * Set the max buffer size for the buffer behind the current position.
1042
1010
  * Every buffer data before will be removed.
1043
1011
  * @param {Number} depthInSeconds
1044
1012
  */
1045
- Player.prototype.setMaxBufferBehind = function (depthInSeconds) {
1013
+ setMaxBufferBehind(depthInSeconds) {
1046
1014
  this._priv_bufferOptions.maxBufferBehind.setValue(depthInSeconds);
1047
- };
1015
+ }
1048
1016
  /**
1049
1017
  * Set the max buffer size for the buffer behind the current position.
1050
1018
  * Every buffer data before will be removed.
1051
1019
  * @param {Number} depthInSeconds
1052
1020
  */
1053
- Player.prototype.setMaxBufferAhead = function (depthInSeconds) {
1021
+ setMaxBufferAhead(depthInSeconds) {
1054
1022
  this._priv_bufferOptions.maxBufferAhead.setValue(depthInSeconds);
1055
- };
1023
+ }
1056
1024
  /**
1057
1025
  * Set the max buffer size for the buffer ahead of the current position.
1058
1026
  * The player will stop downloading chunks when this size is reached.
1059
1027
  * @param {Number} sizeInSeconds
1060
1028
  */
1061
- Player.prototype.setWantedBufferAhead = function (sizeInSeconds) {
1029
+ setWantedBufferAhead(sizeInSeconds) {
1062
1030
  this._priv_bufferOptions.wantedBufferAhead.setValue(sizeInSeconds);
1063
- };
1031
+ }
1064
1032
  /**
1065
1033
  * Set the max buffer size the buffer should take in memory
1066
1034
  * The player . will stop downloading chunks when this size is reached.
1067
1035
  * @param {Number} sizeInKBytes
1068
1036
  */
1069
- Player.prototype.setMaxVideoBufferSize = function (sizeInKBytes) {
1037
+ setMaxVideoBufferSize(sizeInKBytes) {
1070
1038
  this._priv_bufferOptions.maxVideoBufferSize.setValue(sizeInKBytes);
1071
- };
1039
+ }
1072
1040
  /**
1073
1041
  * Returns the max buffer size for the buffer behind the current position.
1074
1042
  * @returns {Number}
1075
1043
  */
1076
- Player.prototype.getMaxBufferBehind = function () {
1044
+ getMaxBufferBehind() {
1077
1045
  return this._priv_bufferOptions.maxBufferBehind.getValue();
1078
- };
1046
+ }
1079
1047
  /**
1080
1048
  * Returns the max buffer size for the buffer behind the current position.
1081
1049
  * @returns {Number}
1082
1050
  */
1083
- Player.prototype.getMaxBufferAhead = function () {
1051
+ getMaxBufferAhead() {
1084
1052
  return this._priv_bufferOptions.maxBufferAhead.getValue();
1085
- };
1053
+ }
1086
1054
  /**
1087
1055
  * Returns the max buffer size for the buffer ahead of the current position.
1088
1056
  * @returns {Number}
1089
1057
  */
1090
- Player.prototype.getWantedBufferAhead = function () {
1058
+ getWantedBufferAhead() {
1091
1059
  return this._priv_bufferOptions.wantedBufferAhead.getValue();
1092
- };
1060
+ }
1093
1061
  /**
1094
1062
  * Returns the max buffer memory size for the buffer in kilobytes
1095
1063
  * @returns {Number}
1096
1064
  */
1097
- Player.prototype.getMaxVideoBufferSize = function () {
1065
+ getMaxVideoBufferSize() {
1098
1066
  return this._priv_bufferOptions.maxVideoBufferSize.getValue();
1099
- };
1100
- Player.prototype.getCurrentPeriod = function () {
1067
+ }
1068
+ getCurrentPeriod() {
1101
1069
  var _a;
1102
- var currentPeriod = (_a = this._priv_contentInfos) === null || _a === void 0 ? void 0 : _a.currentPeriod;
1103
- if (isNullOrUndefined(currentPeriod)) {
1070
+ const currentPeriod = (_a = this._priv_contentInfos) === null || _a === void 0 ? void 0 : _a.currentPeriod;
1071
+ if ((0, is_null_or_undefined_1.default)(currentPeriod)) {
1104
1072
  return null;
1105
1073
  }
1106
1074
  return { id: currentPeriod.id, start: currentPeriod.start, end: currentPeriod.end };
1107
- };
1075
+ }
1108
1076
  /**
1109
1077
  * Returns both the name of the key system (e.g. `"com.widevine.alpha"`) and
1110
1078
  * the `MediaKeySystemConfiguration` currently associated to the
@@ -1113,26 +1081,26 @@ var Player = /** @class */ (function (_super) {
1113
1081
  * Returns `null` if no such capabilities is associated or if unknown.
1114
1082
  * @returns {Object|null}
1115
1083
  */
1116
- Player.prototype.getKeySystemConfiguration = function () {
1084
+ getKeySystemConfiguration() {
1117
1085
  if (this.videoElement === null) {
1118
1086
  throw new Error("Disposed player");
1119
1087
  }
1120
- var values = getKeySystemConfiguration(this.videoElement);
1088
+ const values = (0, decrypt_1.getKeySystemConfiguration)(this.videoElement);
1121
1089
  if (values === null) {
1122
1090
  return null;
1123
1091
  }
1124
1092
  return { keySystem: values[0], configuration: values[1] };
1125
- };
1093
+ }
1126
1094
  /**
1127
1095
  * Returns the list of available Periods for which the current audio, video or
1128
1096
  * text track can now be changed.
1129
1097
  * @returns {Array.<Object>}
1130
1098
  */
1131
- Player.prototype.getAvailablePeriods = function () {
1099
+ getAvailablePeriods() {
1132
1100
  if (this._priv_contentInfos === null) {
1133
1101
  return [];
1134
1102
  }
1135
- var _a = this._priv_contentInfos, isDirectFile = _a.isDirectFile, tracksStore = _a.tracksStore;
1103
+ const { isDirectFile, tracksStore } = this._priv_contentInfos;
1136
1104
  if (isDirectFile) {
1137
1105
  return [];
1138
1106
  }
@@ -1140,126 +1108,126 @@ var Player = /** @class */ (function (_super) {
1140
1108
  return [];
1141
1109
  }
1142
1110
  return tracksStore.getAvailablePeriods().slice();
1143
- };
1111
+ }
1144
1112
  /**
1145
1113
  * Returns every available audio tracks for a given Period - or the current
1146
1114
  * one if no `periodId` is given.
1147
1115
  * @param {string|undefined} [periodId]
1148
1116
  * @returns {Array.<Object>}
1149
1117
  */
1150
- Player.prototype.getAvailableAudioTracks = function (periodId) {
1118
+ getAvailableAudioTracks(periodId) {
1151
1119
  var _a;
1152
1120
  if (this._priv_contentInfos === null) {
1153
1121
  return [];
1154
1122
  }
1155
- var _b = this._priv_contentInfos, isDirectFile = _b.isDirectFile, mediaElementTracksStore = _b.mediaElementTracksStore;
1123
+ const { isDirectFile, mediaElementTracksStore } = this._priv_contentInfos;
1156
1124
  if (isDirectFile) {
1157
1125
  return (_a = mediaElementTracksStore === null || mediaElementTracksStore === void 0 ? void 0 : mediaElementTracksStore.getAvailableAudioTracks()) !== null && _a !== void 0 ? _a : [];
1158
1126
  }
1159
- return this._priv_callTracksStoreGetterSetter(periodId, [], function (tcm, periodRef) { var _a; return (_a = tcm.getAvailableAudioTracks(periodRef)) !== null && _a !== void 0 ? _a : []; });
1160
- };
1127
+ return this._priv_callTracksStoreGetterSetter(periodId, [], (tcm, periodRef) => { var _a; return (_a = tcm.getAvailableAudioTracks(periodRef)) !== null && _a !== void 0 ? _a : []; });
1128
+ }
1161
1129
  /**
1162
1130
  * Returns every available text tracks for a given Period - or the current
1163
1131
  * one if no `periodId` is given.
1164
1132
  * @param {string|undefined} [periodId]
1165
1133
  * @returns {Array.<Object>}
1166
1134
  */
1167
- Player.prototype.getAvailableTextTracks = function (periodId) {
1135
+ getAvailableTextTracks(periodId) {
1168
1136
  var _a;
1169
1137
  if (this._priv_contentInfos === null) {
1170
1138
  return [];
1171
1139
  }
1172
- var _b = this._priv_contentInfos, isDirectFile = _b.isDirectFile, mediaElementTracksStore = _b.mediaElementTracksStore;
1140
+ const { isDirectFile, mediaElementTracksStore } = this._priv_contentInfos;
1173
1141
  if (isDirectFile) {
1174
1142
  return (_a = mediaElementTracksStore === null || mediaElementTracksStore === void 0 ? void 0 : mediaElementTracksStore.getAvailableTextTracks()) !== null && _a !== void 0 ? _a : [];
1175
1143
  }
1176
- return this._priv_callTracksStoreGetterSetter(periodId, [], function (tcm, periodRef) { var _a; return (_a = tcm.getAvailableTextTracks(periodRef)) !== null && _a !== void 0 ? _a : []; });
1177
- };
1144
+ return this._priv_callTracksStoreGetterSetter(periodId, [], (tcm, periodRef) => { var _a; return (_a = tcm.getAvailableTextTracks(periodRef)) !== null && _a !== void 0 ? _a : []; });
1145
+ }
1178
1146
  /**
1179
1147
  * Returns every available video tracks for the current Period.
1180
1148
  * @param {string|undefined} [periodId]
1181
1149
  * @returns {Array.<Object>}
1182
1150
  */
1183
- Player.prototype.getAvailableVideoTracks = function (periodId) {
1151
+ getAvailableVideoTracks(periodId) {
1184
1152
  var _a;
1185
1153
  if (this._priv_contentInfos === null) {
1186
1154
  return [];
1187
1155
  }
1188
- var _b = this._priv_contentInfos, isDirectFile = _b.isDirectFile, mediaElementTracksStore = _b.mediaElementTracksStore;
1156
+ const { isDirectFile, mediaElementTracksStore } = this._priv_contentInfos;
1189
1157
  if (isDirectFile) {
1190
1158
  return (_a = mediaElementTracksStore === null || mediaElementTracksStore === void 0 ? void 0 : mediaElementTracksStore.getAvailableVideoTracks()) !== null && _a !== void 0 ? _a : [];
1191
1159
  }
1192
- return this._priv_callTracksStoreGetterSetter(periodId, [], function (tcm, periodRef) { var _a; return (_a = tcm.getAvailableVideoTracks(periodRef)) !== null && _a !== void 0 ? _a : []; });
1193
- };
1160
+ return this._priv_callTracksStoreGetterSetter(periodId, [], (tcm, periodRef) => { var _a; return (_a = tcm.getAvailableVideoTracks(periodRef)) !== null && _a !== void 0 ? _a : []; });
1161
+ }
1194
1162
  /**
1195
1163
  * Returns currently chosen audio language for the current Period.
1196
1164
  * @param {string|undefined} [periodId]
1197
1165
  * @returns {Object|null|undefined}
1198
1166
  */
1199
- Player.prototype.getAudioTrack = function (periodId) {
1167
+ getAudioTrack(periodId) {
1200
1168
  if (this._priv_contentInfos === null) {
1201
1169
  return undefined;
1202
1170
  }
1203
- var _a = this._priv_contentInfos, isDirectFile = _a.isDirectFile, mediaElementTracksStore = _a.mediaElementTracksStore;
1171
+ const { isDirectFile, mediaElementTracksStore } = this._priv_contentInfos;
1204
1172
  if (isDirectFile) {
1205
1173
  if (mediaElementTracksStore === null) {
1206
1174
  return undefined;
1207
1175
  }
1208
1176
  return mediaElementTracksStore.getChosenAudioTrack();
1209
1177
  }
1210
- return this._priv_callTracksStoreGetterSetter(periodId, undefined, function (tcm, periodRef) { return tcm.getChosenAudioTrack(periodRef); });
1211
- };
1178
+ return this._priv_callTracksStoreGetterSetter(periodId, undefined, (tcm, periodRef) => tcm.getChosenAudioTrack(periodRef));
1179
+ }
1212
1180
  /**
1213
1181
  * Returns currently chosen subtitle for the current Period.
1214
1182
  * @param {string|undefined} [periodId]
1215
1183
  * @returns {Object|null|undefined}
1216
1184
  */
1217
- Player.prototype.getTextTrack = function (periodId) {
1185
+ getTextTrack(periodId) {
1218
1186
  if (this._priv_contentInfos === null) {
1219
1187
  return undefined;
1220
1188
  }
1221
- var _a = this._priv_contentInfos, isDirectFile = _a.isDirectFile, mediaElementTracksStore = _a.mediaElementTracksStore;
1189
+ const { isDirectFile, mediaElementTracksStore } = this._priv_contentInfos;
1222
1190
  if (isDirectFile) {
1223
1191
  if (mediaElementTracksStore === null) {
1224
1192
  return undefined;
1225
1193
  }
1226
1194
  return mediaElementTracksStore.getChosenTextTrack();
1227
1195
  }
1228
- return this._priv_callTracksStoreGetterSetter(periodId, undefined, function (tcm, periodRef) { return tcm.getChosenTextTrack(periodRef); });
1229
- };
1196
+ return this._priv_callTracksStoreGetterSetter(periodId, undefined, (tcm, periodRef) => tcm.getChosenTextTrack(periodRef));
1197
+ }
1230
1198
  /**
1231
1199
  * Returns currently chosen video track for the current Period.
1232
1200
  * @param {string|undefined} [periodId]
1233
1201
  * @returns {Object|null|undefined}
1234
1202
  */
1235
- Player.prototype.getVideoTrack = function (periodId) {
1203
+ getVideoTrack(periodId) {
1236
1204
  if (this._priv_contentInfos === null) {
1237
1205
  return undefined;
1238
1206
  }
1239
- var _a = this._priv_contentInfos, isDirectFile = _a.isDirectFile, mediaElementTracksStore = _a.mediaElementTracksStore;
1207
+ const { isDirectFile, mediaElementTracksStore } = this._priv_contentInfos;
1240
1208
  if (isDirectFile) {
1241
1209
  if (mediaElementTracksStore === null) {
1242
1210
  return undefined;
1243
1211
  }
1244
1212
  return mediaElementTracksStore.getChosenVideoTrack();
1245
1213
  }
1246
- return this._priv_callTracksStoreGetterSetter(periodId, undefined, function (tcm, periodRef) { return tcm.getChosenVideoTrack(periodRef); });
1247
- };
1214
+ return this._priv_callTracksStoreGetterSetter(periodId, undefined, (tcm, periodRef) => tcm.getChosenVideoTrack(periodRef));
1215
+ }
1248
1216
  /**
1249
1217
  * Update the audio language for the current Period.
1250
1218
  * @param {string | object} arg
1251
1219
  * @throws Error - the current content has no TracksStore.
1252
1220
  * @throws Error - the given id is linked to no audio track.
1253
1221
  */
1254
- Player.prototype.setAudioTrack = function (arg) {
1222
+ setAudioTrack(arg) {
1255
1223
  var _a;
1256
1224
  if (this._priv_contentInfos === null) {
1257
1225
  throw new Error("No content loaded");
1258
1226
  }
1259
- var _b = this._priv_contentInfos, isDirectFile = _b.isDirectFile, mediaElementTracksStore = _b.mediaElementTracksStore;
1227
+ const { isDirectFile, mediaElementTracksStore } = this._priv_contentInfos;
1260
1228
  if (isDirectFile) {
1261
1229
  try {
1262
- var audioId = typeof arg === "string" ? arg :
1230
+ const audioId = typeof arg === "string" ? arg :
1263
1231
  arg.trackId;
1264
1232
  mediaElementTracksStore === null || mediaElementTracksStore === void 0 ? void 0 : mediaElementTracksStore.setAudioTrackById(audioId);
1265
1233
  return;
@@ -1268,10 +1236,10 @@ var Player = /** @class */ (function (_super) {
1268
1236
  throw new Error("player: unknown audio track");
1269
1237
  }
1270
1238
  }
1271
- var periodId;
1272
- var trackId;
1273
- var switchingMode;
1274
- var reprsToLock = null;
1239
+ let periodId;
1240
+ let trackId;
1241
+ let switchingMode;
1242
+ let reprsToLock = null;
1275
1243
  if (typeof arg === "string") {
1276
1244
  trackId = arg;
1277
1245
  }
@@ -1281,24 +1249,22 @@ var Player = /** @class */ (function (_super) {
1281
1249
  switchingMode = arg.switchingMode;
1282
1250
  reprsToLock = (_a = arg.lockedRepresentations) !== null && _a !== void 0 ? _a : null;
1283
1251
  }
1284
- return this._priv_callTracksStoreGetterSetter(periodId, undefined, function (tcm, periodRef) {
1285
- return tcm.setAudioTrack(periodRef, trackId, switchingMode, reprsToLock);
1286
- });
1287
- };
1252
+ return this._priv_callTracksStoreGetterSetter(periodId, undefined, (tcm, periodRef) => tcm.setAudioTrack(periodRef, trackId, switchingMode, reprsToLock));
1253
+ }
1288
1254
  /**
1289
1255
  * Update the text language for the current Period.
1290
1256
  * @param {string | Object} arg
1291
1257
  * @throws Error - the current content has no TracksStore.
1292
1258
  * @throws Error - the given id is linked to no text track.
1293
1259
  */
1294
- Player.prototype.setTextTrack = function (arg) {
1260
+ setTextTrack(arg) {
1295
1261
  if (this._priv_contentInfos === null) {
1296
1262
  throw new Error("No content loaded");
1297
1263
  }
1298
- var _a = this._priv_contentInfos, isDirectFile = _a.isDirectFile, mediaElementTracksStore = _a.mediaElementTracksStore;
1264
+ const { isDirectFile, mediaElementTracksStore } = this._priv_contentInfos;
1299
1265
  if (isDirectFile) {
1300
1266
  try {
1301
- var textId = typeof arg === "string" ? arg :
1267
+ const textId = typeof arg === "string" ? arg :
1302
1268
  arg.trackId;
1303
1269
  mediaElementTracksStore === null || mediaElementTracksStore === void 0 ? void 0 : mediaElementTracksStore.setTextTrackById(textId);
1304
1270
  return;
@@ -1307,8 +1273,8 @@ var Player = /** @class */ (function (_super) {
1307
1273
  throw new Error("player: unknown text track");
1308
1274
  }
1309
1275
  }
1310
- var periodId;
1311
- var trackId;
1276
+ let periodId;
1277
+ let trackId;
1312
1278
  if (typeof arg === "string") {
1313
1279
  trackId = arg;
1314
1280
  }
@@ -1316,38 +1282,38 @@ var Player = /** @class */ (function (_super) {
1316
1282
  trackId = arg.trackId;
1317
1283
  periodId = arg.periodId;
1318
1284
  }
1319
- return this._priv_callTracksStoreGetterSetter(periodId, undefined, function (tcm, periodRef) { return tcm.setTextTrack(periodRef, trackId); });
1320
- };
1285
+ return this._priv_callTracksStoreGetterSetter(periodId, undefined, (tcm, periodRef) => tcm.setTextTrack(periodRef, trackId));
1286
+ }
1321
1287
  /**
1322
1288
  * Disable subtitles for the current content.
1323
1289
  * @param {string|undefined} [periodId]
1324
1290
  */
1325
- Player.prototype.disableTextTrack = function (periodId) {
1291
+ disableTextTrack(periodId) {
1326
1292
  if (this._priv_contentInfos === null) {
1327
1293
  return;
1328
1294
  }
1329
- var _a = this._priv_contentInfos, isDirectFile = _a.isDirectFile, mediaElementTracksStore = _a.mediaElementTracksStore;
1295
+ const { isDirectFile, mediaElementTracksStore } = this._priv_contentInfos;
1330
1296
  if (isDirectFile) {
1331
1297
  mediaElementTracksStore === null || mediaElementTracksStore === void 0 ? void 0 : mediaElementTracksStore.disableTextTrack();
1332
1298
  return;
1333
1299
  }
1334
- return this._priv_callTracksStoreGetterSetter(periodId, undefined, function (tcm, periodRef) { return tcm.disableTrack(periodRef, "text"); });
1335
- };
1300
+ return this._priv_callTracksStoreGetterSetter(periodId, undefined, (tcm, periodRef) => tcm.disableTrack(periodRef, "text"));
1301
+ }
1336
1302
  /**
1337
1303
  * Update the video track for the current Period.
1338
1304
  * @param {string | Object} arg
1339
1305
  * @throws Error - the current content has no TracksStore.
1340
1306
  * @throws Error - the given id is linked to no video track.
1341
1307
  */
1342
- Player.prototype.setVideoTrack = function (arg) {
1308
+ setVideoTrack(arg) {
1343
1309
  var _a;
1344
1310
  if (this._priv_contentInfos === null) {
1345
1311
  throw new Error("No content loaded");
1346
1312
  }
1347
- var _b = this._priv_contentInfos, isDirectFile = _b.isDirectFile, mediaElementTracksStore = _b.mediaElementTracksStore;
1313
+ const { isDirectFile, mediaElementTracksStore } = this._priv_contentInfos;
1348
1314
  if (isDirectFile) {
1349
1315
  try {
1350
- var videoId = typeof arg === "string" ? arg :
1316
+ const videoId = typeof arg === "string" ? arg :
1351
1317
  arg.trackId;
1352
1318
  mediaElementTracksStore === null || mediaElementTracksStore === void 0 ? void 0 : mediaElementTracksStore.setVideoTrackById(videoId);
1353
1319
  return;
@@ -1356,10 +1322,10 @@ var Player = /** @class */ (function (_super) {
1356
1322
  throw new Error("player: unknown video track");
1357
1323
  }
1358
1324
  }
1359
- var periodId;
1360
- var trackId;
1361
- var switchingMode;
1362
- var reprsToLock = null;
1325
+ let periodId;
1326
+ let trackId;
1327
+ let switchingMode;
1328
+ let reprsToLock = null;
1363
1329
  if (typeof arg === "string") {
1364
1330
  trackId = arg;
1365
1331
  }
@@ -1369,35 +1335,33 @@ var Player = /** @class */ (function (_super) {
1369
1335
  switchingMode = arg.switchingMode;
1370
1336
  reprsToLock = (_a = arg.lockedRepresentations) !== null && _a !== void 0 ? _a : null;
1371
1337
  }
1372
- return this._priv_callTracksStoreGetterSetter(periodId, undefined, function (tcm, periodRef) {
1373
- return tcm.setVideoTrack(periodRef, trackId, switchingMode, reprsToLock);
1374
- });
1375
- };
1338
+ return this._priv_callTracksStoreGetterSetter(periodId, undefined, (tcm, periodRef) => tcm.setVideoTrack(periodRef, trackId, switchingMode, reprsToLock));
1339
+ }
1376
1340
  /**
1377
1341
  * Disable video track for the current content.
1378
1342
  * @param {string|undefined} [periodId]
1379
1343
  */
1380
- Player.prototype.disableVideoTrack = function (periodId) {
1344
+ disableVideoTrack(periodId) {
1381
1345
  if (this._priv_contentInfos === null) {
1382
1346
  return;
1383
1347
  }
1384
- var _a = this._priv_contentInfos, isDirectFile = _a.isDirectFile, mediaElementTracksStore = _a.mediaElementTracksStore;
1348
+ const { isDirectFile, mediaElementTracksStore } = this._priv_contentInfos;
1385
1349
  if (isDirectFile && mediaElementTracksStore !== null) {
1386
1350
  return mediaElementTracksStore.disableVideoTrack();
1387
1351
  }
1388
- return this._priv_callTracksStoreGetterSetter(periodId, undefined, function (tcm, periodRef) { return tcm.disableTrack(periodRef, "video"); });
1389
- };
1390
- Player.prototype.lockVideoRepresentations = function (arg) {
1352
+ return this._priv_callTracksStoreGetterSetter(periodId, undefined, (tcm, periodRef) => tcm.disableTrack(periodRef, "video"));
1353
+ }
1354
+ lockVideoRepresentations(arg) {
1391
1355
  if (this._priv_contentInfos === null) {
1392
1356
  throw new Error("No content loaded");
1393
1357
  }
1394
- var isDirectFile = this._priv_contentInfos.isDirectFile;
1358
+ const { isDirectFile } = this._priv_contentInfos;
1395
1359
  if (isDirectFile) {
1396
1360
  throw new Error("Cannot lock video Representations in directfile mode.");
1397
1361
  }
1398
- var repsId;
1399
- var periodId;
1400
- var switchingMode;
1362
+ let repsId;
1363
+ let periodId;
1364
+ let switchingMode;
1401
1365
  if (Array.isArray(arg)) {
1402
1366
  repsId = arg;
1403
1367
  periodId = undefined;
@@ -1407,21 +1371,20 @@ var Player = /** @class */ (function (_super) {
1407
1371
  periodId = arg.periodId;
1408
1372
  switchingMode = arg.switchingMode;
1409
1373
  }
1410
- return this._priv_callTracksStoreGetterSetter(periodId, undefined, function (tcm, periodRef) {
1411
- return tcm.lockVideoRepresentations(periodRef, { representations: repsId, switchingMode: switchingMode });
1412
- });
1413
- };
1414
- Player.prototype.lockAudioRepresentations = function (arg) {
1374
+ return this._priv_callTracksStoreGetterSetter(periodId, undefined, (tcm, periodRef) => tcm.lockVideoRepresentations(periodRef, { representations: repsId,
1375
+ switchingMode }));
1376
+ }
1377
+ lockAudioRepresentations(arg) {
1415
1378
  if (this._priv_contentInfos === null) {
1416
1379
  throw new Error("No content loaded");
1417
1380
  }
1418
- var isDirectFile = this._priv_contentInfos.isDirectFile;
1381
+ const { isDirectFile } = this._priv_contentInfos;
1419
1382
  if (isDirectFile) {
1420
1383
  throw new Error("Cannot lock audio Representations in directfile mode.");
1421
1384
  }
1422
- var repsId;
1423
- var periodId;
1424
- var switchingMode;
1385
+ let repsId;
1386
+ let periodId;
1387
+ let switchingMode;
1425
1388
  if (Array.isArray(arg)) {
1426
1389
  repsId = arg;
1427
1390
  periodId = undefined;
@@ -1431,76 +1394,75 @@ var Player = /** @class */ (function (_super) {
1431
1394
  periodId = arg.periodId;
1432
1395
  switchingMode = arg.switchingMode;
1433
1396
  }
1434
- return this._priv_callTracksStoreGetterSetter(periodId, undefined, function (tcm, periodRef) {
1435
- return tcm.lockAudioRepresentations(periodRef, { representations: repsId, switchingMode: switchingMode });
1436
- });
1437
- };
1438
- Player.prototype.getLockedVideoRepresentations = function (periodId) {
1397
+ return this._priv_callTracksStoreGetterSetter(periodId, undefined, (tcm, periodRef) => tcm.lockAudioRepresentations(periodRef, { representations: repsId,
1398
+ switchingMode }));
1399
+ }
1400
+ getLockedVideoRepresentations(periodId) {
1439
1401
  if (this._priv_contentInfos === null) {
1440
1402
  return null;
1441
1403
  }
1442
- var isDirectFile = this._priv_contentInfos.isDirectFile;
1404
+ const { isDirectFile } = this._priv_contentInfos;
1443
1405
  if (isDirectFile) {
1444
1406
  return null;
1445
1407
  }
1446
- return this._priv_callTracksStoreGetterSetter(periodId, null, function (tcm, periodRef) { return tcm.getLockedVideoRepresentations(periodRef); });
1447
- };
1448
- Player.prototype.getLockedAudioRepresentations = function (periodId) {
1408
+ return this._priv_callTracksStoreGetterSetter(periodId, null, (tcm, periodRef) => tcm.getLockedVideoRepresentations(periodRef));
1409
+ }
1410
+ getLockedAudioRepresentations(periodId) {
1449
1411
  if (this._priv_contentInfos === null) {
1450
1412
  return null;
1451
1413
  }
1452
- var isDirectFile = this._priv_contentInfos.isDirectFile;
1414
+ const { isDirectFile } = this._priv_contentInfos;
1453
1415
  if (isDirectFile) {
1454
1416
  return null;
1455
1417
  }
1456
- return this._priv_callTracksStoreGetterSetter(periodId, null, function (tcm, periodRef) { return tcm.getLockedAudioRepresentations(periodRef); });
1457
- };
1458
- Player.prototype.unlockVideoRepresentations = function (periodId) {
1418
+ return this._priv_callTracksStoreGetterSetter(periodId, null, (tcm, periodRef) => tcm.getLockedAudioRepresentations(periodRef));
1419
+ }
1420
+ unlockVideoRepresentations(periodId) {
1459
1421
  if (this._priv_contentInfos === null) {
1460
1422
  return;
1461
1423
  }
1462
- var isDirectFile = this._priv_contentInfos.isDirectFile;
1424
+ const { isDirectFile } = this._priv_contentInfos;
1463
1425
  if (isDirectFile) {
1464
1426
  return;
1465
1427
  }
1466
- return this._priv_callTracksStoreGetterSetter(periodId, undefined, function (tcm, periodRef) { return tcm.unlockVideoRepresentations(periodRef); });
1467
- };
1468
- Player.prototype.unlockAudioRepresentations = function (periodId) {
1428
+ return this._priv_callTracksStoreGetterSetter(periodId, undefined, (tcm, periodRef) => tcm.unlockVideoRepresentations(periodRef));
1429
+ }
1430
+ unlockAudioRepresentations(periodId) {
1469
1431
  if (this._priv_contentInfos === null) {
1470
1432
  return;
1471
1433
  }
1472
- var isDirectFile = this._priv_contentInfos.isDirectFile;
1434
+ const { isDirectFile } = this._priv_contentInfos;
1473
1435
  if (isDirectFile) {
1474
1436
  return;
1475
1437
  }
1476
- return this._priv_callTracksStoreGetterSetter(periodId, undefined, function (tcm, periodRef) { return tcm.unlockAudioRepresentations(periodRef); });
1477
- };
1438
+ return this._priv_callTracksStoreGetterSetter(periodId, undefined, (tcm, periodRef) => tcm.unlockAudioRepresentations(periodRef));
1439
+ }
1478
1440
  /**
1479
1441
  * Get minimum seek-able position.
1480
1442
  * @returns {number}
1481
1443
  */
1482
- Player.prototype.getMinimumPosition = function () {
1444
+ getMinimumPosition() {
1483
1445
  if (this._priv_contentInfos === null) {
1484
1446
  return null;
1485
1447
  }
1486
1448
  if (this._priv_contentInfos.isDirectFile) {
1487
1449
  return 0;
1488
1450
  }
1489
- var manifest = this._priv_contentInfos.manifest;
1451
+ const { manifest } = this._priv_contentInfos;
1490
1452
  if (manifest !== null) {
1491
1453
  return manifest.getMinimumSafePosition();
1492
1454
  }
1493
1455
  return null;
1494
- };
1456
+ }
1495
1457
  /**
1496
1458
  * Get maximum seek-able position.
1497
1459
  * @returns {number}
1498
1460
  */
1499
- Player.prototype.getMaximumPosition = function () {
1461
+ getMaximumPosition() {
1500
1462
  if (this._priv_contentInfos === null) {
1501
1463
  return null;
1502
1464
  }
1503
- var _a = this._priv_contentInfos, isDirectFile = _a.isDirectFile, manifest = _a.manifest;
1465
+ const { isDirectFile, manifest } = this._priv_contentInfos;
1504
1466
  if (isDirectFile) {
1505
1467
  if (this.videoElement === null) {
1506
1468
  throw new Error("Disposed player");
@@ -1514,7 +1476,7 @@ var Player = /** @class */ (function (_super) {
1514
1476
  return manifest.getMaximumSafePosition();
1515
1477
  }
1516
1478
  return null;
1517
- };
1479
+ }
1518
1480
  // ---- Undocumented Private methods. ----
1519
1481
  //
1520
1482
  // Those methods are just here either to allow some tools relying on the
@@ -1529,17 +1491,17 @@ var Player = /** @class */ (function (_super) {
1529
1491
  * @param {string} bufferType
1530
1492
  * @returns {Array.<Object>|null}
1531
1493
  */
1532
- Player.prototype.__priv_getSegmentBufferContent = function (bufferType) {
1494
+ __priv_getSegmentBufferContent(bufferType) {
1533
1495
  if (this._priv_contentInfos === null ||
1534
1496
  this._priv_contentInfos.segmentBuffersStore === null) {
1535
1497
  return null;
1536
1498
  }
1537
- var segmentBufferStatus = this._priv_contentInfos
1499
+ const segmentBufferStatus = this._priv_contentInfos
1538
1500
  .segmentBuffersStore.getStatus(bufferType);
1539
1501
  return segmentBufferStatus.type === "initialized" ?
1540
1502
  segmentBufferStatus.value.getInventory() :
1541
1503
  null;
1542
- };
1504
+ }
1543
1505
  /**
1544
1506
  * /!\ For tools use only! Do not touch!
1545
1507
  *
@@ -1548,46 +1510,45 @@ var Player = /** @class */ (function (_super) {
1548
1510
  * @returns {Manifest|null} - The current Manifest (`null` when not known).
1549
1511
  */
1550
1512
  // TODO remove the need for that public method
1551
- Player.prototype.__priv_getManifest = function () {
1513
+ __priv_getManifest() {
1552
1514
  if (this._priv_contentInfos === null) {
1553
1515
  return null;
1554
1516
  }
1555
1517
  return this._priv_contentInfos.manifest;
1556
- };
1518
+ }
1557
1519
  // TODO remove the need for that public method
1558
- Player.prototype.__priv_getCurrentAdaptation = function () {
1520
+ __priv_getCurrentAdaptation() {
1559
1521
  if (this._priv_contentInfos === null) {
1560
1522
  return null;
1561
1523
  }
1562
- var _a = this._priv_contentInfos, currentPeriod = _a.currentPeriod, activeAdaptations = _a.activeAdaptations;
1524
+ const { currentPeriod, activeAdaptations } = this._priv_contentInfos;
1563
1525
  if (currentPeriod === null ||
1564
1526
  activeAdaptations === null ||
1565
- isNullOrUndefined(activeAdaptations[currentPeriod.id])) {
1527
+ (0, is_null_or_undefined_1.default)(activeAdaptations[currentPeriod.id])) {
1566
1528
  return null;
1567
1529
  }
1568
1530
  return activeAdaptations[currentPeriod.id];
1569
- };
1531
+ }
1570
1532
  // TODO remove the need for that public method
1571
- Player.prototype.__priv_getCurrentRepresentations = function () {
1533
+ __priv_getCurrentRepresentations() {
1572
1534
  if (this._priv_contentInfos === null) {
1573
1535
  return null;
1574
1536
  }
1575
- var _a = this._priv_contentInfos, currentPeriod = _a.currentPeriod, activeRepresentations = _a.activeRepresentations;
1537
+ const { currentPeriod, activeRepresentations } = this._priv_contentInfos;
1576
1538
  if (currentPeriod === null ||
1577
1539
  activeRepresentations === null ||
1578
- isNullOrUndefined(activeRepresentations[currentPeriod.id])) {
1540
+ (0, is_null_or_undefined_1.default)(activeRepresentations[currentPeriod.id])) {
1579
1541
  return null;
1580
1542
  }
1581
1543
  return activeRepresentations[currentPeriod.id];
1582
- };
1544
+ }
1583
1545
  // ---- Private methods ----
1584
1546
  /**
1585
1547
  * Reset all state properties relative to a playing content.
1586
1548
  */
1587
- Player.prototype._priv_cleanUpCurrentContentState = function () {
1588
- var _this = this;
1549
+ _priv_cleanUpCurrentContentState() {
1589
1550
  var _a, _b, _c, _d;
1590
- log.debug("Locking `contentLock` to clean-up the current content.");
1551
+ log_1.default.debug("Locking `contentLock` to clean-up the current content.");
1591
1552
  // lock playback of new contents while cleaning up is pending
1592
1553
  this._priv_contentLock.setValue(true);
1593
1554
  (_b = (_a = this._priv_contentInfos) === null || _a === void 0 ? void 0 : _a.tracksStore) === null || _b === void 0 ? void 0 : _b.dispose();
@@ -1595,18 +1556,18 @@ var Player = /** @class */ (function (_super) {
1595
1556
  this._priv_contentInfos = null;
1596
1557
  this._priv_contentEventsMemory = {};
1597
1558
  // DRM-related clean-up
1598
- var freeUpContentLock = function () {
1599
- if (_this.videoElement !== null) { // If not disposed
1600
- log.debug("Unlocking `contentLock`. Next content can begin.");
1601
- _this._priv_contentLock.setValue(false);
1559
+ const freeUpContentLock = () => {
1560
+ if (this.videoElement !== null) { // If not disposed
1561
+ log_1.default.debug("Unlocking `contentLock`. Next content can begin.");
1562
+ this._priv_contentLock.setValue(false);
1602
1563
  }
1603
1564
  };
1604
- if (!isNullOrUndefined(this.videoElement)) {
1605
- clearOnStop(this.videoElement).then(function () {
1606
- log.debug("API: DRM session cleaned-up with success!");
1565
+ if (!(0, is_null_or_undefined_1.default)(this.videoElement)) {
1566
+ (0, decrypt_1.clearOnStop)(this.videoElement).then(() => {
1567
+ log_1.default.debug("API: DRM session cleaned-up with success!");
1607
1568
  freeUpContentLock();
1608
- }, function (err) {
1609
- log.error("API: An error arised when trying to clean-up the DRM session:" +
1569
+ }, (err) => {
1570
+ log_1.default.error("API: An error arised when trying to clean-up the DRM session:" +
1610
1571
  (err instanceof Error ? err.toString() :
1611
1572
  "Unknown Error"));
1612
1573
  freeUpContentLock();
@@ -1615,95 +1576,93 @@ var Player = /** @class */ (function (_super) {
1615
1576
  else {
1616
1577
  freeUpContentLock();
1617
1578
  }
1618
- };
1579
+ }
1619
1580
  /**
1620
1581
  * Triggered when the Manifest has been loaded for the current content.
1621
1582
  * Initialize various private properties and emit initial event.
1622
1583
  * @param {Object} contentInfos
1623
1584
  * @param {Object} manifest
1624
1585
  */
1625
- Player.prototype._priv_onManifestReady = function (contentInfos, manifest) {
1626
- var _this = this;
1586
+ _priv_onManifestReady(contentInfos, manifest) {
1627
1587
  var _a;
1628
1588
  if (contentInfos.contentId !== ((_a = this._priv_contentInfos) === null || _a === void 0 ? void 0 : _a.contentId)) {
1629
1589
  return; // Event for another content
1630
1590
  }
1631
1591
  contentInfos.manifest = manifest;
1632
1592
  this._priv_reloadingMetadata.manifest = manifest;
1633
- var tracksStore = new TracksStore({
1593
+ const tracksStore = new tracks_store_1.default({
1634
1594
  preferTrickModeTracks: this._priv_preferTrickModeTracks,
1635
1595
  defaultAudioTrackSwitchingMode: contentInfos.defaultAudioTrackSwitchingMode,
1636
1596
  });
1637
1597
  contentInfos.tracksStore = tracksStore;
1638
- tracksStore.addEventListener("newAvailablePeriods", function (p) {
1639
- _this.trigger("newAvailablePeriods", p);
1598
+ tracksStore.addEventListener("newAvailablePeriods", (p) => {
1599
+ this.trigger("newAvailablePeriods", p);
1640
1600
  });
1641
- tracksStore.addEventListener("brokenRepresentationsLock", function (e) {
1642
- _this.trigger("brokenRepresentationsLock", e);
1601
+ tracksStore.addEventListener("brokenRepresentationsLock", (e) => {
1602
+ this.trigger("brokenRepresentationsLock", e);
1643
1603
  });
1644
- tracksStore.addEventListener("trackUpdate", function (e) {
1604
+ tracksStore.addEventListener("trackUpdate", (e) => {
1645
1605
  var _a, _b;
1646
- _this.trigger("trackUpdate", e);
1647
- var currentPeriod = (_b = (_a = _this._priv_contentInfos) === null || _a === void 0 ? void 0 : _a.currentPeriod) !== null && _b !== void 0 ? _b : undefined;
1606
+ this.trigger("trackUpdate", e);
1607
+ const currentPeriod = (_b = (_a = this._priv_contentInfos) === null || _a === void 0 ? void 0 : _a.currentPeriod) !== null && _b !== void 0 ? _b : undefined;
1648
1608
  if (e.reason === "no-playable-representation" &&
1649
1609
  e.period.id === (currentPeriod === null || currentPeriod === void 0 ? void 0 : currentPeriod.id)) {
1650
- _this._priv_onAvailableTracksMayHaveChanged(e.trackType);
1610
+ this._priv_onAvailableTracksMayHaveChanged(e.trackType);
1651
1611
  }
1652
1612
  });
1653
- contentInfos.tracksStore.addEventListener("warning", function (err) {
1654
- _this.trigger("warning", err);
1613
+ contentInfos.tracksStore.addEventListener("warning", (err) => {
1614
+ this.trigger("warning", err);
1655
1615
  });
1656
- contentInfos.tracksStore.addEventListener("error", function (err) {
1657
- _this._priv_onFatalError(err, contentInfos);
1616
+ contentInfos.tracksStore.addEventListener("error", (err) => {
1617
+ this._priv_onFatalError(err, contentInfos);
1658
1618
  });
1659
1619
  contentInfos.tracksStore.updatePeriodList(manifest);
1660
- manifest.addEventListener("manifestUpdate", function (updates) {
1620
+ manifest.addEventListener("manifestUpdate", (updates) => {
1661
1621
  var _a, _b, _c;
1662
1622
  // Update the tracks chosen if it changed
1663
- if (!isNullOrUndefined(contentInfos === null || contentInfos === void 0 ? void 0 : contentInfos.tracksStore)) {
1623
+ if (!(0, is_null_or_undefined_1.default)(contentInfos === null || contentInfos === void 0 ? void 0 : contentInfos.tracksStore)) {
1664
1624
  contentInfos.tracksStore.updatePeriodList(manifest);
1665
1625
  }
1666
- var currentPeriod = (_b = (_a = _this._priv_contentInfos) === null || _a === void 0 ? void 0 : _a.currentPeriod) !== null && _b !== void 0 ? _b : undefined;
1667
- var currTracksStore = (_c = _this._priv_contentInfos) === null || _c === void 0 ? void 0 : _c.tracksStore;
1668
- if (currentPeriod === undefined || isNullOrUndefined(currTracksStore)) {
1626
+ const currentPeriod = (_b = (_a = this._priv_contentInfos) === null || _a === void 0 ? void 0 : _a.currentPeriod) !== null && _b !== void 0 ? _b : undefined;
1627
+ const currTracksStore = (_c = this._priv_contentInfos) === null || _c === void 0 ? void 0 : _c.tracksStore;
1628
+ if (currentPeriod === undefined || (0, is_null_or_undefined_1.default)(currTracksStore)) {
1669
1629
  return;
1670
1630
  }
1671
- for (var _i = 0, _d = updates.updatedPeriods; _i < _d.length; _i++) {
1672
- var update = _d[_i];
1631
+ for (const update of updates.updatedPeriods) {
1673
1632
  if (update.period.id === currentPeriod.id) {
1674
1633
  if (update.result.addedAdaptations.length > 0 ||
1675
1634
  update.result.removedAdaptations.length > 0) {
1676
1635
  // We might have new (or less) tracks, send events just to be sure
1677
- var periodRef = currTracksStore.getPeriodObjectFromPeriod(currentPeriod);
1636
+ const periodRef = currTracksStore.getPeriodObjectFromPeriod(currentPeriod);
1678
1637
  if (periodRef === undefined) {
1679
1638
  return;
1680
1639
  }
1681
- _this._priv_onAvailableTracksMayHaveChanged("audio");
1682
- _this._priv_onAvailableTracksMayHaveChanged("text");
1683
- _this._priv_onAvailableTracksMayHaveChanged("video");
1640
+ this._priv_onAvailableTracksMayHaveChanged("audio");
1641
+ this._priv_onAvailableTracksMayHaveChanged("text");
1642
+ this._priv_onAvailableTracksMayHaveChanged("video");
1684
1643
  }
1685
1644
  }
1686
1645
  return;
1687
1646
  }
1688
1647
  }, contentInfos.currentContentCanceller.signal);
1689
- manifest.addEventListener("decipherabilityUpdate", function (elts) {
1648
+ manifest.addEventListener("decipherabilityUpdate", (elts) => {
1690
1649
  /**
1691
1650
  * Array of tuples only including once the Period/Track combination, and
1692
1651
  * only when it concerns the currently-selected track.
1693
1652
  */
1694
- var periodsAndTrackTypes = elts.reduce(function (acc, elt) {
1653
+ const periodsAndTrackTypes = elts.reduce((acc, elt) => {
1695
1654
  var _a, _b, _c;
1696
- var isFound = arrayFind(acc, function (x) { return x[0].id === elt.period.id &&
1697
- x[1] === elt.adaptation.type; }) === undefined;
1655
+ const isFound = (0, array_find_1.default)(acc, (x) => x[0].id === elt.period.id &&
1656
+ x[1] === elt.adaptation.type) === undefined;
1698
1657
  if (!isFound) {
1699
1658
  // Only consider the currently-selected tracks.
1700
1659
  // NOTE: Maybe there's room for optimizations? Unclear.
1701
- var tStore = contentInfos.tracksStore;
1660
+ const tStore = contentInfos.tracksStore;
1702
1661
  if (tStore === null) {
1703
1662
  return acc;
1704
1663
  }
1705
- var isCurrent = false;
1706
- var periodRef = tStore.getPeriodObjectFromPeriod(elt.period);
1664
+ let isCurrent = false;
1665
+ const periodRef = tStore.getPeriodObjectFromPeriod(elt.period);
1707
1666
  if (periodRef === undefined) {
1708
1667
  return acc;
1709
1668
  }
@@ -1727,12 +1686,11 @@ var Player = /** @class */ (function (_super) {
1727
1686
  }
1728
1687
  return acc;
1729
1688
  }, []);
1730
- for (var _i = 0, periodsAndTrackTypes_1 = periodsAndTrackTypes; _i < periodsAndTrackTypes_1.length; _i++) {
1731
- var _a = periodsAndTrackTypes_1[_i], period = _a[0], trackType = _a[1];
1732
- _this._priv_triggerEventIfNotStopped("representationListUpdate", { period: period, trackType: trackType, reason: "decipherability-update" }, contentInfos.currentContentCanceller.signal);
1689
+ for (const [period, trackType] of periodsAndTrackTypes) {
1690
+ this._priv_triggerEventIfNotStopped("representationListUpdate", { period, trackType, reason: "decipherability-update" }, contentInfos.currentContentCanceller.signal);
1733
1691
  }
1734
1692
  }, contentInfos.currentContentCanceller.signal);
1735
- };
1693
+ }
1736
1694
  /**
1737
1695
  * Triggered each times the current Period Changed.
1738
1696
  * Store and emit initial state for the Period.
@@ -1740,14 +1698,13 @@ var Player = /** @class */ (function (_super) {
1740
1698
  * @param {Object} contentInfos
1741
1699
  * @param {Object} periodInfo
1742
1700
  */
1743
- Player.prototype._priv_onActivePeriodChanged = function (contentInfos, _a) {
1744
- var _b, _c, _d, _e, _f, _g;
1745
- var period = _a.period;
1746
- if (contentInfos.contentId !== ((_b = this._priv_contentInfos) === null || _b === void 0 ? void 0 : _b.contentId)) {
1701
+ _priv_onActivePeriodChanged(contentInfos, { period }) {
1702
+ var _a, _b, _c, _d, _e, _f;
1703
+ if (contentInfos.contentId !== ((_a = this._priv_contentInfos) === null || _a === void 0 ? void 0 : _a.contentId)) {
1747
1704
  return; // Event for another content
1748
1705
  }
1749
1706
  contentInfos.currentPeriod = period;
1750
- var cancelSignal = contentInfos.currentContentCanceller.signal;
1707
+ const cancelSignal = contentInfos.currentContentCanceller.signal;
1751
1708
  if (this._priv_contentEventsMemory.periodChange !== period) {
1752
1709
  this._priv_contentEventsMemory.periodChange = period;
1753
1710
  this._priv_triggerEventIfNotStopped("periodChange", { start: period.start,
@@ -1757,16 +1714,16 @@ var Player = /** @class */ (function (_super) {
1757
1714
  this._priv_triggerEventIfNotStopped("availableAudioTracksChange", this.getAvailableAudioTracks(), cancelSignal);
1758
1715
  this._priv_triggerEventIfNotStopped("availableTextTracksChange", this.getAvailableTextTracks(), cancelSignal);
1759
1716
  this._priv_triggerEventIfNotStopped("availableVideoTracksChange", this.getAvailableVideoTracks(), cancelSignal);
1760
- var tracksStore = (_c = this._priv_contentInfos) === null || _c === void 0 ? void 0 : _c.tracksStore;
1717
+ const tracksStore = (_b = this._priv_contentInfos) === null || _b === void 0 ? void 0 : _b.tracksStore;
1761
1718
  // Emit initial events for the Period
1762
- if (!isNullOrUndefined(tracksStore)) {
1763
- var periodRef = tracksStore.getPeriodObjectFromPeriod(period);
1719
+ if (!(0, is_null_or_undefined_1.default)(tracksStore)) {
1720
+ const periodRef = tracksStore.getPeriodObjectFromPeriod(period);
1764
1721
  if (periodRef) {
1765
- var audioTrack = tracksStore.getChosenAudioTrack(periodRef);
1722
+ const audioTrack = tracksStore.getChosenAudioTrack(periodRef);
1766
1723
  this._priv_triggerEventIfNotStopped("audioTrackChange", audioTrack, cancelSignal);
1767
- var textTrack = tracksStore.getChosenTextTrack(periodRef);
1724
+ const textTrack = tracksStore.getChosenTextTrack(periodRef);
1768
1725
  this._priv_triggerEventIfNotStopped("textTrackChange", textTrack, cancelSignal);
1769
- var videoTrack = tracksStore.getChosenVideoTrack(periodRef);
1726
+ const videoTrack = tracksStore.getChosenVideoTrack(periodRef);
1770
1727
  this._priv_triggerEventIfNotStopped("videoTrackChange", videoTrack, cancelSignal);
1771
1728
  }
1772
1729
  }
@@ -1775,30 +1732,30 @@ var Player = /** @class */ (function (_super) {
1775
1732
  this._priv_triggerEventIfNotStopped("textTrackChange", null, cancelSignal);
1776
1733
  this._priv_triggerEventIfNotStopped("videoTrackChange", null, cancelSignal);
1777
1734
  }
1778
- var audioRepresentation = (_e = (_d = this.__priv_getCurrentRepresentations()) === null || _d === void 0 ? void 0 : _d.audio) !== null && _e !== void 0 ? _e : null;
1735
+ const audioRepresentation = (_d = (_c = this.__priv_getCurrentRepresentations()) === null || _c === void 0 ? void 0 : _c.audio) !== null && _d !== void 0 ? _d : null;
1779
1736
  this._priv_triggerEventIfNotStopped("audioRepresentationChange", audioRepresentation, cancelSignal);
1780
- var videoRepresentation = (_g = (_f = this.__priv_getCurrentRepresentations()) === null || _f === void 0 ? void 0 : _f.video) !== null && _g !== void 0 ? _g : null;
1737
+ const videoRepresentation = (_f = (_e = this.__priv_getCurrentRepresentations()) === null || _e === void 0 ? void 0 : _e.video) !== null && _f !== void 0 ? _f : null;
1781
1738
  this._priv_triggerEventIfNotStopped("videoRepresentationChange", videoRepresentation, cancelSignal);
1782
- };
1739
+ }
1783
1740
  /**
1784
1741
  * Triggered each times a new "PeriodStream" is ready.
1785
1742
  * Choose the right Adaptation for the Period and emit it.
1786
1743
  * @param {Object} contentInfos
1787
1744
  * @param {Object} value
1788
1745
  */
1789
- Player.prototype._priv_onPeriodStreamReady = function (contentInfos, value) {
1746
+ _priv_onPeriodStreamReady(contentInfos, value) {
1790
1747
  var _a;
1791
1748
  if (contentInfos.contentId !== ((_a = this._priv_contentInfos) === null || _a === void 0 ? void 0 : _a.contentId)) {
1792
1749
  return; // Event for another content
1793
1750
  }
1794
- var type = value.type, manifest = value.manifest, period = value.period, adaptationRef = value.adaptationRef;
1795
- var tracksStore = contentInfos.tracksStore;
1751
+ const { type, manifest, period, adaptationRef } = value;
1752
+ const tracksStore = contentInfos.tracksStore;
1796
1753
  switch (type) {
1797
1754
  case "video":
1798
1755
  case "audio":
1799
1756
  case "text":
1800
- if (isNullOrUndefined(tracksStore)) {
1801
- log.error("API: TracksStore not instanciated for a new ".concat(type, " period"));
1757
+ if ((0, is_null_or_undefined_1.default)(tracksStore)) {
1758
+ log_1.default.error(`API: TracksStore not instanciated for a new ${type} period`);
1802
1759
  adaptationRef.setValue(null);
1803
1760
  }
1804
1761
  else {
@@ -1806,50 +1763,50 @@ var Player = /** @class */ (function (_super) {
1806
1763
  }
1807
1764
  break;
1808
1765
  default:
1809
- assertUnreachable(type);
1766
+ (0, assert_unreachable_1.default)(type);
1810
1767
  }
1811
- };
1768
+ }
1812
1769
  /**
1813
1770
  * Triggered each times we "remove" a PeriodStream.
1814
1771
  * @param {Object} contentInfos
1815
1772
  * @param {Object} value
1816
1773
  */
1817
- Player.prototype._priv_onPeriodStreamCleared = function (contentInfos, value) {
1774
+ _priv_onPeriodStreamCleared(contentInfos, value) {
1818
1775
  var _a;
1819
1776
  if (contentInfos.contentId !== ((_a = this._priv_contentInfos) === null || _a === void 0 ? void 0 : _a.contentId)) {
1820
1777
  return; // Event for another content
1821
1778
  }
1822
- var type = value.type, period = value.period;
1823
- var tracksStore = contentInfos.tracksStore;
1779
+ const { type, period } = value;
1780
+ const tracksStore = contentInfos.tracksStore;
1824
1781
  // Clean-up track choices from TracksStore
1825
1782
  switch (type) {
1826
1783
  case "audio":
1827
1784
  case "text":
1828
1785
  case "video":
1829
- if (!isNullOrUndefined(tracksStore)) {
1786
+ if (!(0, is_null_or_undefined_1.default)(tracksStore)) {
1830
1787
  tracksStore.removeTrackReference(type, period);
1831
1788
  }
1832
1789
  break;
1833
1790
  }
1834
1791
  // Clean-up stored Representation and Adaptation information
1835
- var activeAdaptations = contentInfos.activeAdaptations, activeRepresentations = contentInfos.activeRepresentations;
1836
- if (!isNullOrUndefined(activeAdaptations) &&
1837
- !isNullOrUndefined(activeAdaptations[period.id])) {
1838
- var activePeriodAdaptations = activeAdaptations[period.id];
1792
+ const { activeAdaptations, activeRepresentations } = contentInfos;
1793
+ if (!(0, is_null_or_undefined_1.default)(activeAdaptations) &&
1794
+ !(0, is_null_or_undefined_1.default)(activeAdaptations[period.id])) {
1795
+ const activePeriodAdaptations = activeAdaptations[period.id];
1839
1796
  delete activePeriodAdaptations[type];
1840
1797
  if (Object.keys(activePeriodAdaptations).length === 0) {
1841
1798
  delete activeAdaptations[period.id];
1842
1799
  }
1843
1800
  }
1844
- if (!isNullOrUndefined(activeRepresentations) &&
1845
- !isNullOrUndefined(activeRepresentations[period.id])) {
1846
- var activePeriodRepresentations = activeRepresentations[period.id];
1801
+ if (!(0, is_null_or_undefined_1.default)(activeRepresentations) &&
1802
+ !(0, is_null_or_undefined_1.default)(activeRepresentations[period.id])) {
1803
+ const activePeriodRepresentations = activeRepresentations[period.id];
1847
1804
  delete activePeriodRepresentations[type];
1848
1805
  if (Object.keys(activePeriodRepresentations).length === 0) {
1849
1806
  delete activeRepresentations[period.id];
1850
1807
  }
1851
1808
  }
1852
- };
1809
+ }
1853
1810
  /**
1854
1811
  * Triggered each times a new Adaptation is considered for the current
1855
1812
  * content.
@@ -1857,50 +1814,48 @@ var Player = /** @class */ (function (_super) {
1857
1814
  * @param {Object} contentInfos
1858
1815
  * @param {Object} value
1859
1816
  */
1860
- Player.prototype._priv_onAdaptationChange = function (contentInfos, _a) {
1861
- var _b;
1862
- var _c;
1863
- var type = _a.type, adaptation = _a.adaptation, period = _a.period;
1864
- if (contentInfos.contentId !== ((_c = this._priv_contentInfos) === null || _c === void 0 ? void 0 : _c.contentId)) {
1817
+ _priv_onAdaptationChange(contentInfos, { type, adaptation, period }) {
1818
+ var _a;
1819
+ if (contentInfos.contentId !== ((_a = this._priv_contentInfos) === null || _a === void 0 ? void 0 : _a.contentId)) {
1865
1820
  return; // Event for another content
1866
1821
  }
1867
1822
  // lazily create contentInfos.activeAdaptations
1868
1823
  if (contentInfos.activeAdaptations === null) {
1869
1824
  contentInfos.activeAdaptations = {};
1870
1825
  }
1871
- var activeAdaptations = contentInfos.activeAdaptations, currentPeriod = contentInfos.currentPeriod;
1872
- var activePeriodAdaptations = activeAdaptations[period.id];
1873
- if (isNullOrUndefined(activePeriodAdaptations)) {
1874
- activeAdaptations[period.id] = (_b = {}, _b[type] = adaptation, _b);
1826
+ const { activeAdaptations, currentPeriod } = contentInfos;
1827
+ const activePeriodAdaptations = activeAdaptations[period.id];
1828
+ if ((0, is_null_or_undefined_1.default)(activePeriodAdaptations)) {
1829
+ activeAdaptations[period.id] = { [type]: adaptation };
1875
1830
  }
1876
1831
  else {
1877
1832
  activePeriodAdaptations[type] = adaptation;
1878
1833
  }
1879
- var tracksStore = contentInfos.tracksStore;
1880
- var cancelSignal = contentInfos.currentContentCanceller.signal;
1834
+ const { tracksStore } = contentInfos;
1835
+ const cancelSignal = contentInfos.currentContentCanceller.signal;
1881
1836
  if (tracksStore !== null &&
1882
- currentPeriod !== null && !isNullOrUndefined(period) &&
1837
+ currentPeriod !== null && !(0, is_null_or_undefined_1.default)(period) &&
1883
1838
  period.id === currentPeriod.id) {
1884
- var periodRef = tracksStore.getPeriodObjectFromPeriod(period);
1839
+ const periodRef = tracksStore.getPeriodObjectFromPeriod(period);
1885
1840
  if (periodRef === undefined) {
1886
1841
  return;
1887
1842
  }
1888
1843
  switch (type) {
1889
1844
  case "audio":
1890
- var audioTrack = tracksStore.getChosenAudioTrack(periodRef);
1845
+ const audioTrack = tracksStore.getChosenAudioTrack(periodRef);
1891
1846
  this._priv_triggerEventIfNotStopped("audioTrackChange", audioTrack, cancelSignal);
1892
1847
  break;
1893
1848
  case "text":
1894
- var textTrack = tracksStore.getChosenTextTrack(periodRef);
1849
+ const textTrack = tracksStore.getChosenTextTrack(periodRef);
1895
1850
  this._priv_triggerEventIfNotStopped("textTrackChange", textTrack, cancelSignal);
1896
1851
  break;
1897
1852
  case "video":
1898
- var videoTrack = tracksStore.getChosenVideoTrack(periodRef);
1853
+ const videoTrack = tracksStore.getChosenVideoTrack(periodRef);
1899
1854
  this._priv_triggerEventIfNotStopped("videoTrackChange", videoTrack, cancelSignal);
1900
1855
  break;
1901
1856
  }
1902
1857
  }
1903
- };
1858
+ }
1904
1859
  /**
1905
1860
  * Triggered each times a new Representation is considered during playback.
1906
1861
  *
@@ -1909,29 +1864,27 @@ var Player = /** @class */ (function (_super) {
1909
1864
  * @param {Object} contentInfos
1910
1865
  * @param {Object} obj
1911
1866
  */
1912
- Player.prototype._priv_onRepresentationChange = function (contentInfos, _a) {
1913
- var _b;
1914
- var _c;
1915
- var type = _a.type, period = _a.period, representation = _a.representation;
1916
- if (contentInfos.contentId !== ((_c = this._priv_contentInfos) === null || _c === void 0 ? void 0 : _c.contentId)) {
1867
+ _priv_onRepresentationChange(contentInfos, { type, period, representation }) {
1868
+ var _a;
1869
+ if (contentInfos.contentId !== ((_a = this._priv_contentInfos) === null || _a === void 0 ? void 0 : _a.contentId)) {
1917
1870
  return; // Event for another content
1918
1871
  }
1919
1872
  // lazily create contentInfos.activeRepresentations
1920
1873
  if (contentInfos.activeRepresentations === null) {
1921
1874
  contentInfos.activeRepresentations = {};
1922
1875
  }
1923
- var activeRepresentations = contentInfos.activeRepresentations, currentPeriod = contentInfos.currentPeriod;
1924
- var activePeriodRepresentations = activeRepresentations[period.id];
1925
- if (isNullOrUndefined(activePeriodRepresentations)) {
1926
- activeRepresentations[period.id] = (_b = {}, _b[type] = representation, _b);
1876
+ const { activeRepresentations, currentPeriod } = contentInfos;
1877
+ const activePeriodRepresentations = activeRepresentations[period.id];
1878
+ if ((0, is_null_or_undefined_1.default)(activePeriodRepresentations)) {
1879
+ activeRepresentations[period.id] = { [type]: representation };
1927
1880
  }
1928
1881
  else {
1929
1882
  activePeriodRepresentations[type] = representation;
1930
1883
  }
1931
- if (!isNullOrUndefined(period) &&
1884
+ if (!(0, is_null_or_undefined_1.default)(period) &&
1932
1885
  currentPeriod !== null &&
1933
1886
  currentPeriod.id === period.id) {
1934
- var cancelSignal = this._priv_contentInfos.currentContentCanceller.signal;
1887
+ const cancelSignal = this._priv_contentInfos.currentContentCanceller.signal;
1935
1888
  if (type === "video") {
1936
1889
  this._priv_triggerEventIfNotStopped("videoRepresentationChange", representation, cancelSignal);
1937
1890
  }
@@ -1939,7 +1892,7 @@ var Player = /** @class */ (function (_super) {
1939
1892
  this._priv_triggerEventIfNotStopped("audioRepresentationChange", representation, cancelSignal);
1940
1893
  }
1941
1894
  }
1942
- };
1895
+ }
1943
1896
  /**
1944
1897
  * Triggered each time a bitrate estimate is calculated.
1945
1898
  *
@@ -1947,15 +1900,14 @@ var Player = /** @class */ (function (_super) {
1947
1900
  *
1948
1901
  * @param {Object} value
1949
1902
  */
1950
- Player.prototype._priv_onBitrateEstimateChange = function (_a) {
1951
- var type = _a.type, bitrate = _a.bitrate;
1903
+ _priv_onBitrateEstimateChange({ type, bitrate, }) {
1952
1904
  if (bitrate !== undefined) {
1953
1905
  this._priv_bitrateInfos.lastBitrates[type] = bitrate;
1954
1906
  }
1955
1907
  // !!! undocumented API :O !!!
1956
1908
  /* eslint-disable-next-line */
1957
- this.trigger("__priv_bitrateEstimateChange", { type: type, bitrate: bitrate });
1958
- };
1909
+ this.trigger("__priv_bitrateEstimateChange", { type, bitrate });
1910
+ }
1959
1911
  /**
1960
1912
  * Triggered each time the player state updates.
1961
1913
  *
@@ -1963,13 +1915,13 @@ var Player = /** @class */ (function (_super) {
1963
1915
  *
1964
1916
  * @param {string} newState
1965
1917
  */
1966
- Player.prototype._priv_setPlayerState = function (newState) {
1918
+ _priv_setPlayerState(newState) {
1967
1919
  if (this.state !== newState) {
1968
1920
  this.state = newState;
1969
- log.info("API: playerStateChange event", newState);
1921
+ log_1.default.info("API: playerStateChange event", newState);
1970
1922
  this.trigger("playerStateChange", newState);
1971
1923
  }
1972
- };
1924
+ }
1973
1925
  /**
1974
1926
  * Triggered each time a playback observation.
1975
1927
  *
@@ -1978,22 +1930,22 @@ var Player = /** @class */ (function (_super) {
1978
1930
  * @param {Object} contentInfos
1979
1931
  * @param {Object} observation
1980
1932
  */
1981
- Player.prototype._priv_triggerPositionUpdate = function (contentInfos, observation) {
1933
+ _priv_triggerPositionUpdate(contentInfos, observation) {
1982
1934
  var _a, _b;
1983
1935
  if (contentInfos.contentId !== ((_a = this._priv_contentInfos) === null || _a === void 0 ? void 0 : _a.contentId)) {
1984
1936
  return; // Event for another content
1985
1937
  }
1986
- var isDirectFile = contentInfos.isDirectFile, manifest = contentInfos.manifest;
1987
- if ((!isDirectFile && manifest === null) || isNullOrUndefined(observation)) {
1938
+ const { isDirectFile, manifest } = contentInfos;
1939
+ if ((!isDirectFile && manifest === null) || (0, is_null_or_undefined_1.default)(observation)) {
1988
1940
  return;
1989
1941
  }
1990
- var maximumPosition = manifest !== null ? manifest.getMaximumSafePosition() :
1942
+ const maximumPosition = manifest !== null ? manifest.getMaximumSafePosition() :
1991
1943
  undefined;
1992
- var positionData = {
1944
+ const positionData = {
1993
1945
  position: observation.position,
1994
1946
  duration: observation.duration,
1995
1947
  playbackRate: observation.playbackRate,
1996
- maximumPosition: maximumPosition,
1948
+ maximumPosition,
1997
1949
  // TODO bufferGap may be undefined
1998
1950
  bufferGap: observation.bufferGap === undefined ||
1999
1951
  !isFinite(observation.bufferGap) ?
@@ -2003,41 +1955,40 @@ var Player = /** @class */ (function (_super) {
2003
1955
  if (manifest !== null &&
2004
1956
  manifest.isLive &&
2005
1957
  observation.position > 0) {
2006
- var ast = (_b = manifest.availabilityStartTime) !== null && _b !== void 0 ? _b : 0;
1958
+ const ast = (_b = manifest.availabilityStartTime) !== null && _b !== void 0 ? _b : 0;
2007
1959
  positionData.wallClockTime = observation.position + ast;
2008
- var livePosition = manifest.getLivePosition();
1960
+ const livePosition = manifest.getLivePosition();
2009
1961
  if (livePosition !== undefined) {
2010
1962
  positionData.liveGap = livePosition - observation.position;
2011
1963
  }
2012
1964
  }
2013
1965
  else if (isDirectFile && this.videoElement !== null) {
2014
- var startDate = getStartDate(this.videoElement);
1966
+ const startDate = (0, compat_1.getStartDate)(this.videoElement);
2015
1967
  if (startDate !== undefined) {
2016
1968
  positionData.wallClockTime = startDate + observation.position;
2017
1969
  }
2018
1970
  }
2019
1971
  this.trigger("positionUpdate", positionData);
2020
- };
1972
+ }
2021
1973
  /**
2022
1974
  * @param {string} evt
2023
1975
  * @param {*} arg
2024
1976
  * @param {Object} currentContentCancelSignal
2025
1977
  */
2026
- Player.prototype._priv_triggerEventIfNotStopped = function (evt, arg, currentContentCancelSignal) {
1978
+ _priv_triggerEventIfNotStopped(evt, arg, currentContentCancelSignal) {
2027
1979
  if (!currentContentCancelSignal.isCancelled()) {
2028
1980
  this.trigger(evt, arg);
2029
1981
  }
2030
- };
1982
+ }
2031
1983
  /**
2032
1984
  * @param {Object} cancelSignal
2033
1985
  * @returns {Object}
2034
1986
  */
2035
- Player.prototype._priv_initializeMediaElementTracksStore = function (cancelSignal) {
2036
- var _this = this;
1987
+ _priv_initializeMediaElementTracksStore(cancelSignal) {
2037
1988
  var _a, _b, _c;
2038
- assert(features.directfile !== null, "Initializing `MediaElementTracksStore` without Directfile feature");
2039
- assert(this.videoElement !== null, "Initializing `MediaElementTracksStore` on a disposed RxPlayer");
2040
- var mediaElementTracksStore = new features.directfile.mediaElementTracksStore(this.videoElement);
1989
+ (0, assert_1.default)(features_1.default.directfile !== null, "Initializing `MediaElementTracksStore` without Directfile feature");
1990
+ (0, assert_1.default)(this.videoElement !== null, "Initializing `MediaElementTracksStore` on a disposed RxPlayer");
1991
+ const mediaElementTracksStore = new features_1.default.directfile.mediaElementTracksStore(this.videoElement);
2041
1992
  this._priv_triggerEventIfNotStopped("availableAudioTracksChange", mediaElementTracksStore.getAvailableAudioTracks(), cancelSignal);
2042
1993
  this._priv_triggerEventIfNotStopped("availableVideoTracksChange", mediaElementTracksStore.getAvailableVideoTracks(), cancelSignal);
2043
1994
  this._priv_triggerEventIfNotStopped("availableTextTracksChange", mediaElementTracksStore.getAvailableTextTracks(), cancelSignal);
@@ -2045,52 +1996,40 @@ var Player = /** @class */ (function (_super) {
2045
1996
  this._priv_triggerEventIfNotStopped("textTrackChange", (_b = mediaElementTracksStore.getChosenTextTrack()) !== null && _b !== void 0 ? _b : null, cancelSignal);
2046
1997
  this._priv_triggerEventIfNotStopped("videoTrackChange", (_c = mediaElementTracksStore.getChosenVideoTrack()) !== null && _c !== void 0 ? _c : null, cancelSignal);
2047
1998
  mediaElementTracksStore
2048
- .addEventListener("availableVideoTracksChange", function (val) {
2049
- return _this.trigger("availableVideoTracksChange", val);
2050
- });
1999
+ .addEventListener("availableVideoTracksChange", (val) => this.trigger("availableVideoTracksChange", val));
2051
2000
  mediaElementTracksStore
2052
- .addEventListener("availableAudioTracksChange", function (val) {
2053
- return _this.trigger("availableAudioTracksChange", val);
2054
- });
2001
+ .addEventListener("availableAudioTracksChange", (val) => this.trigger("availableAudioTracksChange", val));
2055
2002
  mediaElementTracksStore
2056
- .addEventListener("availableTextTracksChange", function (val) {
2057
- return _this.trigger("availableTextTracksChange", val);
2058
- });
2003
+ .addEventListener("availableTextTracksChange", (val) => this.trigger("availableTextTracksChange", val));
2059
2004
  mediaElementTracksStore
2060
- .addEventListener("audioTrackChange", function (val) {
2061
- return _this.trigger("audioTrackChange", val);
2062
- });
2005
+ .addEventListener("audioTrackChange", (val) => this.trigger("audioTrackChange", val));
2063
2006
  mediaElementTracksStore
2064
- .addEventListener("videoTrackChange", function (val) {
2065
- return _this.trigger("videoTrackChange", val);
2066
- });
2007
+ .addEventListener("videoTrackChange", (val) => this.trigger("videoTrackChange", val));
2067
2008
  mediaElementTracksStore
2068
- .addEventListener("textTrackChange", function (val) {
2069
- return _this.trigger("textTrackChange", val);
2070
- });
2009
+ .addEventListener("textTrackChange", (val) => this.trigger("textTrackChange", val));
2071
2010
  return mediaElementTracksStore;
2072
- };
2073
- Player.prototype._priv_callTracksStoreGetterSetter = function (periodId, defaultValue, cb) {
2011
+ }
2012
+ _priv_callTracksStoreGetterSetter(periodId, defaultValue, cb) {
2074
2013
  var _a, _b;
2075
2014
  if (this._priv_contentInfos === null ||
2076
2015
  this._priv_contentInfos.tracksStore === null) {
2077
- log.warn("API: Trying to call track API too soon");
2016
+ log_1.default.warn("API: Trying to call track API too soon");
2078
2017
  return defaultValue;
2079
2018
  }
2080
- var tracksStore = this._priv_contentInfos.tracksStore;
2081
- var currentPeriod = (_b = (_a = this._priv_contentInfos) === null || _a === void 0 ? void 0 : _a.currentPeriod) !== null && _b !== void 0 ? _b : undefined;
2082
- var wantedPeriodId = periodId !== null && periodId !== void 0 ? periodId : currentPeriod === null || currentPeriod === void 0 ? void 0 : currentPeriod.id;
2019
+ const { tracksStore } = this._priv_contentInfos;
2020
+ const currentPeriod = (_b = (_a = this._priv_contentInfos) === null || _a === void 0 ? void 0 : _a.currentPeriod) !== null && _b !== void 0 ? _b : undefined;
2021
+ const wantedPeriodId = periodId !== null && periodId !== void 0 ? periodId : currentPeriod === null || currentPeriod === void 0 ? void 0 : currentPeriod.id;
2083
2022
  if (wantedPeriodId === undefined) {
2084
2023
  return defaultValue;
2085
2024
  }
2086
- var periodRef = wantedPeriodId === (currentPeriod === null || currentPeriod === void 0 ? void 0 : currentPeriod.id) ?
2025
+ const periodRef = wantedPeriodId === (currentPeriod === null || currentPeriod === void 0 ? void 0 : currentPeriod.id) ?
2087
2026
  tracksStore.getPeriodObjectFromPeriod(currentPeriod) :
2088
2027
  tracksStore.getPeriodObjectFromId(wantedPeriodId);
2089
2028
  if (periodRef === undefined) {
2090
2029
  return defaultValue;
2091
2030
  }
2092
2031
  return cb(tracksStore, periodRef);
2093
- };
2032
+ }
2094
2033
  /**
2095
2034
  * Method to call when some event lead to a high for possibility that the
2096
2035
  * available tracks for the given type have changed.
@@ -2101,37 +2040,37 @@ var Player = /** @class */ (function (_super) {
2101
2040
  * @param {Object|undefined} [oPeriodRef] - optional period object used by the
2102
2041
  * `tracksStore` API, allows to optimize the method by bypassing this step.
2103
2042
  */
2104
- Player.prototype._priv_onAvailableTracksMayHaveChanged = function (trackType, oPeriodRef) {
2105
- var contentInfos = this._priv_contentInfos;
2043
+ _priv_onAvailableTracksMayHaveChanged(trackType, oPeriodRef) {
2044
+ const contentInfos = this._priv_contentInfos;
2106
2045
  if (contentInfos === null) {
2107
2046
  return;
2108
2047
  }
2109
- var currentPeriod = contentInfos.currentPeriod, tracksStore = contentInfos.tracksStore, currentContentCanceller = contentInfos.currentContentCanceller;
2110
- var cancelSignal = currentContentCanceller.signal;
2111
- if (isNullOrUndefined(currentPeriod) || tracksStore === null) {
2048
+ const { currentPeriod, tracksStore, currentContentCanceller } = contentInfos;
2049
+ const cancelSignal = currentContentCanceller.signal;
2050
+ if ((0, is_null_or_undefined_1.default)(currentPeriod) || tracksStore === null) {
2112
2051
  return;
2113
2052
  }
2114
- var periodRef = oPeriodRef !== null && oPeriodRef !== void 0 ? oPeriodRef : tracksStore.getPeriodObjectFromPeriod(currentPeriod);
2053
+ const periodRef = oPeriodRef !== null && oPeriodRef !== void 0 ? oPeriodRef : tracksStore.getPeriodObjectFromPeriod(currentPeriod);
2115
2054
  if (periodRef === undefined) {
2116
2055
  return;
2117
2056
  }
2118
2057
  switch (trackType) {
2119
2058
  case "video":
2120
- var videoTracks = tracksStore.getAvailableVideoTracks(periodRef);
2059
+ const videoTracks = tracksStore.getAvailableVideoTracks(periodRef);
2121
2060
  this._priv_triggerEventIfNotStopped("availableVideoTracksChange", videoTracks !== null && videoTracks !== void 0 ? videoTracks : [], cancelSignal);
2122
2061
  break;
2123
2062
  case "audio":
2124
- var audioTracks = tracksStore.getAvailableAudioTracks(periodRef);
2063
+ const audioTracks = tracksStore.getAvailableAudioTracks(periodRef);
2125
2064
  this._priv_triggerEventIfNotStopped("availableAudioTracksChange", audioTracks !== null && audioTracks !== void 0 ? audioTracks : [], cancelSignal);
2126
2065
  break;
2127
2066
  case "text":
2128
- var textTracks = tracksStore.getAvailableTextTracks(periodRef);
2067
+ const textTracks = tracksStore.getAvailableTextTracks(periodRef);
2129
2068
  this._priv_triggerEventIfNotStopped("availableTextTracksChange", textTracks !== null && textTracks !== void 0 ? textTracks : [], cancelSignal);
2130
2069
  break;
2131
2070
  default:
2132
- assertUnreachable(trackType);
2071
+ (0, assert_unreachable_1.default)(trackType);
2133
2072
  }
2134
- };
2073
+ }
2135
2074
  /**
2136
2075
  * Method to call when a fatal error lead to the stopping of the current
2137
2076
  * content.
@@ -2140,8 +2079,8 @@ var Player = /** @class */ (function (_super) {
2140
2079
  * @param {Object} contentInfos - The `IPublicApiContentInfos` object linked
2141
2080
  * to the content for which the error was received.
2142
2081
  */
2143
- Player.prototype._priv_onFatalError = function (err, contentInfos) {
2144
- var formattedError = formatError(err, {
2082
+ _priv_onFatalError(err, contentInfos) {
2083
+ const formattedError = (0, errors_1.formatError)(err, {
2145
2084
  defaultCode: "NONE",
2146
2085
  defaultReason: "An unknown error stopped content playback.",
2147
2086
  });
@@ -2149,7 +2088,7 @@ var Player = /** @class */ (function (_super) {
2149
2088
  contentInfos.currentContentCanceller.cancel();
2150
2089
  this._priv_cleanUpCurrentContentState();
2151
2090
  this._priv_currentError = formattedError;
2152
- log.error("API: The player stopped because of an error", formattedError);
2091
+ log_1.default.error("API: The player stopped because of an error", formattedError);
2153
2092
  this._priv_setPlayerState("STOPPED" /* PLAYER_STATES.STOPPED */);
2154
2093
  // TODO This condition is here because the eventual callback called when the
2155
2094
  // player state is updated can launch a new content, thus the error will not
@@ -2158,8 +2097,7 @@ var Player = /** @class */ (function (_super) {
2158
2097
  if (this._priv_currentError === formattedError) {
2159
2098
  this.trigger("error", formattedError);
2160
2099
  }
2161
- };
2162
- return Player;
2163
- }(EventEmitter));
2164
- Player.version = /* PLAYER_VERSION */ "4.0.0-beta.2";
2165
- export default Player;
2100
+ }
2101
+ }
2102
+ Player.version = /* PLAYER_VERSION */ "4.0.0-beta.3";
2103
+ exports.default = Player;