rx-player 4.0.0-dev.2023092900 → 4.0.0-dev.2023102700

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