rx-player 3.29.0-dev.2022091600 → 4.0.0-alpha.2022100600

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 (423) hide show
  1. package/CHANGELOG.md +86 -19
  2. package/FILES.md +0 -1
  3. package/MAINTAINERS.md +2 -1
  4. package/VERSION +1 -1
  5. package/a.js +373 -0
  6. package/dist/_esm5.processed/compat/add_text_track.d.ts +1 -3
  7. package/dist/_esm5.processed/compat/add_text_track.js +4 -7
  8. package/dist/_esm5.processed/compat/browser_compatibility_types.d.ts +0 -7
  9. package/dist/_esm5.processed/compat/event_listeners.d.ts +1 -15
  10. package/dist/_esm5.processed/compat/event_listeners.js +1 -38
  11. package/dist/_esm5.processed/compat/index.d.ts +1 -3
  12. package/dist/_esm5.processed/compat/index.js +1 -3
  13. package/dist/_esm5.processed/config.d.ts +10 -20
  14. package/dist/_esm5.processed/core/adaptive/adaptive_representation_selector.d.ts +0 -58
  15. package/dist/_esm5.processed/core/adaptive/adaptive_representation_selector.js +16 -37
  16. package/dist/_esm5.processed/core/adaptive/utils/select_optimal_representation.d.ts +2 -8
  17. package/dist/_esm5.processed/core/adaptive/utils/select_optimal_representation.js +2 -11
  18. package/dist/_esm5.processed/core/api/option_utils.d.ts +12 -35
  19. package/dist/_esm5.processed/core/api/option_utils.js +40 -220
  20. package/dist/_esm5.processed/core/api/public_api.d.ts +98 -267
  21. package/dist/_esm5.processed/core/api/public_api.js +449 -807
  22. package/dist/_esm5.processed/core/{segment_buffers/implementations/image → api/track_management}/index.d.ts +3 -2
  23. package/dist/_esm5.processed/core/{segment_buffers/implementations/image → api/track_management}/index.js +3 -2
  24. package/dist/_esm5.processed/core/api/{tracks_management/media_element_track_choice_manager.d.ts → track_management/media_element_tracks_store.d.ts} +15 -75
  25. package/dist/_esm5.processed/core/api/{tracks_management/media_element_track_choice_manager.js → track_management/media_element_tracks_store.js} +74 -193
  26. package/dist/_esm5.processed/core/api/track_management/track_dispatcher.d.ts +85 -0
  27. package/dist/_esm5.processed/core/api/track_management/track_dispatcher.js +157 -0
  28. package/dist/_esm5.processed/core/api/track_management/tracks_store.d.ts +410 -0
  29. package/dist/_esm5.processed/core/api/track_management/tracks_store.js +974 -0
  30. package/dist/_esm5.processed/core/api/utils.d.ts +1 -0
  31. package/dist/_esm5.processed/core/api/utils.js +2 -1
  32. package/dist/_esm5.processed/core/decrypt/__tests__/__global__/utils.d.ts +15 -0
  33. package/dist/_esm5.processed/core/decrypt/__tests__/__global__/utils.js +27 -0
  34. package/dist/_esm5.processed/core/decrypt/content_decryptor.js +8 -43
  35. package/dist/_esm5.processed/core/decrypt/find_key_system.d.ts +1 -1
  36. package/dist/_esm5.processed/core/decrypt/find_key_system.js +87 -67
  37. package/dist/_esm5.processed/core/decrypt/get_media_keys.js +6 -5
  38. package/dist/_esm5.processed/core/decrypt/session_events_listener.d.ts +17 -14
  39. package/dist/_esm5.processed/core/decrypt/session_events_listener.js +10 -31
  40. package/dist/_esm5.processed/core/decrypt/utils/check_key_statuses.d.ts +21 -18
  41. package/dist/_esm5.processed/core/decrypt/utils/check_key_statuses.js +13 -84
  42. package/dist/_esm5.processed/core/decrypt/utils/persistent_sessions_store.d.ts +6 -5
  43. package/dist/_esm5.processed/core/decrypt/utils/persistent_sessions_store.js +8 -5
  44. package/dist/_esm5.processed/core/fetchers/cdn_prioritizer.d.ts +98 -0
  45. package/dist/_esm5.processed/core/fetchers/cdn_prioritizer.js +173 -0
  46. package/dist/_esm5.processed/core/fetchers/manifest/manifest_fetcher.d.ts +1 -3
  47. package/dist/_esm5.processed/core/fetchers/manifest/manifest_fetcher.js +8 -27
  48. package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.d.ts +5 -10
  49. package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.js +29 -23
  50. package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher_creator.d.ts +5 -6
  51. package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher_creator.js +7 -5
  52. package/dist/_esm5.processed/core/fetchers/utils/schedule_request.d.ts +98 -0
  53. package/dist/_esm5.processed/core/fetchers/utils/schedule_request.js +377 -0
  54. package/dist/_esm5.processed/core/init/content_time_boundaries_observer.d.ts +4 -3
  55. package/dist/_esm5.processed/core/init/content_time_boundaries_observer.js +21 -22
  56. package/dist/_esm5.processed/core/init/events_generators.d.ts +2 -14
  57. package/dist/_esm5.processed/core/init/events_generators.js +1 -9
  58. package/dist/_esm5.processed/core/init/initialize_media_source.d.ts +16 -9
  59. package/dist/_esm5.processed/core/init/initialize_media_source.js +11 -5
  60. package/dist/_esm5.processed/core/init/load_on_media_source.js +7 -1
  61. package/dist/_esm5.processed/core/init/manifest_update_scheduler.js +1 -1
  62. package/dist/_esm5.processed/core/init/types.d.ts +4 -19
  63. package/dist/_esm5.processed/core/segment_buffers/implementations/text/native/native_text_segment_buffer.d.ts +1 -2
  64. package/dist/_esm5.processed/core/segment_buffers/implementations/text/native/native_text_segment_buffer.js +2 -3
  65. package/dist/_esm5.processed/core/segment_buffers/implementations/types.d.ts +2 -2
  66. package/dist/_esm5.processed/core/segment_buffers/index.d.ts +2 -2
  67. package/dist/_esm5.processed/core/segment_buffers/index.js +2 -1
  68. package/dist/_esm5.processed/core/segment_buffers/inventory/index.d.ts +1 -0
  69. package/dist/_esm5.processed/core/segment_buffers/inventory/index.js +1 -0
  70. package/dist/_esm5.processed/core/segment_buffers/inventory/utils.d.ts +33 -0
  71. package/dist/_esm5.processed/core/segment_buffers/inventory/utils.js +49 -0
  72. package/dist/_esm5.processed/core/segment_buffers/segment_buffers_store.d.ts +0 -1
  73. package/dist/_esm5.processed/core/segment_buffers/segment_buffers_store.js +2 -16
  74. package/dist/_esm5.processed/core/stream/adaptation/adaptation_stream.d.ts +2 -10
  75. package/dist/_esm5.processed/core/stream/adaptation/adaptation_stream.js +167 -135
  76. package/dist/_esm5.processed/core/stream/adaptation/get_representations_switch_strategy.d.ts +39 -0
  77. package/dist/_esm5.processed/core/stream/adaptation/get_representations_switch_strategy.js +133 -0
  78. package/dist/_esm5.processed/core/stream/events_generators.d.ts +4 -4
  79. package/dist/_esm5.processed/core/stream/events_generators.js +6 -6
  80. package/dist/_esm5.processed/core/stream/index.d.ts +0 -1
  81. package/dist/_esm5.processed/core/stream/orchestrator/active_period_emitter.d.ts +1 -2
  82. package/dist/_esm5.processed/core/stream/orchestrator/active_period_emitter.js +1 -2
  83. package/dist/_esm5.processed/core/stream/orchestrator/{get_time_ranges_for_content.d.ts → get_blacklisted_ranges.d.ts} +1 -1
  84. package/dist/_esm5.processed/core/stream/orchestrator/{get_time_ranges_for_content.js → get_blacklisted_ranges.js} +1 -1
  85. package/dist/_esm5.processed/core/stream/orchestrator/stream_orchestrator.js +20 -62
  86. package/dist/_esm5.processed/core/stream/period/get_adaptation_switch_strategy.d.ts +2 -4
  87. package/dist/_esm5.processed/core/stream/period/get_adaptation_switch_strategy.js +10 -46
  88. package/dist/_esm5.processed/core/stream/period/period_stream.d.ts +0 -3
  89. package/dist/_esm5.processed/core/stream/period/period_stream.js +10 -10
  90. package/dist/_esm5.processed/core/stream/representation/representation_stream.js +27 -21
  91. package/dist/_esm5.processed/core/stream/types.d.ts +54 -23
  92. package/dist/_esm5.processed/default_config.d.ts +54 -96
  93. package/dist/_esm5.processed/default_config.js +57 -112
  94. package/dist/_esm5.processed/errors/custom_loader_error.d.ts +1 -3
  95. package/dist/_esm5.processed/errors/custom_loader_error.js +1 -3
  96. package/dist/_esm5.processed/errors/encrypted_media_error.d.ts +1 -6
  97. package/dist/_esm5.processed/errors/encrypted_media_error.js +5 -4
  98. package/dist/_esm5.processed/errors/network_error.d.ts +0 -1
  99. package/dist/_esm5.processed/errors/network_error.js +0 -1
  100. package/dist/_esm5.processed/errors/request_error.d.ts +2 -3
  101. package/dist/_esm5.processed/errors/request_error.js +2 -5
  102. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.js +4 -4
  103. package/dist/_esm5.processed/features/features_object.js +0 -2
  104. package/dist/_esm5.processed/features/initialize_features.d.ts +2 -4
  105. package/dist/_esm5.processed/features/initialize_features.js +4 -12
  106. package/dist/_esm5.processed/features/list/directfile.js +2 -2
  107. package/dist/_esm5.processed/features/list/index.d.ts +0 -2
  108. package/dist/_esm5.processed/features/list/index.js +0 -2
  109. package/dist/_esm5.processed/features/types.d.ts +4 -27
  110. package/dist/_esm5.processed/index.d.ts +1 -3
  111. package/dist/_esm5.processed/index.js +1 -4
  112. package/dist/_esm5.processed/manifest/adaptation.d.ts +3 -9
  113. package/dist/_esm5.processed/manifest/adaptation.js +9 -23
  114. package/dist/_esm5.processed/manifest/index.d.ts +3 -4
  115. package/dist/_esm5.processed/manifest/manifest.d.ts +6 -55
  116. package/dist/_esm5.processed/manifest/manifest.js +6 -102
  117. package/dist/_esm5.processed/manifest/period.d.ts +4 -5
  118. package/dist/_esm5.processed/manifest/representation.d.ts +22 -6
  119. package/dist/_esm5.processed/manifest/representation.js +10 -1
  120. package/dist/_esm5.processed/manifest/representation_index/index.d.ts +2 -2
  121. package/dist/_esm5.processed/manifest/representation_index/static.d.ts +3 -1
  122. package/dist/_esm5.processed/manifest/representation_index/static.js +8 -2
  123. package/dist/_esm5.processed/manifest/representation_index/types.d.ts +74 -36
  124. package/dist/_esm5.processed/manifest/types.d.ts +0 -2
  125. package/dist/_esm5.processed/manifest/update_period_in_place.js +1 -0
  126. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/base.d.ts +27 -40
  127. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/base.js +37 -30
  128. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/get_init_segment.d.ts +1 -1
  129. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/get_init_segment.js +3 -3
  130. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/get_segments_from_timeline.d.ts +1 -1
  131. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/get_segments_from_timeline.js +4 -4
  132. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/list.d.ts +9 -7
  133. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/list.js +19 -9
  134. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/template.d.ts +7 -12
  135. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/template.js +27 -24
  136. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.d.ts +13 -10
  137. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.js +20 -13
  138. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/tokens.d.ts +3 -4
  139. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/tokens.js +4 -12
  140. package/dist/_esm5.processed/parsers/manifest/dash/common/infer_adaptation_type.d.ts +2 -2
  141. package/dist/_esm5.processed/parsers/manifest/dash/common/infer_adaptation_type.js +1 -6
  142. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_adaptation_sets.js +3 -5
  143. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_mpd.d.ts +0 -2
  144. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_mpd.js +3 -5
  145. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_periods.js +2 -2
  146. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representation_index.d.ts +0 -2
  147. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representation_index.js +2 -4
  148. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representations.js +6 -2
  149. package/dist/_esm5.processed/parsers/manifest/dash/common/resolve_base_urls.d.ts +1 -2
  150. package/dist/_esm5.processed/parsers/manifest/dash/common/resolve_base_urls.js +3 -8
  151. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/AdaptationSet.js +10 -6
  152. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/BaseURL.d.ts +1 -1
  153. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/BaseURL.js +2 -20
  154. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/Representation.js +4 -2
  155. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/utils.d.ts +10 -1
  156. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/utils.js +18 -2
  157. package/dist/_esm5.processed/parsers/manifest/dash/node_parser_types.d.ts +4 -10
  158. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/AdaptationSet.js +3 -6
  159. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/BaseURL.js +0 -11
  160. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/Representation.js +1 -2
  161. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/types.d.ts +5 -1
  162. package/dist/_esm5.processed/parsers/manifest/local/parse_local_manifest.js +2 -1
  163. package/dist/_esm5.processed/parsers/manifest/local/representation_index.d.ts +2 -0
  164. package/dist/_esm5.processed/parsers/manifest/local/representation_index.js +8 -2
  165. package/dist/_esm5.processed/parsers/manifest/metaplaylist/metaplaylist_parser.js +13 -7
  166. package/dist/_esm5.processed/parsers/manifest/metaplaylist/representation_index.d.ts +12 -3
  167. package/dist/_esm5.processed/parsers/manifest/metaplaylist/representation_index.js +11 -2
  168. package/dist/_esm5.processed/parsers/manifest/smooth/create_parser.d.ts +0 -1
  169. package/dist/_esm5.processed/parsers/manifest/smooth/create_parser.js +27 -27
  170. package/dist/_esm5.processed/parsers/manifest/smooth/representation_index.d.ts +21 -83
  171. package/dist/_esm5.processed/parsers/manifest/smooth/representation_index.js +55 -127
  172. package/dist/_esm5.processed/parsers/manifest/smooth/shared_smooth_segment_timeline.d.ts +119 -0
  173. package/dist/_esm5.processed/parsers/manifest/smooth/shared_smooth_segment_timeline.js +159 -0
  174. package/dist/_esm5.processed/parsers/manifest/smooth/utils/add_segment_infos.d.ts +3 -6
  175. package/dist/_esm5.processed/parsers/manifest/smooth/utils/add_segment_infos.js +4 -4
  176. package/dist/_esm5.processed/parsers/manifest/types.d.ts +27 -3
  177. package/dist/_esm5.processed/public_types.d.ts +372 -347
  178. package/dist/_esm5.processed/transports/dash/add_segment_integrity_checks_to_loader.js +4 -4
  179. package/dist/_esm5.processed/{utils/list_to_map.d.ts → transports/dash/construct_segment_url.d.ts} +3 -7
  180. package/dist/_esm5.processed/transports/dash/construct_segment_url.js +21 -0
  181. package/dist/_esm5.processed/transports/dash/manifest_parser.js +2 -3
  182. package/dist/_esm5.processed/transports/dash/pipelines.js +1 -4
  183. package/dist/_esm5.processed/transports/dash/segment_loader.d.ts +2 -2
  184. package/dist/_esm5.processed/transports/dash/segment_loader.js +25 -20
  185. package/dist/_esm5.processed/transports/dash/segment_parser.js +19 -24
  186. package/dist/_esm5.processed/transports/dash/text_loader.js +8 -6
  187. package/dist/_esm5.processed/transports/dash/text_parser.js +31 -34
  188. package/dist/_esm5.processed/transports/local/pipelines.js +1 -10
  189. package/dist/_esm5.processed/transports/local/segment_loader.d.ts +3 -2
  190. package/dist/_esm5.processed/transports/local/segment_loader.js +4 -4
  191. package/dist/_esm5.processed/transports/local/segment_parser.d.ts +1 -1
  192. package/dist/_esm5.processed/transports/local/segment_parser.js +10 -10
  193. package/dist/_esm5.processed/transports/local/text_parser.d.ts +2 -2
  194. package/dist/_esm5.processed/transports/local/text_parser.js +23 -23
  195. package/dist/_esm5.processed/transports/metaplaylist/pipelines.js +34 -52
  196. package/dist/_esm5.processed/transports/smooth/is_mp4_embedded_track.d.ts +22 -0
  197. package/dist/_esm5.processed/{features/list/bif_parser.js → transports/smooth/is_mp4_embedded_track.js} +6 -7
  198. package/dist/_esm5.processed/transports/smooth/pipelines.js +35 -188
  199. package/dist/_esm5.processed/transports/smooth/segment_loader.d.ts +1 -1
  200. package/dist/_esm5.processed/transports/smooth/segment_loader.js +28 -22
  201. package/dist/_esm5.processed/transports/smooth/utils.d.ts +4 -27
  202. package/dist/_esm5.processed/transports/smooth/utils.js +7 -55
  203. package/dist/_esm5.processed/transports/types.d.ts +98 -91
  204. package/dist/_esm5.processed/transports/utils/call_custom_manifest_loader.js +3 -3
  205. package/dist/_esm5.processed/transports/utils/infer_segment_container.d.ts +3 -3
  206. package/dist/_esm5.processed/transports/utils/infer_segment_container.js +5 -7
  207. package/dist/_esm5.processed/transports/utils/parse_text_track.d.ts +8 -12
  208. package/dist/_esm5.processed/transports/utils/parse_text_track.js +19 -21
  209. package/dist/_esm5.processed/utils/event_emitter.d.ts +1 -2
  210. package/dist/_esm5.processed/utils/reference.d.ts +3 -3
  211. package/dist/_esm5.processed/utils/request/xhr.js +5 -5
  212. package/dist/_esm5.processed/utils/resolve_url.d.ts +7 -4
  213. package/dist/_esm5.processed/utils/resolve_url.js +11 -8
  214. package/dist/mpd-parser.wasm +0 -0
  215. package/dist/rx-player.js +7710 -9324
  216. package/dist/rx-player.min.js +1 -1
  217. package/locked_reps.js +46 -0
  218. package/package.json +1 -1
  219. package/sonar-project.properties +1 -1
  220. package/src/README.md +6 -5
  221. package/src/compat/__tests__/add_text_track.test.ts +4 -49
  222. package/src/compat/add_text_track.ts +3 -7
  223. package/src/compat/browser_compatibility_types.ts +0 -7
  224. package/src/compat/event_listeners.ts +0 -48
  225. package/src/compat/index.ts +0 -10
  226. package/src/config.ts +1 -0
  227. package/src/core/adaptive/adaptive_representation_selector.ts +10 -123
  228. package/src/core/adaptive/utils/__tests__/select_optimal_representation.test.ts +7 -183
  229. package/src/core/adaptive/utils/select_optimal_representation.ts +2 -13
  230. package/src/core/api/README.md +5 -5
  231. package/src/core/api/__tests__/option_utils.test.ts +59 -735
  232. package/src/core/api/__tests__/public_api.test.ts +15 -402
  233. package/src/core/api/__tests__/utils.test.ts +3 -3
  234. package/src/core/api/option_utils.ts +65 -307
  235. package/src/core/api/public_api.ts +612 -983
  236. package/src/core/api/track_management/README.md +15 -0
  237. package/src/core/api/{tracks_management/__tests__/media_element_track_choice_manager.test.ts → track_management/__tests__/media_element_tracks_store.test.ts} +8 -8
  238. package/src/core/{segment_buffers/implementations/image → api/track_management}/index.ts +4 -2
  239. package/src/core/api/{tracks_management/media_element_track_choice_manager.ts → track_management/media_element_tracks_store.ts} +66 -235
  240. package/src/core/api/track_management/track_dispatcher.ts +238 -0
  241. package/src/core/api/track_management/tracks_store.ts +1359 -0
  242. package/src/core/api/utils.ts +4 -2
  243. package/src/core/decrypt/__tests__/__global__/get_license.test.ts +2 -2
  244. package/src/core/decrypt/__tests__/__global__/media_key_system_access.test.ts +122 -63
  245. package/src/core/decrypt/__tests__/__global__/utils.ts +28 -0
  246. package/src/core/decrypt/content_decryptor.ts +8 -50
  247. package/src/core/decrypt/find_key_system.ts +81 -69
  248. package/src/core/decrypt/get_media_keys.ts +6 -5
  249. package/src/core/decrypt/session_events_listener.ts +34 -75
  250. package/src/core/decrypt/utils/check_key_statuses.ts +41 -85
  251. package/src/core/decrypt/utils/persistent_sessions_store.ts +12 -9
  252. package/src/core/fetchers/cdn_prioritizer.ts +198 -0
  253. package/src/core/fetchers/manifest/manifest_fetcher.ts +11 -41
  254. package/src/core/fetchers/segment/segment_fetcher.ts +30 -26
  255. package/src/core/fetchers/segment/segment_fetcher_creator.ts +13 -7
  256. package/src/core/fetchers/utils/schedule_request.ts +430 -0
  257. package/src/core/init/content_time_boundaries_observer.ts +12 -12
  258. package/src/core/init/events_generators.ts +0 -18
  259. package/src/core/init/initialize_media_source.ts +30 -14
  260. package/src/core/init/load_on_media_source.ts +11 -2
  261. package/src/core/init/manifest_update_scheduler.ts +1 -1
  262. package/src/core/init/types.ts +4 -22
  263. package/src/core/segment_buffers/README.md +18 -18
  264. package/src/core/segment_buffers/implementations/text/native/native_text_segment_buffer.ts +2 -7
  265. package/src/core/segment_buffers/implementations/types.ts +2 -3
  266. package/src/core/segment_buffers/index.ts +5 -0
  267. package/src/core/segment_buffers/inventory/index.ts +4 -0
  268. package/src/core/segment_buffers/inventory/utils.ts +61 -0
  269. package/src/core/segment_buffers/segment_buffers_store.ts +4 -18
  270. package/src/core/stream/adaptation/adaptation_stream.ts +244 -208
  271. package/src/core/stream/adaptation/get_representations_switch_strategy.ts +194 -0
  272. package/src/core/stream/events_generators.ts +13 -7
  273. package/src/core/stream/index.ts +0 -1
  274. package/src/core/stream/orchestrator/README.md +1 -4
  275. package/src/core/stream/orchestrator/active_period_emitter.ts +1 -2
  276. package/src/core/stream/orchestrator/{get_time_ranges_for_content.ts → get_blacklisted_ranges.ts} +1 -1
  277. package/src/core/stream/orchestrator/stream_orchestrator.ts +57 -116
  278. package/src/core/stream/period/get_adaptation_switch_strategy.ts +13 -58
  279. package/src/core/stream/period/period_stream.ts +18 -12
  280. package/src/core/stream/representation/representation_stream.ts +31 -24
  281. package/src/core/stream/types.ts +73 -29
  282. package/src/default_config.ts +64 -122
  283. package/src/errors/__tests__/is_known_error.test.ts +2 -6
  284. package/src/errors/__tests__/network_error.test.ts +5 -17
  285. package/src/errors/__tests__/request_error.test.ts +0 -14
  286. package/src/errors/custom_loader_error.ts +0 -4
  287. package/src/errors/encrypted_media_error.ts +1 -20
  288. package/src/errors/network_error.ts +0 -2
  289. package/src/errors/request_error.ts +2 -8
  290. package/src/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.ts +4 -3
  291. package/src/features/__tests__/initialize_features.test.ts +2 -20
  292. package/src/features/features_object.ts +0 -2
  293. package/src/features/initialize_features.ts +5 -14
  294. package/src/features/list/__tests__/directfile.test.ts +4 -4
  295. package/src/features/list/directfile.ts +2 -2
  296. package/src/features/list/index.ts +0 -2
  297. package/src/features/types.ts +4 -29
  298. package/src/index.ts +1 -4
  299. package/src/manifest/__tests__/adaptation.test.ts +10 -47
  300. package/src/manifest/__tests__/manifest.test.ts +14 -14
  301. package/src/manifest/__tests__/period.test.ts +19 -20
  302. package/src/manifest/adaptation.ts +14 -27
  303. package/src/manifest/index.ts +0 -10
  304. package/src/manifest/manifest.ts +10 -166
  305. package/src/manifest/period.ts +5 -5
  306. package/src/manifest/representation.ts +31 -7
  307. package/src/manifest/representation_index/__tests__/static.test.ts +1 -1
  308. package/src/manifest/representation_index/index.ts +0 -2
  309. package/src/manifest/representation_index/static.ts +11 -3
  310. package/src/manifest/representation_index/types.ts +82 -39
  311. package/src/manifest/types.ts +0 -3
  312. package/src/manifest/update_period_in_place.ts +1 -0
  313. package/src/parsers/manifest/dash/common/indexes/base.ts +51 -61
  314. package/src/parsers/manifest/dash/common/indexes/get_init_segment.ts +6 -4
  315. package/src/parsers/manifest/dash/common/indexes/get_segments_from_timeline.ts +5 -5
  316. package/src/parsers/manifest/dash/common/indexes/list.ts +28 -21
  317. package/src/parsers/manifest/dash/common/indexes/template.ts +37 -43
  318. package/src/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.ts +33 -23
  319. package/src/parsers/manifest/dash/common/indexes/tokens.ts +7 -18
  320. package/src/parsers/manifest/dash/common/infer_adaptation_type.ts +2 -8
  321. package/src/parsers/manifest/dash/common/parse_adaptation_sets.ts +6 -8
  322. package/src/parsers/manifest/dash/common/parse_mpd.ts +3 -8
  323. package/src/parsers/manifest/dash/common/parse_periods.ts +2 -3
  324. package/src/parsers/manifest/dash/common/parse_representation_index.ts +3 -12
  325. package/src/parsers/manifest/dash/common/parse_representations.ts +9 -0
  326. package/src/parsers/manifest/dash/common/resolve_base_urls.ts +5 -9
  327. package/src/parsers/manifest/dash/js-parser/__tests__/parse_from_document.test.ts +0 -2
  328. package/src/parsers/manifest/dash/js-parser/node_parsers/AdaptationSet.ts +11 -5
  329. package/src/parsers/manifest/dash/js-parser/node_parsers/BaseURL.ts +2 -29
  330. package/src/parsers/manifest/dash/js-parser/node_parsers/Representation.ts +4 -1
  331. package/src/parsers/manifest/dash/js-parser/node_parsers/__tests__/AdaptationSet.test.ts +188 -26
  332. package/src/parsers/manifest/dash/js-parser/node_parsers/utils.ts +22 -2
  333. package/src/parsers/manifest/dash/node_parser_types.ts +4 -11
  334. package/src/parsers/manifest/dash/wasm-parser/rs/events.rs +14 -2
  335. package/src/parsers/manifest/dash/wasm-parser/rs/processor/attributes.rs +5 -12
  336. package/src/parsers/manifest/dash/wasm-parser/rs/utils.rs +49 -0
  337. package/src/parsers/manifest/dash/wasm-parser/ts/generators/AdaptationSet.ts +3 -6
  338. package/src/parsers/manifest/dash/wasm-parser/ts/generators/BaseURL.ts +0 -13
  339. package/src/parsers/manifest/dash/wasm-parser/ts/generators/Representation.ts +1 -2
  340. package/src/parsers/manifest/dash/wasm-parser/ts/types.ts +8 -0
  341. package/src/parsers/manifest/local/parse_local_manifest.ts +1 -0
  342. package/src/parsers/manifest/local/representation_index.ts +10 -2
  343. package/src/parsers/manifest/metaplaylist/metaplaylist_parser.ts +15 -9
  344. package/src/parsers/manifest/metaplaylist/representation_index.ts +26 -5
  345. package/src/parsers/manifest/smooth/create_parser.ts +33 -39
  346. package/src/parsers/manifest/smooth/representation_index.ts +80 -222
  347. package/src/parsers/manifest/smooth/shared_smooth_segment_timeline.ts +241 -0
  348. package/src/parsers/manifest/smooth/utils/add_segment_infos.ts +7 -9
  349. package/src/parsers/manifest/types.ts +29 -5
  350. package/src/parsers/manifest/utils/__tests__/get_first_time_from_adaptations.test.ts +17 -0
  351. package/src/parsers/manifest/utils/__tests__/get_last_time_from_adaptation.test.ts +17 -0
  352. package/src/public_types.ts +451 -395
  353. package/src/transports/dash/add_segment_integrity_checks_to_loader.ts +4 -5
  354. package/src/{features/list/image_buffer.ts → transports/dash/construct_segment_url.ts} +10 -11
  355. package/src/transports/dash/manifest_parser.ts +2 -5
  356. package/src/transports/dash/pipelines.ts +1 -7
  357. package/src/transports/dash/segment_loader.ts +29 -24
  358. package/src/transports/dash/segment_parser.ts +21 -27
  359. package/src/transports/dash/text_loader.ts +10 -7
  360. package/src/transports/dash/text_parser.ts +31 -35
  361. package/src/transports/local/pipelines.ts +1 -11
  362. package/src/transports/local/segment_loader.ts +3 -4
  363. package/src/transports/local/segment_parser.ts +11 -10
  364. package/src/transports/local/text_parser.ts +23 -23
  365. package/src/transports/metaplaylist/pipelines.ts +62 -92
  366. package/{dist/_esm5.processed/utils/list_to_map.js → src/transports/smooth/is_mp4_embedded_track.ts} +7 -10
  367. package/src/transports/smooth/pipelines.ts +42 -195
  368. package/src/transports/smooth/segment_loader.ts +30 -27
  369. package/src/transports/smooth/utils.ts +13 -62
  370. package/src/transports/types.ts +103 -111
  371. package/src/transports/utils/__tests__/infer_segment_container.test.ts +25 -172
  372. package/src/transports/utils/call_custom_manifest_loader.ts +3 -5
  373. package/src/transports/utils/infer_segment_container.ts +7 -13
  374. package/src/transports/utils/parse_text_track.ts +25 -31
  375. package/src/typings/globals.d.ts +0 -2
  376. package/src/utils/__tests__/event_emitter.test.ts +72 -67
  377. package/src/utils/__tests__/initialization_segment_cache.test.ts +7 -7
  378. package/src/utils/__tests__/resolve_url.test.ts +27 -23
  379. package/src/utils/event_emitter.ts +1 -3
  380. package/src/utils/reference.ts +3 -3
  381. package/src/utils/request/xhr.ts +5 -5
  382. package/src/utils/resolve_url.ts +11 -8
  383. package/dist/_esm5.processed/compat/fullscreen.d.ts +0 -32
  384. package/dist/_esm5.processed/compat/fullscreen.js +0 -78
  385. package/dist/_esm5.processed/compat/is_offline.d.ts +0 -39
  386. package/dist/_esm5.processed/compat/is_offline.js +0 -43
  387. package/dist/_esm5.processed/core/api/tracks_management/track_choice_manager.d.ts +0 -263
  388. package/dist/_esm5.processed/core/api/tracks_management/track_choice_manager.js +0 -1056
  389. package/dist/_esm5.processed/core/fetchers/utils/try_urls_with_backoff.d.ts +0 -85
  390. package/dist/_esm5.processed/core/fetchers/utils/try_urls_with_backoff.js +0 -264
  391. package/dist/_esm5.processed/core/segment_buffers/implementations/image/image_segment_buffer.d.ts +0 -67
  392. package/dist/_esm5.processed/core/segment_buffers/implementations/image/image_segment_buffer.js +0 -121
  393. package/dist/_esm5.processed/core/stream/adaptation/create_representation_estimator.d.ts +0 -47
  394. package/dist/_esm5.processed/core/stream/adaptation/create_representation_estimator.js +0 -71
  395. package/dist/_esm5.processed/features/list/bif_parser.d.ts +0 -23
  396. package/dist/_esm5.processed/features/list/image_buffer.d.ts +0 -23
  397. package/dist/_esm5.processed/features/list/image_buffer.js +0 -25
  398. package/dist/_esm5.processed/transports/dash/image_pipelines.d.ts +0 -37
  399. package/dist/_esm5.processed/transports/dash/image_pipelines.js +0 -127
  400. package/dist/_esm5.processed/utils/simple_set.d.ts +0 -51
  401. package/dist/_esm5.processed/utils/simple_set.js +0 -57
  402. package/dist/_esm5.processed/utils/uniq.d.ts +0 -36
  403. package/dist/_esm5.processed/utils/uniq.js +0 -43
  404. package/dummy +0 -1
  405. package/scripts/report_build_sizes +0 -92
  406. package/src/compat/__tests__/fullscreen.test.ts +0 -286
  407. package/src/compat/__tests__/is_offline.test.ts +0 -65
  408. package/src/compat/fullscreen.ts +0 -87
  409. package/src/compat/is_offline.ts +0 -44
  410. package/src/core/api/tracks_management/track_choice_manager.ts +0 -1354
  411. package/src/core/fetchers/utils/try_urls_with_backoff.ts +0 -287
  412. package/src/core/segment_buffers/implementations/image/image_segment_buffer.ts +0 -136
  413. package/src/core/stream/adaptation/create_representation_estimator.ts +0 -112
  414. package/src/features/list/__tests__/bif_parser.test.ts +0 -36
  415. package/src/features/list/__tests__/image_buffer.test.ts +0 -35
  416. package/src/features/list/bif_parser.ts +0 -29
  417. package/src/transports/dash/image_pipelines.ts +0 -120
  418. package/src/utils/__tests__/list_to_map.test.ts +0 -46
  419. package/src/utils/__tests__/simple_set.test.ts +0 -57
  420. package/src/utils/__tests__/uniq.test.ts +0 -134
  421. package/src/utils/list_to_map.ts +0 -32
  422. package/src/utils/simple_set.ts +0 -67
  423. package/src/utils/uniq.ts +0 -49
package/CHANGELOG.md CHANGED
@@ -1,28 +1,95 @@
1
1
  # Changelog
2
2
 
3
- ## v3.29.0-dev.2022091600 (2022-09-16)
3
+ ## v4.0.0-alpha.2022100600 (2022-10-06)
4
4
 
5
- ### Features
6
-
7
- - add `networkConfig.segmentRequestTimeout` and `networkConfig.manifestRequestTimeout` options to loadVideo to configure the timeout of respectively segment and manifest requests [#1156]
8
- - add `timeout` property to the first argument communicated to a `segmentLoader` (from `loadVideo`'s `transportOptions`) [#1156]
9
- - add `timeout` property to a new third argument communicated to a `manifestLoader` (from `loadVideo`'s `transportOptions`) [#1156]
10
- - add `keySystems[].onKeyExpiration` to `loadVideo` options to configure the behavior the RxPlayer should have on key expiration [#1157]
11
- - add `keyStatuses` property to an `EncryptedMediaError` with the `KEY_STATUS_CHANGE_ERROR` code to communicate which key id and key statuses caused issues. [#1157]
12
-
13
- ### Bug fixes
5
+ ### Changed
14
6
 
15
- - Compat/Directfile: Fix an issue with LG TV when playing multiple directfile contents with the `stopAtEnd` player option set to `true` [#1154]
16
- - Compat: To work around an issue on LG TVs, also specify a request timeout manually through a `setTimeout` call when XMLHttpRequests are created for Manifest and segment requests [#1152]
17
- - Compat: Fix issue with Samsung TVs where starting playback on a discontinuity could lead to infinite rebuffering [#1140]
18
- - Compat: For `"directfile"` contents, also consider `AudioTrack` with a `description` (without an "s") as audio-description audio tracks to work-around what seems to be a Safari typo [#1160]
19
- - Better handle valid reverse playback use cases by not skipping gaps when the playback rate has been set to `0` or a negative value [#1138]
20
- - DRM: When using persistent licenses, create new MediaKeySession when `load` resolves with `false`, instead of relying the same, to fix issues with such persistent sessions [#1139]
7
+ - 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]
8
+ - The `RELOADING` player state (gettable through the `getPlayerState` and `playerStateChange` API) can now happen at any time to unlock playback.
9
+ - Remove bitrate API: `getAvailableVideoBitrates`, `getAvailableAudioBitrates`, `setAudioBitrate`, `setVideoBitrate`, `getAudioBitrate`, `getVideoBitrate` in profit of the Representations lock APIs [#1144]
10
+ - Remove track preferences API (methods: `getPreferredAudioTracks`, `getPreferredVideoTracks`, `setPreferredAudioTracks` and `setPreferredVideoTracks`, types: `IAudioTrackPreference`, `ITextTrackPreference` and `IVideoTrackPreference`) in profit of the new tracks API
11
+ - Remove `getManualVideoBitrate` and `getManualAudioBitrate` in profit of the new Representations lock APIs
12
+ - 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]
13
+ - Rename `audioTrackSwitchingMode` loadVideo option into `defaultAudioTrackSwitchingMode` [#1030]
14
+ - Remove `manualBitrateSwitchingMode` loadVideo option to instead rely on the `switchingMode` property of each `lockVideoRepresentations` and `lockAudioRepresentations` calls. [#1030]
15
+ - Remove `audioBitrateChange` and `videoBitrateChange` API in profit of the new `audioRepresentationChange` and `videoRepresentationChange` events
16
+ - 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
17
+ - "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]
18
+ - Rename `networkConfig` into `requestConfig` and re-organize its inner properties to pave the way for future request-related APIs.
19
+ - 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.
20
+ - Remove `decipherabilityUpdate` event as it appeared to be not easily exploitable and exposed internal logic too much [#1168]
21
+ - Remove `getUrl` method in profit of the more powerful `getContentUrls`
22
+ - Remove methods: `getManifest`, `getCurrentAdaptations` and `getCurrentRepresentations`, as they reveal the RxPlayer's internals too much
23
+ - 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).
24
+ - Remove the `supplementaryTextTracks` loadVideo option. You can use the `TextTrackRenderer` tool if you wish to diplay external subtitles on top of your content.
25
+ - Rename `maximumBufferTime` in `positionUpdate` events to `maximumPosition`
26
+ - Remove `getVideoPlayedTime` and `getVideoLoadedTime` methods. Their names was very confusing and can be re-implemented relatively easily using the media element's buffered property.
27
+ - Rename `getVideoDuration` to `getMediaDuration`, to avoid confusion with the video track's duration.
28
+ - Rename `getVideoBufferGap` to `getCurrentBufferGap, to avoid confusion with the "buffer gap" specific to the video track.
29
+ - Remove image-related API: `supplementaryImageTracks` `loadVideo` option, `imageTrackUpdate` event, `getImageTrackData` method. Those are better handled by an application. The `parseBifThumbnails` tool is still available.
30
+ - 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]
31
+ - Remove `persistentStateRequired` API, in profit of the more powerful `persistentState` API [#1148]
32
+ - Remove `distinctiveIdentifierRequired` API, in profit of the more powerful `distinctiveIdentifier` API [#1148]
33
+ - Remove `keySystems[].onKeyStatusesChange` API as it seems to never be used [#1148]
34
+ - Remove `aggressiveMode` from the `transportOptions` `loadVideo` option
35
+ - Remove deprecated `throttleWhenHidden` player option in profit of `throttleVideoBitrateWhenHidden`
36
+ - Change payload of `periodChange` events, so they emit only core properties related to a `Period`.
37
+ - 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]
38
+ - 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]
39
+ - A Representation's `frameRate` is now always a number - in terms of frame per seconds - instead of a string.
40
+ - `Representations` (in methods: `getAvailableVideoTracks`, `getVideoTrack`, `representationFilter`, `getAvailableAudioTracks`, `getAudioTrack` and events: `audioTrackChange` and `videoTrackChange`) can have an `undefined` bitrate
41
+ - 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
42
+ - Remove deprecated `getNativeTextTrack` method. If advanced features are wanted, it's better to just use the HTML text track API
43
+ - Remove deprecated `nativeTextTracksChange` event. Same reason than for `getNativeTextTrack`
44
+ - Remove deprecated `hideNativeSubtitles` from `loadVideo` options. Same reason than for `getNativeTextTrack`
45
+ - Remove `xhr` property from a `NetworkError`. Doing so stop us from using the fetch API
46
+ - Remove deprecated `defaultAudioTrack` and `defaultTextTrack`in profit of new track APIs
47
+ - 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.
48
+ - Remove the notion of environment variables linked to personalized builds (e.g. RXP_DASH) in profit of the minimal RxPlayer.
49
+ - Rename `IPersistentSessionStorage` type to `IPersistentLicenseConfig` [#1147]
50
+ - Remove undocumented `audioRobustnesses` and `videoRobustnesses` properties of the `keySystems` option of `loadVideo` calls, as more powerful solutions now exist: respectively `audioCapabilitiesConfig` and `videoCapabilitiesConfig` [#1148]
51
+ - Remove public types `ISupplementaryTextTrackOption` and `ISupplementaryImageTrackOption`. Those are the types respectively for `supplementaryTextTracks` and `supplementaryImageTracks` which have been removed
52
+ - Remove public types `IBitrateEstimate` as no API depend on it anymore.
53
+ - Remove public types `IManifest`, `IPeriod`, `IAdaptation`, `IRepresentation`, `IRepresentationInfos`, `IBifThumbnail`, `IBifObject` and `IExposedSegment` as no API depend on them anymore.
54
+ - Remove public types `IDefaultAudioTrackOption` and `IDefaultTextTrackOption`. Those are the types respectively for `defaultAudioTrack` and `defaultTextTrack` `loadVideo` options which have been removed
21
55
 
22
- ### Other improvements
56
+ ### Features
23
57
 
24
- - In the experimental "local" transport, add `incomingRanges` property to signal the time ranges of remaining data, allowing better discontinuity handling and duration estimates for sill-loading dowloaded contents [#1151]
25
- - Only send through `"warning"` events, just one `EncryptedMediaError` with a `KEY_STATUS_CHANGE_ERROR` code when multiple ones arises at the same time [#1157]
58
+ - `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
59
+ - Add `switchingMode` optional property to `setVideoTrack` and `setAudioTrack`, to configure the way in which the RxPlayer switches between the previous and new track
60
+ - Add optional `periodId` property to `setAudioTrack`, `setVideoTrack` and `setTextTrack`, to allow setting the track of another, future or past, Period.
61
+ - `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.
62
+ - `disableTextTrack`, and`disableVideoTrack` can now optionally take a `periodId` argument to disable a track for a specific Period
63
+ - Add optional `lockedRepresentations` property to `setAudioTrack` and `setVideoTrack`, to only filter some allowed Representations (i.e. qualities) after switching to the wanted track.
64
+ - Add `getCurrentPeriod` method to retrieve information on the Period currently played
65
+ - Add `getAvailablePeriods` method to retrieve information on all Periods on which a track or Representation choice can be made
66
+ - Add `lockVideoRepresentations`, `lockAudioRepresentations`, `getLockedVideoRepresentations`, `getLockedAudioRepresentations`, `unlockVideoRepresentations` and `unlockAudioRepresentations` methods to allow a complex selection of Representations that are currently allowed to play.
67
+ - Add `getVideoRepresentation` and `getAudioRepresentation` method to retrieve information on the currently loaded representations [#1144]
68
+ - Add `audioRepresentationChange` and `videoRepresentationChange` events to be notified when the currently-loaded Representation for the current Period changes.
69
+ - Add `getContentUrls` allowing to retrieve the one or several known URLs through which the current Manifest or content is reachable.
70
+ - Add `newAvailablePeriods` event to signal new Period on which a track and/or Representation choice can be made
71
+ - Add `brokenRepresentationsLock` event for when a Representations lock could not be respected anymore
72
+ - Add `autoTrackSwitch` event for when a chosen track could not be kept by the RxPlayer
73
+ - 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]
74
+ - 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]
75
+ - 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]
76
+ - Add `ISegmentLoaderContext` public type for the first argument of the `segmentLoader` API
77
+ - Add `IRepresentationFilterRepresentation` public type for the first argument of the `representationFilter` API
78
+ - Add `IRepresentationContext` public type for the second argument of the `representationFilter` API
79
+ - Add `IManifestLoaderInfo` public type for the first argument of the `manifestLoader` API
80
+ - Add `IDecipherabilityUpdatePeriodInfo` public type to define the `periodInfo` property of a `decipherabilityUpdate` event
81
+ - Add `IPeriodChangeEvent` public type to define the properties send through a `periodChange` event
82
+ - Add `IPeriod` public type to define a Period object returned by methods like `getAvailablePeriods` or `getCurrentPeriod`
83
+ - Add `IVideoTrackSwitchingMode` public type to define the type of the `switchingMode` property optionally given to `setAudioTrack`
84
+ - Add `IAudioRepresentationsSwitchingMode` public type to define the type of the `switchingMode` property optionally given to `lockAudioRepresentations`
85
+ - Add `IVideoRepresentationsSwitchingMode` public type to define the type of the `switchingMode` property optionally given to `lockAudioRepresentations`
86
+ - Add `IBrokenRepresentationsLockContext` public type to define the type sent as a payload of the `brokenRepresentationsLock` event
87
+ - Add `IAutoTrackSwitchEventPayload` public type to define the type sent as a payload of the `autoTrackSwitch` event
88
+ - Add `ILockedVideoRepresentationsSettings` public type to define the object that should be given to the new `lockVideoRepresentation` method
89
+ - Add `ILockedAudioRepresentationsSettings` public type to define the object that should be given to the new `lockAudioRepresentation` method
90
+ - Add `IAudioTrackSetting` public type to define the object that may be given to the `setAudioTrack` method
91
+ - Add `IVideoTrackSetting` public type to define the object that may be given to the `setVideoTrack` method
92
+ - Add `ITextTrackSetting` public type to define the object that may be given to the `setTextTrack` method
26
93
 
27
94
  ## v3.28.0 (2022-07-12)
28
95
 
package/FILES.md CHANGED
@@ -167,7 +167,6 @@ What is exported there are functions to load:
167
167
  - Manifests/MPDs
168
168
  - video/audio segments
169
169
  - subtitles tracks
170
- - image tracks
171
170
 
172
171
  For different streaming technologies.
173
172
 
package/MAINTAINERS.md CHANGED
@@ -16,7 +16,6 @@ RxPlayer-related question or to propose new features.
16
16
  Here is the list of current maintainers:
17
17
 
18
18
  - Paul Berberian <paul.berberian@canal-plus.com>
19
- - Paul Rosset <paul.rosset@canal-plus.com>
20
19
 
21
20
 
22
21
  ## Previous maintainers ########################################################
@@ -24,8 +23,10 @@ Here is the list of current maintainers:
24
23
  Here is the list of previous maintainers, which are not working on the project
25
24
  anymore:
26
25
 
26
+ - Achraf Laamoum <achraf.laamoum@canal-plus.com>
27
27
  - Alexandre Duros <alexandre.duros@canal-plus.com>
28
28
  - Antoine Maillard <antoine.maillard@canal-plus.com>
29
29
  - Guillaume Bentaieb <guillaume.bentaieb@canal-plus.com>
30
30
  - Guillaume Renault <guillaume.renault@canal-plus.com>
31
+ - Paul Rosset <paul.rosset@canal-plus.com>
31
32
  - Pierre Guilleminot <pierre.guilleminot@canal-plus.com>
package/VERSION CHANGED
@@ -1 +1 @@
1
- 3.29.0-dev.2022091600
1
+ 4.0.0-alpha.2022100600
package/a.js ADDED
@@ -0,0 +1,373 @@
1
+ // Cas les plus fréquents
2
+
3
+ // Seulement mettre la piste courante en français
4
+ // ----------------------------------------------
5
+ //
6
+ // Rien ne change:
7
+
8
+ const choosenTrack = player.getAvailableAudioTracks()
9
+ .find((t) => t.normalized === "fra" && t.audioDescription !== true);
10
+ if (choosenTrack !== undefined) {
11
+ player.setAudioTrack(choosenTrack.id);
12
+ }
13
+
14
+ // Mettre la piste francaise pour toutes les Periods
15
+ // -------------------------------------------------
16
+ //
17
+ // Brancher l'event `"newAvailablePeriods"` pour les futures Periods anoncées
18
+ // après mise à jour du Manifest et au changement de contenu et appeller
19
+ // `setAudioTrack` pour toutes les Periods:
20
+
21
+ player.addEventListener("newAvailablePeriods", (periods) => {
22
+ periods.forEach(setFrenchTrackForPeriod);
23
+ });
24
+ player.getAvailablePeriods()
25
+ .forEach(setFrenchTrackForPeriod);
26
+
27
+ function setFrenchTrackForPeriod(periodInfo) {
28
+ const chosenTrack = player.getAvailableAudioTracks(periodInfo.id)
29
+ .find((t) => t.normalized === "fra" && t.audioDescription !== true);
30
+ if (choosenTrack !== undefined) {
31
+ player.setAudioTrack( { periodId: periodInfo.id,
32
+ trackId: chosenTrack.id });
33
+ }
34
+ }
35
+
36
+ // Plus général: changer la piste pour toutes les Periods
37
+ // ------------------------------------------------------
38
+ //
39
+ // Pareil, juste ajoutons un store simplifié:
40
+
41
+ const SomeStore = {
42
+ language: "eng",
43
+ isAudioDescription: false,
44
+ };
45
+
46
+ player.addEventListener("newAvailablePeriods", (periods) => {
47
+ periods.forEach(setAudioTrackForPeriod);
48
+ });
49
+
50
+ function updateAllAudioTracks(newLanguage, newAudioDescriptionStatus) {
51
+ SomeStore.language = newLanguage;
52
+ SomeStore.isAudioDescription = newAudioDescriptionStatus;
53
+ player.getAvailablePeriods().forEach(setAudioTrackForPeriod);
54
+ }
55
+
56
+ function setAudioTrackForPeriod(periodInfo) {
57
+ const { language, isAudioDescription } = SomeStore;
58
+ const choosenTrack = player.getAvailableAudioTracks(periodInfo.id)
59
+ .find((t) =>
60
+ t.normalized === language &&
61
+ isAudioDescription ? t.audioDescription === true :
62
+ t.audioDescription !== true);
63
+ if (choosenTrack !== undefined) {
64
+ player.setAudioTrack({
65
+ trackId: choosenTrack.id,
66
+ lockedRepresentations: [chosenTrack.representations[0].id]
67
+ }, periodInfo.id);
68
+ }
69
+ }
70
+
71
+
72
+ // Simplifier et optimiser ce cas fréquent pour le futur ?
73
+ // -------------------------------------------------------
74
+ //
75
+ // Proposition d'un "defaultAudioTrackSelector" configurable pour définir la piste par
76
+ // défaut:
77
+
78
+ const SomeStore = {
79
+ language: "eng",
80
+ isAudioDescription: false,
81
+ };
82
+
83
+ function updateAllAudioTracks(newLanguage, newAudioDescriptionStatus) {
84
+ SomeStore.language = newLanguage;
85
+ SomeStore.isAudioDescription = newAudioDescriptionStatus;
86
+ player.setDefaultAudioTrackSelector(setAudioTrackForPeriod);
87
+ }
88
+
89
+ function setAudioTrackForPeriod(audioTracks, _periodInfo) {
90
+ const { language, isAudioDescription } = SomeStore;
91
+ const choosenTrack = audioTracks.find((t) =>
92
+ t.normalized === language &&
93
+ isAudioDescription ? t.audioDescription === true :
94
+ t.audioDescription !== true);
95
+ if (choosenTrack === undefined) {
96
+ // preference not found, let the RxPlayer choose for us
97
+ return undefined;
98
+ }
99
+ // preference found: select it
100
+ return choosenTrack.id;
101
+ }
102
+
103
+ // => reset pour la Period courante ? second argument booléen
104
+ // => persisté au changement de contenu ? oui
105
+ // => autoriser un setAudioTrack pendant qu'un defaultAudioTrackSelector est actif ? oui
106
+
107
+ player.hasDefaultAudioTrackSelector();
108
+ player.removeDefaultAudioTrackSelector();
109
+
110
+
111
+ // All APIs:
112
+
113
+ player.getAvailableAudioTracks();
114
+ player.getAvailableVideoTracks();
115
+ player.getAvailableTextTracks();
116
+ player.getAudioTrack();
117
+ player.getVideoTrack();
118
+ player.getTextTrack();
119
+ player.setAudioTrack();
120
+ player.setVideoTrack();
121
+ player.setTextTrack();
122
+
123
+ player.setDefaultAudioTrackSelector();
124
+ player.setDefaultVideoTrackSelector();
125
+ player.setDefaultTextTrackSelector();
126
+ player.removeDefaultAudioTrackSelector();
127
+ player.removeDefaultVideoTrackSelector();
128
+ player.removeDefaultTextTrackSelector();
129
+ player.hasDefaultAudioTrackSelector();
130
+ player.hasDefaultVideoTrackSelector();
131
+ player.hasDefaultTextTrackSelector();
132
+
133
+
134
+ // ```
135
+ // # Representation (quality) selection
136
+ //
137
+ // ## lockVideoRepresentations / lockAudioRepresentations
138
+
139
+
140
+ player.setMaxVideoBitrate(1000);
141
+
142
+ // For all future Periods and contents
143
+ player.addEventListener("newAvailablePeriods", (periods) => {
144
+ periods.forEach((p) => limitVideoBitrate(p, 1000));
145
+ });
146
+
147
+ // If currently playing, for all Periods in the current content
148
+ player.getAvailablePeriods()
149
+ .forEach((p) => limitVideoBitrate(p, 1000));
150
+
151
+ // At each track change
152
+ player.setAudioTrack({
153
+ trackId,
154
+ periodId,
155
+ lockedRepresentations: getLimited(p, 1000),
156
+ });
157
+
158
+
159
+ // Automatically filter which Representation will be played by default
160
+ player.setAutoVideoRepresentationsLocker((videoTrack, _periodInfo) => {
161
+ const filtered = videoTrack.representations
162
+ .filter(rep => rep.bitrate !== undefined && rep.bitrate <= 1000)
163
+ .map(rep => rep.id);
164
+
165
+ if (filtered.length === 0) {
166
+ if (videoTrack.representations.length === 0) {
167
+ return;
168
+ }
169
+ const minBitrate = videoTrack.representations.sort((a, b) => {
170
+
171
+ });
172
+ }
173
+ }, true);
174
+
175
+ player.setDefaultVideoTrackSelector((videoTracks, _periodInfo) => {
176
+ const activeVideoTrack = videoTracks.find(v => v.active) ?? videoTracks[0];
177
+ const filtered = activeVideoTrack.representations
178
+ .filter(rep => rep.bitrate !== undefined && rep.bitrate <= 1000)
179
+ .map(rep => rep.id);
180
+
181
+ if (filtered.length === 0) {
182
+ if (activeVideoTrack.representations.length === 0) {
183
+ return;
184
+ }
185
+ const minBitrate = activeVideoTrack.representations.sort((a, b) => {
186
+
187
+ });
188
+ }
189
+ }, true);
190
+
191
+ // Powerful enough to remove the need of track preference APIs, bitrate APIs and the
192
+ // representationFilter API which all have their issues (mostly, they are not flexible enough and had
193
+ // some complex behavior when diving into the details).
194
+ //
195
+ // However simple use cases that were previously easy to configure through those APIs are much harder
196
+ // with thhe new.
197
+
198
+
199
+ // representationFilter
200
+ //
201
+ // If this function was used to filter out some audio and/or video
202
+ // Representation (which is all cases we've seen), its behavior can be
203
+ // reproduced by using the new Representations "locking" feature, which allows
204
+ // to only allow some Representations from being played (see
205
+ // `lockVideoRepresentations` / `lockAudioRepresentations`).
206
+ //
207
+ // The new Representations locking feature is also more powerful, allowing to
208
+ // inspect all other Representations from the corresponding track - or even all
209
+ // other tracks while the filter function is called.
210
+ //
211
+ // The easiest way of replacing `representationFilter` could be by locking
212
+ // wanted Representations through a "default video/audio track selector" before
213
+ // calling `loadVideo`.
214
+ // This can be donethrough the `setDefaultVideoTrackSelector` and/or the
215
+ // `setDefaultAudioTrackSelector` method, depending on if you want to limit the
216
+ // video Representations or the audio Representations. The following examples
217
+ // are going to show how this can be done for video tracks, but it can also be
218
+ // applied on audio tracks with the corresponding alternative methods.
219
+
220
+ // Only authorize some video Representations from being played on the default
221
+ // video tracks chosen by the RxPlayer:
222
+ player.setDefaultVideoTrackSelector((videoTracks, periodInfo) => {
223
+ // Note: The `videoTracks` array begins by the default video track
224
+ const filtered = videoTracks[0].representations.filter(representationFilter);
225
+ return {
226
+ periodId: periodInfo.id,
227
+ lockedRepresentations: filtered,
228
+ trackId: videoTracks[0].id,
229
+ };
230
+ });
231
+
232
+ // Note that this filter is persisted even through the next contents you will
233
+ // play. If you want to remove it, you can call the
234
+ // `removeDefaultVideoTrackSelector` method:
235
+ player.removeDefaultVideoTrackSelector();
236
+
237
+ // If switching the video track is possible in your application, don't forget to
238
+ // also apply the filter there:
239
+ function changeVideoTrack(periodId, videoTrack) {
240
+ const filtered = videoTrack.representations.filter(representationFilter);
241
+ player.setVideoTrack({
242
+ periodId,
243
+ lockedRepresentations: filtered,
244
+ trackId: videoTrack.id,
245
+ });
246
+ }
247
+
248
+ // And that's all! You should now always be filtering out video Representations
249
+ // for all video tracks chosen.
250
+
251
+ // Note that if you display Representations choice to the user in some ways, you
252
+ // might also want to remove the choice from that list:
253
+ function getAvailableVideoRepresentations() {
254
+ player.getVideoTrack()
255
+ if (videoTrack === null) {
256
+ return []; //"No video track currently");
257
+ }
258
+ return videoTrack.representations.filter(representationFilter);
259
+ }
260
+
261
+ // update the documentation:
262
+ // - setAudioTrack
263
+ // - setTextTrack
264
+ // - setVideoTrack
265
+ //
266
+ // Add the documentation:
267
+ // - getAvailablePeriods method
268
+ //
269
+ // Write tests
270
+ //
271
+ // representationChange event?
272
+
273
+ // /!\ ChromeCast etc.
274
+ // singleLicensePer: "periods"
275
+
276
+ // test Samsung
277
+
278
+
279
+ // Example: Know when the video Representations lock is enabled / disabled for
280
+ // the Period currently being played
281
+
282
+ let areVideoRepresentationsLocked = false;
283
+
284
+ function updateAreVideoRepresentationsLocked() {
285
+ areVideoRepresentationsLocked =
286
+ rxPlayer.getLockedVideoRepresentations() !== null;
287
+ }
288
+
289
+ // Update it each time the video lock for the current Period is "broken"
290
+ rxPlayer.addEventListener("brokenRepresentationsLock", (info) => {
291
+ const currentPeriod = rxPlayer.getCurrentPeriod();
292
+ if (
293
+ info.trackType === "video" &&
294
+ currentPeriod !== null && info.period.id === currentPeriod.id
295
+ ) {
296
+ updateAreVideoRepresentationsLocked();
297
+ }
298
+ });
299
+
300
+ // Update it each time the video track for the current Period changes, whether
301
+ // it was done explicitely (through setVideoTrack/disableVideoTrack),
302
+ // implicitely (the RxPlayer automatically switched by itself) or just because
303
+ // a new Period is now being played.
304
+ rxPlayer.addEventListener("videoTrackChange", () => {
305
+ updateAreVideoRepresentationsLocked();
306
+ });
307
+
308
+ // And update it each time the lock API are called for the current Period
309
+ function lockVideoRepresentations(reps) {
310
+ rxPlayer.lockVideoRepresentations(reps);
311
+ updateAreVideoRepresentationsLocked();
312
+ }
313
+ function unlockVideoRepresentations() {
314
+ rxPlayer.unlockVideoRepresentations();
315
+ updateAreVideoRepresentationsLocked();
316
+ }
317
+
318
+
319
+ // Example: Know when the video Representations lock is enabled / disabled for
320
+ // any Period
321
+
322
+ // First let's consider a given period `id` named `PERIOD_ID`
323
+ const PERIOD_ID = "<SOME_PERIOD_ID>";
324
+
325
+ let areVideoRepresentationsLockedForPeriod = false;
326
+
327
+ function updateAreVideoRepresentationsLocked() {
328
+ areVideoRepresentationsLockedForPeriod =
329
+ rxPlayer.getLockedVideoRepresentations(PERIOD_ID) !== null;
330
+ }
331
+
332
+ // Update it each time the video lock for the corresponding Period is "broken"
333
+ rxPlayer.addEventListener("brokenRepresentationsLock", (info) => {
334
+ if (info.trackType === "video" && info.period.id === PERIOD_ID) {
335
+ updateAreVideoRepresentationsLocked();
336
+ }
337
+ });
338
+
339
+ // Update it each time the video track is voluntarly changed/disabled for that Period
340
+ function setVideoTrackForPeriod(periodId, trackId) {
341
+ rxPlayer.setVideoTrack({ periodId, trackId });
342
+ if (periodId === PERIOD_ID) {
343
+ updateAreVideoRepresentationsLocked();
344
+ }
345
+ }
346
+ function disableVideoTrackForPeriod() {
347
+ rxPlayer.setVideoTrack({ periodId, trackId });
348
+ if (periodId === PERIOD_ID) {
349
+ updateAreVideoRepresentationsLocked();
350
+ }
351
+ }
352
+
353
+ // Update it each time, the RxPlayer decides to automatically change the video
354
+ // track for that Period (extremely rare)
355
+ rxPlayer.addEventListener("autoTrackSwitch", (info) => {
356
+ if (info.trackType === "video" && info.period.id === PERIOD_ID) {
357
+ updateAreVideoRepresentationsLocked();
358
+ }
359
+ });
360
+
361
+ // And update it each time the lock API are called for that Period
362
+ function lockVideoRepresentations(periodId, representations) {
363
+ rxPlayer.lockVideoRepresentations({ periodId, representations });
364
+ if (periodId === PERIOD_ID) {
365
+ updateAreVideoRepresentationsLocked();
366
+ }
367
+ }
368
+ function unlockVideoRepresentations(periodId) {
369
+ rxPlayer.unlockVideoRepresentations(periodId);
370
+ if (periodId === PERIOD_ID) {
371
+ updateAreVideoRepresentationsLocked();
372
+ }
373
+ }
@@ -23,11 +23,9 @@ 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.
28
26
  * @returns {Object}
29
27
  */
30
- export default function addTextTrack(mediaElement: HTMLMediaElement, hidden: boolean): {
28
+ export default function addTextTrack(mediaElement: HTMLMediaElement): {
31
29
  track: ICompatTextTrack;
32
30
  trackElement: HTMLTrackElement | undefined;
33
31
  };
@@ -23,12 +23,10 @@ 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.
28
26
  * @returns {Object}
29
27
  */
30
- export default function addTextTrack(mediaElement, hidden) {
31
- var _a, _b;
28
+ export default function addTextTrack(mediaElement) {
29
+ var _a;
32
30
  var track;
33
31
  var trackElement;
34
32
  var kind = "subtitles";
@@ -36,15 +34,14 @@ export default function addTextTrack(mediaElement, hidden) {
36
34
  var tracksLength = mediaElement.textTracks.length;
37
35
  track = (tracksLength > 0 ? mediaElement.textTracks[tracksLength - 1] :
38
36
  mediaElement.addTextTrack(kind));
39
- track.mode = hidden ? ((_a = track.HIDDEN) !== null && _a !== void 0 ? _a : "hidden") :
40
- ((_b = track.SHOWING) !== null && _b !== void 0 ? _b : "showing");
37
+ track.mode = (_a = track.SHOWING) !== null && _a !== void 0 ? _a : "showing";
41
38
  }
42
39
  else {
43
40
  trackElement = document.createElement("track");
44
41
  mediaElement.appendChild(trackElement);
45
42
  track = trackElement.track;
46
43
  trackElement.kind = kind;
47
- track.mode = hidden ? "hidden" : "showing";
44
+ track.mode = "showing";
48
45
  }
49
46
  return { track: track, trackElement: trackElement };
50
47
  }
@@ -52,15 +52,8 @@ 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;
58
55
  mozHidden?: boolean;
59
- msExitFullscreen?: () => void;
60
- msFullscreenElement?: Element | null;
61
56
  msHidden?: boolean;
62
- webkitExitFullscreen: () => void;
63
- webkitFullscreenElement: Element | null;
64
57
  webkitHidden?: boolean;
65
58
  }
66
59
  /**
@@ -27,15 +27,6 @@ export interface IEventEmitterLike {
27
27
  removeEventListener: (eventName: string, handler: () => void) => void;
28
28
  }
29
29
  export declare type IEventTargetLike = HTMLElement | IEventEmitterLike | IEventEmitter<unknown>;
30
- /**
31
- * Returns a reference:
32
- * - Set to `true` when the current page is considered visible and active.
33
- * - Set to `false` otherwise.
34
- * @param {Object} stopListening - `CancellationSignal` allowing to free the
35
- * resources allocated to update this value.
36
- * @returns {Object}
37
- */
38
- declare function getPageActivityRef(stopListening: CancellationSignal): IReadOnlySharedReference<boolean>;
39
30
  export interface IPictureInPictureEvent {
40
31
  isEnabled: boolean;
41
32
  pipWindow: ICompatPictureInPictureWindow | null;
@@ -92,11 +83,6 @@ declare const onEnded$: (element: IEventTargetLike) => Observable<Event>;
92
83
  * @returns {Observable}
93
84
  */
94
85
  declare const onTimeUpdate$: (element: IEventTargetLike) => Observable<Event>;
95
- /**
96
- * @param {HTMLElement} element
97
- * @returns {Observable}
98
- */
99
- declare const onFullscreenChange$: (element: IEventTargetLike) => Observable<Event>;
100
86
  /**
101
87
  * @param {HTMLMediaElement} mediaElement
102
88
  * @returns {Observable}
@@ -178,4 +164,4 @@ declare const onEnded: (element: IEventTargetLike, listener: (event?: unknown) =
178
164
  * emits
179
165
  */
180
166
  declare function addEventListener(elt: IEventEmitterLike, evt: string, listener: (x?: unknown) => void, stopListening: CancellationSignal): void;
181
- export { addEventListener, getPageActivityRef, getPictureOnPictureStateRef, getVideoVisibilityRef, getVideoWidthRef, onEncrypted$, onEnded, onEnded$, onFullscreenChange$, onKeyAdded$, onKeyError$, onKeyMessage$, onKeyStatusesChange$, onLoadedMetadata$, onRemoveSourceBuffers$, onSeeked, onSeeked$, onSeeking, onSeeking$, onSourceClose$, onSourceEnded$, onSourceOpen$, onTextTrackChanges$, onTimeUpdate$, onUpdate$, };
167
+ export { addEventListener, getPictureOnPictureStateRef, getVideoVisibilityRef, getVideoWidthRef, onEncrypted$, onEnded, onEnded$, onKeyAdded$, onKeyError$, onKeyMessage$, onKeyStatusesChange$, onLoadedMetadata$, onRemoveSourceBuffers$, onSeeked, onSeeked$, onSeeking, onSeeking$, onSourceClose$, onSourceEnded$, onSourceOpen$, onTextTrackChanges$, onTimeUpdate$, onUpdate$, };