rx-player 3.28.0 → 4.0.0-alpha.2022080900

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 (322) hide show
  1. package/.github/workflows/checks.yml +20 -18
  2. package/CHANGELOG.md +1 -0
  3. package/FILES.md +0 -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/eme/load_session.d.ts +5 -6
  10. package/dist/_esm5.processed/compat/eme/load_session.js +5 -6
  11. package/dist/_esm5.processed/compat/event_listeners.d.ts +1 -15
  12. package/dist/_esm5.processed/compat/event_listeners.js +1 -38
  13. package/dist/_esm5.processed/compat/index.d.ts +1 -2
  14. package/dist/_esm5.processed/compat/index.js +1 -2
  15. package/dist/_esm5.processed/config.d.ts +7 -12
  16. package/dist/_esm5.processed/core/adaptive/adaptive_representation_selector.d.ts +0 -1
  17. package/dist/_esm5.processed/core/adaptive/adaptive_representation_selector.js +4 -1
  18. package/dist/_esm5.processed/core/api/option_utils.d.ts +2 -16
  19. package/dist/_esm5.processed/core/api/option_utils.js +13 -131
  20. package/dist/_esm5.processed/core/api/public_api.d.ts +72 -212
  21. package/dist/_esm5.processed/core/api/public_api.js +353 -635
  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/{media_element_track_choice_manager.d.ts → track_management/media_element_tracks_store.d.ts} +16 -76
  25. package/dist/_esm5.processed/core/api/{media_element_track_choice_manager.js → track_management/media_element_tracks_store.js} +77 -196
  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/fetchers/manifest/manifest_fetcher.js +1 -19
  31. package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.d.ts +2 -2
  32. package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.js +15 -7
  33. package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher_creator.js +1 -1
  34. package/dist/_esm5.processed/core/init/initialize_media_source.d.ts +0 -5
  35. package/dist/_esm5.processed/core/segment_buffers/implementations/text/native/native_text_segment_buffer.d.ts +1 -2
  36. package/dist/_esm5.processed/core/segment_buffers/implementations/text/native/native_text_segment_buffer.js +2 -3
  37. package/dist/_esm5.processed/core/segment_buffers/implementations/types.d.ts +2 -2
  38. package/dist/_esm5.processed/core/segment_buffers/index.d.ts +2 -2
  39. package/dist/_esm5.processed/core/segment_buffers/index.js +2 -1
  40. package/dist/_esm5.processed/core/segment_buffers/inventory/index.d.ts +1 -0
  41. package/dist/_esm5.processed/core/segment_buffers/inventory/index.js +1 -0
  42. package/dist/_esm5.processed/core/segment_buffers/inventory/utils.d.ts +33 -0
  43. package/dist/_esm5.processed/core/segment_buffers/inventory/utils.js +49 -0
  44. package/dist/_esm5.processed/core/segment_buffers/segment_buffers_store.d.ts +0 -1
  45. package/dist/_esm5.processed/core/segment_buffers/segment_buffers_store.js +2 -16
  46. package/dist/_esm5.processed/core/stream/adaptation/adaptation_stream.d.ts +2 -10
  47. package/dist/_esm5.processed/core/stream/adaptation/adaptation_stream.js +164 -135
  48. package/dist/_esm5.processed/core/stream/adaptation/get_representations_switch_strategy.d.ts +39 -0
  49. package/dist/_esm5.processed/core/stream/adaptation/get_representations_switch_strategy.js +133 -0
  50. package/dist/_esm5.processed/core/stream/events_generators.d.ts +3 -3
  51. package/dist/_esm5.processed/core/stream/events_generators.js +4 -4
  52. package/dist/_esm5.processed/core/stream/index.d.ts +0 -1
  53. package/dist/_esm5.processed/core/stream/orchestrator/active_period_emitter.d.ts +1 -2
  54. package/dist/_esm5.processed/core/stream/orchestrator/active_period_emitter.js +1 -2
  55. package/dist/_esm5.processed/core/stream/orchestrator/stream_orchestrator.js +1 -1
  56. package/dist/_esm5.processed/core/stream/period/get_adaptation_switch_strategy.d.ts +2 -4
  57. package/dist/_esm5.processed/core/stream/period/get_adaptation_switch_strategy.js +10 -46
  58. package/dist/_esm5.processed/core/stream/period/period_stream.d.ts +0 -3
  59. package/dist/_esm5.processed/core/stream/period/period_stream.js +10 -10
  60. package/dist/_esm5.processed/core/stream/representation/representation_stream.js +27 -21
  61. package/dist/_esm5.processed/core/stream/types.d.ts +40 -9
  62. package/dist/_esm5.processed/default_config.d.ts +32 -53
  63. package/dist/_esm5.processed/default_config.js +33 -51
  64. package/dist/_esm5.processed/errors/network_error.d.ts +0 -1
  65. package/dist/_esm5.processed/errors/network_error.js +0 -1
  66. package/dist/_esm5.processed/errors/request_error.d.ts +2 -3
  67. package/dist/_esm5.processed/errors/request_error.js +2 -5
  68. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/thumbnail_loader.js +2 -1
  69. package/dist/_esm5.processed/features/features_object.js +0 -2
  70. package/dist/_esm5.processed/features/initialize_features.js +2 -7
  71. package/dist/_esm5.processed/features/list/directfile.js +2 -2
  72. package/dist/_esm5.processed/features/list/index.d.ts +0 -2
  73. package/dist/_esm5.processed/features/list/index.js +0 -2
  74. package/dist/_esm5.processed/features/types.d.ts +4 -27
  75. package/dist/_esm5.processed/manifest/adaptation.d.ts +3 -9
  76. package/dist/_esm5.processed/manifest/adaptation.js +9 -23
  77. package/dist/_esm5.processed/manifest/index.d.ts +3 -4
  78. package/dist/_esm5.processed/manifest/manifest.d.ts +5 -54
  79. package/dist/_esm5.processed/manifest/manifest.js +4 -100
  80. package/dist/_esm5.processed/manifest/period.d.ts +4 -5
  81. package/dist/_esm5.processed/manifest/representation.d.ts +10 -5
  82. package/dist/_esm5.processed/manifest/representation.js +9 -1
  83. package/dist/_esm5.processed/manifest/representation_index/index.d.ts +2 -2
  84. package/dist/_esm5.processed/manifest/representation_index/static.d.ts +2 -0
  85. package/dist/_esm5.processed/manifest/representation_index/static.js +7 -0
  86. package/dist/_esm5.processed/manifest/representation_index/types.d.ts +83 -35
  87. package/dist/_esm5.processed/manifest/types.d.ts +0 -2
  88. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/base.d.ts +17 -31
  89. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/base.js +26 -19
  90. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/list.d.ts +7 -6
  91. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/list.js +8 -6
  92. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/template.d.ts +3 -6
  93. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/template.js +12 -9
  94. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.d.ts +2 -0
  95. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.js +6 -0
  96. package/dist/_esm5.processed/parsers/manifest/dash/common/infer_adaptation_type.d.ts +2 -2
  97. package/dist/_esm5.processed/parsers/manifest/dash/common/infer_adaptation_type.js +1 -6
  98. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_adaptation_sets.js +3 -5
  99. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_mpd.d.ts +0 -2
  100. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_mpd.js +1 -1
  101. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_periods.js +2 -2
  102. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representation_index.d.ts +0 -2
  103. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representation_index.js +2 -2
  104. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/AdaptationSet.js +10 -6
  105. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/Representation.js +4 -2
  106. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/utils.d.ts +10 -1
  107. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/utils.js +18 -2
  108. package/dist/_esm5.processed/parsers/manifest/dash/node_parser_types.d.ts +4 -4
  109. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/AdaptationSet.js +3 -6
  110. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/Representation.js +1 -2
  111. package/dist/_esm5.processed/parsers/manifest/local/representation_index.d.ts +2 -0
  112. package/dist/_esm5.processed/parsers/manifest/local/representation_index.js +6 -0
  113. package/dist/_esm5.processed/parsers/manifest/metaplaylist/metaplaylist_parser.js +6 -6
  114. package/dist/_esm5.processed/parsers/manifest/metaplaylist/representation_index.d.ts +12 -3
  115. package/dist/_esm5.processed/parsers/manifest/metaplaylist/representation_index.js +11 -2
  116. package/dist/_esm5.processed/parsers/manifest/smooth/create_parser.d.ts +0 -1
  117. package/dist/_esm5.processed/parsers/manifest/smooth/create_parser.js +11 -17
  118. package/dist/_esm5.processed/parsers/manifest/smooth/representation_index.d.ts +22 -85
  119. package/dist/_esm5.processed/parsers/manifest/smooth/representation_index.js +54 -127
  120. package/dist/_esm5.processed/parsers/manifest/smooth/shared_smooth_segment_timeline.d.ts +119 -0
  121. package/dist/_esm5.processed/parsers/manifest/smooth/shared_smooth_segment_timeline.js +159 -0
  122. package/dist/_esm5.processed/parsers/manifest/smooth/utils/add_segment_infos.d.ts +3 -6
  123. package/dist/_esm5.processed/parsers/manifest/smooth/utils/add_segment_infos.js +4 -4
  124. package/dist/_esm5.processed/parsers/manifest/types.d.ts +3 -3
  125. package/dist/_esm5.processed/public_types.d.ts +234 -221
  126. package/dist/_esm5.processed/transports/dash/add_segment_integrity_checks_to_loader.js +4 -4
  127. package/dist/_esm5.processed/transports/dash/manifest_parser.js +2 -3
  128. package/dist/_esm5.processed/transports/dash/pipelines.js +1 -4
  129. package/dist/_esm5.processed/transports/dash/segment_loader.d.ts +2 -2
  130. package/dist/_esm5.processed/transports/dash/segment_loader.js +15 -17
  131. package/dist/_esm5.processed/transports/dash/segment_parser.js +19 -24
  132. package/dist/_esm5.processed/transports/dash/text_loader.js +4 -4
  133. package/dist/_esm5.processed/transports/dash/text_parser.js +28 -33
  134. package/dist/_esm5.processed/transports/local/pipelines.js +1 -10
  135. package/dist/_esm5.processed/transports/local/segment_parser.d.ts +1 -1
  136. package/dist/_esm5.processed/transports/local/segment_parser.js +10 -10
  137. package/dist/_esm5.processed/transports/local/text_parser.d.ts +2 -2
  138. package/dist/_esm5.processed/transports/local/text_parser.js +23 -23
  139. package/dist/_esm5.processed/transports/metaplaylist/pipelines.js +34 -54
  140. package/dist/_esm5.processed/{utils/list_to_map.d.ts → transports/smooth/is_mp4_embedded_track.d.ts} +5 -5
  141. package/dist/_esm5.processed/{features/list/bif_parser.js → transports/smooth/is_mp4_embedded_track.js} +6 -7
  142. package/dist/_esm5.processed/transports/smooth/pipelines.js +31 -186
  143. package/dist/_esm5.processed/transports/smooth/segment_loader.d.ts +1 -1
  144. package/dist/_esm5.processed/transports/smooth/segment_loader.js +22 -20
  145. package/dist/_esm5.processed/transports/types.d.ts +95 -90
  146. package/dist/_esm5.processed/transports/utils/call_custom_manifest_loader.js +1 -1
  147. package/dist/_esm5.processed/transports/utils/infer_segment_container.d.ts +3 -3
  148. package/dist/_esm5.processed/transports/utils/infer_segment_container.js +5 -7
  149. package/dist/_esm5.processed/transports/utils/parse_text_track.d.ts +8 -12
  150. package/dist/_esm5.processed/transports/utils/parse_text_track.js +19 -21
  151. package/dist/_esm5.processed/utils/reference.d.ts +3 -3
  152. package/dist/_esm5.processed/utils/request/xhr.js +4 -4
  153. package/dist/_esm5.processed/utils/task_canceller.d.ts +0 -3
  154. package/dist/_esm5.processed/utils/task_canceller.js +0 -3
  155. package/dist/mpd-parser.wasm +0 -0
  156. package/dist/rx-player.js +3854 -5336
  157. package/dist/rx-player.min.js +1 -1
  158. package/locked_reps.js +46 -0
  159. package/package.json +2 -2
  160. package/scripts/report_build_sizes +0 -4
  161. package/sonar-project.properties +1 -1
  162. package/src/README.md +6 -5
  163. package/src/compat/__tests__/add_text_track.test.ts +4 -49
  164. package/src/compat/add_text_track.ts +3 -7
  165. package/src/compat/browser_compatibility_types.ts +0 -7
  166. package/src/compat/eme/load_session.ts +5 -6
  167. package/src/compat/event_listeners.ts +0 -48
  168. package/src/compat/index.ts +0 -8
  169. package/src/config.ts +1 -0
  170. package/src/core/adaptive/adaptive_representation_selector.ts +3 -3
  171. package/src/core/api/README.md +5 -5
  172. package/src/core/api/__tests__/option_utils.test.ts +17 -499
  173. package/src/core/api/__tests__/public_api.test.ts +6 -157
  174. package/src/core/api/option_utils.ts +17 -181
  175. package/src/core/api/public_api.ts +455 -765
  176. package/src/core/api/track_management/README.md +15 -0
  177. package/src/core/api/{__tests__/media_element_track_choice_manager.test.ts → track_management/__tests__/media_element_tracks_store.test.ts} +8 -8
  178. package/src/core/{segment_buffers/implementations/image → api/track_management}/index.ts +4 -2
  179. package/src/core/api/{media_element_track_choice_manager.ts → track_management/media_element_tracks_store.ts} +73 -242
  180. package/src/core/api/track_management/track_dispatcher.ts +238 -0
  181. package/src/core/api/track_management/tracks_store.ts +1359 -0
  182. package/src/core/decrypt/__tests__/__global__/get_license.test.ts +2 -2
  183. package/src/core/fetchers/manifest/manifest_fetcher.ts +1 -23
  184. package/src/core/fetchers/segment/segment_fetcher.ts +15 -7
  185. package/src/core/fetchers/segment/segment_fetcher_creator.ts +1 -1
  186. package/src/core/init/initialize_media_source.ts +0 -5
  187. package/src/core/segment_buffers/README.md +18 -18
  188. package/src/core/segment_buffers/implementations/text/native/native_text_segment_buffer.ts +2 -7
  189. package/src/core/segment_buffers/implementations/types.ts +2 -3
  190. package/src/core/segment_buffers/index.ts +5 -0
  191. package/src/core/segment_buffers/inventory/index.ts +4 -0
  192. package/src/core/segment_buffers/inventory/utils.ts +61 -0
  193. package/src/core/segment_buffers/segment_buffers_store.ts +4 -18
  194. package/src/core/stream/adaptation/adaptation_stream.ts +240 -208
  195. package/src/core/stream/adaptation/get_representations_switch_strategy.ts +194 -0
  196. package/src/core/stream/events_generators.ts +9 -3
  197. package/src/core/stream/index.ts +0 -1
  198. package/src/core/stream/orchestrator/README.md +1 -4
  199. package/src/core/stream/orchestrator/active_period_emitter.ts +1 -2
  200. package/src/core/stream/orchestrator/stream_orchestrator.ts +1 -1
  201. package/src/core/stream/period/get_adaptation_switch_strategy.ts +13 -58
  202. package/src/core/stream/period/period_stream.ts +18 -12
  203. package/src/core/stream/representation/representation_stream.ts +31 -24
  204. package/src/core/stream/types.ts +53 -11
  205. package/src/default_config.ts +38 -58
  206. package/src/errors/__tests__/is_known_error.test.ts +2 -6
  207. package/src/errors/__tests__/network_error.test.ts +5 -17
  208. package/src/errors/__tests__/request_error.test.ts +0 -14
  209. package/src/errors/network_error.ts +0 -2
  210. package/src/errors/request_error.ts +2 -8
  211. package/src/experimental/tools/VideoThumbnailLoader/thumbnail_loader.ts +2 -1
  212. package/src/features/__tests__/initialize_features.test.ts +2 -18
  213. package/src/features/features_object.ts +0 -2
  214. package/src/features/initialize_features.ts +3 -9
  215. package/src/features/list/__tests__/directfile.test.ts +4 -4
  216. package/src/features/list/directfile.ts +2 -2
  217. package/src/features/list/index.ts +0 -2
  218. package/src/features/types.ts +4 -29
  219. package/src/manifest/__tests__/adaptation.test.ts +10 -47
  220. package/src/manifest/__tests__/manifest.test.ts +11 -11
  221. package/src/manifest/__tests__/period.test.ts +19 -20
  222. package/src/manifest/adaptation.ts +14 -27
  223. package/src/manifest/index.ts +0 -8
  224. package/src/manifest/manifest.ts +8 -164
  225. package/src/manifest/period.ts +5 -5
  226. package/src/manifest/representation.ts +16 -7
  227. package/src/manifest/representation_index/__tests__/static.test.ts +1 -0
  228. package/src/manifest/representation_index/index.ts +0 -2
  229. package/src/manifest/representation_index/static.ts +9 -0
  230. package/src/manifest/representation_index/types.ts +95 -39
  231. package/src/manifest/types.ts +0 -3
  232. package/src/parsers/manifest/dash/common/indexes/base.ts +29 -38
  233. package/src/parsers/manifest/dash/common/indexes/list.ts +14 -7
  234. package/src/parsers/manifest/dash/common/indexes/template.ts +15 -16
  235. package/src/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.ts +8 -0
  236. package/src/parsers/manifest/dash/common/infer_adaptation_type.ts +2 -8
  237. package/src/parsers/manifest/dash/common/parse_adaptation_sets.ts +6 -8
  238. package/src/parsers/manifest/dash/common/parse_mpd.ts +1 -4
  239. package/src/parsers/manifest/dash/common/parse_periods.ts +2 -3
  240. package/src/parsers/manifest/dash/common/parse_representation_index.ts +2 -6
  241. package/src/parsers/manifest/dash/js-parser/__tests__/parse_from_document.test.ts +0 -2
  242. package/src/parsers/manifest/dash/js-parser/node_parsers/AdaptationSet.ts +11 -5
  243. package/src/parsers/manifest/dash/js-parser/node_parsers/Representation.ts +4 -1
  244. package/src/parsers/manifest/dash/js-parser/node_parsers/__tests__/AdaptationSet.test.ts +181 -15
  245. package/src/parsers/manifest/dash/js-parser/node_parsers/utils.ts +22 -2
  246. package/src/parsers/manifest/dash/node_parser_types.ts +4 -4
  247. package/src/parsers/manifest/dash/wasm-parser/rs/events.rs +11 -1
  248. package/src/parsers/manifest/dash/wasm-parser/rs/processor/attributes.rs +4 -4
  249. package/src/parsers/manifest/dash/wasm-parser/rs/utils.rs +49 -0
  250. package/src/parsers/manifest/dash/wasm-parser/ts/generators/AdaptationSet.ts +3 -6
  251. package/src/parsers/manifest/dash/wasm-parser/ts/generators/Representation.ts +1 -2
  252. package/src/parsers/manifest/local/representation_index.ts +8 -0
  253. package/src/parsers/manifest/metaplaylist/metaplaylist_parser.ts +8 -8
  254. package/src/parsers/manifest/metaplaylist/representation_index.ts +26 -5
  255. package/src/parsers/manifest/smooth/create_parser.ts +17 -27
  256. package/src/parsers/manifest/smooth/representation_index.ts +79 -222
  257. package/src/parsers/manifest/smooth/shared_smooth_segment_timeline.ts +241 -0
  258. package/src/parsers/manifest/smooth/utils/add_segment_infos.ts +7 -9
  259. package/src/parsers/manifest/types.ts +3 -4
  260. package/src/parsers/manifest/utils/__tests__/get_first_time_from_adaptations.test.ts +2 -0
  261. package/src/parsers/manifest/utils/__tests__/get_last_time_from_adaptation.test.ts +2 -0
  262. package/src/public_types.ts +294 -257
  263. package/src/transports/dash/add_segment_integrity_checks_to_loader.ts +4 -5
  264. package/src/transports/dash/manifest_parser.ts +2 -5
  265. package/src/transports/dash/pipelines.ts +1 -7
  266. package/src/transports/dash/segment_loader.ts +17 -20
  267. package/src/transports/dash/segment_parser.ts +21 -27
  268. package/src/transports/dash/text_loader.ts +4 -4
  269. package/src/transports/dash/text_parser.ts +28 -34
  270. package/src/transports/local/pipelines.ts +1 -11
  271. package/src/transports/local/segment_parser.ts +11 -10
  272. package/src/transports/local/text_parser.ts +23 -23
  273. package/src/transports/metaplaylist/pipelines.ts +45 -89
  274. package/{dist/_esm5.processed/utils/list_to_map.js → src/transports/smooth/is_mp4_embedded_track.ts} +7 -10
  275. package/src/transports/smooth/pipelines.ts +35 -190
  276. package/src/transports/smooth/segment_loader.ts +23 -25
  277. package/src/transports/types.ts +98 -109
  278. package/src/transports/utils/__tests__/infer_segment_container.test.ts +25 -172
  279. package/src/transports/utils/call_custom_manifest_loader.ts +1 -1
  280. package/src/transports/utils/infer_segment_container.ts +7 -13
  281. package/src/transports/utils/parse_text_track.ts +25 -31
  282. package/src/typings/globals.d.ts +0 -2
  283. package/src/utils/__tests__/initialization_segment_cache.test.ts +7 -0
  284. package/src/utils/reference.ts +3 -3
  285. package/src/utils/request/xhr.ts +4 -4
  286. package/src/utils/task_canceller.ts +0 -3
  287. package/dist/_esm5.processed/compat/fullscreen.d.ts +0 -32
  288. package/dist/_esm5.processed/compat/fullscreen.js +0 -78
  289. package/dist/_esm5.processed/core/api/track_choice_manager.d.ts +0 -263
  290. package/dist/_esm5.processed/core/api/track_choice_manager.js +0 -1056
  291. package/dist/_esm5.processed/core/segment_buffers/implementations/image/image_segment_buffer.d.ts +0 -66
  292. package/dist/_esm5.processed/core/segment_buffers/implementations/image/image_segment_buffer.js +0 -123
  293. package/dist/_esm5.processed/core/stream/adaptation/create_representation_estimator.d.ts +0 -47
  294. package/dist/_esm5.processed/core/stream/adaptation/create_representation_estimator.js +0 -71
  295. package/dist/_esm5.processed/features/list/bif_parser.d.ts +0 -23
  296. package/dist/_esm5.processed/features/list/image_buffer.d.ts +0 -23
  297. package/dist/_esm5.processed/features/list/image_buffer.js +0 -25
  298. package/dist/_esm5.processed/transports/dash/image_pipelines.d.ts +0 -36
  299. package/dist/_esm5.processed/transports/dash/image_pipelines.js +0 -125
  300. package/dist/_esm5.processed/transports/smooth/utils.d.ts +0 -49
  301. package/dist/_esm5.processed/transports/smooth/utils.js +0 -80
  302. package/dist/_esm5.processed/utils/simple_set.d.ts +0 -51
  303. package/dist/_esm5.processed/utils/simple_set.js +0 -57
  304. package/dist/_esm5.processed/utils/uniq.d.ts +0 -36
  305. package/dist/_esm5.processed/utils/uniq.js +0 -43
  306. package/src/compat/__tests__/fullscreen.test.ts +0 -286
  307. package/src/compat/fullscreen.ts +0 -87
  308. package/src/core/api/track_choice_manager.ts +0 -1354
  309. package/src/core/segment_buffers/implementations/image/image_segment_buffer.ts +0 -141
  310. package/src/core/stream/adaptation/create_representation_estimator.ts +0 -112
  311. package/src/features/list/__tests__/bif_parser.test.ts +0 -36
  312. package/src/features/list/__tests__/image_buffer.test.ts +0 -35
  313. package/src/features/list/bif_parser.ts +0 -29
  314. package/src/features/list/image_buffer.ts +0 -29
  315. package/src/transports/dash/image_pipelines.ts +0 -116
  316. package/src/transports/smooth/utils.ts +0 -94
  317. package/src/utils/__tests__/list_to_map.test.ts +0 -46
  318. package/src/utils/__tests__/simple_set.test.ts +0 -57
  319. package/src/utils/__tests__/uniq.test.ts +0 -134
  320. package/src/utils/list_to_map.ts +0 -32
  321. package/src/utils/simple_set.ts +0 -67
  322. package/src/utils/uniq.ts +0 -49
@@ -54,27 +54,29 @@ jobs:
54
54
  - run: node tests/integration/run.js --bchromehl
55
55
  - run: npm run test:memory
56
56
 
57
- integration_windows:
57
+ # Windows seems to be a lot less stable for some reason.
58
+ # TODO debug?
59
+ # integration_windows:
58
60
 
59
- runs-on: windows-latest
61
+ # runs-on: windows-latest
60
62
 
61
- strategy:
62
- matrix:
63
- node-version: [16.x]
64
- # See supported Node.js release schedule at https://nodejs.org/en/about/releases/
63
+ # strategy:
64
+ # matrix:
65
+ # node-version: [16.x]
66
+ # # See supported Node.js release schedule at https://nodejs.org/en/about/releases/
65
67
 
66
- steps:
67
- - uses: actions/checkout@v2
68
- - name: Use Node.js ${{ matrix.node-version }}
69
- uses: actions/setup-node@v2
70
- with:
71
- node-version: ${{ matrix.node-version }}
72
- cache: 'npm'
73
- - run: npm install
74
- # Firefox seems to have issue with integration tests on GitHub actions only
75
- # TODO to check
76
- - run: node tests/integration/run.js --bchromehl
77
- - run: npm run test:memory
68
+ # steps:
69
+ # - uses: actions/checkout@v2
70
+ # - name: Use Node.js ${{ matrix.node-version }}
71
+ # uses: actions/setup-node@v2
72
+ # with:
73
+ # node-version: ${{ matrix.node-version }}
74
+ # cache: 'npm'
75
+ # - run: npm install
76
+ # # Firefox seems to have issue with integration tests on GitHub actions only
77
+ # # TODO to check
78
+ # - run: node tests/integration/run.js --bchromehl
79
+ # - run: npm run test:memory
78
80
 
79
81
  # MacOS seems to be a lot less stable for some reason.
80
82
  # TODO debug?
package/CHANGELOG.md CHANGED
@@ -25,6 +25,7 @@
25
25
  ### Other improvements
26
26
 
27
27
  - TTML: Add support for percent based thickness for textOutline in TTML Subtitles [#1108]
28
+ - Improve TypeScript's language servers auto import feature with the RxPlayer by better redirecting to the exported type [#1126]
28
29
  - If seeking after the last potential position, load last segments before ending [#1097]
29
30
  - The duration set on the media element is now only relative to the current chosen tracks (it was previously relative to all potential track). This allows to seek later when switching e.g. to a longer video track [#1102]
30
31
  - Errors coming from an HTMLMediaElement now have the browser's error message if it exists [#1112]
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/VERSION CHANGED
@@ -1 +1 @@
1
- 3.28.0
1
+ 4.0.0-alpha.2022080900
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
  /**
@@ -18,14 +18,13 @@ import { ICustomMediaKeySession } from "./custom_media_keys";
18
18
  * Load a persistent session, based on its `sessionId`, on the given
19
19
  * MediaKeySession.
20
20
  *
21
- * Returns an Observable which emits:
22
- * - true if the persistent MediaKeySession was found and loaded
23
- * - false if no persistent MediaKeySession was found with that `sessionId`.
24
- * Then completes.
21
+ * Returns a Promise which resolves with:
22
+ * - `true` if the persistent MediaKeySession was found and loaded
23
+ * - `false` if no persistent MediaKeySession was found with that `sessionId`.
25
24
  *
26
- * The Observable throws if anything goes wrong in the process.
25
+ * The Promise rejects if anything goes wrong in the process.
27
26
  * @param {MediaKeySession} session
28
27
  * @param {string} sessionId
29
- * @returns {Observable}
28
+ * @returns {Promise.<boolean>}
30
29
  */
31
30
  export default function loadSession(session: MediaKeySession | ICustomMediaKeySession, sessionId: string): Promise<boolean>;
@@ -55,15 +55,14 @@ var EME_WAITING_DELAY_LOADED_SESSION_EMPTY_KEYSTATUSES = 100;
55
55
  * Load a persistent session, based on its `sessionId`, on the given
56
56
  * MediaKeySession.
57
57
  *
58
- * Returns an Observable which emits:
59
- * - true if the persistent MediaKeySession was found and loaded
60
- * - false if no persistent MediaKeySession was found with that `sessionId`.
61
- * Then completes.
58
+ * Returns a Promise which resolves with:
59
+ * - `true` if the persistent MediaKeySession was found and loaded
60
+ * - `false` if no persistent MediaKeySession was found with that `sessionId`.
62
61
  *
63
- * The Observable throws if anything goes wrong in the process.
62
+ * The Promise rejects if anything goes wrong in the process.
64
63
  * @param {MediaKeySession} session
65
64
  * @param {string} sessionId
66
- * @returns {Observable}
65
+ * @returns {Promise.<boolean>}
67
66
  */
68
67
  export default function loadSession(session, sessionId) {
69
68
  return __awaiter(this, void 0, void 0, function () {
@@ -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;
@@ -91,11 +82,6 @@ declare const onEnded$: (element: IEventTargetLike) => Observable<Event>;
91
82
  * @returns {Observable}
92
83
  */
93
84
  declare const onTimeUpdate$: (element: IEventTargetLike) => Observable<Event>;
94
- /**
95
- * @param {HTMLElement} element
96
- * @returns {Observable}
97
- */
98
- declare const onFullscreenChange$: (element: IEventTargetLike) => Observable<Event>;
99
85
  /**
100
86
  * @param {HTMLMediaElement} mediaElement
101
87
  * @returns {Observable}
@@ -162,4 +148,4 @@ declare const onKeyStatusesChange$: (element: IEventTargetLike) => Observable<Ev
162
148
  * emits
163
149
  */
164
150
  declare function addEventListener(elt: IEventEmitterLike, evt: string, listener: (x?: unknown) => void, stopListening: CancellationSignal): void;
165
- export { addEventListener, getPageActivityRef, getPictureOnPictureStateRef, getVideoVisibilityRef, getVideoWidthRef, onEncrypted$, onEnded$, onFullscreenChange$, onKeyAdded$, onKeyError$, onKeyMessage$, onKeyStatusesChange$, onLoadedMetadata$, onRemoveSourceBuffers$, onSeeked$, onSeeking$, onSourceClose$, onSourceEnded$, onSourceOpen$, onTextTrackChanges$, onTimeUpdate$, onUpdate$, };
151
+ export { addEventListener, getPictureOnPictureStateRef, getVideoVisibilityRef, getVideoWidthRef, onEncrypted$, onEnded$, onKeyAdded$, onKeyError$, onKeyMessage$, onKeyStatusesChange$, onLoadedMetadata$, onRemoveSourceBuffers$, onSeeked$, onSeeking$, onSourceClose$, onSourceEnded$, onSourceOpen$, onTextTrackChanges$, onTimeUpdate$, onUpdate$, };
@@ -142,36 +142,6 @@ function getDocumentVisibilityRef(stopListening) {
142
142
  });
143
143
  return ref;
144
144
  }
145
- /**
146
- * Returns a reference:
147
- * - Set to `true` when the current page is considered visible and active.
148
- * - Set to `false` otherwise.
149
- * @param {Object} stopListening - `CancellationSignal` allowing to free the
150
- * resources allocated to update this value.
151
- * @returns {Object}
152
- */
153
- function getPageActivityRef(stopListening) {
154
- var isDocVisibleRef = getDocumentVisibilityRef(stopListening);
155
- var currentTimeout;
156
- var ref = createSharedReference(true);
157
- stopListening.register(function () {
158
- clearTimeout(currentTimeout);
159
- currentTimeout = undefined;
160
- ref.finish();
161
- });
162
- isDocVisibleRef.onUpdate(function onDocVisibilityChange(isVisible) {
163
- clearTimeout(currentTimeout); // clear potential previous timeout
164
- currentTimeout = undefined;
165
- if (!isVisible) {
166
- var INACTIVITY_DELAY = config.getCurrent().INACTIVITY_DELAY;
167
- currentTimeout = window.setTimeout(function () {
168
- ref.setValueIfChanged(false);
169
- }, INACTIVITY_DELAY);
170
- }
171
- ref.setValueIfChanged(true);
172
- }, { clearSignal: stopListening, emitCurrentValue: true });
173
- return ref;
174
- }
175
145
  /**
176
146
  * Get video width from Picture-in-Picture window
177
147
  * @param {HTMLMediaElement} mediaElement
@@ -332,13 +302,6 @@ var onEnded$ = compatibleListener(["ended"]);
332
302
  * @returns {Observable}
333
303
  */
334
304
  var onTimeUpdate$ = compatibleListener(["timeupdate"]);
335
- /**
336
- * @param {HTMLElement} element
337
- * @returns {Observable}
338
- */
339
- var onFullscreenChange$ = compatibleListener(["fullscreenchange", "FullscreenChange"],
340
- // On IE11, fullscreen change events is called MSFullscreenChange
341
- BROWSER_PREFIXES.concat("MS"));
342
305
  /**
343
306
  * @param {HTMLMediaElement} mediaElement
344
307
  * @returns {Observable}
@@ -413,4 +376,4 @@ function addEventListener(elt, evt, listener, stopListening) {
413
376
  elt.removeEventListener(evt, listener);
414
377
  });
415
378
  }
416
- export { addEventListener, getPageActivityRef, getPictureOnPictureStateRef, getVideoVisibilityRef, getVideoWidthRef, onEncrypted$, onEnded$, onFullscreenChange$, onKeyAdded$, onKeyError$, onKeyMessage$, onKeyStatusesChange$, onLoadedMetadata$, onRemoveSourceBuffers$, onSeeked$, onSeeking$, onSourceClose$, onSourceEnded$, onSourceOpen$, onTextTrackChanges$, onTimeUpdate$, onUpdate$, };
379
+ export { addEventListener, getPictureOnPictureStateRef, getVideoVisibilityRef, getVideoWidthRef, onEncrypted$, onEnded$, onKeyAdded$, onKeyError$, onKeyMessage$, onKeyStatusesChange$, onLoadedMetadata$, onRemoveSourceBuffers$, onSeeked$, onSeeking$, onSourceClose$, onSourceEnded$, onSourceOpen$, onTextTrackChanges$, onTimeUpdate$, onUpdate$, };
@@ -21,7 +21,6 @@ import tryToChangeSourceBufferType, { ICompatSourceBuffer } from "./change_sourc
21
21
  import clearElementSrc from "./clear_element_src";
22
22
  import { closeSession, CustomMediaKeySystemAccess, generateKeyRequest, getInitData, ICustomMediaKeys, ICustomMediaKeySession, ICustomMediaKeySystemAccess, loadSession, requestMediaKeySystemAccess, setMediaKeys } from "./eme";
23
23
  import * as events from "./event_listeners";
24
- import { exitFullscreen, isFullscreen, requestFullscreen } from "./fullscreen";
25
24
  import getStartDate from "./get_start_date";
26
25
  import hasEMEAPIs from "./has_eme_apis";
27
26
  import isCodecSupported from "./is_codec_supported";
@@ -38,4 +37,4 @@ import shouldUnsetMediaKeys from "./should_unset_media_keys";
38
37
  import shouldValidateMetadata from "./should_validate_metadata";
39
38
  import shouldWaitForDataBeforeLoaded from "./should_wait_for_data_before_loaded";
40
39
  import whenLoadedMetadata$ from "./when_loaded_metadata";
41
- export { addClassName, addTextTrack, canPatchISOBMFFSegment, clearElementSrc, closeSession, CustomMediaKeySystemAccess, events, exitFullscreen, generateKeyRequest, getInitData, getStartDate, hasEMEAPIs, ICompatTextTrack, ICompatVTTCue, ICustomMediaKeySession, ICustomMediaKeySystemAccess, ICustomMediaKeys, ICompatSourceBuffer, isCodecSupported, isFullscreen, isNode, isOffline, isVTTCue, loadSession, makeVTTCue, MediaSource_, onHeightWidthChange, play, requestFullscreen, requestMediaKeySystemAccess, setElementSrc$, setMediaKeys, shouldReloadMediaSourceOnDecipherabilityUpdate, shouldRenewMediaKeys, shouldUnsetMediaKeys, shouldValidateMetadata, shouldWaitForDataBeforeLoaded, tryToChangeSourceBufferType, whenLoadedMetadata$, };
40
+ export { addClassName, addTextTrack, canPatchISOBMFFSegment, clearElementSrc, closeSession, CustomMediaKeySystemAccess, events, generateKeyRequest, getInitData, getStartDate, hasEMEAPIs, ICompatTextTrack, ICompatVTTCue, ICustomMediaKeySession, ICustomMediaKeySystemAccess, ICustomMediaKeys, ICompatSourceBuffer, isCodecSupported, isNode, isOffline, isVTTCue, loadSession, makeVTTCue, MediaSource_, onHeightWidthChange, play, requestMediaKeySystemAccess, setElementSrc$, setMediaKeys, shouldReloadMediaSourceOnDecipherabilityUpdate, shouldRenewMediaKeys, shouldUnsetMediaKeys, shouldValidateMetadata, shouldWaitForDataBeforeLoaded, tryToChangeSourceBufferType, whenLoadedMetadata$, };
@@ -21,7 +21,6 @@ import tryToChangeSourceBufferType from "./change_source_buffer_type";
21
21
  import clearElementSrc from "./clear_element_src";
22
22
  import { closeSession, CustomMediaKeySystemAccess, generateKeyRequest, getInitData, loadSession, requestMediaKeySystemAccess, setMediaKeys, } from "./eme";
23
23
  import * as events from "./event_listeners";
24
- import { exitFullscreen, isFullscreen, requestFullscreen, } from "./fullscreen";
25
24
  import getStartDate from "./get_start_date";
26
25
  import hasEMEAPIs from "./has_eme_apis";
27
26
  import isCodecSupported from "./is_codec_supported";
@@ -44,4 +43,4 @@ import whenLoadedMetadata$ from "./when_loaded_metadata";
44
43
  // we would prefer to disallow (both for the understandability of the code and
45
44
  // to better exploit tree shaking.
46
45
  patchWebkitSourceBuffer();
47
- export { addClassName, addTextTrack, canPatchISOBMFFSegment, clearElementSrc, closeSession, CustomMediaKeySystemAccess, events, exitFullscreen, generateKeyRequest, getInitData, getStartDate, hasEMEAPIs, isCodecSupported, isFullscreen, isNode, isOffline, isVTTCue, loadSession, makeVTTCue, MediaSource_, onHeightWidthChange, play, requestFullscreen, requestMediaKeySystemAccess, setElementSrc$, setMediaKeys, shouldReloadMediaSourceOnDecipherabilityUpdate, shouldRenewMediaKeys, shouldUnsetMediaKeys, shouldValidateMetadata, shouldWaitForDataBeforeLoaded, tryToChangeSourceBufferType, whenLoadedMetadata$, };
46
+ export { addClassName, addTextTrack, canPatchISOBMFFSegment, clearElementSrc, closeSession, CustomMediaKeySystemAccess, events, generateKeyRequest, getInitData, getStartDate, hasEMEAPIs, isCodecSupported, isNode, isOffline, isVTTCue, loadSession, makeVTTCue, MediaSource_, onHeightWidthChange, play, requestMediaKeySystemAccess, setElementSrc$, setMediaKeys, shouldReloadMediaSourceOnDecipherabilityUpdate, shouldRenewMediaKeys, shouldUnsetMediaKeys, shouldValidateMetadata, shouldWaitForDataBeforeLoaded, tryToChangeSourceBufferType, whenLoadedMetadata$, };