rx-player 4.0.0 → 4.1.0-dev.2024031100

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 (2222) hide show
  1. package/.prettierrc +4 -0
  2. package/CHANGELOG.md +1500 -996
  3. package/MAINTAINERS.md +9 -12
  4. package/README.md +107 -122
  5. package/VERSION +1 -1
  6. package/dist/commonjs/__GENERATED_CODE/embedded_dash_wasm.js +1 -1
  7. package/dist/commonjs/__GENERATED_CODE/embedded_worker.js +1 -1
  8. package/dist/commonjs/__GENERATED_CODE/embedded_worker_es5.d.ts +3 -0
  9. package/dist/commonjs/__GENERATED_CODE/embedded_worker_es5.js +6 -0
  10. package/dist/commonjs/__GENERATED_CODE/index.d.ts +1 -0
  11. package/dist/commonjs/__GENERATED_CODE/index.js +3 -1
  12. package/dist/commonjs/compat/add_class_name.js +4 -3
  13. package/dist/commonjs/compat/add_text_track.d.ts +1 -1
  14. package/dist/commonjs/compat/add_text_track.js +3 -2
  15. package/dist/commonjs/compat/browser_compatibility_types.js +13 -7
  16. package/dist/commonjs/compat/browser_detection.d.ts +3 -1
  17. package/dist/commonjs/compat/browser_detection.js +16 -12
  18. package/dist/commonjs/compat/can_seek_directly_after_loaded_metadata.d.ts +7 -0
  19. package/dist/commonjs/compat/can_seek_directly_after_loaded_metadata.js +10 -0
  20. package/dist/commonjs/compat/change_source_buffer_type.d.ts +1 -1
  21. package/dist/commonjs/compat/eme/close_session.d.ts +1 -1
  22. package/dist/commonjs/compat/eme/close_session.js +16 -12
  23. package/dist/commonjs/compat/eme/custom_key_system_access.d.ts +1 -1
  24. package/dist/commonjs/compat/eme/custom_media_keys/ie11_media_keys.d.ts +1 -1
  25. package/dist/commonjs/compat/eme/custom_media_keys/ie11_media_keys.js +14 -9
  26. package/dist/commonjs/compat/eme/custom_media_keys/moz_media_keys_constructor.d.ts +1 -1
  27. package/dist/commonjs/compat/eme/custom_media_keys/old_webkit_media_keys.d.ts +1 -1
  28. package/dist/commonjs/compat/eme/custom_media_keys/old_webkit_media_keys.js +13 -11
  29. package/dist/commonjs/compat/eme/custom_media_keys/types.d.ts +1 -1
  30. package/dist/commonjs/compat/eme/custom_media_keys/webkit_media_keys.d.ts +1 -1
  31. package/dist/commonjs/compat/eme/custom_media_keys/webkit_media_keys.js +5 -11
  32. package/dist/commonjs/compat/eme/custom_media_keys/webkit_media_keys_constructor.d.ts +1 -1
  33. package/dist/commonjs/compat/eme/custom_media_keys/webkit_media_keys_constructor.js +2 -2
  34. package/dist/commonjs/compat/eme/eme-api-implementation.d.ts +3 -3
  35. package/dist/commonjs/compat/eme/eme-api-implementation.js +13 -9
  36. package/dist/commonjs/compat/eme/generate_key_request.d.ts +1 -1
  37. package/dist/commonjs/compat/eme/generate_key_request.js +16 -19
  38. package/dist/commonjs/compat/eme/get_init_data.js +5 -7
  39. package/dist/commonjs/compat/eme/get_uuid_kid_from_keystatus_kid.js +1 -2
  40. package/dist/commonjs/compat/eme/get_webkit_fairplay_initdata.js +10 -11
  41. package/dist/commonjs/compat/eme/load_session.d.ts +1 -1
  42. package/dist/commonjs/compat/eme/set_media_keys.d.ts +9 -0
  43. package/dist/commonjs/compat/eme/set_media_keys.js +37 -0
  44. package/dist/commonjs/compat/enable_audio_track.d.ts +1 -1
  45. package/dist/commonjs/compat/event_listeners.d.ts +4 -4
  46. package/dist/commonjs/compat/event_listeners.js +42 -33
  47. package/dist/commonjs/compat/has_webassembly.js +1 -2
  48. package/dist/commonjs/compat/has_worker_api.d.ts +9 -0
  49. package/dist/commonjs/compat/has_worker_api.js +17 -0
  50. package/dist/commonjs/compat/is_codec_supported.js +2 -1
  51. package/dist/commonjs/compat/is_vtt_cue.d.ts +1 -1
  52. package/dist/commonjs/compat/make_vtt_cue.d.ts +1 -1
  53. package/dist/commonjs/compat/may_media_element_fail_on_undecipherable_data.d.ts +16 -0
  54. package/dist/commonjs/compat/may_media_element_fail_on_undecipherable_data.js +19 -0
  55. package/dist/commonjs/compat/on_height_width_change.d.ts +2 -2
  56. package/dist/commonjs/compat/patch_webkit_source_buffer.js +29 -29
  57. package/dist/commonjs/compat/should_await_set_media_keys.d.ts +16 -0
  58. package/dist/commonjs/compat/should_await_set_media_keys.js +22 -0
  59. package/dist/commonjs/compat/should_reload_media_source_on_decipherability_update.js +1 -2
  60. package/dist/commonjs/config.d.ts +1 -1
  61. package/dist/commonjs/core/adaptive/adaptive_representation_selector.d.ts +25 -22
  62. package/dist/commonjs/core/adaptive/adaptive_representation_selector.js +47 -25
  63. package/dist/commonjs/core/adaptive/buffer_based_chooser.d.ts +1 -1
  64. package/dist/commonjs/core/adaptive/buffer_based_chooser.js +13 -11
  65. package/dist/commonjs/core/adaptive/guess_based_chooser.d.ts +6 -6
  66. package/dist/commonjs/core/adaptive/guess_based_chooser.js +7 -6
  67. package/dist/commonjs/core/adaptive/index.d.ts +2 -2
  68. package/dist/commonjs/core/adaptive/network_analyzer.d.ts +6 -6
  69. package/dist/commonjs/core/adaptive/network_analyzer.js +44 -40
  70. package/dist/commonjs/core/adaptive/utils/bandwidth_estimator.js +1 -1
  71. package/dist/commonjs/core/adaptive/utils/ewma.js +1 -2
  72. package/dist/commonjs/core/adaptive/utils/filter_by_bitrate.d.ts +2 -2
  73. package/dist/commonjs/core/adaptive/utils/filter_by_resolution.d.ts +2 -2
  74. package/dist/commonjs/core/adaptive/utils/filter_by_resolution.js +2 -4
  75. package/dist/commonjs/core/adaptive/utils/get_buffer_levels.js +7 -4
  76. package/dist/commonjs/core/adaptive/utils/last_estimate_storage.d.ts +3 -3
  77. package/dist/commonjs/core/adaptive/utils/pending_requests_store.d.ts +5 -5
  78. package/dist/commonjs/core/adaptive/utils/pending_requests_store.js +4 -3
  79. package/dist/commonjs/core/adaptive/utils/representation_score_calculator.d.ts +7 -7
  80. package/dist/commonjs/core/adaptive/utils/representation_score_calculator.js +11 -8
  81. package/dist/commonjs/core/adaptive/utils/select_optimal_representation.d.ts +4 -4
  82. package/dist/commonjs/core/adaptive/utils/select_optimal_representation.js +2 -2
  83. package/dist/commonjs/core/fetchers/cdn_prioritizer.d.ts +2 -2
  84. package/dist/commonjs/core/fetchers/cdn_prioritizer.js +5 -6
  85. package/dist/commonjs/core/fetchers/manifest/index.d.ts +1 -1
  86. package/dist/commonjs/core/fetchers/manifest/manifest_fetcher.d.ts +3 -3
  87. package/dist/commonjs/core/fetchers/manifest/manifest_fetcher.js +80 -65
  88. package/dist/commonjs/core/fetchers/segment/index.d.ts +1 -1
  89. package/dist/commonjs/core/fetchers/segment/initialization_segment_cache.d.ts +4 -4
  90. package/dist/commonjs/core/fetchers/segment/prioritized_segment_fetcher.d.ts +4 -3
  91. package/dist/commonjs/core/fetchers/segment/segment_fetcher.d.ts +12 -12
  92. package/dist/commonjs/core/fetchers/segment/segment_fetcher.js +49 -32
  93. package/dist/commonjs/core/fetchers/segment/segment_fetcher_creator.d.ts +5 -5
  94. package/dist/commonjs/core/fetchers/segment/segment_fetcher_creator.js +4 -2
  95. package/dist/commonjs/core/fetchers/segment/task_prioritizer.d.ts +1 -1
  96. package/dist/commonjs/core/fetchers/segment/task_prioritizer.js +18 -17
  97. package/dist/commonjs/core/fetchers/utils/error_selector.d.ts +1 -2
  98. package/dist/commonjs/core/fetchers/utils/error_selector.js +0 -1
  99. package/dist/commonjs/core/fetchers/utils/schedule_request.d.ts +3 -3
  100. package/dist/commonjs/core/fetchers/utils/schedule_request.js +20 -21
  101. package/dist/commonjs/core/main/common/DecipherabilityFreezeDetector.d.ts +79 -0
  102. package/dist/commonjs/core/main/common/DecipherabilityFreezeDetector.js +127 -0
  103. package/dist/commonjs/core/main/common/content_time_boundaries_observer.d.ts +191 -0
  104. package/dist/commonjs/core/main/common/content_time_boundaries_observer.js +519 -0
  105. package/dist/commonjs/core/main/common/create_content_time_boundaries_observer.d.ts +27 -0
  106. package/dist/commonjs/core/main/common/create_content_time_boundaries_observer.js +48 -0
  107. package/dist/commonjs/core/main/common/get_buffered_data_per_media_buffer.d.ts +14 -0
  108. package/dist/commonjs/core/main/common/get_buffered_data_per_media_buffer.js +37 -0
  109. package/dist/commonjs/core/main/worker/content_preparer.d.ts +93 -0
  110. package/dist/commonjs/core/main/worker/content_preparer.js +273 -0
  111. package/dist/commonjs/core/main/worker/globals.d.ts +13 -0
  112. package/dist/commonjs/core/main/worker/globals.js +26 -0
  113. package/dist/commonjs/core/main/worker/index.d.ts +2 -0
  114. package/dist/commonjs/core/main/worker/index.js +4 -0
  115. package/dist/commonjs/core/main/worker/send_message.d.ts +3 -0
  116. package/dist/commonjs/core/main/worker/send_message.js +25 -0
  117. package/dist/commonjs/core/main/worker/track_choice_setter.d.ts +19 -0
  118. package/dist/commonjs/core/main/worker/track_choice_setter.js +140 -0
  119. package/dist/commonjs/core/main/worker/worker_main.d.ts +1 -0
  120. package/dist/commonjs/core/main/worker/worker_main.js +784 -0
  121. package/dist/commonjs/core/main/worker/worker_text_displayer_interface.d.ts +64 -0
  122. package/dist/commonjs/core/main/worker/worker_text_displayer_interface.js +126 -0
  123. package/dist/commonjs/core/segment_sinks/garbage_collector.d.ts +43 -0
  124. package/dist/commonjs/core/segment_sinks/garbage_collector.js +226 -0
  125. package/dist/commonjs/core/segment_sinks/implementations/audio_video/audio_video_segment_buffer.d.ts +135 -0
  126. package/dist/commonjs/core/segment_sinks/implementations/audio_video/audio_video_segment_buffer.js +358 -0
  127. package/dist/commonjs/core/segment_sinks/implementations/audio_video/index.d.ts +17 -0
  128. package/dist/commonjs/core/segment_sinks/implementations/index.d.ts +19 -0
  129. package/dist/commonjs/core/segment_sinks/implementations/index.js +35 -0
  130. package/dist/commonjs/core/segment_sinks/implementations/text/index.d.ts +3 -0
  131. package/dist/commonjs/core/segment_sinks/implementations/text/text_segment_buffer.d.ts +90 -0
  132. package/dist/commonjs/core/segment_sinks/implementations/text/text_segment_buffer.js +257 -0
  133. package/dist/commonjs/core/segment_sinks/implementations/types.d.ts +307 -0
  134. package/dist/commonjs/core/segment_sinks/implementations/types.js +117 -0
  135. package/dist/commonjs/core/segment_sinks/index.d.ts +21 -0
  136. package/dist/commonjs/core/segment_sinks/index.js +28 -0
  137. package/dist/commonjs/core/segment_sinks/inventory/buffered_history.d.ts +89 -0
  138. package/dist/commonjs/core/segment_sinks/inventory/index.d.ts +21 -0
  139. package/dist/commonjs/core/segment_sinks/inventory/segment_inventory.d.ts +238 -0
  140. package/dist/commonjs/core/segment_sinks/inventory/segment_inventory.js +917 -0
  141. package/dist/commonjs/core/segment_sinks/inventory/types.d.ts +27 -0
  142. package/dist/commonjs/core/segment_sinks/inventory/utils.d.ts +33 -0
  143. package/dist/commonjs/core/segment_sinks/inventory/utils.js +53 -0
  144. package/dist/commonjs/core/segment_sinks/segment_buffers_store.d.ts +171 -0
  145. package/dist/commonjs/core/segment_sinks/segment_buffers_store.js +288 -0
  146. package/dist/commonjs/core/stream/adaptation/adaptation_stream.d.ts +4 -4
  147. package/dist/commonjs/core/stream/adaptation/adaptation_stream.js +52 -24
  148. package/dist/commonjs/core/stream/adaptation/get_representations_switch_strategy.d.ts +11 -11
  149. package/dist/commonjs/core/stream/adaptation/get_representations_switch_strategy.js +32 -33
  150. package/dist/commonjs/core/stream/adaptation/types.d.ts +18 -18
  151. package/dist/commonjs/core/stream/index.d.ts +1 -1
  152. package/dist/commonjs/core/stream/orchestrator/get_time_ranges_for_content.d.ts +5 -5
  153. package/dist/commonjs/core/stream/orchestrator/get_time_ranges_for_content.js +5 -5
  154. package/dist/commonjs/core/stream/orchestrator/stream_orchestrator.d.ts +20 -19
  155. package/dist/commonjs/core/stream/orchestrator/stream_orchestrator.js +76 -52
  156. package/dist/commonjs/core/stream/period/period_stream.d.ts +5 -5
  157. package/dist/commonjs/core/stream/period/period_stream.js +85 -47
  158. package/dist/commonjs/core/stream/period/types.d.ts +23 -21
  159. package/dist/commonjs/core/stream/period/utils/get_adaptation_switch_strategy.d.ts +13 -13
  160. package/dist/commonjs/core/stream/period/utils/get_adaptation_switch_strategy.js +34 -38
  161. package/dist/commonjs/core/stream/representation/representation_stream.d.ts +5 -5
  162. package/dist/commonjs/core/stream/representation/representation_stream.js +58 -32
  163. package/dist/commonjs/core/stream/representation/types.d.ts +24 -24
  164. package/dist/commonjs/core/stream/representation/utils/append_segment_to_buffer.d.ts +9 -9
  165. package/dist/commonjs/core/stream/representation/utils/append_segment_to_buffer.js +12 -13
  166. package/dist/commonjs/core/stream/representation/utils/check_for_discontinuity.d.ts +7 -7
  167. package/dist/commonjs/core/stream/representation/utils/check_for_discontinuity.js +16 -18
  168. package/dist/commonjs/core/stream/representation/utils/downloading_queue.d.ts +10 -10
  169. package/dist/commonjs/core/stream/representation/utils/downloading_queue.js +11 -11
  170. package/dist/commonjs/core/stream/representation/utils/get_buffer_status.d.ts +11 -11
  171. package/dist/commonjs/core/stream/representation/utils/get_buffer_status.js +50 -29
  172. package/dist/commonjs/core/stream/representation/utils/get_needed_segments.d.ts +6 -7
  173. package/dist/commonjs/core/stream/representation/utils/get_needed_segments.js +29 -30
  174. package/dist/commonjs/core/stream/representation/utils/push_init_segment.d.ts +13 -13
  175. package/dist/commonjs/core/stream/representation/utils/push_init_segment.js +10 -8
  176. package/dist/commonjs/core/stream/representation/utils/push_media_segment.d.ts +14 -14
  177. package/dist/commonjs/core/stream/representation/utils/push_media_segment.js +16 -13
  178. package/dist/commonjs/core/types.d.ts +8 -0
  179. package/dist/commonjs/default_config.js +21 -18
  180. package/dist/commonjs/errors/encrypted_media_error.d.ts +2 -2
  181. package/dist/commonjs/errors/encrypted_media_error.js +4 -2
  182. package/dist/commonjs/errors/error_codes.d.ts +3 -3
  183. package/dist/commonjs/errors/error_codes.js +1 -0
  184. package/dist/commonjs/errors/format_error.d.ts +2 -2
  185. package/dist/commonjs/errors/format_error.js +1 -2
  186. package/dist/commonjs/errors/is_known_error.d.ts +1 -1
  187. package/dist/commonjs/errors/is_known_error.js +2 -2
  188. package/dist/commonjs/errors/media_error.d.ts +2 -2
  189. package/dist/commonjs/errors/media_error.js +4 -2
  190. package/dist/commonjs/errors/network_error.d.ts +2 -2
  191. package/dist/commonjs/errors/network_error.js +6 -4
  192. package/dist/commonjs/errors/other_error.d.ts +1 -1
  193. package/dist/commonjs/errors/other_error.js +1 -3
  194. package/dist/commonjs/errors/source_buffer_error.js +4 -2
  195. package/dist/commonjs/experimental/features/local.d.ts +1 -1
  196. package/dist/commonjs/experimental/features/local.js +1 -2
  197. package/dist/commonjs/experimental/features/metaplaylist.d.ts +1 -1
  198. package/dist/commonjs/experimental/features/metaplaylist.js +1 -2
  199. package/dist/commonjs/experimental/features/multi_thread.d.ts +1 -1
  200. package/dist/commonjs/experimental/features/multi_thread.js +1 -2
  201. package/dist/commonjs/experimental/index.d.ts +1 -1
  202. package/dist/commonjs/experimental/tools/VideoThumbnailLoader/features/dash.d.ts +1 -1
  203. package/dist/commonjs/experimental/tools/VideoThumbnailLoader/features/metaplaylist.d.ts +1 -1
  204. package/dist/commonjs/experimental/tools/VideoThumbnailLoader/index.d.ts +1 -1
  205. package/dist/commonjs/experimental/tools/VideoThumbnailLoader/load_and_push_segment.d.ts +3 -3
  206. package/dist/commonjs/experimental/tools/VideoThumbnailLoader/prepare_source_buffer.d.ts +2 -2
  207. package/dist/commonjs/experimental/tools/VideoThumbnailLoader/prepare_source_buffer.js +5 -5
  208. package/dist/commonjs/experimental/tools/VideoThumbnailLoader/remove_buffer_around_time.d.ts +1 -1
  209. package/dist/commonjs/experimental/tools/VideoThumbnailLoader/remove_buffer_around_time.js +2 -2
  210. package/dist/commonjs/experimental/tools/VideoThumbnailLoader/types.d.ts +6 -6
  211. package/dist/commonjs/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.d.ts +3 -3
  212. package/dist/commonjs/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.js +11 -18
  213. package/dist/commonjs/experimental/tools/createMetaplaylist/get_duration_from_manifest.js +13 -23
  214. package/dist/commonjs/experimental/tools/createMetaplaylist/index.d.ts +1 -1
  215. package/dist/commonjs/experimental/tools/createMetaplaylist/index.js +8 -7
  216. package/dist/commonjs/experimental/tools/index.d.ts +1 -1
  217. package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/api/index.d.ts +1 -1
  218. package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/api/index.js +9 -15
  219. package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/api/probeMediaConfiguration.d.ts +4 -3
  220. package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/api/probeMediaConfiguration.js +6 -3
  221. package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/capabilities.d.ts +1 -1
  222. package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/capabilities.js +9 -46
  223. package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/probers/DRMInfos.d.ts +2 -1
  224. package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/probers/DRMInfos.js +8 -5
  225. package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/probers/HDCPPolicy.d.ts +2 -1
  226. package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/probers/HDCPPolicy.js +21 -13
  227. package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/probers/decodingInfo.d.ts +2 -1
  228. package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/probers/decodingInfo.js +21 -17
  229. package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/probers/defaultCodecsFinder.js +12 -12
  230. package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/probers/index.d.ts +1 -1
  231. package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/probers/mediaContentType.d.ts +2 -1
  232. package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/probers/mediaContentType.js +7 -8
  233. package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/probers/mediaContentTypeWithFeatures/format.d.ts +1 -1
  234. package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/probers/mediaContentTypeWithFeatures/format.js +6 -11
  235. package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/probers/mediaContentTypeWithFeatures/index.d.ts +2 -1
  236. package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/probers/mediaContentTypeWithFeatures/index.js +1 -2
  237. package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/probers/mediaDisplayInfos.d.ts +2 -1
  238. package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/probers/mediaDisplayInfos.js +3 -3
  239. package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/types.d.ts +2 -2
  240. package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/utils.d.ts +1 -1
  241. package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/utils.js +8 -7
  242. package/dist/commonjs/features/add_features.d.ts +1 -1
  243. package/dist/commonjs/features/features_object.d.ts +1 -1
  244. package/dist/commonjs/features/features_object.js +4 -3
  245. package/dist/commonjs/features/index.d.ts +1 -1
  246. package/dist/commonjs/features/list/dash.d.ts +1 -1
  247. package/dist/commonjs/features/list/dash.js +3 -4
  248. package/dist/commonjs/features/list/dash_wasm.d.ts +2 -2
  249. package/dist/commonjs/features/list/dash_wasm.js +1 -2
  250. package/dist/commonjs/features/list/debug_element.d.ts +1 -1
  251. package/dist/commonjs/features/list/debug_element.js +1 -1
  252. package/dist/commonjs/features/list/directfile.d.ts +1 -1
  253. package/dist/commonjs/features/list/directfile.js +2 -3
  254. package/dist/commonjs/features/list/eme.d.ts +1 -1
  255. package/dist/commonjs/features/list/eme.js +1 -1
  256. package/dist/commonjs/features/list/html_sami_parser.d.ts +1 -1
  257. package/dist/commonjs/features/list/html_sami_parser.js +4 -4
  258. package/dist/commonjs/features/list/html_srt_parser.d.ts +1 -1
  259. package/dist/commonjs/features/list/html_srt_parser.js +4 -4
  260. package/dist/commonjs/features/list/html_text_buffer.d.ts +1 -1
  261. package/dist/commonjs/features/list/html_text_buffer.js +1 -1
  262. package/dist/commonjs/features/list/html_ttml_parser.d.ts +1 -1
  263. package/dist/commonjs/features/list/html_ttml_parser.js +4 -4
  264. package/dist/commonjs/features/list/html_vtt_parser.d.ts +1 -1
  265. package/dist/commonjs/features/list/html_vtt_parser.js +4 -4
  266. package/dist/commonjs/features/list/media_source_main.d.ts +1 -1
  267. package/dist/commonjs/features/list/media_source_main.js +1 -2
  268. package/dist/commonjs/features/list/native_sami_parser.d.ts +1 -1
  269. package/dist/commonjs/features/list/native_sami_parser.js +4 -4
  270. package/dist/commonjs/features/list/native_srt_parser.d.ts +1 -1
  271. package/dist/commonjs/features/list/native_srt_parser.js +4 -4
  272. package/dist/commonjs/features/list/native_text_buffer.d.ts +1 -1
  273. package/dist/commonjs/features/list/native_text_buffer.js +1 -1
  274. package/dist/commonjs/features/list/native_ttml_parser.d.ts +1 -1
  275. package/dist/commonjs/features/list/native_ttml_parser.js +4 -4
  276. package/dist/commonjs/features/list/native_vtt_parser.d.ts +1 -1
  277. package/dist/commonjs/features/list/native_vtt_parser.js +4 -4
  278. package/dist/commonjs/features/list/smooth.d.ts +1 -1
  279. package/dist/commonjs/features/list/smooth.js +1 -2
  280. package/dist/commonjs/features/types.d.ts +28 -23
  281. package/dist/commonjs/index.d.ts +1 -1
  282. package/dist/commonjs/index.js +3 -1
  283. package/dist/commonjs/main_thread/api/debug/buffer_graph.d.ts +28 -0
  284. package/dist/commonjs/main_thread/api/debug/buffer_graph.js +168 -0
  285. package/dist/commonjs/main_thread/api/debug/buffer_size_graph.js +131 -0
  286. package/dist/commonjs/main_thread/api/debug/modules/general_info.d.ts +3 -0
  287. package/dist/commonjs/main_thread/api/debug/modules/general_info.js +236 -0
  288. package/dist/commonjs/main_thread/api/debug/modules/segment_buffer_content.d.ts +4 -0
  289. package/dist/commonjs/main_thread/api/debug/modules/segment_buffer_content.js +127 -0
  290. package/dist/commonjs/main_thread/api/debug/modules/segment_buffer_size.d.ts +3 -0
  291. package/dist/commonjs/main_thread/api/debug/modules/segment_buffer_size.js +38 -0
  292. package/dist/commonjs/main_thread/api/debug/render.d.ts +3 -0
  293. package/dist/commonjs/main_thread/api/index.d.ts +17 -0
  294. package/dist/commonjs/main_thread/api/index.js +19 -0
  295. package/dist/commonjs/main_thread/api/option_utils.d.ts +124 -0
  296. package/dist/commonjs/main_thread/api/option_utils.js +335 -0
  297. package/dist/commonjs/main_thread/api/public_api.d.ts +768 -0
  298. package/dist/commonjs/main_thread/api/public_api.js +2557 -0
  299. package/dist/commonjs/main_thread/api/utils.d.ts +66 -0
  300. package/dist/commonjs/main_thread/api/utils.js +178 -0
  301. package/dist/commonjs/main_thread/decrypt/__tests__/__global__/utils.d.ts +184 -0
  302. package/dist/commonjs/main_thread/decrypt/__tests__/__global__/utils.js +439 -0
  303. package/dist/commonjs/main_thread/decrypt/attach_media_keys.d.ts +53 -0
  304. package/dist/commonjs/main_thread/decrypt/attach_media_keys.js +124 -0
  305. package/dist/commonjs/main_thread/decrypt/clear_on_stop.js +43 -0
  306. package/dist/commonjs/main_thread/decrypt/content_decryptor.d.ts +185 -0
  307. package/dist/commonjs/main_thread/decrypt/content_decryptor.js +1053 -0
  308. package/dist/commonjs/main_thread/decrypt/create_or_load_session.d.ts +64 -0
  309. package/dist/commonjs/main_thread/decrypt/create_or_load_session.js +135 -0
  310. package/dist/commonjs/main_thread/decrypt/create_session.d.ts +54 -0
  311. package/dist/commonjs/main_thread/decrypt/create_session.js +215 -0
  312. package/dist/commonjs/main_thread/decrypt/dispose_decryption_resources.js +83 -0
  313. package/dist/commonjs/main_thread/decrypt/find_key_system.d.ts +48 -0
  314. package/dist/commonjs/main_thread/decrypt/find_key_system.js +375 -0
  315. package/dist/commonjs/main_thread/decrypt/get_media_keys.d.ts +44 -0
  316. package/dist/commonjs/main_thread/decrypt/get_media_keys.js +165 -0
  317. package/dist/commonjs/main_thread/decrypt/index.d.ts +26 -0
  318. package/dist/commonjs/main_thread/decrypt/init_media_keys.d.ts +26 -0
  319. package/dist/commonjs/main_thread/decrypt/init_media_keys.js +87 -0
  320. package/dist/commonjs/main_thread/decrypt/session_events_listener.d.ts +75 -0
  321. package/dist/commonjs/main_thread/decrypt/session_events_listener.js +325 -0
  322. package/dist/commonjs/main_thread/decrypt/set_server_certificate.d.ts +51 -0
  323. package/dist/commonjs/main_thread/decrypt/set_server_certificate.js +145 -0
  324. package/dist/commonjs/main_thread/decrypt/types.d.ts +374 -0
  325. package/dist/commonjs/main_thread/decrypt/utils/are_init_values_compatible.js +144 -0
  326. package/dist/commonjs/main_thread/decrypt/utils/check_key_statuses.d.ts +52 -0
  327. package/dist/commonjs/main_thread/decrypt/utils/check_key_statuses.js +211 -0
  328. package/dist/commonjs/main_thread/decrypt/utils/clean_old_loaded_sessions.d.ts +26 -0
  329. package/dist/commonjs/main_thread/decrypt/utils/clean_old_stored_persistent_info.d.ts +32 -0
  330. package/dist/commonjs/main_thread/decrypt/utils/init_data_values_container.d.ts +69 -0
  331. package/dist/commonjs/main_thread/decrypt/utils/init_data_values_container.js +137 -0
  332. package/dist/commonjs/main_thread/decrypt/utils/is_session_usable.d.ts +24 -0
  333. package/dist/commonjs/main_thread/decrypt/utils/is_session_usable.js +51 -0
  334. package/dist/commonjs/main_thread/decrypt/utils/key_session_record.d.ts +104 -0
  335. package/dist/commonjs/main_thread/decrypt/utils/key_session_record.js +189 -0
  336. package/dist/commonjs/main_thread/decrypt/utils/loaded_sessions_store.d.ts +213 -0
  337. package/dist/commonjs/main_thread/decrypt/utils/loaded_sessions_store.js +518 -0
  338. package/dist/commonjs/main_thread/decrypt/utils/media_keys_infos_store.d.ts +56 -0
  339. package/dist/commonjs/main_thread/decrypt/utils/media_keys_infos_store.js +45 -0
  340. package/dist/commonjs/main_thread/decrypt/utils/persistent_sessions_store.d.ts +94 -0
  341. package/dist/commonjs/main_thread/decrypt/utils/persistent_sessions_store.js +356 -0
  342. package/dist/commonjs/main_thread/decrypt/utils/serializable_bytes.d.ts +44 -0
  343. package/dist/commonjs/main_thread/decrypt/utils/serializable_bytes.js +50 -0
  344. package/dist/commonjs/main_thread/decrypt/utils/server_certificate_store.d.ts +64 -0
  345. package/dist/commonjs/main_thread/decrypt/utils/server_certificate_store.js +123 -0
  346. package/dist/commonjs/main_thread/init/directfile_content_initializer.d.ts +97 -0
  347. package/dist/commonjs/main_thread/init/directfile_content_initializer.js +264 -0
  348. package/dist/commonjs/main_thread/init/media_source_content_initializer.d.ts +166 -0
  349. package/dist/commonjs/main_thread/init/media_source_content_initializer.js +918 -0
  350. package/dist/commonjs/main_thread/init/multi_thread_content_initializer.d.ts +222 -0
  351. package/dist/commonjs/main_thread/init/multi_thread_content_initializer.js +1477 -0
  352. package/dist/commonjs/main_thread/init/send_message.d.ts +2 -0
  353. package/dist/commonjs/main_thread/init/send_message.js +13 -0
  354. package/dist/commonjs/main_thread/init/types.d.ts +221 -0
  355. package/dist/commonjs/main_thread/init/utils/create_core_playback_observer.d.ts +83 -0
  356. package/dist/commonjs/main_thread/init/utils/create_core_playback_observer.js +105 -0
  357. package/dist/commonjs/main_thread/init/utils/create_media_source.d.ts +37 -0
  358. package/dist/commonjs/main_thread/init/utils/create_media_source.js +106 -0
  359. package/dist/commonjs/main_thread/init/utils/get_initial_time.d.ts +76 -0
  360. package/dist/commonjs/main_thread/init/utils/get_initial_time.js +109 -0
  361. package/dist/commonjs/main_thread/init/utils/get_loaded_reference.d.ts +28 -0
  362. package/dist/commonjs/main_thread/init/utils/get_loaded_reference.js +67 -0
  363. package/dist/commonjs/main_thread/init/utils/initial_seek_and_play.d.ts +61 -0
  364. package/dist/commonjs/main_thread/init/utils/initial_seek_and_play.js +204 -0
  365. package/dist/commonjs/main_thread/init/utils/initialize_content_decryption.d.ts +87 -0
  366. package/dist/commonjs/main_thread/init/utils/initialize_content_decryption.js +119 -0
  367. package/dist/commonjs/main_thread/init/utils/main_thread_text_displayer_interface.d.ts +35 -0
  368. package/dist/commonjs/main_thread/init/utils/rebuffering_controller.d.ts +114 -0
  369. package/dist/commonjs/main_thread/init/utils/rebuffering_controller.js +450 -0
  370. package/dist/commonjs/main_thread/init/utils/stream_events_emitter/are_same_stream_events.js +35 -0
  371. package/dist/commonjs/main_thread/init/utils/stream_events_emitter/index.d.ts +18 -0
  372. package/dist/commonjs/main_thread/init/utils/stream_events_emitter/refresh_scheduled_events_list.d.ts +25 -0
  373. package/dist/commonjs/main_thread/init/utils/stream_events_emitter/refresh_scheduled_events_list.js +98 -0
  374. package/dist/commonjs/main_thread/init/utils/stream_events_emitter/stream_events_emitter.d.ts +53 -0
  375. package/dist/commonjs/main_thread/init/utils/stream_events_emitter/stream_events_emitter.js +230 -0
  376. package/dist/commonjs/main_thread/init/utils/stream_events_emitter/types.d.ts +41 -0
  377. package/dist/commonjs/main_thread/init/utils/throw_on_media_error.d.ts +23 -0
  378. package/dist/commonjs/main_thread/init/utils/throw_on_media_error.js +66 -0
  379. package/dist/commonjs/main_thread/text_displayer/html/html_parsers.js +25 -0
  380. package/dist/commonjs/main_thread/text_displayer/html/html_text_displayer.d.ts +100 -0
  381. package/dist/commonjs/main_thread/text_displayer/html/html_text_displayer.js +318 -0
  382. package/dist/commonjs/main_thread/text_displayer/html/text_track_cues_store.d.ts +65 -0
  383. package/dist/commonjs/main_thread/text_displayer/html/text_track_cues_store.js +378 -0
  384. package/dist/commonjs/main_thread/text_displayer/html/update_proportional_elements.js +64 -0
  385. package/dist/commonjs/main_thread/text_displayer/html/utils.js +119 -0
  386. package/dist/commonjs/main_thread/text_displayer/index.d.ts +2 -0
  387. package/dist/commonjs/main_thread/text_displayer/manual_time_ranges.js +52 -0
  388. package/dist/commonjs/main_thread/text_displayer/native/native_parsers.d.ts +11 -0
  389. package/dist/commonjs/main_thread/text_displayer/native/native_parsers.js +25 -0
  390. package/dist/commonjs/main_thread/text_displayer/native/native_text_displayer.d.ts +56 -0
  391. package/dist/commonjs/main_thread/text_displayer/native/native_text_displayer.js +207 -0
  392. package/dist/commonjs/main_thread/text_displayer/types.d.ts +71 -0
  393. package/dist/commonjs/main_thread/text_displayer/types.js +2 -0
  394. package/dist/commonjs/main_thread/tracks_store/index.d.ts +20 -0
  395. package/dist/commonjs/main_thread/tracks_store/media_element_tracks_store.d.ts +197 -0
  396. package/dist/commonjs/main_thread/tracks_store/media_element_tracks_store.js +691 -0
  397. package/dist/commonjs/main_thread/tracks_store/track_dispatcher.d.ts +101 -0
  398. package/dist/commonjs/main_thread/tracks_store/track_dispatcher.js +198 -0
  399. package/dist/commonjs/main_thread/tracks_store/tracks_store.d.ts +448 -0
  400. package/dist/commonjs/main_thread/tracks_store/tracks_store.js +1096 -0
  401. package/dist/commonjs/main_thread/types.d.ts +5 -0
  402. package/dist/commonjs/main_thread/types.js +2 -0
  403. package/dist/commonjs/manifest/classes/adaptation.d.ts +134 -0
  404. package/dist/commonjs/manifest/classes/adaptation.js +237 -0
  405. package/dist/commonjs/manifest/classes/index.d.ts +25 -0
  406. package/dist/commonjs/manifest/classes/index.js +46 -0
  407. package/dist/commonjs/manifest/classes/manifest.d.ts +391 -0
  408. package/dist/commonjs/manifest/classes/manifest.js +494 -0
  409. package/dist/commonjs/manifest/classes/period.d.ts +106 -0
  410. package/dist/commonjs/manifest/classes/period.js +235 -0
  411. package/dist/commonjs/manifest/classes/representation.d.ts +238 -0
  412. package/dist/commonjs/manifest/classes/representation.js +382 -0
  413. package/dist/commonjs/manifest/classes/representation_index/index.d.ts +18 -0
  414. package/dist/commonjs/manifest/classes/representation_index/static.d.ts +101 -0
  415. package/dist/commonjs/manifest/classes/representation_index/static.js +147 -0
  416. package/dist/commonjs/manifest/classes/representation_index/types.d.ts +420 -0
  417. package/dist/commonjs/manifest/classes/types.d.ts +29 -0
  418. package/dist/commonjs/manifest/classes/types.js +33 -0
  419. package/dist/commonjs/manifest/classes/update_period_in_place.d.ts +53 -0
  420. package/dist/commonjs/manifest/classes/update_period_in_place.js +172 -0
  421. package/dist/commonjs/manifest/classes/update_periods.d.ts +50 -0
  422. package/dist/commonjs/manifest/classes/update_periods.js +229 -0
  423. package/dist/commonjs/manifest/classes/utils.d.ts +39 -0
  424. package/dist/commonjs/manifest/classes/utils.js +54 -0
  425. package/dist/commonjs/manifest/index.d.ts +15 -25
  426. package/dist/commonjs/manifest/index.js +5 -46
  427. package/dist/commonjs/manifest/types.d.ts +2 -31
  428. package/dist/commonjs/manifest/types.js +0 -16
  429. package/dist/commonjs/manifest/utils.d.ts +11 -49
  430. package/dist/commonjs/manifest/utils.js +55 -79
  431. package/dist/commonjs/minimal.d.ts +1 -1
  432. package/dist/commonjs/minimal.js +6 -1
  433. package/dist/commonjs/mse/main_codec_support_prober.d.ts +1 -1
  434. package/dist/commonjs/mse/main_media_source_interface.d.ts +2 -2
  435. package/dist/commonjs/mse/main_media_source_interface.js +59 -34
  436. package/dist/commonjs/mse/types.d.ts +3 -3
  437. package/dist/commonjs/mse/utils/end_of_stream.d.ts +33 -0
  438. package/dist/commonjs/mse/utils/end_of_stream.js +114 -0
  439. package/dist/commonjs/mse/utils/media_source_duration_updater.js +272 -0
  440. package/dist/commonjs/mse/worker_codec_support_prober.d.ts +1 -1
  441. package/dist/commonjs/mse/worker_media_source_interface.d.ts +4 -4
  442. package/dist/commonjs/mse/worker_media_source_interface.js +19 -17
  443. package/dist/commonjs/multithread_types.d.ts +15 -18
  444. package/dist/commonjs/parsers/containers/isobmff/create_box.d.ts +1 -1
  445. package/dist/commonjs/parsers/containers/isobmff/create_box.js +4 -3
  446. package/dist/commonjs/parsers/containers/isobmff/drm/playready.js +1 -2
  447. package/dist/commonjs/parsers/containers/isobmff/extract_complete_chunks.js +95 -0
  448. package/dist/commonjs/parsers/containers/isobmff/find_complete_box.js +57 -0
  449. package/dist/commonjs/parsers/containers/isobmff/get_box.js +2 -4
  450. package/dist/commonjs/parsers/containers/isobmff/index.d.ts +5 -3
  451. package/dist/commonjs/parsers/containers/isobmff/index.js +5 -1
  452. package/dist/commonjs/parsers/containers/isobmff/read.d.ts +1 -1
  453. package/dist/commonjs/parsers/containers/isobmff/read.js +7 -7
  454. package/dist/commonjs/parsers/containers/isobmff/take_pssh_out.js +3 -4
  455. package/dist/commonjs/parsers/containers/isobmff/utils.js +64 -40
  456. package/dist/commonjs/parsers/containers/matroska/index.d.ts +1 -1
  457. package/dist/commonjs/parsers/containers/matroska/utils.js +42 -29
  458. package/dist/commonjs/parsers/images/bif.js +17 -4
  459. package/dist/commonjs/parsers/manifest/dash/common/attach_trickmode_track.d.ts +1 -1
  460. package/dist/commonjs/parsers/manifest/dash/common/convert_supplemental_codecs.js +1 -3
  461. package/dist/commonjs/parsers/manifest/dash/common/flatten_overlapping_periods.d.ts +1 -1
  462. package/dist/commonjs/parsers/manifest/dash/common/flatten_overlapping_periods.js +1 -1
  463. package/dist/commonjs/parsers/manifest/dash/common/get_hdr_information.js +4 -12
  464. package/dist/commonjs/parsers/manifest/dash/common/get_http_utc-timing_url.d.ts +1 -1
  465. package/dist/commonjs/parsers/manifest/dash/common/get_http_utc-timing_url.js +4 -5
  466. package/dist/commonjs/parsers/manifest/dash/common/get_minimum_and_maximum_positions.d.ts +1 -1
  467. package/dist/commonjs/parsers/manifest/dash/common/get_minimum_and_maximum_positions.js +5 -2
  468. package/dist/commonjs/parsers/manifest/dash/common/get_periods_time_infos.d.ts +1 -1
  469. package/dist/commonjs/parsers/manifest/dash/common/get_periods_time_infos.js +14 -10
  470. package/dist/commonjs/parsers/manifest/dash/common/index.d.ts +1 -1
  471. package/dist/commonjs/parsers/manifest/dash/common/indexes/base.d.ts +5 -5
  472. package/dist/commonjs/parsers/manifest/dash/common/indexes/base.js +39 -29
  473. package/dist/commonjs/parsers/manifest/dash/common/indexes/get_init_segment.d.ts +2 -2
  474. package/dist/commonjs/parsers/manifest/dash/common/indexes/get_init_segment.js +8 -4
  475. package/dist/commonjs/parsers/manifest/dash/common/indexes/get_segments_from_timeline.d.ts +4 -4
  476. package/dist/commonjs/parsers/manifest/dash/common/indexes/get_segments_from_timeline.js +14 -10
  477. package/dist/commonjs/parsers/manifest/dash/common/indexes/list.d.ts +2 -2
  478. package/dist/commonjs/parsers/manifest/dash/common/indexes/list.js +33 -20
  479. package/dist/commonjs/parsers/manifest/dash/common/indexes/template.d.ts +3 -3
  480. package/dist/commonjs/parsers/manifest/dash/common/indexes/template.js +58 -57
  481. package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_elements.d.ts +5 -4
  482. package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_elements.js +13 -10
  483. package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_previous_timeline.d.ts +3 -2
  484. package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_previous_timeline.js +23 -18
  485. package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/convert_element_to_index_segment.d.ts +1 -1
  486. package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/convert_element_to_index_segment.js +16 -9
  487. package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/find_first_common_start_time.d.ts +4 -3
  488. package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/find_first_common_start_time.js +47 -26
  489. package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/parse_s_element.d.ts +11 -2
  490. package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/parse_s_element.js +74 -3
  491. package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.d.ts +9 -8
  492. package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.js +85 -66
  493. package/dist/commonjs/parsers/manifest/dash/common/indexes/tokens.js +2 -4
  494. package/dist/commonjs/parsers/manifest/dash/common/infer_adaptation_type.d.ts +1 -1
  495. package/dist/commonjs/parsers/manifest/dash/common/infer_adaptation_type.js +2 -2
  496. package/dist/commonjs/parsers/manifest/dash/common/manifest_bounds_calculator.js +9 -10
  497. package/dist/commonjs/parsers/manifest/dash/common/parse_adaptation_sets.d.ts +5 -5
  498. package/dist/commonjs/parsers/manifest/dash/common/parse_adaptation_sets.js +63 -56
  499. package/dist/commonjs/parsers/manifest/dash/common/parse_availability_start_time.d.ts +3 -2
  500. package/dist/commonjs/parsers/manifest/dash/common/parse_availability_start_time.js +5 -3
  501. package/dist/commonjs/parsers/manifest/dash/common/parse_mpd.d.ts +6 -6
  502. package/dist/commonjs/parsers/manifest/dash/common/parse_mpd.js +67 -41
  503. package/dist/commonjs/parsers/manifest/dash/common/parse_periods.d.ts +5 -5
  504. package/dist/commonjs/parsers/manifest/dash/common/parse_periods.js +46 -29
  505. package/dist/commonjs/parsers/manifest/dash/common/parse_representation_index.d.ts +5 -5
  506. package/dist/commonjs/parsers/manifest/dash/common/parse_representation_index.js +4 -6
  507. package/dist/commonjs/parsers/manifest/dash/common/parse_representations.d.ts +5 -5
  508. package/dist/commonjs/parsers/manifest/dash/common/parse_representations.js +66 -64
  509. package/dist/commonjs/parsers/manifest/dash/common/resolve_base_urls.d.ts +1 -1
  510. package/dist/commonjs/parsers/manifest/dash/common/resolve_base_urls.js +4 -2
  511. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/index.d.ts +17 -0
  512. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/index.js +19 -0
  513. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/AdaptationSet.d.ts +24 -0
  514. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/AdaptationSet.js +400 -0
  515. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/BaseURL.d.ts +24 -0
  516. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/BaseURL.js +33 -0
  517. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/ContentComponent.d.ts +23 -0
  518. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/ContentComponent.js +70 -0
  519. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/ContentProtection.d.ts +22 -0
  520. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/ContentProtection.js +118 -0
  521. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/EventStream.d.ts +23 -0
  522. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/EventStream.js +154 -0
  523. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/Initialization.d.ts +22 -0
  524. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/Initialization.js +70 -0
  525. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/MPD.d.ts +23 -0
  526. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/MPD.js +221 -0
  527. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/Period.d.ts +23 -0
  528. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/Period.js +179 -0
  529. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/Representation.d.ts +22 -0
  530. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/Representation.js +256 -0
  531. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentBase.d.ts +23 -0
  532. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentBase.js +152 -0
  533. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentList.d.ts +22 -0
  534. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentList.js +60 -0
  535. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentTemplate.d.ts +24 -0
  536. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentTemplate.js +125 -0
  537. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentTimeline.d.ts +22 -0
  538. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentTimeline.js +36 -0
  539. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentURL.d.ts +24 -0
  540. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentURL.js +82 -0
  541. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/utils.d.ts +176 -0
  542. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/utils.js +382 -0
  543. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/parse_from_xml_string.d.ts +24 -0
  544. package/dist/commonjs/parsers/manifest/dash/fast-js-parser/parse_from_xml_string.js +142 -0
  545. package/dist/commonjs/parsers/manifest/dash/native-parser/node_parsers/AdaptationSet.d.ts +23 -0
  546. package/dist/commonjs/parsers/manifest/dash/native-parser/node_parsers/AdaptationSet.js +374 -0
  547. package/dist/commonjs/parsers/manifest/dash/native-parser/node_parsers/BaseURL.d.ts +23 -0
  548. package/dist/commonjs/parsers/manifest/dash/native-parser/node_parsers/BaseURL.js +32 -0
  549. package/dist/commonjs/parsers/manifest/dash/native-parser/node_parsers/ContentComponent.d.ts +22 -0
  550. package/dist/commonjs/parsers/manifest/dash/native-parser/node_parsers/ContentProtection.d.ts +21 -0
  551. package/dist/commonjs/parsers/manifest/dash/native-parser/node_parsers/EventStream.d.ts +23 -0
  552. package/dist/commonjs/parsers/manifest/dash/native-parser/node_parsers/EventStream.js +119 -0
  553. package/dist/commonjs/parsers/manifest/dash/native-parser/node_parsers/Initialization.d.ts +21 -0
  554. package/dist/commonjs/parsers/manifest/dash/native-parser/node_parsers/Initialization.js +44 -0
  555. package/dist/commonjs/parsers/manifest/dash/native-parser/node_parsers/MPD.d.ts +21 -0
  556. package/dist/commonjs/parsers/manifest/dash/native-parser/node_parsers/MPD.js +181 -0
  557. package/dist/commonjs/parsers/manifest/dash/native-parser/node_parsers/Period.d.ts +21 -0
  558. package/dist/commonjs/parsers/manifest/dash/native-parser/node_parsers/Period.js +138 -0
  559. package/dist/commonjs/parsers/manifest/dash/native-parser/node_parsers/Representation.d.ts +21 -0
  560. package/dist/commonjs/parsers/manifest/dash/native-parser/node_parsers/Representation.js +230 -0
  561. package/dist/commonjs/parsers/manifest/dash/native-parser/node_parsers/SegmentBase.d.ts +22 -0
  562. package/dist/commonjs/parsers/manifest/dash/native-parser/node_parsers/SegmentBase.js +126 -0
  563. package/dist/commonjs/parsers/manifest/dash/native-parser/node_parsers/SegmentList.d.ts +21 -0
  564. package/dist/commonjs/parsers/manifest/dash/native-parser/node_parsers/SegmentTemplate.d.ts +23 -0
  565. package/dist/commonjs/parsers/manifest/dash/native-parser/node_parsers/SegmentTemplate.js +102 -0
  566. package/dist/commonjs/parsers/manifest/dash/native-parser/node_parsers/SegmentTimeline.d.ts +21 -0
  567. package/dist/commonjs/parsers/manifest/dash/native-parser/node_parsers/SegmentURL.d.ts +23 -0
  568. package/dist/commonjs/parsers/manifest/dash/native-parser/node_parsers/SegmentURL.js +56 -0
  569. package/dist/commonjs/parsers/manifest/dash/native-parser/node_parsers/utils.d.ts +169 -0
  570. package/dist/commonjs/parsers/manifest/dash/native-parser/node_parsers/utils.js +346 -0
  571. package/dist/commonjs/parsers/manifest/dash/native-parser/parse_from_document.d.ts +24 -0
  572. package/dist/commonjs/parsers/manifest/dash/native-parser/parse_from_document.js +136 -0
  573. package/dist/commonjs/parsers/manifest/dash/node_parser_types.d.ts +5 -3
  574. package/dist/commonjs/parsers/manifest/dash/parsers_types.d.ts +1 -1
  575. package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/dash-wasm-parser.d.ts +1 -1
  576. package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/dash-wasm-parser.js +31 -17
  577. package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/AdaptationSet.d.ts +3 -2
  578. package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/AdaptationSet.js +21 -25
  579. package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/BaseURL.d.ts +2 -2
  580. package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/ContentComponent.d.ts +3 -3
  581. package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/ContentComponent.js +1 -1
  582. package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/ContentProtection.d.ts +3 -3
  583. package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/ContentProtection.js +4 -2
  584. package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/EventStream.d.ts +3 -2
  585. package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/EventStream.js +2 -4
  586. package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/MPD.d.ts +3 -2
  587. package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/MPD.js +4 -4
  588. package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/Period.d.ts +3 -2
  589. package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/Period.js +9 -6
  590. package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/Representation.d.ts +3 -2
  591. package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/Representation.js +13 -15
  592. package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/Scheme.d.ts +3 -3
  593. package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/Scheme.js +1 -1
  594. package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/SegmentBase.d.ts +2 -2
  595. package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/SegmentBase.js +5 -10
  596. package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/SegmentList.d.ts +3 -2
  597. package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/SegmentTemplate.d.ts +2 -2
  598. package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/SegmentTemplate.js +11 -18
  599. package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/SegmentUrl.d.ts +2 -2
  600. package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/SegmentUrl.js +2 -4
  601. package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/XLink.d.ts +3 -2
  602. package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/XLink.js +4 -4
  603. package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/root.d.ts +2 -2
  604. package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/root.js +7 -3
  605. package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/parsers_stack.js +5 -2
  606. package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/utils.d.ts +1 -1
  607. package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/utils.js +7 -3
  608. package/dist/commonjs/parsers/manifest/local/parse_local_manifest.d.ts +2 -2
  609. package/dist/commonjs/parsers/manifest/local/parse_local_manifest.js +25 -16
  610. package/dist/commonjs/parsers/manifest/local/representation_index.d.ts +2 -2
  611. package/dist/commonjs/parsers/manifest/local/representation_index.js +8 -10
  612. package/dist/commonjs/parsers/manifest/metaplaylist/index.d.ts +1 -1
  613. package/dist/commonjs/parsers/manifest/metaplaylist/metaplaylist_parser.d.ts +4 -4
  614. package/dist/commonjs/parsers/manifest/metaplaylist/metaplaylist_parser.js +48 -43
  615. package/dist/commonjs/parsers/manifest/metaplaylist/representation_index.d.ts +3 -3
  616. package/dist/commonjs/parsers/manifest/metaplaylist/representation_index.js +10 -7
  617. package/dist/commonjs/parsers/manifest/smooth/create_parser.d.ts +2 -2
  618. package/dist/commonjs/parsers/manifest/smooth/create_parser.js +130 -108
  619. package/dist/commonjs/parsers/manifest/smooth/get_codecs.js +3 -3
  620. package/dist/commonjs/parsers/manifest/smooth/index.d.ts +1 -1
  621. package/dist/commonjs/parsers/manifest/smooth/parse_C_nodes.js +9 -9
  622. package/dist/commonjs/parsers/manifest/smooth/parse_protection_node.js +12 -8
  623. package/dist/commonjs/parsers/manifest/smooth/representation_index.d.ts +3 -3
  624. package/dist/commonjs/parsers/manifest/smooth/representation_index.js +37 -37
  625. package/dist/commonjs/parsers/manifest/smooth/shared_smooth_segment_timeline.d.ts +1 -1
  626. package/dist/commonjs/parsers/manifest/smooth/shared_smooth_segment_timeline.js +8 -9
  627. package/dist/commonjs/parsers/manifest/smooth/utils/add_segment_infos.js +10 -7
  628. package/dist/commonjs/parsers/manifest/smooth/utils/parseBoolean.d.ts +1 -1
  629. package/dist/commonjs/parsers/manifest/smooth/utils/parseBoolean.js +1 -1
  630. package/dist/commonjs/parsers/manifest/smooth/utils/tokens.d.ts +1 -1
  631. package/dist/commonjs/parsers/manifest/smooth/utils/tokens.js +1 -2
  632. package/dist/commonjs/parsers/manifest/types.d.ts +2 -2
  633. package/dist/commonjs/parsers/manifest/utils/check_manifest_ids.d.ts +1 -1
  634. package/dist/commonjs/parsers/manifest/utils/clear_timeline_from_position.d.ts +3 -2
  635. package/dist/commonjs/parsers/manifest/utils/clear_timeline_from_position.js +11 -7
  636. package/dist/commonjs/parsers/manifest/utils/get_first_time_from_adaptation.d.ts +1 -1
  637. package/dist/commonjs/parsers/manifest/utils/get_first_time_from_adaptation.js +5 -4
  638. package/dist/commonjs/parsers/manifest/utils/get_last_time_from_adaptation.d.ts +1 -1
  639. package/dist/commonjs/parsers/manifest/utils/get_last_time_from_adaptation.js +5 -4
  640. package/dist/commonjs/parsers/manifest/utils/get_maximum_positions.d.ts +2 -2
  641. package/dist/commonjs/parsers/manifest/utils/get_maximum_positions.js +11 -17
  642. package/dist/commonjs/parsers/manifest/utils/get_minimum_position.d.ts +2 -2
  643. package/dist/commonjs/parsers/manifest/utils/get_minimum_position.js +5 -11
  644. package/dist/commonjs/parsers/manifest/utils/index_helpers.js +4 -5
  645. package/dist/commonjs/parsers/manifest/utils/update_segment_timeline.d.ts +1 -1
  646. package/dist/commonjs/parsers/manifest/utils/update_segment_timeline.js +17 -17
  647. package/dist/commonjs/parsers/texttracks/index.d.ts +1 -1
  648. package/dist/commonjs/parsers/texttracks/sami/html.d.ts +1 -1
  649. package/dist/commonjs/parsers/texttracks/sami/html.js +17 -16
  650. package/dist/commonjs/parsers/texttracks/sami/native.d.ts +1 -1
  651. package/dist/commonjs/parsers/texttracks/sami/native.js +12 -18
  652. package/dist/commonjs/parsers/texttracks/srt/html.js +12 -10
  653. package/dist/commonjs/parsers/texttracks/srt/native.d.ts +1 -1
  654. package/dist/commonjs/parsers/texttracks/srt/native.js +2 -8
  655. package/dist/commonjs/parsers/texttracks/srt/parse_cue.js +4 -8
  656. package/dist/commonjs/parsers/texttracks/ttml/get_parameters.js +7 -8
  657. package/dist/commonjs/parsers/texttracks/ttml/get_time_delimiters.d.ts +1 -1
  658. package/dist/commonjs/parsers/texttracks/ttml/get_time_delimiters.js +9 -10
  659. package/dist/commonjs/parsers/texttracks/ttml/html/apply_default_ttml_paragraph_style.js +2 -2
  660. package/dist/commonjs/parsers/texttracks/ttml/html/apply_extent.js +5 -9
  661. package/dist/commonjs/parsers/texttracks/ttml/html/apply_font_size.js +6 -7
  662. package/dist/commonjs/parsers/texttracks/ttml/html/apply_line_height.js +2 -2
  663. package/dist/commonjs/parsers/texttracks/ttml/html/apply_origin.js +5 -9
  664. package/dist/commonjs/parsers/texttracks/ttml/html/apply_padding.js +7 -11
  665. package/dist/commonjs/parsers/texttracks/ttml/html/create_element.d.ts +2 -2
  666. package/dist/commonjs/parsers/texttracks/ttml/html/create_element.js +29 -22
  667. package/dist/commonjs/parsers/texttracks/ttml/html/generate_css_test_outline.js +2 -2
  668. package/dist/commonjs/parsers/texttracks/ttml/html/parse_cue.d.ts +1 -1
  669. package/dist/commonjs/parsers/texttracks/ttml/html/parse_cue.js +5 -3
  670. package/dist/commonjs/parsers/texttracks/ttml/html/parse_ttml_to_div.d.ts +1 -1
  671. package/dist/commonjs/parsers/texttracks/ttml/html/ttml_color_to_css_color.js +39 -23
  672. package/dist/commonjs/parsers/texttracks/ttml/native/parse_cue.d.ts +2 -2
  673. package/dist/commonjs/parsers/texttracks/ttml/native/parse_cue.js +14 -13
  674. package/dist/commonjs/parsers/texttracks/ttml/native/parse_ttml_to_vtt.d.ts +1 -1
  675. package/dist/commonjs/parsers/texttracks/ttml/parse_ttml.d.ts +3 -3
  676. package/dist/commonjs/parsers/texttracks/ttml/parse_ttml.js +27 -15
  677. package/dist/commonjs/parsers/texttracks/ttml/resolve_styles_inheritance.d.ts +1 -1
  678. package/dist/commonjs/parsers/texttracks/ttml/time_parsing.d.ts +1 -1
  679. package/dist/commonjs/parsers/texttracks/ttml/time_parsing.js +2 -2
  680. package/dist/commonjs/parsers/texttracks/ttml/xml_utils.js +2 -1
  681. package/dist/commonjs/parsers/texttracks/types.d.ts +1 -1
  682. package/dist/commonjs/parsers/texttracks/webvtt/get_style_blocks.js +2 -1
  683. package/dist/commonjs/parsers/texttracks/webvtt/html/convert_payload_to_html.d.ts +1 -1
  684. package/dist/commonjs/parsers/texttracks/webvtt/html/create_default_style_elements.d.ts +1 -1
  685. package/dist/commonjs/parsers/texttracks/webvtt/html/create_style_attribute.js +6 -12
  686. package/dist/commonjs/parsers/texttracks/webvtt/html/create_styled_element.d.ts +1 -1
  687. package/dist/commonjs/parsers/texttracks/webvtt/html/create_styled_element.js +7 -8
  688. package/dist/commonjs/parsers/texttracks/webvtt/html/parse_style_block.js +4 -4
  689. package/dist/commonjs/parsers/texttracks/webvtt/html/parse_webvtt_to_div.d.ts +1 -1
  690. package/dist/commonjs/parsers/texttracks/webvtt/html/parse_webvtt_to_div.js +1 -1
  691. package/dist/commonjs/parsers/texttracks/webvtt/html/to_html.d.ts +1 -1
  692. package/dist/commonjs/parsers/texttracks/webvtt/html/to_html.js +4 -10
  693. package/dist/commonjs/parsers/texttracks/webvtt/native/parse_vtt_to_cues.d.ts +1 -1
  694. package/dist/commonjs/parsers/texttracks/webvtt/native/parse_vtt_to_cues.js +5 -9
  695. package/dist/commonjs/parsers/texttracks/webvtt/native/set_settings_on_cue.d.ts +1 -1
  696. package/dist/commonjs/parsers/texttracks/webvtt/native/to_native_cue.d.ts +2 -2
  697. package/dist/commonjs/parsers/texttracks/webvtt/native/to_native_cue.js +3 -3
  698. package/dist/commonjs/parsers/texttracks/webvtt/parse_cue_block.js +9 -5
  699. package/dist/commonjs/parsers/texttracks/webvtt/parse_timestamp.js +1 -2
  700. package/dist/commonjs/parsers/texttracks/webvtt/utils.js +6 -6
  701. package/dist/commonjs/playback_observer/index.d.ts +6 -0
  702. package/dist/commonjs/playback_observer/index.js +5 -0
  703. package/dist/commonjs/playback_observer/media_element_playback_observer.d.ts +203 -0
  704. package/dist/commonjs/playback_observer/media_element_playback_observer.js +685 -0
  705. package/dist/commonjs/playback_observer/types.d.ts +223 -0
  706. package/dist/commonjs/playback_observer/types.js +2 -0
  707. package/dist/commonjs/playback_observer/utils/generate_read_only_observer.d.ts +11 -0
  708. package/dist/commonjs/playback_observer/utils/generate_read_only_observer.js +44 -0
  709. package/dist/commonjs/playback_observer/utils/observation_position.d.ts +87 -0
  710. package/dist/commonjs/playback_observer/utils/observation_position.js +88 -0
  711. package/dist/commonjs/playback_observer/worker_playback_observer.d.ts +72 -0
  712. package/dist/commonjs/playback_observer/worker_playback_observer.js +49 -0
  713. package/dist/commonjs/public_types.d.ts +13 -16
  714. package/dist/commonjs/public_types.js +0 -1
  715. package/dist/commonjs/tools/TextTrackRenderer/text_track_renderer.d.ts +2 -2
  716. package/dist/commonjs/tools/TextTrackRenderer/text_track_renderer.js +10 -7
  717. package/dist/commonjs/tools/index.d.ts +1 -1
  718. package/dist/commonjs/tools/parseBIFThumbnails/index.js +5 -4
  719. package/dist/commonjs/transports/dash/add_segment_integrity_checks_to_loader.d.ts +1 -1
  720. package/dist/commonjs/transports/dash/add_segment_integrity_checks_to_loader.js +2 -3
  721. package/dist/commonjs/transports/dash/construct_segment_url.d.ts +2 -2
  722. package/dist/commonjs/transports/dash/construct_segment_url.js +7 -3
  723. package/dist/commonjs/transports/dash/get_events_out_of_emsgs.d.ts +2 -2
  724. package/dist/commonjs/transports/dash/get_events_out_of_emsgs.js +12 -10
  725. package/dist/commonjs/transports/dash/init_segment_loader.d.ts +3 -3
  726. package/dist/commonjs/transports/dash/init_segment_loader.js +46 -22
  727. package/dist/commonjs/transports/dash/low_latency_segment_loader.d.ts +2 -2
  728. package/dist/commonjs/transports/dash/low_latency_segment_loader.js +18 -11
  729. package/dist/commonjs/transports/dash/manifest_parser.d.ts +2 -2
  730. package/dist/commonjs/transports/dash/manifest_parser.js +69 -28
  731. package/dist/commonjs/transports/dash/pipelines.d.ts +1 -1
  732. package/dist/commonjs/transports/dash/pipelines.js +15 -12
  733. package/dist/commonjs/transports/dash/segment_loader.d.ts +4 -4
  734. package/dist/commonjs/transports/dash/segment_loader.js +35 -21
  735. package/dist/commonjs/transports/dash/segment_parser.d.ts +2 -2
  736. package/dist/commonjs/transports/dash/segment_parser.js +54 -22
  737. package/dist/commonjs/transports/dash/text_loader.d.ts +2 -2
  738. package/dist/commonjs/transports/dash/text_loader.js +21 -18
  739. package/dist/commonjs/transports/dash/text_parser.d.ts +2 -2
  740. package/dist/commonjs/transports/dash/text_parser.js +49 -23
  741. package/dist/commonjs/transports/index.d.ts +1 -1
  742. package/dist/commonjs/transports/index.js +0 -15
  743. package/dist/commonjs/transports/local/pipelines.d.ts +1 -1
  744. package/dist/commonjs/transports/local/pipelines.js +15 -10
  745. package/dist/commonjs/transports/local/segment_loader.d.ts +3 -3
  746. package/dist/commonjs/transports/local/segment_loader.js +14 -6
  747. package/dist/commonjs/transports/local/segment_parser.d.ts +1 -1
  748. package/dist/commonjs/transports/local/segment_parser.js +30 -12
  749. package/dist/commonjs/transports/local/text_parser.d.ts +1 -1
  750. package/dist/commonjs/transports/local/text_parser.js +48 -18
  751. package/dist/commonjs/transports/metaplaylist/manifest_loader.d.ts +4 -4
  752. package/dist/commonjs/transports/metaplaylist/manifest_loader.js +9 -5
  753. package/dist/commonjs/transports/metaplaylist/pipelines.d.ts +1 -1
  754. package/dist/commonjs/transports/metaplaylist/pipelines.js +38 -22
  755. package/dist/commonjs/transports/smooth/extract_timings_infos.d.ts +2 -2
  756. package/dist/commonjs/transports/smooth/extract_timings_infos.js +14 -13
  757. package/dist/commonjs/transports/smooth/is_mp4_embedded_track.d.ts +1 -1
  758. package/dist/commonjs/transports/smooth/is_mp4_embedded_track.js +1 -1
  759. package/dist/commonjs/transports/smooth/isobmff/create_audio_init_segment.d.ts +0 -1
  760. package/dist/commonjs/transports/smooth/isobmff/create_audio_init_segment.js +3 -4
  761. package/dist/commonjs/transports/smooth/isobmff/create_boxes.js +22 -31
  762. package/dist/commonjs/transports/smooth/isobmff/create_init_segment.js +1 -1
  763. package/dist/commonjs/transports/smooth/isobmff/get_aaces_header.js +4 -16
  764. package/dist/commonjs/transports/smooth/isobmff/parse_tfrf.js +1 -1
  765. package/dist/commonjs/transports/smooth/isobmff/parse_tfxd.js +1 -1
  766. package/dist/commonjs/transports/smooth/isobmff/patch_segment.js +12 -11
  767. package/dist/commonjs/transports/smooth/pipelines.d.ts +1 -1
  768. package/dist/commonjs/transports/smooth/pipelines.js +101 -60
  769. package/dist/commonjs/transports/smooth/segment_loader.d.ts +3 -3
  770. package/dist/commonjs/transports/smooth/segment_loader.js +50 -27
  771. package/dist/commonjs/transports/smooth/utils.d.ts +4 -4
  772. package/dist/commonjs/transports/smooth/utils.js +9 -5
  773. package/dist/commonjs/transports/types.d.ts +22 -27
  774. package/dist/commonjs/transports/utils/byte_range.js +1 -2
  775. package/dist/commonjs/transports/utils/call_custom_manifest_loader.d.ts +3 -3
  776. package/dist/commonjs/transports/utils/call_custom_manifest_loader.js +10 -6
  777. package/dist/commonjs/transports/utils/check_isobmff_integrity.js +5 -5
  778. package/dist/commonjs/transports/utils/generate_manifest_loader.d.ts +3 -3
  779. package/dist/commonjs/transports/utils/generate_manifest_loader.js +18 -6
  780. package/dist/commonjs/transports/utils/get_isobmff_timing_infos.d.ts +2 -2
  781. package/dist/commonjs/transports/utils/get_isobmff_timing_infos.js +12 -11
  782. package/dist/commonjs/transports/utils/infer_segment_container.d.ts +1 -1
  783. package/dist/commonjs/transports/utils/infer_segment_container.js +1 -3
  784. package/dist/commonjs/transports/utils/parse_text_track.d.ts +4 -4
  785. package/dist/commonjs/transports/utils/parse_text_track.js +4 -7
  786. package/dist/commonjs/utils/array_includes.js +2 -6
  787. package/dist/commonjs/utils/assert.js +3 -6
  788. package/dist/commonjs/utils/base64.js +87 -29
  789. package/dist/commonjs/utils/byte_parsing.js +64 -56
  790. package/dist/commonjs/utils/cancellable_sleep.d.ts +1 -1
  791. package/dist/commonjs/utils/create_cancellable_promise.d.ts +1 -1
  792. package/dist/commonjs/utils/deep_merge.js +4 -4
  793. package/dist/commonjs/utils/event_emitter.d.ts +1 -1
  794. package/dist/commonjs/utils/event_emitter.js +1 -2
  795. package/dist/commonjs/utils/get_fuzzed_delay.js +1 -1
  796. package/dist/commonjs/utils/global_scope.d.ts +1 -1
  797. package/dist/commonjs/utils/global_scope.js +10 -3
  798. package/dist/commonjs/utils/hash_buffer.js +1 -1
  799. package/dist/commonjs/utils/languages/normalize.js +4 -2
  800. package/dist/commonjs/utils/logger.js +21 -31
  801. package/dist/commonjs/utils/monotonic_timestamp.d.ts +6 -9
  802. package/dist/commonjs/utils/monotonic_timestamp.js +15 -6
  803. package/dist/commonjs/utils/object_assign.d.ts +6 -3
  804. package/dist/commonjs/utils/object_assign.js +5 -7
  805. package/dist/commonjs/utils/object_values.d.ts +1 -1
  806. package/dist/commonjs/utils/object_values.js +2 -3
  807. package/dist/commonjs/utils/queue_microtask.js +3 -3
  808. package/dist/commonjs/utils/ranges.js +22 -29
  809. package/dist/commonjs/utils/reference.d.ts +1 -1
  810. package/dist/commonjs/utils/reference.js +1 -3
  811. package/dist/commonjs/utils/request/fetch.d.ts +1 -1
  812. package/dist/commonjs/utils/request/fetch.js +33 -22
  813. package/dist/commonjs/utils/request/request_error.js +2 -2
  814. package/dist/commonjs/utils/request/xhr.d.ts +1 -1
  815. package/dist/commonjs/utils/request/xhr.js +28 -17
  816. package/dist/commonjs/utils/retry_promise_with_backoff.d.ts +10 -1
  817. package/dist/commonjs/utils/retry_promise_with_backoff.js +18 -4
  818. package/dist/commonjs/utils/slice_uint8array.js +3 -3
  819. package/dist/commonjs/utils/starts_with.js +3 -3
  820. package/dist/commonjs/utils/string_parsing.js +16 -18
  821. package/dist/commonjs/utils/sync_or_async.js +6 -2
  822. package/dist/commonjs/utils/task_canceller.js +1 -2
  823. package/dist/commonjs/utils/wrapInPromise.d.ts +1 -1
  824. package/dist/commonjs/utils/xml-parser.d.ts +70 -0
  825. package/dist/commonjs/utils/xml-parser.js +357 -0
  826. package/dist/commonjs/worker_entry_point.js +1 -1
  827. package/dist/es2017/__GENERATED_CODE/embedded_dash_wasm.js +1 -1
  828. package/dist/es2017/__GENERATED_CODE/embedded_worker.js +1 -1
  829. package/dist/es2017/__GENERATED_CODE/embedded_worker_es5.d.ts +3 -0
  830. package/dist/es2017/__GENERATED_CODE/embedded_worker_es5.js +3 -0
  831. package/dist/es2017/__GENERATED_CODE/index.d.ts +1 -0
  832. package/dist/es2017/__GENERATED_CODE/index.js +1 -0
  833. package/dist/es2017/compat/add_class_name.js +4 -3
  834. package/dist/es2017/compat/add_text_track.d.ts +1 -1
  835. package/dist/es2017/compat/add_text_track.js +3 -2
  836. package/dist/es2017/compat/browser_compatibility_types.js +13 -7
  837. package/dist/es2017/compat/browser_detection.d.ts +3 -1
  838. package/dist/es2017/compat/browser_detection.js +15 -12
  839. package/dist/es2017/compat/can_reuse_media_keys.js +1 -1
  840. package/dist/es2017/compat/can_seek_directly_after_loaded_metadata.d.ts +7 -0
  841. package/dist/es2017/compat/can_seek_directly_after_loaded_metadata.js +8 -0
  842. package/dist/es2017/compat/change_source_buffer_type.d.ts +1 -1
  843. package/dist/es2017/compat/eme/close_session.d.ts +1 -1
  844. package/dist/es2017/compat/eme/close_session.js +17 -13
  845. package/dist/es2017/compat/eme/custom_key_system_access.d.ts +1 -1
  846. package/dist/es2017/compat/eme/custom_media_keys/ie11_media_keys.d.ts +1 -1
  847. package/dist/es2017/compat/eme/custom_media_keys/ie11_media_keys.js +14 -7
  848. package/dist/es2017/compat/eme/custom_media_keys/index.js +1 -1
  849. package/dist/es2017/compat/eme/custom_media_keys/moz_media_keys_constructor.d.ts +1 -1
  850. package/dist/es2017/compat/eme/custom_media_keys/old_webkit_media_keys.d.ts +1 -1
  851. package/dist/es2017/compat/eme/custom_media_keys/old_webkit_media_keys.js +10 -10
  852. package/dist/es2017/compat/eme/custom_media_keys/types.d.ts +1 -1
  853. package/dist/es2017/compat/eme/custom_media_keys/webkit_media_keys.d.ts +1 -1
  854. package/dist/es2017/compat/eme/custom_media_keys/webkit_media_keys.js +5 -9
  855. package/dist/es2017/compat/eme/custom_media_keys/webkit_media_keys_constructor.d.ts +1 -1
  856. package/dist/es2017/compat/eme/custom_media_keys/webkit_media_keys_constructor.js +3 -3
  857. package/dist/es2017/compat/eme/eme-api-implementation.d.ts +3 -3
  858. package/dist/es2017/compat/eme/eme-api-implementation.js +13 -12
  859. package/dist/es2017/compat/eme/generate_key_request.d.ts +1 -1
  860. package/dist/es2017/compat/eme/generate_key_request.js +17 -20
  861. package/dist/es2017/compat/eme/get_init_data.js +5 -7
  862. package/dist/es2017/compat/eme/get_uuid_kid_from_keystatus_kid.js +2 -3
  863. package/dist/es2017/compat/eme/get_webkit_fairplay_initdata.js +12 -13
  864. package/dist/es2017/compat/eme/load_session.d.ts +1 -1
  865. package/dist/es2017/compat/eme/set_media_keys.d.ts +9 -0
  866. package/dist/es2017/compat/eme/set_media_keys.js +33 -0
  867. package/dist/es2017/compat/enable_audio_track.d.ts +1 -1
  868. package/dist/es2017/compat/event_listeners.d.ts +4 -4
  869. package/dist/es2017/compat/event_listeners.js +39 -36
  870. package/dist/es2017/compat/has_webassembly.js +1 -2
  871. package/dist/es2017/compat/has_worker_api.d.ts +9 -0
  872. package/dist/es2017/compat/has_worker_api.js +14 -0
  873. package/dist/es2017/compat/is_codec_supported.js +2 -1
  874. package/dist/es2017/compat/is_vtt_cue.d.ts +1 -1
  875. package/dist/es2017/compat/make_vtt_cue.d.ts +1 -1
  876. package/dist/es2017/compat/may_media_element_fail_on_undecipherable_data.d.ts +16 -0
  877. package/dist/es2017/compat/may_media_element_fail_on_undecipherable_data.js +17 -0
  878. package/dist/es2017/compat/on_height_width_change.d.ts +2 -2
  879. package/dist/es2017/compat/on_height_width_change.js +1 -1
  880. package/dist/es2017/compat/patch_webkit_source_buffer.js +28 -28
  881. package/dist/es2017/compat/should_await_set_media_keys.d.ts +16 -0
  882. package/dist/es2017/compat/should_await_set_media_keys.js +19 -0
  883. package/dist/es2017/compat/should_favour_custom_safari_EME.js +2 -2
  884. package/dist/es2017/compat/should_reload_media_source_on_decipherability_update.js +1 -2
  885. package/dist/es2017/config.d.ts +1 -1
  886. package/dist/es2017/core/adaptive/adaptive_representation_selector.d.ts +25 -22
  887. package/dist/es2017/core/adaptive/adaptive_representation_selector.js +40 -28
  888. package/dist/es2017/core/adaptive/buffer_based_chooser.d.ts +1 -1
  889. package/dist/es2017/core/adaptive/buffer_based_chooser.js +14 -12
  890. package/dist/es2017/core/adaptive/guess_based_chooser.d.ts +6 -6
  891. package/dist/es2017/core/adaptive/guess_based_chooser.js +8 -7
  892. package/dist/es2017/core/adaptive/index.d.ts +2 -2
  893. package/dist/es2017/core/adaptive/network_analyzer.d.ts +6 -6
  894. package/dist/es2017/core/adaptive/network_analyzer.js +45 -41
  895. package/dist/es2017/core/adaptive/utils/bandwidth_estimator.js +1 -1
  896. package/dist/es2017/core/adaptive/utils/ewma.js +1 -2
  897. package/dist/es2017/core/adaptive/utils/filter_by_bitrate.d.ts +2 -2
  898. package/dist/es2017/core/adaptive/utils/filter_by_resolution.d.ts +2 -2
  899. package/dist/es2017/core/adaptive/utils/filter_by_resolution.js +2 -4
  900. package/dist/es2017/core/adaptive/utils/get_buffer_levels.js +8 -5
  901. package/dist/es2017/core/adaptive/utils/last_estimate_storage.d.ts +3 -3
  902. package/dist/es2017/core/adaptive/utils/pending_requests_store.d.ts +5 -5
  903. package/dist/es2017/core/adaptive/utils/pending_requests_store.js +5 -6
  904. package/dist/es2017/core/adaptive/utils/representation_score_calculator.d.ts +7 -7
  905. package/dist/es2017/core/adaptive/utils/representation_score_calculator.js +10 -8
  906. package/dist/es2017/core/adaptive/utils/select_optimal_representation.d.ts +4 -4
  907. package/dist/es2017/core/adaptive/utils/select_optimal_representation.js +2 -2
  908. package/dist/es2017/core/fetchers/cdn_prioritizer.d.ts +2 -2
  909. package/dist/es2017/core/fetchers/cdn_prioritizer.js +5 -6
  910. package/dist/es2017/core/fetchers/manifest/index.d.ts +1 -1
  911. package/dist/es2017/core/fetchers/manifest/manifest_fetcher.d.ts +3 -3
  912. package/dist/es2017/core/fetchers/manifest/manifest_fetcher.js +76 -76
  913. package/dist/es2017/core/fetchers/segment/index.d.ts +1 -1
  914. package/dist/es2017/core/fetchers/segment/initialization_segment_cache.d.ts +4 -4
  915. package/dist/es2017/core/fetchers/segment/initialization_segment_cache.js +1 -1
  916. package/dist/es2017/core/fetchers/segment/prioritized_segment_fetcher.d.ts +4 -3
  917. package/dist/es2017/core/fetchers/segment/segment_fetcher.d.ts +12 -12
  918. package/dist/es2017/core/fetchers/segment/segment_fetcher.js +52 -37
  919. package/dist/es2017/core/fetchers/segment/segment_fetcher_creator.d.ts +5 -5
  920. package/dist/es2017/core/fetchers/segment/segment_fetcher_creator.js +5 -3
  921. package/dist/es2017/core/fetchers/segment/task_prioritizer.d.ts +1 -1
  922. package/dist/es2017/core/fetchers/segment/task_prioritizer.js +22 -21
  923. package/dist/es2017/core/fetchers/utils/error_selector.d.ts +1 -2
  924. package/dist/es2017/core/fetchers/utils/error_selector.js +1 -2
  925. package/dist/es2017/core/fetchers/utils/schedule_request.d.ts +3 -3
  926. package/dist/es2017/core/fetchers/utils/schedule_request.js +22 -23
  927. package/dist/es2017/core/main/common/DecipherabilityFreezeDetector.d.ts +79 -0
  928. package/dist/es2017/core/main/common/DecipherabilityFreezeDetector.js +91 -0
  929. package/dist/es2017/core/main/common/content_time_boundaries_observer.d.ts +191 -0
  930. package/dist/es2017/core/main/common/content_time_boundaries_observer.js +467 -0
  931. package/dist/es2017/core/main/common/create_content_time_boundaries_observer.d.ts +27 -0
  932. package/dist/es2017/core/main/common/create_content_time_boundaries_observer.js +41 -0
  933. package/dist/es2017/core/main/common/get_buffered_data_per_media_buffer.d.ts +14 -0
  934. package/dist/es2017/core/main/common/get_buffered_data_per_media_buffer.js +34 -0
  935. package/dist/es2017/core/main/worker/content_preparer.d.ts +93 -0
  936. package/dist/es2017/core/main/worker/content_preparer.js +239 -0
  937. package/dist/es2017/core/main/worker/globals.d.ts +13 -0
  938. package/dist/es2017/core/main/worker/globals.js +18 -0
  939. package/dist/es2017/core/main/worker/index.d.ts +2 -0
  940. package/dist/es2017/core/main/worker/index.js +2 -0
  941. package/dist/es2017/core/main/worker/send_message.d.ts +3 -0
  942. package/dist/es2017/core/main/worker/send_message.js +20 -0
  943. package/dist/es2017/core/main/worker/track_choice_setter.d.ts +19 -0
  944. package/dist/es2017/core/main/worker/track_choice_setter.js +114 -0
  945. package/dist/es2017/core/main/worker/worker_main.d.ts +1 -0
  946. package/dist/es2017/core/main/worker/worker_main.js +699 -0
  947. package/dist/es2017/core/main/worker/worker_text_displayer_interface.d.ts +64 -0
  948. package/dist/es2017/core/main/worker/worker_text_displayer_interface.js +120 -0
  949. package/dist/es2017/core/segment_sinks/garbage_collector.d.ts +43 -0
  950. package/dist/es2017/core/segment_sinks/garbage_collector.js +143 -0
  951. package/dist/es2017/core/segment_sinks/implementations/audio_video/audio_video_segment_buffer.d.ts +135 -0
  952. package/dist/es2017/core/segment_sinks/implementations/audio_video/audio_video_segment_buffer.js +265 -0
  953. package/dist/es2017/core/segment_sinks/implementations/audio_video/index.d.ts +17 -0
  954. package/dist/es2017/core/segment_sinks/implementations/audio_video/index.js +17 -0
  955. package/dist/es2017/core/segment_sinks/implementations/index.d.ts +19 -0
  956. package/dist/es2017/core/segment_sinks/implementations/index.js +18 -0
  957. package/dist/es2017/core/segment_sinks/implementations/text/index.d.ts +3 -0
  958. package/dist/es2017/core/segment_sinks/implementations/text/index.js +2 -0
  959. package/dist/es2017/core/segment_sinks/implementations/text/text_segment_buffer.d.ts +90 -0
  960. package/dist/es2017/core/segment_sinks/implementations/text/text_segment_buffer.js +156 -0
  961. package/dist/es2017/core/segment_sinks/implementations/types.d.ts +307 -0
  962. package/dist/es2017/core/segment_sinks/implementations/types.js +112 -0
  963. package/dist/es2017/core/segment_sinks/implementations/utils/manual_time_ranges.js +63 -0
  964. package/dist/es2017/core/segment_sinks/index.d.ts +21 -0
  965. package/dist/es2017/core/segment_sinks/index.js +21 -0
  966. package/dist/es2017/core/segment_sinks/inventory/buffered_history.d.ts +89 -0
  967. package/dist/es2017/core/segment_sinks/inventory/buffered_history.js +88 -0
  968. package/dist/es2017/core/segment_sinks/inventory/index.d.ts +21 -0
  969. package/dist/es2017/core/segment_sinks/inventory/index.js +18 -0
  970. package/dist/es2017/core/segment_sinks/inventory/segment_inventory.d.ts +238 -0
  971. package/dist/es2017/core/segment_sinks/inventory/segment_inventory.js +868 -0
  972. package/dist/es2017/core/segment_sinks/inventory/types.d.ts +27 -0
  973. package/dist/es2017/core/segment_sinks/inventory/utils.d.ts +33 -0
  974. package/dist/es2017/core/segment_sinks/inventory/utils.js +48 -0
  975. package/dist/es2017/core/segment_sinks/segment_buffers_store.d.ts +171 -0
  976. package/dist/es2017/core/segment_sinks/segment_buffers_store.js +281 -0
  977. package/dist/es2017/core/stream/adaptation/adaptation_stream.d.ts +4 -4
  978. package/dist/es2017/core/stream/adaptation/adaptation_stream.js +43 -32
  979. package/dist/es2017/core/stream/adaptation/get_representations_switch_strategy.d.ts +11 -11
  980. package/dist/es2017/core/stream/adaptation/get_representations_switch_strategy.js +31 -32
  981. package/dist/es2017/core/stream/adaptation/types.d.ts +18 -18
  982. package/dist/es2017/core/stream/index.d.ts +1 -1
  983. package/dist/es2017/core/stream/orchestrator/get_time_ranges_for_content.d.ts +5 -5
  984. package/dist/es2017/core/stream/orchestrator/get_time_ranges_for_content.js +6 -6
  985. package/dist/es2017/core/stream/orchestrator/stream_orchestrator.d.ts +20 -19
  986. package/dist/es2017/core/stream/orchestrator/stream_orchestrator.js +68 -57
  987. package/dist/es2017/core/stream/period/period_stream.d.ts +5 -5
  988. package/dist/es2017/core/stream/period/period_stream.js +78 -58
  989. package/dist/es2017/core/stream/period/types.d.ts +23 -21
  990. package/dist/es2017/core/stream/period/utils/get_adaptation_switch_strategy.d.ts +13 -13
  991. package/dist/es2017/core/stream/period/utils/get_adaptation_switch_strategy.js +34 -38
  992. package/dist/es2017/core/stream/representation/representation_stream.d.ts +5 -5
  993. package/dist/es2017/core/stream/representation/representation_stream.js +48 -35
  994. package/dist/es2017/core/stream/representation/types.d.ts +24 -24
  995. package/dist/es2017/core/stream/representation/utils/append_segment_to_buffer.d.ts +9 -9
  996. package/dist/es2017/core/stream/representation/utils/append_segment_to_buffer.js +13 -14
  997. package/dist/es2017/core/stream/representation/utils/check_for_discontinuity.d.ts +7 -7
  998. package/dist/es2017/core/stream/representation/utils/check_for_discontinuity.js +16 -18
  999. package/dist/es2017/core/stream/representation/utils/downloading_queue.d.ts +10 -10
  1000. package/dist/es2017/core/stream/representation/utils/downloading_queue.js +11 -11
  1001. package/dist/es2017/core/stream/representation/utils/get_buffer_status.d.ts +11 -11
  1002. package/dist/es2017/core/stream/representation/utils/get_buffer_status.js +40 -31
  1003. package/dist/es2017/core/stream/representation/utils/get_needed_segments.d.ts +6 -7
  1004. package/dist/es2017/core/stream/representation/utils/get_needed_segments.js +26 -31
  1005. package/dist/es2017/core/stream/representation/utils/push_init_segment.d.ts +13 -13
  1006. package/dist/es2017/core/stream/representation/utils/push_init_segment.js +8 -9
  1007. package/dist/es2017/core/stream/representation/utils/push_media_segment.d.ts +14 -14
  1008. package/dist/es2017/core/stream/representation/utils/push_media_segment.js +14 -15
  1009. package/dist/es2017/core/types.d.ts +8 -0
  1010. package/dist/es2017/default_config.js +21 -18
  1011. package/dist/es2017/errors/encrypted_media_error.d.ts +2 -2
  1012. package/dist/es2017/errors/encrypted_media_error.js +5 -3
  1013. package/dist/es2017/errors/error_codes.d.ts +3 -3
  1014. package/dist/es2017/errors/error_codes.js +2 -1
  1015. package/dist/es2017/errors/format_error.d.ts +2 -2
  1016. package/dist/es2017/errors/format_error.js +2 -3
  1017. package/dist/es2017/errors/is_known_error.d.ts +1 -1
  1018. package/dist/es2017/errors/is_known_error.js +2 -2
  1019. package/dist/es2017/errors/media_error.d.ts +2 -2
  1020. package/dist/es2017/errors/media_error.js +5 -3
  1021. package/dist/es2017/errors/network_error.d.ts +2 -2
  1022. package/dist/es2017/errors/network_error.js +7 -5
  1023. package/dist/es2017/errors/other_error.d.ts +1 -1
  1024. package/dist/es2017/errors/other_error.js +2 -4
  1025. package/dist/es2017/errors/source_buffer_error.js +4 -2
  1026. package/dist/es2017/experimental/features/local.d.ts +1 -1
  1027. package/dist/es2017/experimental/features/local.js +1 -2
  1028. package/dist/es2017/experimental/features/metaplaylist.d.ts +1 -1
  1029. package/dist/es2017/experimental/features/metaplaylist.js +1 -2
  1030. package/dist/es2017/experimental/features/multi_thread.d.ts +1 -1
  1031. package/dist/es2017/experimental/features/multi_thread.js +1 -2
  1032. package/dist/es2017/experimental/index.d.ts +1 -1
  1033. package/dist/es2017/experimental/index.js +1 -1
  1034. package/dist/es2017/experimental/tools/VideoThumbnailLoader/features/dash.d.ts +1 -1
  1035. package/dist/es2017/experimental/tools/VideoThumbnailLoader/features/metaplaylist.d.ts +1 -1
  1036. package/dist/es2017/experimental/tools/VideoThumbnailLoader/index.d.ts +1 -1
  1037. package/dist/es2017/experimental/tools/VideoThumbnailLoader/index.js +2 -2
  1038. package/dist/es2017/experimental/tools/VideoThumbnailLoader/load_and_push_segment.d.ts +3 -3
  1039. package/dist/es2017/experimental/tools/VideoThumbnailLoader/prepare_source_buffer.d.ts +2 -2
  1040. package/dist/es2017/experimental/tools/VideoThumbnailLoader/prepare_source_buffer.js +5 -5
  1041. package/dist/es2017/experimental/tools/VideoThumbnailLoader/remove_buffer_around_time.d.ts +1 -1
  1042. package/dist/es2017/experimental/tools/VideoThumbnailLoader/remove_buffer_around_time.js +2 -2
  1043. package/dist/es2017/experimental/tools/VideoThumbnailLoader/types.d.ts +6 -6
  1044. package/dist/es2017/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.d.ts +3 -3
  1045. package/dist/es2017/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.js +14 -22
  1046. package/dist/es2017/experimental/tools/createMetaplaylist/get_duration_from_manifest.js +13 -23
  1047. package/dist/es2017/experimental/tools/createMetaplaylist/index.d.ts +1 -1
  1048. package/dist/es2017/experimental/tools/createMetaplaylist/index.js +8 -14
  1049. package/dist/es2017/experimental/tools/index.d.ts +1 -1
  1050. package/dist/es2017/experimental/tools/index.js +1 -1
  1051. package/dist/es2017/experimental/tools/mediaCapabilitiesProber/api/index.d.ts +1 -1
  1052. package/dist/es2017/experimental/tools/mediaCapabilitiesProber/api/index.js +9 -13
  1053. package/dist/es2017/experimental/tools/mediaCapabilitiesProber/api/probeMediaConfiguration.d.ts +4 -3
  1054. package/dist/es2017/experimental/tools/mediaCapabilitiesProber/api/probeMediaConfiguration.js +7 -4
  1055. package/dist/es2017/experimental/tools/mediaCapabilitiesProber/capabilities.d.ts +1 -1
  1056. package/dist/es2017/experimental/tools/mediaCapabilitiesProber/capabilities.js +10 -47
  1057. package/dist/es2017/experimental/tools/mediaCapabilitiesProber/probers/DRMInfos.d.ts +2 -1
  1058. package/dist/es2017/experimental/tools/mediaCapabilitiesProber/probers/DRMInfos.js +9 -6
  1059. package/dist/es2017/experimental/tools/mediaCapabilitiesProber/probers/HDCPPolicy.d.ts +2 -1
  1060. package/dist/es2017/experimental/tools/mediaCapabilitiesProber/probers/HDCPPolicy.js +22 -14
  1061. package/dist/es2017/experimental/tools/mediaCapabilitiesProber/probers/decodingInfo.d.ts +2 -1
  1062. package/dist/es2017/experimental/tools/mediaCapabilitiesProber/probers/decodingInfo.js +22 -18
  1063. package/dist/es2017/experimental/tools/mediaCapabilitiesProber/probers/defaultCodecsFinder.js +10 -10
  1064. package/dist/es2017/experimental/tools/mediaCapabilitiesProber/probers/index.d.ts +1 -1
  1065. package/dist/es2017/experimental/tools/mediaCapabilitiesProber/probers/mediaContentType.d.ts +2 -1
  1066. package/dist/es2017/experimental/tools/mediaCapabilitiesProber/probers/mediaContentType.js +6 -7
  1067. package/dist/es2017/experimental/tools/mediaCapabilitiesProber/probers/mediaContentTypeWithFeatures/format.d.ts +1 -1
  1068. package/dist/es2017/experimental/tools/mediaCapabilitiesProber/probers/mediaContentTypeWithFeatures/format.js +6 -11
  1069. package/dist/es2017/experimental/tools/mediaCapabilitiesProber/probers/mediaContentTypeWithFeatures/index.d.ts +2 -1
  1070. package/dist/es2017/experimental/tools/mediaCapabilitiesProber/probers/mediaContentTypeWithFeatures/index.js +2 -3
  1071. package/dist/es2017/experimental/tools/mediaCapabilitiesProber/probers/mediaDisplayInfos.d.ts +2 -1
  1072. package/dist/es2017/experimental/tools/mediaCapabilitiesProber/probers/mediaDisplayInfos.js +4 -4
  1073. package/dist/es2017/experimental/tools/mediaCapabilitiesProber/types.d.ts +2 -2
  1074. package/dist/es2017/experimental/tools/mediaCapabilitiesProber/utils.d.ts +1 -1
  1075. package/dist/es2017/experimental/tools/mediaCapabilitiesProber/utils.js +8 -7
  1076. package/dist/es2017/features/add_features.d.ts +1 -1
  1077. package/dist/es2017/features/features_object.d.ts +1 -1
  1078. package/dist/es2017/features/features_object.js +4 -3
  1079. package/dist/es2017/features/index.d.ts +1 -1
  1080. package/dist/es2017/features/index.js +1 -1
  1081. package/dist/es2017/features/list/dash.d.ts +1 -1
  1082. package/dist/es2017/features/list/dash.js +3 -4
  1083. package/dist/es2017/features/list/dash_wasm.d.ts +2 -2
  1084. package/dist/es2017/features/list/dash_wasm.js +1 -2
  1085. package/dist/es2017/features/list/debug_element.d.ts +1 -1
  1086. package/dist/es2017/features/list/debug_element.js +1 -1
  1087. package/dist/es2017/features/list/directfile.d.ts +1 -1
  1088. package/dist/es2017/features/list/directfile.js +3 -5
  1089. package/dist/es2017/features/list/eme.d.ts +1 -1
  1090. package/dist/es2017/features/list/eme.js +1 -1
  1091. package/dist/es2017/features/list/html_sami_parser.d.ts +1 -1
  1092. package/dist/es2017/features/list/html_sami_parser.js +1 -1
  1093. package/dist/es2017/features/list/html_srt_parser.d.ts +1 -1
  1094. package/dist/es2017/features/list/html_srt_parser.js +1 -1
  1095. package/dist/es2017/features/list/html_text_buffer.d.ts +1 -1
  1096. package/dist/es2017/features/list/html_text_buffer.js +1 -1
  1097. package/dist/es2017/features/list/html_ttml_parser.d.ts +1 -1
  1098. package/dist/es2017/features/list/html_ttml_parser.js +1 -1
  1099. package/dist/es2017/features/list/html_vtt_parser.d.ts +1 -1
  1100. package/dist/es2017/features/list/html_vtt_parser.js +1 -1
  1101. package/dist/es2017/features/list/media_source_main.d.ts +1 -1
  1102. package/dist/es2017/features/list/media_source_main.js +1 -2
  1103. package/dist/es2017/features/list/native_sami_parser.d.ts +1 -1
  1104. package/dist/es2017/features/list/native_sami_parser.js +1 -1
  1105. package/dist/es2017/features/list/native_srt_parser.d.ts +1 -1
  1106. package/dist/es2017/features/list/native_srt_parser.js +1 -1
  1107. package/dist/es2017/features/list/native_text_buffer.d.ts +1 -1
  1108. package/dist/es2017/features/list/native_text_buffer.js +1 -1
  1109. package/dist/es2017/features/list/native_ttml_parser.d.ts +1 -1
  1110. package/dist/es2017/features/list/native_ttml_parser.js +1 -1
  1111. package/dist/es2017/features/list/native_vtt_parser.d.ts +1 -1
  1112. package/dist/es2017/features/list/native_vtt_parser.js +1 -1
  1113. package/dist/es2017/features/list/smooth.d.ts +1 -1
  1114. package/dist/es2017/features/list/smooth.js +1 -2
  1115. package/dist/es2017/features/types.d.ts +28 -23
  1116. package/dist/es2017/index.d.ts +1 -1
  1117. package/dist/es2017/index.js +3 -1
  1118. package/dist/es2017/main_thread/api/debug/buffer_graph.d.ts +28 -0
  1119. package/dist/es2017/main_thread/api/debug/buffer_graph.js +164 -0
  1120. package/dist/es2017/main_thread/api/debug/buffer_size_graph.js +102 -0
  1121. package/dist/es2017/main_thread/api/debug/modules/general_info.d.ts +3 -0
  1122. package/dist/es2017/main_thread/api/debug/modules/general_info.js +192 -0
  1123. package/dist/es2017/main_thread/api/debug/modules/segment_buffer_content.d.ts +4 -0
  1124. package/dist/es2017/main_thread/api/debug/modules/segment_buffer_content.js +124 -0
  1125. package/dist/es2017/main_thread/api/debug/modules/segment_buffer_size.d.ts +3 -0
  1126. package/dist/es2017/main_thread/api/debug/modules/segment_buffer_size.js +35 -0
  1127. package/dist/es2017/main_thread/api/debug/render.d.ts +3 -0
  1128. package/dist/es2017/main_thread/api/debug/render.js +32 -0
  1129. package/dist/es2017/main_thread/api/debug/utils.js +54 -0
  1130. package/dist/es2017/main_thread/api/index.d.ts +17 -0
  1131. package/dist/es2017/main_thread/api/index.js +17 -0
  1132. package/dist/es2017/main_thread/api/option_utils.d.ts +124 -0
  1133. package/dist/es2017/main_thread/api/option_utils.js +308 -0
  1134. package/dist/es2017/main_thread/api/public_api.d.ts +768 -0
  1135. package/dist/es2017/main_thread/api/public_api.js +2386 -0
  1136. package/dist/es2017/main_thread/api/utils.d.ts +66 -0
  1137. package/dist/es2017/main_thread/api/utils.js +170 -0
  1138. package/dist/es2017/main_thread/decrypt/__tests__/__global__/utils.d.ts +184 -0
  1139. package/dist/es2017/main_thread/decrypt/__tests__/__global__/utils.js +378 -0
  1140. package/dist/es2017/main_thread/decrypt/attach_media_keys.d.ts +53 -0
  1141. package/dist/es2017/main_thread/decrypt/attach_media_keys.js +72 -0
  1142. package/dist/es2017/main_thread/decrypt/clear_on_stop.js +40 -0
  1143. package/dist/es2017/main_thread/decrypt/content_decryptor.d.ts +185 -0
  1144. package/dist/es2017/main_thread/decrypt/content_decryptor.js +799 -0
  1145. package/dist/es2017/main_thread/decrypt/create_or_load_session.d.ts +64 -0
  1146. package/dist/es2017/main_thread/decrypt/create_or_load_session.js +83 -0
  1147. package/dist/es2017/main_thread/decrypt/create_session.d.ts +54 -0
  1148. package/dist/es2017/main_thread/decrypt/create_session.js +150 -0
  1149. package/dist/es2017/main_thread/decrypt/dispose_decryption_resources.js +34 -0
  1150. package/dist/es2017/main_thread/decrypt/find_key_system.d.ts +48 -0
  1151. package/dist/es2017/main_thread/decrypt/find_key_system.js +287 -0
  1152. package/dist/es2017/main_thread/decrypt/get_media_keys.d.ts +44 -0
  1153. package/dist/es2017/main_thread/decrypt/get_media_keys.js +103 -0
  1154. package/dist/es2017/main_thread/decrypt/index.d.ts +26 -0
  1155. package/dist/es2017/main_thread/decrypt/index.js +26 -0
  1156. package/dist/es2017/main_thread/decrypt/init_media_keys.d.ts +26 -0
  1157. package/dist/es2017/main_thread/decrypt/init_media_keys.js +37 -0
  1158. package/dist/es2017/main_thread/decrypt/session_events_listener.d.ts +75 -0
  1159. package/dist/es2017/main_thread/decrypt/session_events_listener.js +246 -0
  1160. package/dist/es2017/main_thread/decrypt/set_server_certificate.d.ts +51 -0
  1161. package/dist/es2017/main_thread/decrypt/set_server_certificate.js +82 -0
  1162. package/dist/es2017/main_thread/decrypt/types.d.ts +374 -0
  1163. package/dist/es2017/main_thread/decrypt/utils/are_init_values_compatible.js +141 -0
  1164. package/dist/es2017/main_thread/decrypt/utils/check_key_statuses.d.ts +52 -0
  1165. package/dist/es2017/main_thread/decrypt/utils/check_key_statuses.js +163 -0
  1166. package/dist/es2017/main_thread/decrypt/utils/clean_old_loaded_sessions.d.ts +26 -0
  1167. package/dist/es2017/main_thread/decrypt/utils/clean_old_stored_persistent_info.d.ts +32 -0
  1168. package/dist/es2017/main_thread/decrypt/utils/init_data_values_container.d.ts +69 -0
  1169. package/dist/es2017/main_thread/decrypt/utils/init_data_values_container.js +105 -0
  1170. package/dist/es2017/main_thread/decrypt/utils/is_session_usable.d.ts +24 -0
  1171. package/dist/es2017/main_thread/decrypt/utils/is_session_usable.js +48 -0
  1172. package/dist/es2017/main_thread/decrypt/utils/key_id_comparison.js +48 -0
  1173. package/dist/es2017/main_thread/decrypt/utils/key_session_record.d.ts +104 -0
  1174. package/dist/es2017/main_thread/decrypt/utils/key_session_record.js +152 -0
  1175. package/dist/es2017/main_thread/decrypt/utils/loaded_sessions_store.d.ts +213 -0
  1176. package/dist/es2017/main_thread/decrypt/utils/loaded_sessions_store.js +365 -0
  1177. package/dist/es2017/main_thread/decrypt/utils/media_keys_infos_store.d.ts +56 -0
  1178. package/dist/es2017/main_thread/decrypt/utils/media_keys_infos_store.js +43 -0
  1179. package/dist/es2017/main_thread/decrypt/utils/persistent_sessions_store.d.ts +94 -0
  1180. package/dist/es2017/main_thread/decrypt/utils/persistent_sessions_store.js +325 -0
  1181. package/dist/es2017/main_thread/decrypt/utils/serializable_bytes.d.ts +44 -0
  1182. package/dist/es2017/main_thread/decrypt/utils/serializable_bytes.js +46 -0
  1183. package/dist/es2017/main_thread/decrypt/utils/server_certificate_store.d.ts +64 -0
  1184. package/dist/es2017/main_thread/decrypt/utils/server_certificate_store.js +121 -0
  1185. package/dist/es2017/main_thread/init/directfile_content_initializer.d.ts +97 -0
  1186. package/dist/es2017/main_thread/init/directfile_content_initializer.js +233 -0
  1187. package/dist/es2017/main_thread/init/media_source_content_initializer.d.ts +166 -0
  1188. package/dist/es2017/main_thread/init/media_source_content_initializer.js +712 -0
  1189. package/dist/es2017/main_thread/init/multi_thread_content_initializer.d.ts +222 -0
  1190. package/dist/es2017/main_thread/init/multi_thread_content_initializer.js +1394 -0
  1191. package/dist/es2017/main_thread/init/send_message.d.ts +2 -0
  1192. package/dist/es2017/main_thread/init/send_message.js +10 -0
  1193. package/dist/es2017/main_thread/init/types.d.ts +221 -0
  1194. package/dist/es2017/main_thread/init/utils/create_core_playback_observer.d.ts +83 -0
  1195. package/dist/es2017/main_thread/init/utils/create_core_playback_observer.js +98 -0
  1196. package/dist/es2017/main_thread/init/utils/create_media_source.d.ts +37 -0
  1197. package/dist/es2017/main_thread/init/utils/create_media_source.js +101 -0
  1198. package/dist/es2017/main_thread/init/utils/get_initial_time.d.ts +76 -0
  1199. package/dist/es2017/main_thread/init/utils/get_initial_time.js +106 -0
  1200. package/dist/es2017/main_thread/init/utils/get_loaded_reference.d.ts +28 -0
  1201. package/dist/es2017/main_thread/init/utils/get_loaded_reference.js +64 -0
  1202. package/dist/es2017/main_thread/init/utils/initial_seek_and_play.d.ts +61 -0
  1203. package/dist/es2017/main_thread/init/utils/initial_seek_and_play.js +200 -0
  1204. package/dist/es2017/main_thread/init/utils/initialize_content_decryption.d.ts +87 -0
  1205. package/dist/es2017/main_thread/init/utils/initialize_content_decryption.js +116 -0
  1206. package/dist/es2017/main_thread/init/utils/main_thread_text_displayer_interface.d.ts +35 -0
  1207. package/dist/es2017/main_thread/init/utils/rebuffering_controller.d.ts +114 -0
  1208. package/dist/es2017/main_thread/init/utils/rebuffering_controller.js +426 -0
  1209. package/dist/es2017/main_thread/init/utils/stream_events_emitter/are_same_stream_events.js +33 -0
  1210. package/dist/es2017/main_thread/init/utils/stream_events_emitter/index.d.ts +18 -0
  1211. package/dist/es2017/main_thread/init/utils/stream_events_emitter/refresh_scheduled_events_list.d.ts +25 -0
  1212. package/dist/es2017/main_thread/init/utils/stream_events_emitter/refresh_scheduled_events_list.js +84 -0
  1213. package/dist/es2017/main_thread/init/utils/stream_events_emitter/stream_events_emitter.d.ts +53 -0
  1214. package/dist/es2017/main_thread/init/utils/stream_events_emitter/stream_events_emitter.js +175 -0
  1215. package/dist/es2017/main_thread/init/utils/stream_events_emitter/types.d.ts +41 -0
  1216. package/dist/es2017/main_thread/init/utils/throw_on_media_error.d.ts +23 -0
  1217. package/dist/es2017/main_thread/init/utils/throw_on_media_error.js +63 -0
  1218. package/dist/es2017/main_thread/text_displayer/html/html_parsers.js +22 -0
  1219. package/dist/es2017/main_thread/text_displayer/html/html_text_displayer.d.ts +100 -0
  1220. package/dist/es2017/main_thread/text_displayer/html/html_text_displayer.js +312 -0
  1221. package/dist/es2017/main_thread/text_displayer/html/text_track_cues_store.d.ts +65 -0
  1222. package/dist/es2017/main_thread/text_displayer/html/text_track_cues_store.js +358 -0
  1223. package/dist/es2017/main_thread/text_displayer/html/update_proportional_elements.js +61 -0
  1224. package/dist/es2017/main_thread/text_displayer/html/utils.js +111 -0
  1225. package/dist/es2017/main_thread/text_displayer/index.d.ts +2 -0
  1226. package/dist/es2017/main_thread/text_displayer/manual_time_ranges.js +48 -0
  1227. package/dist/es2017/main_thread/text_displayer/native/native_parsers.d.ts +11 -0
  1228. package/dist/es2017/main_thread/text_displayer/native/native_parsers.js +22 -0
  1229. package/dist/es2017/main_thread/text_displayer/native/native_text_displayer.d.ts +56 -0
  1230. package/dist/es2017/main_thread/text_displayer/native/native_text_displayer.js +203 -0
  1231. package/dist/es2017/main_thread/text_displayer/types.d.ts +71 -0
  1232. package/dist/es2017/main_thread/text_displayer/types.js +1 -0
  1233. package/dist/es2017/main_thread/tracks_store/index.d.ts +20 -0
  1234. package/dist/es2017/main_thread/tracks_store/media_element_tracks_store.d.ts +197 -0
  1235. package/dist/es2017/main_thread/tracks_store/media_element_tracks_store.js +663 -0
  1236. package/dist/es2017/main_thread/tracks_store/track_dispatcher.d.ts +101 -0
  1237. package/dist/es2017/main_thread/tracks_store/track_dispatcher.js +175 -0
  1238. package/dist/es2017/main_thread/tracks_store/tracks_store.d.ts +448 -0
  1239. package/dist/es2017/main_thread/tracks_store/tracks_store.js +998 -0
  1240. package/dist/es2017/main_thread/types.d.ts +5 -0
  1241. package/dist/es2017/main_thread/types.js +1 -0
  1242. package/dist/es2017/manifest/classes/adaptation.d.ts +134 -0
  1243. package/dist/es2017/manifest/classes/adaptation.js +193 -0
  1244. package/dist/es2017/manifest/classes/index.d.ts +25 -0
  1245. package/dist/es2017/manifest/classes/index.js +28 -0
  1246. package/dist/es2017/manifest/classes/manifest.d.ts +391 -0
  1247. package/dist/es2017/manifest/classes/manifest.js +381 -0
  1248. package/dist/es2017/manifest/classes/period.d.ts +106 -0
  1249. package/dist/es2017/manifest/classes/period.js +194 -0
  1250. package/dist/es2017/manifest/classes/representation.d.ts +238 -0
  1251. package/dist/es2017/manifest/classes/representation.js +346 -0
  1252. package/dist/es2017/manifest/classes/representation_index/index.d.ts +18 -0
  1253. package/dist/es2017/manifest/classes/representation_index/static.d.ts +101 -0
  1254. package/dist/es2017/manifest/classes/representation_index/static.js +143 -0
  1255. package/dist/es2017/manifest/classes/representation_index/types.d.ts +420 -0
  1256. package/dist/es2017/manifest/classes/types.d.ts +29 -0
  1257. package/dist/es2017/manifest/classes/types.js +30 -0
  1258. package/dist/es2017/manifest/classes/update_period_in_place.d.ts +53 -0
  1259. package/dist/es2017/manifest/classes/update_period_in_place.js +109 -0
  1260. package/dist/es2017/manifest/classes/update_periods.d.ts +50 -0
  1261. package/dist/es2017/manifest/classes/update_periods.js +193 -0
  1262. package/dist/es2017/manifest/classes/utils.d.ts +39 -0
  1263. package/dist/es2017/manifest/classes/utils.js +49 -0
  1264. package/dist/es2017/manifest/index.d.ts +15 -25
  1265. package/dist/es2017/manifest/index.js +3 -28
  1266. package/dist/es2017/manifest/types.d.ts +2 -31
  1267. package/dist/es2017/manifest/types.js +1 -15
  1268. package/dist/es2017/manifest/utils.d.ts +11 -49
  1269. package/dist/es2017/manifest/utils.js +46 -88
  1270. package/dist/es2017/minimal.d.ts +1 -1
  1271. package/dist/es2017/minimal.js +6 -1
  1272. package/dist/es2017/mse/main_codec_support_prober.d.ts +1 -1
  1273. package/dist/es2017/mse/main_media_source_interface.d.ts +2 -2
  1274. package/dist/es2017/mse/main_media_source_interface.js +61 -36
  1275. package/dist/es2017/mse/types.d.ts +3 -3
  1276. package/dist/es2017/mse/utils/end_of_stream.d.ts +33 -0
  1277. package/dist/es2017/mse/utils/end_of_stream.js +87 -0
  1278. package/dist/es2017/mse/utils/media_source_duration_updater.js +265 -0
  1279. package/dist/es2017/mse/worker_codec_support_prober.d.ts +1 -1
  1280. package/dist/es2017/mse/worker_media_source_interface.d.ts +4 -4
  1281. package/dist/es2017/mse/worker_media_source_interface.js +21 -19
  1282. package/dist/es2017/multithread_types.d.ts +15 -18
  1283. package/dist/es2017/parsers/containers/isobmff/create_box.d.ts +1 -1
  1284. package/dist/es2017/parsers/containers/isobmff/create_box.js +6 -5
  1285. package/dist/es2017/parsers/containers/isobmff/drm/playready.js +2 -3
  1286. package/dist/es2017/parsers/containers/isobmff/extract_complete_chunks.js +67 -0
  1287. package/dist/es2017/parsers/containers/isobmff/find_complete_box.js +54 -0
  1288. package/dist/es2017/parsers/containers/isobmff/get_box.js +3 -5
  1289. package/dist/es2017/parsers/containers/isobmff/index.d.ts +5 -3
  1290. package/dist/es2017/parsers/containers/isobmff/index.js +6 -4
  1291. package/dist/es2017/parsers/containers/isobmff/read.d.ts +1 -1
  1292. package/dist/es2017/parsers/containers/isobmff/read.js +9 -9
  1293. package/dist/es2017/parsers/containers/isobmff/take_pssh_out.js +4 -5
  1294. package/dist/es2017/parsers/containers/isobmff/utils.js +60 -45
  1295. package/dist/es2017/parsers/containers/matroska/index.d.ts +1 -1
  1296. package/dist/es2017/parsers/containers/matroska/index.js +1 -1
  1297. package/dist/es2017/parsers/containers/matroska/utils.js +42 -29
  1298. package/dist/es2017/parsers/images/bif.js +10 -6
  1299. package/dist/es2017/parsers/manifest/dash/common/attach_trickmode_track.d.ts +1 -1
  1300. package/dist/es2017/parsers/manifest/dash/common/convert_supplemental_codecs.js +1 -3
  1301. package/dist/es2017/parsers/manifest/dash/common/flatten_overlapping_periods.d.ts +1 -1
  1302. package/dist/es2017/parsers/manifest/dash/common/flatten_overlapping_periods.js +1 -1
  1303. package/dist/es2017/parsers/manifest/dash/common/get_hdr_information.js +4 -12
  1304. package/dist/es2017/parsers/manifest/dash/common/get_http_utc-timing_url.d.ts +1 -1
  1305. package/dist/es2017/parsers/manifest/dash/common/get_http_utc-timing_url.js +4 -5
  1306. package/dist/es2017/parsers/manifest/dash/common/get_minimum_and_maximum_positions.d.ts +1 -1
  1307. package/dist/es2017/parsers/manifest/dash/common/get_minimum_and_maximum_positions.js +4 -2
  1308. package/dist/es2017/parsers/manifest/dash/common/get_periods_time_infos.d.ts +1 -1
  1309. package/dist/es2017/parsers/manifest/dash/common/get_periods_time_infos.js +15 -13
  1310. package/dist/es2017/parsers/manifest/dash/common/index.d.ts +1 -1
  1311. package/dist/es2017/parsers/manifest/dash/common/indexes/base.d.ts +5 -5
  1312. package/dist/es2017/parsers/manifest/dash/common/indexes/base.js +36 -31
  1313. package/dist/es2017/parsers/manifest/dash/common/indexes/get_init_segment.d.ts +2 -2
  1314. package/dist/es2017/parsers/manifest/dash/common/indexes/get_init_segment.js +6 -4
  1315. package/dist/es2017/parsers/manifest/dash/common/indexes/get_segments_from_timeline.d.ts +4 -4
  1316. package/dist/es2017/parsers/manifest/dash/common/indexes/get_segments_from_timeline.js +10 -10
  1317. package/dist/es2017/parsers/manifest/dash/common/indexes/list.d.ts +2 -2
  1318. package/dist/es2017/parsers/manifest/dash/common/indexes/list.js +23 -20
  1319. package/dist/es2017/parsers/manifest/dash/common/indexes/template.d.ts +3 -3
  1320. package/dist/es2017/parsers/manifest/dash/common/indexes/template.js +54 -59
  1321. package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_elements.d.ts +5 -4
  1322. package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_elements.js +14 -11
  1323. package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_previous_timeline.d.ts +3 -2
  1324. package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_previous_timeline.js +25 -20
  1325. package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/convert_element_to_index_segment.d.ts +1 -1
  1326. package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/convert_element_to_index_segment.js +15 -10
  1327. package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/find_first_common_start_time.d.ts +4 -3
  1328. package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/find_first_common_start_time.js +43 -27
  1329. package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/parse_s_element.d.ts +11 -2
  1330. package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/parse_s_element.js +49 -2
  1331. package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.d.ts +9 -8
  1332. package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.js +77 -69
  1333. package/dist/es2017/parsers/manifest/dash/common/indexes/tokens.js +2 -4
  1334. package/dist/es2017/parsers/manifest/dash/common/infer_adaptation_type.d.ts +1 -1
  1335. package/dist/es2017/parsers/manifest/dash/common/infer_adaptation_type.js +2 -2
  1336. package/dist/es2017/parsers/manifest/dash/common/manifest_bounds_calculator.js +9 -10
  1337. package/dist/es2017/parsers/manifest/dash/common/parse_adaptation_sets.d.ts +5 -5
  1338. package/dist/es2017/parsers/manifest/dash/common/parse_adaptation_sets.js +61 -66
  1339. package/dist/es2017/parsers/manifest/dash/common/parse_availability_start_time.d.ts +3 -2
  1340. package/dist/es2017/parsers/manifest/dash/common/parse_availability_start_time.js +5 -3
  1341. package/dist/es2017/parsers/manifest/dash/common/parse_mpd.d.ts +6 -6
  1342. package/dist/es2017/parsers/manifest/dash/common/parse_mpd.js +54 -42
  1343. package/dist/es2017/parsers/manifest/dash/common/parse_periods.d.ts +5 -5
  1344. package/dist/es2017/parsers/manifest/dash/common/parse_periods.js +33 -34
  1345. package/dist/es2017/parsers/manifest/dash/common/parse_representation_index.d.ts +5 -5
  1346. package/dist/es2017/parsers/manifest/dash/common/parse_representation_index.js +5 -7
  1347. package/dist/es2017/parsers/manifest/dash/common/parse_representations.d.ts +5 -5
  1348. package/dist/es2017/parsers/manifest/dash/common/parse_representations.js +63 -68
  1349. package/dist/es2017/parsers/manifest/dash/common/resolve_base_urls.d.ts +1 -1
  1350. package/dist/es2017/parsers/manifest/dash/common/resolve_base_urls.js +5 -3
  1351. package/dist/es2017/parsers/manifest/dash/fast-js-parser/index.d.ts +17 -0
  1352. package/dist/es2017/parsers/manifest/dash/fast-js-parser/index.js +17 -0
  1353. package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/AdaptationSet.d.ts +24 -0
  1354. package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/AdaptationSet.js +358 -0
  1355. package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/BaseURL.d.ts +24 -0
  1356. package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/BaseURL.js +30 -0
  1357. package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/ContentComponent.d.ts +23 -0
  1358. package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/ContentComponent.js +45 -0
  1359. package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/ContentProtection.d.ts +22 -0
  1360. package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/ContentProtection.js +77 -0
  1361. package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/EventStream.d.ts +23 -0
  1362. package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/EventStream.js +101 -0
  1363. package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/Initialization.d.ts +22 -0
  1364. package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/Initialization.js +45 -0
  1365. package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/MPD.d.ts +23 -0
  1366. package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/MPD.js +179 -0
  1367. package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/Period.d.ts +23 -0
  1368. package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/Period.js +137 -0
  1369. package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/Representation.d.ts +22 -0
  1370. package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/Representation.js +214 -0
  1371. package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentBase.d.ts +23 -0
  1372. package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentBase.js +111 -0
  1373. package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentList.d.ts +22 -0
  1374. package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentList.js +41 -0
  1375. package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentTemplate.d.ts +24 -0
  1376. package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentTemplate.js +84 -0
  1377. package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentTimeline.d.ts +22 -0
  1378. package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentTimeline.js +33 -0
  1379. package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentURL.d.ts +24 -0
  1380. package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentURL.js +57 -0
  1381. package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/utils.d.ts +176 -0
  1382. package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/utils.js +310 -0
  1383. package/dist/es2017/parsers/manifest/dash/fast-js-parser/parse_from_xml_string.d.ts +24 -0
  1384. package/dist/es2017/parsers/manifest/dash/fast-js-parser/parse_from_xml_string.js +114 -0
  1385. package/dist/es2017/parsers/manifest/dash/native-parser/node_parsers/AdaptationSet.d.ts +23 -0
  1386. package/dist/es2017/parsers/manifest/dash/native-parser/node_parsers/AdaptationSet.js +354 -0
  1387. package/dist/es2017/parsers/manifest/dash/native-parser/node_parsers/BaseURL.d.ts +23 -0
  1388. package/dist/es2017/parsers/manifest/dash/native-parser/node_parsers/BaseURL.js +29 -0
  1389. package/dist/es2017/parsers/manifest/dash/native-parser/node_parsers/ContentComponent.d.ts +22 -0
  1390. package/dist/es2017/parsers/manifest/dash/native-parser/node_parsers/ContentProtection.d.ts +21 -0
  1391. package/dist/es2017/parsers/manifest/dash/native-parser/node_parsers/EventStream.d.ts +23 -0
  1392. package/dist/es2017/parsers/manifest/dash/native-parser/node_parsers/EventStream.js +100 -0
  1393. package/dist/es2017/parsers/manifest/dash/native-parser/node_parsers/Initialization.d.ts +21 -0
  1394. package/dist/es2017/parsers/manifest/dash/native-parser/node_parsers/Initialization.js +41 -0
  1395. package/dist/es2017/parsers/manifest/dash/native-parser/node_parsers/MPD.d.ts +21 -0
  1396. package/dist/es2017/parsers/manifest/dash/native-parser/node_parsers/MPD.js +161 -0
  1397. package/dist/es2017/parsers/manifest/dash/native-parser/node_parsers/Period.d.ts +21 -0
  1398. package/dist/es2017/parsers/manifest/dash/native-parser/node_parsers/Period.js +118 -0
  1399. package/dist/es2017/parsers/manifest/dash/native-parser/node_parsers/Representation.d.ts +21 -0
  1400. package/dist/es2017/parsers/manifest/dash/native-parser/node_parsers/Representation.js +210 -0
  1401. package/dist/es2017/parsers/manifest/dash/native-parser/node_parsers/SegmentBase.d.ts +22 -0
  1402. package/dist/es2017/parsers/manifest/dash/native-parser/node_parsers/SegmentBase.js +107 -0
  1403. package/dist/es2017/parsers/manifest/dash/native-parser/node_parsers/SegmentList.d.ts +21 -0
  1404. package/dist/es2017/parsers/manifest/dash/native-parser/node_parsers/SegmentTemplate.d.ts +23 -0
  1405. package/dist/es2017/parsers/manifest/dash/native-parser/node_parsers/SegmentTemplate.js +83 -0
  1406. package/dist/es2017/parsers/manifest/dash/native-parser/node_parsers/SegmentTimeline.d.ts +21 -0
  1407. package/dist/es2017/parsers/manifest/dash/native-parser/node_parsers/SegmentURL.d.ts +23 -0
  1408. package/dist/es2017/parsers/manifest/dash/native-parser/node_parsers/SegmentURL.js +53 -0
  1409. package/dist/es2017/parsers/manifest/dash/native-parser/node_parsers/utils.d.ts +169 -0
  1410. package/dist/es2017/parsers/manifest/dash/native-parser/node_parsers/utils.js +297 -0
  1411. package/dist/es2017/parsers/manifest/dash/native-parser/parse_from_document.d.ts +24 -0
  1412. package/dist/es2017/parsers/manifest/dash/native-parser/parse_from_document.js +108 -0
  1413. package/dist/es2017/parsers/manifest/dash/node_parser_types.d.ts +5 -3
  1414. package/dist/es2017/parsers/manifest/dash/parsers_types.d.ts +1 -1
  1415. package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/dash-wasm-parser.d.ts +1 -1
  1416. package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/dash-wasm-parser.js +29 -18
  1417. package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/AdaptationSet.d.ts +3 -2
  1418. package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/AdaptationSet.js +22 -26
  1419. package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/BaseURL.d.ts +2 -2
  1420. package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/ContentComponent.d.ts +3 -3
  1421. package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/ContentComponent.js +1 -1
  1422. package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/ContentProtection.d.ts +3 -3
  1423. package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/ContentProtection.js +4 -2
  1424. package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/EventStream.d.ts +3 -2
  1425. package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/EventStream.js +2 -4
  1426. package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/MPD.d.ts +3 -2
  1427. package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/MPD.js +5 -5
  1428. package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/Period.d.ts +3 -2
  1429. package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/Period.js +9 -6
  1430. package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/Representation.d.ts +3 -2
  1431. package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/Representation.js +13 -15
  1432. package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/Scheme.d.ts +3 -3
  1433. package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/Scheme.js +1 -1
  1434. package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/SegmentBase.d.ts +2 -2
  1435. package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/SegmentBase.js +5 -10
  1436. package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/SegmentList.d.ts +3 -2
  1437. package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/SegmentTemplate.d.ts +2 -2
  1438. package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/SegmentTemplate.js +11 -18
  1439. package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/SegmentUrl.d.ts +2 -2
  1440. package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/SegmentUrl.js +2 -4
  1441. package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/XLink.d.ts +3 -2
  1442. package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/XLink.js +5 -5
  1443. package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/root.d.ts +2 -2
  1444. package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/root.js +8 -4
  1445. package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/parsers_stack.js +4 -2
  1446. package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/utils.d.ts +1 -1
  1447. package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/utils.js +8 -4
  1448. package/dist/es2017/parsers/manifest/local/parse_local_manifest.d.ts +2 -2
  1449. package/dist/es2017/parsers/manifest/local/parse_local_manifest.js +21 -16
  1450. package/dist/es2017/parsers/manifest/local/representation_index.d.ts +2 -2
  1451. package/dist/es2017/parsers/manifest/local/representation_index.js +7 -7
  1452. package/dist/es2017/parsers/manifest/metaplaylist/index.d.ts +1 -1
  1453. package/dist/es2017/parsers/manifest/metaplaylist/metaplaylist_parser.d.ts +4 -4
  1454. package/dist/es2017/parsers/manifest/metaplaylist/metaplaylist_parser.js +41 -43
  1455. package/dist/es2017/parsers/manifest/metaplaylist/representation_index.d.ts +3 -3
  1456. package/dist/es2017/parsers/manifest/metaplaylist/representation_index.js +10 -7
  1457. package/dist/es2017/parsers/manifest/smooth/create_parser.d.ts +2 -2
  1458. package/dist/es2017/parsers/manifest/smooth/create_parser.js +120 -121
  1459. package/dist/es2017/parsers/manifest/smooth/get_codecs.js +3 -3
  1460. package/dist/es2017/parsers/manifest/smooth/index.d.ts +1 -1
  1461. package/dist/es2017/parsers/manifest/smooth/index.js +1 -1
  1462. package/dist/es2017/parsers/manifest/smooth/parse_C_nodes.js +9 -9
  1463. package/dist/es2017/parsers/manifest/smooth/parse_protection_node.js +12 -8
  1464. package/dist/es2017/parsers/manifest/smooth/representation_index.d.ts +3 -3
  1465. package/dist/es2017/parsers/manifest/smooth/representation_index.js +35 -38
  1466. package/dist/es2017/parsers/manifest/smooth/shared_smooth_segment_timeline.d.ts +1 -1
  1467. package/dist/es2017/parsers/manifest/smooth/shared_smooth_segment_timeline.js +8 -9
  1468. package/dist/es2017/parsers/manifest/smooth/utils/add_segment_infos.js +10 -7
  1469. package/dist/es2017/parsers/manifest/smooth/utils/parseBoolean.d.ts +1 -1
  1470. package/dist/es2017/parsers/manifest/smooth/utils/parseBoolean.js +1 -1
  1471. package/dist/es2017/parsers/manifest/smooth/utils/tokens.d.ts +1 -1
  1472. package/dist/es2017/parsers/manifest/smooth/utils/tokens.js +2 -3
  1473. package/dist/es2017/parsers/manifest/types.d.ts +2 -2
  1474. package/dist/es2017/parsers/manifest/utils/check_manifest_ids.d.ts +1 -1
  1475. package/dist/es2017/parsers/manifest/utils/check_manifest_ids.js +2 -2
  1476. package/dist/es2017/parsers/manifest/utils/clear_timeline_from_position.d.ts +3 -2
  1477. package/dist/es2017/parsers/manifest/utils/clear_timeline_from_position.js +11 -7
  1478. package/dist/es2017/parsers/manifest/utils/get_first_time_from_adaptation.d.ts +1 -1
  1479. package/dist/es2017/parsers/manifest/utils/get_first_time_from_adaptation.js +5 -4
  1480. package/dist/es2017/parsers/manifest/utils/get_last_time_from_adaptation.d.ts +1 -1
  1481. package/dist/es2017/parsers/manifest/utils/get_last_time_from_adaptation.js +5 -4
  1482. package/dist/es2017/parsers/manifest/utils/get_maximum_positions.d.ts +2 -2
  1483. package/dist/es2017/parsers/manifest/utils/get_maximum_positions.js +11 -17
  1484. package/dist/es2017/parsers/manifest/utils/get_minimum_position.d.ts +2 -2
  1485. package/dist/es2017/parsers/manifest/utils/get_minimum_position.js +5 -11
  1486. package/dist/es2017/parsers/manifest/utils/index_helpers.js +4 -5
  1487. package/dist/es2017/parsers/manifest/utils/update_segment_timeline.d.ts +1 -1
  1488. package/dist/es2017/parsers/manifest/utils/update_segment_timeline.js +17 -16
  1489. package/dist/es2017/parsers/texttracks/index.d.ts +1 -1
  1490. package/dist/es2017/parsers/texttracks/sami/html.d.ts +1 -1
  1491. package/dist/es2017/parsers/texttracks/sami/html.js +17 -16
  1492. package/dist/es2017/parsers/texttracks/sami/native.d.ts +1 -1
  1493. package/dist/es2017/parsers/texttracks/sami/native.js +11 -17
  1494. package/dist/es2017/parsers/texttracks/srt/html.js +12 -10
  1495. package/dist/es2017/parsers/texttracks/srt/native.d.ts +1 -1
  1496. package/dist/es2017/parsers/texttracks/srt/native.js +1 -7
  1497. package/dist/es2017/parsers/texttracks/srt/parse_cue.js +4 -9
  1498. package/dist/es2017/parsers/texttracks/ttml/get_parameters.js +8 -13
  1499. package/dist/es2017/parsers/texttracks/ttml/get_time_delimiters.d.ts +1 -1
  1500. package/dist/es2017/parsers/texttracks/ttml/get_time_delimiters.js +9 -10
  1501. package/dist/es2017/parsers/texttracks/ttml/html/apply_default_ttml_paragraph_style.js +2 -2
  1502. package/dist/es2017/parsers/texttracks/ttml/html/apply_extent.js +3 -7
  1503. package/dist/es2017/parsers/texttracks/ttml/html/apply_font_size.js +4 -5
  1504. package/dist/es2017/parsers/texttracks/ttml/html/apply_line_height.js +1 -1
  1505. package/dist/es2017/parsers/texttracks/ttml/html/apply_origin.js +3 -7
  1506. package/dist/es2017/parsers/texttracks/ttml/html/apply_padding.js +3 -7
  1507. package/dist/es2017/parsers/texttracks/ttml/html/create_element.d.ts +2 -2
  1508. package/dist/es2017/parsers/texttracks/ttml/html/create_element.js +30 -23
  1509. package/dist/es2017/parsers/texttracks/ttml/html/generate_css_test_outline.js +2 -2
  1510. package/dist/es2017/parsers/texttracks/ttml/html/parse_cue.d.ts +1 -1
  1511. package/dist/es2017/parsers/texttracks/ttml/html/parse_cue.js +5 -4
  1512. package/dist/es2017/parsers/texttracks/ttml/html/parse_ttml_to_div.d.ts +1 -1
  1513. package/dist/es2017/parsers/texttracks/ttml/html/ttml_color_to_css_color.js +39 -23
  1514. package/dist/es2017/parsers/texttracks/ttml/native/parse_cue.d.ts +2 -2
  1515. package/dist/es2017/parsers/texttracks/ttml/native/parse_cue.js +14 -13
  1516. package/dist/es2017/parsers/texttracks/ttml/native/parse_ttml_to_vtt.d.ts +1 -1
  1517. package/dist/es2017/parsers/texttracks/ttml/parse_ttml.d.ts +3 -3
  1518. package/dist/es2017/parsers/texttracks/ttml/parse_ttml.js +22 -19
  1519. package/dist/es2017/parsers/texttracks/ttml/resolve_styles_inheritance.d.ts +1 -1
  1520. package/dist/es2017/parsers/texttracks/ttml/time_parsing.d.ts +1 -1
  1521. package/dist/es2017/parsers/texttracks/ttml/time_parsing.js +2 -2
  1522. package/dist/es2017/parsers/texttracks/ttml/xml_utils.js +2 -1
  1523. package/dist/es2017/parsers/texttracks/types.d.ts +1 -1
  1524. package/dist/es2017/parsers/texttracks/webvtt/get_cue_blocks.js +1 -1
  1525. package/dist/es2017/parsers/texttracks/webvtt/get_style_blocks.js +2 -1
  1526. package/dist/es2017/parsers/texttracks/webvtt/html/convert_payload_to_html.d.ts +1 -1
  1527. package/dist/es2017/parsers/texttracks/webvtt/html/create_default_style_elements.d.ts +1 -1
  1528. package/dist/es2017/parsers/texttracks/webvtt/html/create_style_attribute.js +6 -12
  1529. package/dist/es2017/parsers/texttracks/webvtt/html/create_styled_element.d.ts +1 -1
  1530. package/dist/es2017/parsers/texttracks/webvtt/html/create_styled_element.js +8 -9
  1531. package/dist/es2017/parsers/texttracks/webvtt/html/parse_style_block.js +4 -4
  1532. package/dist/es2017/parsers/texttracks/webvtt/html/parse_webvtt_to_div.d.ts +1 -1
  1533. package/dist/es2017/parsers/texttracks/webvtt/html/parse_webvtt_to_div.js +1 -1
  1534. package/dist/es2017/parsers/texttracks/webvtt/html/to_html.d.ts +1 -1
  1535. package/dist/es2017/parsers/texttracks/webvtt/html/to_html.js +5 -13
  1536. package/dist/es2017/parsers/texttracks/webvtt/native/parse_vtt_to_cues.d.ts +1 -1
  1537. package/dist/es2017/parsers/texttracks/webvtt/native/parse_vtt_to_cues.js +4 -8
  1538. package/dist/es2017/parsers/texttracks/webvtt/native/set_settings_on_cue.d.ts +1 -1
  1539. package/dist/es2017/parsers/texttracks/webvtt/native/to_native_cue.d.ts +2 -2
  1540. package/dist/es2017/parsers/texttracks/webvtt/native/to_native_cue.js +2 -2
  1541. package/dist/es2017/parsers/texttracks/webvtt/parse_cue_block.js +7 -8
  1542. package/dist/es2017/parsers/texttracks/webvtt/parse_timestamp.js +1 -2
  1543. package/dist/es2017/parsers/texttracks/webvtt/utils.js +6 -6
  1544. package/dist/es2017/playback_observer/index.d.ts +6 -0
  1545. package/dist/es2017/playback_observer/index.js +2 -0
  1546. package/dist/es2017/playback_observer/media_element_playback_observer.d.ts +203 -0
  1547. package/dist/es2017/playback_observer/media_element_playback_observer.js +678 -0
  1548. package/dist/es2017/playback_observer/types.d.ts +223 -0
  1549. package/dist/es2017/playback_observer/types.js +1 -0
  1550. package/dist/es2017/playback_observer/utils/generate_read_only_observer.d.ts +11 -0
  1551. package/dist/es2017/playback_observer/utils/generate_read_only_observer.js +41 -0
  1552. package/dist/es2017/playback_observer/utils/observation_position.d.ts +87 -0
  1553. package/dist/es2017/playback_observer/utils/observation_position.js +84 -0
  1554. package/dist/es2017/playback_observer/worker_playback_observer.d.ts +72 -0
  1555. package/dist/es2017/playback_observer/worker_playback_observer.js +45 -0
  1556. package/dist/es2017/public_types.d.ts +13 -16
  1557. package/dist/es2017/public_types.js +0 -1
  1558. package/dist/es2017/tools/TextTrackRenderer/text_track_renderer.d.ts +2 -2
  1559. package/dist/es2017/tools/TextTrackRenderer/text_track_renderer.js +11 -9
  1560. package/dist/es2017/tools/index.d.ts +1 -1
  1561. package/dist/es2017/tools/index.js +1 -1
  1562. package/dist/es2017/tools/parseBIFThumbnails/index.js +6 -5
  1563. package/dist/es2017/transports/dash/add_segment_integrity_checks_to_loader.d.ts +1 -1
  1564. package/dist/es2017/transports/dash/add_segment_integrity_checks_to_loader.js +2 -3
  1565. package/dist/es2017/transports/dash/construct_segment_url.d.ts +2 -2
  1566. package/dist/es2017/transports/dash/construct_segment_url.js +7 -3
  1567. package/dist/es2017/transports/dash/get_events_out_of_emsgs.d.ts +2 -2
  1568. package/dist/es2017/transports/dash/get_events_out_of_emsgs.js +12 -10
  1569. package/dist/es2017/transports/dash/init_segment_loader.d.ts +3 -3
  1570. package/dist/es2017/transports/dash/init_segment_loader.js +29 -23
  1571. package/dist/es2017/transports/dash/low_latency_segment_loader.d.ts +2 -2
  1572. package/dist/es2017/transports/dash/low_latency_segment_loader.js +14 -11
  1573. package/dist/es2017/transports/dash/manifest_parser.d.ts +2 -2
  1574. package/dist/es2017/transports/dash/manifest_parser.js +68 -32
  1575. package/dist/es2017/transports/dash/pipelines.d.ts +1 -1
  1576. package/dist/es2017/transports/dash/pipelines.js +15 -12
  1577. package/dist/es2017/transports/dash/segment_loader.d.ts +4 -4
  1578. package/dist/es2017/transports/dash/segment_loader.js +31 -23
  1579. package/dist/es2017/transports/dash/segment_parser.d.ts +2 -2
  1580. package/dist/es2017/transports/dash/segment_parser.js +40 -25
  1581. package/dist/es2017/transports/dash/text_loader.d.ts +2 -2
  1582. package/dist/es2017/transports/dash/text_loader.js +19 -20
  1583. package/dist/es2017/transports/dash/text_parser.d.ts +2 -2
  1584. package/dist/es2017/transports/dash/text_parser.js +44 -26
  1585. package/dist/es2017/transports/index.d.ts +1 -1
  1586. package/dist/es2017/transports/index.js +1 -1
  1587. package/dist/es2017/transports/local/pipelines.d.ts +1 -1
  1588. package/dist/es2017/transports/local/pipelines.js +14 -9
  1589. package/dist/es2017/transports/local/segment_loader.d.ts +3 -3
  1590. package/dist/es2017/transports/local/segment_loader.js +14 -6
  1591. package/dist/es2017/transports/local/segment_parser.d.ts +1 -1
  1592. package/dist/es2017/transports/local/segment_parser.js +24 -14
  1593. package/dist/es2017/transports/local/text_parser.d.ts +1 -1
  1594. package/dist/es2017/transports/local/text_parser.js +36 -18
  1595. package/dist/es2017/transports/metaplaylist/manifest_loader.d.ts +4 -4
  1596. package/dist/es2017/transports/metaplaylist/manifest_loader.js +8 -6
  1597. package/dist/es2017/transports/metaplaylist/pipelines.d.ts +1 -1
  1598. package/dist/es2017/transports/metaplaylist/pipelines.js +35 -24
  1599. package/dist/es2017/transports/smooth/extract_timings_infos.d.ts +2 -2
  1600. package/dist/es2017/transports/smooth/extract_timings_infos.js +17 -19
  1601. package/dist/es2017/transports/smooth/is_mp4_embedded_track.d.ts +1 -1
  1602. package/dist/es2017/transports/smooth/is_mp4_embedded_track.js +1 -1
  1603. package/dist/es2017/transports/smooth/isobmff/create_audio_init_segment.d.ts +0 -1
  1604. package/dist/es2017/transports/smooth/isobmff/create_audio_init_segment.js +3 -4
  1605. package/dist/es2017/transports/smooth/isobmff/create_boxes.js +23 -32
  1606. package/dist/es2017/transports/smooth/isobmff/create_init_segment.js +2 -2
  1607. package/dist/es2017/transports/smooth/isobmff/create_traf_box.js +2 -2
  1608. package/dist/es2017/transports/smooth/isobmff/get_aaces_header.js +4 -16
  1609. package/dist/es2017/transports/smooth/isobmff/parse_tfrf.js +2 -2
  1610. package/dist/es2017/transports/smooth/isobmff/parse_tfxd.js +1 -1
  1611. package/dist/es2017/transports/smooth/isobmff/patch_segment.js +12 -11
  1612. package/dist/es2017/transports/smooth/pipelines.d.ts +1 -1
  1613. package/dist/es2017/transports/smooth/pipelines.js +84 -61
  1614. package/dist/es2017/transports/smooth/segment_loader.d.ts +3 -3
  1615. package/dist/es2017/transports/smooth/segment_loader.js +44 -29
  1616. package/dist/es2017/transports/smooth/utils.d.ts +4 -4
  1617. package/dist/es2017/transports/smooth/utils.js +10 -6
  1618. package/dist/es2017/transports/types.d.ts +22 -27
  1619. package/dist/es2017/transports/utils/byte_range.js +1 -2
  1620. package/dist/es2017/transports/utils/call_custom_manifest_loader.d.ts +3 -3
  1621. package/dist/es2017/transports/utils/call_custom_manifest_loader.js +10 -8
  1622. package/dist/es2017/transports/utils/check_isobmff_integrity.js +4 -4
  1623. package/dist/es2017/transports/utils/generate_manifest_loader.d.ts +3 -3
  1624. package/dist/es2017/transports/utils/generate_manifest_loader.js +12 -6
  1625. package/dist/es2017/transports/utils/get_isobmff_timing_infos.d.ts +2 -2
  1626. package/dist/es2017/transports/utils/get_isobmff_timing_infos.js +12 -11
  1627. package/dist/es2017/transports/utils/infer_segment_container.d.ts +1 -1
  1628. package/dist/es2017/transports/utils/infer_segment_container.js +1 -3
  1629. package/dist/es2017/transports/utils/parse_text_track.d.ts +4 -4
  1630. package/dist/es2017/transports/utils/parse_text_track.js +6 -16
  1631. package/dist/es2017/utils/array_includes.js +2 -6
  1632. package/dist/es2017/utils/assert.js +3 -6
  1633. package/dist/es2017/utils/base64.js +87 -29
  1634. package/dist/es2017/utils/byte_parsing.js +64 -56
  1635. package/dist/es2017/utils/cancellable_sleep.d.ts +1 -1
  1636. package/dist/es2017/utils/create_cancellable_promise.d.ts +1 -1
  1637. package/dist/es2017/utils/deep_merge.js +4 -4
  1638. package/dist/es2017/utils/event_emitter.d.ts +1 -1
  1639. package/dist/es2017/utils/event_emitter.js +1 -2
  1640. package/dist/es2017/utils/get_fuzzed_delay.js +1 -1
  1641. package/dist/es2017/utils/global_scope.d.ts +1 -1
  1642. package/dist/es2017/utils/global_scope.js +10 -3
  1643. package/dist/es2017/utils/hash_buffer.js +1 -1
  1644. package/dist/es2017/utils/languages/normalize.js +5 -5
  1645. package/dist/es2017/utils/logger.js +12 -22
  1646. package/dist/es2017/utils/monotonic_timestamp.d.ts +6 -9
  1647. package/dist/es2017/utils/monotonic_timestamp.js +13 -5
  1648. package/dist/es2017/utils/object_assign.d.ts +6 -3
  1649. package/dist/es2017/utils/object_assign.js +5 -7
  1650. package/dist/es2017/utils/object_values.d.ts +1 -1
  1651. package/dist/es2017/utils/object_values.js +4 -4
  1652. package/dist/es2017/utils/queue_microtask.js +3 -3
  1653. package/dist/es2017/utils/ranges.js +22 -29
  1654. package/dist/es2017/utils/reference.d.ts +1 -1
  1655. package/dist/es2017/utils/reference.js +1 -3
  1656. package/dist/es2017/utils/request/fetch.d.ts +1 -1
  1657. package/dist/es2017/utils/request/fetch.js +24 -23
  1658. package/dist/es2017/utils/request/request_error.js +2 -2
  1659. package/dist/es2017/utils/request/xhr.d.ts +1 -1
  1660. package/dist/es2017/utils/request/xhr.js +19 -17
  1661. package/dist/es2017/utils/retry_promise_with_backoff.d.ts +10 -1
  1662. package/dist/es2017/utils/retry_promise_with_backoff.js +15 -3
  1663. package/dist/es2017/utils/slice_uint8array.js +3 -3
  1664. package/dist/es2017/utils/starts_with.js +3 -3
  1665. package/dist/es2017/utils/string_parsing.js +16 -18
  1666. package/dist/es2017/utils/sync_or_async.js +6 -2
  1667. package/dist/es2017/utils/task_canceller.js +1 -2
  1668. package/dist/es2017/utils/wrapInPromise.d.ts +1 -1
  1669. package/dist/es2017/utils/xml-parser.d.ts +70 -0
  1670. package/dist/es2017/utils/xml-parser.js +322 -0
  1671. package/dist/es2017/worker_entry_point.js +2 -2
  1672. package/dist/mpd-parser.wasm +0 -0
  1673. package/dist/rx-player.js +46203 -45666
  1674. package/dist/rx-player.min.js +1 -1
  1675. package/dist/worker.es5.js +2 -0
  1676. package/dist/worker.es5.js.LICENSE.txt +1 -0
  1677. package/dist/worker.js +8 -3
  1678. package/package.json +20 -10
  1679. package/dist/commonjs/compat/index.d.ts +0 -36
  1680. package/dist/commonjs/compat/index.js +0 -64
  1681. package/dist/commonjs/core/api/debug/buffer_graph.d.ts +0 -28
  1682. package/dist/commonjs/core/api/debug/buffer_graph.js +0 -173
  1683. package/dist/commonjs/core/api/debug/buffer_size_graph.js +0 -132
  1684. package/dist/commonjs/core/api/debug/modules/general_info.d.ts +0 -3
  1685. package/dist/commonjs/core/api/debug/modules/general_info.js +0 -232
  1686. package/dist/commonjs/core/api/debug/modules/segment_buffer_content.d.ts +0 -4
  1687. package/dist/commonjs/core/api/debug/modules/segment_buffer_content.js +0 -125
  1688. package/dist/commonjs/core/api/debug/modules/segment_buffer_size.d.ts +0 -3
  1689. package/dist/commonjs/core/api/debug/modules/segment_buffer_size.js +0 -38
  1690. package/dist/commonjs/core/api/debug/render.d.ts +0 -3
  1691. package/dist/commonjs/core/api/index.d.ts +0 -20
  1692. package/dist/commonjs/core/api/index.js +0 -22
  1693. package/dist/commonjs/core/api/option_utils.d.ts +0 -124
  1694. package/dist/commonjs/core/api/option_utils.js +0 -318
  1695. package/dist/commonjs/core/api/playback_observer.d.ts +0 -521
  1696. package/dist/commonjs/core/api/playback_observer.js +0 -771
  1697. package/dist/commonjs/core/api/public_api.d.ts +0 -751
  1698. package/dist/commonjs/core/api/public_api.js +0 -2458
  1699. package/dist/commonjs/core/api/track_management/index.d.ts +0 -18
  1700. package/dist/commonjs/core/api/track_management/media_element_tracks_store.d.ts +0 -197
  1701. package/dist/commonjs/core/api/track_management/media_element_tracks_store.js +0 -688
  1702. package/dist/commonjs/core/api/track_management/track_dispatcher.d.ts +0 -100
  1703. package/dist/commonjs/core/api/track_management/track_dispatcher.js +0 -184
  1704. package/dist/commonjs/core/api/track_management/tracks_store.d.ts +0 -441
  1705. package/dist/commonjs/core/api/track_management/tracks_store.js +0 -1066
  1706. package/dist/commonjs/core/api/utils.d.ts +0 -66
  1707. package/dist/commonjs/core/api/utils.js +0 -175
  1708. package/dist/commonjs/core/decrypt/__tests__/__global__/utils.d.ts +0 -178
  1709. package/dist/commonjs/core/decrypt/__tests__/__global__/utils.js +0 -413
  1710. package/dist/commonjs/core/decrypt/attach_media_keys.d.ts +0 -53
  1711. package/dist/commonjs/core/decrypt/attach_media_keys.js +0 -121
  1712. package/dist/commonjs/core/decrypt/clear_on_stop.js +0 -43
  1713. package/dist/commonjs/core/decrypt/content_decryptor.d.ts +0 -184
  1714. package/dist/commonjs/core/decrypt/content_decryptor.js +0 -1035
  1715. package/dist/commonjs/core/decrypt/create_or_load_session.d.ts +0 -63
  1716. package/dist/commonjs/core/decrypt/create_or_load_session.js +0 -127
  1717. package/dist/commonjs/core/decrypt/create_session.d.ts +0 -53
  1718. package/dist/commonjs/core/decrypt/create_session.js +0 -215
  1719. package/dist/commonjs/core/decrypt/dispose_decryption_resources.js +0 -91
  1720. package/dist/commonjs/core/decrypt/find_key_system.d.ts +0 -48
  1721. package/dist/commonjs/core/decrypt/find_key_system.js +0 -369
  1722. package/dist/commonjs/core/decrypt/get_media_keys.d.ts +0 -44
  1723. package/dist/commonjs/core/decrypt/get_media_keys.js +0 -156
  1724. package/dist/commonjs/core/decrypt/index.d.ts +0 -26
  1725. package/dist/commonjs/core/decrypt/init_media_keys.d.ts +0 -26
  1726. package/dist/commonjs/core/decrypt/init_media_keys.js +0 -93
  1727. package/dist/commonjs/core/decrypt/session_events_listener.d.ts +0 -75
  1728. package/dist/commonjs/core/decrypt/session_events_listener.js +0 -330
  1729. package/dist/commonjs/core/decrypt/set_server_certificate.d.ts +0 -51
  1730. package/dist/commonjs/core/decrypt/set_server_certificate.js +0 -146
  1731. package/dist/commonjs/core/decrypt/types.d.ts +0 -374
  1732. package/dist/commonjs/core/decrypt/utils/are_init_values_compatible.js +0 -116
  1733. package/dist/commonjs/core/decrypt/utils/check_key_statuses.d.ts +0 -52
  1734. package/dist/commonjs/core/decrypt/utils/check_key_statuses.js +0 -211
  1735. package/dist/commonjs/core/decrypt/utils/clean_old_loaded_sessions.d.ts +0 -26
  1736. package/dist/commonjs/core/decrypt/utils/clean_old_stored_persistent_info.d.ts +0 -32
  1737. package/dist/commonjs/core/decrypt/utils/init_data_values_container.d.ts +0 -69
  1738. package/dist/commonjs/core/decrypt/utils/init_data_values_container.js +0 -126
  1739. package/dist/commonjs/core/decrypt/utils/is_session_usable.d.ts +0 -24
  1740. package/dist/commonjs/core/decrypt/utils/is_session_usable.js +0 -52
  1741. package/dist/commonjs/core/decrypt/utils/key_session_record.d.ts +0 -104
  1742. package/dist/commonjs/core/decrypt/utils/key_session_record.js +0 -190
  1743. package/dist/commonjs/core/decrypt/utils/loaded_sessions_store.d.ts +0 -215
  1744. package/dist/commonjs/core/decrypt/utils/loaded_sessions_store.js +0 -515
  1745. package/dist/commonjs/core/decrypt/utils/media_keys_infos_store.d.ts +0 -56
  1746. package/dist/commonjs/core/decrypt/utils/media_keys_infos_store.js +0 -46
  1747. package/dist/commonjs/core/decrypt/utils/persistent_sessions_store.d.ts +0 -94
  1748. package/dist/commonjs/core/decrypt/utils/persistent_sessions_store.js +0 -346
  1749. package/dist/commonjs/core/decrypt/utils/serializable_bytes.d.ts +0 -44
  1750. package/dist/commonjs/core/decrypt/utils/serializable_bytes.js +0 -50
  1751. package/dist/commonjs/core/decrypt/utils/server_certificate_store.d.ts +0 -64
  1752. package/dist/commonjs/core/decrypt/utils/server_certificate_store.js +0 -114
  1753. package/dist/commonjs/core/init/directfile_content_initializer.d.ts +0 -97
  1754. package/dist/commonjs/core/init/directfile_content_initializer.js +0 -267
  1755. package/dist/commonjs/core/init/media_source_content_initializer.d.ts +0 -165
  1756. package/dist/commonjs/core/init/media_source_content_initializer.js +0 -865
  1757. package/dist/commonjs/core/init/multithread/main_thread/multi_thread_content_initializer.d.ts +0 -167
  1758. package/dist/commonjs/core/init/multithread/main_thread/multi_thread_content_initializer.js +0 -1393
  1759. package/dist/commonjs/core/init/multithread/main_thread/send_message.d.ts +0 -2
  1760. package/dist/commonjs/core/init/multithread/main_thread/send_message.js +0 -13
  1761. package/dist/commonjs/core/init/multithread/worker/content_preparer.d.ts +0 -92
  1762. package/dist/commonjs/core/init/multithread/worker/content_preparer.js +0 -259
  1763. package/dist/commonjs/core/init/multithread/worker/globals.d.ts +0 -13
  1764. package/dist/commonjs/core/init/multithread/worker/globals.js +0 -26
  1765. package/dist/commonjs/core/init/multithread/worker/index.d.ts +0 -2
  1766. package/dist/commonjs/core/init/multithread/worker/index.js +0 -4
  1767. package/dist/commonjs/core/init/multithread/worker/send_message.d.ts +0 -3
  1768. package/dist/commonjs/core/init/multithread/worker/send_message.js +0 -25
  1769. package/dist/commonjs/core/init/multithread/worker/track_choice_setter.d.ts +0 -19
  1770. package/dist/commonjs/core/init/multithread/worker/track_choice_setter.js +0 -140
  1771. package/dist/commonjs/core/init/multithread/worker/worker_playback_observer.d.ts +0 -21
  1772. package/dist/commonjs/core/init/multithread/worker/worker_playback_observer.js +0 -47
  1773. package/dist/commonjs/core/init/multithread/worker/worker_portal.d.ts +0 -1
  1774. package/dist/commonjs/core/init/multithread/worker/worker_portal.js +0 -727
  1775. package/dist/commonjs/core/init/multithread/worker/worker_text_displayer_interface.d.ts +0 -64
  1776. package/dist/commonjs/core/init/multithread/worker/worker_text_displayer_interface.js +0 -127
  1777. package/dist/commonjs/core/init/types.d.ts +0 -226
  1778. package/dist/commonjs/core/init/utils/DecipherabilityFreezeDetector.d.ts +0 -54
  1779. package/dist/commonjs/core/init/utils/DecipherabilityFreezeDetector.js +0 -129
  1780. package/dist/commonjs/core/init/utils/content_time_boundaries_observer.d.ts +0 -192
  1781. package/dist/commonjs/core/init/utils/content_time_boundaries_observer.js +0 -518
  1782. package/dist/commonjs/core/init/utils/create_content_time_boundaries_observer.d.ts +0 -28
  1783. package/dist/commonjs/core/init/utils/create_content_time_boundaries_observer.js +0 -48
  1784. package/dist/commonjs/core/init/utils/create_core_playback_observer.d.ts +0 -61
  1785. package/dist/commonjs/core/init/utils/create_core_playback_observer.js +0 -130
  1786. package/dist/commonjs/core/init/utils/create_media_source.d.ts +0 -37
  1787. package/dist/commonjs/core/init/utils/create_media_source.js +0 -108
  1788. package/dist/commonjs/core/init/utils/end_of_stream.d.ts +0 -33
  1789. package/dist/commonjs/core/init/utils/end_of_stream.js +0 -115
  1790. package/dist/commonjs/core/init/utils/get_initial_time.d.ts +0 -76
  1791. package/dist/commonjs/core/init/utils/get_initial_time.js +0 -116
  1792. package/dist/commonjs/core/init/utils/get_loaded_reference.d.ts +0 -28
  1793. package/dist/commonjs/core/init/utils/get_loaded_reference.js +0 -61
  1794. package/dist/commonjs/core/init/utils/initial_seek_and_play.d.ts +0 -61
  1795. package/dist/commonjs/core/init/utils/initial_seek_and_play.js +0 -210
  1796. package/dist/commonjs/core/init/utils/initialize_content_decryption.d.ts +0 -86
  1797. package/dist/commonjs/core/init/utils/initialize_content_decryption.js +0 -113
  1798. package/dist/commonjs/core/init/utils/main_thread_text_displayer_interface.d.ts +0 -35
  1799. package/dist/commonjs/core/init/utils/media_source_duration_updater.js +0 -270
  1800. package/dist/commonjs/core/init/utils/rebuffering_controller.d.ts +0 -114
  1801. package/dist/commonjs/core/init/utils/rebuffering_controller.js +0 -445
  1802. package/dist/commonjs/core/init/utils/stream_events_emitter/are_same_stream_events.js +0 -37
  1803. package/dist/commonjs/core/init/utils/stream_events_emitter/index.d.ts +0 -18
  1804. package/dist/commonjs/core/init/utils/stream_events_emitter/refresh_scheduled_events_list.d.ts +0 -25
  1805. package/dist/commonjs/core/init/utils/stream_events_emitter/refresh_scheduled_events_list.js +0 -91
  1806. package/dist/commonjs/core/init/utils/stream_events_emitter/stream_events_emitter.d.ts +0 -53
  1807. package/dist/commonjs/core/init/utils/stream_events_emitter/stream_events_emitter.js +0 -234
  1808. package/dist/commonjs/core/init/utils/stream_events_emitter/types.d.ts +0 -41
  1809. package/dist/commonjs/core/init/utils/throw_on_media_error.d.ts +0 -23
  1810. package/dist/commonjs/core/init/utils/throw_on_media_error.js +0 -61
  1811. package/dist/commonjs/core/segment_buffers/garbage_collector.d.ts +0 -43
  1812. package/dist/commonjs/core/segment_buffers/garbage_collector.js +0 -220
  1813. package/dist/commonjs/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.d.ts +0 -134
  1814. package/dist/commonjs/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.js +0 -350
  1815. package/dist/commonjs/core/segment_buffers/implementations/audio_video/index.d.ts +0 -17
  1816. package/dist/commonjs/core/segment_buffers/implementations/index.d.ts +0 -19
  1817. package/dist/commonjs/core/segment_buffers/implementations/index.js +0 -35
  1818. package/dist/commonjs/core/segment_buffers/implementations/text/index.d.ts +0 -3
  1819. package/dist/commonjs/core/segment_buffers/implementations/text/text_segment_buffer.d.ts +0 -89
  1820. package/dist/commonjs/core/segment_buffers/implementations/text/text_segment_buffer.js +0 -253
  1821. package/dist/commonjs/core/segment_buffers/implementations/types.d.ts +0 -309
  1822. package/dist/commonjs/core/segment_buffers/implementations/types.js +0 -117
  1823. package/dist/commonjs/core/segment_buffers/index.d.ts +0 -21
  1824. package/dist/commonjs/core/segment_buffers/index.js +0 -28
  1825. package/dist/commonjs/core/segment_buffers/inventory/buffered_history.d.ts +0 -89
  1826. package/dist/commonjs/core/segment_buffers/inventory/index.d.ts +0 -21
  1827. package/dist/commonjs/core/segment_buffers/inventory/segment_inventory.d.ts +0 -238
  1828. package/dist/commonjs/core/segment_buffers/inventory/segment_inventory.js +0 -906
  1829. package/dist/commonjs/core/segment_buffers/inventory/types.d.ts +0 -27
  1830. package/dist/commonjs/core/segment_buffers/inventory/utils.d.ts +0 -33
  1831. package/dist/commonjs/core/segment_buffers/inventory/utils.js +0 -54
  1832. package/dist/commonjs/core/segment_buffers/segment_buffers_store.d.ts +0 -171
  1833. package/dist/commonjs/core/segment_buffers/segment_buffers_store.js +0 -292
  1834. package/dist/commonjs/manifest/adaptation.d.ts +0 -135
  1835. package/dist/commonjs/manifest/adaptation.js +0 -242
  1836. package/dist/commonjs/manifest/manifest.d.ts +0 -388
  1837. package/dist/commonjs/manifest/manifest.js +0 -496
  1838. package/dist/commonjs/manifest/period.d.ts +0 -106
  1839. package/dist/commonjs/manifest/period.js +0 -236
  1840. package/dist/commonjs/manifest/representation.d.ts +0 -238
  1841. package/dist/commonjs/manifest/representation.js +0 -376
  1842. package/dist/commonjs/manifest/representation_index/index.d.ts +0 -18
  1843. package/dist/commonjs/manifest/representation_index/static.d.ts +0 -101
  1844. package/dist/commonjs/manifest/representation_index/static.js +0 -143
  1845. package/dist/commonjs/manifest/representation_index/types.d.ts +0 -420
  1846. package/dist/commonjs/manifest/update_period_in_place.d.ts +0 -52
  1847. package/dist/commonjs/manifest/update_period_in_place.js +0 -172
  1848. package/dist/commonjs/manifest/update_periods.d.ts +0 -50
  1849. package/dist/commonjs/manifest/update_periods.js +0 -228
  1850. package/dist/commonjs/parsers/manifest/dash/js-parser/node_parsers/AdaptationSet.d.ts +0 -23
  1851. package/dist/commonjs/parsers/manifest/dash/js-parser/node_parsers/AdaptationSet.js +0 -331
  1852. package/dist/commonjs/parsers/manifest/dash/js-parser/node_parsers/BaseURL.d.ts +0 -23
  1853. package/dist/commonjs/parsers/manifest/dash/js-parser/node_parsers/BaseURL.js +0 -33
  1854. package/dist/commonjs/parsers/manifest/dash/js-parser/node_parsers/ContentComponent.d.ts +0 -22
  1855. package/dist/commonjs/parsers/manifest/dash/js-parser/node_parsers/ContentProtection.d.ts +0 -21
  1856. package/dist/commonjs/parsers/manifest/dash/js-parser/node_parsers/EventStream.d.ts +0 -23
  1857. package/dist/commonjs/parsers/manifest/dash/js-parser/node_parsers/EventStream.js +0 -113
  1858. package/dist/commonjs/parsers/manifest/dash/js-parser/node_parsers/Initialization.d.ts +0 -21
  1859. package/dist/commonjs/parsers/manifest/dash/js-parser/node_parsers/Initialization.js +0 -42
  1860. package/dist/commonjs/parsers/manifest/dash/js-parser/node_parsers/MPD.d.ts +0 -21
  1861. package/dist/commonjs/parsers/manifest/dash/js-parser/node_parsers/MPD.js +0 -164
  1862. package/dist/commonjs/parsers/manifest/dash/js-parser/node_parsers/Period.d.ts +0 -21
  1863. package/dist/commonjs/parsers/manifest/dash/js-parser/node_parsers/Period.js +0 -132
  1864. package/dist/commonjs/parsers/manifest/dash/js-parser/node_parsers/Representation.d.ts +0 -21
  1865. package/dist/commonjs/parsers/manifest/dash/js-parser/node_parsers/Representation.js +0 -209
  1866. package/dist/commonjs/parsers/manifest/dash/js-parser/node_parsers/SegmentBase.d.ts +0 -22
  1867. package/dist/commonjs/parsers/manifest/dash/js-parser/node_parsers/SegmentBase.js +0 -108
  1868. package/dist/commonjs/parsers/manifest/dash/js-parser/node_parsers/SegmentList.d.ts +0 -21
  1869. package/dist/commonjs/parsers/manifest/dash/js-parser/node_parsers/SegmentTemplate.d.ts +0 -23
  1870. package/dist/commonjs/parsers/manifest/dash/js-parser/node_parsers/SegmentTemplate.js +0 -92
  1871. package/dist/commonjs/parsers/manifest/dash/js-parser/node_parsers/SegmentTimeline.d.ts +0 -21
  1872. package/dist/commonjs/parsers/manifest/dash/js-parser/node_parsers/SegmentURL.d.ts +0 -23
  1873. package/dist/commonjs/parsers/manifest/dash/js-parser/node_parsers/SegmentURL.js +0 -52
  1874. package/dist/commonjs/parsers/manifest/dash/js-parser/node_parsers/utils.d.ts +0 -187
  1875. package/dist/commonjs/parsers/manifest/dash/js-parser/node_parsers/utils.js +0 -354
  1876. package/dist/commonjs/parsers/manifest/dash/js-parser/parse_from_document.d.ts +0 -24
  1877. package/dist/commonjs/parsers/manifest/dash/js-parser/parse_from_document.js +0 -131
  1878. package/dist/commonjs/text_displayer/html/html_parsers.js +0 -25
  1879. package/dist/commonjs/text_displayer/html/html_text_displayer.d.ts +0 -100
  1880. package/dist/commonjs/text_displayer/html/html_text_displayer.js +0 -317
  1881. package/dist/commonjs/text_displayer/html/text_track_cues_store.d.ts +0 -65
  1882. package/dist/commonjs/text_displayer/html/text_track_cues_store.js +0 -378
  1883. package/dist/commonjs/text_displayer/html/update_proportional_elements.js +0 -65
  1884. package/dist/commonjs/text_displayer/html/utils.js +0 -115
  1885. package/dist/commonjs/text_displayer/index.d.ts +0 -2
  1886. package/dist/commonjs/text_displayer/manual_time_ranges.js +0 -52
  1887. package/dist/commonjs/text_displayer/native/native_parsers.d.ts +0 -11
  1888. package/dist/commonjs/text_displayer/native/native_parsers.js +0 -25
  1889. package/dist/commonjs/text_displayer/native/native_text_displayer.d.ts +0 -56
  1890. package/dist/commonjs/text_displayer/native/native_text_displayer.js +0 -207
  1891. package/dist/commonjs/text_displayer/types.d.ts +0 -74
  1892. package/dist/commonjs/transports/dash/extract_complete_chunks.js +0 -91
  1893. package/dist/commonjs/transports/utils/find_complete_box.js +0 -56
  1894. package/dist/es2017/compat/index.d.ts +0 -36
  1895. package/dist/es2017/compat/index.js +0 -42
  1896. package/dist/es2017/core/api/debug/buffer_graph.d.ts +0 -28
  1897. package/dist/es2017/core/api/debug/buffer_graph.js +0 -169
  1898. package/dist/es2017/core/api/debug/buffer_size_graph.js +0 -103
  1899. package/dist/es2017/core/api/debug/modules/general_info.d.ts +0 -3
  1900. package/dist/es2017/core/api/debug/modules/general_info.js +0 -188
  1901. package/dist/es2017/core/api/debug/modules/segment_buffer_content.d.ts +0 -4
  1902. package/dist/es2017/core/api/debug/modules/segment_buffer_content.js +0 -122
  1903. package/dist/es2017/core/api/debug/modules/segment_buffer_size.d.ts +0 -3
  1904. package/dist/es2017/core/api/debug/modules/segment_buffer_size.js +0 -35
  1905. package/dist/es2017/core/api/debug/render.d.ts +0 -3
  1906. package/dist/es2017/core/api/debug/render.js +0 -32
  1907. package/dist/es2017/core/api/debug/utils.js +0 -54
  1908. package/dist/es2017/core/api/index.d.ts +0 -20
  1909. package/dist/es2017/core/api/index.js +0 -19
  1910. package/dist/es2017/core/api/option_utils.d.ts +0 -124
  1911. package/dist/es2017/core/api/option_utils.js +0 -315
  1912. package/dist/es2017/core/api/playback_observer.d.ts +0 -521
  1913. package/dist/es2017/core/api/playback_observer.js +0 -770
  1914. package/dist/es2017/core/api/public_api.d.ts +0 -751
  1915. package/dist/es2017/core/api/public_api.js +0 -2346
  1916. package/dist/es2017/core/api/track_management/index.d.ts +0 -18
  1917. package/dist/es2017/core/api/track_management/media_element_tracks_store.d.ts +0 -197
  1918. package/dist/es2017/core/api/track_management/media_element_tracks_store.js +0 -669
  1919. package/dist/es2017/core/api/track_management/track_dispatcher.d.ts +0 -100
  1920. package/dist/es2017/core/api/track_management/track_dispatcher.js +0 -166
  1921. package/dist/es2017/core/api/track_management/tracks_store.d.ts +0 -441
  1922. package/dist/es2017/core/api/track_management/tracks_store.js +0 -981
  1923. package/dist/es2017/core/api/utils.d.ts +0 -66
  1924. package/dist/es2017/core/api/utils.js +0 -167
  1925. package/dist/es2017/core/decrypt/__tests__/__global__/utils.d.ts +0 -178
  1926. package/dist/es2017/core/decrypt/__tests__/__global__/utils.js +0 -363
  1927. package/dist/es2017/core/decrypt/attach_media_keys.d.ts +0 -53
  1928. package/dist/es2017/core/decrypt/attach_media_keys.js +0 -72
  1929. package/dist/es2017/core/decrypt/clear_on_stop.js +0 -40
  1930. package/dist/es2017/core/decrypt/content_decryptor.d.ts +0 -184
  1931. package/dist/es2017/core/decrypt/content_decryptor.js +0 -792
  1932. package/dist/es2017/core/decrypt/create_or_load_session.d.ts +0 -63
  1933. package/dist/es2017/core/decrypt/create_or_load_session.js +0 -75
  1934. package/dist/es2017/core/decrypt/create_session.d.ts +0 -53
  1935. package/dist/es2017/core/decrypt/create_session.js +0 -150
  1936. package/dist/es2017/core/decrypt/dispose_decryption_resources.js +0 -42
  1937. package/dist/es2017/core/decrypt/find_key_system.d.ts +0 -48
  1938. package/dist/es2017/core/decrypt/find_key_system.js +0 -281
  1939. package/dist/es2017/core/decrypt/get_media_keys.d.ts +0 -44
  1940. package/dist/es2017/core/decrypt/get_media_keys.js +0 -100
  1941. package/dist/es2017/core/decrypt/index.d.ts +0 -26
  1942. package/dist/es2017/core/decrypt/index.js +0 -26
  1943. package/dist/es2017/core/decrypt/init_media_keys.d.ts +0 -26
  1944. package/dist/es2017/core/decrypt/init_media_keys.js +0 -47
  1945. package/dist/es2017/core/decrypt/session_events_listener.d.ts +0 -75
  1946. package/dist/es2017/core/decrypt/session_events_listener.js +0 -249
  1947. package/dist/es2017/core/decrypt/set_server_certificate.d.ts +0 -51
  1948. package/dist/es2017/core/decrypt/set_server_certificate.js +0 -83
  1949. package/dist/es2017/core/decrypt/types.d.ts +0 -374
  1950. package/dist/es2017/core/decrypt/utils/are_init_values_compatible.js +0 -113
  1951. package/dist/es2017/core/decrypt/utils/check_key_statuses.d.ts +0 -52
  1952. package/dist/es2017/core/decrypt/utils/check_key_statuses.js +0 -165
  1953. package/dist/es2017/core/decrypt/utils/clean_old_loaded_sessions.d.ts +0 -26
  1954. package/dist/es2017/core/decrypt/utils/clean_old_stored_persistent_info.d.ts +0 -32
  1955. package/dist/es2017/core/decrypt/utils/init_data_values_container.d.ts +0 -69
  1956. package/dist/es2017/core/decrypt/utils/init_data_values_container.js +0 -96
  1957. package/dist/es2017/core/decrypt/utils/is_session_usable.d.ts +0 -24
  1958. package/dist/es2017/core/decrypt/utils/is_session_usable.js +0 -49
  1959. package/dist/es2017/core/decrypt/utils/key_id_comparison.js +0 -48
  1960. package/dist/es2017/core/decrypt/utils/key_session_record.d.ts +0 -104
  1961. package/dist/es2017/core/decrypt/utils/key_session_record.js +0 -153
  1962. package/dist/es2017/core/decrypt/utils/loaded_sessions_store.d.ts +0 -215
  1963. package/dist/es2017/core/decrypt/utils/loaded_sessions_store.js +0 -365
  1964. package/dist/es2017/core/decrypt/utils/media_keys_infos_store.d.ts +0 -56
  1965. package/dist/es2017/core/decrypt/utils/media_keys_infos_store.js +0 -44
  1966. package/dist/es2017/core/decrypt/utils/persistent_sessions_store.d.ts +0 -94
  1967. package/dist/es2017/core/decrypt/utils/persistent_sessions_store.js +0 -321
  1968. package/dist/es2017/core/decrypt/utils/serializable_bytes.d.ts +0 -44
  1969. package/dist/es2017/core/decrypt/utils/serializable_bytes.js +0 -46
  1970. package/dist/es2017/core/decrypt/utils/server_certificate_store.d.ts +0 -64
  1971. package/dist/es2017/core/decrypt/utils/server_certificate_store.js +0 -112
  1972. package/dist/es2017/core/init/directfile_content_initializer.d.ts +0 -97
  1973. package/dist/es2017/core/init/directfile_content_initializer.js +0 -238
  1974. package/dist/es2017/core/init/media_source_content_initializer.d.ts +0 -165
  1975. package/dist/es2017/core/init/media_source_content_initializer.js +0 -685
  1976. package/dist/es2017/core/init/multithread/main_thread/multi_thread_content_initializer.d.ts +0 -167
  1977. package/dist/es2017/core/init/multithread/main_thread/multi_thread_content_initializer.js +0 -1317
  1978. package/dist/es2017/core/init/multithread/main_thread/send_message.d.ts +0 -2
  1979. package/dist/es2017/core/init/multithread/main_thread/send_message.js +0 -10
  1980. package/dist/es2017/core/init/multithread/worker/content_preparer.d.ts +0 -92
  1981. package/dist/es2017/core/init/multithread/worker/content_preparer.js +0 -236
  1982. package/dist/es2017/core/init/multithread/worker/globals.d.ts +0 -13
  1983. package/dist/es2017/core/init/multithread/worker/globals.js +0 -18
  1984. package/dist/es2017/core/init/multithread/worker/index.d.ts +0 -2
  1985. package/dist/es2017/core/init/multithread/worker/index.js +0 -2
  1986. package/dist/es2017/core/init/multithread/worker/send_message.d.ts +0 -3
  1987. package/dist/es2017/core/init/multithread/worker/send_message.js +0 -20
  1988. package/dist/es2017/core/init/multithread/worker/track_choice_setter.d.ts +0 -19
  1989. package/dist/es2017/core/init/multithread/worker/track_choice_setter.js +0 -114
  1990. package/dist/es2017/core/init/multithread/worker/worker_playback_observer.d.ts +0 -21
  1991. package/dist/es2017/core/init/multithread/worker/worker_playback_observer.js +0 -43
  1992. package/dist/es2017/core/init/multithread/worker/worker_portal.d.ts +0 -1
  1993. package/dist/es2017/core/init/multithread/worker/worker_portal.js +0 -671
  1994. package/dist/es2017/core/init/multithread/worker/worker_text_displayer_interface.d.ts +0 -64
  1995. package/dist/es2017/core/init/multithread/worker/worker_text_displayer_interface.js +0 -121
  1996. package/dist/es2017/core/init/types.d.ts +0 -226
  1997. package/dist/es2017/core/init/utils/DecipherabilityFreezeDetector.d.ts +0 -54
  1998. package/dist/es2017/core/init/utils/DecipherabilityFreezeDetector.js +0 -93
  1999. package/dist/es2017/core/init/utils/content_time_boundaries_observer.d.ts +0 -192
  2000. package/dist/es2017/core/init/utils/content_time_boundaries_observer.js +0 -468
  2001. package/dist/es2017/core/init/utils/create_content_time_boundaries_observer.d.ts +0 -28
  2002. package/dist/es2017/core/init/utils/create_content_time_boundaries_observer.js +0 -41
  2003. package/dist/es2017/core/init/utils/create_core_playback_observer.d.ts +0 -61
  2004. package/dist/es2017/core/init/utils/create_core_playback_observer.js +0 -122
  2005. package/dist/es2017/core/init/utils/create_media_source.d.ts +0 -37
  2006. package/dist/es2017/core/init/utils/create_media_source.js +0 -103
  2007. package/dist/es2017/core/init/utils/end_of_stream.d.ts +0 -33
  2008. package/dist/es2017/core/init/utils/end_of_stream.js +0 -88
  2009. package/dist/es2017/core/init/utils/get_initial_time.d.ts +0 -76
  2010. package/dist/es2017/core/init/utils/get_initial_time.js +0 -113
  2011. package/dist/es2017/core/init/utils/get_loaded_reference.d.ts +0 -28
  2012. package/dist/es2017/core/init/utils/get_loaded_reference.js +0 -58
  2013. package/dist/es2017/core/init/utils/initial_seek_and_play.d.ts +0 -61
  2014. package/dist/es2017/core/init/utils/initial_seek_and_play.js +0 -206
  2015. package/dist/es2017/core/init/utils/initialize_content_decryption.d.ts +0 -86
  2016. package/dist/es2017/core/init/utils/initialize_content_decryption.js +0 -110
  2017. package/dist/es2017/core/init/utils/main_thread_text_displayer_interface.d.ts +0 -35
  2018. package/dist/es2017/core/init/utils/media_source_duration_updater.js +0 -263
  2019. package/dist/es2017/core/init/utils/rebuffering_controller.d.ts +0 -114
  2020. package/dist/es2017/core/init/utils/rebuffering_controller.js +0 -421
  2021. package/dist/es2017/core/init/utils/stream_events_emitter/are_same_stream_events.js +0 -35
  2022. package/dist/es2017/core/init/utils/stream_events_emitter/index.d.ts +0 -18
  2023. package/dist/es2017/core/init/utils/stream_events_emitter/refresh_scheduled_events_list.d.ts +0 -25
  2024. package/dist/es2017/core/init/utils/stream_events_emitter/refresh_scheduled_events_list.js +0 -85
  2025. package/dist/es2017/core/init/utils/stream_events_emitter/stream_events_emitter.d.ts +0 -53
  2026. package/dist/es2017/core/init/utils/stream_events_emitter/stream_events_emitter.js +0 -180
  2027. package/dist/es2017/core/init/utils/stream_events_emitter/types.d.ts +0 -41
  2028. package/dist/es2017/core/init/utils/throw_on_media_error.d.ts +0 -23
  2029. package/dist/es2017/core/init/utils/throw_on_media_error.js +0 -58
  2030. package/dist/es2017/core/segment_buffers/garbage_collector.d.ts +0 -43
  2031. package/dist/es2017/core/segment_buffers/garbage_collector.js +0 -137
  2032. package/dist/es2017/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.d.ts +0 -134
  2033. package/dist/es2017/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.js +0 -259
  2034. package/dist/es2017/core/segment_buffers/implementations/audio_video/index.d.ts +0 -17
  2035. package/dist/es2017/core/segment_buffers/implementations/audio_video/index.js +0 -17
  2036. package/dist/es2017/core/segment_buffers/implementations/index.d.ts +0 -19
  2037. package/dist/es2017/core/segment_buffers/implementations/index.js +0 -18
  2038. package/dist/es2017/core/segment_buffers/implementations/text/index.d.ts +0 -3
  2039. package/dist/es2017/core/segment_buffers/implementations/text/index.js +0 -2
  2040. package/dist/es2017/core/segment_buffers/implementations/text/text_segment_buffer.d.ts +0 -89
  2041. package/dist/es2017/core/segment_buffers/implementations/text/text_segment_buffer.js +0 -152
  2042. package/dist/es2017/core/segment_buffers/implementations/types.d.ts +0 -309
  2043. package/dist/es2017/core/segment_buffers/implementations/types.js +0 -112
  2044. package/dist/es2017/core/segment_buffers/implementations/utils/manual_time_ranges.js +0 -63
  2045. package/dist/es2017/core/segment_buffers/index.d.ts +0 -21
  2046. package/dist/es2017/core/segment_buffers/index.js +0 -21
  2047. package/dist/es2017/core/segment_buffers/inventory/buffered_history.d.ts +0 -89
  2048. package/dist/es2017/core/segment_buffers/inventory/buffered_history.js +0 -90
  2049. package/dist/es2017/core/segment_buffers/inventory/index.d.ts +0 -21
  2050. package/dist/es2017/core/segment_buffers/inventory/index.js +0 -18
  2051. package/dist/es2017/core/segment_buffers/inventory/segment_inventory.d.ts +0 -238
  2052. package/dist/es2017/core/segment_buffers/inventory/segment_inventory.js +0 -863
  2053. package/dist/es2017/core/segment_buffers/inventory/types.d.ts +0 -27
  2054. package/dist/es2017/core/segment_buffers/inventory/utils.d.ts +0 -33
  2055. package/dist/es2017/core/segment_buffers/inventory/utils.js +0 -49
  2056. package/dist/es2017/core/segment_buffers/segment_buffers_store.d.ts +0 -171
  2057. package/dist/es2017/core/segment_buffers/segment_buffers_store.js +0 -281
  2058. package/dist/es2017/manifest/adaptation.d.ts +0 -135
  2059. package/dist/es2017/manifest/adaptation.js +0 -195
  2060. package/dist/es2017/manifest/manifest.d.ts +0 -388
  2061. package/dist/es2017/manifest/manifest.js +0 -383
  2062. package/dist/es2017/manifest/period.d.ts +0 -106
  2063. package/dist/es2017/manifest/period.js +0 -194
  2064. package/dist/es2017/manifest/representation.d.ts +0 -238
  2065. package/dist/es2017/manifest/representation.js +0 -344
  2066. package/dist/es2017/manifest/representation_index/index.d.ts +0 -18
  2067. package/dist/es2017/manifest/representation_index/static.d.ts +0 -101
  2068. package/dist/es2017/manifest/representation_index/static.js +0 -139
  2069. package/dist/es2017/manifest/representation_index/types.d.ts +0 -420
  2070. package/dist/es2017/manifest/update_period_in_place.d.ts +0 -52
  2071. package/dist/es2017/manifest/update_period_in_place.js +0 -110
  2072. package/dist/es2017/manifest/update_periods.d.ts +0 -50
  2073. package/dist/es2017/manifest/update_periods.js +0 -192
  2074. package/dist/es2017/parsers/manifest/dash/js-parser/node_parsers/AdaptationSet.d.ts +0 -23
  2075. package/dist/es2017/parsers/manifest/dash/js-parser/node_parsers/AdaptationSet.js +0 -311
  2076. package/dist/es2017/parsers/manifest/dash/js-parser/node_parsers/BaseURL.d.ts +0 -23
  2077. package/dist/es2017/parsers/manifest/dash/js-parser/node_parsers/BaseURL.js +0 -30
  2078. package/dist/es2017/parsers/manifest/dash/js-parser/node_parsers/ContentComponent.d.ts +0 -22
  2079. package/dist/es2017/parsers/manifest/dash/js-parser/node_parsers/ContentProtection.d.ts +0 -21
  2080. package/dist/es2017/parsers/manifest/dash/js-parser/node_parsers/EventStream.d.ts +0 -23
  2081. package/dist/es2017/parsers/manifest/dash/js-parser/node_parsers/EventStream.js +0 -94
  2082. package/dist/es2017/parsers/manifest/dash/js-parser/node_parsers/Initialization.d.ts +0 -21
  2083. package/dist/es2017/parsers/manifest/dash/js-parser/node_parsers/Initialization.js +0 -39
  2084. package/dist/es2017/parsers/manifest/dash/js-parser/node_parsers/MPD.d.ts +0 -21
  2085. package/dist/es2017/parsers/manifest/dash/js-parser/node_parsers/MPD.js +0 -144
  2086. package/dist/es2017/parsers/manifest/dash/js-parser/node_parsers/Period.d.ts +0 -21
  2087. package/dist/es2017/parsers/manifest/dash/js-parser/node_parsers/Period.js +0 -112
  2088. package/dist/es2017/parsers/manifest/dash/js-parser/node_parsers/Representation.d.ts +0 -21
  2089. package/dist/es2017/parsers/manifest/dash/js-parser/node_parsers/Representation.js +0 -189
  2090. package/dist/es2017/parsers/manifest/dash/js-parser/node_parsers/SegmentBase.d.ts +0 -22
  2091. package/dist/es2017/parsers/manifest/dash/js-parser/node_parsers/SegmentBase.js +0 -89
  2092. package/dist/es2017/parsers/manifest/dash/js-parser/node_parsers/SegmentList.d.ts +0 -21
  2093. package/dist/es2017/parsers/manifest/dash/js-parser/node_parsers/SegmentTemplate.d.ts +0 -23
  2094. package/dist/es2017/parsers/manifest/dash/js-parser/node_parsers/SegmentTemplate.js +0 -73
  2095. package/dist/es2017/parsers/manifest/dash/js-parser/node_parsers/SegmentTimeline.d.ts +0 -21
  2096. package/dist/es2017/parsers/manifest/dash/js-parser/node_parsers/SegmentURL.d.ts +0 -23
  2097. package/dist/es2017/parsers/manifest/dash/js-parser/node_parsers/SegmentURL.js +0 -49
  2098. package/dist/es2017/parsers/manifest/dash/js-parser/node_parsers/utils.d.ts +0 -187
  2099. package/dist/es2017/parsers/manifest/dash/js-parser/node_parsers/utils.js +0 -306
  2100. package/dist/es2017/parsers/manifest/dash/js-parser/parse_from_document.d.ts +0 -24
  2101. package/dist/es2017/parsers/manifest/dash/js-parser/parse_from_document.js +0 -106
  2102. package/dist/es2017/text_displayer/html/html_parsers.js +0 -22
  2103. package/dist/es2017/text_displayer/html/html_text_displayer.d.ts +0 -100
  2104. package/dist/es2017/text_displayer/html/html_text_displayer.js +0 -311
  2105. package/dist/es2017/text_displayer/html/text_track_cues_store.d.ts +0 -65
  2106. package/dist/es2017/text_displayer/html/text_track_cues_store.js +0 -358
  2107. package/dist/es2017/text_displayer/html/update_proportional_elements.js +0 -62
  2108. package/dist/es2017/text_displayer/html/utils.js +0 -107
  2109. package/dist/es2017/text_displayer/index.d.ts +0 -2
  2110. package/dist/es2017/text_displayer/manual_time_ranges.js +0 -48
  2111. package/dist/es2017/text_displayer/native/native_parsers.d.ts +0 -11
  2112. package/dist/es2017/text_displayer/native/native_parsers.js +0 -22
  2113. package/dist/es2017/text_displayer/native/native_text_displayer.d.ts +0 -56
  2114. package/dist/es2017/text_displayer/native/native_text_displayer.js +0 -203
  2115. package/dist/es2017/text_displayer/types.d.ts +0 -74
  2116. package/dist/es2017/transports/dash/extract_complete_chunks.js +0 -63
  2117. package/dist/es2017/transports/utils/find_complete_box.js +0 -53
  2118. /package/dist/commonjs/core/{segment_buffers → segment_sinks}/implementations/audio_video/index.js +0 -0
  2119. /package/dist/commonjs/core/{segment_buffers → segment_sinks}/implementations/text/index.js +0 -0
  2120. /package/dist/commonjs/core/{segment_buffers → segment_sinks}/implementations/utils/manual_time_ranges.d.ts +0 -0
  2121. /package/dist/commonjs/core/{segment_buffers → segment_sinks}/implementations/utils/manual_time_ranges.js +0 -0
  2122. /package/dist/commonjs/core/{segment_buffers → segment_sinks}/inventory/buffered_history.js +0 -0
  2123. /package/dist/commonjs/core/{segment_buffers → segment_sinks}/inventory/index.js +0 -0
  2124. /package/dist/commonjs/core/{init/utils/stream_events_emitter → segment_sinks/inventory}/types.js +0 -0
  2125. /package/dist/commonjs/{text_displayer → core}/types.js +0 -0
  2126. /package/dist/commonjs/{core → main_thread}/api/debug/buffer_size_graph.d.ts +0 -0
  2127. /package/dist/commonjs/{core → main_thread}/api/debug/constants.d.ts +0 -0
  2128. /package/dist/commonjs/{core → main_thread}/api/debug/constants.js +0 -0
  2129. /package/dist/commonjs/{core → main_thread}/api/debug/index.d.ts +0 -0
  2130. /package/dist/commonjs/{core → main_thread}/api/debug/index.js +0 -0
  2131. /package/dist/commonjs/{core → main_thread}/api/debug/render.js +0 -0
  2132. /package/dist/commonjs/{core → main_thread}/api/debug/utils.d.ts +0 -0
  2133. /package/dist/commonjs/{core → main_thread}/api/debug/utils.js +0 -0
  2134. /package/dist/commonjs/{core → main_thread}/decrypt/clear_on_stop.d.ts +0 -0
  2135. /package/dist/commonjs/{core → main_thread}/decrypt/dispose_decryption_resources.d.ts +0 -0
  2136. /package/dist/commonjs/{core → main_thread}/decrypt/get_key_system_configuration.d.ts +0 -0
  2137. /package/dist/commonjs/{core → main_thread}/decrypt/get_key_system_configuration.js +0 -0
  2138. /package/dist/commonjs/{core → main_thread}/decrypt/index.js +0 -0
  2139. /package/dist/commonjs/{core → main_thread}/decrypt/types.js +0 -0
  2140. /package/dist/commonjs/{core → main_thread}/decrypt/utils/are_init_values_compatible.d.ts +0 -0
  2141. /package/dist/commonjs/{core → main_thread}/decrypt/utils/clean_old_loaded_sessions.js +0 -0
  2142. /package/dist/commonjs/{core → main_thread}/decrypt/utils/clean_old_stored_persistent_info.js +0 -0
  2143. /package/dist/commonjs/{core → main_thread}/decrypt/utils/get_drm_system_id.d.ts +0 -0
  2144. /package/dist/commonjs/{core → main_thread}/decrypt/utils/get_drm_system_id.js +0 -0
  2145. /package/dist/commonjs/{core → main_thread}/decrypt/utils/key_id_comparison.d.ts +0 -0
  2146. /package/dist/commonjs/{core → main_thread}/decrypt/utils/key_id_comparison.js +0 -0
  2147. /package/dist/commonjs/{core → main_thread}/init/index.d.ts +0 -0
  2148. /package/dist/commonjs/{core → main_thread}/init/index.js +0 -0
  2149. /package/dist/commonjs/{core → main_thread}/init/types.js +0 -0
  2150. /package/dist/commonjs/{core → main_thread}/init/utils/main_thread_text_displayer_interface.js +0 -0
  2151. /package/dist/commonjs/{core → main_thread}/init/utils/stream_events_emitter/are_same_stream_events.d.ts +0 -0
  2152. /package/dist/commonjs/{core → main_thread}/init/utils/stream_events_emitter/index.js +0 -0
  2153. /package/dist/commonjs/{core/segment_buffers/inventory → main_thread/init/utils/stream_events_emitter}/types.js +0 -0
  2154. /package/dist/commonjs/{text_displayer → main_thread/text_displayer}/html/html_parsers.d.ts +0 -0
  2155. /package/dist/commonjs/{text_displayer → main_thread/text_displayer}/html/index.d.ts +0 -0
  2156. /package/dist/commonjs/{text_displayer → main_thread/text_displayer}/html/index.js +0 -0
  2157. /package/dist/commonjs/{text_displayer → main_thread/text_displayer}/html/update_proportional_elements.d.ts +0 -0
  2158. /package/dist/commonjs/{text_displayer → main_thread/text_displayer}/html/utils.d.ts +0 -0
  2159. /package/dist/commonjs/{text_displayer → main_thread/text_displayer}/index.js +0 -0
  2160. /package/dist/commonjs/{text_displayer → main_thread/text_displayer}/manual_time_ranges.d.ts +0 -0
  2161. /package/dist/commonjs/{text_displayer → main_thread/text_displayer}/native/index.d.ts +0 -0
  2162. /package/dist/commonjs/{text_displayer → main_thread/text_displayer}/native/index.js +0 -0
  2163. /package/dist/commonjs/{core/api/track_management → main_thread/tracks_store}/index.js +0 -0
  2164. /package/dist/commonjs/manifest/{representation_index → classes/representation_index}/index.js +0 -0
  2165. /package/dist/commonjs/manifest/{representation_index → classes/representation_index}/types.js +0 -0
  2166. /package/dist/commonjs/{core/init → mse}/utils/media_source_duration_updater.d.ts +0 -0
  2167. /package/dist/commonjs/{transports/dash → parsers/containers/isobmff}/extract_complete_chunks.d.ts +0 -0
  2168. /package/dist/commonjs/{transports/utils → parsers/containers/isobmff}/find_complete_box.d.ts +0 -0
  2169. /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/index.d.ts +0 -0
  2170. /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/index.js +0 -0
  2171. /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/ContentComponent.js +0 -0
  2172. /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/ContentProtection.js +0 -0
  2173. /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentList.js +0 -0
  2174. /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentTimeline.js +0 -0
  2175. /package/dist/es2017/core/{segment_buffers → segment_sinks}/implementations/utils/manual_time_ranges.d.ts +0 -0
  2176. /package/dist/es2017/core/{init/utils/stream_events_emitter → segment_sinks/inventory}/types.js +0 -0
  2177. /package/dist/es2017/{text_displayer → core}/types.js +0 -0
  2178. /package/dist/es2017/{core → main_thread}/api/debug/buffer_size_graph.d.ts +0 -0
  2179. /package/dist/es2017/{core → main_thread}/api/debug/constants.d.ts +0 -0
  2180. /package/dist/es2017/{core → main_thread}/api/debug/constants.js +0 -0
  2181. /package/dist/es2017/{core → main_thread}/api/debug/index.d.ts +0 -0
  2182. /package/dist/es2017/{core → main_thread}/api/debug/index.js +0 -0
  2183. /package/dist/es2017/{core → main_thread}/api/debug/utils.d.ts +0 -0
  2184. /package/dist/es2017/{core → main_thread}/decrypt/clear_on_stop.d.ts +0 -0
  2185. /package/dist/es2017/{core → main_thread}/decrypt/dispose_decryption_resources.d.ts +0 -0
  2186. /package/dist/es2017/{core → main_thread}/decrypt/get_key_system_configuration.d.ts +0 -0
  2187. /package/dist/es2017/{core → main_thread}/decrypt/get_key_system_configuration.js +0 -0
  2188. /package/dist/es2017/{core → main_thread}/decrypt/types.js +0 -0
  2189. /package/dist/es2017/{core → main_thread}/decrypt/utils/are_init_values_compatible.d.ts +0 -0
  2190. /package/dist/es2017/{core → main_thread}/decrypt/utils/clean_old_loaded_sessions.js +0 -0
  2191. /package/dist/es2017/{core → main_thread}/decrypt/utils/clean_old_stored_persistent_info.js +0 -0
  2192. /package/dist/es2017/{core → main_thread}/decrypt/utils/get_drm_system_id.d.ts +0 -0
  2193. /package/dist/es2017/{core → main_thread}/decrypt/utils/get_drm_system_id.js +0 -0
  2194. /package/dist/es2017/{core → main_thread}/decrypt/utils/key_id_comparison.d.ts +0 -0
  2195. /package/dist/es2017/{core → main_thread}/init/index.d.ts +0 -0
  2196. /package/dist/es2017/{core → main_thread}/init/index.js +0 -0
  2197. /package/dist/es2017/{core → main_thread}/init/types.js +0 -0
  2198. /package/dist/es2017/{core → main_thread}/init/utils/main_thread_text_displayer_interface.js +0 -0
  2199. /package/dist/es2017/{core → main_thread}/init/utils/stream_events_emitter/are_same_stream_events.d.ts +0 -0
  2200. /package/dist/es2017/{core → main_thread}/init/utils/stream_events_emitter/index.js +0 -0
  2201. /package/dist/es2017/{core/segment_buffers/inventory → main_thread/init/utils/stream_events_emitter}/types.js +0 -0
  2202. /package/dist/es2017/{text_displayer → main_thread/text_displayer}/html/html_parsers.d.ts +0 -0
  2203. /package/dist/es2017/{text_displayer → main_thread/text_displayer}/html/index.d.ts +0 -0
  2204. /package/dist/es2017/{text_displayer → main_thread/text_displayer}/html/index.js +0 -0
  2205. /package/dist/es2017/{text_displayer → main_thread/text_displayer}/html/update_proportional_elements.d.ts +0 -0
  2206. /package/dist/es2017/{text_displayer → main_thread/text_displayer}/html/utils.d.ts +0 -0
  2207. /package/dist/es2017/{text_displayer → main_thread/text_displayer}/index.js +0 -0
  2208. /package/dist/es2017/{text_displayer → main_thread/text_displayer}/manual_time_ranges.d.ts +0 -0
  2209. /package/dist/es2017/{text_displayer → main_thread/text_displayer}/native/index.d.ts +0 -0
  2210. /package/dist/es2017/{text_displayer → main_thread/text_displayer}/native/index.js +0 -0
  2211. /package/dist/es2017/{core/api/track_management → main_thread/tracks_store}/index.js +0 -0
  2212. /package/dist/es2017/manifest/{representation_index → classes/representation_index}/index.js +0 -0
  2213. /package/dist/es2017/manifest/{representation_index → classes/representation_index}/types.js +0 -0
  2214. /package/dist/es2017/{core/init → mse}/utils/media_source_duration_updater.d.ts +0 -0
  2215. /package/dist/es2017/{transports/dash → parsers/containers/isobmff}/extract_complete_chunks.d.ts +0 -0
  2216. /package/dist/es2017/{transports/utils → parsers/containers/isobmff}/find_complete_box.d.ts +0 -0
  2217. /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/index.d.ts +0 -0
  2218. /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/index.js +0 -0
  2219. /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/ContentComponent.js +0 -0
  2220. /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/ContentProtection.js +0 -0
  2221. /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentList.js +0 -0
  2222. /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentTimeline.js +0 -0
@@ -0,0 +1,2557 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright 2015 CANAL+ Group
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");publicapi
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ var __extends = (this && this.__extends) || (function () {
18
+ var extendStatics = function (d, b) {
19
+ extendStatics = Object.setPrototypeOf ||
20
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
21
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
22
+ return extendStatics(d, b);
23
+ };
24
+ return function (d, b) {
25
+ if (typeof b !== "function" && b !== null)
26
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
27
+ extendStatics(d, b);
28
+ function __() { this.constructor = d; }
29
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
30
+ };
31
+ })();
32
+ var __assign = (this && this.__assign) || function () {
33
+ __assign = Object.assign || function(t) {
34
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
35
+ s = arguments[i];
36
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
37
+ t[p] = s[p];
38
+ }
39
+ return t;
40
+ };
41
+ return __assign.apply(this, arguments);
42
+ };
43
+ var __values = (this && this.__values) || function(o) {
44
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
45
+ if (m) return m.call(o);
46
+ if (o && typeof o.length === "number") return {
47
+ next: function () {
48
+ if (o && i >= o.length) o = void 0;
49
+ return { value: o && o[i++], done: !o };
50
+ }
51
+ };
52
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
53
+ };
54
+ var __read = (this && this.__read) || function (o, n) {
55
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
56
+ if (!m) return o;
57
+ var i = m.call(o), r, ar = [], e;
58
+ try {
59
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
60
+ }
61
+ catch (error) { e = { error: error }; }
62
+ finally {
63
+ try {
64
+ if (r && !r.done && (m = i["return"])) m.call(i);
65
+ }
66
+ finally { if (e) throw e.error; }
67
+ }
68
+ return ar;
69
+ };
70
+ Object.defineProperty(exports, "__esModule", { value: true });
71
+ /**
72
+ * This file defines the public API for the RxPlayer.
73
+ * It also starts the different sub-parts of the player on various API calls.
74
+ */
75
+ var can_rely_on_video_visibility_and_size_1 = require("../../compat/can_rely_on_video_visibility_and_size");
76
+ var event_listeners_1 = require("../../compat/event_listeners");
77
+ var get_start_date_1 = require("../../compat/get_start_date");
78
+ var has_mse_in_worker_1 = require("../../compat/has_mse_in_worker");
79
+ var has_worker_api_1 = require("../../compat/has_worker_api");
80
+ var is_debug_mode_enabled_1 = require("../../compat/is_debug_mode_enabled");
81
+ var errors_1 = require("../../errors");
82
+ var worker_initialization_error_1 = require("../../errors/worker_initialization_error");
83
+ var features_1 = require("../../features");
84
+ var log_1 = require("../../log");
85
+ var manifest_1 = require("../../manifest");
86
+ var media_element_playback_observer_1 = require("../../playback_observer/media_element_playback_observer");
87
+ var array_find_1 = require("../../utils/array_find");
88
+ var array_includes_1 = require("../../utils/array_includes");
89
+ var assert_1 = require("../../utils/assert");
90
+ var event_emitter_1 = require("../../utils/event_emitter");
91
+ var id_generator_1 = require("../../utils/id_generator");
92
+ var is_null_or_undefined_1 = require("../../utils/is_null_or_undefined");
93
+ var monotonic_timestamp_1 = require("../../utils/monotonic_timestamp");
94
+ var object_assign_1 = require("../../utils/object_assign");
95
+ var ranges_1 = require("../../utils/ranges");
96
+ var reference_1 = require("../../utils/reference");
97
+ var task_canceller_1 = require("../../utils/task_canceller");
98
+ var decrypt_1 = require("../decrypt");
99
+ var tracks_store_1 = require("../tracks_store");
100
+ var option_utils_1 = require("./option_utils");
101
+ var utils_1 = require("./utils");
102
+ /* eslint-disable @typescript-eslint/naming-convention */
103
+ var generateContentId = (0, id_generator_1.default)();
104
+ /**
105
+ * Options of a `loadVideo` call which are for now not supported when running
106
+ * in a "multithread" mode.
107
+ *
108
+ * TODO support those?
109
+ */
110
+ var MULTI_THREAD_UNSUPPORTED_LOAD_VIDEO_OPTIONS = [
111
+ "manifestLoader",
112
+ "segmentLoader",
113
+ ];
114
+ /**
115
+ * @class Player
116
+ * @extends EventEmitter
117
+ */
118
+ var Player = /** @class */ (function (_super) {
119
+ __extends(Player, _super);
120
+ /**
121
+ * @constructor
122
+ * @param {Object} options
123
+ */
124
+ function Player(options) {
125
+ if (options === void 0) { options = {}; }
126
+ var _this = _super.call(this) || this;
127
+ var _a = (0, option_utils_1.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;
128
+ // Workaround to support Firefox autoplay on FF 42.
129
+ // See: https://bugzilla.mozilla.org/show_bug.cgi?id=1194624
130
+ videoElement.preload = "auto";
131
+ _this.version = /* PLAYER_VERSION */ "4.1.0-dev.2024031100";
132
+ _this.log = log_1.default;
133
+ _this.state = "STOPPED";
134
+ _this.videoElement = videoElement;
135
+ Player._priv_registerVideoElement(_this.videoElement);
136
+ var destroyCanceller = new task_canceller_1.default();
137
+ _this._destroyCanceller = destroyCanceller;
138
+ _this._priv_pictureInPictureRef = (0, event_listeners_1.getPictureOnPictureStateRef)(videoElement, destroyCanceller.signal);
139
+ _this._priv_speed = new reference_1.default(videoElement.playbackRate, _this._destroyCanceller.signal);
140
+ _this._priv_preferTrickModeTracks = false;
141
+ _this._priv_contentLock = new reference_1.default(false, _this._destroyCanceller.signal);
142
+ _this._priv_bufferOptions = {
143
+ wantedBufferAhead: new reference_1.default(wantedBufferAhead, _this._destroyCanceller.signal),
144
+ maxBufferAhead: new reference_1.default(maxBufferAhead, _this._destroyCanceller.signal),
145
+ maxBufferBehind: new reference_1.default(maxBufferBehind, _this._destroyCanceller.signal),
146
+ maxVideoBufferSize: new reference_1.default(maxVideoBufferSize, _this._destroyCanceller.signal),
147
+ };
148
+ _this._priv_bitrateInfos = {
149
+ lastBitrates: { audio: baseBandwidth, video: baseBandwidth },
150
+ };
151
+ _this._priv_throttleVideoBitrateWhenHidden = throttleVideoBitrateWhenHidden;
152
+ _this._priv_videoResolutionLimit = videoResolutionLimit;
153
+ _this._priv_currentError = null;
154
+ _this._priv_contentInfos = null;
155
+ _this._priv_contentEventsMemory = {};
156
+ _this._priv_reloadingMetadata = {};
157
+ _this._priv_lastAutoPlay = false;
158
+ _this._priv_worker = null;
159
+ var onVolumeChange = function () {
160
+ _this.trigger("volumeChange", {
161
+ volume: videoElement.volume,
162
+ muted: videoElement.muted,
163
+ });
164
+ };
165
+ videoElement.addEventListener("volumechange", onVolumeChange);
166
+ destroyCanceller.signal.register(function () {
167
+ videoElement.removeEventListener("volumechange", onVolumeChange);
168
+ });
169
+ return _this;
170
+ }
171
+ Object.defineProperty(Player, "ErrorTypes", {
172
+ /** All possible Error types emitted by the RxPlayer. */
173
+ get: function () {
174
+ return errors_1.ErrorTypes;
175
+ },
176
+ enumerable: false,
177
+ configurable: true
178
+ });
179
+ Object.defineProperty(Player, "ErrorCodes", {
180
+ /** All possible Error codes emitted by the RxPlayer. */
181
+ get: function () {
182
+ return errors_1.ErrorCodes;
183
+ },
184
+ enumerable: false,
185
+ configurable: true
186
+ });
187
+ Object.defineProperty(Player, "LogLevel", {
188
+ /**
189
+ * Current log level.
190
+ * Update current log level.
191
+ * Should be either (by verbosity ascending):
192
+ * - "NONE"
193
+ * - "ERROR"
194
+ * - "WARNING"
195
+ * - "INFO"
196
+ * - "DEBUG"
197
+ * Any other value will be translated to "NONE".
198
+ */
199
+ get: function () {
200
+ return log_1.default.getLevel();
201
+ },
202
+ set: function (logLevel) {
203
+ log_1.default.setLevel(logLevel);
204
+ },
205
+ enumerable: false,
206
+ configurable: true
207
+ });
208
+ /**
209
+ * Add feature(s) to the RxPlayer.
210
+ * @param {Array.<Object>} featureList - Features wanted.
211
+ */
212
+ Player.addFeatures = function (featureList) {
213
+ (0, features_1.addFeatures)(featureList);
214
+ };
215
+ /**
216
+ * Register the video element to the set of elements currently in use.
217
+ * @param videoElement the video element to register.
218
+ * @throws Error - Throws if the element is already used by another player instance.
219
+ */
220
+ Player._priv_registerVideoElement = function (videoElement) {
221
+ if (Player._priv_currentlyUsedVideoElements.has(videoElement)) {
222
+ var errorMessage = "The video element is already attached to another RxPlayer instance." +
223
+ "\nMake sure to dispose the previous instance with player.dispose() before creating" +
224
+ " a new player instance attaching that video element.";
225
+ // eslint-disable-next-line no-console
226
+ console.warn(errorMessage);
227
+ /*
228
+ * TODO: for next major version 5.0: this need to throw an error instead of just logging
229
+ * this was not done for minor version as it could be considerated a breaking change.
230
+ *
231
+ * throw new Error(errorMessage);
232
+ */
233
+ }
234
+ Player._priv_currentlyUsedVideoElements.add(videoElement);
235
+ };
236
+ /**
237
+ * Deregister the video element of the set of elements currently in use.
238
+ * @param videoElement the video element to deregister.
239
+ */
240
+ Player._priv_deregisterVideoElement = function (videoElement) {
241
+ if (Player._priv_currentlyUsedVideoElements.has(videoElement)) {
242
+ Player._priv_currentlyUsedVideoElements.delete(videoElement);
243
+ }
244
+ };
245
+ /**
246
+ * TODO returns promise?
247
+ * @param {Object} workerSettings
248
+ */
249
+ Player.prototype.attachWorker = function (workerSettings) {
250
+ var _this = this;
251
+ return new Promise(function (res, rej) {
252
+ var _a;
253
+ if (!(0, has_worker_api_1.default)()) {
254
+ log_1.default.warn("API: Cannot rely on a WebWorker: Worker API unavailable");
255
+ return rej(new worker_initialization_error_1.default("INCOMPATIBLE_ERROR", "Worker unavailable"));
256
+ }
257
+ if (typeof workerSettings.workerUrl === "string") {
258
+ _this._priv_worker = new Worker(workerSettings.workerUrl);
259
+ }
260
+ else {
261
+ var blobUrl = URL.createObjectURL(workerSettings.workerUrl);
262
+ _this._priv_worker = new Worker(blobUrl);
263
+ URL.revokeObjectURL(blobUrl);
264
+ }
265
+ _this._priv_worker.onerror = function (evt) {
266
+ if (_this._priv_worker !== null) {
267
+ _this._priv_worker.terminate();
268
+ _this._priv_worker = null;
269
+ }
270
+ log_1.default.error("API: Unexpected worker error", evt.error instanceof Error ? evt.error : undefined);
271
+ rej(new worker_initialization_error_1.default("UNKNOWN_ERROR", 'Unexpected Worker "error" event'));
272
+ };
273
+ var handleInitMessages = function (msg) {
274
+ var msgData = msg.data;
275
+ if (msgData.type === "init-error" /* WorkerMessageType.InitError */) {
276
+ log_1.default.warn("API: Processing InitError worker message: detaching worker");
277
+ if (_this._priv_worker !== null) {
278
+ _this._priv_worker.removeEventListener("message", handleInitMessages);
279
+ _this._priv_worker.terminate();
280
+ _this._priv_worker = null;
281
+ }
282
+ rej(new worker_initialization_error_1.default("SETUP_ERROR", "Worker parser initialization failed: " + msgData.value.errorMessage));
283
+ }
284
+ else if (msgData.type === "init-success" /* WorkerMessageType.InitSuccess */) {
285
+ log_1.default.info("API: InitSuccess received from worker.");
286
+ if (_this._priv_worker !== null) {
287
+ _this._priv_worker.removeEventListener("message", handleInitMessages);
288
+ }
289
+ res();
290
+ }
291
+ };
292
+ _this._priv_worker.addEventListener("message", handleInitMessages);
293
+ log_1.default.debug("---> Sending To Worker:", "init" /* MainThreadMessageType.Init */);
294
+ _this._priv_worker.postMessage({
295
+ type: "init" /* MainThreadMessageType.Init */,
296
+ value: {
297
+ dashWasmUrl: workerSettings.dashWasmUrl,
298
+ logLevel: log_1.default.getLevel(),
299
+ sendBackLogs: (0, is_debug_mode_enabled_1.default)(),
300
+ date: Date.now(),
301
+ timestamp: (0, monotonic_timestamp_1.default)(),
302
+ hasVideo: ((_a = _this.videoElement) === null || _a === void 0 ? void 0 : _a.nodeName.toLowerCase()) === "video",
303
+ hasMseInWorker: has_mse_in_worker_1.default,
304
+ },
305
+ });
306
+ log_1.default.addEventListener("onLogLevelChange", function (logLevel) {
307
+ if (_this._priv_worker === null) {
308
+ return;
309
+ }
310
+ log_1.default.debug("---> Sending To Worker:", "log-level-update" /* MainThreadMessageType.LogLevelUpdate */);
311
+ _this._priv_worker.postMessage({
312
+ type: "log-level-update" /* MainThreadMessageType.LogLevelUpdate */,
313
+ value: {
314
+ logLevel: logLevel,
315
+ sendBackLogs: (0, is_debug_mode_enabled_1.default)(),
316
+ },
317
+ });
318
+ }, _this._destroyCanceller.signal);
319
+ });
320
+ };
321
+ /**
322
+ * Returns information on which "mode" the RxPlayer is running for the current
323
+ * content (e.g. main logic running in a WebWorker or not, are we in
324
+ * directfile mode...).
325
+ *
326
+ * Returns `null` if no content is loaded.
327
+ * @returns {Object|null}
328
+ */
329
+ Player.prototype.getCurrentModeInformation = function () {
330
+ if (this._priv_contentInfos === null) {
331
+ return null;
332
+ }
333
+ return {
334
+ isDirectFile: this._priv_contentInfos.isDirectFile,
335
+ useWorker: this._priv_contentInfos.useWorker,
336
+ };
337
+ };
338
+ /**
339
+ * Register a new callback for a player event event.
340
+ *
341
+ * @param {string} evt - The event to register a callback to
342
+ * @param {Function} fn - The callback to call as that event is triggered.
343
+ * The callback will take as argument the eventual payload of the event
344
+ * (single argument).
345
+ */
346
+ Player.prototype.addEventListener = function (evt, fn) {
347
+ // The EventEmitter's `addEventListener` method takes an optional third
348
+ // argument that we do not want to expose in the public API.
349
+ // We thus overwrite that function to remove any possible usage of that
350
+ // third argument.
351
+ return _super.prototype.addEventListener.call(this, evt, fn);
352
+ };
353
+ /**
354
+ * Stop the playback for the current content.
355
+ */
356
+ Player.prototype.stop = function () {
357
+ if (this._priv_contentInfos !== null) {
358
+ this._priv_contentInfos.currentContentCanceller.cancel();
359
+ }
360
+ this._priv_cleanUpCurrentContentState();
361
+ if (this.state !== "STOPPED" /* PLAYER_STATES.STOPPED */) {
362
+ this._priv_setPlayerState("STOPPED" /* PLAYER_STATES.STOPPED */);
363
+ }
364
+ };
365
+ /**
366
+ * Free the resources used by the player.
367
+ * /!\ The player cannot be "used" anymore after this method has been called.
368
+ */
369
+ Player.prototype.dispose = function () {
370
+ // free resources linked to the loaded content
371
+ this.stop();
372
+ if (this.videoElement !== null) {
373
+ Player._priv_deregisterVideoElement(this.videoElement);
374
+ // free resources used for decryption management
375
+ (0, decrypt_1.disposeDecryptionResources)(this.videoElement).catch(function (err) {
376
+ var message = err instanceof Error ? err.message : "Unknown error";
377
+ log_1.default.error("API: Could not dispose decryption resources: " + message);
378
+ });
379
+ }
380
+ // free resources linked to the Player instance
381
+ this._destroyCanceller.cancel();
382
+ this._priv_reloadingMetadata = {};
383
+ // un-attach video element
384
+ this.videoElement = null;
385
+ if (this._priv_worker !== null) {
386
+ this._priv_worker.terminate();
387
+ this._priv_worker = null;
388
+ }
389
+ };
390
+ /**
391
+ * Load a new video.
392
+ * @param {Object} opts
393
+ */
394
+ Player.prototype.loadVideo = function (opts) {
395
+ var options = (0, option_utils_1.parseLoadVideoOptions)(opts);
396
+ log_1.default.info("API: Calling loadvideo", options.url, options.transport);
397
+ this._priv_reloadingMetadata = { options: options };
398
+ this._priv_initializeContentPlayback(options);
399
+ this._priv_lastAutoPlay = options.autoPlay;
400
+ };
401
+ /**
402
+ * Reload the last loaded content.
403
+ * @param {Object} reloadOpts
404
+ */
405
+ Player.prototype.reload = function (reloadOpts) {
406
+ var _a, _b, _c;
407
+ var _d = this._priv_reloadingMetadata, options = _d.options, manifest = _d.manifest, reloadPosition = _d.reloadPosition, reloadInPause = _d.reloadInPause;
408
+ if (options === undefined) {
409
+ throw new Error("API: Can't reload without having previously loaded a content.");
410
+ }
411
+ (0, option_utils_1.checkReloadOptions)(reloadOpts);
412
+ var startAt;
413
+ if (((_a = reloadOpts === null || reloadOpts === void 0 ? void 0 : reloadOpts.reloadAt) === null || _a === void 0 ? void 0 : _a.position) !== undefined) {
414
+ startAt = { position: reloadOpts.reloadAt.position };
415
+ }
416
+ else if (((_b = reloadOpts === null || reloadOpts === void 0 ? void 0 : reloadOpts.reloadAt) === null || _b === void 0 ? void 0 : _b.relative) !== undefined) {
417
+ if (reloadPosition === undefined) {
418
+ throw new Error("Can't reload to a relative position when previous content was not loaded.");
419
+ }
420
+ else {
421
+ startAt = { position: reloadOpts.reloadAt.relative + reloadPosition };
422
+ }
423
+ }
424
+ else if (reloadPosition !== undefined) {
425
+ startAt = { position: reloadPosition };
426
+ }
427
+ var autoPlay;
428
+ if ((reloadOpts === null || reloadOpts === void 0 ? void 0 : reloadOpts.autoPlay) !== undefined) {
429
+ autoPlay = reloadOpts.autoPlay;
430
+ }
431
+ else if (reloadInPause !== undefined) {
432
+ autoPlay = !reloadInPause;
433
+ }
434
+ var keySystems;
435
+ if ((reloadOpts === null || reloadOpts === void 0 ? void 0 : reloadOpts.keySystems) !== undefined) {
436
+ keySystems = reloadOpts.keySystems;
437
+ }
438
+ else if (((_c = this._priv_reloadingMetadata.options) === null || _c === void 0 ? void 0 : _c.keySystems) !== undefined) {
439
+ keySystems = this._priv_reloadingMetadata.options.keySystems;
440
+ }
441
+ var newOptions = __assign(__assign({}, options), { initialManifest: manifest });
442
+ if (startAt !== undefined) {
443
+ newOptions.startAt = startAt;
444
+ }
445
+ if (autoPlay !== undefined) {
446
+ newOptions.autoPlay = autoPlay;
447
+ }
448
+ if (keySystems !== undefined) {
449
+ newOptions.keySystems = keySystems;
450
+ }
451
+ this._priv_initializeContentPlayback(newOptions);
452
+ };
453
+ Player.prototype.createDebugElement = function (element) {
454
+ if (features_1.default.createDebugElement === null) {
455
+ throw new Error("Feature `DEBUG_ELEMENT` not added to the RxPlayer");
456
+ }
457
+ var canceller = new task_canceller_1.default();
458
+ features_1.default.createDebugElement(element, this, canceller.signal);
459
+ return {
460
+ dispose: function () {
461
+ canceller.cancel();
462
+ },
463
+ };
464
+ };
465
+ /**
466
+ * From given options, initialize content playback.
467
+ * @param {Object} options
468
+ */
469
+ Player.prototype._priv_initializeContentPlayback = function (options) {
470
+ var _this = this;
471
+ var _a, _b, _c, _d, _e, _f;
472
+ 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, segmentLoader = options.segmentLoader, serverSyncInfos = options.serverSyncInfos, mode = options.mode, __priv_manifestUpdateUrl = options.__priv_manifestUpdateUrl, __priv_patchLastSegmentInSidx = options.__priv_patchLastSegmentInSidx, url = options.url;
473
+ // Perform multiple checks on the given options
474
+ if (this.videoElement === null) {
475
+ throw new Error("the attached video element is disposed");
476
+ }
477
+ var isDirectFile = transport === "directfile";
478
+ /** Emit to stop the current content. */
479
+ var currentContentCanceller = new task_canceller_1.default();
480
+ var videoElement = this.videoElement;
481
+ var initializer;
482
+ var useWorker = false;
483
+ var mediaElementTracksStore = null;
484
+ if (!isDirectFile) {
485
+ /** Interface used to load and refresh the Manifest. */
486
+ var manifestRequestSettings = {
487
+ lowLatencyMode: lowLatencyMode,
488
+ maxRetry: (_a = requestConfig.manifest) === null || _a === void 0 ? void 0 : _a.maxRetry,
489
+ requestTimeout: (_b = requestConfig.manifest) === null || _b === void 0 ? void 0 : _b.timeout,
490
+ connectionTimeout: (_c = requestConfig.manifest) === null || _c === void 0 ? void 0 : _c.connectionTimeout,
491
+ minimumManifestUpdateInterval: minimumManifestUpdateInterval,
492
+ initialManifest: initialManifest,
493
+ };
494
+ var relyOnVideoVisibilityAndSize = (0, can_rely_on_video_visibility_and_size_1.default)();
495
+ var throttlers = {
496
+ throttleBitrate: {},
497
+ limitResolution: {},
498
+ };
499
+ if (this._priv_throttleVideoBitrateWhenHidden) {
500
+ if (!relyOnVideoVisibilityAndSize) {
501
+ log_1.default.warn("API: Can't apply throttleVideoBitrateWhenHidden because " +
502
+ "browser can't be trusted for visibility.");
503
+ }
504
+ else {
505
+ throttlers.throttleBitrate = {
506
+ video: (0, reference_1.createMappedReference)((0, event_listeners_1.getVideoVisibilityRef)(this._priv_pictureInPictureRef, currentContentCanceller.signal), function (isActive) { return (isActive ? Infinity : 0); }, currentContentCanceller.signal),
507
+ };
508
+ }
509
+ }
510
+ if (this._priv_videoResolutionLimit === "videoElement") {
511
+ if (!relyOnVideoVisibilityAndSize) {
512
+ log_1.default.warn("API: Can't apply videoResolutionLimit because browser can't be " +
513
+ "trusted for video size.");
514
+ }
515
+ else {
516
+ throttlers.limitResolution = {
517
+ video: (0, event_listeners_1.getElementResolutionRef)(videoElement, this._priv_pictureInPictureRef, currentContentCanceller.signal),
518
+ };
519
+ }
520
+ }
521
+ else if (this._priv_videoResolutionLimit === "screen") {
522
+ throttlers.limitResolution = {
523
+ video: (0, event_listeners_1.getScreenResolutionRef)(currentContentCanceller.signal),
524
+ };
525
+ }
526
+ /** Options used by the adaptive logic. */
527
+ var adaptiveOptions = {
528
+ initialBitrates: this._priv_bitrateInfos.lastBitrates,
529
+ lowLatencyMode: lowLatencyMode,
530
+ throttlers: throttlers,
531
+ };
532
+ /** Options used by the TextTrack SegmentSink. */
533
+ var textTrackOptions = options.textTrackMode === "native"
534
+ ? { textTrackMode: "native" }
535
+ : {
536
+ textTrackMode: "html",
537
+ textTrackElement: options.textTrackElement,
538
+ };
539
+ var bufferOptions = (0, object_assign_1.default)({ enableFastSwitching: enableFastSwitching, onCodecSwitch: onCodecSwitch }, this._priv_bufferOptions);
540
+ var segmentRequestOptions = {
541
+ lowLatencyMode: lowLatencyMode,
542
+ maxRetry: (_d = requestConfig.segment) === null || _d === void 0 ? void 0 : _d.maxRetry,
543
+ requestTimeout: (_e = requestConfig.segment) === null || _e === void 0 ? void 0 : _e.timeout,
544
+ connectionTimeout: (_f = requestConfig.segment) === null || _f === void 0 ? void 0 : _f.connectionTimeout,
545
+ };
546
+ var canRunInMultiThread = features_1.default.multithread !== null &&
547
+ this._priv_worker !== null &&
548
+ transport === "dash" &&
549
+ MULTI_THREAD_UNSUPPORTED_LOAD_VIDEO_OPTIONS.every(function (option) {
550
+ return (0, is_null_or_undefined_1.default)(options[option]);
551
+ }) &&
552
+ typeof options.representationFilter !== "function";
553
+ if (mode === "main" || (mode === "auto" && !canRunInMultiThread)) {
554
+ if (features_1.default.mainThreadMediaSourceInit === null) {
555
+ throw new Error("Cannot load video, neither in a WebWorker nor with the " +
556
+ "`MEDIA_SOURCE_MAIN` feature");
557
+ }
558
+ var transportFn = features_1.default.transports[transport];
559
+ if (typeof transportFn !== "function") {
560
+ // Stop previous content and reset its state
561
+ this.stop();
562
+ this._priv_currentError = null;
563
+ throw new Error("transport \"".concat(transport, "\" not supported"));
564
+ }
565
+ var representationFilter = typeof options.representationFilter === "string"
566
+ ? (0, manifest_1.createRepresentationFilterFromFnString)(options.representationFilter)
567
+ : options.representationFilter;
568
+ log_1.default.info("API: Initializing MediaSource mode in the main thread");
569
+ var transportPipelines = transportFn({
570
+ lowLatencyMode: lowLatencyMode,
571
+ checkMediaSegmentIntegrity: checkMediaSegmentIntegrity,
572
+ manifestLoader: manifestLoader,
573
+ referenceDateTime: referenceDateTime,
574
+ representationFilter: representationFilter,
575
+ segmentLoader: segmentLoader,
576
+ serverSyncInfos: serverSyncInfos,
577
+ __priv_manifestUpdateUrl: __priv_manifestUpdateUrl,
578
+ __priv_patchLastSegmentInSidx: __priv_patchLastSegmentInSidx,
579
+ });
580
+ initializer = new features_1.default.mainThreadMediaSourceInit({
581
+ adaptiveOptions: adaptiveOptions,
582
+ autoPlay: autoPlay,
583
+ bufferOptions: bufferOptions,
584
+ keySystems: keySystems,
585
+ lowLatencyMode: lowLatencyMode,
586
+ transport: transportPipelines,
587
+ manifestRequestSettings: manifestRequestSettings,
588
+ segmentRequestOptions: segmentRequestOptions,
589
+ speed: this._priv_speed,
590
+ startAt: startAt,
591
+ textTrackOptions: textTrackOptions,
592
+ url: url,
593
+ });
594
+ }
595
+ else {
596
+ if (features_1.default.multithread === null) {
597
+ throw new Error("Cannot load video in multithread mode: `MULTI_THREAD` " +
598
+ "feature not imported.");
599
+ }
600
+ else if (this._priv_worker === null) {
601
+ throw new Error("Cannot load video in multithread mode: `attachWorker` " +
602
+ "method not called.");
603
+ }
604
+ (0, assert_1.default)(typeof options.representationFilter !== "function");
605
+ useWorker = true;
606
+ log_1.default.info("API: Initializing MediaSource mode in a WebWorker");
607
+ var transportOptions = {
608
+ lowLatencyMode: lowLatencyMode,
609
+ checkMediaSegmentIntegrity: checkMediaSegmentIntegrity,
610
+ referenceDateTime: referenceDateTime,
611
+ serverSyncInfos: serverSyncInfos,
612
+ manifestLoader: undefined,
613
+ segmentLoader: undefined,
614
+ representationFilter: options.representationFilter,
615
+ __priv_manifestUpdateUrl: __priv_manifestUpdateUrl,
616
+ __priv_patchLastSegmentInSidx: __priv_patchLastSegmentInSidx,
617
+ };
618
+ initializer = new features_1.default.multithread.init({
619
+ adaptiveOptions: adaptiveOptions,
620
+ autoPlay: autoPlay,
621
+ bufferOptions: bufferOptions,
622
+ keySystems: keySystems,
623
+ lowLatencyMode: lowLatencyMode,
624
+ transportOptions: transportOptions,
625
+ manifestRequestSettings: manifestRequestSettings,
626
+ segmentRequestOptions: segmentRequestOptions,
627
+ speed: this._priv_speed,
628
+ startAt: startAt,
629
+ textTrackOptions: textTrackOptions,
630
+ worker: this._priv_worker,
631
+ url: url,
632
+ });
633
+ }
634
+ }
635
+ else {
636
+ if (features_1.default.directfile === null) {
637
+ this.stop();
638
+ this._priv_currentError = null;
639
+ throw new Error("DirectFile feature not activated in your build.");
640
+ }
641
+ else if ((0, is_null_or_undefined_1.default)(url)) {
642
+ throw new Error("No URL for a DirectFile content");
643
+ }
644
+ log_1.default.info("API: Initializing DirectFile mode in the main thread");
645
+ mediaElementTracksStore = this._priv_initializeMediaElementTracksStore(currentContentCanceller.signal);
646
+ if (currentContentCanceller.isUsed()) {
647
+ return;
648
+ }
649
+ initializer = new features_1.default.directfile.initDirectFile({
650
+ autoPlay: autoPlay,
651
+ keySystems: keySystems,
652
+ speed: this._priv_speed,
653
+ startAt: startAt,
654
+ url: url,
655
+ });
656
+ }
657
+ /** Future `this._priv_contentInfos` related to this content. */
658
+ var contentInfos = {
659
+ contentId: generateContentId(),
660
+ originalUrl: url,
661
+ currentContentCanceller: currentContentCanceller,
662
+ defaultAudioTrackSwitchingMode: defaultAudioTrackSwitchingMode,
663
+ initializer: initializer,
664
+ isDirectFile: isDirectFile,
665
+ segmentSinksStore: null,
666
+ manifest: null,
667
+ currentPeriod: null,
668
+ activeAdaptations: null,
669
+ activeRepresentations: null,
670
+ tracksStore: null,
671
+ mediaElementTracksStore: mediaElementTracksStore,
672
+ useWorker: useWorker,
673
+ };
674
+ // Bind events
675
+ initializer.addEventListener("error", function (error) {
676
+ _this._priv_onFatalError(error, contentInfos);
677
+ });
678
+ initializer.addEventListener("warning", function (error) {
679
+ var formattedError = (0, errors_1.formatError)(error, {
680
+ defaultCode: "NONE",
681
+ defaultReason: "An unknown error happened.",
682
+ });
683
+ log_1.default.warn("API: Sending warning:", formattedError);
684
+ _this.trigger("warning", formattedError);
685
+ });
686
+ initializer.addEventListener("reloadingMediaSource", function (payload) {
687
+ contentInfos.segmentSinksStore = null;
688
+ if (contentInfos.tracksStore !== null) {
689
+ contentInfos.tracksStore.resetPeriodObjects();
690
+ }
691
+ _this._priv_lastAutoPlay = payload.autoPlay;
692
+ });
693
+ initializer.addEventListener("inbandEvents", function (inbandEvents) {
694
+ return _this.trigger("inbandEvents", inbandEvents);
695
+ });
696
+ initializer.addEventListener("streamEvent", function (streamEvent) {
697
+ return _this.trigger("streamEvent", streamEvent);
698
+ });
699
+ initializer.addEventListener("streamEventSkip", function (streamEventSkip) {
700
+ return _this.trigger("streamEventSkip", streamEventSkip);
701
+ });
702
+ initializer.addEventListener("activePeriodChanged", function (periodInfo) {
703
+ return _this._priv_onActivePeriodChanged(contentInfos, periodInfo);
704
+ });
705
+ initializer.addEventListener("periodStreamReady", function (periodReadyInfo) {
706
+ return _this._priv_onPeriodStreamReady(contentInfos, periodReadyInfo);
707
+ });
708
+ initializer.addEventListener("periodStreamCleared", function (periodClearedInfo) {
709
+ return _this._priv_onPeriodStreamCleared(contentInfos, periodClearedInfo);
710
+ });
711
+ initializer.addEventListener("representationChange", function (representationInfo) {
712
+ return _this._priv_onRepresentationChange(contentInfos, representationInfo);
713
+ });
714
+ initializer.addEventListener("adaptationChange", function (adaptationInfo) {
715
+ return _this._priv_onAdaptationChange(contentInfos, adaptationInfo);
716
+ });
717
+ initializer.addEventListener("bitrateEstimateChange", function (bitrateEstimateInfo) {
718
+ return _this._priv_onBitrateEstimateChange(bitrateEstimateInfo);
719
+ });
720
+ initializer.addEventListener("manifestReady", function (manifest) {
721
+ return _this._priv_onManifestReady(contentInfos, manifest);
722
+ });
723
+ initializer.addEventListener("manifestUpdate", function (updates) {
724
+ return _this._priv_onManifestUpdate(contentInfos, updates);
725
+ });
726
+ initializer.addEventListener("decipherabilityUpdate", function (updates) {
727
+ return _this._priv_onDecipherabilityUpdate(contentInfos, updates);
728
+ });
729
+ initializer.addEventListener("loaded", function (evt) {
730
+ contentInfos.segmentSinksStore = evt.segmentSinksStore;
731
+ });
732
+ // Now, that most events are linked, prepare the next content.
733
+ initializer.prepare();
734
+ // Now that the content is prepared, stop previous content and reset state
735
+ // This is done after content preparation as `stop` could technically have
736
+ // a long and synchronous blocking time.
737
+ // Note that this call is done **synchronously** after all events linking.
738
+ // This is **VERY** important so:
739
+ // - the `STOPPED` state is switched to synchronously after loading a new
740
+ // content.
741
+ // - we can avoid involontarily catching events linked to the previous
742
+ // content.
743
+ this.stop();
744
+ /** Global "playback observer" which will emit playback conditions */
745
+ var playbackObserver = new media_element_playback_observer_1.default(videoElement, {
746
+ withMediaSource: !isDirectFile,
747
+ lowLatencyMode: lowLatencyMode,
748
+ });
749
+ currentContentCanceller.signal.register(function () {
750
+ playbackObserver.stop();
751
+ });
752
+ // Update the RxPlayer's state at the right events
753
+ var playerStateRef = (0, utils_1.constructPlayerStateReference)(initializer, videoElement, playbackObserver, currentContentCanceller.signal);
754
+ currentContentCanceller.signal.register(function () {
755
+ initializer.dispose();
756
+ });
757
+ /**
758
+ * Function updating `this._priv_reloadingMetadata` in function of the
759
+ * current state and playback conditions.
760
+ * To call when either might change.
761
+ * @param {string} state - The player state we're about to switch to.
762
+ */
763
+ var updateReloadingMetadata = function (state) {
764
+ switch (state) {
765
+ case "STOPPED":
766
+ case "RELOADING":
767
+ case "LOADING":
768
+ break; // keep previous metadata
769
+ case "ENDED":
770
+ _this._priv_reloadingMetadata.reloadInPause = true;
771
+ _this._priv_reloadingMetadata.reloadPosition = playbackObserver
772
+ .getReference()
773
+ .getValue()
774
+ .position.getPolled();
775
+ break;
776
+ default:
777
+ var o = playbackObserver.getReference().getValue();
778
+ _this._priv_reloadingMetadata.reloadInPause = o.paused;
779
+ _this._priv_reloadingMetadata.reloadPosition = o.position.getWanted();
780
+ break;
781
+ }
782
+ };
783
+ /**
784
+ * `TaskCanceller` allowing to stop emitting `"play"` and `"pause"`
785
+ * events.
786
+ * `null` when such events are not emitted currently.
787
+ */
788
+ var playPauseEventsCanceller = null;
789
+ /**
790
+ * Callback emitting `"play"` and `"pause`" events once the content is
791
+ * loaded, starting from the state indicated in argument.
792
+ * @param {boolean} willAutoPlay - If `false`, we're currently paused.
793
+ */
794
+ var triggerPlayPauseEventsWhenReady = function (willAutoPlay) {
795
+ if (playPauseEventsCanceller !== null) {
796
+ playPauseEventsCanceller.cancel(); // cancel previous logic
797
+ playPauseEventsCanceller = null;
798
+ }
799
+ playerStateRef.onUpdate(function (val, stopListeningToStateUpdates) {
800
+ if (!(0, utils_1.isLoadedState)(val)) {
801
+ return; // content not loaded yet: no event
802
+ }
803
+ stopListeningToStateUpdates();
804
+ if (playPauseEventsCanceller !== null) {
805
+ playPauseEventsCanceller.cancel();
806
+ }
807
+ playPauseEventsCanceller = new task_canceller_1.default();
808
+ playPauseEventsCanceller.linkToSignal(currentContentCanceller.signal);
809
+ if (willAutoPlay !== !videoElement.paused) {
810
+ // paused status is not at the expected value on load: emit event
811
+ if (videoElement.paused) {
812
+ _this.trigger("pause", null);
813
+ }
814
+ else {
815
+ _this.trigger("play", null);
816
+ }
817
+ }
818
+ (0, utils_1.emitPlayPauseEvents)(videoElement, function () { return _this.trigger("play", null); }, function () { return _this.trigger("pause", null); }, currentContentCanceller.signal);
819
+ }, {
820
+ emitCurrentValue: false,
821
+ clearSignal: currentContentCanceller.signal,
822
+ });
823
+ };
824
+ triggerPlayPauseEventsWhenReady(autoPlay);
825
+ initializer.addEventListener("reloadingMediaSource", function (payload) {
826
+ triggerPlayPauseEventsWhenReady(payload.autoPlay);
827
+ });
828
+ this._priv_currentError = null;
829
+ this._priv_contentInfos = contentInfos;
830
+ /**
831
+ * `TaskCanceller` allowing to stop emitting `"seeking"` and `"seeked"`
832
+ * events.
833
+ * `null` when such events are not emitted currently.
834
+ */
835
+ var seekEventsCanceller = null;
836
+ // React to player state change
837
+ playerStateRef.onUpdate(function (newState) {
838
+ updateReloadingMetadata(newState);
839
+ _this._priv_setPlayerState(newState);
840
+ if (currentContentCanceller.isUsed()) {
841
+ return;
842
+ }
843
+ if (seekEventsCanceller !== null) {
844
+ if (!(0, utils_1.isLoadedState)(_this.state)) {
845
+ seekEventsCanceller.cancel();
846
+ seekEventsCanceller = null;
847
+ }
848
+ }
849
+ else if ((0, utils_1.isLoadedState)(_this.state)) {
850
+ seekEventsCanceller = new task_canceller_1.default();
851
+ seekEventsCanceller.linkToSignal(currentContentCanceller.signal);
852
+ (0, utils_1.emitSeekEvents)(videoElement, playbackObserver, function () { return _this.trigger("seeking", null); }, function () { return _this.trigger("seeked", null); }, seekEventsCanceller.signal);
853
+ }
854
+ }, { emitCurrentValue: true, clearSignal: currentContentCanceller.signal });
855
+ // React to playback conditions change
856
+ playbackObserver.listen(function (observation) {
857
+ updateReloadingMetadata(_this.state);
858
+ _this._priv_triggerPositionUpdate(contentInfos, observation);
859
+ }, { clearSignal: currentContentCanceller.signal });
860
+ currentContentCanceller.signal.register(function () {
861
+ initializer.removeEventListener();
862
+ });
863
+ // initialize the content only when the lock is inactive
864
+ this._priv_contentLock.onUpdate(function (isLocked, stopListeningToLock) {
865
+ if (!isLocked) {
866
+ stopListeningToLock();
867
+ // start playback!
868
+ initializer.start(videoElement, playbackObserver);
869
+ }
870
+ }, { emitCurrentValue: true, clearSignal: currentContentCanceller.signal });
871
+ };
872
+ /**
873
+ * Returns fatal error if one for the current content.
874
+ * null otherwise.
875
+ * @returns {Object|null} - The current Error (`null` when no error).
876
+ */
877
+ Player.prototype.getError = function () {
878
+ return this._priv_currentError;
879
+ };
880
+ /**
881
+ * Returns the media DOM element used by the player.
882
+ * You should not its HTML5 API directly and use the player's method instead,
883
+ * to ensure a well-behaved player.
884
+ * @returns {HTMLMediaElement|null} - The HTMLMediaElement used (`null` when
885
+ * disposed)
886
+ */
887
+ Player.prototype.getVideoElement = function () {
888
+ return this.videoElement;
889
+ };
890
+ /**
891
+ * Returns the player's current state.
892
+ * @returns {string} - The current Player's state
893
+ */
894
+ Player.prototype.getPlayerState = function () {
895
+ return this.state;
896
+ };
897
+ /**
898
+ * Returns true if a content is loaded.
899
+ * @returns {Boolean} - `true` if a content is loaded, `false` otherwise.
900
+ */
901
+ Player.prototype.isContentLoaded = function () {
902
+ return !(0, array_includes_1.default)(["LOADING", "RELOADING", "STOPPED"], this.state);
903
+ };
904
+ /**
905
+ * Returns true if the player is buffering.
906
+ * @returns {Boolean} - `true` if the player is buffering, `false` otherwise.
907
+ */
908
+ Player.prototype.isBuffering = function () {
909
+ return (0, array_includes_1.default)(["BUFFERING", "SEEKING", "LOADING", "RELOADING"], this.state);
910
+ };
911
+ /**
912
+ * Returns the play/pause status of the player :
913
+ * - when `LOADING` or `RELOADING`, returns the scheduled play/pause condition
914
+ * for when loading is over,
915
+ * - in other states, returns the `<video>` element .paused value,
916
+ * - if the player is disposed, returns `true`.
917
+ * @returns {Boolean} - `true` if the player is paused or will be after loading,
918
+ * `false` otherwise.
919
+ */
920
+ Player.prototype.isPaused = function () {
921
+ if (this.videoElement) {
922
+ if ((0, array_includes_1.default)(["LOADING", "RELOADING"], this.state)) {
923
+ return !this._priv_lastAutoPlay;
924
+ }
925
+ else {
926
+ return this.videoElement.paused;
927
+ }
928
+ }
929
+ return true;
930
+ };
931
+ /**
932
+ * Returns true if both:
933
+ * - a content is loaded
934
+ * - the content loaded is a live content
935
+ * @returns {Boolean} - `true` if we're playing a live content, `false` otherwise.
936
+ */
937
+ Player.prototype.isLive = function () {
938
+ if (this._priv_contentInfos === null) {
939
+ return false;
940
+ }
941
+ var _a = this._priv_contentInfos, isDirectFile = _a.isDirectFile, manifest = _a.manifest;
942
+ if (isDirectFile || manifest === null) {
943
+ return false;
944
+ }
945
+ return manifest.isLive;
946
+ };
947
+ /**
948
+ * Returns `true` if trickmode playback is active (usually through the usage
949
+ * of the `setPlaybackRate` method), which means that the RxPlayer selects
950
+ * "trickmode" video tracks in priority.
951
+ * @returns {Boolean}
952
+ */
953
+ Player.prototype.areTrickModeTracksEnabled = function () {
954
+ return this._priv_preferTrickModeTracks;
955
+ };
956
+ /**
957
+ * Returns the URL(s) of the currently considered Manifest, or of the content for
958
+ * directfile content.
959
+ * @returns {Array.<string>|undefined} - Current URL. `undefined` if not known
960
+ * or no URL yet.
961
+ */
962
+ Player.prototype.getContentUrls = function () {
963
+ if (this._priv_contentInfos === null) {
964
+ return undefined;
965
+ }
966
+ var _a = this._priv_contentInfos, isDirectFile = _a.isDirectFile, manifest = _a.manifest, originalUrl = _a.originalUrl;
967
+ if (isDirectFile) {
968
+ return originalUrl === undefined ? undefined : [originalUrl];
969
+ }
970
+ if (manifest !== null) {
971
+ return manifest.uris;
972
+ }
973
+ return undefined;
974
+ };
975
+ /**
976
+ * Update URL of the content currently being played (e.g. DASH's MPD).
977
+ * @param {Array.<string>|undefined} urls - URLs to reach that content /
978
+ * Manifest from the most prioritized URL to the least prioritized URL.
979
+ * @param {Object|undefined} [params]
980
+ * @param {boolean} params.refresh - If `true` the resource in question
981
+ * (e.g. DASH's MPD) will be refreshed immediately.
982
+ */
983
+ Player.prototype.updateContentUrls = function (urls, params) {
984
+ if (this._priv_contentInfos === null) {
985
+ throw new Error("No content loaded");
986
+ }
987
+ var refreshNow = (params === null || params === void 0 ? void 0 : params.refresh) === true;
988
+ this._priv_contentInfos.initializer.updateContentUrls(urls, refreshNow);
989
+ };
990
+ /**
991
+ * Returns the video duration, in seconds.
992
+ * NaN if no video is playing.
993
+ * @returns {Number}
994
+ */
995
+ Player.prototype.getMediaDuration = function () {
996
+ if (this.videoElement === null) {
997
+ throw new Error("Disposed player");
998
+ }
999
+ return this.videoElement.duration;
1000
+ };
1001
+ /**
1002
+ * Returns in seconds the difference between:
1003
+ * - the end of the current contiguous loaded range.
1004
+ * - the current time
1005
+ * @returns {Number}
1006
+ */
1007
+ Player.prototype.getCurrentBufferGap = function () {
1008
+ if (this.videoElement === null) {
1009
+ throw new Error("Disposed player");
1010
+ }
1011
+ var videoElement = this.videoElement;
1012
+ var bufferGap = (0, ranges_1.getLeftSizeOfBufferedTimeRange)(videoElement.buffered, videoElement.currentTime);
1013
+ if (bufferGap === Infinity) {
1014
+ return 0;
1015
+ }
1016
+ return bufferGap;
1017
+ };
1018
+ /**
1019
+ * Get the current position, in s, in wall-clock time.
1020
+ * That is:
1021
+ * - for live content, get a timestamp, in s, of the current played content.
1022
+ * - for static content, returns the position from beginning in s.
1023
+ *
1024
+ * If you do not know if you want to use this method or getPosition:
1025
+ * - If what you want is to display the current time to the user, use this
1026
+ * one.
1027
+ * - If what you want is to interact with the player's API or perform other
1028
+ * actions (like statistics) with the real player data, use getPosition.
1029
+ *
1030
+ * @returns {Number}
1031
+ */
1032
+ Player.prototype.getWallClockTime = function () {
1033
+ if (this.videoElement === null) {
1034
+ throw new Error("Disposed player");
1035
+ }
1036
+ if (this._priv_contentInfos === null) {
1037
+ return this.videoElement.currentTime;
1038
+ }
1039
+ var _a = this._priv_contentInfos, isDirectFile = _a.isDirectFile, manifest = _a.manifest;
1040
+ if (isDirectFile) {
1041
+ var startDate = (0, get_start_date_1.default)(this.videoElement);
1042
+ return (startDate !== null && startDate !== void 0 ? startDate : 0) + this.videoElement.currentTime;
1043
+ }
1044
+ if (manifest !== null) {
1045
+ var currentTime = this.videoElement.currentTime;
1046
+ var ast = manifest.availabilityStartTime !== undefined ? manifest.availabilityStartTime : 0;
1047
+ return currentTime + ast;
1048
+ }
1049
+ return 0;
1050
+ };
1051
+ /**
1052
+ * Get the current position, in seconds, of the video element.
1053
+ *
1054
+ * If you do not know if you want to use this method or getWallClockTime:
1055
+ * - If what you want is to display the current time to the user, use
1056
+ * getWallClockTime.
1057
+ * - If what you want is to interact with the player's API or perform other
1058
+ * actions (like statistics) with the real player data, use this one.
1059
+ *
1060
+ * @returns {Number}
1061
+ */
1062
+ Player.prototype.getPosition = function () {
1063
+ if (this.videoElement === null) {
1064
+ throw new Error("Disposed player");
1065
+ }
1066
+ return this.videoElement.currentTime;
1067
+ };
1068
+ /**
1069
+ * Returns the last stored content position, in seconds.
1070
+ *
1071
+ * @returns {number|undefined}
1072
+ */
1073
+ Player.prototype.getLastStoredContentPosition = function () {
1074
+ return this._priv_reloadingMetadata.reloadPosition;
1075
+ };
1076
+ /**
1077
+ * Returns the current playback rate at which the video plays.
1078
+ * @returns {Number}
1079
+ */
1080
+ Player.prototype.getPlaybackRate = function () {
1081
+ return this._priv_speed.getValue();
1082
+ };
1083
+ /**
1084
+ * Update the playback rate of the video.
1085
+ *
1086
+ * This method's effect is persisted from content to content, and can be
1087
+ * called even when no content is playing (it will still have an effect for
1088
+ * the next contents).
1089
+ *
1090
+ * If you want to reverse effects provoked by `setPlaybackRate` before playing
1091
+ * another content, you will have to call `setPlaybackRate` first with the
1092
+ * default settings you want to set.
1093
+ *
1094
+ * As an example, to reset the speed to "normal" (x1) speed and to disable
1095
+ * trickMode video tracks (which may have been enabled by a previous
1096
+ * `setPlaybackRate` call), you can call:
1097
+ * ```js
1098
+ * player.setPlaybackRate(1, { preferTrickModeTracks: false });
1099
+ * ```
1100
+ *
1101
+ * --
1102
+ *
1103
+ * This method can be used to switch to or exit from "trickMode" video tracks,
1104
+ * which are tracks specifically defined to mimic the visual aspect of a VCR's
1105
+ * fast forward/rewind feature, by only displaying a few video frames during
1106
+ * playback.
1107
+ *
1108
+ * This behavior is configurable through the second argument, by adding a
1109
+ * property named `preferTrickModeTracks` to that object.
1110
+ *
1111
+ * You can set that value to `true` to switch to trickMode video tracks when
1112
+ * available, and set it to `false` when you want to disable that logic.
1113
+ * Note that like any configuration given to `setPlaybackRate`, this setting
1114
+ * is persisted through all future contents played by the player.
1115
+ *
1116
+ * If you want to stop enabling trickMode tracks, you will have to call
1117
+ * `setPlaybackRate` again with `preferTrickModeTracks` set to `false`.
1118
+ *
1119
+ * You can know at any moment whether this behavior is enabled by calling
1120
+ * the `areTrickModeTracksEnabled` method. This will only means that the
1121
+ * RxPlayer will select in priority trickmode video tracks, not that the
1122
+ * currently chosen video tracks is a trickmode track (for example, some
1123
+ * contents may have no trickmode tracks available).
1124
+ *
1125
+ * If you want to know about the latter instead, you can call `getVideoTrack`
1126
+ * and/or listen to `videoTrackChange` events. The track returned may have an
1127
+ * `isTrickModeTrack` property set to `true`, indicating that it is a
1128
+ * trickmode track.
1129
+ *
1130
+ * Note that switching to or getting out of a trickmode video track may
1131
+ * lead to the player being a brief instant in a `"RELOADING"` state (notified
1132
+ * through `playerStateChange` events and the `getLoadedContentState` method).
1133
+ * When in that state, a black screen may be displayed and multiple RxPlayer
1134
+ * APIs will not be usable.
1135
+ *
1136
+ * @param {Number} rate
1137
+ * @param {Object} opts
1138
+ */
1139
+ Player.prototype.setPlaybackRate = function (rate, opts) {
1140
+ var _a;
1141
+ if (rate !== this._priv_speed.getValue()) {
1142
+ this._priv_speed.setValue(rate);
1143
+ }
1144
+ var preferTrickModeTracks = opts === null || opts === void 0 ? void 0 : opts.preferTrickModeTracks;
1145
+ if (typeof preferTrickModeTracks !== "boolean") {
1146
+ return;
1147
+ }
1148
+ this._priv_preferTrickModeTracks = preferTrickModeTracks;
1149
+ var tracksStore = (_a = this._priv_contentInfos) === null || _a === void 0 ? void 0 : _a.tracksStore;
1150
+ if (!(0, is_null_or_undefined_1.default)(tracksStore)) {
1151
+ if (preferTrickModeTracks && !tracksStore.isTrickModeEnabled()) {
1152
+ tracksStore.enableVideoTrickModeTracks();
1153
+ }
1154
+ else if (!preferTrickModeTracks && tracksStore.isTrickModeEnabled()) {
1155
+ tracksStore.disableVideoTrickModeTracks();
1156
+ }
1157
+ }
1158
+ };
1159
+ /**
1160
+ * Returns video Representation currently considered for the current Period.
1161
+ *
1162
+ * Returns `null` if no video track is playing for the current Period.
1163
+ *
1164
+ * Returns `undefined` either when are not currently playing any Period or
1165
+ * when we don't know which Representation is playing.
1166
+ * @returns {Object|null|undefined}
1167
+ */
1168
+ Player.prototype.getVideoRepresentation = function () {
1169
+ var representations = this.__priv_getCurrentRepresentations();
1170
+ if (representations === null) {
1171
+ return undefined;
1172
+ }
1173
+ return representations.video;
1174
+ };
1175
+ /**
1176
+ * Returns audio Representation currently considered for the current Period.
1177
+ *
1178
+ * Returns `null` if no audio track is playing for the current Period.
1179
+ *
1180
+ * Returns `undefined` either when are not currently playing any Period or
1181
+ * when we don't know which Representation is playing.
1182
+ * @returns {Object|null|undefined}
1183
+ */
1184
+ Player.prototype.getAudioRepresentation = function () {
1185
+ var representations = this.__priv_getCurrentRepresentations();
1186
+ if (representations === null) {
1187
+ return undefined;
1188
+ }
1189
+ return representations.audio;
1190
+ };
1191
+ /**
1192
+ * Play/Resume the current video.
1193
+ * @returns {Promise}
1194
+ */
1195
+ Player.prototype.play = function () {
1196
+ var _this = this;
1197
+ if (this.videoElement === null) {
1198
+ throw new Error("Disposed player");
1199
+ }
1200
+ var playPromise = this.videoElement.play();
1201
+ /* eslint-disable @typescript-eslint/unbound-method */
1202
+ if ((0, is_null_or_undefined_1.default)(playPromise) || typeof playPromise.catch !== "function") {
1203
+ /* eslint-enable @typescript-eslint/unbound-method */
1204
+ return Promise.resolve();
1205
+ }
1206
+ return playPromise.catch(function (error) {
1207
+ if (error.name === "NotAllowedError") {
1208
+ var warning = new errors_1.MediaError("MEDIA_ERR_PLAY_NOT_ALLOWED", error.toString());
1209
+ _this.trigger("warning", warning);
1210
+ }
1211
+ throw error;
1212
+ });
1213
+ };
1214
+ /**
1215
+ * Pause the current video.
1216
+ */
1217
+ Player.prototype.pause = function () {
1218
+ if (this.videoElement === null) {
1219
+ throw new Error("Disposed player");
1220
+ }
1221
+ this.videoElement.pause();
1222
+ };
1223
+ /**
1224
+ * Seek to a given absolute position.
1225
+ * @param {Number|Object} time
1226
+ * @returns {Number} - The time the player has seek to
1227
+ */
1228
+ Player.prototype.seekTo = function (time) {
1229
+ var _a;
1230
+ if (this.videoElement === null) {
1231
+ throw new Error("Disposed player");
1232
+ }
1233
+ if (this._priv_contentInfos === null) {
1234
+ throw new Error("player: no content loaded");
1235
+ }
1236
+ var _b = this._priv_contentInfos, isDirectFile = _b.isDirectFile, manifest = _b.manifest;
1237
+ if (!isDirectFile && manifest === null) {
1238
+ throw new Error("player: the content did not load yet");
1239
+ }
1240
+ var positionWanted;
1241
+ if (typeof time === "number") {
1242
+ positionWanted = time;
1243
+ }
1244
+ else if (typeof time === "object") {
1245
+ var timeObj = time;
1246
+ var currentTs = this.videoElement.currentTime;
1247
+ if (!(0, is_null_or_undefined_1.default)(timeObj.relative)) {
1248
+ positionWanted = currentTs + timeObj.relative;
1249
+ }
1250
+ else if (!(0, is_null_or_undefined_1.default)(timeObj.position)) {
1251
+ positionWanted = timeObj.position;
1252
+ }
1253
+ else if (!(0, is_null_or_undefined_1.default)(timeObj.wallClockTime)) {
1254
+ if (manifest !== null) {
1255
+ positionWanted = timeObj.wallClockTime - ((_a = manifest.availabilityStartTime) !== null && _a !== void 0 ? _a : 0);
1256
+ }
1257
+ else if (isDirectFile && this.videoElement !== null) {
1258
+ var startDate = (0, get_start_date_1.default)(this.videoElement);
1259
+ if (startDate !== undefined) {
1260
+ positionWanted = timeObj.wallClockTime - startDate;
1261
+ }
1262
+ }
1263
+ if (positionWanted === undefined) {
1264
+ positionWanted = timeObj.wallClockTime;
1265
+ }
1266
+ }
1267
+ else {
1268
+ throw new Error("invalid time object. You must set one of the " +
1269
+ 'following properties: "relative", "position" or ' +
1270
+ '"wallClockTime"');
1271
+ }
1272
+ }
1273
+ if (positionWanted === undefined) {
1274
+ throw new Error("invalid time given");
1275
+ }
1276
+ log_1.default.info("API: API Seek to", positionWanted);
1277
+ this.videoElement.currentTime = positionWanted;
1278
+ return positionWanted;
1279
+ };
1280
+ /**
1281
+ * Returns the current player's audio volume on the media element.
1282
+ * From 0 (no audio) to 1 (maximum volume).
1283
+ * @returns {Number}
1284
+ */
1285
+ Player.prototype.getVolume = function () {
1286
+ if (this.videoElement === null) {
1287
+ throw new Error("Disposed player");
1288
+ }
1289
+ return this.videoElement.volume;
1290
+ };
1291
+ /**
1292
+ * Set the player's audio volume. From 0 (no volume) to 1 (maximum volume).
1293
+ * @param {Number} volume
1294
+ */
1295
+ Player.prototype.setVolume = function (volume) {
1296
+ if (this.videoElement === null) {
1297
+ throw new Error("Disposed player");
1298
+ }
1299
+ var videoElement = this.videoElement;
1300
+ if (volume !== videoElement.volume) {
1301
+ videoElement.volume = volume;
1302
+ }
1303
+ };
1304
+ /**
1305
+ * Returns `true` if audio is currently muted.
1306
+ * @returns {Boolean}
1307
+ */
1308
+ Player.prototype.isMute = function () {
1309
+ var _a;
1310
+ return ((_a = this.videoElement) === null || _a === void 0 ? void 0 : _a.muted) === true;
1311
+ };
1312
+ /**
1313
+ * Mute audio.
1314
+ */
1315
+ Player.prototype.mute = function () {
1316
+ if (this.videoElement === null) {
1317
+ throw new Error("Disposed player");
1318
+ }
1319
+ if (!this.videoElement.muted) {
1320
+ this.videoElement.muted = true;
1321
+ }
1322
+ };
1323
+ /**
1324
+ * Unmute audio.
1325
+ */
1326
+ Player.prototype.unMute = function () {
1327
+ if (this.videoElement === null) {
1328
+ throw new Error("Disposed player");
1329
+ }
1330
+ if (this.videoElement.muted) {
1331
+ this.videoElement.muted = false;
1332
+ }
1333
+ };
1334
+ /**
1335
+ * Set the max buffer size for the buffer behind the current position.
1336
+ * Every buffer data before will be removed.
1337
+ * @param {Number} depthInSeconds
1338
+ */
1339
+ Player.prototype.setMaxBufferBehind = function (depthInSeconds) {
1340
+ this._priv_bufferOptions.maxBufferBehind.setValue(depthInSeconds);
1341
+ };
1342
+ /**
1343
+ * Set the max buffer size for the buffer behind the current position.
1344
+ * Every buffer data before will be removed.
1345
+ * @param {Number} depthInSeconds
1346
+ */
1347
+ Player.prototype.setMaxBufferAhead = function (depthInSeconds) {
1348
+ this._priv_bufferOptions.maxBufferAhead.setValue(depthInSeconds);
1349
+ };
1350
+ /**
1351
+ * Set the max buffer size for the buffer ahead of the current position.
1352
+ * The player will stop downloading chunks when this size is reached.
1353
+ * @param {Number} sizeInSeconds
1354
+ */
1355
+ Player.prototype.setWantedBufferAhead = function (sizeInSeconds) {
1356
+ this._priv_bufferOptions.wantedBufferAhead.setValue(sizeInSeconds);
1357
+ };
1358
+ /**
1359
+ * Set the max buffer size the buffer should take in memory
1360
+ * The player . will stop downloading chunks when this size is reached.
1361
+ * @param {Number} sizeInKBytes
1362
+ */
1363
+ Player.prototype.setMaxVideoBufferSize = function (sizeInKBytes) {
1364
+ this._priv_bufferOptions.maxVideoBufferSize.setValue(sizeInKBytes);
1365
+ };
1366
+ /**
1367
+ * Returns the max buffer size for the buffer behind the current position.
1368
+ * @returns {Number}
1369
+ */
1370
+ Player.prototype.getMaxBufferBehind = function () {
1371
+ return this._priv_bufferOptions.maxBufferBehind.getValue();
1372
+ };
1373
+ /**
1374
+ * Returns the max buffer size for the buffer behind the current position.
1375
+ * @returns {Number}
1376
+ */
1377
+ Player.prototype.getMaxBufferAhead = function () {
1378
+ return this._priv_bufferOptions.maxBufferAhead.getValue();
1379
+ };
1380
+ /**
1381
+ * Returns the max buffer size for the buffer ahead of the current position.
1382
+ * @returns {Number}
1383
+ */
1384
+ Player.prototype.getWantedBufferAhead = function () {
1385
+ return this._priv_bufferOptions.wantedBufferAhead.getValue();
1386
+ };
1387
+ /**
1388
+ * Returns the max buffer memory size for the buffer in kilobytes
1389
+ * @returns {Number}
1390
+ */
1391
+ Player.prototype.getMaxVideoBufferSize = function () {
1392
+ return this._priv_bufferOptions.maxVideoBufferSize.getValue();
1393
+ };
1394
+ Player.prototype.getCurrentPeriod = function () {
1395
+ var _a;
1396
+ var currentPeriod = (_a = this._priv_contentInfos) === null || _a === void 0 ? void 0 : _a.currentPeriod;
1397
+ if ((0, is_null_or_undefined_1.default)(currentPeriod)) {
1398
+ return null;
1399
+ }
1400
+ return {
1401
+ id: currentPeriod.id,
1402
+ start: currentPeriod.start,
1403
+ end: currentPeriod.end,
1404
+ };
1405
+ };
1406
+ /**
1407
+ * Returns both the name of the key system (e.g. `"com.widevine.alpha"`) and
1408
+ * the `MediaKeySystemConfiguration` currently associated to the
1409
+ * HTMLMediaElement linked to the RxPlayer.
1410
+ *
1411
+ * Returns `null` if no such capabilities is associated or if unknown.
1412
+ * @returns {Object|null}
1413
+ */
1414
+ Player.prototype.getKeySystemConfiguration = function () {
1415
+ if (this.videoElement === null) {
1416
+ throw new Error("Disposed player");
1417
+ }
1418
+ var values = (0, decrypt_1.getKeySystemConfiguration)(this.videoElement);
1419
+ if (values === null) {
1420
+ return null;
1421
+ }
1422
+ return { keySystem: values[0], configuration: values[1] };
1423
+ };
1424
+ /**
1425
+ * Returns the list of available Periods for which the current audio, video or
1426
+ * text track can now be changed.
1427
+ * @returns {Array.<Object>}
1428
+ */
1429
+ Player.prototype.getAvailablePeriods = function () {
1430
+ if (this._priv_contentInfos === null) {
1431
+ return [];
1432
+ }
1433
+ var _a = this._priv_contentInfos, isDirectFile = _a.isDirectFile, tracksStore = _a.tracksStore;
1434
+ if (isDirectFile) {
1435
+ return [];
1436
+ }
1437
+ if (tracksStore === null) {
1438
+ return [];
1439
+ }
1440
+ return tracksStore.getAvailablePeriods().slice();
1441
+ };
1442
+ /**
1443
+ * Returns every available audio tracks for a given Period - or the current
1444
+ * one if no `periodId` is given.
1445
+ * @param {string|undefined} [periodId]
1446
+ * @returns {Array.<Object>}
1447
+ */
1448
+ Player.prototype.getAvailableAudioTracks = function (periodId) {
1449
+ var _a;
1450
+ if (this._priv_contentInfos === null) {
1451
+ return [];
1452
+ }
1453
+ var _b = this._priv_contentInfos, isDirectFile = _b.isDirectFile, mediaElementTracksStore = _b.mediaElementTracksStore;
1454
+ if (isDirectFile) {
1455
+ return (_a = mediaElementTracksStore === null || mediaElementTracksStore === void 0 ? void 0 : mediaElementTracksStore.getAvailableAudioTracks()) !== null && _a !== void 0 ? _a : [];
1456
+ }
1457
+ return this._priv_callTracksStoreGetterSetter(periodId, [], function (tcm, periodRef) { var _a; return (_a = tcm.getAvailableAudioTracks(periodRef)) !== null && _a !== void 0 ? _a : []; });
1458
+ };
1459
+ /**
1460
+ * Returns every available text tracks for a given Period - or the current
1461
+ * one if no `periodId` is given.
1462
+ * @param {string|undefined} [periodId]
1463
+ * @returns {Array.<Object>}
1464
+ */
1465
+ Player.prototype.getAvailableTextTracks = function (periodId) {
1466
+ var _a;
1467
+ if (this._priv_contentInfos === null) {
1468
+ return [];
1469
+ }
1470
+ var _b = this._priv_contentInfos, isDirectFile = _b.isDirectFile, mediaElementTracksStore = _b.mediaElementTracksStore;
1471
+ if (isDirectFile) {
1472
+ return (_a = mediaElementTracksStore === null || mediaElementTracksStore === void 0 ? void 0 : mediaElementTracksStore.getAvailableTextTracks()) !== null && _a !== void 0 ? _a : [];
1473
+ }
1474
+ return this._priv_callTracksStoreGetterSetter(periodId, [], function (tcm, periodRef) { var _a; return (_a = tcm.getAvailableTextTracks(periodRef)) !== null && _a !== void 0 ? _a : []; });
1475
+ };
1476
+ /**
1477
+ * Returns every available video tracks for the current Period.
1478
+ * @param {string|undefined} [periodId]
1479
+ * @returns {Array.<Object>}
1480
+ */
1481
+ Player.prototype.getAvailableVideoTracks = function (periodId) {
1482
+ var _a;
1483
+ if (this._priv_contentInfos === null) {
1484
+ return [];
1485
+ }
1486
+ var _b = this._priv_contentInfos, isDirectFile = _b.isDirectFile, mediaElementTracksStore = _b.mediaElementTracksStore;
1487
+ if (isDirectFile) {
1488
+ return (_a = mediaElementTracksStore === null || mediaElementTracksStore === void 0 ? void 0 : mediaElementTracksStore.getAvailableVideoTracks()) !== null && _a !== void 0 ? _a : [];
1489
+ }
1490
+ return this._priv_callTracksStoreGetterSetter(periodId, [], function (tcm, periodRef) { var _a; return (_a = tcm.getAvailableVideoTracks(periodRef)) !== null && _a !== void 0 ? _a : []; });
1491
+ };
1492
+ /**
1493
+ * Returns currently chosen audio language for the current Period.
1494
+ * @param {string|undefined} [periodId]
1495
+ * @returns {Object|null|undefined}
1496
+ */
1497
+ Player.prototype.getAudioTrack = function (periodId) {
1498
+ if (this._priv_contentInfos === null) {
1499
+ return undefined;
1500
+ }
1501
+ var _a = this._priv_contentInfos, isDirectFile = _a.isDirectFile, mediaElementTracksStore = _a.mediaElementTracksStore;
1502
+ if (isDirectFile) {
1503
+ if (mediaElementTracksStore === null) {
1504
+ return undefined;
1505
+ }
1506
+ return mediaElementTracksStore.getChosenAudioTrack();
1507
+ }
1508
+ return this._priv_callTracksStoreGetterSetter(periodId, undefined, function (tcm, periodRef) {
1509
+ return tcm.getChosenAudioTrack(periodRef);
1510
+ });
1511
+ };
1512
+ /**
1513
+ * Returns currently chosen subtitle for the current Period.
1514
+ * @param {string|undefined} [periodId]
1515
+ * @returns {Object|null|undefined}
1516
+ */
1517
+ Player.prototype.getTextTrack = function (periodId) {
1518
+ if (this._priv_contentInfos === null) {
1519
+ return undefined;
1520
+ }
1521
+ var _a = this._priv_contentInfos, isDirectFile = _a.isDirectFile, mediaElementTracksStore = _a.mediaElementTracksStore;
1522
+ if (isDirectFile) {
1523
+ if (mediaElementTracksStore === null) {
1524
+ return undefined;
1525
+ }
1526
+ return mediaElementTracksStore.getChosenTextTrack();
1527
+ }
1528
+ return this._priv_callTracksStoreGetterSetter(periodId, undefined, function (tcm, periodRef) {
1529
+ return tcm.getChosenTextTrack(periodRef);
1530
+ });
1531
+ };
1532
+ /**
1533
+ * Returns currently chosen video track for the current Period.
1534
+ * @param {string|undefined} [periodId]
1535
+ * @returns {Object|null|undefined}
1536
+ */
1537
+ Player.prototype.getVideoTrack = function (periodId) {
1538
+ if (this._priv_contentInfos === null) {
1539
+ return undefined;
1540
+ }
1541
+ var _a = this._priv_contentInfos, isDirectFile = _a.isDirectFile, mediaElementTracksStore = _a.mediaElementTracksStore;
1542
+ if (isDirectFile) {
1543
+ if (mediaElementTracksStore === null) {
1544
+ return undefined;
1545
+ }
1546
+ return mediaElementTracksStore.getChosenVideoTrack();
1547
+ }
1548
+ return this._priv_callTracksStoreGetterSetter(periodId, undefined, function (tcm, periodRef) {
1549
+ return tcm.getChosenVideoTrack(periodRef);
1550
+ });
1551
+ };
1552
+ /**
1553
+ * Update the audio language for the current Period.
1554
+ * @param {string | object} arg
1555
+ * @throws Error - the current content has no TracksStore.
1556
+ * @throws Error - the given id is linked to no audio track.
1557
+ */
1558
+ Player.prototype.setAudioTrack = function (arg) {
1559
+ var _a;
1560
+ if (this._priv_contentInfos === null) {
1561
+ throw new Error("No content loaded");
1562
+ }
1563
+ var _b = this._priv_contentInfos, isDirectFile = _b.isDirectFile, mediaElementTracksStore = _b.mediaElementTracksStore;
1564
+ if (isDirectFile) {
1565
+ try {
1566
+ var audioId = typeof arg === "string" ? arg : arg.trackId;
1567
+ mediaElementTracksStore === null || mediaElementTracksStore === void 0 ? void 0 : mediaElementTracksStore.setAudioTrackById(audioId);
1568
+ return;
1569
+ }
1570
+ catch (e) {
1571
+ throw new Error("player: unknown audio track");
1572
+ }
1573
+ }
1574
+ var periodId;
1575
+ var trackId;
1576
+ var switchingMode;
1577
+ var lockedRepresentations = null;
1578
+ var relativeResumingPosition;
1579
+ if (typeof arg === "string") {
1580
+ trackId = arg;
1581
+ }
1582
+ else {
1583
+ trackId = arg.trackId;
1584
+ periodId = arg.periodId;
1585
+ switchingMode = arg.switchingMode;
1586
+ lockedRepresentations = (_a = arg.lockedRepresentations) !== null && _a !== void 0 ? _a : null;
1587
+ relativeResumingPosition = arg.relativeResumingPosition;
1588
+ }
1589
+ return this._priv_callTracksStoreGetterSetter(periodId, undefined, function (tcm, periodRef) {
1590
+ return tcm.setAudioTrack({
1591
+ periodRef: periodRef,
1592
+ trackId: trackId,
1593
+ switchingMode: switchingMode,
1594
+ lockedRepresentations: lockedRepresentations,
1595
+ relativeResumingPosition: relativeResumingPosition,
1596
+ });
1597
+ });
1598
+ };
1599
+ /**
1600
+ * Update the text language for the current Period.
1601
+ * @param {string | Object} arg
1602
+ * @throws Error - the current content has no TracksStore.
1603
+ * @throws Error - the given id is linked to no text track.
1604
+ */
1605
+ Player.prototype.setTextTrack = function (arg) {
1606
+ if (this._priv_contentInfos === null) {
1607
+ throw new Error("No content loaded");
1608
+ }
1609
+ var _a = this._priv_contentInfos, isDirectFile = _a.isDirectFile, mediaElementTracksStore = _a.mediaElementTracksStore;
1610
+ if (isDirectFile) {
1611
+ try {
1612
+ var textId = typeof arg === "string" ? arg : arg.trackId;
1613
+ mediaElementTracksStore === null || mediaElementTracksStore === void 0 ? void 0 : mediaElementTracksStore.setTextTrackById(textId);
1614
+ return;
1615
+ }
1616
+ catch (e) {
1617
+ throw new Error("player: unknown text track");
1618
+ }
1619
+ }
1620
+ var periodId;
1621
+ var trackId;
1622
+ if (typeof arg === "string") {
1623
+ trackId = arg;
1624
+ }
1625
+ else {
1626
+ trackId = arg.trackId;
1627
+ periodId = arg.periodId;
1628
+ }
1629
+ return this._priv_callTracksStoreGetterSetter(periodId, undefined, function (tcm, periodRef) {
1630
+ return tcm.setTextTrack(periodRef, trackId);
1631
+ });
1632
+ };
1633
+ /**
1634
+ * Disable subtitles for the current content.
1635
+ * @param {string|undefined} [periodId]
1636
+ */
1637
+ Player.prototype.disableTextTrack = function (periodId) {
1638
+ if (this._priv_contentInfos === null) {
1639
+ return;
1640
+ }
1641
+ var _a = this._priv_contentInfos, isDirectFile = _a.isDirectFile, mediaElementTracksStore = _a.mediaElementTracksStore;
1642
+ if (isDirectFile) {
1643
+ mediaElementTracksStore === null || mediaElementTracksStore === void 0 ? void 0 : mediaElementTracksStore.disableTextTrack();
1644
+ return;
1645
+ }
1646
+ return this._priv_callTracksStoreGetterSetter(periodId, undefined, function (tcm, periodRef) {
1647
+ return tcm.disableTrack(periodRef, "text");
1648
+ });
1649
+ };
1650
+ /**
1651
+ * Update the video track for the current Period.
1652
+ * @param {string | Object} arg
1653
+ * @throws Error - the current content has no TracksStore.
1654
+ * @throws Error - the given id is linked to no video track.
1655
+ */
1656
+ Player.prototype.setVideoTrack = function (arg) {
1657
+ var _a;
1658
+ if (this._priv_contentInfos === null) {
1659
+ throw new Error("No content loaded");
1660
+ }
1661
+ var _b = this._priv_contentInfos, isDirectFile = _b.isDirectFile, mediaElementTracksStore = _b.mediaElementTracksStore;
1662
+ if (isDirectFile) {
1663
+ try {
1664
+ var videoId = typeof arg === "string" ? arg : arg.trackId;
1665
+ mediaElementTracksStore === null || mediaElementTracksStore === void 0 ? void 0 : mediaElementTracksStore.setVideoTrackById(videoId);
1666
+ return;
1667
+ }
1668
+ catch (e) {
1669
+ throw new Error("player: unknown video track");
1670
+ }
1671
+ }
1672
+ var periodId;
1673
+ var trackId;
1674
+ var switchingMode;
1675
+ var lockedRepresentations = null;
1676
+ var relativeResumingPosition;
1677
+ if (typeof arg === "string") {
1678
+ trackId = arg;
1679
+ }
1680
+ else {
1681
+ trackId = arg.trackId;
1682
+ periodId = arg.periodId;
1683
+ switchingMode = arg.switchingMode;
1684
+ lockedRepresentations = (_a = arg.lockedRepresentations) !== null && _a !== void 0 ? _a : null;
1685
+ relativeResumingPosition = arg.relativeResumingPosition;
1686
+ }
1687
+ return this._priv_callTracksStoreGetterSetter(periodId, undefined, function (tcm, periodRef) {
1688
+ return tcm.setVideoTrack({
1689
+ periodRef: periodRef,
1690
+ trackId: trackId,
1691
+ switchingMode: switchingMode,
1692
+ lockedRepresentations: lockedRepresentations,
1693
+ relativeResumingPosition: relativeResumingPosition,
1694
+ });
1695
+ });
1696
+ };
1697
+ /**
1698
+ * Disable video track for the current content.
1699
+ * @param {string|undefined} [periodId]
1700
+ */
1701
+ Player.prototype.disableVideoTrack = function (periodId) {
1702
+ if (this._priv_contentInfos === null) {
1703
+ return;
1704
+ }
1705
+ var _a = this._priv_contentInfos, isDirectFile = _a.isDirectFile, mediaElementTracksStore = _a.mediaElementTracksStore;
1706
+ if (isDirectFile && mediaElementTracksStore !== null) {
1707
+ return mediaElementTracksStore.disableVideoTrack();
1708
+ }
1709
+ return this._priv_callTracksStoreGetterSetter(periodId, undefined, function (tcm, periodRef) {
1710
+ return tcm.disableTrack(periodRef, "video");
1711
+ });
1712
+ };
1713
+ Player.prototype.lockVideoRepresentations = function (arg) {
1714
+ if (this._priv_contentInfos === null) {
1715
+ throw new Error("No content loaded");
1716
+ }
1717
+ var isDirectFile = this._priv_contentInfos.isDirectFile;
1718
+ if (isDirectFile) {
1719
+ throw new Error("Cannot lock video Representations in directfile mode.");
1720
+ }
1721
+ var repsId;
1722
+ var periodId;
1723
+ var switchingMode;
1724
+ if (Array.isArray(arg)) {
1725
+ repsId = arg;
1726
+ periodId = undefined;
1727
+ }
1728
+ else {
1729
+ repsId = arg.representations;
1730
+ periodId = arg.periodId;
1731
+ switchingMode = arg.switchingMode;
1732
+ }
1733
+ return this._priv_callTracksStoreGetterSetter(periodId, undefined, function (tcm, periodRef) {
1734
+ return tcm.lockVideoRepresentations(periodRef, {
1735
+ representations: repsId,
1736
+ switchingMode: switchingMode,
1737
+ });
1738
+ });
1739
+ };
1740
+ Player.prototype.lockAudioRepresentations = function (arg) {
1741
+ if (this._priv_contentInfos === null) {
1742
+ throw new Error("No content loaded");
1743
+ }
1744
+ var isDirectFile = this._priv_contentInfos.isDirectFile;
1745
+ if (isDirectFile) {
1746
+ throw new Error("Cannot lock audio Representations in directfile mode.");
1747
+ }
1748
+ var repsId;
1749
+ var periodId;
1750
+ var switchingMode;
1751
+ if (Array.isArray(arg)) {
1752
+ repsId = arg;
1753
+ periodId = undefined;
1754
+ }
1755
+ else {
1756
+ repsId = arg.representations;
1757
+ periodId = arg.periodId;
1758
+ switchingMode = arg.switchingMode;
1759
+ }
1760
+ return this._priv_callTracksStoreGetterSetter(periodId, undefined, function (tcm, periodRef) {
1761
+ return tcm.lockAudioRepresentations(periodRef, {
1762
+ representations: repsId,
1763
+ switchingMode: switchingMode,
1764
+ });
1765
+ });
1766
+ };
1767
+ Player.prototype.getLockedVideoRepresentations = function (periodId) {
1768
+ if (this._priv_contentInfos === null) {
1769
+ return null;
1770
+ }
1771
+ var isDirectFile = this._priv_contentInfos.isDirectFile;
1772
+ if (isDirectFile) {
1773
+ return null;
1774
+ }
1775
+ return this._priv_callTracksStoreGetterSetter(periodId, null, function (tcm, periodRef) {
1776
+ return tcm.getLockedVideoRepresentations(periodRef);
1777
+ });
1778
+ };
1779
+ Player.prototype.getLockedAudioRepresentations = function (periodId) {
1780
+ if (this._priv_contentInfos === null) {
1781
+ return null;
1782
+ }
1783
+ var isDirectFile = this._priv_contentInfos.isDirectFile;
1784
+ if (isDirectFile) {
1785
+ return null;
1786
+ }
1787
+ return this._priv_callTracksStoreGetterSetter(periodId, null, function (tcm, periodRef) {
1788
+ return tcm.getLockedAudioRepresentations(periodRef);
1789
+ });
1790
+ };
1791
+ Player.prototype.unlockVideoRepresentations = function (periodId) {
1792
+ if (this._priv_contentInfos === null) {
1793
+ return;
1794
+ }
1795
+ var isDirectFile = this._priv_contentInfos.isDirectFile;
1796
+ if (isDirectFile) {
1797
+ return;
1798
+ }
1799
+ return this._priv_callTracksStoreGetterSetter(periodId, undefined, function (tcm, periodRef) {
1800
+ return tcm.unlockVideoRepresentations(periodRef);
1801
+ });
1802
+ };
1803
+ Player.prototype.unlockAudioRepresentations = function (periodId) {
1804
+ if (this._priv_contentInfos === null) {
1805
+ return;
1806
+ }
1807
+ var isDirectFile = this._priv_contentInfos.isDirectFile;
1808
+ if (isDirectFile) {
1809
+ return;
1810
+ }
1811
+ return this._priv_callTracksStoreGetterSetter(periodId, undefined, function (tcm, periodRef) {
1812
+ return tcm.unlockAudioRepresentations(periodRef);
1813
+ });
1814
+ };
1815
+ /**
1816
+ * Get minimum seek-able position.
1817
+ * @returns {number}
1818
+ */
1819
+ Player.prototype.getMinimumPosition = function () {
1820
+ if (this._priv_contentInfos === null) {
1821
+ return null;
1822
+ }
1823
+ if (this._priv_contentInfos.isDirectFile) {
1824
+ return 0;
1825
+ }
1826
+ var manifest = this._priv_contentInfos.manifest;
1827
+ if (manifest !== null) {
1828
+ return (0, manifest_1.getMinimumSafePosition)(manifest);
1829
+ }
1830
+ return null;
1831
+ };
1832
+ /**
1833
+ * Returns the current position for live contents.
1834
+ *
1835
+ * Returns `null` if no content is loaded or if the current loaded content is
1836
+ * not considered as a live content.
1837
+ * Returns `undefined` if that live position is currently unknown.
1838
+ * @returns {number}
1839
+ */
1840
+ Player.prototype.getLivePosition = function () {
1841
+ if (this._priv_contentInfos === null) {
1842
+ return null;
1843
+ }
1844
+ var _a = this._priv_contentInfos, isDirectFile = _a.isDirectFile, manifest = _a.manifest;
1845
+ if (isDirectFile) {
1846
+ return undefined;
1847
+ }
1848
+ if ((manifest === null || manifest === void 0 ? void 0 : manifest.isLive) !== true) {
1849
+ return null;
1850
+ }
1851
+ return (0, manifest_1.getLivePosition)(manifest);
1852
+ };
1853
+ /**
1854
+ * Get maximum seek-able position.
1855
+ * @returns {number}
1856
+ */
1857
+ Player.prototype.getMaximumPosition = function () {
1858
+ if (this._priv_contentInfos === null) {
1859
+ return null;
1860
+ }
1861
+ var _a = this._priv_contentInfos, isDirectFile = _a.isDirectFile, manifest = _a.manifest;
1862
+ if (isDirectFile) {
1863
+ if (this.videoElement === null) {
1864
+ throw new Error("Disposed player");
1865
+ }
1866
+ return this.videoElement.duration;
1867
+ }
1868
+ if (manifest !== null) {
1869
+ if (!manifest.isDynamic && this.videoElement !== null) {
1870
+ return this.videoElement.duration;
1871
+ }
1872
+ return (0, manifest_1.getMaximumSafePosition)(manifest);
1873
+ }
1874
+ return null;
1875
+ };
1876
+ // ---- Undocumented Private methods. ----
1877
+ //
1878
+ // Those methods are just here either to allow some tools relying on the
1879
+ // RxPlayer instance to work or to improve the RxPlayer's demo.
1880
+ //
1881
+ // They should not be used by any external code.
1882
+ /**
1883
+ * /!\ For demo use only! Do not touch!
1884
+ *
1885
+ * Returns every chunk buffered for a given buffer type.
1886
+ * Returns `null` if no SegmentSink was created for this type of buffer.
1887
+ * @param {string} bufferType
1888
+ * @returns {Array.<Object>|null}
1889
+ */
1890
+ Player.prototype.__priv_getSegmentSinkContent = function (bufferType) {
1891
+ if (this._priv_contentInfos === null ||
1892
+ this._priv_contentInfos.segmentSinksStore === null) {
1893
+ return null;
1894
+ }
1895
+ var segmentSinkStatus = this._priv_contentInfos.segmentSinksStore.getStatus(bufferType);
1896
+ if (segmentSinkStatus.type === "initialized") {
1897
+ return segmentSinkStatus.value.getLastKnownInventory();
1898
+ }
1899
+ return null;
1900
+ };
1901
+ /**
1902
+ * /!\ For tools use only! Do not touch!
1903
+ *
1904
+ * Returns manifest/playlist object.
1905
+ * null if the player is STOPPED.
1906
+ * @returns {Manifest|null} - The current Manifest (`null` when not known).
1907
+ */
1908
+ // TODO remove the need for that public method
1909
+ Player.prototype.__priv_getManifest = function () {
1910
+ if (this._priv_contentInfos === null) {
1911
+ return null;
1912
+ }
1913
+ return this._priv_contentInfos.manifest;
1914
+ };
1915
+ // TODO remove the need for that public method
1916
+ Player.prototype.__priv_getCurrentAdaptation = function () {
1917
+ if (this._priv_contentInfos === null) {
1918
+ return null;
1919
+ }
1920
+ var _a = this._priv_contentInfos, currentPeriod = _a.currentPeriod, activeAdaptations = _a.activeAdaptations;
1921
+ if (currentPeriod === null ||
1922
+ activeAdaptations === null ||
1923
+ (0, is_null_or_undefined_1.default)(activeAdaptations[currentPeriod.id])) {
1924
+ return null;
1925
+ }
1926
+ return activeAdaptations[currentPeriod.id];
1927
+ };
1928
+ // TODO remove the need for that public method
1929
+ Player.prototype.__priv_getCurrentRepresentations = function () {
1930
+ if (this._priv_contentInfos === null) {
1931
+ return null;
1932
+ }
1933
+ var _a = this._priv_contentInfos, currentPeriod = _a.currentPeriod, activeRepresentations = _a.activeRepresentations;
1934
+ if (currentPeriod === null ||
1935
+ activeRepresentations === null ||
1936
+ (0, is_null_or_undefined_1.default)(activeRepresentations[currentPeriod.id])) {
1937
+ return null;
1938
+ }
1939
+ return activeRepresentations[currentPeriod.id];
1940
+ };
1941
+ // ---- Private methods ----
1942
+ /**
1943
+ * Reset all state properties relative to a playing content.
1944
+ */
1945
+ Player.prototype._priv_cleanUpCurrentContentState = function () {
1946
+ var _this = this;
1947
+ var _a, _b, _c, _d;
1948
+ log_1.default.debug("Locking `contentLock` to clean-up the current content.");
1949
+ // lock playback of new contents while cleaning up is pending
1950
+ this._priv_contentLock.setValue(true);
1951
+ (_b = (_a = this._priv_contentInfos) === null || _a === void 0 ? void 0 : _a.tracksStore) === null || _b === void 0 ? void 0 : _b.dispose();
1952
+ (_d = (_c = this._priv_contentInfos) === null || _c === void 0 ? void 0 : _c.mediaElementTracksStore) === null || _d === void 0 ? void 0 : _d.dispose();
1953
+ this._priv_contentInfos = null;
1954
+ this._priv_contentEventsMemory = {};
1955
+ // DRM-related clean-up
1956
+ var freeUpContentLock = function () {
1957
+ if (_this.videoElement !== null) {
1958
+ // If not disposed
1959
+ log_1.default.debug("Unlocking `contentLock`. Next content can begin.");
1960
+ _this._priv_contentLock.setValue(false);
1961
+ }
1962
+ };
1963
+ if (!(0, is_null_or_undefined_1.default)(this.videoElement)) {
1964
+ (0, decrypt_1.clearOnStop)(this.videoElement).then(function () {
1965
+ log_1.default.debug("API: DRM session cleaned-up with success!");
1966
+ freeUpContentLock();
1967
+ }, function (err) {
1968
+ log_1.default.error("API: An error arised when trying to clean-up the DRM session:" +
1969
+ (err instanceof Error ? err.toString() : "Unknown Error"));
1970
+ freeUpContentLock();
1971
+ });
1972
+ }
1973
+ else {
1974
+ freeUpContentLock();
1975
+ }
1976
+ };
1977
+ /**
1978
+ * Triggered when the Manifest has been loaded for the current content.
1979
+ * Initialize various private properties and emit initial event.
1980
+ * @param {Object} contentInfos
1981
+ * @param {Object} manifest
1982
+ */
1983
+ Player.prototype._priv_onManifestReady = function (contentInfos, manifest) {
1984
+ var _this = this;
1985
+ var _a;
1986
+ if (contentInfos.contentId !== ((_a = this._priv_contentInfos) === null || _a === void 0 ? void 0 : _a.contentId)) {
1987
+ return; // Event for another content
1988
+ }
1989
+ contentInfos.manifest = manifest;
1990
+ if (manifest.manifestFormat === 0 /* ManifestMetadataFormat.Class */) {
1991
+ this._priv_reloadingMetadata.manifest = manifest;
1992
+ }
1993
+ var tracksStore = new tracks_store_1.default({
1994
+ preferTrickModeTracks: this._priv_preferTrickModeTracks,
1995
+ defaultAudioTrackSwitchingMode: contentInfos.defaultAudioTrackSwitchingMode,
1996
+ });
1997
+ contentInfos.tracksStore = tracksStore;
1998
+ tracksStore.addEventListener("newAvailablePeriods", function (p) {
1999
+ _this.trigger("newAvailablePeriods", p);
2000
+ });
2001
+ tracksStore.addEventListener("brokenRepresentationsLock", function (e) {
2002
+ _this.trigger("brokenRepresentationsLock", e);
2003
+ });
2004
+ tracksStore.addEventListener("trackUpdate", function (e) {
2005
+ var _a, _b;
2006
+ _this.trigger("trackUpdate", e);
2007
+ var currentPeriod = (_b = (_a = _this._priv_contentInfos) === null || _a === void 0 ? void 0 : _a.currentPeriod) !== null && _b !== void 0 ? _b : undefined;
2008
+ if (e.reason === "no-playable-representation" &&
2009
+ e.period.id === (currentPeriod === null || currentPeriod === void 0 ? void 0 : currentPeriod.id)) {
2010
+ _this._priv_onAvailableTracksMayHaveChanged(e.trackType);
2011
+ }
2012
+ });
2013
+ contentInfos.tracksStore.addEventListener("warning", function (err) {
2014
+ _this.trigger("warning", err);
2015
+ });
2016
+ contentInfos.tracksStore.addEventListener("error", function (err) {
2017
+ _this._priv_onFatalError(err, contentInfos);
2018
+ });
2019
+ contentInfos.tracksStore.onManifestUpdate(manifest);
2020
+ };
2021
+ /**
2022
+ * Triggered when the Manifest has been updated for the current content.
2023
+ * Initialize various private properties and emit initial event.
2024
+ * @param {Object} contentInfos
2025
+ * @param {Object} updates
2026
+ */
2027
+ Player.prototype._priv_onManifestUpdate = function (contentInfos, updates) {
2028
+ var e_1, _a;
2029
+ var _b, _c, _d;
2030
+ if (this._priv_contentInfos === null || this._priv_contentInfos.manifest === null) {
2031
+ return;
2032
+ }
2033
+ // Update the tracks chosen if it changed
2034
+ if (!(0, is_null_or_undefined_1.default)(contentInfos === null || contentInfos === void 0 ? void 0 : contentInfos.tracksStore)) {
2035
+ contentInfos.tracksStore.onManifestUpdate(this._priv_contentInfos.manifest);
2036
+ }
2037
+ var currentPeriod = (_c = (_b = this._priv_contentInfos) === null || _b === void 0 ? void 0 : _b.currentPeriod) !== null && _c !== void 0 ? _c : undefined;
2038
+ var currTracksStore = (_d = this._priv_contentInfos) === null || _d === void 0 ? void 0 : _d.tracksStore;
2039
+ if (currentPeriod === undefined || (0, is_null_or_undefined_1.default)(currTracksStore)) {
2040
+ return;
2041
+ }
2042
+ try {
2043
+ for (var _e = __values(updates.updatedPeriods), _f = _e.next(); !_f.done; _f = _e.next()) {
2044
+ var update = _f.value;
2045
+ if (update.period.id === currentPeriod.id) {
2046
+ if (update.result.addedAdaptations.length > 0 ||
2047
+ update.result.removedAdaptations.length > 0) {
2048
+ // We might have new (or less) tracks, send events just to be sure
2049
+ var periodRef = currTracksStore.getPeriodObjectFromPeriod(currentPeriod);
2050
+ if (periodRef === undefined) {
2051
+ return;
2052
+ }
2053
+ this._priv_onAvailableTracksMayHaveChanged("audio");
2054
+ this._priv_onAvailableTracksMayHaveChanged("text");
2055
+ this._priv_onAvailableTracksMayHaveChanged("video");
2056
+ }
2057
+ }
2058
+ }
2059
+ }
2060
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
2061
+ finally {
2062
+ try {
2063
+ if (_f && !_f.done && (_a = _e.return)) _a.call(_e);
2064
+ }
2065
+ finally { if (e_1) throw e_1.error; }
2066
+ }
2067
+ };
2068
+ Player.prototype._priv_onDecipherabilityUpdate = function (contentInfos, elts) {
2069
+ var e_2, _a;
2070
+ if (contentInfos === null || contentInfos.manifest === null) {
2071
+ return;
2072
+ }
2073
+ if (!(0, is_null_or_undefined_1.default)(contentInfos === null || contentInfos === void 0 ? void 0 : contentInfos.tracksStore)) {
2074
+ contentInfos.tracksStore.onDecipherabilityUpdates();
2075
+ }
2076
+ /**
2077
+ * Array of tuples only including once the Period/Track combination, and
2078
+ * only when it concerns the currently-selected track.
2079
+ */
2080
+ var periodsAndTrackTypes = elts.reduce(function (acc, elt) {
2081
+ var _a, _b, _c;
2082
+ var isFound = (0, array_find_1.default)(acc, function (x) { return x[0].id === elt.period.id && x[1] === elt.adaptation.type; }) !== undefined;
2083
+ if (!isFound) {
2084
+ // Only consider the currently-selected tracks.
2085
+ // NOTE: Maybe there's room for optimizations? Unclear.
2086
+ var tStore = contentInfos.tracksStore;
2087
+ if (tStore === null) {
2088
+ return acc;
2089
+ }
2090
+ var isCurrent = false;
2091
+ var periodRef = tStore.getPeriodObjectFromPeriod(elt.period);
2092
+ if (periodRef === undefined) {
2093
+ return acc;
2094
+ }
2095
+ switch (elt.adaptation.type) {
2096
+ case "audio":
2097
+ isCurrent = ((_a = tStore.getChosenAudioTrack(periodRef)) === null || _a === void 0 ? void 0 : _a.id) === elt.adaptation.id;
2098
+ break;
2099
+ case "video":
2100
+ isCurrent = ((_b = tStore.getChosenVideoTrack(periodRef)) === null || _b === void 0 ? void 0 : _b.id) === elt.adaptation.id;
2101
+ break;
2102
+ case "text":
2103
+ isCurrent = ((_c = tStore.getChosenTextTrack(periodRef)) === null || _c === void 0 ? void 0 : _c.id) === elt.adaptation.id;
2104
+ break;
2105
+ }
2106
+ if (isCurrent) {
2107
+ acc.push([elt.period, elt.adaptation.type]);
2108
+ }
2109
+ }
2110
+ return acc;
2111
+ }, []);
2112
+ try {
2113
+ for (var periodsAndTrackTypes_1 = __values(periodsAndTrackTypes), periodsAndTrackTypes_1_1 = periodsAndTrackTypes_1.next(); !periodsAndTrackTypes_1_1.done; periodsAndTrackTypes_1_1 = periodsAndTrackTypes_1.next()) {
2114
+ var _b = __read(periodsAndTrackTypes_1_1.value, 2), period = _b[0], trackType = _b[1];
2115
+ this._priv_triggerEventIfNotStopped("representationListUpdate", {
2116
+ period: { start: period.start, end: period.end, id: period.id },
2117
+ trackType: trackType,
2118
+ reason: "decipherability-update",
2119
+ }, contentInfos.currentContentCanceller.signal);
2120
+ }
2121
+ }
2122
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
2123
+ finally {
2124
+ try {
2125
+ if (periodsAndTrackTypes_1_1 && !periodsAndTrackTypes_1_1.done && (_a = periodsAndTrackTypes_1.return)) _a.call(periodsAndTrackTypes_1);
2126
+ }
2127
+ finally { if (e_2) throw e_2.error; }
2128
+ }
2129
+ };
2130
+ /**
2131
+ * Triggered each times the current Period Changed.
2132
+ * Store and emit initial state for the Period.
2133
+ *
2134
+ * @param {Object} contentInfos
2135
+ * @param {Object} periodInfo
2136
+ */
2137
+ Player.prototype._priv_onActivePeriodChanged = function (contentInfos, _a) {
2138
+ var _b, _c, _d, _e, _f, _g;
2139
+ var period = _a.period;
2140
+ if (contentInfos.contentId !== ((_b = this._priv_contentInfos) === null || _b === void 0 ? void 0 : _b.contentId)) {
2141
+ return; // Event for another content
2142
+ }
2143
+ contentInfos.currentPeriod = period;
2144
+ var cancelSignal = contentInfos.currentContentCanceller.signal;
2145
+ if (this._priv_contentEventsMemory.periodChange !== period) {
2146
+ this._priv_contentEventsMemory.periodChange = period;
2147
+ this._priv_triggerEventIfNotStopped("periodChange", { start: period.start, end: period.end, id: period.id }, cancelSignal);
2148
+ }
2149
+ this._priv_triggerEventIfNotStopped("availableAudioTracksChange", this.getAvailableAudioTracks(), cancelSignal);
2150
+ this._priv_triggerEventIfNotStopped("availableTextTracksChange", this.getAvailableTextTracks(), cancelSignal);
2151
+ this._priv_triggerEventIfNotStopped("availableVideoTracksChange", this.getAvailableVideoTracks(), cancelSignal);
2152
+ var tracksStore = (_c = this._priv_contentInfos) === null || _c === void 0 ? void 0 : _c.tracksStore;
2153
+ // Emit initial events for the Period
2154
+ if (!(0, is_null_or_undefined_1.default)(tracksStore)) {
2155
+ var periodRef = tracksStore.getPeriodObjectFromPeriod(period);
2156
+ if (periodRef) {
2157
+ var audioTrack = tracksStore.getChosenAudioTrack(periodRef);
2158
+ this._priv_triggerEventIfNotStopped("audioTrackChange", audioTrack, cancelSignal);
2159
+ var textTrack = tracksStore.getChosenTextTrack(periodRef);
2160
+ this._priv_triggerEventIfNotStopped("textTrackChange", textTrack, cancelSignal);
2161
+ var videoTrack = tracksStore.getChosenVideoTrack(periodRef);
2162
+ this._priv_triggerEventIfNotStopped("videoTrackChange", videoTrack, cancelSignal);
2163
+ }
2164
+ }
2165
+ else {
2166
+ this._priv_triggerEventIfNotStopped("audioTrackChange", null, cancelSignal);
2167
+ this._priv_triggerEventIfNotStopped("textTrackChange", null, cancelSignal);
2168
+ this._priv_triggerEventIfNotStopped("videoTrackChange", null, cancelSignal);
2169
+ }
2170
+ var audioRepresentation = (_e = (_d = this.__priv_getCurrentRepresentations()) === null || _d === void 0 ? void 0 : _d.audio) !== null && _e !== void 0 ? _e : null;
2171
+ this._priv_triggerEventIfNotStopped("audioRepresentationChange", audioRepresentation, cancelSignal);
2172
+ var videoRepresentation = (_g = (_f = this.__priv_getCurrentRepresentations()) === null || _f === void 0 ? void 0 : _f.video) !== null && _g !== void 0 ? _g : null;
2173
+ this._priv_triggerEventIfNotStopped("videoRepresentationChange", videoRepresentation, cancelSignal);
2174
+ };
2175
+ /**
2176
+ * Triggered each times a new "PeriodStream" is ready.
2177
+ * Choose the right Adaptation for the Period and emit it.
2178
+ * @param {Object} contentInfos
2179
+ * @param {Object} value
2180
+ */
2181
+ Player.prototype._priv_onPeriodStreamReady = function (contentInfos, value) {
2182
+ var _a;
2183
+ if (contentInfos.contentId !== ((_a = this._priv_contentInfos) === null || _a === void 0 ? void 0 : _a.contentId)) {
2184
+ return; // Event for another content
2185
+ }
2186
+ var type = value.type, period = value.period, adaptationRef = value.adaptationRef;
2187
+ var tracksStore = contentInfos.tracksStore;
2188
+ switch (type) {
2189
+ case "video":
2190
+ case "audio":
2191
+ case "text":
2192
+ if ((0, is_null_or_undefined_1.default)(tracksStore)) {
2193
+ log_1.default.error("API: TracksStore not instanciated for a new ".concat(type, " period"));
2194
+ adaptationRef.setValue(null);
2195
+ }
2196
+ else {
2197
+ tracksStore.addTrackReference(type, period, adaptationRef);
2198
+ }
2199
+ break;
2200
+ default:
2201
+ (0, assert_1.assertUnreachable)(type);
2202
+ }
2203
+ };
2204
+ /**
2205
+ * Triggered each times we "remove" a PeriodStream.
2206
+ * @param {Object} contentInfos
2207
+ * @param {Object} value
2208
+ */
2209
+ Player.prototype._priv_onPeriodStreamCleared = function (contentInfos, value) {
2210
+ var _a;
2211
+ if (contentInfos.contentId !== ((_a = this._priv_contentInfos) === null || _a === void 0 ? void 0 : _a.contentId)) {
2212
+ return; // Event for another content
2213
+ }
2214
+ var type = value.type, period = value.period;
2215
+ var tracksStore = contentInfos.tracksStore;
2216
+ // Clean-up track choices from TracksStore
2217
+ switch (type) {
2218
+ case "audio":
2219
+ case "text":
2220
+ case "video":
2221
+ if (!(0, is_null_or_undefined_1.default)(tracksStore)) {
2222
+ tracksStore.removeTrackReference(type, period);
2223
+ }
2224
+ break;
2225
+ }
2226
+ // Clean-up stored Representation and Adaptation information
2227
+ var activeAdaptations = contentInfos.activeAdaptations, activeRepresentations = contentInfos.activeRepresentations;
2228
+ if (!(0, is_null_or_undefined_1.default)(activeAdaptations) &&
2229
+ !(0, is_null_or_undefined_1.default)(activeAdaptations[period.id])) {
2230
+ var activePeriodAdaptations = activeAdaptations[period.id];
2231
+ delete activePeriodAdaptations[type];
2232
+ if (Object.keys(activePeriodAdaptations).length === 0) {
2233
+ delete activeAdaptations[period.id];
2234
+ }
2235
+ }
2236
+ if (!(0, is_null_or_undefined_1.default)(activeRepresentations) &&
2237
+ !(0, is_null_or_undefined_1.default)(activeRepresentations[period.id])) {
2238
+ var activePeriodRepresentations = activeRepresentations[period.id];
2239
+ delete activePeriodRepresentations[type];
2240
+ if (Object.keys(activePeriodRepresentations).length === 0) {
2241
+ delete activeRepresentations[period.id];
2242
+ }
2243
+ }
2244
+ };
2245
+ /**
2246
+ * Triggered each times a new Adaptation is considered for the current
2247
+ * content.
2248
+ * Store given Adaptation and emit it if from the current Period.
2249
+ * @param {Object} contentInfos
2250
+ * @param {Object} value
2251
+ */
2252
+ Player.prototype._priv_onAdaptationChange = function (contentInfos, _a) {
2253
+ var _b;
2254
+ var _c;
2255
+ var type = _a.type, adaptation = _a.adaptation, period = _a.period;
2256
+ if (contentInfos.contentId !== ((_c = this._priv_contentInfos) === null || _c === void 0 ? void 0 : _c.contentId)) {
2257
+ return; // Event for another content
2258
+ }
2259
+ // lazily create contentInfos.activeAdaptations
2260
+ if (contentInfos.activeAdaptations === null) {
2261
+ contentInfos.activeAdaptations = {};
2262
+ }
2263
+ var activeAdaptations = contentInfos.activeAdaptations, currentPeriod = contentInfos.currentPeriod;
2264
+ var activePeriodAdaptations = activeAdaptations[period.id];
2265
+ if ((0, is_null_or_undefined_1.default)(activePeriodAdaptations)) {
2266
+ activeAdaptations[period.id] = (_b = {}, _b[type] = adaptation, _b);
2267
+ }
2268
+ else {
2269
+ activePeriodAdaptations[type] = adaptation;
2270
+ }
2271
+ var tracksStore = contentInfos.tracksStore;
2272
+ var cancelSignal = contentInfos.currentContentCanceller.signal;
2273
+ if (tracksStore !== null &&
2274
+ currentPeriod !== null &&
2275
+ !(0, is_null_or_undefined_1.default)(period) &&
2276
+ period.id === currentPeriod.id) {
2277
+ var periodRef = tracksStore.getPeriodObjectFromPeriod(period);
2278
+ if (periodRef === undefined) {
2279
+ return;
2280
+ }
2281
+ switch (type) {
2282
+ case "audio":
2283
+ var audioTrack = tracksStore.getChosenAudioTrack(periodRef);
2284
+ this._priv_triggerEventIfNotStopped("audioTrackChange", audioTrack, cancelSignal);
2285
+ break;
2286
+ case "text":
2287
+ var textTrack = tracksStore.getChosenTextTrack(periodRef);
2288
+ this._priv_triggerEventIfNotStopped("textTrackChange", textTrack, cancelSignal);
2289
+ break;
2290
+ case "video":
2291
+ var videoTrack = tracksStore.getChosenVideoTrack(periodRef);
2292
+ this._priv_triggerEventIfNotStopped("videoTrackChange", videoTrack, cancelSignal);
2293
+ break;
2294
+ }
2295
+ }
2296
+ };
2297
+ /**
2298
+ * Triggered each times a new Representation is considered during playback.
2299
+ *
2300
+ * Store given Representation and emit it if from the current Period.
2301
+ *
2302
+ * @param {Object} contentInfos
2303
+ * @param {Object} obj
2304
+ */
2305
+ Player.prototype._priv_onRepresentationChange = function (contentInfos, _a) {
2306
+ var _b;
2307
+ var _c;
2308
+ var type = _a.type, period = _a.period, representation = _a.representation;
2309
+ if (contentInfos.contentId !== ((_c = this._priv_contentInfos) === null || _c === void 0 ? void 0 : _c.contentId)) {
2310
+ return; // Event for another content
2311
+ }
2312
+ // lazily create contentInfos.activeRepresentations
2313
+ if (contentInfos.activeRepresentations === null) {
2314
+ contentInfos.activeRepresentations = {};
2315
+ }
2316
+ var activeRepresentations = contentInfos.activeRepresentations, currentPeriod = contentInfos.currentPeriod;
2317
+ var activePeriodRepresentations = activeRepresentations[period.id];
2318
+ if ((0, is_null_or_undefined_1.default)(activePeriodRepresentations)) {
2319
+ activeRepresentations[period.id] = (_b = {}, _b[type] = representation, _b);
2320
+ }
2321
+ else {
2322
+ activePeriodRepresentations[type] = representation;
2323
+ }
2324
+ if (!(0, is_null_or_undefined_1.default)(period) &&
2325
+ currentPeriod !== null &&
2326
+ currentPeriod.id === period.id) {
2327
+ var cancelSignal = this._priv_contentInfos.currentContentCanceller.signal;
2328
+ if (type === "video") {
2329
+ this._priv_triggerEventIfNotStopped("videoRepresentationChange", representation, cancelSignal);
2330
+ }
2331
+ else if (type === "audio") {
2332
+ this._priv_triggerEventIfNotStopped("audioRepresentationChange", representation, cancelSignal);
2333
+ }
2334
+ }
2335
+ };
2336
+ /**
2337
+ * Triggered each time a bitrate estimate is calculated.
2338
+ *
2339
+ * Emit it.
2340
+ *
2341
+ * @param {Object} value
2342
+ */
2343
+ Player.prototype._priv_onBitrateEstimateChange = function (_a) {
2344
+ var type = _a.type, bitrate = _a.bitrate;
2345
+ if (bitrate !== undefined) {
2346
+ this._priv_bitrateInfos.lastBitrates[type] = bitrate;
2347
+ }
2348
+ this.trigger(
2349
+ // !!! undocumented API :O !!!
2350
+ /* eslint-disable-next-line */
2351
+ "__priv_bitrateEstimateChange",
2352
+ /* eslint-disable-next-line */
2353
+ { type: type, bitrate: bitrate });
2354
+ };
2355
+ /**
2356
+ * Triggered each time the player state updates.
2357
+ *
2358
+ * Trigger the right Player Event.
2359
+ *
2360
+ * @param {string} newState
2361
+ */
2362
+ Player.prototype._priv_setPlayerState = function (newState) {
2363
+ if (this.state !== newState) {
2364
+ this.state = newState;
2365
+ log_1.default.info("API: playerStateChange event", newState);
2366
+ this.trigger("playerStateChange", newState);
2367
+ }
2368
+ };
2369
+ /**
2370
+ * Triggered each time a playback observation.
2371
+ *
2372
+ * Trigger the right Player Event
2373
+ *
2374
+ * @param {Object} contentInfos
2375
+ * @param {Object} observation
2376
+ */
2377
+ Player.prototype._priv_triggerPositionUpdate = function (contentInfos, observation) {
2378
+ var _a, _b;
2379
+ if (contentInfos.contentId !== ((_a = this._priv_contentInfos) === null || _a === void 0 ? void 0 : _a.contentId)) {
2380
+ return; // Event for another content
2381
+ }
2382
+ var isDirectFile = contentInfos.isDirectFile, manifest = contentInfos.manifest;
2383
+ if ((!isDirectFile && manifest === null) || (0, is_null_or_undefined_1.default)(observation)) {
2384
+ return;
2385
+ }
2386
+ var maximumPosition = manifest !== null ? (0, manifest_1.getMaximumSafePosition)(manifest) : undefined;
2387
+ var positionData = {
2388
+ position: observation.position.getPolled(),
2389
+ duration: observation.duration,
2390
+ playbackRate: observation.playbackRate,
2391
+ maximumPosition: maximumPosition,
2392
+ // TODO bufferGap may be undefined
2393
+ bufferGap: observation.bufferGap === undefined || !isFinite(observation.bufferGap)
2394
+ ? 0
2395
+ : observation.bufferGap,
2396
+ };
2397
+ if (manifest !== null && manifest.isLive && observation.position.getPolled() > 0) {
2398
+ var ast = (_b = manifest.availabilityStartTime) !== null && _b !== void 0 ? _b : 0;
2399
+ positionData.wallClockTime = observation.position.getPolled() + ast;
2400
+ var livePosition = (0, manifest_1.getLivePosition)(manifest);
2401
+ if (livePosition !== undefined) {
2402
+ positionData.liveGap = livePosition - observation.position.getPolled();
2403
+ }
2404
+ }
2405
+ else if (isDirectFile && this.videoElement !== null) {
2406
+ var startDate = (0, get_start_date_1.default)(this.videoElement);
2407
+ if (startDate !== undefined) {
2408
+ positionData.wallClockTime = startDate + observation.position.getPolled();
2409
+ }
2410
+ }
2411
+ this.trigger("positionUpdate", positionData);
2412
+ };
2413
+ /**
2414
+ * @param {string} evt
2415
+ * @param {*} arg
2416
+ * @param {Object} currentContentCancelSignal
2417
+ */
2418
+ Player.prototype._priv_triggerEventIfNotStopped = function (evt, arg, currentContentCancelSignal) {
2419
+ if (!currentContentCancelSignal.isCancelled()) {
2420
+ this.trigger(evt, arg);
2421
+ }
2422
+ };
2423
+ /**
2424
+ * @param {Object} cancelSignal
2425
+ * @returns {Object}
2426
+ */
2427
+ Player.prototype._priv_initializeMediaElementTracksStore = function (cancelSignal) {
2428
+ var _this = this;
2429
+ var _a, _b, _c;
2430
+ (0, assert_1.default)(features_1.default.directfile !== null, "Initializing `MediaElementTracksStore` without Directfile feature");
2431
+ (0, assert_1.default)(this.videoElement !== null, "Initializing `MediaElementTracksStore` on a disposed RxPlayer");
2432
+ var mediaElementTracksStore = new features_1.default.directfile.mediaElementTracksStore(this.videoElement);
2433
+ this._priv_triggerEventIfNotStopped("availableAudioTracksChange", mediaElementTracksStore.getAvailableAudioTracks(), cancelSignal);
2434
+ this._priv_triggerEventIfNotStopped("availableVideoTracksChange", mediaElementTracksStore.getAvailableVideoTracks(), cancelSignal);
2435
+ this._priv_triggerEventIfNotStopped("availableTextTracksChange", mediaElementTracksStore.getAvailableTextTracks(), cancelSignal);
2436
+ this._priv_triggerEventIfNotStopped("audioTrackChange", (_a = mediaElementTracksStore.getChosenAudioTrack()) !== null && _a !== void 0 ? _a : null, cancelSignal);
2437
+ this._priv_triggerEventIfNotStopped("textTrackChange", (_b = mediaElementTracksStore.getChosenTextTrack()) !== null && _b !== void 0 ? _b : null, cancelSignal);
2438
+ this._priv_triggerEventIfNotStopped("videoTrackChange", (_c = mediaElementTracksStore.getChosenVideoTrack()) !== null && _c !== void 0 ? _c : null, cancelSignal);
2439
+ mediaElementTracksStore.addEventListener("availableVideoTracksChange", function (val) {
2440
+ return _this.trigger("availableVideoTracksChange", val);
2441
+ });
2442
+ mediaElementTracksStore.addEventListener("availableAudioTracksChange", function (val) {
2443
+ return _this.trigger("availableAudioTracksChange", val);
2444
+ });
2445
+ mediaElementTracksStore.addEventListener("availableTextTracksChange", function (val) {
2446
+ return _this.trigger("availableTextTracksChange", val);
2447
+ });
2448
+ mediaElementTracksStore.addEventListener("audioTrackChange", function (val) {
2449
+ return _this.trigger("audioTrackChange", val);
2450
+ });
2451
+ mediaElementTracksStore.addEventListener("videoTrackChange", function (val) {
2452
+ return _this.trigger("videoTrackChange", val);
2453
+ });
2454
+ mediaElementTracksStore.addEventListener("textTrackChange", function (val) {
2455
+ return _this.trigger("textTrackChange", val);
2456
+ });
2457
+ return mediaElementTracksStore;
2458
+ };
2459
+ Player.prototype._priv_callTracksStoreGetterSetter = function (periodId, defaultValue, cb) {
2460
+ var _a, _b;
2461
+ if (this._priv_contentInfos === null ||
2462
+ this._priv_contentInfos.tracksStore === null) {
2463
+ log_1.default.warn("API: Trying to call track API too soon");
2464
+ return defaultValue;
2465
+ }
2466
+ var tracksStore = this._priv_contentInfos.tracksStore;
2467
+ var currentPeriod = (_b = (_a = this._priv_contentInfos) === null || _a === void 0 ? void 0 : _a.currentPeriod) !== null && _b !== void 0 ? _b : undefined;
2468
+ var wantedPeriodId = periodId !== null && periodId !== void 0 ? periodId : currentPeriod === null || currentPeriod === void 0 ? void 0 : currentPeriod.id;
2469
+ if (wantedPeriodId === undefined) {
2470
+ return defaultValue;
2471
+ }
2472
+ var periodRef = wantedPeriodId === (currentPeriod === null || currentPeriod === void 0 ? void 0 : currentPeriod.id)
2473
+ ? tracksStore.getPeriodObjectFromPeriod(currentPeriod)
2474
+ : tracksStore.getPeriodObjectFromId(wantedPeriodId);
2475
+ if (periodRef === undefined) {
2476
+ return defaultValue;
2477
+ }
2478
+ return cb(tracksStore, periodRef);
2479
+ };
2480
+ /**
2481
+ * Method to call when some event lead to a high for possibility that the
2482
+ * available tracks for the given type have changed.
2483
+ * Send the corresponding `available*Tracks` change event with the last
2484
+ * available tracks.
2485
+ *
2486
+ * @param {string} trackType
2487
+ * @param {Object|undefined} [oPeriodRef] - optional period object used by the
2488
+ * `tracksStore` API, allows to optimize the method by bypassing this step.
2489
+ */
2490
+ Player.prototype._priv_onAvailableTracksMayHaveChanged = function (trackType, oPeriodRef) {
2491
+ var contentInfos = this._priv_contentInfos;
2492
+ if (contentInfos === null) {
2493
+ return;
2494
+ }
2495
+ var currentPeriod = contentInfos.currentPeriod, tracksStore = contentInfos.tracksStore, currentContentCanceller = contentInfos.currentContentCanceller;
2496
+ var cancelSignal = currentContentCanceller.signal;
2497
+ if ((0, is_null_or_undefined_1.default)(currentPeriod) || tracksStore === null) {
2498
+ return;
2499
+ }
2500
+ var periodRef = oPeriodRef !== null && oPeriodRef !== void 0 ? oPeriodRef : tracksStore.getPeriodObjectFromPeriod(currentPeriod);
2501
+ if (periodRef === undefined) {
2502
+ return;
2503
+ }
2504
+ switch (trackType) {
2505
+ case "video":
2506
+ var videoTracks = tracksStore.getAvailableVideoTracks(periodRef);
2507
+ this._priv_triggerEventIfNotStopped("availableVideoTracksChange", videoTracks !== null && videoTracks !== void 0 ? videoTracks : [], cancelSignal);
2508
+ break;
2509
+ case "audio":
2510
+ var audioTracks = tracksStore.getAvailableAudioTracks(periodRef);
2511
+ this._priv_triggerEventIfNotStopped("availableAudioTracksChange", audioTracks !== null && audioTracks !== void 0 ? audioTracks : [], cancelSignal);
2512
+ break;
2513
+ case "text":
2514
+ var textTracks = tracksStore.getAvailableTextTracks(periodRef);
2515
+ this._priv_triggerEventIfNotStopped("availableTextTracksChange", textTracks !== null && textTracks !== void 0 ? textTracks : [], cancelSignal);
2516
+ break;
2517
+ default:
2518
+ (0, assert_1.assertUnreachable)(trackType);
2519
+ }
2520
+ };
2521
+ /**
2522
+ * Method to call when a fatal error lead to the stopping of the current
2523
+ * content.
2524
+ *
2525
+ * @param {*} err - The error encountered.
2526
+ * @param {Object} contentInfos - The `IPublicApiContentInfos` object linked
2527
+ * to the content for which the error was received.
2528
+ */
2529
+ Player.prototype._priv_onFatalError = function (err, contentInfos) {
2530
+ var formattedError = (0, errors_1.formatError)(err, {
2531
+ defaultCode: "NONE",
2532
+ defaultReason: "An unknown error stopped content playback.",
2533
+ });
2534
+ formattedError.fatal = true;
2535
+ contentInfos.currentContentCanceller.cancel();
2536
+ this._priv_cleanUpCurrentContentState();
2537
+ this._priv_currentError = formattedError;
2538
+ log_1.default.error("API: The player stopped because of an error", formattedError);
2539
+ this._priv_setPlayerState("STOPPED" /* PLAYER_STATES.STOPPED */);
2540
+ // TODO This condition is here because the eventual callback called when the
2541
+ // player state is updated can launch a new content, thus the error will not
2542
+ // be here anymore, in which case triggering the "error" event is unwanted.
2543
+ // This is very ugly though, and we should probable have a better solution
2544
+ if (this._priv_currentError === formattedError) {
2545
+ this.trigger("error", formattedError);
2546
+ }
2547
+ };
2548
+ /**
2549
+ * Store all video elements currently in use by an RxPlayer instance.
2550
+ * This is used to check that a video element is not shared between multiple instances.
2551
+ * Use of a WeakSet ensure the object is garbage collected if it's not used anymore.
2552
+ */
2553
+ Player._priv_currentlyUsedVideoElements = new WeakSet();
2554
+ return Player;
2555
+ }(event_emitter_1.default));
2556
+ Player.version = /* PLAYER_VERSION */ "4.1.0-dev.2024031100";
2557
+ exports.default = Player;