rx-player 3.26.2 → 3.27.0-dev.20220317

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 (500) hide show
  1. package/.github/workflows/perfs.yml +22 -0
  2. package/CHANGELOG.md +33 -1
  3. package/FILES.md +5 -4
  4. package/VERSION +1 -1
  5. package/dist/_esm5.processed/compat/browser_detection.d.ts +4 -2
  6. package/dist/_esm5.processed/compat/browser_detection.js +4 -2
  7. package/dist/_esm5.processed/compat/eme/close_session.d.ts +11 -5
  8. package/dist/_esm5.processed/compat/eme/close_session.js +144 -36
  9. package/dist/_esm5.processed/compat/eme/custom_media_keys/index.d.ts +3 -5
  10. package/dist/_esm5.processed/compat/eme/custom_media_keys/index.js +27 -24
  11. package/dist/_esm5.processed/compat/eme/custom_media_keys/old_webkit_media_keys.js +53 -34
  12. package/dist/_esm5.processed/compat/eme/custom_media_keys/webkit_media_keys.js +43 -41
  13. package/dist/_esm5.processed/compat/eme/generate_key_request.d.ts +2 -3
  14. package/dist/_esm5.processed/compat/eme/generate_key_request.js +22 -26
  15. package/dist/_esm5.processed/compat/eme/load_session.d.ts +1 -2
  16. package/dist/_esm5.processed/compat/eme/load_session.js +68 -17
  17. package/dist/_esm5.processed/compat/event_listeners.js +2 -1
  18. package/dist/_esm5.processed/compat/should_favour_custom_safari_EME.js +2 -2
  19. package/dist/_esm5.processed/config.d.ts +166 -1080
  20. package/dist/_esm5.processed/config.js +17 -1119
  21. package/dist/_esm5.processed/core/abr/bandwidth_estimator.js +4 -1
  22. package/dist/_esm5.processed/core/abr/buffer_based_chooser.d.ts +28 -6
  23. package/dist/_esm5.processed/core/abr/buffer_based_chooser.js +63 -12
  24. package/dist/_esm5.processed/core/abr/network_analyzer.d.ts +1 -1
  25. package/dist/_esm5.processed/core/abr/network_analyzer.js +2 -1
  26. package/dist/_esm5.processed/core/abr/pending_requests_store.js +3 -5
  27. package/dist/_esm5.processed/core/abr/representation_estimator.d.ts +1 -1
  28. package/dist/_esm5.processed/core/abr/representation_estimator.js +2 -2
  29. package/dist/_esm5.processed/core/api/get_player_state.js +1 -1
  30. package/dist/_esm5.processed/core/api/index.d.ts +2 -1
  31. package/dist/_esm5.processed/core/api/media_element_track_choice_manager.d.ts +6 -0
  32. package/dist/_esm5.processed/core/api/media_element_track_choice_manager.js +22 -4
  33. package/dist/_esm5.processed/core/api/option_utils.d.ts +3 -1
  34. package/dist/_esm5.processed/core/api/option_utils.js +19 -6
  35. package/dist/_esm5.processed/core/api/playback_observer.js +5 -1
  36. package/dist/_esm5.processed/core/api/public_api.d.ts +82 -71
  37. package/dist/_esm5.processed/core/api/public_api.js +72 -33
  38. package/dist/_esm5.processed/core/api/track_choice_manager.d.ts +6 -6
  39. package/dist/_esm5.processed/core/{eme → decrypt}/__tests__/__global__/utils.d.ts +7 -51
  40. package/dist/_esm5.processed/core/{eme → decrypt}/__tests__/__global__/utils.js +30 -75
  41. package/dist/_esm5.processed/core/{eme → decrypt}/attach_media_keys.d.ts +12 -12
  42. package/dist/_esm5.processed/core/decrypt/attach_media_keys.js +104 -0
  43. package/dist/_esm5.processed/core/{eme/clear_eme_session.d.ts → decrypt/clear_on_stop.d.ts} +3 -4
  44. package/dist/_esm5.processed/core/decrypt/clear_on_stop.js +41 -0
  45. package/dist/_esm5.processed/core/decrypt/content_decryptor.d.ts +216 -0
  46. package/dist/_esm5.processed/core/decrypt/content_decryptor.js +866 -0
  47. package/dist/_esm5.processed/core/{eme/get_session.d.ts → decrypt/create_or_load_session.d.ts} +28 -26
  48. package/dist/_esm5.processed/core/decrypt/create_or_load_session.js +124 -0
  49. package/dist/_esm5.processed/core/{eme → decrypt}/create_session.d.ts +22 -19
  50. package/dist/_esm5.processed/core/decrypt/create_session.js +174 -0
  51. package/dist/_esm5.processed/core/decrypt/dispose_decryption_resources.d.ts +21 -0
  52. package/dist/_esm5.processed/core/decrypt/dispose_decryption_resources.js +81 -0
  53. package/dist/_esm5.processed/core/{eme → decrypt}/find_key_system.d.ts +11 -14
  54. package/dist/_esm5.processed/core/decrypt/find_key_system.js +300 -0
  55. package/dist/_esm5.processed/core/{eme → decrypt}/get_current_key_system.d.ts +0 -0
  56. package/dist/_esm5.processed/core/{eme → decrypt}/get_current_key_system.js +1 -1
  57. package/dist/_esm5.processed/core/{eme → decrypt}/get_media_keys.d.ts +13 -5
  58. package/dist/_esm5.processed/core/decrypt/get_media_keys.js +153 -0
  59. package/dist/_esm5.processed/core/{eme → decrypt}/index.d.ts +5 -6
  60. package/dist/_esm5.processed/core/{eme → decrypt}/index.js +5 -5
  61. package/dist/_esm5.processed/core/{eme → decrypt}/init_media_keys.d.ts +6 -4
  62. package/dist/_esm5.processed/core/decrypt/init_media_keys.js +82 -0
  63. package/dist/_esm5.processed/core/decrypt/session_events_listener.d.ts +77 -0
  64. package/dist/_esm5.processed/core/{eme → decrypt}/session_events_listener.js +25 -24
  65. package/dist/_esm5.processed/core/{eme → decrypt}/set_server_certificate.d.ts +15 -6
  66. package/dist/_esm5.processed/core/decrypt/set_server_certificate.js +141 -0
  67. package/dist/_esm5.processed/core/{eme → decrypt}/types.d.ts +120 -242
  68. package/dist/_esm5.processed/core/{eme → decrypt}/types.js +0 -0
  69. package/dist/_esm5.processed/core/{eme → decrypt}/utils/are_init_values_compatible.d.ts +3 -3
  70. package/dist/_esm5.processed/core/{eme → decrypt}/utils/are_init_values_compatible.js +5 -5
  71. package/dist/_esm5.processed/core/{eme → decrypt/utils}/check_key_statuses.d.ts +2 -2
  72. package/dist/_esm5.processed/core/{eme → decrypt/utils}/check_key_statuses.js +4 -3
  73. package/dist/_esm5.processed/core/{eme/utils/close_session.d.ts → decrypt/utils/clean_old_loaded_sessions.d.ts} +8 -7
  74. package/dist/_esm5.processed/core/decrypt/utils/clean_old_loaded_sessions.js +85 -0
  75. package/dist/_esm5.processed/core/{eme → decrypt/utils}/clean_old_stored_persistent_info.d.ts +1 -1
  76. package/dist/_esm5.processed/core/{eme → decrypt/utils}/clean_old_stored_persistent_info.js +2 -2
  77. package/dist/_esm5.processed/core/{eme → decrypt/utils}/get_drm_system_id.d.ts +0 -0
  78. package/dist/_esm5.processed/core/{eme → decrypt/utils}/get_drm_system_id.js +1 -1
  79. package/dist/_esm5.processed/core/decrypt/utils/init_data_values_container.d.ts +69 -0
  80. package/dist/_esm5.processed/core/decrypt/utils/init_data_values_container.js +99 -0
  81. package/dist/_esm5.processed/core/{eme → decrypt}/utils/is_session_usable.d.ts +0 -1
  82. package/dist/_esm5.processed/core/{eme → decrypt}/utils/is_session_usable.js +4 -5
  83. package/dist/_esm5.processed/core/decrypt/utils/key_id_comparison.d.ts +44 -0
  84. package/dist/_esm5.processed/core/decrypt/utils/key_id_comparison.js +77 -0
  85. package/dist/_esm5.processed/core/decrypt/utils/key_session_record.d.ts +104 -0
  86. package/dist/_esm5.processed/core/decrypt/utils/key_session_record.js +155 -0
  87. package/dist/_esm5.processed/core/decrypt/utils/loaded_sessions_store.d.ts +108 -0
  88. package/dist/_esm5.processed/core/decrypt/utils/loaded_sessions_store.js +303 -0
  89. package/dist/_esm5.processed/core/{eme → decrypt/utils}/media_keys_infos_store.d.ts +4 -4
  90. package/dist/_esm5.processed/core/{eme → decrypt/utils}/media_keys_infos_store.js +0 -0
  91. package/dist/_esm5.processed/core/{eme → decrypt}/utils/persistent_sessions_store.d.ts +8 -18
  92. package/dist/_esm5.processed/core/{eme → decrypt}/utils/persistent_sessions_store.js +119 -97
  93. package/dist/_esm5.processed/core/{eme/utils/init_data_container.d.ts → decrypt/utils/serializable_bytes.d.ts} +8 -5
  94. package/dist/_esm5.processed/core/{eme/utils/init_data_container.js → decrypt/utils/serializable_bytes.js} +9 -9
  95. package/dist/_esm5.processed/core/{eme → decrypt/utils}/server_certificate_store.d.ts +1 -1
  96. package/dist/_esm5.processed/core/{eme → decrypt/utils}/server_certificate_store.js +1 -1
  97. package/dist/_esm5.processed/core/fetchers/manifest/manifest_fetcher.d.ts +4 -4
  98. package/dist/_esm5.processed/core/fetchers/manifest/manifest_fetcher.js +3 -3
  99. package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.d.ts +2 -2
  100. package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.js +6 -2
  101. package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher_creator.js +1 -1
  102. package/dist/_esm5.processed/core/fetchers/utils/try_urls_with_backoff.js +1 -1
  103. package/dist/_esm5.processed/core/init/get_initial_time.js +1 -1
  104. package/dist/_esm5.processed/core/init/initialize_directfile.d.ts +3 -3
  105. package/dist/_esm5.processed/core/init/initialize_directfile.js +11 -17
  106. package/dist/_esm5.processed/core/init/initialize_media_source.d.ts +5 -3
  107. package/dist/_esm5.processed/core/init/initialize_media_source.js +18 -69
  108. package/dist/_esm5.processed/core/init/link_drm_and_content.d.ts +61 -0
  109. package/dist/_esm5.processed/core/init/link_drm_and_content.js +94 -0
  110. package/dist/_esm5.processed/core/init/manifest_update_scheduler.d.ts +4 -4
  111. package/dist/_esm5.processed/core/init/manifest_update_scheduler.js +2 -1
  112. package/dist/_esm5.processed/core/init/stall_avoider.js +1 -1
  113. package/dist/_esm5.processed/core/init/stream_events_emitter/are_same_stream_events.d.ts +4 -4
  114. package/dist/_esm5.processed/core/init/stream_events_emitter/stream_events_emitter.js +1 -1
  115. package/dist/_esm5.processed/core/init/stream_events_emitter/types.d.ts +2 -2
  116. package/dist/_esm5.processed/core/init/types.d.ts +2 -4
  117. package/dist/_esm5.processed/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.js +1 -1
  118. package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/html_text_segment_buffer.d.ts +3 -3
  119. package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/html_text_segment_buffer.js +3 -1
  120. package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/text_track_cues_store.js +32 -31
  121. package/dist/_esm5.processed/core/segment_buffers/implementations/text/native/native_text_segment_buffer.d.ts +4 -4
  122. package/dist/_esm5.processed/core/segment_buffers/inventory/segment_inventory.d.ts +17 -1
  123. package/dist/_esm5.processed/core/segment_buffers/inventory/segment_inventory.js +22 -5
  124. package/dist/_esm5.processed/core/stream/adaptation/adaptation_stream.d.ts +2 -1
  125. package/dist/_esm5.processed/core/stream/adaptation/adaptation_stream.js +6 -3
  126. package/dist/_esm5.processed/core/stream/events_generators.d.ts +8 -3
  127. package/dist/_esm5.processed/core/stream/events_generators.js +3 -2
  128. package/dist/_esm5.processed/core/stream/orchestrator/stream_orchestrator.d.ts +1 -0
  129. package/dist/_esm5.processed/core/stream/orchestrator/stream_orchestrator.js +3 -3
  130. package/dist/_esm5.processed/core/stream/period/create_empty_adaptation_stream.js +2 -1
  131. package/dist/_esm5.processed/core/stream/period/get_adaptation_switch_strategy.js +1 -1
  132. package/dist/_esm5.processed/core/stream/period/period_stream.d.ts +2 -1
  133. package/dist/_esm5.processed/core/stream/period/period_stream.js +3 -3
  134. package/dist/_esm5.processed/core/stream/representation/force_garbage_collection.js +5 -6
  135. package/dist/_esm5.processed/core/stream/representation/get_buffer_status.d.ts +6 -1
  136. package/dist/_esm5.processed/core/stream/representation/get_buffer_status.js +12 -9
  137. package/dist/_esm5.processed/core/stream/representation/get_needed_segments.d.ts +19 -14
  138. package/dist/_esm5.processed/core/stream/representation/get_needed_segments.js +86 -10
  139. package/dist/_esm5.processed/core/stream/representation/get_segment_priority.js +1 -1
  140. package/dist/_esm5.processed/core/stream/representation/push_media_segment.js +3 -3
  141. package/dist/_esm5.processed/core/stream/representation/representation_stream.d.ts +6 -0
  142. package/dist/_esm5.processed/core/stream/representation/representation_stream.js +19 -8
  143. package/dist/_esm5.processed/core/stream/types.d.ts +1 -1
  144. package/dist/_esm5.processed/default_config.d.ts +1114 -0
  145. package/dist/_esm5.processed/default_config.js +1145 -0
  146. package/dist/_esm5.processed/errors/request_error.js +3 -1
  147. package/dist/_esm5.processed/experimental/index.d.ts +2 -0
  148. package/dist/_esm5.processed/experimental/index.js +2 -0
  149. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/push_data.d.ts +1 -0
  150. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/thumbnail_loader.d.ts +2 -2
  151. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/thumbnail_loader.js +2 -4
  152. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/api/probeMediaConfiguration.d.ts +1 -1
  153. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/api/probeMediaConfiguration.js +1 -1
  154. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/DRMInfos.js +1 -2
  155. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/HDCPPolicy.js +1 -2
  156. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/types.d.ts +3 -3
  157. package/dist/_esm5.processed/features/features_object.js +1 -1
  158. package/dist/_esm5.processed/features/initialize_features.js +1 -1
  159. package/dist/_esm5.processed/features/list/eme.d.ts +3 -3
  160. package/dist/_esm5.processed/features/list/eme.js +5 -5
  161. package/dist/_esm5.processed/features/types.d.ts +3 -3
  162. package/dist/_esm5.processed/manifest/adaptation.d.ts +2 -2
  163. package/dist/_esm5.processed/manifest/adaptation.js +3 -1
  164. package/dist/_esm5.processed/manifest/manifest.d.ts +10 -23
  165. package/dist/_esm5.processed/manifest/manifest.js +10 -74
  166. package/dist/_esm5.processed/manifest/period.d.ts +3 -3
  167. package/dist/_esm5.processed/manifest/representation.d.ts +37 -5
  168. package/dist/_esm5.processed/manifest/representation_index/types.d.ts +18 -18
  169. package/dist/_esm5.processed/manifest/types.d.ts +3 -3
  170. package/dist/_esm5.processed/parsers/manifest/dash/common/get_hdr_information.d.ts +1 -1
  171. package/dist/_esm5.processed/parsers/manifest/dash/common/get_periods_time_infos.d.ts +3 -3
  172. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/base.d.ts +6 -6
  173. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/get_init_segment.d.ts +3 -3
  174. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/get_segments_from_timeline.d.ts +2 -2
  175. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/is_period_fulfilled.js +1 -2
  176. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/list.d.ts +14 -14
  177. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/template.d.ts +17 -17
  178. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/template.js +1 -2
  179. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_elements.js +1 -1
  180. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.d.ts +28 -20
  181. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.js +20 -5
  182. package/dist/_esm5.processed/parsers/manifest/dash/common/infer_adaptation_type.d.ts +2 -2
  183. package/dist/_esm5.processed/parsers/manifest/dash/common/manifest_bounds_calculator.d.ts +1 -1
  184. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_adaptation_sets.d.ts +17 -35
  185. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_adaptation_sets.js +109 -96
  186. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_mpd.d.ts +8 -8
  187. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_mpd.js +1 -2
  188. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_periods.d.ts +18 -27
  189. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_periods.js +25 -23
  190. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representation_index.d.ts +21 -15
  191. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representation_index.js +19 -19
  192. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representations.d.ts +15 -38
  193. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representations.js +8 -8
  194. package/dist/_esm5.processed/parsers/manifest/dash/node_parser_types.d.ts +30 -30
  195. package/dist/_esm5.processed/parsers/manifest/dash/parsers_types.d.ts +3 -3
  196. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/dash-wasm-parser.js +1 -1
  197. package/dist/_esm5.processed/parsers/manifest/metaplaylist/metaplaylist_parser.d.ts +2 -2
  198. package/dist/_esm5.processed/parsers/manifest/smooth/create_parser.d.ts +7 -7
  199. package/dist/_esm5.processed/parsers/manifest/smooth/create_parser.js +1 -0
  200. package/dist/_esm5.processed/parsers/manifest/smooth/representation_index.d.ts +8 -8
  201. package/dist/_esm5.processed/parsers/manifest/types.d.ts +28 -28
  202. package/dist/_esm5.processed/parsers/manifest/utils/clear_timeline_from_position.d.ts +3 -2
  203. package/dist/_esm5.processed/parsers/manifest/utils/clear_timeline_from_position.js +15 -5
  204. package/dist/_esm5.processed/parsers/manifest/utils/index_helpers.d.ts +2 -2
  205. package/dist/_esm5.processed/parsers/manifest/utils/update_segment_timeline.d.ts +11 -1
  206. package/dist/_esm5.processed/parsers/manifest/utils/update_segment_timeline.js +31 -19
  207. package/dist/_esm5.processed/parsers/texttracks/webvtt/html/to_html.d.ts +2 -2
  208. package/dist/_esm5.processed/parsers/texttracks/webvtt/parse_cue_block.d.ts +1 -1
  209. package/dist/_esm5.processed/public_types.d.ts +2 -2
  210. package/dist/_esm5.processed/transports/dash/add_segment_integrity_checks_to_loader.js +2 -1
  211. package/dist/_esm5.processed/transports/dash/image_pipelines.js +4 -1
  212. package/dist/_esm5.processed/transports/dash/init_segment_loader.js +1 -1
  213. package/dist/_esm5.processed/transports/dash/manifest_parser.js +1 -1
  214. package/dist/_esm5.processed/transports/dash/segment_loader.d.ts +2 -2
  215. package/dist/_esm5.processed/transports/dash/segment_loader.js +2 -2
  216. package/dist/_esm5.processed/transports/dash/segment_parser.d.ts +1 -1
  217. package/dist/_esm5.processed/transports/dash/segment_parser.js +6 -3
  218. package/dist/_esm5.processed/transports/dash/text_loader.d.ts +1 -1
  219. package/dist/_esm5.processed/transports/dash/text_loader.js +1 -1
  220. package/dist/_esm5.processed/transports/dash/text_parser.d.ts +1 -1
  221. package/dist/_esm5.processed/transports/dash/text_parser.js +8 -2
  222. package/dist/_esm5.processed/transports/local/segment_loader.d.ts +1 -2
  223. package/dist/_esm5.processed/transports/local/segment_loader.js +1 -1
  224. package/dist/_esm5.processed/transports/local/segment_parser.js +4 -1
  225. package/dist/_esm5.processed/transports/local/text_parser.js +8 -2
  226. package/dist/_esm5.processed/transports/metaplaylist/manifest_loader.d.ts +1 -1
  227. package/dist/_esm5.processed/transports/metaplaylist/pipelines.js +1 -1
  228. package/dist/_esm5.processed/transports/smooth/pipelines.js +69 -11
  229. package/dist/_esm5.processed/transports/smooth/segment_loader.d.ts +0 -1
  230. package/dist/_esm5.processed/transports/smooth/segment_loader.js +2 -2
  231. package/dist/_esm5.processed/transports/types.d.ts +58 -30
  232. package/dist/_esm5.processed/transports/utils/call_custom_manifest_loader.js +1 -1
  233. package/dist/_esm5.processed/transports/utils/generate_manifest_loader.d.ts +1 -1
  234. package/dist/_esm5.processed/utils/cancellable_sleep.js +1 -1
  235. package/dist/_esm5.processed/utils/cast_to_observable.d.ts +1 -2
  236. package/dist/_esm5.processed/utils/cast_to_observable.js +1 -1
  237. package/dist/_esm5.processed/utils/deep_merge.d.ts +12 -0
  238. package/dist/_esm5.processed/utils/deep_merge.js +53 -0
  239. package/dist/_esm5.processed/utils/reference.d.ts +29 -0
  240. package/dist/_esm5.processed/utils/reference.js +72 -24
  241. package/dist/_esm5.processed/utils/request/fetch.d.ts +4 -5
  242. package/dist/_esm5.processed/utils/request/fetch.js +8 -6
  243. package/dist/_esm5.processed/utils/request/xhr.d.ts +6 -6
  244. package/dist/_esm5.processed/utils/request/xhr.js +3 -2
  245. package/dist/_esm5.processed/utils/rx-from_cancellable_promise.d.ts +1 -2
  246. package/dist/_esm5.processed/utils/rx-from_cancellable_promise.js +7 -2
  247. package/dist/_esm5.processed/utils/task_canceller.d.ts +5 -3
  248. package/dist/_esm5.processed/utils/task_canceller.js +3 -3
  249. package/dist/rx-player.js +5242 -3190
  250. package/dist/rx-player.min.js +1 -1
  251. package/dummy +1 -0
  252. package/{dist/_esm5.processed/core/eme/dispose_eme.d.ts → experimental/index.d.ts} +1 -4
  253. package/{dist/_esm5.processed/core/eme/dispose_media_keys.d.ts → experimental/index.js} +1 -6
  254. package/package.json +33 -36
  255. package/scripts/build/templates/experimental/index.d.ts +16 -0
  256. package/scripts/build/templates/experimental/index.js +16 -0
  257. package/scripts/doc-generator/generate_header_html.js +6 -7
  258. package/scripts/doc-generator/generate_page_html.js +3 -4
  259. package/scripts/doc-generator/generate_page_list_html.js +4 -5
  260. package/scripts/doc-generator/generate_sidebar_html.js +4 -7
  261. package/scripts/doc-generator/utils.js +0 -11
  262. package/scripts/generate_demo_list.js +3 -3
  263. package/scripts/generate_documentation_list.js +3 -3
  264. package/scripts/launch_static_server.js +127 -67
  265. package/scripts/run_standalone_demo.js +1 -0
  266. package/scripts/start_demo_web_server.js +1 -0
  267. package/sonar-project.properties +1 -1
  268. package/src/README.md +6 -6
  269. package/src/compat/__tests__/fullscreen.test.ts +7 -7
  270. package/src/compat/__tests__/is_vtt_cue.test.ts +1 -1
  271. package/src/compat/__tests__/should_favour_custom_safari_EME.test.ts +45 -5
  272. package/src/compat/browser_detection.ts +4 -2
  273. package/src/compat/eme/close_session.ts +90 -56
  274. package/src/compat/eme/custom_media_keys/ie11_media_keys.ts +1 -1
  275. package/src/compat/eme/custom_media_keys/index.ts +28 -41
  276. package/src/compat/eme/custom_media_keys/old_webkit_media_keys.ts +63 -46
  277. package/src/compat/eme/custom_media_keys/webkit_media_keys.ts +51 -49
  278. package/src/compat/eme/generate_key_request.ts +25 -33
  279. package/src/compat/eme/load_session.ts +29 -31
  280. package/src/compat/event_listeners.ts +2 -1
  281. package/src/compat/should_favour_custom_safari_EME.ts +5 -2
  282. package/src/config.ts +17 -1210
  283. package/src/core/README.md +1 -1
  284. package/src/core/abr/__tests__/{get_estimate_from_buffer_levels.test.ts → buffer_based_chooser.test.ts} +94 -123
  285. package/src/core/abr/bandwidth_estimator.ts +4 -4
  286. package/src/core/abr/buffer_based_chooser.ts +85 -20
  287. package/src/core/abr/network_analyzer.ts +6 -7
  288. package/src/core/abr/pending_requests_store.ts +3 -5
  289. package/src/core/abr/representation_estimator.ts +6 -3
  290. package/src/core/api/__tests__/get_player_state.test.ts +3 -3
  291. package/src/core/api/__tests__/option_utils.test.ts +17 -17
  292. package/src/core/api/get_player_state.ts +1 -1
  293. package/src/core/api/index.ts +3 -0
  294. package/src/core/api/media_element_track_choice_manager.ts +22 -3
  295. package/src/core/api/option_utils.ts +37 -20
  296. package/src/core/api/playback_observer.ts +12 -8
  297. package/src/core/api/public_api.ts +152 -112
  298. package/src/core/api/track_choice_manager.ts +10 -9
  299. package/src/core/decrypt/README.md +22 -0
  300. package/src/core/decrypt/__tests__/__global__/get_license.test.ts +418 -0
  301. package/src/core/decrypt/__tests__/__global__/init_data.test.ts +675 -0
  302. package/src/core/{eme → decrypt}/__tests__/__global__/media_key_system_access.test.ts +99 -92
  303. package/src/core/decrypt/__tests__/__global__/media_keys.test.ts +156 -0
  304. package/src/core/decrypt/__tests__/__global__/server_certificate.test.ts +262 -0
  305. package/src/core/{eme → decrypt}/__tests__/__global__/utils.ts +36 -103
  306. package/src/core/{eme → decrypt}/attach_media_keys.ts +49 -56
  307. package/src/core/decrypt/clear_on_stop.ts +48 -0
  308. package/src/core/decrypt/content_decryptor.ts +1158 -0
  309. package/src/core/decrypt/create_or_load_session.ts +130 -0
  310. package/src/core/decrypt/create_session.ts +175 -0
  311. package/src/core/decrypt/dispose_decryption_resources.ts +39 -0
  312. package/src/core/{eme → decrypt}/find_key_system.ts +126 -134
  313. package/src/core/{eme → decrypt}/get_current_key_system.ts +1 -1
  314. package/src/core/decrypt/get_media_keys.ts +145 -0
  315. package/src/core/{eme → decrypt}/index.ts +11 -8
  316. package/src/core/decrypt/init_media_keys.ts +51 -0
  317. package/src/core/{eme → decrypt}/session_events_listener.ts +93 -55
  318. package/src/core/decrypt/set_server_certificate.ts +104 -0
  319. package/src/core/{eme → decrypt}/types.ts +129 -259
  320. package/src/core/{eme → decrypt}/utils/__tests__/are_init_values_compatible.test.ts +1 -1
  321. package/src/core/{eme → decrypt/utils}/__tests__/clean_old_loaded_sessions.test.ts +29 -71
  322. package/src/core/{eme → decrypt/utils}/__tests__/clean_old_stored_persistent_info.test.ts +6 -6
  323. package/src/core/{eme → decrypt}/utils/are_init_values_compatible.ts +9 -9
  324. package/src/core/{eme → decrypt/utils}/check_key_statuses.ts +6 -5
  325. package/{dist/_esm5.processed/core/eme/clean_old_loaded_sessions.js → src/core/decrypt/utils/clean_old_loaded_sessions.ts} +20 -20
  326. package/src/core/{eme → decrypt/utils}/clean_old_stored_persistent_info.ts +3 -3
  327. package/src/core/{eme → decrypt/utils}/get_drm_system_id.ts +1 -1
  328. package/src/core/decrypt/utils/init_data_values_container.ts +119 -0
  329. package/src/core/{eme → decrypt}/utils/is_session_usable.ts +4 -5
  330. package/src/core/decrypt/utils/key_id_comparison.ts +82 -0
  331. package/src/core/decrypt/utils/key_session_record.ts +175 -0
  332. package/src/core/decrypt/utils/loaded_sessions_store.ts +318 -0
  333. package/src/core/{eme → decrypt/utils}/media_keys_infos_store.ts +4 -4
  334. package/src/core/{eme → decrypt}/utils/persistent_sessions_store.ts +122 -104
  335. package/src/core/{eme/utils/init_data_container.ts → decrypt/utils/serializable_bytes.ts} +8 -5
  336. package/src/core/{eme → decrypt/utils}/server_certificate_store.ts +2 -2
  337. package/src/core/fetchers/manifest/manifest_fetcher.ts +9 -9
  338. package/src/core/fetchers/segment/segment_fetcher.ts +10 -7
  339. package/src/core/fetchers/segment/segment_fetcher_creator.ts +2 -2
  340. package/src/core/fetchers/utils/try_urls_with_backoff.ts +1 -1
  341. package/src/core/init/.initialize_media_source.ts.un~ +0 -0
  342. package/src/core/init/get_initial_time.ts +2 -1
  343. package/src/core/init/initialize_directfile.ts +19 -22
  344. package/src/core/init/initialize_media_source.ts +43 -106
  345. package/src/core/init/link_drm_and_content.ts +176 -0
  346. package/src/core/init/manifest_update_scheduler.ts +12 -10
  347. package/src/core/init/stall_avoider.ts +6 -5
  348. package/src/core/init/stream_events_emitter/are_same_stream_events.ts +4 -4
  349. package/src/core/init/stream_events_emitter/stream_events_emitter.ts +2 -1
  350. package/src/core/init/stream_events_emitter/types.ts +2 -2
  351. package/src/core/init/types.ts +1 -39
  352. package/src/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.ts +2 -1
  353. package/src/core/segment_buffers/implementations/text/html/html_text_segment_buffer.ts +6 -7
  354. package/src/core/segment_buffers/implementations/text/html/text_track_cues_store.ts +32 -31
  355. package/src/core/segment_buffers/implementations/text/native/native_text_segment_buffer.ts +4 -4
  356. package/src/core/segment_buffers/inventory/segment_inventory.ts +42 -8
  357. package/src/core/stream/adaptation/adaptation_stream.ts +7 -1
  358. package/src/core/stream/events_generators.ts +9 -4
  359. package/src/core/stream/orchestrator/stream_orchestrator.ts +9 -4
  360. package/src/core/stream/period/create_empty_adaptation_stream.ts +2 -1
  361. package/src/core/stream/period/get_adaptation_switch_strategy.ts +1 -1
  362. package/src/core/stream/period/period_stream.ts +5 -2
  363. package/src/core/stream/representation/force_garbage_collection.ts +5 -7
  364. package/src/core/stream/representation/get_buffer_status.ts +28 -16
  365. package/src/core/stream/representation/get_needed_segments.ts +124 -28
  366. package/src/core/stream/representation/get_segment_priority.ts +1 -2
  367. package/src/core/stream/representation/push_media_segment.ts +3 -2
  368. package/src/core/stream/representation/representation_stream.ts +30 -7
  369. package/src/core/stream/types.ts +1 -1
  370. package/src/default_config.ts +1241 -0
  371. package/src/errors/request_error.ts +4 -1
  372. package/src/experimental/index.ts +5 -0
  373. package/src/experimental/tools/VideoThumbnailLoader/push_data.ts +1 -0
  374. package/src/experimental/tools/VideoThumbnailLoader/thumbnail_loader.ts +5 -7
  375. package/src/experimental/tools/mediaCapabilitiesProber/__tests__/probers/DRMInfos.test.ts +3 -10
  376. package/src/experimental/tools/mediaCapabilitiesProber/__tests__/probers/HDCPPolicy.test.ts +4 -4
  377. package/src/experimental/tools/mediaCapabilitiesProber/api/index.ts +1 -1
  378. package/src/experimental/tools/mediaCapabilitiesProber/api/probeMediaConfiguration.ts +3 -3
  379. package/src/experimental/tools/mediaCapabilitiesProber/probers/DRMInfos.ts +1 -2
  380. package/src/experimental/tools/mediaCapabilitiesProber/probers/HDCPPolicy.ts +1 -2
  381. package/src/experimental/tools/mediaCapabilitiesProber/types.ts +3 -3
  382. package/src/features/__tests__/initialize_features.test.ts +2 -2
  383. package/src/features/features_object.ts +1 -1
  384. package/src/features/initialize_features.ts +1 -1
  385. package/src/features/list/__tests__/eme.test.ts +5 -5
  386. package/src/features/list/eme.ts +5 -5
  387. package/src/features/types.ts +3 -10
  388. package/src/manifest/adaptation.ts +6 -4
  389. package/src/manifest/manifest.ts +16 -86
  390. package/src/manifest/period.ts +3 -3
  391. package/src/manifest/representation.ts +38 -5
  392. package/src/manifest/representation_index/types.ts +18 -18
  393. package/src/manifest/types.ts +3 -3
  394. package/src/parsers/manifest/dash/common/__tests__/manifest_bounds_calculator.test.ts +1 -0
  395. package/src/parsers/manifest/dash/common/get_hdr_information.ts +1 -1
  396. package/src/parsers/manifest/dash/common/get_periods_time_infos.ts +3 -3
  397. package/src/parsers/manifest/dash/common/indexes/base.ts +6 -6
  398. package/src/parsers/manifest/dash/common/indexes/get_init_segment.ts +4 -2
  399. package/src/parsers/manifest/dash/common/indexes/get_segments_from_timeline.ts +2 -2
  400. package/src/parsers/manifest/dash/common/indexes/is_period_fulfilled.ts +1 -2
  401. package/src/parsers/manifest/dash/common/indexes/list.ts +14 -14
  402. package/src/parsers/manifest/dash/common/indexes/template.ts +18 -18
  403. package/src/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_elements.ts +1 -1
  404. package/src/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.ts +51 -23
  405. package/src/parsers/manifest/dash/common/infer_adaptation_type.ts +2 -2
  406. package/src/parsers/manifest/dash/common/manifest_bounds_calculator.ts +1 -1
  407. package/src/parsers/manifest/dash/common/parse_adaptation_sets.ts +167 -134
  408. package/src/parsers/manifest/dash/common/parse_mpd.ts +9 -10
  409. package/src/parsers/manifest/dash/common/parse_periods.ts +80 -79
  410. package/src/parsers/manifest/dash/common/parse_representation_index.ts +83 -75
  411. package/src/parsers/manifest/dash/common/parse_representations.ts +44 -63
  412. package/src/parsers/manifest/dash/node_parser_types.ts +30 -30
  413. package/src/parsers/manifest/dash/parsers_types.ts +3 -3
  414. package/src/parsers/manifest/dash/wasm-parser/ts/dash-wasm-parser.ts +1 -1
  415. package/src/parsers/manifest/metaplaylist/metaplaylist_parser.ts +4 -4
  416. package/src/parsers/manifest/smooth/create_parser.ts +24 -21
  417. package/src/parsers/manifest/smooth/representation_index.ts +14 -14
  418. package/src/parsers/manifest/types.ts +28 -28
  419. package/src/parsers/manifest/utils/__tests__/update_segment_timeline.test.ts +31 -33
  420. package/src/parsers/manifest/utils/clear_timeline_from_position.ts +15 -6
  421. package/src/parsers/manifest/utils/index_helpers.ts +2 -2
  422. package/src/parsers/manifest/utils/update_segment_timeline.ts +32 -21
  423. package/src/parsers/texttracks/webvtt/html/__tests__/create_styled_element.test.ts +1 -0
  424. package/src/parsers/texttracks/webvtt/html/to_html.ts +2 -2
  425. package/src/parsers/texttracks/webvtt/parse_cue_block.ts +1 -1
  426. package/src/public_types.ts +5 -1
  427. package/src/transports/dash/add_segment_integrity_checks_to_loader.ts +2 -2
  428. package/src/transports/dash/image_pipelines.ts +4 -1
  429. package/src/transports/dash/init_segment_loader.ts +1 -1
  430. package/src/transports/dash/manifest_parser.ts +1 -1
  431. package/src/transports/dash/segment_loader.ts +7 -7
  432. package/src/transports/dash/segment_parser.ts +8 -1
  433. package/src/transports/dash/text_loader.ts +2 -2
  434. package/src/transports/dash/text_parser.ts +11 -1
  435. package/src/transports/local/segment_loader.ts +4 -4
  436. package/src/transports/local/segment_parser.ts +4 -0
  437. package/src/transports/local/text_parser.ts +8 -0
  438. package/src/transports/metaplaylist/manifest_loader.ts +1 -1
  439. package/src/transports/metaplaylist/pipelines.ts +1 -1
  440. package/src/transports/smooth/pipelines.ts +29 -16
  441. package/src/transports/smooth/segment_loader.ts +8 -8
  442. package/src/transports/types.ts +59 -30
  443. package/src/transports/utils/call_custom_manifest_loader.ts +6 -6
  444. package/src/transports/utils/generate_manifest_loader.ts +1 -1
  445. package/src/utils/__tests__/deep_merge.test.ts +48 -0
  446. package/src/utils/__tests__/flat_map.test.ts +12 -7
  447. package/src/utils/cancellable_sleep.ts +1 -1
  448. package/src/utils/cast_to_observable.ts +1 -2
  449. package/src/utils/deep_merge.ts +46 -0
  450. package/src/utils/reference.ts +116 -23
  451. package/src/utils/request/fetch.ts +17 -15
  452. package/src/utils/request/xhr.ts +11 -8
  453. package/src/utils/rx-from_cancellable_promise.ts +8 -4
  454. package/src/utils/task_canceller.ts +6 -4
  455. package/tsconfig.json +1 -2
  456. package/tsconfig.modules.json +1 -2
  457. package/dist/_esm5.processed/core/abr/get_estimate_from_buffer_levels.d.ts +0 -29
  458. package/dist/_esm5.processed/core/abr/get_estimate_from_buffer_levels.js +0 -67
  459. package/dist/_esm5.processed/core/eme/attach_media_keys.js +0 -57
  460. package/dist/_esm5.processed/core/eme/clean_old_loaded_sessions.d.ts +0 -59
  461. package/dist/_esm5.processed/core/eme/clear_eme_session.js +0 -50
  462. package/dist/_esm5.processed/core/eme/create_session.js +0 -126
  463. package/dist/_esm5.processed/core/eme/dispose_eme.js +0 -23
  464. package/dist/_esm5.processed/core/eme/dispose_media_keys.js +0 -36
  465. package/dist/_esm5.processed/core/eme/eme_manager.d.ts +0 -31
  466. package/dist/_esm5.processed/core/eme/eme_manager.js +0 -278
  467. package/dist/_esm5.processed/core/eme/find_key_system.js +0 -243
  468. package/dist/_esm5.processed/core/eme/get_media_keys.js +0 -85
  469. package/dist/_esm5.processed/core/eme/get_session.js +0 -68
  470. package/dist/_esm5.processed/core/eme/init_media_keys.js +0 -66
  471. package/dist/_esm5.processed/core/eme/session_events_listener.d.ts +0 -41
  472. package/dist/_esm5.processed/core/eme/set_server_certificate.js +0 -85
  473. package/dist/_esm5.processed/core/eme/utils/close_session.js +0 -81
  474. package/dist/_esm5.processed/core/eme/utils/init_data_store.d.ts +0 -115
  475. package/dist/_esm5.processed/core/eme/utils/init_data_store.js +0 -181
  476. package/dist/_esm5.processed/core/eme/utils/loaded_sessions_store.d.ts +0 -123
  477. package/dist/_esm5.processed/core/eme/utils/loaded_sessions_store.js +0 -173
  478. package/dist/_esm5.processed/core/init/create_eme_manager.d.ts +0 -34
  479. package/dist/_esm5.processed/core/init/create_eme_manager.js +0 -52
  480. package/src/core/abr/get_estimate_from_buffer_levels.ts +0 -85
  481. package/src/core/eme/README.md +0 -26
  482. package/src/core/eme/__tests__/__global__/get_license.test.ts +0 -414
  483. package/src/core/eme/__tests__/__global__/init_data.test.ts +0 -908
  484. package/src/core/eme/__tests__/__global__/media_keys.test.ts +0 -266
  485. package/src/core/eme/__tests__/__global__/server_certificate.test.ts +0 -364
  486. package/src/core/eme/__tests__/init_media_keys.test.ts +0 -182
  487. package/src/core/eme/clean_old_loaded_sessions.ts +0 -96
  488. package/src/core/eme/clear_eme_session.ts +0 -62
  489. package/src/core/eme/create_session.ts +0 -187
  490. package/src/core/eme/dispose_eme.ts +0 -25
  491. package/src/core/eme/dispose_media_keys.ts +0 -46
  492. package/src/core/eme/eme_manager.ts +0 -387
  493. package/src/core/eme/get_media_keys.ts +0 -141
  494. package/src/core/eme/get_session.ts +0 -135
  495. package/src/core/eme/init_media_keys.ts +0 -106
  496. package/src/core/eme/set_server_certificate.ts +0 -115
  497. package/src/core/eme/utils/close_session.ts +0 -113
  498. package/src/core/eme/utils/init_data_store.ts +0 -234
  499. package/src/core/eme/utils/loaded_sessions_store.ts +0 -235
  500. package/src/core/init/create_eme_manager.ts +0 -95
@@ -13,1091 +13,177 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- declare const _default: {
17
- /**
18
- * Volume set on unMute if the volume is set to 0 and either:
19
- * - mute has never been called before
20
- * - mute has last been called while the volume was already set to 0 (either
21
- * via setVolume, or a previous mute call)
22
- * @type {Number}
23
- */
24
- DEFAULT_UNMUTED_VOLUME: number;
25
- /**
26
- * Default time interval after which a request will timeout, in ms.
27
- * @type {Number}
28
- */
29
- DEFAULT_REQUEST_TIMEOUT: number;
30
- /**
31
- * Can be either:
32
- * - "native": Subtitles are all displayed in a <track> element
33
- * - "html": Subtitles are all displayed in a <div> separated from the video
34
- * element. Can be useful to display richer TTML subtitles, for example.
35
- * @type {Object|null}
36
- */
37
- DEFAULT_TEXT_TRACK_MODE: "native" | "html";
38
- /**
39
- * Strategy to adopt when manually setting the current bitrate.
40
- * Can be either:
41
- * - "seamless": transitions are very smooth but not immediate.
42
- * - "direct": the quality switch happens immediately but to achieve that,
43
- * the player will need to set a new MediaSource on the media element in
44
- * some cases. This often leads to a black screen + unavailable APIs
45
- * during a short moment.
46
- * @type {string}
47
- */
48
- DEFAULT_MANUAL_BITRATE_SWITCHING_MODE: "direct" | "seamless";
49
- /**
50
- * Default behavior for the `enableFastSwitching` loadVideo options.
51
- *
52
- * Fast-switching allows to provide quicker transitions from lower quality
53
- * segments to higher quality segments but might be badly supported on some
54
- * devices.
55
- * When enabled, the RxPlayer might replace segments of a lower-quality
56
- * (with a lower bitrate) with segments of a higher quality (with a higher
57
- * bitrate). This allows to have a fast transition when network conditions
58
- * improve.
59
- * When disabled, segments of a lower-quality will not be replaced.
60
- */
61
- DEFAULT_ENABLE_FAST_SWITCHING: boolean;
62
- /**
63
- * Strategy to adopt when manually switching of audio adaptation.
64
- * Can be either:
65
- * - "seamless": transitions are smooth but could be not immediate.
66
- * - "direct": that strategy will perform a very small seek that result
67
- * most of the time by a flush of the current buffered data, by doing
68
- * that we allow quicker transition between audio track, but we could
69
- * see appear a RELOADING or a SEEKING state.
70
- */
71
- DEFAULT_AUDIO_TRACK_SWITCHING_MODE: "direct" | "seamless";
72
- /**
73
- * In some cases after switching the current track or bitrate, the RxPlayer
74
- * could be led to go into the `"RELOADING"` state, which corresponds to
75
- * visually a black screen (with nothing audible) before restarting playback.
76
- *
77
- * We could want to seek back some milliseconds when doing that.
78
- * For example, when switching the current audio track, it might make sense
79
- * to restart some time before, so the beginning of the sentence can be heard
80
- * again in the new language.
81
- *
82
- * This config property allows to set the relative position the RxPlayer will
83
- * seek to after reloading, in seconds.
84
- *
85
- * For example: a value of `-0.7` means that will seek back 700 milliseconds
86
- * when reloading due to a track or bitrate switch with necessitated a
87
- * reloading.
88
- */
89
- DELTA_POSITION_AFTER_RELOAD: {
90
- /** Relative position when switching the bitrate */
91
- bitrateSwitch: number;
92
- /**
93
- * Relative position when switching the track.
94
- *
95
- * From tests, I noticed that seeking back was only really "pleasant" when
96
- * switching the audio track.
97
- *
98
- * E.g. switching the video track often means changing the camera angle or
99
- * even totally changing what is being seen and rely much less on temporal
100
- * context than when an audio track is switched.
101
- * As such, I decided to only set a sensible seek-back behavior when
102
- * switching the audio track, and only a minimal one (to still ensure
103
- * nothing was missed) for video.
104
- *
105
- * "Other" mainly concern text track, where seeking back could even be
106
- * annoying, so that behavior has been disabled in that case.
107
- */
108
- trackSwitch: {
16
+ import { IDefaultConfig } from "./default_config";
17
+ declare class ConfigHandler {
18
+ _config: {
19
+ DEFAULT_UNMUTED_VOLUME: number;
20
+ DEFAULT_REQUEST_TIMEOUT: number;
21
+ DEFAULT_TEXT_TRACK_MODE: "native" | "html";
22
+ DEFAULT_MANUAL_BITRATE_SWITCHING_MODE: "direct" | "seamless";
23
+ DEFAULT_ENABLE_FAST_SWITCHING: boolean;
24
+ DEFAULT_AUDIO_TRACK_SWITCHING_MODE: "direct" | "seamless";
25
+ DELTA_POSITION_AFTER_RELOAD: {
26
+ bitrateSwitch: number;
27
+ trackSwitch: {
28
+ audio: number;
29
+ video: number;
30
+ other: number;
31
+ };
32
+ };
33
+ DEFAULT_CODEC_SWITCHING_BEHAVIOR: "reload" | "continue";
34
+ DEFAULT_AUTO_PLAY: boolean;
35
+ DEFAULT_SHOW_NATIVE_SUBTITLE: boolean;
36
+ DEFAULT_STOP_AT_END: boolean;
37
+ DEFAULT_WANTED_BUFFER_AHEAD: number;
38
+ DEFAULT_MAX_BUFFER_AHEAD: number;
39
+ DEFAULT_MAX_BUFFER_BEHIND: number;
40
+ DEFAULT_MAX_VIDEO_BUFFER_SIZE: number;
41
+ MAXIMUM_MAX_BUFFER_AHEAD: Partial<Record<"audio" | "video" | "image" | "text", number>>;
42
+ MAXIMUM_MAX_BUFFER_BEHIND: Partial<Record<"audio" | "video" | "image" | "text", number>>;
43
+ DEFAULT_INITIAL_BITRATES: {
109
44
  audio: number;
110
45
  video: number;
111
46
  other: number;
112
47
  };
113
- };
114
- /**
115
- * Behavior of the RxPlayer when encountering a whole other codec on a already
116
- * existing audio or video SourceBuffer.
117
- *
118
- * Can be either:
119
- *
120
- * - "continue": Segments linked to the new codec will continue to be
121
- * pushed to that same SourceBuffer. The RxPlayer will still try to call
122
- * the `changeType` API on the SourceBuffer before pushing those
123
- * segments but continue even if this call failed.
124
- *
125
- * - "reload": Every time a new incompatible codec is encountered on a
126
- * given SourceBuffer, we will reload the MediaSource.
127
- */
128
- DEFAULT_CODEC_SWITCHING_BEHAVIOR: "reload" | "continue";
129
- /**
130
- * If set to true, video through loadVideo will auto play by default
131
- * @type {Boolean}
132
- */
133
- DEFAULT_AUTO_PLAY: boolean;
134
- /**
135
- * If set to false, "native" subtitles (in a <track> element) will be hidden
136
- * by default.
137
- * @type {Boolean}
138
- */
139
- DEFAULT_SHOW_NATIVE_SUBTITLE: boolean;
140
- /**
141
- * If set to true, the player will by default stop immediately and unload the
142
- * content on reaching the end of the media.
143
- *
144
- * If set to false, it will not unload nor stop by default, leaving the user
145
- * free to seek in the already-loaded content.
146
- *
147
- * Set to `true` for legacy reasons.
148
- * @type {Boolean}
149
- */
150
- DEFAULT_STOP_AT_END: boolean;
151
- /**
152
- * Default buffer goal in seconds.
153
- * Once enough content has been downloaded to fill the buffer up to
154
- * ``current position + DEFAULT_WANTED_BUFFER_AHEAD", we will stop downloading
155
- * content.
156
- * @type {Number}
157
- */
158
- DEFAULT_WANTED_BUFFER_AHEAD: number;
159
- /**
160
- * Default max buffer size ahead of the current position in seconds.
161
- * The buffer _after_ this limit will be garbage collected.
162
- * Set to Infinity for no limit.
163
- * @type {Number}
164
- */
165
- DEFAULT_MAX_BUFFER_AHEAD: number;
166
- /**
167
- * Default max buffer size ahead of the current position in seconds.
168
- * The buffer _before_ this limit will be garbage collected.
169
- * Set to Infinity for no limit.
170
- * @type {Number}
171
- */
172
- DEFAULT_MAX_BUFFER_BEHIND: number;
173
- /**
174
- * Maximum possible buffer ahead for each type of buffer, to avoid too much
175
- * memory usage when playing for a long time.
176
- * Equal to Infinity if not defined here.
177
- * @type {Object}
178
- */
179
- MAXIMUM_MAX_BUFFER_AHEAD: Partial<Record<"audio" | "video" | "image" | "text", number>>;
180
- /**
181
- * Maximum possible buffer behind for each type of buffer, to avoid too much
182
- * memory usage when playing for a long time.
183
- * Equal to Infinity if not defined here.
184
- * @type {Object}
185
- */
186
- MAXIMUM_MAX_BUFFER_BEHIND: Partial<Record<"audio" | "video" | "image" | "text", number>>;
187
- /**
188
- * Default bitrate ceils initially set as the first content begins.
189
- *
190
- * If no track is found with a bitrate inferior or equal to the
191
- * bitrate there, the one with the lowest bitrate will be taken instead.
192
- *
193
- * Set to 0 for the lowest bitrate, Infinity for the highest.
194
- *
195
- * These values are only useful for the first content played, as consecutive
196
- * play will always take the last set one.
197
- * @type {Object}
198
- */
199
- DEFAULT_INITIAL_BITRATES: {
200
- audio: number;
201
- video: number;
202
- other: number;
203
- };
204
- /**
205
- * Default bitrate floor initially set to dictate the minimum bitrate the
206
- * ABR manager can automatically switch to.
207
- *
208
- * If no track is found with a quality superior or equal to the
209
- * bitrate there, the lowest bitrate will be taken instead.
210
- *
211
- * Set to Infinity to discard any limit in the ABR strategy.
212
- * @type {Object}
213
- */
214
- DEFAULT_MIN_BITRATES: Record<"audio" | "video" | "other", number>;
215
- /**
216
- * Default bitrate ceil initially set to dictate the maximum bitrate the
217
- * ABR manager can automatically switch to.
218
- *
219
- * If no track is found with a quality inferior or equal to the
220
- * bitrate there, the lowest bitrate will be taken instead.
221
- *
222
- * Set to Infinity to discard any limit in the ABR strategy.
223
- * @type {Object}
224
- */
225
- DEFAULT_MAX_BITRATES: Record<"audio" | "video" | "other", number>;
226
- /**
227
- * Delay after which, if the page is hidden, the user is considered inactive
228
- * on the current video.
229
- *
230
- * Allow to enforce specific optimizations when the page is not shown.
231
- * @see DEFAULT_THROTTLE_WHEN_HIDDEN
232
- * @type {Number}
233
- */
234
- INACTIVITY_DELAY: number;
235
- /**
236
- * If true, if the player is in a "hidden" state for a delay specified by the
237
- * INACTIVITY DELAY config property, we throttle automatically to the video
238
- * representation with the lowest bitrate.
239
- * @type {Boolean}
240
- */
241
- DEFAULT_THROTTLE_WHEN_HIDDEN: boolean;
242
- /**
243
- * If true, if the video is considered in a "hidden" state for a delay specified by
244
- * the INACTIVITY DELAY config property, we throttle automatically to the video
245
- * representation with the lowest bitrate.
246
- * @type {Boolean}
247
- */
248
- DEFAULT_THROTTLE_VIDEO_BITRATE_WHEN_HIDDEN: boolean;
249
- /**
250
- * If true, the video representations you can switch to in adaptive mode
251
- * are limited by the video element's width.
252
- *
253
- * Basically in that case, we won't switch to a video Representation with
254
- * a width higher than the current width of the video HTMLElement.
255
- * @type {Boolean}
256
- */
257
- DEFAULT_LIMIT_VIDEO_WIDTH: boolean;
258
- /**
259
- * Default initial live gap considered if no presentation delay has been
260
- * suggested, in seconds.
261
- * @type {Number}
262
- */
263
- DEFAULT_LIVE_GAP: {
264
- DEFAULT: number;
265
- LOW_LATENCY: number;
266
- };
267
- /**
268
- * Maximum time, in seconds, the player should automatically skip when stalled
269
- * because of a current hole in the buffer.
270
- * Bear in mind that this might seek over not-yet-downloaded/pushed segments.
271
- * @type {Number}
272
- */
273
- BUFFER_DISCONTINUITY_THRESHOLD: number;
274
- /**
275
- * When encountering small discontinuities, the RxPlayer may want, in specific
276
- * conditions, ignore those and let the browser seek over them iself (this
277
- * allows for example to avoid conflicts when both the browser and the
278
- * RxPlayer want to seek at a different position, sometimes leading to a
279
- * seeking loop).
280
- * In this case, we however still want to seek it ourselves if the browser
281
- * doesn't take the opportunity soon enough.
282
- *
283
- * This value specifies a delay after which a discontinuity ignored by the
284
- * RxPlayer is finally considered.
285
- * We want to maintain high enough to be sure the browser will not seek yet
286
- * small enough so this (arguably rare) situation won't lead to too much
287
- * waiting time.
288
- */
289
- FORCE_DISCONTINUITY_SEEK_DELAY: number;
290
- /**
291
- * Ratio used to know if an already loaded segment should be re-buffered.
292
- * We re-load the given segment if the current one times that ratio is
293
- * inferior to the new one.
294
- * @type {Number}
295
- */
296
- BITRATE_REBUFFERING_RATIO: number;
297
- /**
298
- * Those are used when a "QuotaExceededError" error is received after
299
- * appending a new segment in the SourceBuffer.
300
- *
301
- * This error can arise when the browser's buffer is considered full.
302
- * In this case, the player goes into manual garbage collection (GC) mode.
303
- * @type {Object}
304
- */
305
- BUFFER_GC_GAPS: {
306
- /**
307
- * _Low_ gap (from current position) from which the buffer will be _garbage
308
- * collected_ (read removed from the buffer) when a QuotaExceededError is
309
- * received.
310
- * In seconds.
311
- * @type {Number}
312
- */
313
- CALM: number;
314
- /**
315
- * _High_ gap (from current position) from which the buffer will be _garbage
316
- * collected_ (read removed from the buffer) when a QuotaExceededError is
317
- * received, if the low one does not clean up any buffer.
318
- * In seconds.
319
- * @type {Number}
320
- */
321
- BEEFY: number;
322
- };
323
- /**
324
- * The default number of times a manifest request will be re-performed
325
- * when loaded/refreshed if the request finishes on an error which
326
- * justify an retry.
327
- *
328
- * Note that some errors do not use this counter:
329
- * - if the error is not due to the xhr, no retry will be peformed
330
- * - if the error is an HTTP error code, but not a 500-smthg or a 404, no
331
- * retry will be performed.
332
- * - if it has a high chance of being due to the user being offline, a
333
- * separate counter is used (see DEFAULT_MAX_REQUESTS_RETRY_ON_OFFLINE).
334
- * @type Number
335
- */
336
- DEFAULT_MAX_MANIFEST_REQUEST_RETRY: number;
337
- /**
338
- * The default number of times a segment request will be re-performed when
339
- * on error which justify a retry.
340
- *
341
- * Note that some errors do not use this counter:
342
- * - if the error is not due to the xhr, no retry will be peformed
343
- * - if the error is an HTTP error code, but not a 500-smthg or a 404, no
344
- * retry will be performed.
345
- * - if it has a high chance of being due to the user being offline, a
346
- * separate counter is used (see DEFAULT_MAX_REQUESTS_RETRY_ON_OFFLINE).
347
- * @type Number
348
- */
349
- DEFAULT_MAX_REQUESTS_RETRY_ON_ERROR: number;
350
- /**
351
- * Under some circonstances, we're able to tell that the user is offline (see
352
- * the compat files).
353
- * When this happens, and xhr requests fails due to an error event (you might
354
- * still be able to perform xhr offline, e.g. on localhost), you might want to
355
- * retry indefinitely or with a higher number of retry than if the error is
356
- * due to a CDN problem.
357
- *
358
- * A capped exponential backoff will still be used (like for an error code).
359
- * @type {Number}
360
- */
361
- DEFAULT_MAX_REQUESTS_RETRY_ON_OFFLINE: number;
362
- /**
363
- * Initial backoff delay when a segment / manifest download fails, in
364
- * milliseconds.
365
- *
366
- * This delay will then grow exponentally by power of twos (200, 400, 800
367
- * etc.)
368
- *
369
- * Please note that this delay is not exact, as it will be fuzzed.
370
- * @type {Number}
371
- */
372
- INITIAL_BACKOFF_DELAY_BASE: {
373
- REGULAR: number;
374
- LOW_LATENCY: number;
375
- };
376
- /**
377
- * Maximum backoff delay when a segment / manifest download fails, in
378
- * milliseconds.
379
- *
380
- * Please note that this delay is not exact, as it will be fuzzed.
381
- * @type {Number}
382
- */
383
- MAX_BACKOFF_DELAY_BASE: {
384
- REGULAR: number;
385
- LOW_LATENCY: number;
386
- };
387
- /**
388
- * Minimum interval at which playback information samples will be taken. This
389
- * variable is for the "regular" mediasource strategy (that is, not for the
390
- * directfile API.
391
- *
392
- * At each of these interval, various different modules in the RxPlayer will
393
- * run based on the information communicated.
394
- *
395
- * Keep in mind this is the minimum interval. This logic will also be
396
- * triggered when various events of the media element are received.
397
- * @type {Number}
398
- */
399
- SAMPLING_INTERVAL_MEDIASOURCE: number;
400
- /**
401
- * Same than SAMPLING_INTERVAL_MEDIASOURCE but for lowLatency mode.
402
- * @type {Number}
403
- */
404
- SAMPLING_INTERVAL_LOW_LATENCY: number;
405
- /**
406
- * Same than SAMPLING_INTERVAL_MEDIASOURCE but for the directfile API.
407
- * @type {Number}
408
- */
409
- SAMPLING_INTERVAL_NO_MEDIASOURCE: number;
410
- /**
411
- * Minimum number of bytes sampled before we trust the estimate.
412
- * If we have not sampled much data, our estimate may not be accurate
413
- * enough to trust.
414
- * If the total of bytes sampled is less than this value, we use a
415
- * default estimate.
416
- * This specific value is based on experimentations.
417
- * @type {Number}
418
- */
419
- ABR_MINIMUM_TOTAL_BYTES: number;
420
- /**
421
- * Minimum number of bytes, under which samples are discarded.
422
- * Our models do not include latency information, so connection startup time
423
- * (time to first byte) is considered part of the download time.
424
- * Because of this, we should ignore very small downloads which would cause
425
- * our estimate to be too low.
426
- * This specific value is based on experimentation.
427
- * @type {Number}
428
- */
429
- ABR_MINIMUM_CHUNK_SIZE: number;
430
- /**
431
- * Factor with which is multiplied the bandwidth estimate when the ABR is in
432
- * starvation mode.
433
- * @type {Object}
434
- */
435
- ABR_STARVATION_FACTOR: {
436
- DEFAULT: number;
437
- LOW_LATENCY: number;
438
- };
439
- /**
440
- * Factor with which is multiplied the bandwidth estimate when the ABR is not
441
- * in starvation mode.
442
- * @type {Object}
443
- */
444
- ABR_REGULAR_FACTOR: {
445
- DEFAULT: number;
446
- LOW_LATENCY: number;
447
- };
448
- /**
449
- * If a media buffer has less than ABR_STARVATION_GAP in seconds ahead of the
450
- * current position in its buffer, the ABR manager will go into starvation
451
- * mode.
452
- *
453
- * It gets out of starvation mode when the OUT_OF_STARVATION_GAP value is
454
- * reached.
455
- *
456
- * Under this starvation mode:
457
- *
458
- * - the bandwidth considered will be a little lower than the one estimated
459
- *
460
- * - the time the next important request take will be checked
461
- * multiple times to detect when/if it takes too much time.
462
- * If the request is considered too long, the bitrate will be hastily
463
- * re-calculated from this single request.
464
- *
465
- * @type {Object}
466
- */
467
- ABR_STARVATION_GAP: {
468
- DEFAULT: number;
469
- LOW_LATENCY: number;
470
- };
471
- OUT_OF_STARVATION_GAP: {
472
- DEFAULT: number;
473
- LOW_LATENCY: number;
474
- };
475
- /**
476
- * This is a security to avoid going into starvation mode when the content is
477
- * ending (@see ABR_STARVATION_GAP).
478
- * Basically, we subtract that value from the global duration of the content
479
- * and we never enter "starvation mode" if the currently available buffer
480
- * (which equals to the current position + the available buffer ahead of it)
481
- * is equal or higher than this value.
482
- * @type {Number}
483
- */
484
- ABR_STARVATION_DURATION_DELTA: number;
485
- /**
486
- * Half-life, in seconds for a fastly-evolving exponential weighted moving
487
- * average.
488
- * The lower it is, the faster the ABR logic will react to the bandwidth
489
- * falling quickly.
490
- * Should be kept to a lower number than ABR_SLOW_EMA for coherency reasons.
491
- * @type {Number}
492
- */
493
- ABR_FAST_EMA: number;
494
- /**
495
- * Half-life, in seconds for a slowly-evolving exponential weighted moving
496
- * average.
497
- * The lower it is, the faster the ABR logic is going to react to recent
498
- * bandwidth variation, on the higher and on the lower side.
499
- * Should be kept to a higher number than ABR_FAST_EMA for coherency reasons.
500
- * @type {Number}
501
- */
502
- ABR_SLOW_EMA: number;
503
- /**
504
- * Number of seconds ahead in the buffer after which playback will resume when
505
- * seeking on an unbuffered part of the content.
506
- * @type {Number}
507
- */
508
- RESUME_GAP_AFTER_SEEKING: {
509
- DEFAULT: number;
510
- LOW_LATENCY: number;
511
- };
512
- /**
513
- * Number of seconds ahead in the buffer after which playback will resume when
514
- * the player was rebuffering due to a low readyState.
515
- * @type {Number}
516
- */
517
- RESUME_GAP_AFTER_NOT_ENOUGH_DATA: {
518
- DEFAULT: number;
519
- LOW_LATENCY: number;
520
- };
521
- /**
522
- * Number of seconds ahead in the buffer after which playback will resume
523
- * after the player went through a buffering step.
524
- * @type {Number}
525
- */
526
- RESUME_GAP_AFTER_BUFFERING: {
527
- DEFAULT: number;
528
- LOW_LATENCY: number;
529
- };
530
- /**
531
- * Maximum number of seconds in the buffer based on which a "rebuffering"
532
- * strategy will be considered:
533
- * The player will pause playback to get enough time building a sufficient
534
- * buffer. This mostly happen when seeking in an unbuffered part or when not
535
- * enough buffer is ahead of the current position.
536
- * @type {Number}
537
- */
538
- REBUFFERING_GAP: {
539
- DEFAULT: number;
540
- LOW_LATENCY: number;
541
- };
542
- /**
543
- * Amount of time (in seconds) with data ahead of the current position, at
544
- * which we always consider the browser to be able to play.
545
- *
546
- * If the media element has this amount of data in advance or more but
547
- * playback cannot begin, the player will consider it "freezing".
548
- */
549
- MINIMUM_BUFFER_AMOUNT_BEFORE_FREEZING: number;
550
- /**
551
- * A media whose position inexplicably does not increment despite playing is
552
- * called as "freezing" in the RxPlayer.
553
- *
554
- * If the media is still "freezing" after waiting for `UNFREEZING_SEEK_DELAY`
555
- * milliseconds, the RxPlayer will try to un-freeze the situation by interacting
556
- * with the media element.
557
- *
558
- * Those interactions can be costly in time before playback continue, so it
559
- * should be set at a sufficiently high value to avoid false positives.
560
- */
561
- UNFREEZING_SEEK_DELAY: number;
562
- /**
563
- * A media whose position inexplicably does not increment despite playing is
564
- * called as "freezing" in the RxPlayer.
565
- *
566
- * A small freezing interval may be normal as the browser may take time before
567
- * playing, e.g. after a seek.
568
- *
569
- * If the media is still "freezing" after waiting for `FREEZING_STALLED_DELAY`
570
- * milliseconds, the RxPlayer will emit a BUFFERING state through its API to
571
- * notify that the player cannot currently advance.
572
- */
573
- FREEZING_STALLED_DELAY: number;
574
- /**
575
- * A media whose position inexplicably does not increment despite playing is
576
- * called as "freezing" in the RxPlayer.
577
- *
578
- * If the media is frozen for a sufficiently large time
579
- * (@see UNFREEZING_SEEK_DELAY), the RxPlayer will perform a seek corresponding
580
- * to its current position plus `UNFREEZING_DELTA_POSITION` seconds.
581
- *
582
- * This should be kept short enough as the goal is just to un-freeze lower-level
583
- * buffers.
584
- */
585
- UNFREEZING_DELTA_POSITION: number;
586
- /**
587
- * Maximum authorized difference between what we calculated to be the
588
- * beginning or end of the segment in a media buffer and what we
589
- * actually are noticing now.
590
- *
591
- * If the segment seems to have removed more than this size in seconds, we
592
- * will infer that the segment has been garbage collected and we might try to
593
- * re-download it.
594
- * @type {Number}
595
- */
596
- MAX_TIME_MISSING_FROM_COMPLETE_SEGMENT: number;
597
- /**
598
- * The maximum authorized difference, in seconds, between the real buffered
599
- * time of a given chunk and what the segment information of the Manifest
600
- * tells us.
601
- *
602
- * Setting a value too high can lead to parts of the media buffer being
603
- * linked to the wrong segments and to segments wrongly believed to be still
604
- * complete (instead of garbage collected).
605
- *
606
- * Setting a value too low can lead to parts of the media buffer not being
607
- * linked to the concerned segment and to segments wrongly believed to be
608
- * partly garbage collected (instead of complete segments).
609
- * @type {Number}
610
- */
611
- MAX_MANIFEST_BUFFERED_START_END_DIFFERENCE: number;
612
- /**
613
- * The maximum authorized difference, in seconds, between the duration a
614
- * segment should have according to the Manifest and the actual duration it
615
- * seems to have once pushed to the media buffer.
616
- *
617
- * Setting a value too high can lead to parts of the media buffer being
618
- * linked to the wrong segments and to segments wrongly believed to be still
619
- * complete (instead of garbage collected).
620
- *
621
- * Setting a value too low can lead to parts of the media buffer not being
622
- * linked to the concerned segment and to segments wrongly believed to be
623
- * partly garbage collected (instead of complete segments). This last point
624
- * could lead to unnecessary segment re-downloading.
625
- * @type {Number}
626
- */
627
- MAX_MANIFEST_BUFFERED_DURATION_DIFFERENCE: number;
628
- /**
629
- * Minimum duration in seconds a segment should be into a buffered range to be
630
- * considered as part of that range.
631
- * Segments which have less than this amount of time "linked" to a buffered
632
- * range will be deleted.
633
- *
634
- * Setting a value too low can lead in worst-case scenarios to segments being
635
- * wrongly linked to the next or previous range it is truly linked too (if
636
- * those ranges are too close).
637
- *
638
- * Setting a value too high can lead to part of the buffer not being assigned
639
- * any segment. It also limits the minimum duration a segment can be.
640
- *
641
- * TODO As of now, this limits the minimum size a complete segment can be. A
642
- * better logic would be to also consider the duration of a segment. Though
643
- * this logic could lead to bugs with the current code.
644
- * @type {Number}
645
- */
646
- MINIMUM_SEGMENT_SIZE: number;
647
- /**
648
- * Append windows allow to filter media data from segments if they are outside
649
- * a given limit.
650
- * Coded frames with presentation timestamp within this range are allowed to
651
- * be appended to the media buffer while coded frames outside this range are
652
- * filtered out.
653
- *
654
- * Those are often set to be the start and end of the "Period" the segment is
655
- * in.
656
- * However, we noticed that some browsers were too aggressive when the exact
657
- * limits were set: more data than needed was removed, often leading to
658
- * discontinuities.
659
- *
660
- * Those securities are added to the set windows (substracted from the window
661
- * start and added to the window end) to avoid those problems.
662
- * @type {Object}
663
- */
664
- APPEND_WINDOW_SECURITIES: {
665
- START: number;
666
- END: number;
667
- };
668
- /**
669
- * Maximum interval at which text tracks are refreshed in an "html"
670
- * textTrackMode.
671
- *
672
- * The text tracks are also refreshed on various video events, this interval
673
- * will only trigger a refresh if none of those events was received during
674
- * that timespan.
675
- *
676
- * Note that if the TextTrack cue did not change between two intervals or
677
- * events, the DOM won't be refreshed.
678
- * The TextTrack cues structure is also optimized for fast retrieval.
679
- * We should thus not have much of a performance impact here if we set a low
680
- * interval.
681
- *
682
- * @type {Number}
683
- */
684
- MAXIMUM_HTML_TEXT_TRACK_UPDATE_INTERVAL: number;
685
- /**
686
- * On browsers with no ResizeObserver API, this will be the interval in
687
- * milliseconds at which we should check if the text track element has
688
- * changed its size, and updates proportional text-track data accordingly
689
- * (like a proportional font-size).
690
- *
691
- * This is only used:
692
- * - in an "html" textTrackMode
693
- * - when some styling is proportional in the text track data
694
- *
695
- * Putting a value too low will render faster but might use to much proc time.
696
- * Putting a value too high might provoke a re-render too late after the user
697
- * changed the element's size (e.g. when going to fullscreen mode).
698
- *
699
- * @type {Number}
700
- */
701
- TEXT_TRACK_SIZE_CHECKS_INTERVAL: number;
702
- /**
703
- * The Buffer padding is a time offset from the current time that affects
704
- * the buffer.
705
- *
706
- * Basically, from a given time, if the current buffer gap number (time
707
- * between the current time and the end of the downloaded buffer) is above
708
- * the padding described here (of the corresponding type), we won't
709
- * reschedule segments for that range.
710
- *
711
- * This is to avoid excessive re-buffering.
712
- *
713
- * Keeping the padding too low would increase the risk of re-bufferings.
714
- *
715
- * Keeping the padding too high would delay visible quality increase.
716
- *
717
- * @type {Object}
718
- */
719
- BUFFER_PADDING: {
720
- audio: number;
721
- video: number;
722
- other: number;
723
- };
724
- /**
725
- * Segments of different types are downloaded by steps:
726
- *
727
- * - first the audio/video/text Segments which are immediately needed
728
- *
729
- * - then once every of those Segments have been downloaded, less-needed
730
- * Segments
731
- *
732
- * - then once every of those less-needed Segments have been downloaded,
733
- * even less-needed Segments
734
- *
735
- * - etc.
736
- *
737
- * This stepped download strategy allows to make a better use of network
738
- * ressources.
739
- *
740
- * For example, if more than sufficient audio buffer has been downloaded but
741
- * the immediately-needed video Segment is still pending its request, we might
742
- * be in a situation of rebuffering.
743
- * In that case, a better strategy would be to make sure every network
744
- * ressource is allocated for this video Segment before rebuffering happens.
745
- *
746
- * This is where those steps become useful.
747
- *
748
- * --
749
- *
750
- * The numbers defined in this Array describe what the steps are.
751
- *
752
- * Each number is linked to a distance from the current playing position, in
753
- * seconds.
754
- * Distances which will be used as limit points, from which a new step is
755
- * reached (see example).
756
- *
757
- * In the RxPlayer's code, each step is then translated in to a priority
758
- * number.
759
- * The lower is that number, the lower is the step and the lower is the step,
760
- * the higher is the priority.
761
- *
762
- * Note: You can set an empty array to deactivate the steps feature (every
763
- * Segments have the same priority).
764
- *
765
- * @example
766
- *
767
- * let's imagine the following SEGMENT_PRIORITIES_STEPS array:
768
- * [5, 11, 17, 25]
769
- *
770
- * To link each Segments to a corresponding priority number (and thus to a
771
- * specific step), we have to consider the distance between the current
772
- * position and the start time of the Segment.
773
- *
774
- * We have in our example 5 groups, which correspond to the following possible
775
- * distances:
776
- * 1. inferior to 5 => first step (priority number = 0)
777
- * 2. between 5 and 11 => second step (priority number = 1)
778
- * 3. between 11 and 17 => third step (priority number = 2)
779
- * 4. between 17 and 25 => fourth step (priority number = 3)
780
- * 5. superior to 25 => fifth step (priority number = 4)
781
- *
782
- * Segments corresponding to a lower-step will need to all be downloaded
783
- * before Segments of a newer step begin.
784
- *
785
- * @type {Array.<Number>}
786
- */
787
- SEGMENT_PRIORITIES_STEPS: number[];
788
- /**
789
- * Some segment requests are said to be "high priority".
790
- *
791
- * Requests in that category once done will cancel any segment request that
792
- * has a low priority number (see `SEGMENT_PRIORITIES_STEPS`) - meaning a
793
- * priority number equal to `MIN_CANCELABLE_PRIORITY` or more.
794
- *
795
- * Enter here the last priority number that is considered high priority
796
- * (beginning by the first step, which has the priority number `0`).
797
- * @type {number}
798
- */
799
- MAX_HIGH_PRIORITY_LEVEL: number;
800
- /**
801
- * Enter here the first priority step (see `SEGMENT_PRIORITIES_STEPS`) that
802
- * will be considered as low priority.
803
- *
804
- * Segment requests with a low priority will be cancelled if a high priority
805
- * segment request (see MAX_HIGH_PRIORITY_LEVEL) is scheduled while they are
806
- * pending.
807
- *
808
- * This number should be strictly superior to the value indicated in
809
- * `MAX_HIGH_PRIORITY_LEVEL`.
810
- * @type {number}
811
- */
812
- MIN_CANCELABLE_PRIORITY: number;
813
- /**
814
- * Robustnesses used in the {audio,video}Capabilities of the
815
- * MediaKeySystemConfiguration (EME).
816
- *
817
- * Only used for widevine keysystems.
818
- *
819
- * Defined in order of importance (first will be tested first etc.)
820
- * @type {Array.<string>}
821
- */
822
- EME_DEFAULT_WIDEVINE_ROBUSTNESSES: string[];
823
- /**
824
- * Link canonical key systems names to their respective reverse domain name,
825
- * used in the EME APIs.
826
- * This allows to have a simpler API, where users just need to set "widevine"
827
- * or "playready" as a keySystem.
828
- * @type {Object}
829
- */
830
- EME_KEY_SYSTEMS: Partial<Record<string, string[]>>;
831
- /**
832
- * The Manifest parsing logic has a notion of "unsafeMode" which allows to
833
- * speed-up this process a lot with a small risk of de-synchronization with
834
- * what actually is on the server.
835
- * Because using that mode is risky, and can lead to all sort of problems, we
836
- * regularly should fall back to a regular "safe" parsing every once in a
837
- * while.
838
- * This value defines how many consecutive time maximum the "unsafeMode"
839
- * parsing can be done.
840
- */
841
- MAX_CONSECUTIVE_MANIFEST_PARSING_IN_UNSAFE_MODE: number;
842
- /**
843
- * Minimum time spent parsing the Manifest before we can authorize parsing
844
- * it in an "unsafeMode", to speed-up the process with a little risk.
845
- * Please note that this parsing time also sometimes includes idle time such
846
- * as when the parser is waiting for a request to finish.
847
- */
848
- MIN_MANIFEST_PARSING_TIME_TO_ENTER_UNSAFE_MODE: number;
849
- /**
850
- * Minimum amount of <S> elements in a DASH MPD's <SegmentTimeline> element
851
- * necessary to begin parsing the current SegmentTimeline element in an
852
- * unsafe manner (meaning: with risks of de-synchronization).
853
- * This is only done when the "unsafeMode" parsing mode is enabled.
854
- */
855
- MIN_DASH_S_ELEMENTS_TO_PARSE_UNSAFELY: number;
856
- /**
857
- * When we detect that the local Manifest might be out-of-sync with the
858
- * server's one, we schedule a Manifest refresh.
859
- * However, as this "unsynchronization" is only a theory and as we do not want
860
- * to send too many Manifest requests, we keep a delay between the last
861
- * Manifest refresh done and that one.
862
- * This value indicates which delay we want. Note that the Manifest could
863
- * still be refreshed before this delay for other reasons.
864
- * @type {Number}
865
- */
866
- OUT_OF_SYNC_MANIFEST_REFRESH_DELAY: number;
867
- /**
868
- * When a partial Manifest update (that is an update with a partial sub-set
869
- * of the Manifest) fails, we will perform an update with the whole Manifest
870
- * instead.
871
- * To not overload the client - as parsing a Manifest can be resource heavy -
872
- * we set a minimum delay to wait before doing the corresponding request.
873
- * @type {Number}
874
- */
875
- FAILED_PARTIAL_UPDATE_MANIFEST_REFRESH_DELAY: number;
876
- /**
877
- * DASH Manifest based on a SegmentTimeline should normally have an
878
- * MPD@minimumUpdatePeriod attribute which should be sufficient to
879
- * know when to refresh it.
880
- * However, there is a specific case, for when it is equal to 0.
881
- * As of DASH-IF IOP (valid in v4.3), when a DASH's MPD set a
882
- * MPD@minimumUpdatePeriod to `0`, a client should not refresh the MPD
883
- * unless told to do so through inband events, in the stream.
884
- * In reality however, we found it to not always be the case (even with
885
- * DASH-IF own streams) and moreover to not always be the best thing to do.
886
- * We prefer to refresh in average at a regular interval when we do not have
887
- * this information.
888
- * /!\ This value is expressed in seconds.
889
- */
890
- DASH_FALLBACK_LIFETIME_WHEN_MINIMUM_UPDATE_PERIOD_EQUAL_0: number;
891
- /**
892
- * Default value for the maximum number of simultaneous MediaKeySessions that
893
- * will be kept in a cache (linked to the MediaKeys instance) to avoid doing
894
- * superfluous license requests.
895
- *
896
- * If this number is reached, any new session creation will close the oldest
897
- * one.
898
- * Another value can be configured through the API, in which case this default
899
- * will be overwritten.
900
- * @type {Number}
901
- */
902
- EME_DEFAULT_MAX_SIMULTANEOUS_MEDIA_KEY_SESSIONS: number;
903
- /**
904
- * When playing contents with a persistent license, we will usually store some
905
- * information related to that MediaKeySession, to be able to play it at a
906
- * later time.
907
- *
908
- * Those information are removed once a MediaKeySession is not considered
909
- * as "usable" anymore. But to know that, the RxPlayer has to load it.
910
- *
911
- * But the RxPlayer does not re-load every persisted MediaKeySession every
912
- * time to check each one of them one by one, as this would not be a
913
- * performant thing to do.
914
- *
915
- * So this is only done when and if the corresponding content is encountered
916
- * again and only if it contains the same initialization data.
917
- *
918
- * We have to consider that those "information" contain binary data which can
919
- * be of arbitrary length. Size taken by an array of them can relatively
920
- * rapidly take a lot of space in JS memory.
921
- *
922
- * So to avoid this storage to take too much space (would it be in the chosen
923
- * browser's storage or in JS memory), we now set a higher bound for the
924
- * amount of MediaKeySession information that can be stored at the same time.
925
- *
926
- * I set the value of 1000 here, as it seems big enough to not be considered a
927
- * problem (though it can become one, when contents have a lot of keys per
928
- * content), and still low enough so it should not cause much problem (my
929
- * method to choose that number was to work with power of 10s and choosing the
930
- * amount which seemed the most sensible one).
931
- *
932
- * This wasn't battle-tested however.
933
- */
934
- EME_MAX_STORED_PERSISTENT_SESSION_INFORMATION: number;
935
- /**
936
- * Attempts to closing a MediaKeySession can fail, most likely because the
937
- * MediaKeySession was not initialized yet.
938
- * When we consider that we're in one of these case, we will retry to close it.
939
- *
940
- * To avoid going into an infinite loop of retry, this number indicates a
941
- * maximum number of attemps we're going to make (`0` meaning no retry at all,
942
- * `1` only one retry and so on).
943
- */
944
- EME_SESSION_CLOSING_MAX_RETRY: number;
945
- /**
946
- * When closing a MediaKeySession failed due to the reasons explained for the
947
- * `EME_SESSION_CLOSING_MAX_RETRY` config property, we may (among other
948
- * triggers) choose to wait a delay raising exponentially at each retry before
949
- * that new attempt.
950
- * This value indicates the initial value for this delay, in milliseconds.
951
- */
952
- EME_SESSION_CLOSING_INITIAL_DELAY: number;
953
- /**
954
- * When closing a MediaKeySession failed due to the reasons explained for the
955
- * `EME_SESSION_CLOSING_MAX_RETRY` config property, we may (among other
956
- * triggers) choose to wait a delay raising exponentially at each retry before
957
- * that new attempt.
958
- * This value indicates the maximum possible value for this delay, in
959
- * milliseconds.
960
- */
961
- EME_SESSION_CLOSING_MAX_DELAY: number;
962
- /**
963
- * After loading a persistent MediaKeySession, the RxPlayer needs to ensure
964
- * that its keys still allow to decrypt a content.
965
- *
966
- * However on some browsers, the `keyStatuses` property that we used to check
967
- * the keys' satuses linked to that session can be empty for some time after
968
- * the loading operation is done.
969
- *
970
- * This value allows to configure a delay in milliseconds that will be the
971
- * maximum time we will wait after a persistent session is loaded.
972
- * If after that time, the `keyStatuses` property is still empty, we will
973
- * consider that session as not usable.
974
- */
975
- EME_WAITING_DELAY_LOADED_SESSION_EMPTY_KEYSTATUSES: number;
976
- /**
977
- * The player relies on browser events and properties to update its status to
978
- * "ENDED".
979
- *
980
- * Sadly in some cases, like in Chrome 54, this event is never triggered on
981
- * some contents probably due to a browser bug.
982
- *
983
- * This threshold resolves this issue by forcing the status to "ENDED" when:
984
- * 1. the player is stalling
985
- * 2. the absolute difference between current playback time and duration is
986
- * under this value
987
- *
988
- * If set to null, this workaround is disabled and the player only relies on
989
- * browser events.
990
- *
991
- * @type {Number|null}
992
- */
993
- FORCED_ENDED_THRESHOLD: number;
994
- /**
995
- * Maximum duration from the current position we will let in the buffer when
996
- * switching an Adaptation of a given type.
997
- *
998
- * For example, if we have ``text: { before: 1, after: 4 }``, it means that
999
- * when switching subtitles, we will let 1 second before and 4 second after
1000
- * the current position in the previous language (until the new segments
1001
- * overwrite it).
1002
- * This is to allow smooth transitions and avoid de-synchronization that
1003
- * can happen when removing the content being decoded.
1004
- * @type {Object}
1005
- */
1006
- ADAPTATION_SWITCH_BUFFER_PADDINGS: {
1007
- video: {
1008
- before: number;
1009
- after: number;
48
+ DEFAULT_MIN_BITRATES: Record<"audio" | "video" | "other", number>;
49
+ DEFAULT_MAX_BITRATES: Record<"audio" | "video" | "other", number>;
50
+ INACTIVITY_DELAY: number;
51
+ DEFAULT_THROTTLE_WHEN_HIDDEN: boolean;
52
+ DEFAULT_THROTTLE_VIDEO_BITRATE_WHEN_HIDDEN: boolean;
53
+ DEFAULT_LIMIT_VIDEO_WIDTH: boolean;
54
+ DEFAULT_LIVE_GAP: {
55
+ DEFAULT: number;
56
+ LOW_LATENCY: number;
1010
57
  };
1011
- audio: {
1012
- before: number;
1013
- after: number;
58
+ BUFFER_DISCONTINUITY_THRESHOLD: number;
59
+ FORCE_DISCONTINUITY_SEEK_DELAY: number;
60
+ BITRATE_REBUFFERING_RATIO: number;
61
+ BUFFER_GC_GAPS: {
62
+ CALM: number;
63
+ BEEFY: number;
1014
64
  };
1015
- text: {
1016
- before: number;
1017
- after: number;
65
+ DEFAULT_MAX_MANIFEST_REQUEST_RETRY: number;
66
+ DEFAULT_MAX_REQUESTS_RETRY_ON_ERROR: number;
67
+ DEFAULT_MAX_REQUESTS_RETRY_ON_OFFLINE: number;
68
+ INITIAL_BACKOFF_DELAY_BASE: {
69
+ REGULAR: number;
70
+ LOW_LATENCY: number;
1018
71
  };
1019
- image: {
1020
- before: number;
1021
- after: number;
72
+ MAX_BACKOFF_DELAY_BASE: {
73
+ REGULAR: number;
74
+ LOW_LATENCY: number;
1022
75
  };
1023
- };
1024
- /**
1025
- * Interval, in milliseconds, at which we should manually flush
1026
- * SourceBuffers.
1027
- * Some browsers (happened with firefox 66) sometimes "forget" to send us
1028
- * `update` or `updateend` events.
1029
- * In that case, we're completely unable to continue the queue here and
1030
- * stay locked in a waiting state.
1031
- * This interval is here to check at regular intervals if the underlying
1032
- * SourceBuffer is currently updating.
1033
- * @type {Number}
1034
- */
1035
- SOURCE_BUFFER_FLUSHING_INTERVAL: number;
1036
- /**
1037
- * Any already-pushed segment starting before or at the current position +
1038
- * CONTENT_REPLACEMENT_PADDING won't be replaced by new segments.
1039
- *
1040
- * This allows to avoid overwriting segments that are currently being decoded
1041
- * as we encountered many decoding issues when doing so.
1042
- * @type {Number} - in seconds
1043
- */
1044
- CONTENT_REPLACEMENT_PADDING: number;
1045
- /**
1046
- * For video and audio segments, determines two thresholds below which :
1047
- * - The segment is considered as loaded from cache
1048
- * - The segment may be loaded from cache depending on the previous request
1049
- */
1050
- CACHE_LOAD_DURATION_THRESHOLDS: {
1051
- video: number;
1052
- audio: number;
1053
- };
1054
- /** Interval we will use to poll for checking if an event shall be emitted */
1055
- STREAM_EVENT_EMITTER_POLL_INTERVAL: number;
1056
- /**
1057
- * In Javascript, numbers are encoded in a way that a floating number may be
1058
- * represented internally with a rounding error. When multiplying times in
1059
- * seconds by the timescale, we've encoutered cases were the rounding error
1060
- * was amplified by a factor which is about the timescale.
1061
- * Example :
1062
- * (192797480.641122).toFixed(20) = 192797480.64112201333045959473
1063
- * (error is 0.0000000133...)
1064
- * 192797480.641122 * 10000000 = 1927974806411220.2 (error is 0.2)
1065
- * 192797480.641122 * 10000000 * 4 = 7711899225644881 (error is 1)
1066
- * The error is much more significant here, once the timescale has been
1067
- * applied.
1068
- * Thus, we consider that our max tolerable rounding error is 1ms.
1069
- * It is much more than max rounding errors when seen into practice,
1070
- * and not significant from the media loss perspective.
1071
- */
1072
- DEFAULT_MAXIMUM_TIME_ROUNDING_ERROR: number;
1073
- /**
1074
- * RxPlayer's media buffers have a linked history registering recent events
1075
- * that happened on those.
1076
- * The reason is to implement various heuristics in case of weird browser
1077
- * behavior.
1078
- *
1079
- * The `BUFFERED_HISTORY_RETENTION_TIME` is the minimum age an entry of
1080
- * that history can have before being removed from the history.
1081
- */
1082
- BUFFERED_HISTORY_RETENTION_TIME: number;
1083
- /**
1084
- * RxPlayer's media buffers have a linked history registering recent events
1085
- * that happened on those.
1086
- * The reason is to implement various heuristics in case of weird browser
1087
- * behavior.
1088
- *
1089
- * The `BUFFERED_HISTORY_RETENTION_TIME` is the maximum number of entries
1090
- * there can be in that history.
1091
- */
1092
- BUFFERED_HISTORY_MAXIMUM_ENTRIES: number;
1093
- };
1094
- /**
1095
- * Configuration file for the whole player.
1096
- * Feel free to tweak those values if you know what you're doing.
1097
- *
1098
- * Please not that you will need to re-build the whole project to take these
1099
- * modifications into account.
1100
- *
1101
- * @type {Object}
1102
- */
1103
- export default _default;
76
+ SAMPLING_INTERVAL_MEDIASOURCE: number;
77
+ SAMPLING_INTERVAL_LOW_LATENCY: number;
78
+ SAMPLING_INTERVAL_NO_MEDIASOURCE: number;
79
+ ABR_MINIMUM_TOTAL_BYTES: number;
80
+ ABR_MINIMUM_CHUNK_SIZE: number;
81
+ ABR_STARVATION_FACTOR: {
82
+ DEFAULT: number;
83
+ LOW_LATENCY: number;
84
+ };
85
+ ABR_REGULAR_FACTOR: {
86
+ DEFAULT: number;
87
+ LOW_LATENCY: number;
88
+ };
89
+ ABR_STARVATION_GAP: {
90
+ DEFAULT: number;
91
+ LOW_LATENCY: number;
92
+ };
93
+ OUT_OF_STARVATION_GAP: {
94
+ DEFAULT: number;
95
+ LOW_LATENCY: number;
96
+ };
97
+ ABR_STARVATION_DURATION_DELTA: number;
98
+ ABR_FAST_EMA: number;
99
+ ABR_SLOW_EMA: number;
100
+ RESUME_GAP_AFTER_SEEKING: {
101
+ DEFAULT: number;
102
+ LOW_LATENCY: number;
103
+ };
104
+ RESUME_GAP_AFTER_NOT_ENOUGH_DATA: {
105
+ DEFAULT: number;
106
+ LOW_LATENCY: number;
107
+ };
108
+ RESUME_GAP_AFTER_BUFFERING: {
109
+ DEFAULT: number;
110
+ LOW_LATENCY: number;
111
+ };
112
+ REBUFFERING_GAP: {
113
+ DEFAULT: number;
114
+ LOW_LATENCY: number;
115
+ };
116
+ MINIMUM_BUFFER_AMOUNT_BEFORE_FREEZING: number;
117
+ UNFREEZING_SEEK_DELAY: number;
118
+ FREEZING_STALLED_DELAY: number;
119
+ UNFREEZING_DELTA_POSITION: number;
120
+ MAX_TIME_MISSING_FROM_COMPLETE_SEGMENT: number;
121
+ MAX_MANIFEST_BUFFERED_START_END_DIFFERENCE: number;
122
+ MAX_MANIFEST_BUFFERED_DURATION_DIFFERENCE: number;
123
+ MINIMUM_SEGMENT_SIZE: number;
124
+ APPEND_WINDOW_SECURITIES: {
125
+ START: number;
126
+ END: number;
127
+ };
128
+ MAXIMUM_HTML_TEXT_TRACK_UPDATE_INTERVAL: number;
129
+ TEXT_TRACK_SIZE_CHECKS_INTERVAL: number;
130
+ BUFFER_PADDING: {
131
+ audio: number;
132
+ video: number;
133
+ other: number;
134
+ };
135
+ SEGMENT_PRIORITIES_STEPS: number[];
136
+ MAX_HIGH_PRIORITY_LEVEL: number;
137
+ MIN_CANCELABLE_PRIORITY: number;
138
+ EME_DEFAULT_WIDEVINE_ROBUSTNESSES: string[];
139
+ EME_KEY_SYSTEMS: Partial<Record<string, string[]>>;
140
+ MAX_CONSECUTIVE_MANIFEST_PARSING_IN_UNSAFE_MODE: number;
141
+ MIN_MANIFEST_PARSING_TIME_TO_ENTER_UNSAFE_MODE: number;
142
+ MIN_DASH_S_ELEMENTS_TO_PARSE_UNSAFELY: number;
143
+ OUT_OF_SYNC_MANIFEST_REFRESH_DELAY: number;
144
+ FAILED_PARTIAL_UPDATE_MANIFEST_REFRESH_DELAY: number;
145
+ DASH_FALLBACK_LIFETIME_WHEN_MINIMUM_UPDATE_PERIOD_EQUAL_0: number;
146
+ EME_DEFAULT_MAX_SIMULTANEOUS_MEDIA_KEY_SESSIONS: number;
147
+ EME_MAX_STORED_PERSISTENT_SESSION_INFORMATION: number;
148
+ EME_SESSION_CLOSING_MAX_RETRY: number;
149
+ EME_SESSION_CLOSING_INITIAL_DELAY: number;
150
+ EME_SESSION_CLOSING_MAX_DELAY: number;
151
+ EME_WAITING_DELAY_LOADED_SESSION_EMPTY_KEYSTATUSES: number;
152
+ FORCED_ENDED_THRESHOLD: number;
153
+ ADAPTATION_SWITCH_BUFFER_PADDINGS: {
154
+ video: {
155
+ before: number;
156
+ after: number;
157
+ };
158
+ audio: {
159
+ before: number;
160
+ after: number;
161
+ };
162
+ text: {
163
+ before: number;
164
+ after: number;
165
+ };
166
+ image: {
167
+ before: number;
168
+ after: number;
169
+ };
170
+ };
171
+ SOURCE_BUFFER_FLUSHING_INTERVAL: number;
172
+ CONTENT_REPLACEMENT_PADDING: number;
173
+ CACHE_LOAD_DURATION_THRESHOLDS: {
174
+ video: number;
175
+ audio: number;
176
+ };
177
+ STREAM_EVENT_EMITTER_POLL_INTERVAL: number;
178
+ DEFAULT_MAXIMUM_TIME_ROUNDING_ERROR: number;
179
+ BUFFERED_HISTORY_RETENTION_TIME: number;
180
+ BUFFERED_HISTORY_MAXIMUM_ENTRIES: number;
181
+ MIN_BUFFER_LENGTH: number;
182
+ MIN_BUFFER_DISTANCE_BEFORE_CLEAN_UP: number;
183
+ UPTO_CURRENT_POSITION_CLEANUP: number;
184
+ };
185
+ update(config: Partial<IDefaultConfig>): void;
186
+ getCurrent(): IDefaultConfig;
187
+ }
188
+ declare const configHandler: ConfigHandler;
189
+ export default configHandler;