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

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 (297) hide show
  1. package/.eslintrc.js +8 -0
  2. package/CHANGELOG.md +93 -0
  3. package/CONTRIBUTING.md +48 -168
  4. package/FILES.md +40 -92
  5. package/VERSION +1 -1
  6. package/dist/_esm5.processed/compat/browser_detection.d.ts +25 -12
  7. package/dist/_esm5.processed/compat/browser_detection.js +85 -38
  8. package/dist/_esm5.processed/compat/can_reuse_media_keys.js +2 -2
  9. package/dist/_esm5.processed/compat/eme/close_session.js +2 -2
  10. package/dist/_esm5.processed/compat/eme/load_session.js +1 -1
  11. package/dist/_esm5.processed/compat/event_listeners.js +1 -1
  12. package/dist/_esm5.processed/compat/has_issues_with_high_media_source_duration.d.ts +21 -0
  13. package/dist/_esm5.processed/compat/has_issues_with_high_media_source_duration.js +26 -0
  14. package/dist/_esm5.processed/config.d.ts +4 -0
  15. package/dist/_esm5.processed/core/adaptive/adaptive_representation_selector.js +9 -6
  16. package/dist/_esm5.processed/core/adaptive/buffer_based_chooser.d.ts +18 -1
  17. package/dist/_esm5.processed/core/adaptive/buffer_based_chooser.js +106 -25
  18. package/dist/_esm5.processed/core/adaptive/guess_based_chooser.js +6 -6
  19. package/dist/_esm5.processed/core/adaptive/network_analyzer.js +8 -5
  20. package/dist/_esm5.processed/core/adaptive/utils/representation_score_calculator.d.ts +19 -1
  21. package/dist/_esm5.processed/core/adaptive/utils/representation_score_calculator.js +1 -1
  22. package/dist/_esm5.processed/core/api/debug/buffer_graph.d.ts +28 -0
  23. package/dist/_esm5.processed/core/api/debug/buffer_graph.js +175 -0
  24. package/dist/_esm5.processed/core/api/debug/buffer_size_graph.d.ts +10 -0
  25. package/dist/_esm5.processed/core/api/debug/buffer_size_graph.js +104 -0
  26. package/dist/_esm5.processed/core/api/debug/constants.d.ts +2 -0
  27. package/dist/_esm5.processed/core/api/debug/constants.js +2 -0
  28. package/dist/_esm5.processed/core/api/debug/index.d.ts +2 -0
  29. package/dist/_esm5.processed/core/api/debug/index.js +2 -0
  30. package/dist/_esm5.processed/core/api/debug/modules/general_info.d.ts +3 -0
  31. package/dist/_esm5.processed/core/api/debug/modules/general_info.js +180 -0
  32. package/dist/_esm5.processed/core/api/debug/modules/segment_buffer_content.d.ts +4 -0
  33. package/dist/_esm5.processed/core/api/debug/modules/segment_buffer_content.js +121 -0
  34. package/dist/_esm5.processed/core/api/debug/modules/segment_buffer_size.d.ts +3 -0
  35. package/dist/_esm5.processed/core/api/debug/modules/segment_buffer_size.js +35 -0
  36. package/dist/_esm5.processed/core/api/debug/render.d.ts +3 -0
  37. package/dist/_esm5.processed/core/api/debug/render.js +32 -0
  38. package/dist/_esm5.processed/core/api/debug/utils.d.ts +39 -0
  39. package/dist/_esm5.processed/core/api/debug/utils.js +57 -0
  40. package/dist/_esm5.processed/core/api/playback_observer.js +4 -2
  41. package/dist/_esm5.processed/core/api/public_api.d.ts +60 -3
  42. package/dist/_esm5.processed/core/api/public_api.js +280 -60
  43. package/dist/_esm5.processed/core/api/track_management/media_element_tracks_store.js +10 -1
  44. package/dist/_esm5.processed/core/api/track_management/track_dispatcher.d.ts +13 -1
  45. package/dist/_esm5.processed/core/api/track_management/track_dispatcher.js +30 -15
  46. package/dist/_esm5.processed/core/api/track_management/tracks_store.d.ts +3 -1
  47. package/dist/_esm5.processed/core/api/track_management/tracks_store.js +67 -152
  48. package/dist/_esm5.processed/core/api/utils.d.ts +10 -0
  49. package/dist/_esm5.processed/core/api/utils.js +23 -3
  50. package/dist/_esm5.processed/core/decrypt/__tests__/__global__/utils.d.ts +27 -8
  51. package/dist/_esm5.processed/core/decrypt/__tests__/__global__/utils.js +28 -7
  52. package/dist/_esm5.processed/core/decrypt/attach_media_keys.js +1 -1
  53. package/dist/_esm5.processed/core/decrypt/content_decryptor.js +1 -1
  54. package/dist/_esm5.processed/core/decrypt/find_key_system.js +29 -6
  55. package/dist/_esm5.processed/core/decrypt/session_events_listener.js +42 -32
  56. package/dist/_esm5.processed/core/decrypt/utils/check_key_statuses.js +4 -0
  57. package/dist/_esm5.processed/core/decrypt/utils/clean_old_loaded_sessions.js +2 -0
  58. package/dist/_esm5.processed/core/decrypt/utils/loaded_sessions_store.js +5 -1
  59. package/dist/_esm5.processed/core/fetchers/cdn_prioritizer.d.ts +17 -8
  60. package/dist/_esm5.processed/core/fetchers/cdn_prioritizer.js +10 -6
  61. package/dist/_esm5.processed/core/fetchers/manifest/manifest_fetcher.js +5 -4
  62. package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.d.ts +22 -5
  63. package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.js +37 -21
  64. package/dist/_esm5.processed/core/fetchers/segment/task_prioritizer.js +21 -23
  65. package/dist/_esm5.processed/core/fetchers/utils/schedule_request.js +17 -7
  66. package/dist/_esm5.processed/core/init/directfile_content_initializer.js +2 -2
  67. package/dist/_esm5.processed/core/init/media_source_content_initializer.js +74 -41
  68. package/dist/_esm5.processed/core/init/types.d.ts +9 -1
  69. package/dist/_esm5.processed/core/init/utils/content_time_boundaries_observer.d.ts +28 -1
  70. package/dist/_esm5.processed/core/init/utils/content_time_boundaries_observer.js +24 -11
  71. package/dist/_esm5.processed/core/init/utils/create_media_source.js +3 -12
  72. package/dist/_esm5.processed/core/init/utils/end_of_stream.js +6 -3
  73. package/dist/_esm5.processed/core/init/utils/get_loaded_reference.js +2 -1
  74. package/dist/_esm5.processed/core/init/utils/initial_seek_and_play.js +9 -5
  75. package/dist/_esm5.processed/core/init/utils/initialize_content_decryption.js +2 -1
  76. package/dist/_esm5.processed/core/init/utils/media_source_duration_updater.d.ts +58 -0
  77. package/dist/_esm5.processed/core/init/utils/{media_duration_updater.js → media_source_duration_updater.js} +87 -86
  78. package/dist/_esm5.processed/core/init/utils/rebuffering_controller.d.ts +36 -2
  79. package/dist/_esm5.processed/core/init/utils/rebuffering_controller.js +83 -3
  80. package/dist/_esm5.processed/core/init/utils/stream_events_emitter/stream_events_emitter.js +6 -4
  81. package/dist/_esm5.processed/core/init/utils/throw_on_media_error.js +1 -1
  82. package/dist/_esm5.processed/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.d.ts +18 -7
  83. package/dist/_esm5.processed/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.js +38 -50
  84. package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/html_text_segment_buffer.d.ts +8 -0
  85. package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/html_text_segment_buffer.js +16 -2
  86. package/dist/_esm5.processed/core/segment_buffers/implementations/text/native/native_text_segment_buffer.d.ts +8 -0
  87. package/dist/_esm5.processed/core/segment_buffers/implementations/text/native/native_text_segment_buffer.js +12 -0
  88. package/dist/_esm5.processed/core/segment_buffers/implementations/types.d.ts +11 -4
  89. package/dist/_esm5.processed/core/segment_buffers/index.d.ts +2 -2
  90. package/dist/_esm5.processed/core/segment_buffers/segment_buffers_store.js +13 -9
  91. package/dist/_esm5.processed/core/stream/adaptation/adaptation_stream.js +30 -16
  92. package/dist/_esm5.processed/core/stream/adaptation/utils/create_representation_estimator.d.ts +47 -0
  93. package/dist/_esm5.processed/core/stream/adaptation/utils/create_representation_estimator.js +70 -0
  94. package/dist/_esm5.processed/core/stream/orchestrator/stream_orchestrator.js +41 -20
  95. package/dist/_esm5.processed/core/stream/period/period_stream.js +12 -11
  96. package/dist/_esm5.processed/core/stream/representation/representation_stream.js +37 -28
  97. package/dist/_esm5.processed/core/stream/representation/utils/append_segment_to_buffer.d.ts +4 -2
  98. package/dist/_esm5.processed/core/stream/representation/utils/append_segment_to_buffer.js +3 -3
  99. package/dist/_esm5.processed/core/stream/representation/utils/downloading_queue.js +16 -6
  100. package/dist/_esm5.processed/core/stream/representation/utils/push_init_segment.d.ts +3 -2
  101. package/dist/_esm5.processed/core/stream/representation/utils/push_init_segment.js +8 -8
  102. package/dist/_esm5.processed/core/stream/representation/utils/push_media_segment.d.ts +2 -2
  103. package/dist/_esm5.processed/core/stream/representation/utils/push_media_segment.js +2 -3
  104. package/dist/_esm5.processed/core/stream/utils/create_reload_request.js +1 -1
  105. package/dist/_esm5.processed/default_config.d.ts +41 -0
  106. package/dist/_esm5.processed/default_config.js +46 -2
  107. package/dist/_esm5.processed/errors/index.d.ts +2 -2
  108. package/dist/_esm5.processed/errors/media_error.d.ts +23 -1
  109. package/dist/_esm5.processed/errors/media_error.js +18 -5
  110. package/dist/_esm5.processed/experimental/features/debug_element.d.ts +8 -0
  111. package/dist/_esm5.processed/experimental/features/debug_element.js +10 -0
  112. package/dist/_esm5.processed/experimental/features/index.d.ts +1 -0
  113. package/dist/_esm5.processed/experimental/features/index.js +1 -0
  114. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/load_and_push_segment.d.ts +1 -1
  115. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/load_and_push_segment.js +8 -7
  116. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/prepare_source_buffer.js +7 -4
  117. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.js +24 -12
  118. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/index.js +0 -2
  119. package/dist/_esm5.processed/features/features_object.js +1 -0
  120. package/dist/_esm5.processed/features/initialize_features.js +13 -10
  121. package/dist/_esm5.processed/features/types.d.ts +3 -0
  122. package/dist/_esm5.processed/manifest/adaptation.d.ts +21 -2
  123. package/dist/_esm5.processed/manifest/adaptation.js +80 -1
  124. package/dist/_esm5.processed/manifest/manifest.js +2 -0
  125. package/dist/_esm5.processed/manifest/period.js +2 -2
  126. package/dist/_esm5.processed/manifest/representation.d.ts +33 -2
  127. package/dist/_esm5.processed/manifest/representation.js +32 -4
  128. package/dist/_esm5.processed/manifest/utils.js +1 -3
  129. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_adaptation_sets.js +105 -137
  130. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representations.js +25 -5
  131. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/parse_from_document.d.ts +1 -1
  132. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/parse_from_document.js +1 -1
  133. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/dash-wasm-parser.js +1 -0
  134. package/dist/_esm5.processed/public_types.d.ts +13 -3
  135. package/dist/_esm5.processed/tools/TextTrackRenderer/text_track_renderer.js +1 -1
  136. package/dist/_esm5.processed/transports/dash/add_segment_integrity_checks_to_loader.js +15 -11
  137. package/dist/_esm5.processed/transports/dash/low_latency_segment_loader.js +2 -2
  138. package/dist/_esm5.processed/transports/dash/manifest_parser.js +1 -1
  139. package/dist/_esm5.processed/transports/dash/segment_loader.js +4 -4
  140. package/dist/_esm5.processed/transports/local/segment_loader.js +13 -26
  141. package/dist/_esm5.processed/transports/smooth/isobmff/create_boxes.d.ts +4 -6
  142. package/dist/_esm5.processed/transports/smooth/isobmff/create_boxes.js +4 -6
  143. package/dist/_esm5.processed/transports/smooth/segment_loader.js +4 -4
  144. package/dist/_esm5.processed/transports/utils/call_custom_manifest_loader.js +3 -3
  145. package/dist/_esm5.processed/utils/cancellable_sleep.js +4 -10
  146. package/dist/_esm5.processed/utils/create_cancellable_promise.d.ts +26 -0
  147. package/dist/_esm5.processed/utils/create_cancellable_promise.js +52 -0
  148. package/dist/_esm5.processed/utils/is_null_or_undefined.d.ts +1 -1
  149. package/dist/_esm5.processed/utils/is_null_or_undefined.js +1 -1
  150. package/dist/_esm5.processed/utils/reference.js +6 -0
  151. package/dist/_esm5.processed/utils/request/xhr.js +1 -1
  152. package/dist/_esm5.processed/utils/task_canceller.d.ts +34 -15
  153. package/dist/_esm5.processed/utils/task_canceller.js +55 -22
  154. package/dist/mpd-parser.wasm +0 -0
  155. package/dist/rx-player.js +5424 -4712
  156. package/dist/rx-player.min.js +1 -1
  157. package/jest.config.js +1 -5
  158. package/package.json +44 -40
  159. package/scripts/build/constants.d.ts +1 -0
  160. package/scripts/build/generate_build.js +1 -1
  161. package/scripts/fast_demo_build.js +40 -40
  162. package/scripts/generate_full_demo.js +1 -1
  163. package/sonar-project.properties +1 -1
  164. package/src/compat/browser_detection.ts +105 -52
  165. package/src/compat/can_reuse_media_keys.ts +5 -2
  166. package/src/compat/eme/close_session.ts +2 -2
  167. package/src/compat/eme/load_session.ts +1 -1
  168. package/src/compat/event_listeners.ts +1 -1
  169. package/src/compat/has_issues_with_high_media_source_duration.ts +27 -0
  170. package/src/core/adaptive/__tests__/buffer_based_chooser.test.ts +147 -48
  171. package/src/core/adaptive/adaptive_representation_selector.ts +11 -6
  172. package/src/core/adaptive/buffer_based_chooser.ts +144 -26
  173. package/src/core/adaptive/guess_based_chooser.ts +9 -8
  174. package/src/core/adaptive/network_analyzer.ts +9 -4
  175. package/src/core/adaptive/utils/representation_score_calculator.ts +22 -2
  176. package/src/core/api/debug/buffer_graph.ts +247 -0
  177. package/src/core/api/debug/buffer_size_graph.ts +130 -0
  178. package/src/core/api/debug/constants.ts +2 -0
  179. package/src/core/api/debug/index.ts +3 -0
  180. package/src/core/api/debug/modules/general_info.ts +184 -0
  181. package/src/core/api/debug/modules/segment_buffer_content.ts +155 -0
  182. package/src/core/api/debug/modules/segment_buffer_size.ts +48 -0
  183. package/src/core/api/debug/render.ts +40 -0
  184. package/src/core/api/debug/utils.ts +103 -0
  185. package/src/core/api/playback_observer.ts +5 -2
  186. package/src/core/api/public_api.ts +334 -73
  187. package/src/core/api/track_management/media_element_tracks_store.ts +17 -8
  188. package/src/core/api/track_management/track_dispatcher.ts +37 -14
  189. package/src/core/api/track_management/tracks_store.ts +77 -167
  190. package/src/core/api/utils.ts +29 -3
  191. package/src/core/decrypt/__tests__/__global__/utils.ts +61 -40
  192. package/src/core/decrypt/attach_media_keys.ts +1 -1
  193. package/src/core/decrypt/content_decryptor.ts +1 -1
  194. package/src/core/decrypt/find_key_system.ts +25 -11
  195. package/src/core/decrypt/session_events_listener.ts +45 -39
  196. package/src/core/decrypt/utils/check_key_statuses.ts +6 -0
  197. package/src/core/decrypt/utils/clean_old_loaded_sessions.ts +2 -1
  198. package/src/core/decrypt/utils/loaded_sessions_store.ts +8 -1
  199. package/src/core/fetchers/cdn_prioritizer.ts +18 -9
  200. package/src/core/fetchers/manifest/manifest_fetcher.ts +5 -4
  201. package/src/core/fetchers/segment/segment_fetcher.ts +36 -14
  202. package/src/core/fetchers/segment/task_prioritizer.ts +25 -30
  203. package/src/core/fetchers/utils/schedule_request.ts +18 -7
  204. package/src/core/init/directfile_content_initializer.ts +2 -1
  205. package/src/core/init/media_source_content_initializer.ts +89 -50
  206. package/src/core/init/types.ts +9 -1
  207. package/src/core/init/utils/content_time_boundaries_observer.ts +48 -12
  208. package/src/core/init/utils/create_media_source.ts +4 -16
  209. package/src/core/init/utils/end_of_stream.ts +6 -3
  210. package/src/core/init/utils/get_loaded_reference.ts +2 -1
  211. package/src/core/init/utils/initial_seek_and_play.ts +9 -5
  212. package/src/core/init/utils/initialize_content_decryption.ts +2 -1
  213. package/src/core/init/utils/{media_duration_updater.ts → media_source_duration_updater.ts} +103 -110
  214. package/src/core/init/utils/rebuffering_controller.ts +115 -4
  215. package/src/core/init/utils/stream_events_emitter/stream_events_emitter.ts +6 -4
  216. package/src/core/init/utils/throw_on_media_error.ts +1 -1
  217. package/src/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.ts +63 -66
  218. package/src/core/segment_buffers/implementations/text/html/html_text_segment_buffer.ts +20 -2
  219. package/src/core/segment_buffers/implementations/text/native/native_text_segment_buffer.ts +16 -0
  220. package/src/core/segment_buffers/implementations/types.ts +16 -4
  221. package/src/core/segment_buffers/index.ts +2 -0
  222. package/src/core/segment_buffers/segment_buffers_store.ts +16 -13
  223. package/src/core/stream/adaptation/adaptation_stream.ts +33 -19
  224. package/src/core/stream/adaptation/utils/create_representation_estimator.ts +114 -0
  225. package/src/core/stream/orchestrator/stream_orchestrator.ts +42 -20
  226. package/src/core/stream/period/period_stream.ts +13 -11
  227. package/src/core/stream/representation/representation_stream.ts +49 -37
  228. package/src/core/stream/representation/utils/append_segment_to_buffer.ts +9 -4
  229. package/src/core/stream/representation/utils/downloading_queue.ts +16 -4
  230. package/src/core/stream/representation/utils/push_init_segment.ts +11 -6
  231. package/src/core/stream/representation/utils/push_media_segment.ts +3 -3
  232. package/src/core/stream/utils/create_reload_request.ts +1 -1
  233. package/src/default_config.ts +59 -11
  234. package/src/errors/__tests__/media_error.test.ts +6 -6
  235. package/src/errors/index.ts +4 -1
  236. package/src/errors/media_error.ts +67 -1
  237. package/src/experimental/features/__tests__/debug_element.test.ts +26 -0
  238. package/src/experimental/features/debug_element.ts +13 -0
  239. package/src/experimental/features/index.ts +1 -0
  240. package/src/experimental/tools/VideoThumbnailLoader/load_and_push_segment.ts +10 -7
  241. package/src/experimental/tools/VideoThumbnailLoader/prepare_source_buffer.ts +7 -4
  242. package/src/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.ts +25 -10
  243. package/src/experimental/tools/mediaCapabilitiesProber/index.ts +0 -4
  244. package/src/features/__tests__/initialize_features.test.ts +11 -0
  245. package/src/features/features_object.ts +1 -0
  246. package/src/features/initialize_features.ts +15 -10
  247. package/src/features/types.ts +9 -0
  248. package/src/manifest/__tests__/manifest.test.ts +7 -7
  249. package/src/manifest/__tests__/period.test.ts +90 -45
  250. package/src/manifest/adaptation.ts +96 -1
  251. package/src/manifest/manifest.ts +4 -0
  252. package/src/manifest/period.ts +4 -2
  253. package/src/manifest/representation.ts +77 -5
  254. package/src/manifest/utils.ts +1 -3
  255. package/src/parsers/manifest/dash/common/parse_adaptation_sets.ts +116 -151
  256. package/src/parsers/manifest/dash/common/parse_representations.ts +21 -4
  257. package/src/parsers/manifest/dash/js-parser/parse_from_document.ts +1 -1
  258. package/src/parsers/manifest/dash/wasm-parser/ts/dash-wasm-parser.ts +1 -0
  259. package/src/parsers/texttracks/ttml/parse_ttml.ts +1 -1
  260. package/src/public_types.ts +16 -1
  261. package/src/tools/TextTrackRenderer/text_track_renderer.ts +1 -1
  262. package/src/transports/dash/add_segment_integrity_checks_to_loader.ts +31 -22
  263. package/src/transports/dash/low_latency_segment_loader.ts +2 -2
  264. package/src/transports/dash/manifest_parser.ts +1 -1
  265. package/src/transports/dash/segment_loader.ts +4 -4
  266. package/src/transports/local/segment_loader.ts +14 -30
  267. package/src/transports/smooth/isobmff/create_boxes.ts +4 -6
  268. package/src/transports/smooth/segment_loader.ts +4 -4
  269. package/src/transports/utils/call_custom_manifest_loader.ts +3 -3
  270. package/src/typings/globals.d.ts +21 -19
  271. package/src/utils/cancellable_sleep.ts +5 -14
  272. package/src/utils/create_cancellable_promise.ts +69 -0
  273. package/src/utils/is_null_or_undefined.ts +1 -1
  274. package/src/utils/reference.ts +6 -0
  275. package/src/utils/request/xhr.ts +1 -1
  276. package/src/utils/task_canceller.ts +63 -34
  277. package/tsconfig.json +1 -1
  278. package/tsconfig.modules.json +1 -1
  279. package/dist/_esm5.processed/core/init/utils/media_duration_updater.d.ts +0 -56
  280. package/locked_reps.js +0 -46
  281. package/scripts/doc-generator/construct_table_of_contents.js +0 -76
  282. package/scripts/doc-generator/convert_MD_to_HMTL.js +0 -26
  283. package/scripts/doc-generator/create_documentation.js +0 -331
  284. package/scripts/doc-generator/create_documentation_page.js +0 -209
  285. package/scripts/doc-generator/create_page.js +0 -210
  286. package/scripts/doc-generator/generate_header_html.js +0 -147
  287. package/scripts/doc-generator/generate_page_html.js +0 -115
  288. package/scripts/doc-generator/generate_page_list_html.js +0 -92
  289. package/scripts/doc-generator/generate_sidebar_html.js +0 -85
  290. package/scripts/doc-generator/get_search_data_for_content.js +0 -137
  291. package/scripts/doc-generator/index.js +0 -34
  292. package/scripts/doc-generator/parse_doc_configs.js +0 -327
  293. package/scripts/doc-generator/scripts/lunr.js +0 -10
  294. package/scripts/doc-generator/scripts/script.js +0 -451
  295. package/scripts/doc-generator/styles/code.css +0 -99
  296. package/scripts/doc-generator/styles/style.css +0 -835
  297. package/scripts/doc-generator/utils.js +0 -74
package/FILES.md CHANGED
@@ -1,44 +1,14 @@
1
- # File architecture ############################################################
1
+ # File architecture
2
2
 
3
3
  This page describes how the player files are organized. Each chapter go through
4
4
  a single directory or subdirectory, in alphabetical order.
5
5
 
6
6
 
7
- ## Table of Contents ###########################################################
8
-
9
- - [demo/: Demos of rx-player implementations](#demo)
10
- - [dist/: Player builds](#dist)
11
- - [doc/: Player documentation](#doc)
12
- - [scripts/: Tools and scripts](#scripts)
13
- - [src/: the source code](#src)
14
- - [src/compat/: The compatibility files](#src-compat)
15
- - [src/core/: The core files](#src-core)
16
- - [src/errors/: Error definitions](#src-errors)
17
- - [src/experimental/: Experimental features](#src-experimental)
18
- - [src/features/: Feature switching](#src-features)
19
- - [src/manifest/: The Manifest class](#src-manifest)
20
- - [src/transports/: The transport protocols](#src-transports)
21
- - [src/parsers/: The parsing files](#src-parsers)
22
- - [src/typings/: Typescript typings](#src-typings)
23
- - [src/utils/: The utils](#src-utils)
24
- - [src/core/: The core directory](#core)
25
- - [src/core/adaptive/: The adaptive bitrate code](#core-abr)
26
- - [src/core/api/: The API definition](#core-api)
27
- - [src/core/stream/: Load the right segments](#core-stream)
28
- - [src/core/decrypt/: Decryption management](#core-decrypt)
29
- - [src/core/fetchers/: The fetchers](#core-fetchers)
30
- - [src/core/segment_buffers/: The Media buffers](#core-sb)
31
- - [src/core/init/: Media streaming logic](#core-init)
32
- - [src/**/__tests__: the unit tests directories](#src-tests)
33
- - [tests/: the player's tests](#tests)
34
-
35
-
36
- <a name="demo"></a>
37
- ## The demo/ directory: Demos of rx-player implementations #####################
38
-
39
- Demonstration of functional codebases implementing the rx-player.
40
-
41
- At the time of writing, there are two demos:
7
+ ## `demo/`: Demo applications
8
+
9
+ The `demo/` directory contains demos of application using the RxPlayer.
10
+
11
+ At the time of writing, there are two distinct demos:
42
12
 
43
13
  - _full_: Demo with a graphic interface, written with the React library, to
44
14
  showcase what the player can do
@@ -48,36 +18,35 @@ At the time of writing, there are two demos:
48
18
  the displayed page.
49
19
 
50
20
 
51
- <a name="dist"></a>
52
- ## The dist/ directory: Player builds ##########################################
21
+ ## `dist/`: Builds
53
22
 
54
- Store the player builds of the last version released.
23
+ The `demo/` directory stores the player builds of the last version released.
55
24
 
56
- Contains two files: the minified (``rx-player.min.js``) and the non-minified
57
- files (``rx-player.js``). Both are automatically generated with scripts at every
58
- new release.
25
+ Contains the minified (``rx-player.min.js``) and the non-minified files
26
+ (``rx-player.js``). Both are automatically generated with scripts at every new
27
+ release.
59
28
 
60
29
  Two directories, namely ``_esm5.raw`` and ``_esm5.processed`` can also be
61
30
  generated in here if the right scripts are called.
62
31
  These allow to publish more modular codebases to npm.
63
32
 
64
33
 
65
- <a name="doc"></a>
66
- ## The doc/ directory: Player documentation ####################################
34
+ ## `doc/`: Documentation
67
35
 
68
- Documentation, mostly in markdown, of various subjects related to the rx-player:
36
+ The `doc/` directory contains the RxPlayer's documentation, mostly written in
37
+ markdown, on various subjects related to the rx-player:
69
38
  - API documentation
70
39
  - tutorials
71
40
  - list of deprecated APIs...
72
41
  - how to transition between RxPlayer versions
42
+ - how to contribute
73
43
  - etc.
74
44
 
75
45
 
76
- <a name="scripts"></a>
77
- ## The scripts/ directory: scripts #####################################
46
+ ## `scripts/`: Project-managing scripts
78
47
 
79
- Contains various scripts used to help the test and the management of the player
80
- code.
48
+ The `scripts/` directory contains various scripts used to help the test and the
49
+ management of the player code.
81
50
 
82
51
  For example:
83
52
  - generating one of the demo and starting the server to run it
@@ -86,16 +55,14 @@ For example:
86
55
  - generating the rx-player build before publishing on npm
87
56
 
88
57
 
89
- <a name="src"></a>
90
- ## The src/ directory: the source code #########################################
58
+ ## `src/`: The source code
91
59
 
92
- The src contains the entire source code of the rx-player.
60
+ The `src` directory contains the entire source code of the rx-player.
93
61
 
94
62
  It is subdivized into subdirectories which are defined here.
95
63
 
96
64
 
97
- <a name="src-compat"></a>
98
- ### src/compat/: The compatibility files #######################################
65
+ ### `src/compat/`: Compatibility files
99
66
 
100
67
  ``src/compat`` contains functions allowing to use browser APIs in a
101
68
  cross-browser manner.
@@ -110,8 +77,7 @@ Every functions needed in the rest of the code are exported in
110
77
  ``import { whatINeed } from "../compat";``)
111
78
 
112
79
 
113
- <a name="src-core"></a>
114
- ### src/core/: The core files ##################################################
80
+ ### `src/core/`: Core logic
115
81
 
116
82
  Defines the logic and behavior of the player, regardless of the browser and of
117
83
  the streaming technology used.
@@ -126,22 +92,19 @@ This directory contains other subdirectories which are listed in the next
126
92
  chapter.
127
93
 
128
94
 
129
- <a name="src-errors"></a>
130
- ### src/errors/: Error definitions #############################################
95
+ ### `src/errors/`: Error definitions
131
96
 
132
97
  Contains the definition of the error classes used in the rx-player and
133
98
  accessible through the API.
134
99
 
135
100
 
136
- <a name="src-experimental"></a>
137
- ### src/experimental/: Experimental features ###################################
101
+ ### `src/experimental/`: Experimental features
138
102
 
139
103
  You will find here experimental features. Those are tested features who might
140
104
  completely change their API in new player versions.
141
105
 
142
106
 
143
- <a name="src-features"></a>
144
- ### src/features/: Feature switching ###########################################
107
+ ### `src/features/`: Feature switching
145
108
 
146
109
  This manage activated or deactivated features (e.g. DASH, TTML subtitles
147
110
  parsing).
@@ -150,16 +113,14 @@ It exports an object defining the different activated features and provide utils
150
113
  to initialize and update them.
151
114
 
152
115
 
153
- <a name="src-manifest"></a>
154
- ### src/manifest/: The Manifest class ##########################################
116
+ ### `src/manifest/`: Manifest Object definition
155
117
 
156
118
  Defines a common `Manifest` class, regardless of the streaming technology (DASH,
157
119
  HSS...). This class is then used by the rest of the RxPlayer, to allow
158
120
  interaction with it without considering the underlying technology used.
159
121
 
160
122
 
161
- <a name="src-transports"></a>
162
- ### src/transports/: The transport protocols ###################################
123
+ ### `src/transports/`: Streaming protocols implementation
163
124
 
164
125
  Defines a common interface for multiple streaming technologies (DASH, HSS).
165
126
 
@@ -174,8 +135,7 @@ As in most of the code of the rx-player, everything used in the other parts of
174
135
  the code is exported in the index.js file at the root of this directory.
175
136
 
176
137
 
177
- <a name="src-parsers"></a>
178
- ### src/parsers/: The parsers ##################################################
138
+ ### `src/parsers/`: The parsers
179
139
 
180
140
  Functions to parse various formats into the same interface.
181
141
 
@@ -186,22 +146,19 @@ The parsed data being either:
186
146
  - image containers: BIF
187
147
 
188
148
 
189
- <a name="src-typings"></a>
190
- ### src/typings/: Typescript typings ###########################################
149
+ ### `src/typings/`: Typescript typings
191
150
 
192
151
  This directory contains only declaration files for TypeScript. It is
193
152
  automatically added as a `typeRoots` when the TypeScript code is transpiled.
194
153
 
195
154
 
196
- <a name="src-utils"></a>
197
- ### src/utils/: The utils ######################################################
155
+ ### `src/utils/`: Util functions
198
156
 
199
157
  This directory contains general helpers which are used in different parts of the
200
158
  rx-player code.
201
159
 
202
160
 
203
- <a name="core"></a>
204
- ## The src/core/ directory #####################################################
161
+ ## Inside `src/core/`
205
162
 
206
163
  As written in the previous chapter, this is the "core" of the player, where the
207
164
  logic is defined.
@@ -209,8 +166,7 @@ logic is defined.
209
166
  As this directory is versatile and complicated, it also deserves its own chapter.
210
167
 
211
168
 
212
- <a name="core-abr"></a>
213
- ### src/core/adaptive/: The adaptive bitrate code ##############################
169
+ ### `src/core/adaptive/`: Adaptive BitRate logic
214
170
 
215
171
  Defines functions which manages the adaptive streaming part of the player.
216
172
 
@@ -225,29 +181,25 @@ This allows to isolate this complex part and facilitate future refactoring and
225
181
  improvements.
226
182
 
227
183
 
228
- <a name="core-api"></a>
229
- ### src/core/api/: The API definition ##########################################
184
+ ### `src/core/api/`: API definition
230
185
 
231
186
  Defines the rx-player API. This is the part the library user will directly
232
187
  interact with.
233
188
 
234
189
 
235
- <a name="core-stream"></a>
236
- ### src/core/stream/: Load the right segments ##################################
190
+ ### `src/core/stream/`: Segment-picking logic
237
191
 
238
192
  The code there calculate which segments should be downloaded, ask for their
239
193
  download and push the segments into the `SegmentBuffers`.
240
194
 
241
195
 
242
- <a name="core-decrypt"></a>
243
- ### src/core/decrypt/: Decryption management ###################################
196
+ ### `src/core/decrypt/`: Decryption handling
244
197
 
245
198
  Defines functions allowing to handle encrypted contents through the EME browser
246
199
  APIs.
247
200
 
248
201
 
249
- <a name="core-fetchers"></a>
250
- ### src/core/fetchers/: The fetchers ###########################################
202
+ ### `src/core/fetchers/`: Load resources
251
203
 
252
204
  Handle the segments and Manifest downloading pipelines (load and parse) as
253
205
  defined in the ``src/transports/`` directory.
@@ -257,8 +209,7 @@ It facilitates the role of loading the Manifest and new segments for the rest of
257
209
  the core.
258
210
 
259
211
 
260
- <a name="core-sb"></a>
261
- ### src/core/segment_buffers/: The media buffers ###############################
212
+ ### `src/core/segment_buffers/`: Media buffers
262
213
 
263
214
  Code allowing to interact with the media buffers called `SegmentBuffers`.
264
215
 
@@ -271,8 +222,7 @@ for other type of contents (like subtitles), we rely on completely custom media
271
222
  buffers implementations.
272
223
 
273
224
 
274
- <a name="core-init"></a>
275
- ### src/core/init/: Content initialization #####################################
225
+ ### `src/core/init/`: Content initialization and orchestration
276
226
 
277
227
  This is the central part which download manifests, initialize MSE and EME APIs,
278
228
  instanciate the central `StreamOrchestrator` (which will allow to download and
@@ -280,8 +230,7 @@ push segments so the content can play) and link together many subparts of the
280
230
  player.
281
231
 
282
232
 
283
- <a name="src-tests"></a>
284
- ## src/**/__tests__: the unit tests directories ################################
233
+ ## `src/**/__tests__`: Unit tests
285
234
 
286
235
  You will find multiple directories named `__tests__` in the RxPlayer.
287
236
  Those contain unit tests and are put in the same directory than the code it
@@ -303,8 +252,7 @@ Their filename don't follow the same convention than single-source unit tests
303
252
  but should still be suffixed by `.test.ts`.
304
253
 
305
254
 
306
- <a name="tests"></a>
307
- ## The tests/ directory: the player's tests ####################################
255
+ ## `tests/`: The RxPlayer's general tests
308
256
 
309
257
  This directory contains most testing code for the RxPlayer.
310
258
 
package/VERSION CHANGED
@@ -1 +1 @@
1
- 4.0.0-beta.0
1
+ 4.0.0-beta.2
@@ -13,17 +13,30 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- declare const isIE11: boolean;
17
- declare const isIEOrEdge: boolean;
18
- declare const isEdgeChromium: boolean;
19
- declare const isFirefox: boolean;
20
- declare const isSamsungBrowser: boolean;
21
- declare const isTizen: boolean;
22
- declare const isWebOs: boolean;
23
- declare const isWebOs2021: boolean;
24
- declare const isWebOs2022: boolean;
16
+ /** Edge Chromium, regardless of the device */
17
+ declare let isEdgeChromium: boolean;
18
+ /** IE11, regardless of the device */
19
+ declare let isIE11: boolean;
20
+ /** IE11 or Edge __Legacy__ (not Edge Chromium), regardless of the device */
21
+ declare let isIEOrEdge: boolean;
22
+ /** Firefox, regardless of the device */
23
+ declare let isFirefox: boolean;
25
24
  /** `true` on Safari on a PC platform (i.e. not iPhone / iPad etc.) */
26
- declare const isSafariDesktop: boolean;
25
+ declare let isSafariDesktop: boolean;
27
26
  /** `true` on Safari on an iPhone, iPad & iPod platform */
28
- declare const isSafariMobile: boolean;
29
- export { isEdgeChromium, isIE11, isIEOrEdge, isFirefox, isSafariDesktop, isSafariMobile, isSamsungBrowser, isTizen, isWebOs, isWebOs2021, isWebOs2022, };
27
+ declare let isSafariMobile: boolean;
28
+ /** Samsung's own browser application */
29
+ declare let isSamsungBrowser: boolean;
30
+ /** `true` on devices where Tizen is the OS (e.g. Samsung TVs). */
31
+ declare let isTizen: boolean;
32
+ /** `true` on devices where WebOS is the OS (e.g. LG TVs). */
33
+ declare let isWebOs: boolean;
34
+ /** `true` specifically for WebOS 2021 version. */
35
+ declare let isWebOs2021: boolean;
36
+ /** `true` specifically for WebOS 2022 version. */
37
+ declare let isWebOs2022: boolean;
38
+ /** `true` for Panasonic devices. */
39
+ declare let isPanasonic: boolean;
40
+ /** `true` for the PlayStation 5 game console. */
41
+ declare let isPlayStation5: boolean;
42
+ export { isEdgeChromium, isIE11, isIEOrEdge, isFirefox, isPanasonic, isPlayStation5, isSafariDesktop, isSafariMobile, isSamsungBrowser, isTizen, isWebOs, isWebOs2021, isWebOs2022, };
@@ -13,44 +13,91 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- var _a, _b;
17
16
  import isNode from "./is_node";
18
- // true on IE11
19
- // false on Edge and other IEs/browsers.
20
- var isIE11 = !isNode &&
21
- typeof window.MSInputMethodContext !== "undefined" &&
22
- typeof document.documentMode !== "undefined";
23
- // true for IE / Edge
24
- var isIEOrEdge = isNode ?
25
- false :
26
- navigator.appName === "Microsoft Internet Explorer" ||
27
- navigator.appName === "Netscape" &&
28
- /(Trident|Edge)\//.test(navigator.userAgent);
29
- var isEdgeChromium = !isNode &&
30
- navigator.userAgent.toLowerCase().indexOf("edg/") !== -1;
31
- var isFirefox = !isNode &&
32
- navigator.userAgent.toLowerCase().indexOf("firefox") !== -1;
33
- var isSamsungBrowser = !isNode &&
34
- /SamsungBrowser/.test(navigator.userAgent);
35
- var isTizen = !isNode &&
36
- /Tizen/.test(navigator.userAgent);
37
- var isWebOs = !isNode &&
38
- navigator.userAgent.indexOf("Web0S") >= 0;
39
- // Inspired form: http://webostv.developer.lge.com/discover/specifications/web-engine/
40
- // Note: even that page doesn't correspond to what we've actually seen in the
41
- // wild
42
- var isWebOs2021 = isWebOs &&
43
- (/[Ww]eb[O0]S.TV-2021/.test(navigator.userAgent) ||
44
- /[Cc]hr[o0]me\/79/.test(navigator.userAgent));
45
- var isWebOs2022 = isWebOs &&
46
- (/[Ww]eb[O0]S.TV-2022/.test(navigator.userAgent) ||
47
- /[Cc]hr[o0]me\/87/.test(navigator.userAgent));
17
+ /** Edge Chromium, regardless of the device */
18
+ var isEdgeChromium = false;
19
+ /** IE11, regardless of the device */
20
+ var isIE11 = false;
21
+ /** IE11 or Edge __Legacy__ (not Edge Chromium), regardless of the device */
22
+ var isIEOrEdge = false;
23
+ /** Firefox, regardless of the device */
24
+ var isFirefox = false;
48
25
  /** `true` on Safari on a PC platform (i.e. not iPhone / iPad etc.) */
49
- var isSafariDesktop = !isNode && (Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor") >= 0 ||
50
- ((_b = (_a = window.safari) === null || _a === void 0 ? void 0 : _a.pushNotification) === null || _b === void 0 ? void 0 : _b.toString()) ===
51
- "[object SafariRemoteNotification]");
26
+ var isSafariDesktop = false;
52
27
  /** `true` on Safari on an iPhone, iPad & iPod platform */
53
- var isSafariMobile = !isNode &&
54
- typeof navigator.platform === "string" &&
55
- /iPad|iPhone|iPod/.test(navigator.platform);
56
- export { isEdgeChromium, isIE11, isIEOrEdge, isFirefox, isSafariDesktop, isSafariMobile, isSamsungBrowser, isTizen, isWebOs, isWebOs2021, isWebOs2022, };
28
+ var isSafariMobile = false;
29
+ /** Samsung's own browser application */
30
+ var isSamsungBrowser = false;
31
+ /** `true` on devices where Tizen is the OS (e.g. Samsung TVs). */
32
+ var isTizen = false;
33
+ /** `true` on devices where WebOS is the OS (e.g. LG TVs). */
34
+ var isWebOs = false;
35
+ /** `true` specifically for WebOS 2021 version. */
36
+ var isWebOs2021 = false;
37
+ /** `true` specifically for WebOS 2022 version. */
38
+ var isWebOs2022 = false;
39
+ /** `true` for Panasonic devices. */
40
+ var isPanasonic = false;
41
+ /** `true` for the PlayStation 5 game console. */
42
+ var isPlayStation5 = false;
43
+ ((function findCurrentBrowser() {
44
+ var _a, _b;
45
+ if (isNode) {
46
+ return;
47
+ }
48
+ // 1 - Find out browser between IE/Edge Legacy/Edge Chromium/Firefox/Safari
49
+ if (typeof window.MSInputMethodContext !== "undefined" &&
50
+ typeof document.documentMode !== "undefined") {
51
+ isIE11 = true;
52
+ isIEOrEdge = true;
53
+ }
54
+ else if (navigator.appName === "Microsoft Internet Explorer" ||
55
+ navigator.appName === "Netscape" &&
56
+ /(Trident|Edge)\//.test(navigator.userAgent)) {
57
+ isIEOrEdge = true;
58
+ }
59
+ else if (navigator.userAgent.toLowerCase().indexOf("edg/") !== -1) {
60
+ isEdgeChromium = true;
61
+ }
62
+ else if (navigator.userAgent.toLowerCase().indexOf("firefox") !== -1) {
63
+ isFirefox = true;
64
+ }
65
+ else if (typeof navigator.platform === "string" &&
66
+ /iPad|iPhone|iPod/.test(navigator.platform)) {
67
+ isSafariMobile = true;
68
+ }
69
+ else if (Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor") >= 0 ||
70
+ ((_b = (_a = window.safari) === null || _a === void 0 ? void 0 : _a.pushNotification) === null || _b === void 0 ? void 0 : _b.toString()) ===
71
+ "[object SafariRemoteNotification]") {
72
+ isSafariDesktop = true;
73
+ }
74
+ // 2 - Find out specific device/platform information
75
+ // Samsung browser e.g. on Android
76
+ if (/SamsungBrowser/.test(navigator.userAgent)) {
77
+ isSamsungBrowser = true;
78
+ }
79
+ if (navigator.userAgent.indexOf("PlayStation 5") !== -1) {
80
+ isPlayStation5 = true;
81
+ }
82
+ else if (/Tizen/.test(navigator.userAgent)) {
83
+ isTizen = true;
84
+ // Inspired form: http://webostv.developer.lge.com/discover/specifications/web-engine/
85
+ // Note: even that page doesn't correspond to what we've actually seen in the
86
+ // wild
87
+ }
88
+ else if (/[Ww]eb[O0]S/.test(navigator.userAgent)) {
89
+ isWebOs = true;
90
+ if (/[Ww]eb[O0]S.TV-2022/.test(navigator.userAgent) ||
91
+ /[Cc]hr[o0]me\/87/.test(navigator.userAgent)) {
92
+ isWebOs2022 = true;
93
+ }
94
+ else if (/[Ww]eb[O0]S.TV-2021/.test(navigator.userAgent) ||
95
+ /[Cc]hr[o0]me\/79/.test(navigator.userAgent)) {
96
+ isWebOs2021 = true;
97
+ }
98
+ }
99
+ else if (/[Pp]anasonic/.test(navigator.userAgent)) {
100
+ isPanasonic = true;
101
+ }
102
+ })());
103
+ export { isEdgeChromium, isIE11, isIEOrEdge, isFirefox, isPanasonic, isPlayStation5, isSafariDesktop, isSafariMobile, isSamsungBrowser, isTizen, isWebOs, isWebOs2021, isWebOs2022, };
@@ -1,4 +1,4 @@
1
- import { isWebOs } from "./browser_detection";
1
+ import { isPanasonic, isWebOs, } from "./browser_detection";
2
2
  /**
3
3
  * Returns `true` if a `MediaKeys` instance (the `Encrypted Media Extension`
4
4
  * concept) can be reused between contents.
@@ -12,5 +12,5 @@ import { isWebOs } from "./browser_detection";
12
12
  * @returns {boolean}
13
13
  */
14
14
  export default function canReuseMediaKeys() {
15
- return !isWebOs;
15
+ return !isWebOs && !isPanasonic;
16
16
  }
@@ -136,7 +136,7 @@ export default function closeSession(session) {
136
136
  return [3 /*break*/, 4];
137
137
  case 2:
138
138
  err_2 = _a.sent();
139
- if (timeoutCanceller.isUsed) { // Reminder: cancelled == session closed
139
+ if (timeoutCanceller.isUsed()) { // Reminder: cancelled == session closed
140
140
  return [2 /*return*/];
141
141
  }
142
142
  // The caught error can tell if session is closed
@@ -151,7 +151,7 @@ export default function closeSession(session) {
151
151
  _a.sent();
152
152
  return [3 /*break*/, 4];
153
153
  case 4:
154
- if (timeoutCanceller.isUsed) { // Reminder: cancelled == session closed
154
+ if (timeoutCanceller.isUsed()) { // Reminder: cancelled == session closed
155
155
  return [2 /*return*/];
156
156
  }
157
157
  throw new Error("Compat: Couldn't know if session is closed");
@@ -70,7 +70,7 @@ export default function loadSession(session, sessionId) {
70
70
  return __generator(this, function (_a) {
71
71
  switch (_a.label) {
72
72
  case 0:
73
- log.info("Compat/DRM: Load persisted session", sessionId);
73
+ log.info("DRM: Load persisted session", sessionId);
74
74
  return [4 /*yield*/, session.load(sessionId)];
75
75
  case 1:
76
76
  isLoaded = _a.sent();
@@ -75,7 +75,7 @@ function createCompatibleEventListener(eventNames, prefixes) {
75
75
  var mem;
76
76
  var prefixedEvents = eventPrefixed(eventNames, prefixes);
77
77
  return function (element, listener, cancelSignal) {
78
- if (cancelSignal.isCancelled) {
78
+ if (cancelSignal.isCancelled()) {
79
79
  return;
80
80
  }
81
81
  // if the element is a HTMLElement we can detect
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Some platforms have issues when the `MediaSource`'s `duration` property
3
+ * is set to a very high value (playback freezes) but not when setting it
4
+ * to `Infinity`, which is what the HTML spec as of now (2023-05-15) recommends
5
+ * for live contents.
6
+ *
7
+ * However setting the `MediaSource`'s `duration` property to `Infinity` seems
8
+ * more risky, considering all platforms we now support, than setting it at a
9
+ * relatively high ~2**32 value which is what we do generally.
10
+ *
11
+ * Moreover, setting it to `Infinity` require us to use another MSE API,
12
+ * `setLiveSeekableRange` to properly allow seeking. We're used to MSE issues so
13
+ * I'm not too confident of using another MSE API for all platforms directly.
14
+ *
15
+ * So this methods just return `true` based on a whitelist of platform for which
16
+ * it has been detected that high `duration` values cause issues but setting it
17
+ * to Infinity AND playing with `setLiveSeekableRange` does not.
18
+ *
19
+ * @returns {boolean}
20
+ */
21
+ export default function hasIssuesWithHighMediaSourceDuration(): boolean;
@@ -0,0 +1,26 @@
1
+ import { isPlayStation5 } from "./browser_detection";
2
+ /**
3
+ * Some platforms have issues when the `MediaSource`'s `duration` property
4
+ * is set to a very high value (playback freezes) but not when setting it
5
+ * to `Infinity`, which is what the HTML spec as of now (2023-05-15) recommends
6
+ * for live contents.
7
+ *
8
+ * However setting the `MediaSource`'s `duration` property to `Infinity` seems
9
+ * more risky, considering all platforms we now support, than setting it at a
10
+ * relatively high ~2**32 value which is what we do generally.
11
+ *
12
+ * Moreover, setting it to `Infinity` require us to use another MSE API,
13
+ * `setLiveSeekableRange` to properly allow seeking. We're used to MSE issues so
14
+ * I'm not too confident of using another MSE API for all platforms directly.
15
+ *
16
+ * So this methods just return `true` based on a whitelist of platform for which
17
+ * it has been detected that high `duration` values cause issues but setting it
18
+ * to Infinity AND playing with `setLiveSeekableRange` does not.
19
+ *
20
+ * @returns {boolean}
21
+ */
22
+ export default function hasIssuesWithHighMediaSourceDuration() {
23
+ // For now only seen on the Webkit present in the PlayStation 5, for which the
24
+ // alternative is known to work.
25
+ return isPlayStation5;
26
+ }
@@ -65,6 +65,8 @@ declare class ConfigHandler {
65
65
  SAMPLING_INTERVAL_MEDIASOURCE: number;
66
66
  SAMPLING_INTERVAL_LOW_LATENCY: number;
67
67
  SAMPLING_INTERVAL_NO_MEDIASOURCE: number;
68
+ ABR_ENTER_BUFFER_BASED_ALGO: number;
69
+ ABR_EXIT_BUFFER_BASED_ALGO: number;
68
70
  ABR_MINIMUM_TOTAL_BYTES: number;
69
71
  ABR_MINIMUM_CHUNK_SIZE: number;
70
72
  ABR_STARVATION_FACTOR: {
@@ -124,6 +126,8 @@ declare class ConfigHandler {
124
126
  SEGMENT_PRIORITIES_STEPS: number[];
125
127
  MAX_HIGH_PRIORITY_LEVEL: number;
126
128
  MIN_CANCELABLE_PRIORITY: number;
129
+ EME_DEFAULT_VIDEO_CODECS: string[];
130
+ EME_DEFAULT_AUDIO_CODECS: string[];
127
131
  EME_DEFAULT_WIDEVINE_ROBUSTNESSES: string[];
128
132
  EME_DEFAULT_PLAYREADY_RECOMMENDATION_ROBUSTNESSES: string[];
129
133
  EME_KEY_SYSTEMS: Partial<Record<string, string[]>>;
@@ -13,6 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ import config from "../../config";
16
17
  import log from "../../log";
17
18
  import noop from "../../utils/noop";
18
19
  import { getLeftSizeOfRange } from "../../utils/ranges";
@@ -124,7 +125,8 @@ function getEstimateReference(_a, stopAllEstimates) {
124
125
  * This TaskCanceller is used both for restarting estimates with a new
125
126
  * configuration and to cancel them altogether.
126
127
  */
127
- var currentEstimatesCanceller = new TaskCanceller({ cancelOn: stopAllEstimates });
128
+ var currentEstimatesCanceller = new TaskCanceller();
129
+ currentEstimatesCanceller.linkToSignal(stopAllEstimates);
128
130
  // Create `ISharedReference` on which estimates will be emitted.
129
131
  var estimateRef = createEstimateReference(representationsRef.getValue(), currentEstimatesCanceller.signal);
130
132
  representationsRef.onUpdate(restartEstimatesProductionFromCurrentConditions, { clearSignal: stopAllEstimates });
@@ -176,8 +178,7 @@ function getEstimateReference(_a, stopAllEstimates) {
176
178
  var timeRanges = val.buffered;
177
179
  var bufferGap = getLeftSizeOfRange(timeRanges, position.last);
178
180
  var representation = val.content.representation;
179
- var scoreData = scoreCalculator.getEstimate(representation);
180
- var currentScore = scoreData === null || scoreData === void 0 ? void 0 : scoreData[0];
181
+ var currentScore = scoreCalculator.getEstimate(representation);
181
182
  var currentBitrate = representation.bitrate;
182
183
  var observation = { bufferGap: bufferGap, currentBitrate: currentBitrate, currentScore: currentScore, speed: speed };
183
184
  currentBufferBasedEstimate = bufferBasedChooser.getEstimate(observation);
@@ -208,12 +209,13 @@ function getEstimateReference(_a, stopAllEstimates) {
208
209
  stableRepresentation.bitrate / (lastPlaybackObservation.speed > 0 ?
209
210
  lastPlaybackObservation.speed :
210
211
  1);
211
- if (allowBufferBasedEstimates && bufferGap <= 5) {
212
+ var _b = config.getCurrent(), ABR_ENTER_BUFFER_BASED_ALGO = _b.ABR_ENTER_BUFFER_BASED_ALGO, ABR_EXIT_BUFFER_BASED_ALGO = _b.ABR_EXIT_BUFFER_BASED_ALGO;
213
+ if (allowBufferBasedEstimates && bufferGap <= ABR_EXIT_BUFFER_BASED_ALGO) {
212
214
  allowBufferBasedEstimates = false;
213
215
  }
214
216
  else if (!allowBufferBasedEstimates &&
215
217
  isFinite(bufferGap) &&
216
- bufferGap > 10) {
218
+ bufferGap >= ABR_ENTER_BUFFER_BASED_ALGO) {
217
219
  allowBufferBasedEstimates = true;
218
220
  }
219
221
  /**
@@ -296,7 +298,8 @@ function getEstimateReference(_a, stopAllEstimates) {
296
298
  function restartEstimatesProductionFromCurrentConditions() {
297
299
  var representations = representationsRef.getValue();
298
300
  currentEstimatesCanceller.cancel();
299
- currentEstimatesCanceller = new TaskCanceller({ cancelOn: stopAllEstimates });
301
+ currentEstimatesCanceller = new TaskCanceller();
302
+ currentEstimatesCanceller.linkToSignal(stopAllEstimates);
300
303
  var newRef = createEstimateReference(representations, currentEstimatesCanceller.signal);
301
304
  newRef.onUpdate(function onNewEstimate(newEstimate) {
302
305
  estimateRef.setValue(newEstimate);