rx-player 4.0.0-dev.2023120600 → 4.0.0-dev.2023121900

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 (326) hide show
  1. package/CHANGELOG.md +178 -2
  2. package/README.md +2 -33
  3. package/VERSION +1 -1
  4. package/dist/_esm5.processed/compat/add_text_track.d.ts +3 -1
  5. package/dist/_esm5.processed/compat/add_text_track.js +7 -4
  6. package/dist/_esm5.processed/compat/browser_compatibility_types.d.ts +7 -0
  7. package/dist/_esm5.processed/compat/event_listeners.d.ts +15 -2
  8. package/dist/_esm5.processed/compat/event_listeners.js +37 -2
  9. package/dist/_esm5.processed/compat/fullscreen.d.ts +32 -0
  10. package/dist/_esm5.processed/compat/fullscreen.js +78 -0
  11. package/dist/_esm5.processed/compat/index.d.ts +3 -1
  12. package/dist/_esm5.processed/compat/index.js +3 -1
  13. package/dist/_esm5.processed/compat/is_offline.d.ts +39 -0
  14. package/dist/_esm5.processed/compat/is_offline.js +43 -0
  15. package/dist/_esm5.processed/config.d.ts +21 -9
  16. package/dist/_esm5.processed/core/adaptive/adaptive_representation_selector.d.ts +58 -0
  17. package/dist/_esm5.processed/core/adaptive/adaptive_representation_selector.js +54 -14
  18. package/dist/_esm5.processed/core/adaptive/utils/select_optimal_representation.d.ts +8 -2
  19. package/dist/_esm5.processed/core/adaptive/utils/select_optimal_representation.js +11 -2
  20. package/dist/_esm5.processed/core/api/debug/modules/general_info.js +46 -17
  21. package/dist/_esm5.processed/core/api/debug/modules/segment_buffer_content.js +3 -3
  22. package/dist/_esm5.processed/core/api/debug/modules/segment_buffer_size.js +1 -1
  23. package/dist/_esm5.processed/core/api/option_utils.d.ts +35 -14
  24. package/dist/_esm5.processed/core/api/option_utils.js +230 -47
  25. package/dist/_esm5.processed/core/api/public_api.d.ts +266 -92
  26. package/dist/_esm5.processed/core/api/public_api.js +802 -444
  27. package/dist/_esm5.processed/core/api/{track_management/media_element_tracks_store.d.ts → tracks_management/media_element_track_choice_manager.d.ts} +75 -15
  28. package/dist/_esm5.processed/core/api/{track_management/media_element_tracks_store.js → tracks_management/media_element_track_choice_manager.js} +193 -74
  29. package/dist/_esm5.processed/core/api/tracks_management/track_choice_manager.d.ts +258 -0
  30. package/dist/_esm5.processed/core/api/tracks_management/track_choice_manager.js +989 -0
  31. package/dist/_esm5.processed/core/api/utils.d.ts +0 -1
  32. package/dist/_esm5.processed/core/api/utils.js +11 -28
  33. package/dist/_esm5.processed/core/decrypt/content_decryptor.js +3 -3
  34. package/dist/_esm5.processed/core/decrypt/find_key_system.js +71 -83
  35. package/dist/_esm5.processed/core/decrypt/get_media_keys.js +5 -6
  36. package/dist/_esm5.processed/core/decrypt/session_events_listener.js +72 -10
  37. package/dist/_esm5.processed/core/decrypt/utils/persistent_sessions_store.d.ts +4 -4
  38. package/dist/_esm5.processed/core/decrypt/utils/persistent_sessions_store.js +4 -6
  39. package/dist/_esm5.processed/core/fetchers/manifest/manifest_fetcher.d.ts +3 -1
  40. package/dist/_esm5.processed/core/fetchers/manifest/manifest_fetcher.js +26 -7
  41. package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.d.ts +9 -3
  42. package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.js +9 -16
  43. package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher_creator.d.ts +3 -1
  44. package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher_creator.js +1 -1
  45. package/dist/_esm5.processed/core/fetchers/utils/schedule_request.d.ts +6 -1
  46. package/dist/_esm5.processed/core/fetchers/utils/schedule_request.js +41 -4
  47. package/dist/_esm5.processed/core/init/media_source_content_initializer.d.ts +8 -1
  48. package/dist/_esm5.processed/core/init/media_source_content_initializer.js +5 -2
  49. package/dist/_esm5.processed/core/init/types.d.ts +15 -5
  50. package/dist/_esm5.processed/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.js +9 -2
  51. package/dist/_esm5.processed/core/segment_buffers/implementations/image/image_segment_buffer.d.ts +75 -0
  52. package/dist/_esm5.processed/core/segment_buffers/implementations/image/image_segment_buffer.js +133 -0
  53. package/dist/_esm5.processed/core/{api/track_management → segment_buffers/implementations/image}/index.d.ts +2 -3
  54. package/dist/_esm5.processed/core/{api/track_management → segment_buffers/implementations/image}/index.js +2 -3
  55. package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/html_text_segment_buffer.js +1 -1
  56. package/dist/_esm5.processed/core/segment_buffers/implementations/text/native/native_text_segment_buffer.d.ts +2 -1
  57. package/dist/_esm5.processed/core/segment_buffers/implementations/text/native/native_text_segment_buffer.js +4 -3
  58. package/dist/_esm5.processed/core/segment_buffers/implementations/types.d.ts +2 -2
  59. package/dist/_esm5.processed/core/segment_buffers/index.d.ts +2 -2
  60. package/dist/_esm5.processed/core/segment_buffers/index.js +1 -2
  61. package/dist/_esm5.processed/core/segment_buffers/inventory/index.d.ts +2 -3
  62. package/dist/_esm5.processed/core/segment_buffers/inventory/index.js +0 -1
  63. package/dist/_esm5.processed/core/segment_buffers/inventory/segment_inventory.d.ts +25 -8
  64. package/dist/_esm5.processed/core/segment_buffers/inventory/segment_inventory.js +19 -10
  65. package/dist/_esm5.processed/core/segment_buffers/segment_buffers_store.d.ts +1 -0
  66. package/dist/_esm5.processed/core/segment_buffers/segment_buffers_store.js +16 -2
  67. package/dist/_esm5.processed/core/stream/adaptation/adaptation_stream.d.ts +15 -0
  68. package/dist/_esm5.processed/core/stream/adaptation/adaptation_stream.js +93 -183
  69. package/dist/_esm5.processed/core/stream/adaptation/types.d.ts +13 -27
  70. package/dist/_esm5.processed/core/stream/index.d.ts +3 -2
  71. package/dist/_esm5.processed/core/stream/orchestrator/stream_orchestrator.d.ts +0 -2
  72. package/dist/_esm5.processed/core/stream/orchestrator/stream_orchestrator.js +7 -5
  73. package/dist/_esm5.processed/core/stream/period/period_stream.js +12 -13
  74. package/dist/_esm5.processed/core/stream/period/types.d.ts +14 -5
  75. package/dist/_esm5.processed/core/stream/period/utils/get_adaptation_switch_strategy.d.ts +4 -2
  76. package/dist/_esm5.processed/core/stream/period/utils/get_adaptation_switch_strategy.js +46 -10
  77. package/dist/_esm5.processed/core/stream/representation/representation_stream.js +23 -29
  78. package/dist/_esm5.processed/core/stream/representation/types.d.ts +1 -11
  79. package/dist/_esm5.processed/core/stream/representation/utils/get_buffer_status.js +1 -1
  80. package/dist/_esm5.processed/core/stream/representation/utils/get_needed_segments.js +1 -1
  81. package/dist/_esm5.processed/default_config.d.ts +98 -35
  82. package/dist/_esm5.processed/default_config.js +113 -36
  83. package/dist/_esm5.processed/errors/custom_loader_error.d.ts +3 -1
  84. package/dist/_esm5.processed/errors/custom_loader_error.js +3 -1
  85. package/dist/_esm5.processed/errors/media_error.js +2 -2
  86. package/dist/_esm5.processed/errors/network_error.d.ts +1 -0
  87. package/dist/_esm5.processed/errors/network_error.js +1 -0
  88. package/dist/_esm5.processed/errors/request_error.d.ts +3 -2
  89. package/dist/_esm5.processed/errors/request_error.js +5 -2
  90. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.js +3 -3
  91. package/dist/_esm5.processed/features/features_object.js +2 -0
  92. package/dist/_esm5.processed/{transports/smooth/is_mp4_embedded_track.js → features/list/bif_parser.d.ts} +6 -7
  93. package/dist/_esm5.processed/features/list/bif_parser.js +27 -0
  94. package/dist/_esm5.processed/features/list/directfile.js +5 -2
  95. package/dist/_esm5.processed/features/list/image_buffer.d.ts +23 -0
  96. package/dist/_esm5.processed/features/list/image_buffer.js +25 -0
  97. package/dist/_esm5.processed/features/list/index.d.ts +2 -0
  98. package/dist/_esm5.processed/features/list/index.js +2 -0
  99. package/dist/_esm5.processed/features/types.d.ts +27 -3
  100. package/dist/_esm5.processed/manifest/adaptation.d.ts +11 -9
  101. package/dist/_esm5.processed/manifest/adaptation.js +30 -41
  102. package/dist/_esm5.processed/manifest/index.d.ts +4 -3
  103. package/dist/_esm5.processed/manifest/manifest.d.ts +54 -5
  104. package/dist/_esm5.processed/manifest/manifest.js +110 -5
  105. package/dist/_esm5.processed/manifest/period.d.ts +5 -4
  106. package/dist/_esm5.processed/manifest/representation.d.ts +5 -10
  107. package/dist/_esm5.processed/manifest/representation.js +5 -15
  108. package/dist/_esm5.processed/manifest/representation_index/index.d.ts +2 -2
  109. package/dist/_esm5.processed/manifest/representation_index/static.d.ts +0 -2
  110. package/dist/_esm5.processed/manifest/representation_index/static.js +0 -6
  111. package/dist/_esm5.processed/manifest/representation_index/types.d.ts +21 -42
  112. package/dist/_esm5.processed/manifest/types.d.ts +2 -0
  113. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/base.d.ts +31 -17
  114. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/base.js +19 -26
  115. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/list.d.ts +0 -2
  116. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/list.js +1 -7
  117. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/template.d.ts +6 -2
  118. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/template.js +8 -11
  119. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.d.ts +0 -2
  120. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.js +0 -6
  121. package/dist/_esm5.processed/parsers/manifest/dash/common/infer_adaptation_type.d.ts +2 -2
  122. package/dist/_esm5.processed/parsers/manifest/dash/common/infer_adaptation_type.js +6 -1
  123. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_adaptation_sets.js +5 -3
  124. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_mpd.d.ts +2 -0
  125. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_mpd.js +1 -1
  126. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_periods.js +2 -2
  127. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representation_index.d.ts +2 -0
  128. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representation_index.js +2 -2
  129. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/AdaptationSet.js +6 -10
  130. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/Representation.js +2 -4
  131. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/utils.d.ts +1 -10
  132. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/utils.js +2 -18
  133. package/dist/_esm5.processed/parsers/manifest/dash/node_parser_types.d.ts +4 -4
  134. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/AdaptationSet.js +6 -3
  135. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/Representation.js +2 -1
  136. package/dist/_esm5.processed/parsers/manifest/local/representation_index.d.ts +0 -2
  137. package/dist/_esm5.processed/parsers/manifest/local/representation_index.js +0 -6
  138. package/dist/_esm5.processed/parsers/manifest/metaplaylist/metaplaylist_parser.js +6 -6
  139. package/dist/_esm5.processed/parsers/manifest/metaplaylist/representation_index.d.ts +3 -12
  140. package/dist/_esm5.processed/parsers/manifest/metaplaylist/representation_index.js +2 -11
  141. package/dist/_esm5.processed/parsers/manifest/smooth/create_parser.d.ts +1 -0
  142. package/dist/_esm5.processed/parsers/manifest/smooth/create_parser.js +17 -11
  143. package/dist/_esm5.processed/parsers/manifest/smooth/representation_index.d.ts +83 -21
  144. package/dist/_esm5.processed/parsers/manifest/smooth/representation_index.js +125 -53
  145. package/dist/_esm5.processed/parsers/manifest/smooth/utils/add_segment_infos.d.ts +6 -3
  146. package/dist/_esm5.processed/parsers/manifest/smooth/utils/add_segment_infos.js +4 -4
  147. package/dist/_esm5.processed/parsers/manifest/types.d.ts +3 -3
  148. package/dist/_esm5.processed/parsers/texttracks/ttml/html/apply_line_height.js +2 -1
  149. package/dist/_esm5.processed/public_types.d.ts +310 -396
  150. package/dist/_esm5.processed/tools/TextTrackRenderer/text_track_renderer.d.ts +4 -5
  151. package/dist/_esm5.processed/tools/TextTrackRenderer/text_track_renderer.js +4 -5
  152. package/dist/_esm5.processed/transports/dash/add_segment_integrity_checks_to_loader.js +4 -4
  153. package/dist/_esm5.processed/transports/dash/image_pipelines.d.ts +38 -0
  154. package/dist/_esm5.processed/transports/dash/image_pipelines.js +129 -0
  155. package/dist/_esm5.processed/transports/dash/manifest_parser.js +3 -2
  156. package/dist/_esm5.processed/transports/dash/pipelines.js +4 -1
  157. package/dist/_esm5.processed/transports/dash/segment_loader.d.ts +2 -2
  158. package/dist/_esm5.processed/transports/dash/segment_loader.js +20 -26
  159. package/dist/_esm5.processed/transports/dash/segment_parser.js +24 -19
  160. package/dist/_esm5.processed/transports/dash/text_loader.js +5 -5
  161. package/dist/_esm5.processed/transports/dash/text_parser.js +33 -28
  162. package/dist/_esm5.processed/transports/local/pipelines.js +10 -1
  163. package/dist/_esm5.processed/transports/local/segment_loader.js +2 -2
  164. package/dist/_esm5.processed/transports/local/segment_parser.d.ts +1 -1
  165. package/dist/_esm5.processed/transports/local/segment_parser.js +10 -10
  166. package/dist/_esm5.processed/transports/local/text_parser.d.ts +2 -2
  167. package/dist/_esm5.processed/transports/local/text_parser.js +23 -23
  168. package/dist/_esm5.processed/transports/metaplaylist/pipelines.js +52 -34
  169. package/dist/_esm5.processed/transports/smooth/pipelines.js +190 -33
  170. package/dist/_esm5.processed/transports/smooth/segment_loader.d.ts +1 -1
  171. package/dist/_esm5.processed/transports/smooth/segment_loader.js +22 -28
  172. package/dist/_esm5.processed/transports/smooth/utils.d.ts +26 -1
  173. package/dist/_esm5.processed/transports/smooth/utils.js +55 -1
  174. package/dist/_esm5.processed/transports/types.d.ts +89 -94
  175. package/dist/_esm5.processed/transports/utils/call_custom_manifest_loader.js +3 -3
  176. package/dist/_esm5.processed/transports/utils/infer_segment_container.d.ts +3 -3
  177. package/dist/_esm5.processed/transports/utils/infer_segment_container.js +7 -5
  178. package/dist/_esm5.processed/transports/utils/parse_text_track.d.ts +12 -8
  179. package/dist/_esm5.processed/transports/utils/parse_text_track.js +21 -19
  180. package/dist/_esm5.processed/utils/array_includes.d.ts +1 -2
  181. package/dist/_esm5.processed/utils/array_includes.js +28 -30
  182. package/dist/_esm5.processed/{transports/smooth/is_mp4_embedded_track.d.ts → utils/list_to_map.d.ts} +5 -5
  183. package/dist/_esm5.processed/utils/list_to_map.js +28 -0
  184. package/dist/_esm5.processed/utils/request/xhr.js +5 -5
  185. package/dist/_esm5.processed/utils/simple_set.d.ts +51 -0
  186. package/dist/_esm5.processed/utils/simple_set.js +57 -0
  187. package/dist/_esm5.processed/utils/uniq.d.ts +36 -0
  188. package/dist/_esm5.processed/utils/uniq.js +43 -0
  189. package/dist/commonjs/config.d.ts +1 -1
  190. package/dist/commonjs/core/adaptive/adaptive_representation_selector.d.ts +2 -19
  191. package/dist/commonjs/core/adaptive/adaptive_representation_selector.js +2 -2
  192. package/dist/commonjs/core/adaptive/network_analyzer.js +3 -3
  193. package/dist/commonjs/core/api/index.d.ts +1 -1
  194. package/dist/commonjs/core/api/playback_observer.d.ts +128 -8
  195. package/dist/commonjs/core/api/playback_observer.js +217 -64
  196. package/dist/commonjs/core/api/public_api.js +9 -9
  197. package/dist/commonjs/core/api/utils.js +1 -1
  198. package/dist/commonjs/core/decrypt/get_media_keys.js +2 -6
  199. package/dist/commonjs/core/init/directfile_content_initializer.js +5 -1
  200. package/dist/commonjs/core/init/media_source_content_initializer.js +28 -14
  201. package/dist/commonjs/core/init/utils/content_time_boundaries_observer.js +1 -2
  202. package/dist/commonjs/core/init/utils/create_stream_playback_observer.d.ts +1 -5
  203. package/dist/commonjs/core/init/utils/create_stream_playback_observer.js +16 -14
  204. package/dist/commonjs/core/init/utils/initial_seek_and_play.d.ts +9 -11
  205. package/dist/commonjs/core/init/utils/initial_seek_and_play.js +121 -91
  206. package/dist/commonjs/core/init/utils/rebuffering_controller.js +27 -70
  207. package/dist/commonjs/core/init/utils/stream_events_emitter/stream_events_emitter.js +4 -2
  208. package/dist/commonjs/core/segment_buffers/garbage_collector.js +1 -2
  209. package/dist/commonjs/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.js +9 -2
  210. package/dist/commonjs/core/segment_buffers/implementations/text/html/html_text_segment_buffer.js +1 -1
  211. package/dist/commonjs/core/segment_buffers/implementations/text/native/native_text_segment_buffer.js +1 -1
  212. package/dist/commonjs/core/segment_buffers/index.d.ts +2 -2
  213. package/dist/commonjs/core/segment_buffers/inventory/index.d.ts +2 -2
  214. package/dist/commonjs/core/segment_buffers/inventory/segment_inventory.d.ts +25 -8
  215. package/dist/commonjs/core/segment_buffers/inventory/segment_inventory.js +19 -10
  216. package/dist/commonjs/core/stream/adaptation/get_representations_switch_strategy.d.ts +2 -2
  217. package/dist/commonjs/core/stream/adaptation/get_representations_switch_strategy.js +16 -9
  218. package/dist/commonjs/core/stream/orchestrator/stream_orchestrator.js +14 -18
  219. package/dist/commonjs/core/stream/period/period_stream.js +5 -8
  220. package/dist/commonjs/core/stream/period/types.d.ts +2 -3
  221. package/dist/commonjs/core/stream/period/utils/get_adaptation_switch_strategy.d.ts +4 -5
  222. package/dist/commonjs/core/stream/period/utils/get_adaptation_switch_strategy.js +17 -13
  223. package/dist/commonjs/core/stream/representation/representation_stream.js +3 -4
  224. package/dist/commonjs/core/stream/representation/types.d.ts +2 -2
  225. package/dist/commonjs/core/stream/representation/utils/append_segment_to_buffer.js +11 -12
  226. package/dist/commonjs/core/stream/representation/utils/get_buffer_status.js +1 -1
  227. package/dist/commonjs/default_config.d.ts +7 -16
  228. package/dist/commonjs/default_config.js +16 -16
  229. package/dist/commonjs/manifest/adaptation.js +2 -1
  230. package/dist/commonjs/parsers/texttracks/ttml/html/apply_line_height.js +2 -1
  231. package/dist/commonjs/public_types.d.ts +29 -2
  232. package/dist/es2017/config.d.ts +1 -1
  233. package/dist/es2017/core/adaptive/adaptive_representation_selector.d.ts +2 -19
  234. package/dist/es2017/core/adaptive/adaptive_representation_selector.js +2 -2
  235. package/dist/es2017/core/adaptive/network_analyzer.js +3 -3
  236. package/dist/es2017/core/api/index.d.ts +1 -1
  237. package/dist/es2017/core/api/playback_observer.d.ts +128 -8
  238. package/dist/es2017/core/api/playback_observer.js +217 -66
  239. package/dist/es2017/core/api/public_api.js +9 -9
  240. package/dist/es2017/core/api/utils.js +1 -1
  241. package/dist/es2017/core/decrypt/get_media_keys.js +2 -6
  242. package/dist/es2017/core/init/directfile_content_initializer.js +7 -1
  243. package/dist/es2017/core/init/media_source_content_initializer.js +30 -16
  244. package/dist/es2017/core/init/utils/content_time_boundaries_observer.js +1 -2
  245. package/dist/es2017/core/init/utils/create_stream_playback_observer.d.ts +1 -5
  246. package/dist/es2017/core/init/utils/create_stream_playback_observer.js +16 -14
  247. package/dist/es2017/core/init/utils/initial_seek_and_play.d.ts +9 -11
  248. package/dist/es2017/core/init/utils/initial_seek_and_play.js +120 -91
  249. package/dist/es2017/core/init/utils/rebuffering_controller.js +27 -70
  250. package/dist/es2017/core/init/utils/stream_events_emitter/stream_events_emitter.js +4 -2
  251. package/dist/es2017/core/segment_buffers/garbage_collector.js +1 -2
  252. package/dist/es2017/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.js +9 -2
  253. package/dist/es2017/core/segment_buffers/implementations/text/html/html_text_segment_buffer.js +1 -1
  254. package/dist/es2017/core/segment_buffers/implementations/text/native/native_text_segment_buffer.js +1 -1
  255. package/dist/es2017/core/segment_buffers/index.d.ts +2 -2
  256. package/dist/es2017/core/segment_buffers/inventory/index.d.ts +2 -2
  257. package/dist/es2017/core/segment_buffers/inventory/segment_inventory.d.ts +25 -8
  258. package/dist/es2017/core/segment_buffers/inventory/segment_inventory.js +19 -10
  259. package/dist/es2017/core/stream/adaptation/get_representations_switch_strategy.d.ts +2 -2
  260. package/dist/es2017/core/stream/adaptation/get_representations_switch_strategy.js +16 -9
  261. package/dist/es2017/core/stream/orchestrator/stream_orchestrator.js +16 -18
  262. package/dist/es2017/core/stream/period/period_stream.js +4 -7
  263. package/dist/es2017/core/stream/period/types.d.ts +2 -3
  264. package/dist/es2017/core/stream/period/utils/get_adaptation_switch_strategy.d.ts +4 -5
  265. package/dist/es2017/core/stream/period/utils/get_adaptation_switch_strategy.js +17 -13
  266. package/dist/es2017/core/stream/representation/representation_stream.js +3 -4
  267. package/dist/es2017/core/stream/representation/types.d.ts +2 -2
  268. package/dist/es2017/core/stream/representation/utils/append_segment_to_buffer.js +1 -2
  269. package/dist/es2017/core/stream/representation/utils/get_buffer_status.js +1 -1
  270. package/dist/es2017/default_config.d.ts +7 -16
  271. package/dist/es2017/default_config.js +16 -16
  272. package/dist/es2017/manifest/adaptation.js +2 -1
  273. package/dist/es2017/parsers/texttracks/ttml/html/apply_line_height.js +2 -1
  274. package/dist/es2017/public_types.d.ts +29 -2
  275. package/dist/mpd-parser.wasm +0 -0
  276. package/dist/rx-player.js +614 -438
  277. package/dist/rx-player.min.js +1 -1
  278. package/package.json +5 -1
  279. package/scripts/canal-release.patch +78 -0
  280. package/scripts/make-dev-releases +65 -0
  281. package/scripts/update-version +5 -0
  282. package/sonar-project.properties +1 -1
  283. package/src/core/adaptive/adaptive_representation_selector.ts +4 -21
  284. package/src/core/adaptive/network_analyzer.ts +3 -3
  285. package/src/core/api/index.ts +1 -0
  286. package/src/core/api/playback_observer.ts +327 -107
  287. package/src/core/api/public_api.ts +9 -9
  288. package/src/core/api/utils.ts +3 -1
  289. package/src/core/decrypt/get_media_keys.ts +2 -8
  290. package/src/core/init/directfile_content_initializer.ts +8 -8
  291. package/src/core/init/media_source_content_initializer.ts +27 -20
  292. package/src/core/init/utils/content_time_boundaries_observer.ts +1 -1
  293. package/src/core/init/utils/create_stream_playback_observer.ts +19 -20
  294. package/src/core/init/utils/initial_seek_and_play.ts +140 -108
  295. package/src/core/init/utils/rebuffering_controller.ts +32 -77
  296. package/src/core/init/utils/stream_events_emitter/stream_events_emitter.ts +5 -2
  297. package/src/core/segment_buffers/garbage_collector.ts +1 -1
  298. package/src/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.ts +10 -2
  299. package/src/core/segment_buffers/implementations/text/html/html_text_segment_buffer.ts +1 -1
  300. package/src/core/segment_buffers/implementations/text/native/native_text_segment_buffer.ts +1 -1
  301. package/src/core/segment_buffers/index.ts +2 -0
  302. package/src/core/segment_buffers/inventory/index.ts +2 -0
  303. package/src/core/segment_buffers/inventory/segment_inventory.ts +49 -17
  304. package/src/core/stream/adaptation/get_representations_switch_strategy.ts +21 -12
  305. package/src/core/stream/orchestrator/stream_orchestrator.ts +14 -19
  306. package/src/core/stream/period/period_stream.ts +7 -8
  307. package/src/core/stream/period/types.ts +2 -3
  308. package/src/core/stream/period/utils/get_adaptation_switch_strategy.ts +21 -15
  309. package/src/core/stream/representation/representation_stream.ts +3 -5
  310. package/src/core/stream/representation/types.ts +2 -2
  311. package/src/core/stream/representation/utils/append_segment_to_buffer.ts +1 -1
  312. package/src/core/stream/representation/utils/get_buffer_status.ts +2 -1
  313. package/src/default_config.ts +17 -17
  314. package/src/manifest/adaptation.ts +2 -1
  315. package/src/parsers/texttracks/ttml/html/apply_line_height.ts +3 -1
  316. package/src/public_types.ts +29 -2
  317. package/dist/_esm5.processed/core/api/track_management/track_dispatcher.d.ts +0 -84
  318. package/dist/_esm5.processed/core/api/track_management/track_dispatcher.js +0 -158
  319. package/dist/_esm5.processed/core/api/track_management/tracks_store.d.ts +0 -406
  320. package/dist/_esm5.processed/core/api/track_management/tracks_store.js +0 -932
  321. package/dist/_esm5.processed/core/segment_buffers/inventory/utils.d.ts +0 -33
  322. package/dist/_esm5.processed/core/segment_buffers/inventory/utils.js +0 -49
  323. package/dist/_esm5.processed/core/stream/adaptation/get_representations_switch_strategy.d.ts +0 -39
  324. package/dist/_esm5.processed/core/stream/adaptation/get_representations_switch_strategy.js +0 -133
  325. package/dist/_esm5.processed/parsers/manifest/smooth/shared_smooth_segment_timeline.d.ts +0 -119
  326. package/dist/_esm5.processed/parsers/manifest/smooth/shared_smooth_segment_timeline.js +0 -159
package/CHANGELOG.md CHANGED
@@ -1,6 +1,8 @@
1
- # Changelog
1
+ ## v4.0.0-dev.2023121900 (2023-12-19)
2
2
 
3
- ## v4.0.0-dev.2023120600 (2023-12-06)
3
+ ### Changes
4
+
5
+ - A `representationFilter`'s advertised `codec` has now been renamed to `codecs` and is an Array when defined [#1332]
4
6
 
5
7
  ### Features
6
8
 
@@ -13,8 +15,11 @@
13
15
 
14
16
  - Fix subtitles "blinking" in some specific conditions, especially with some DASH low-latency contents [#1314]
15
17
  - DASH: Fix Period overlap resolution logic for when the first Period is removed [#1311]
18
+ - TTML: Fix handling of the `tts:lineHeight` attribute [#1320]
16
19
  - Fix import of the `LOCAL_MANIFEST` experimental feature
17
20
  - Smooth: Rely on a defined `segmentLoader` when playing smooth streaming contents.
21
+ - Avoid very rarely skipping segments which initially were too big to be pushed due to memory limitations [#1323]
22
+ - Tizen (Samsung TVs): Try again to work around all potential issues that could arise due to tizen seeking back by itself [#1327]
18
23
 
19
24
  ### Other improvements
20
25
 
@@ -26,7 +31,178 @@
26
31
  - DEBUG_ELEMENT: always synchronize inventory of segments before rendering it [#1317]
27
32
  - Remove remaining RxPlayer dependency removing possibility of some application-side bundling errors [#1312]
28
33
  - Add cache when checking for codec support, improving performance on some devices and potentially working around some xbox bugs on long-lived pages [#1324]
34
+ - Add exception to text Garbage collection logic to avoid unnecessarily reload text segments frequently [#1325]
35
+ - Demo: Fix switching mode toggle [#1328]
29
36
  - Demo: Add possibility to see the debug element in the demo page
37
+ - Demo: Fix reporting of live position in demo page [#1313]
38
+
39
+
40
+ ## v4.0.0-beta.3 (2023-10-19)
41
+
42
+ ### Changes
43
+
44
+ - The `MediaError`'s `trackInfo` property is now an array renamed as `tracksInfo` and similar `MediaError` are grouped in one [#1264]
45
+ - The `manifestUpdateUrl` `loadVideo` option has been removed as it was unused [#1276]
46
+ - The `/dist` directory in the project has been removed [#1270]
47
+
48
+ ### Bug fixes
49
+
50
+ - Fix adaptive logic on some legacy Edge browsers [#1302]
51
+
52
+ ### Other improvements
53
+
54
+ - `newAvailablePeriods` is now sent lazily at the time new Periods are considered to improve performance [#1265]
55
+ - Implement better error messages by not repeating the Error Type in it [#1290]
56
+ - All import path to the RxPlayer now depend on the same RxPlayer modular build (and not just the minimal, as before) [#1301]
57
+
58
+
59
+ ## v4.0.0-beta.2 (2023-06-27)
60
+
61
+ ### Changes
62
+
63
+ - If all Representations from the current track become undecipherable, automatically switch to another track (also send a `trackUpdate` event) instead of stopping on error [#1234]
64
+ - Only send `MediaError` errors with the `NO_PLAYABLE_REPRESENTATION` error code when no Representation from all tracks of a given type can be played [#1234]
65
+
66
+ ### Features
67
+
68
+ - Add `representationListUpdate` event for when the list of available Representation for a current track changes [#1240]
69
+ - Add `"no-playable-representation"` as a `reason` for `trackUpdate` events when the track switch is due to encrypted Representations [#1234]
70
+
71
+ ### Other improvements
72
+
73
+ - DRM: Reload when playback is unexpectedly frozen with encrypted but only decipherable data in the buffer to work-around rare encryption-related issues [#1236]
74
+
75
+
76
+ ## v4.0.0-beta.1 (2023-03-08)
77
+
78
+ ### Bug fixes
79
+
80
+ - (v4.0.0-beta.0-only issue) Fix memory leak
81
+ - (v4.0.0-beta.0-only issue) Fix MediaSource duration when the maximum buffered end is inferior to current duration but superior to calculated duration
82
+ - (v4.0.0-beta.0-only issue) Fix `stopAtEnd` option by also switching to STOPPED state on ended
83
+ - (v4.0.0-beta.0-only issue) Fix some target's support by not relying on `Promise.prototype.finally` anymore [#1224]
84
+ - (v4.0.0-beta.0-only issue) For dynamic contents, always set a very high duration [#1220]
85
+ - (v4.0.0-beta.0-only issue) DRM: Fix fallbacking for an already-played content by checking key statuses initially linked to a MediaKeySession
86
+
87
+ ### Other improvements
88
+
89
+ - Based on the v3.30.0 of which it inherits all the features, bug fixes and other improvements
90
+
91
+
92
+ ## v4.0.0-beta.0 (2023-01-27)
93
+
94
+ ### Changes
95
+
96
+ - Create `"FREEZING"` player state for cases where the playback position is currently not advancing due to an unknown reason, to separate it from regular `"BUFFERING"`. [#1146]
97
+ - The `RELOADING` player state (gettable through the `getPlayerState` and `playerStateChange` API) can now happen at any time to unlock playback.
98
+ - Remove bitrate API: `getAvailableVideoBitrates`, `getAvailableAudioBitrates`, `setAudioBitrate`, `setVideoBitrate`, `getAudioBitrate`, `getVideoBitrate` in profit of the Representations lock APIs [#1144]
99
+ - Remove max bitrate API: `setMaxVideoBitrate`, `setMaxAudioBitrate`, `getMaxVideoBitrate` and `getMaxAudioBitrate` methods as well as the `maxVideoBitrate` and `maxAudioBitrate` options in profit of the Representations lock APIs
100
+ - Remove min bitrate API: `setMinVideoBitrate`, `setMinAudioBitrate`, `getMinVideoBitrate` and `getMinAudioBitrate` methods as well as the `minVideoBitrate` and `minAudioBitrate` options in profit of the Representations lock APIs
101
+ - Remove track preferences API (methods: `getPreferredAudioTracks`, `getPreferredVideoTracks`, `setPreferredAudioTracks` and `setPreferredVideoTracks`, types: `IAudioTrackPreference`, `ITextTrackPreference` and `IVideoTrackPreference`) in profit of the new tracks API
102
+ - Remove `getManualVideoBitrate` and `getManualAudioBitrate` in profit of the new Representations lock APIs
103
+ - Replace `initialAudioBitrate` and `initialVideoBitrate` constructor options with a single `baseBandwidth` option, which better translates what this option is actually doing and allows for future optimizations on our side. [#1155]
104
+ - Rename `audioTrackSwitchingMode` loadVideo option into `defaultAudioTrackSwitchingMode` [#1030]
105
+ - Remove `manualBitrateSwitchingMode` loadVideo option to instead rely on the `switchingMode` property of each `lockVideoRepresentations` and `lockAudioRepresentations` calls. [#1030]
106
+ - Remove `audioBitrateChange` and `videoBitrateChange` events in profit of the new `audioRepresentationChange` and `videoRepresentationChange` events
107
+ - Remove `availableAudioBitratesChange` and `availableVideoBitratesChange` events. Those are less needed with the new Representations lock API and can be mostly replicated through the `audioTrackChange` and `videoTrackChange` events
108
+ - "Flatten" the `transportOptions` loadVideo options by putting all its inner properties directly at the top level of loadVideo options, to simplify its documentation and discoverability [#1149]
109
+ - Remove `limitVideoWidth` constructor option in profit of the more configurable `videoResolutionLimit` constructor option
110
+ - Rename `networkConfig` into `requestConfig` and re-organize its inner properties to pave the way for future request-related APIs.
111
+ - Remove `stopAtEnd` `loadVideo` option and don't automatically stop when reaching the end by default. This behavior can be counter-intuitive and can be very easily implemented by the application.
112
+ - Remove `decipherabilityUpdate` event as it appeared to be not easily exploitable and exposed internal logic too much [#1168]
113
+ - Remove `getUrl` method in profit of the more powerful `getContentUrls`
114
+ - Impossibility to play the content due to unsupported audio and/or video tracks now triggers an error with the `MANIFEST_INCOMPATIBLE_CODECS_ERROR` instead of `MANIFEST_PARSE_ERROR`
115
+ - Remove methods: `getManifest`, `getCurrentAdaptations` and `getCurrentRepresentations`, as they reveal the RxPlayer's internals too much
116
+ - The `"smooth"` transport now needs to be communicated the URL of the Manifest directly (previously, it was possible to redirect it to a XML or JSON file first due to Canal+ legacy reasons).
117
+ - Remove the `supplementaryTextTracks` loadVideo option. You can use the `TextTrackRenderer` tool if you wish to diplay external subtitles on top of your content.
118
+ - Rename `maximumBufferTime` in `positionUpdate` events to `maximumPosition`
119
+ - Remove `getVideoPlayedTime` and `getVideoLoadedTime` methods. Their names was very confusing and can be re-implemented relatively easily using the media element's buffered property.
120
+ - Rename `getVideoDuration` to `getMediaDuration`, to avoid confusion with the video track's duration.
121
+ - Rename `getVideoBufferGap` to `getCurrentBufferGap, to avoid confusion with the "buffer gap" specific to the video track.
122
+ - Remove image-related API: `supplementaryImageTracks` `loadVideo` option, `imageTrackUpdate` event, `getImageTrackData` method. Those are better handled by an application. The `parseBifThumbnails` tool is still available.
123
+ - Replace `keySystems[].licenseStorage` `keySystems` option (for a `loadVideo` call) by the better-named `persistentLicenseConfig`. The `persistentLicense` boolean (also a `keySystems` option) has also been removed because it was redundant with it) [#1147]
124
+ - Remove `persistentStateRequired` API, in profit of the more powerful `persistentState` API [#1148]
125
+ - Remove `distinctiveIdentifierRequired` API, in profit of the more powerful `distinctiveIdentifier` API [#1148]
126
+ - Remove `keySystems[].fallbackOn` `loadVideo` property as it's now replaced by the more powerful `keySystems[].onKeyOutputRestricted` and `keySystems[].onKeyInternalError` properties.
127
+ - Remove `keySystems[].onKeyStatusesChange` API as it seems to never be used [#1148]
128
+ - Remove `keySystems[].throwOnLicenseExpiration` API as it can now be fully replaced by the `keySystems[].onKeyExpiration` option
129
+ - Remove `aggressiveMode` from the `transportOptions` `loadVideo` option
130
+ - Remove deprecated `throttleWhenHidden` player option in profit of `throttleVideoBitrateWhenHidden`
131
+ - Change payload of `periodChange` events, so they emit only core properties related to a `Period`.
132
+ - Change arguments given to a `transportOptions.segmentLoader` function (the `loadVideo` option): it now doesn't give the full `Manifest`, `Period`, `Adaptation`, `Representation` and `ISegment` structures in arguments but only core properties from it [#995]
133
+ - Custom `manifestLoader` function added to what was previously the `loadVideo`'s `transportOptions` option now set an object as argument (with an `url`property), to let us bring improvements on it in the future [#995]
134
+ - A Representation's `frameRate` is now always a number - in terms of frame per seconds - instead of a string.
135
+ - Update the arguments of the `representationFilter` API
136
+ - `Representations` (in methods: `getAvailableVideoTracks`, `getVideoTrack`, `representationFilter`, `getAvailableAudioTracks`, `getAudioTrack` and events: `audioTrackChange` and `videoTrackChange`) can have an `undefined` bitrate
137
+ - Remove deprecated fullscreen related APIs (methods: `isFullscreen`, `setFullscreen`, `exitFullscreen`, event: `fullscreenChange`) as a a UI is much more adapted to that task and can also bring with it things like a progress bar or HTML text tracks
138
+ - Remove deprecated `getNativeTextTrack` method. If advanced features are wanted, it's better to just use the HTML text track API
139
+ - Remove deprecated `nativeTextTracksChange` event. Same reason than for `getNativeTextTrack`
140
+ - Remove deprecated `hideNativeSubtitles` from `loadVideo` options. Same reason than for `getNativeTextTrack`
141
+ - Remove `xhr` property from a `NetworkError`. Doing so stop us from using the fetch API
142
+ - Remove deprecated `defaultAudioTrack` and `defaultTextTrack`in profit of new track APIs
143
+ - Remove `bitrateEstimationChange` event as it is poorly understood (it's not always close to the expected bandwidth) and has a very complex relationship with the chosen quality.
144
+ - Remove the notion of environment variables linked to personalized builds (e.g. RXP_DASH) in profit of the minimal RxPlayer.
145
+ - Rename `IPersistentSessionStorage` type to `IPersistentLicenseConfig` [#1147]
146
+ - Remove undocumented `audioRobustnesses` and `videoRobustnesses` properties of the `keySystems` option of `loadVideo` calls, as more powerful solutions now exist: respectively `audioCapabilitiesConfig` and `videoCapabilitiesConfig` [#1148]
147
+ - Remove public types `ISupplementaryTextTrackOption` and `ISupplementaryImageTrackOption`. Those are the types respectively for `supplementaryTextTracks` and `supplementaryImageTracks` which have been removed
148
+ - Remove public types `IBitrateEstimate` as no API depend on it anymore.
149
+ - Remove public types `IManifest`, `IPeriod`, `IAdaptation`, `IRepresentation`, `IRepresentationInfos`, `IBifThumbnail`, `IBifObject` and `IExposedSegment` as no API depend on them anymore.
150
+ - Remove public types `IDefaultAudioTrackOption` and `IDefaultTextTrackOption`. Those are the types respectively for `defaultAudioTrack` and `defaultTextTrack` `loadVideo` options which have been removed
151
+ - Remove public types `IAudioTrackPreference`, `ITextTrackPreference` and `IVideoTrackPreference` as the corresponding API do not exist anymore.
152
+ - Stop officially supporting the Internet Explorer 11 browser
153
+
154
+ ### Features
155
+
156
+ - `setAudioTrack`, `setVideoTrack` and `setTextTrack` now may take an object in argument, with the track's id set as a `trackId` property, to allow new features
157
+ - Add `switchingMode` optional property to `setVideoTrack` and `setAudioTrack`, to configure the way in which the RxPlayer switches between the previous and new track
158
+ - Add optional `periodId` property to `setAudioTrack`, `setVideoTrack` and `setTextTrack`, to allow setting the track of another, future or past, Period.
159
+ - `getAvailableAudioTracks`, `getAvailableTextTracks`, `getAvailableVideoTracks`, `getAudioTrack`, `getTextTrack` and `getVideoTrack` can now optionally take a `periodId` argument to retrieve track information on a specific Period, different than the current one.
160
+ - `disableTextTrack`, and`disableVideoTrack` can now optionally take a `periodId` argument to disable a track for a specific Period
161
+ - Add optional `lockedRepresentations` property to `setAudioTrack` and `setVideoTrack`, to only filter some allowed Representations (i.e. qualities) after switching to the wanted track.
162
+ - Add `getCurrentPeriod` method to retrieve information on the Period currently played
163
+ - Add `getAvailablePeriods` method to retrieve information on all Periods on which a track or Representation choice can be made
164
+ - Add `lockVideoRepresentations`, `lockAudioRepresentations`, `getLockedVideoRepresentations`, `getLockedAudioRepresentations`, `unlockVideoRepresentations` and `unlockAudioRepresentations` methods to allow a complex selection of Representations that are currently allowed to play.
165
+ - Add `getVideoRepresentation` and `getAudioRepresentation` method to retrieve information on the currently loaded representations [#1144]
166
+ - Add `audioRepresentationChange` and `videoRepresentationChange` events to be notified when the currently-loaded Representation for the current Period changes.
167
+ - Add `updateContentUrls` API, allowing to update the Manifest's URL during playback [#1182]
168
+ - DASH: implement forced-subtitles, adding the `forced` property to the audio tracks API and selecting by default a forced text track linked to the audio track's language if present [#1187]
169
+ - Add `getContentUrls` allowing to retrieve the one or several known URLs through which the current Manifest or content is reachable.
170
+ - Add `videoResolutionLimit` constructor option allowing to automatically limit a video Representation's resolution.
171
+ - Add `newAvailablePeriods` event to signal new Period on which a track and/or Representation choice can be made
172
+ - Add `brokenRepresentationsLock` event for when a Representations lock could not be respected anymore
173
+ - Add `trackUpdate` event for when a track has been updated for any type and Period
174
+ - Add `distinctiveIdentifier` property in the `keySystems` option (given to the `loadVideo` method) to have full control over the MediaKeySystemConfiguration of the same name in the chosen key system [#1148]
175
+ - Add `persistentState` property in the `keySystems` option (given to the `loadVideo` method) to have full control over the MediaKeySystemConfiguration of the same name in the chosen key system [#1148]
176
+ - Add `keySystems[].onKeyOutputRestricted` and `keySystems[].onKeyInternalError` properties to configure the RxPlayer's behavior when a key switches to the status respectively `"output-restricted"` and `"internal-error"`
177
+ - Add `audioCapabilitiesConfig` and `videoCapabilitiesConfig` properties in the `keySystems` option (given to the `loadVideo` method) to allow advanced configuration of respectively the "audioCapabilities" and "videoCapabilities" in the asked MediaKeySystemConfiguration [#1148]
178
+ - Add `ISegmentLoaderContext` public type for the first argument of the `segmentLoader` API
179
+ - Add `IRepresentationFilterRepresentation` public type for the first argument of the `representationFilter` API
180
+ - Add `IRepresentationContext` public type for the second argument of the `representationFilter` API
181
+ - Add `IManifestLoaderInfo` public type for the first argument of the `manifestLoader` API
182
+ - Add `IPeriodChangeEvent` public type to define the properties send through a `periodChange` event
183
+ - Add `IPeriod` public type to define a Period object returned by methods like `getAvailablePeriods` or `getCurrentPeriod`
184
+ - Add `IVideoTrackSwitchingMode` public type to define the type of the `switchingMode` property optionally given to `setAudioTrack`
185
+ - Add `IAudioRepresentationsSwitchingMode` public type to define the type of the `switchingMode` property optionally given to `lockAudioRepresentations`
186
+ - Add `IVideoRepresentationsSwitchingMode` public type to define the type of the `switchingMode` property optionally given to `lockAudioRepresentations`
187
+ - Add `IBrokenRepresentationsLockContext` public type to define the type sent as a payload of the `brokenRepresentationsLock` event
188
+ - Add `ITrackUpdateEventPayload` public type to define the type sent as a payload of the `trackUpdate` event
189
+ - Add `ILockedVideoRepresentationsSettings` public type to define the object that should be given to the new `lockVideoRepresentation` method
190
+ - Add `ILockedAudioRepresentationsSettings` public type to define the object that should be given to the new `lockAudioRepresentation` method
191
+ - Add `IAudioTrackSetting` public type to define the object that may be given to the `setAudioTrack` method
192
+ - Add `IVideoTrackSetting` public type to define the object that may be given to the `setVideoTrack` method
193
+ - Add `ITextTrackSetting` public type to define the object that may be given to the `setTextTrack` method
194
+
195
+ ### Bug fixes
196
+
197
+ - Fix segment requesting error when playing a DASH content without an url and without BaseURL elements [#1192]
198
+ - API: Stop sending events if the content is stopped due to a side-effect of one of the event handler [#1197]
199
+ - text-tracks/ttml: fix inconsistent line spacing when resizing the `textTrackElement` [#1191]
200
+ - DRM: Fix race condition leading to a JS error instead of a `NO_PLAYABLE_REPRESENTATION` [#1201]
201
+ - DRM/Compat: Renew MediaKeys at each `loadVideo` on all WebOS (LG TV) platforms to work around issues [#1188]
202
+
203
+ ### Other improvements
204
+
205
+ - Remove dependency to RxJS, improving the debugging experience and preventing some uncaught Error from being thrown
30
206
 
31
207
 
32
208
  ## v3.32.1 (2023-10-19)
package/README.md CHANGED
@@ -179,21 +179,11 @@ Demo pages for our previous versions are also available
179
179
 
180
180
 
181
181
 
182
- ## Your questions ##############################################################
183
-
184
- You can ask directly your questions about the project on [our
185
- gitter](https://gitter.im/canalplus/rx-player).
186
- We will try our best to answer them as quickly as possible.
187
-
188
-
189
-
190
182
  ## Contribute ##################################################################
191
183
 
192
184
  Details on how to contribute is written in the [CONTRIBUTING.md
193
185
  file](./CONTRIBUTING.md) at the root of this repository.
194
186
 
195
- If you need more information, you can contact us via our [gitter
196
- room](https://gitter.im/canalplus/rx-player).
197
187
 
198
188
 
199
189
  ### Dependencies ###############################################################
@@ -213,7 +203,7 @@ Canal+ Group is a media company with many advanced needs when it comes to media
213
203
  playback: it provides both live and VoD stream with multiple encryption
214
204
  requirements, supports a very large panel of devices and has many other
215
205
  specificities (like adult content restrictions, ad-insertion, Peer-To-Peer
216
- integration...).
206
+ integration, low-latency live streaming...).
217
207
 
218
208
  When the time came to switch from a plugin-based web player approach to an HTML5
219
209
  one back in 2015, no media player had the key features we wanted, and including
@@ -224,7 +214,7 @@ The R&D department of Canal+ Group thus started to work on a new featureful
224
214
  media-player: the RxPlayer. To both help and profit from the community, it also
225
215
  decided to share it to everyone under a permissive open-source licence.
226
216
 
227
- Now, more than 6 years later, the RxPlayer continues to evolve at the same fast
217
+ Now, more than 8 years later, the RxPlayer continues to evolve at the same fast
228
218
  pace to include a lot of features and improvements you may not find in other
229
219
  media players.
230
220
  You can look at our
@@ -271,24 +261,3 @@ them. Amongst those:
271
261
  risks always low.
272
262
 
273
263
  \* In "directfile" mode, on compatible browsers
274
-
275
-
276
- ## Target support ##############################################################
277
-
278
- Here is a basic list of supported platforms:
279
-
280
- | | Chrome | IE [1] | Edge | Firefox | Safari | Opera |
281
- |-------------|:-------:|:-------:|:------:|:---------:|:--------:|:-------:|
282
- | Windows | >= 30 | >= 11 | >= 12 | >= 42 | >= 8 | >= 25 |
283
- | OSX | >= 30 | - | - | >= 42 | >= 8 | >= 25 |
284
- | Linux | >= 37 | - | - | >= 42 | - | >= 25 |
285
- | Android [2] | >= 30 | - | - | >= 42 | - | >= 15 |
286
- | iOS | No | - | - | No | No | No |
287
-
288
- [1] Only on Windows >= 8.
289
-
290
- [2] Android version >= 4.2
291
-
292
- And more. A good way to know if the browser should be supported by our player is
293
- to go on the page https://www.youtube.com/html5 and check for "Media Source
294
- Extensions" support.
package/VERSION CHANGED
@@ -1 +1 @@
1
- 4.0.0-dev.2023120600
1
+ 4.0.0-dev.2023121900
@@ -23,9 +23,11 @@ import { ICompatTextTrack } from "./browser_compatibility_types";
23
23
  * undefined if no trackElement was added.
24
24
  *
25
25
  * @param {HTMLMediaElement} mediaElement
26
+ * @param {Boolean} hidden - If `true`, the text track will be hidden by
27
+ * default. If `false`, the text track will be directly showing.
26
28
  * @returns {Object}
27
29
  */
28
- export default function addTextTrack(mediaElement: HTMLMediaElement): {
30
+ export default function addTextTrack(mediaElement: HTMLMediaElement, hidden: boolean): {
29
31
  track: ICompatTextTrack;
30
32
  trackElement: HTMLTrackElement | undefined;
31
33
  };
@@ -23,10 +23,12 @@ import { isIEOrEdge } from "./browser_detection";
23
23
  * undefined if no trackElement was added.
24
24
  *
25
25
  * @param {HTMLMediaElement} mediaElement
26
+ * @param {Boolean} hidden - If `true`, the text track will be hidden by
27
+ * default. If `false`, the text track will be directly showing.
26
28
  * @returns {Object}
27
29
  */
28
- export default function addTextTrack(mediaElement) {
29
- var _a;
30
+ export default function addTextTrack(mediaElement, hidden) {
31
+ var _a, _b;
30
32
  var track;
31
33
  var trackElement;
32
34
  var kind = "subtitles";
@@ -34,14 +36,15 @@ export default function addTextTrack(mediaElement) {
34
36
  var tracksLength = mediaElement.textTracks.length;
35
37
  track = (tracksLength > 0 ? mediaElement.textTracks[tracksLength - 1] :
36
38
  mediaElement.addTextTrack(kind));
37
- track.mode = (_a = track.SHOWING) !== null && _a !== void 0 ? _a : "showing";
39
+ track.mode = hidden ? ((_a = track.HIDDEN) !== null && _a !== void 0 ? _a : "hidden") :
40
+ ((_b = track.SHOWING) !== null && _b !== void 0 ? _b : "showing");
38
41
  }
39
42
  else {
40
43
  trackElement = document.createElement("track");
41
44
  mediaElement.appendChild(trackElement);
42
45
  track = trackElement.track;
43
46
  trackElement.kind = kind;
44
- track.mode = "showing";
47
+ track.mode = hidden ? "hidden" : "showing";
45
48
  }
46
49
  return { track: track, trackElement: trackElement };
47
50
  }
@@ -52,8 +52,15 @@ interface ICompatTextTrack extends TextTrack {
52
52
  * functions for some "old" browsers.
53
53
  */
54
54
  interface ICompatDocument extends Document {
55
+ fullscreenElement: Element | null;
56
+ mozCancelFullScreen?: () => void;
57
+ mozFullScreenElement?: HTMLElement;
55
58
  mozHidden?: boolean;
59
+ msExitFullscreen?: () => void;
60
+ msFullscreenElement?: Element | null;
56
61
  msHidden?: boolean;
62
+ webkitExitFullscreen: () => void;
63
+ webkitFullscreenElement: Element | null;
57
64
  webkitHidden?: boolean;
58
65
  }
59
66
  /**
@@ -34,6 +34,15 @@ export type IEventTargetLike = HTMLElement | IEventEmitterLike | IEventEmitter<u
34
34
  * be triggered when that event is emitted on a given event target.
35
35
  */
36
36
  declare function createCompatibleEventListener(eventNames: string[], prefixes?: string[]): (element: IEventTargetLike, listener: (event?: unknown) => void, cancelSignal: CancellationSignal) => void;
37
+ /**
38
+ * Returns a reference:
39
+ * - Set to `true` when the current page is considered visible and active.
40
+ * - Set to `false` otherwise.
41
+ * @param {Object} stopListening - `CancellationSignal` allowing to free the
42
+ * resources allocated to update this value.
43
+ * @returns {Object}
44
+ */
45
+ declare function getPageActivityRef(stopListening: CancellationSignal): IReadOnlySharedReference<boolean>;
37
46
  export interface IPictureInPictureEvent {
38
47
  isEnabled: boolean;
39
48
  pipWindow: ICompatPictureInPictureWindow | null;
@@ -74,7 +83,11 @@ declare const onLoadedMetadata: (element: IEventTargetLike, listener: (event?: u
74
83
  */
75
84
  declare const onTimeUpdate: (element: IEventTargetLike, listener: (event?: unknown) => void, cancelSignal: CancellationSignal) => void;
76
85
  /**
77
- * @param {TextTrackList} mediaElement
86
+ * @param {HTMLElement} element
87
+ */
88
+ declare const onFullscreenChange: (element: IEventTargetLike, listener: (event?: unknown) => void, cancelSignal: CancellationSignal) => void;
89
+ /**
90
+ * @param {TextTrackList} textTrackList
78
91
  */
79
92
  declare const onTextTrackAdded: (element: IEventTargetLike, listener: (event?: unknown) => void, cancelSignal: CancellationSignal) => void;
80
93
  /**
@@ -150,4 +163,4 @@ declare const onEnded: (element: IEventTargetLike, listener: (event?: unknown) =
150
163
  * emits
151
164
  */
152
165
  declare function addEventListener(elt: IEventEmitterLike, evt: string, listener: (x?: unknown) => void, stopListening: CancellationSignal): void;
153
- export { addEventListener, createCompatibleEventListener, getPictureOnPictureStateRef, getVideoVisibilityRef, getVideoWidthRef, onEnded, onKeyAdded, onKeyError, onKeyMessage, onKeyStatusesChange, onLoadedMetadata, onRemoveSourceBuffers, onSeeked, onSeeking, onSourceClose, onSourceEnded, onSourceOpen, onTimeUpdate, onSourceBufferUpdate, onTextTrackAdded, onTextTrackRemoved, };
166
+ export { addEventListener, createCompatibleEventListener, getPageActivityRef, getPictureOnPictureStateRef, getVideoVisibilityRef, getVideoWidthRef, onEnded, onFullscreenChange, onKeyAdded, onKeyError, onKeyMessage, onKeyStatusesChange, onLoadedMetadata, onRemoveSourceBuffers, onSeeked, onSeeking, onSourceClose, onSourceEnded, onSourceOpen, onTimeUpdate, onSourceBufferUpdate, onTextTrackAdded, onTextTrackRemoved, };
@@ -166,6 +166,35 @@ function getDocumentVisibilityRef(stopListening) {
166
166
  }, stopListening);
167
167
  return ref;
168
168
  }
169
+ /**
170
+ * Returns a reference:
171
+ * - Set to `true` when the current page is considered visible and active.
172
+ * - Set to `false` otherwise.
173
+ * @param {Object} stopListening - `CancellationSignal` allowing to free the
174
+ * resources allocated to update this value.
175
+ * @returns {Object}
176
+ */
177
+ function getPageActivityRef(stopListening) {
178
+ var isDocVisibleRef = getDocumentVisibilityRef(stopListening);
179
+ var currentTimeout;
180
+ var ref = new SharedReference(true, stopListening);
181
+ stopListening.register(function () {
182
+ clearTimeout(currentTimeout);
183
+ currentTimeout = undefined;
184
+ });
185
+ isDocVisibleRef.onUpdate(function onDocVisibilityChange(isVisible) {
186
+ clearTimeout(currentTimeout); // clear potential previous timeout
187
+ currentTimeout = undefined;
188
+ if (!isVisible) {
189
+ var INACTIVITY_DELAY = config.getCurrent().INACTIVITY_DELAY;
190
+ currentTimeout = window.setTimeout(function () {
191
+ ref.setValueIfChanged(false);
192
+ }, INACTIVITY_DELAY);
193
+ }
194
+ ref.setValueIfChanged(true);
195
+ }, { clearSignal: stopListening, emitCurrentValue: true });
196
+ return ref;
197
+ }
169
198
  /**
170
199
  * Get video width from Picture-in-Picture window
171
200
  * @param {HTMLMediaElement} mediaElement
@@ -303,7 +332,13 @@ var onLoadedMetadata = createCompatibleEventListener(["loadedmetadata"]);
303
332
  */
304
333
  var onTimeUpdate = createCompatibleEventListener(["timeupdate"]);
305
334
  /**
306
- * @param {TextTrackList} mediaElement
335
+ * @param {HTMLElement} element
336
+ */
337
+ var onFullscreenChange = createCompatibleEventListener(["fullscreenchange", "FullscreenChange"],
338
+ // On IE11, fullscreen change events is called MSFullscreenChange
339
+ BROWSER_PREFIXES.concat("MS"));
340
+ /**
341
+ * @param {TextTrackList} textTrackList
307
342
  */
308
343
  var onTextTrackAdded = createCompatibleEventListener(["addtrack"]);
309
344
  /**
@@ -384,4 +419,4 @@ function addEventListener(elt, evt, listener, stopListening) {
384
419
  elt.removeEventListener(evt, listener);
385
420
  });
386
421
  }
387
- export { addEventListener, createCompatibleEventListener, getPictureOnPictureStateRef, getVideoVisibilityRef, getVideoWidthRef, onEnded, onKeyAdded, onKeyError, onKeyMessage, onKeyStatusesChange, onLoadedMetadata, onRemoveSourceBuffers, onSeeked, onSeeking, onSourceClose, onSourceEnded, onSourceOpen, onTimeUpdate, onSourceBufferUpdate, onTextTrackAdded, onTextTrackRemoved, };
422
+ export { addEventListener, createCompatibleEventListener, getPageActivityRef, getPictureOnPictureStateRef, getVideoVisibilityRef, getVideoWidthRef, onEnded, onFullscreenChange, onKeyAdded, onKeyError, onKeyMessage, onKeyStatusesChange, onLoadedMetadata, onRemoveSourceBuffers, onSeeked, onSeeking, onSourceClose, onSourceEnded, onSourceOpen, onTimeUpdate, onSourceBufferUpdate, onTextTrackAdded, onTextTrackRemoved, };
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Copyright 2015 CANAL+ Group
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ /**
17
+ * Request fullScreen action on a given element.
18
+ * @param {HTMLElement} elt
19
+ */
20
+ declare function requestFullscreen(element: HTMLMediaElement): void;
21
+ /**
22
+ * Exit fullscreen if an element is currently in fullscreen.
23
+ */
24
+ declare function exitFullscreen(): void;
25
+ /**
26
+ * Returns true if an element in the document is being displayed in fullscreen
27
+ * mode;
28
+ * otherwise it's false.
29
+ * @returns {boolean}
30
+ */
31
+ declare function isFullscreen(): boolean;
32
+ export { requestFullscreen, exitFullscreen, isFullscreen, };
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Copyright 2015 CANAL+ Group
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ /**
17
+ * Request fullScreen action on a given element.
18
+ * @param {HTMLElement} elt
19
+ */
20
+ function requestFullscreen(element) {
21
+ if (!isFullscreen()) {
22
+ var elt = element;
23
+ /* eslint-disable @typescript-eslint/unbound-method */
24
+ if (typeof elt.requestFullscreen === "function") {
25
+ /* eslint-enable @typescript-eslint/unbound-method */
26
+ /* eslint-disable @typescript-eslint/no-floating-promises */
27
+ elt.requestFullscreen();
28
+ /* eslint-enable @typescript-eslint/no-floating-promises */
29
+ }
30
+ else if (typeof elt.msRequestFullscreen === "function") {
31
+ elt.msRequestFullscreen();
32
+ }
33
+ else if (typeof elt.mozRequestFullScreen === "function") {
34
+ elt.mozRequestFullScreen();
35
+ }
36
+ else if (typeof elt.webkitRequestFullscreen === "function") {
37
+ elt.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);
38
+ }
39
+ }
40
+ }
41
+ /**
42
+ * Exit fullscreen if an element is currently in fullscreen.
43
+ */
44
+ function exitFullscreen() {
45
+ if (isFullscreen()) {
46
+ var doc = document;
47
+ /* eslint-disable @typescript-eslint/unbound-method */
48
+ if (typeof doc.exitFullscreen === "function") {
49
+ /* eslint-enable @typescript-eslint/unbound-method */
50
+ /* eslint-disable @typescript-eslint/no-floating-promises */
51
+ doc.exitFullscreen();
52
+ /* eslint-enable @typescript-eslint/no-floating-promises */
53
+ }
54
+ else if (typeof doc.msExitFullscreen === "function") {
55
+ doc.msExitFullscreen();
56
+ }
57
+ else if (typeof doc.mozCancelFullScreen === "function") {
58
+ doc.mozCancelFullScreen();
59
+ }
60
+ else if (typeof doc.webkitExitFullscreen === "function") {
61
+ doc.webkitExitFullscreen();
62
+ }
63
+ }
64
+ }
65
+ /**
66
+ * Returns true if an element in the document is being displayed in fullscreen
67
+ * mode;
68
+ * otherwise it's false.
69
+ * @returns {boolean}
70
+ */
71
+ function isFullscreen() {
72
+ var doc = document;
73
+ return (doc.fullscreenElement != null ||
74
+ doc.mozFullScreenElement != null ||
75
+ doc.webkitFullscreenElement != null ||
76
+ doc.msFullscreenElement != null);
77
+ }
78
+ export { requestFullscreen, exitFullscreen, isFullscreen, };
@@ -22,9 +22,11 @@ import tryToChangeSourceBufferType, { ICompatSourceBuffer } from "./change_sourc
22
22
  import clearElementSrc from "./clear_element_src";
23
23
  import enableAudioTrack from "./enable_audio_track";
24
24
  import * as events from "./event_listeners";
25
+ import { exitFullscreen, isFullscreen, requestFullscreen } from "./fullscreen";
25
26
  import getStartDate from "./get_start_date";
26
27
  import isCodecSupported from "./is_codec_supported";
27
28
  import isNode from "./is_node";
29
+ import isOffline from "./is_offline";
28
30
  import isVTTCue from "./is_vtt_cue";
29
31
  import makeVTTCue from "./make_vtt_cue";
30
32
  import onHeightWidthChange from "./on_height_width_change";
@@ -34,4 +36,4 @@ import shouldUnsetMediaKeys from "./should_unset_media_keys";
34
36
  import shouldValidateMetadata from "./should_validate_metadata";
35
37
  import shouldWaitForDataBeforeLoaded from "./should_wait_for_data_before_loaded";
36
38
  import shouldWaitForHaveEnoughData from "./should_wait_for_have_enough_data";
37
- export { addClassName, addTextTrack, canPatchISOBMFFSegment, canReuseMediaKeys, clearElementSrc, enableAudioTrack, events, getStartDate, ICompatTextTrack, ICompatVTTCue, ICompatSourceBuffer, isCodecSupported, isNode, isVTTCue, makeVTTCue, MediaSource_, onHeightWidthChange, shouldReloadMediaSourceOnDecipherabilityUpdate, shouldRenewMediaKeySystemAccess, shouldUnsetMediaKeys, shouldValidateMetadata, shouldWaitForDataBeforeLoaded, shouldWaitForHaveEnoughData, tryToChangeSourceBufferType, };
39
+ export { addClassName, addTextTrack, canPatchISOBMFFSegment, canReuseMediaKeys, clearElementSrc, enableAudioTrack, events, exitFullscreen, getStartDate, ICompatTextTrack, ICompatVTTCue, ICompatSourceBuffer, isCodecSupported, isFullscreen, isNode, isOffline, isVTTCue, makeVTTCue, MediaSource_, onHeightWidthChange, requestFullscreen, shouldReloadMediaSourceOnDecipherabilityUpdate, shouldRenewMediaKeySystemAccess, shouldUnsetMediaKeys, shouldValidateMetadata, shouldWaitForDataBeforeLoaded, shouldWaitForHaveEnoughData, tryToChangeSourceBufferType, };
@@ -22,9 +22,11 @@ import tryToChangeSourceBufferType from "./change_source_buffer_type";
22
22
  import clearElementSrc from "./clear_element_src";
23
23
  import enableAudioTrack from "./enable_audio_track";
24
24
  import * as events from "./event_listeners";
25
+ import { exitFullscreen, isFullscreen, requestFullscreen, } from "./fullscreen";
25
26
  import getStartDate from "./get_start_date";
26
27
  import isCodecSupported from "./is_codec_supported";
27
28
  import isNode from "./is_node";
29
+ import isOffline from "./is_offline";
28
30
  import isVTTCue from "./is_vtt_cue";
29
31
  import makeVTTCue from "./make_vtt_cue";
30
32
  import onHeightWidthChange from "./on_height_width_change";
@@ -40,4 +42,4 @@ import shouldWaitForHaveEnoughData from "./should_wait_for_have_enough_data";
40
42
  // we would prefer to disallow (both for the understandability of the code and
41
43
  // to better exploit tree shaking.
42
44
  patchWebkitSourceBuffer();
43
- export { addClassName, addTextTrack, canPatchISOBMFFSegment, canReuseMediaKeys, clearElementSrc, enableAudioTrack, events, getStartDate, isCodecSupported, isNode, isVTTCue, makeVTTCue, MediaSource_, onHeightWidthChange, shouldReloadMediaSourceOnDecipherabilityUpdate, shouldRenewMediaKeySystemAccess, shouldUnsetMediaKeys, shouldValidateMetadata, shouldWaitForDataBeforeLoaded, shouldWaitForHaveEnoughData, tryToChangeSourceBufferType, };
45
+ export { addClassName, addTextTrack, canPatchISOBMFFSegment, canReuseMediaKeys, clearElementSrc, enableAudioTrack, events, exitFullscreen, getStartDate, isCodecSupported, isFullscreen, isNode, isOffline, isVTTCue, makeVTTCue, MediaSource_, onHeightWidthChange, requestFullscreen, shouldReloadMediaSourceOnDecipherabilityUpdate, shouldRenewMediaKeySystemAccess, shouldUnsetMediaKeys, shouldValidateMetadata, shouldWaitForDataBeforeLoaded, shouldWaitForHaveEnoughData, tryToChangeSourceBufferType, };
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Copyright 2015 CANAL+ Group
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ /**
17
+ * Some browsers have a builtin API to know if it's connected at least to a
18
+ * LAN network, at most to the internet.
19
+ *
20
+ * /!\ This feature can be dangerous as you can both have false positives and
21
+ * false negatives.
22
+ *
23
+ * False positives:
24
+ * - you can still play local contents (on localhost) if isOffline == true
25
+ * - on some browsers isOffline might be true even if we're connected to a LAN
26
+ * or a router (it would mean we're just not able to connect to the
27
+ * Internet). So we can eventually play LAN contents if isOffline == true
28
+ *
29
+ * False negatives:
30
+ * - in some cases, we even might have isOffline at false when we do not have
31
+ * any connection:
32
+ * - in browsers that do not support the feature
33
+ * - in browsers running in some virtualization softwares where the
34
+ * network adapters are always connected.
35
+ *
36
+ * Use with these cases in mind.
37
+ * @returns {Boolean}
38
+ */
39
+ export default function isOffline(): boolean;