rx-player 3.26.3-dev.2022021400 → 3.27.0-dev.20220317

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (340) hide show
  1. package/CHANGELOG.md +15 -1
  2. package/FILES.md +5 -4
  3. package/VERSION +1 -1
  4. package/dist/_esm5.processed/compat/browser_detection.d.ts +4 -2
  5. package/dist/_esm5.processed/compat/browser_detection.js +4 -2
  6. package/dist/_esm5.processed/compat/eme/close_session.d.ts +11 -5
  7. package/dist/_esm5.processed/compat/eme/close_session.js +144 -36
  8. package/dist/_esm5.processed/compat/eme/custom_media_keys/index.d.ts +3 -5
  9. package/dist/_esm5.processed/compat/eme/custom_media_keys/index.js +21 -22
  10. package/dist/_esm5.processed/compat/eme/custom_media_keys/old_webkit_media_keys.js +53 -34
  11. package/dist/_esm5.processed/compat/eme/custom_media_keys/webkit_media_keys.js +43 -41
  12. package/dist/_esm5.processed/compat/eme/generate_key_request.d.ts +2 -3
  13. package/dist/_esm5.processed/compat/eme/generate_key_request.js +22 -26
  14. package/dist/_esm5.processed/compat/eme/load_session.d.ts +1 -2
  15. package/dist/_esm5.processed/compat/eme/load_session.js +68 -17
  16. package/dist/_esm5.processed/compat/event_listeners.js +2 -1
  17. package/dist/_esm5.processed/compat/should_favour_custom_safari_EME.js +2 -2
  18. package/dist/_esm5.processed/config.d.ts +166 -1080
  19. package/dist/_esm5.processed/config.js +17 -1119
  20. package/dist/_esm5.processed/core/abr/bandwidth_estimator.js +4 -1
  21. package/dist/_esm5.processed/core/abr/network_analyzer.js +2 -1
  22. package/dist/_esm5.processed/core/api/get_player_state.js +1 -1
  23. package/dist/_esm5.processed/core/api/index.d.ts +2 -1
  24. package/dist/_esm5.processed/core/api/media_element_track_choice_manager.js +2 -1
  25. package/dist/_esm5.processed/core/api/option_utils.d.ts +3 -1
  26. package/dist/_esm5.processed/core/api/option_utils.js +19 -6
  27. package/dist/_esm5.processed/core/api/playback_observer.js +5 -1
  28. package/dist/_esm5.processed/core/api/public_api.d.ts +82 -71
  29. package/dist/_esm5.processed/core/api/public_api.js +72 -33
  30. package/dist/_esm5.processed/core/{eme → decrypt}/__tests__/__global__/utils.d.ts +7 -49
  31. package/dist/_esm5.processed/core/{eme → decrypt}/__tests__/__global__/utils.js +25 -65
  32. package/dist/_esm5.processed/core/{eme → decrypt}/attach_media_keys.d.ts +12 -12
  33. package/dist/_esm5.processed/core/decrypt/attach_media_keys.js +104 -0
  34. package/dist/_esm5.processed/core/{eme/clear_eme_session.d.ts → decrypt/clear_on_stop.d.ts} +3 -4
  35. package/dist/_esm5.processed/core/decrypt/clear_on_stop.js +41 -0
  36. package/dist/_esm5.processed/core/decrypt/content_decryptor.d.ts +216 -0
  37. package/dist/_esm5.processed/core/decrypt/content_decryptor.js +866 -0
  38. package/dist/_esm5.processed/core/{eme/get_session.d.ts → decrypt/create_or_load_session.d.ts} +28 -26
  39. package/dist/_esm5.processed/core/decrypt/create_or_load_session.js +124 -0
  40. package/dist/_esm5.processed/core/{eme → decrypt}/create_session.d.ts +22 -19
  41. package/dist/_esm5.processed/core/decrypt/create_session.js +174 -0
  42. package/dist/_esm5.processed/core/decrypt/dispose_decryption_resources.d.ts +21 -0
  43. package/dist/_esm5.processed/core/decrypt/dispose_decryption_resources.js +81 -0
  44. package/dist/_esm5.processed/core/{eme → decrypt}/find_key_system.d.ts +11 -14
  45. package/dist/_esm5.processed/core/decrypt/find_key_system.js +300 -0
  46. package/dist/_esm5.processed/core/{eme → decrypt}/get_current_key_system.d.ts +0 -0
  47. package/dist/_esm5.processed/core/{eme → decrypt}/get_current_key_system.js +1 -1
  48. package/dist/_esm5.processed/core/{eme → decrypt}/get_media_keys.d.ts +13 -5
  49. package/dist/_esm5.processed/core/decrypt/get_media_keys.js +153 -0
  50. package/dist/_esm5.processed/core/{eme → decrypt}/index.d.ts +5 -6
  51. package/dist/_esm5.processed/core/{eme → decrypt}/index.js +5 -5
  52. package/dist/_esm5.processed/core/{eme → decrypt}/init_media_keys.d.ts +6 -4
  53. package/dist/_esm5.processed/core/decrypt/init_media_keys.js +82 -0
  54. package/dist/_esm5.processed/core/decrypt/session_events_listener.d.ts +77 -0
  55. package/dist/_esm5.processed/core/{eme → decrypt}/session_events_listener.js +25 -24
  56. package/dist/_esm5.processed/core/{eme → decrypt}/set_server_certificate.d.ts +15 -6
  57. package/dist/_esm5.processed/core/decrypt/set_server_certificate.js +141 -0
  58. package/dist/_esm5.processed/core/{eme → decrypt}/types.d.ts +119 -241
  59. package/dist/_esm5.processed/core/{eme → decrypt}/types.js +0 -0
  60. package/dist/_esm5.processed/core/{eme → decrypt}/utils/are_init_values_compatible.d.ts +3 -3
  61. package/dist/_esm5.processed/core/{eme → decrypt}/utils/are_init_values_compatible.js +5 -5
  62. package/dist/_esm5.processed/core/{eme → decrypt/utils}/check_key_statuses.d.ts +2 -2
  63. package/dist/_esm5.processed/core/{eme → decrypt/utils}/check_key_statuses.js +4 -3
  64. package/dist/_esm5.processed/core/{eme/utils/close_session.d.ts → decrypt/utils/clean_old_loaded_sessions.d.ts} +8 -7
  65. package/dist/_esm5.processed/core/decrypt/utils/clean_old_loaded_sessions.js +85 -0
  66. package/dist/_esm5.processed/core/{eme → decrypt/utils}/clean_old_stored_persistent_info.d.ts +1 -1
  67. package/dist/_esm5.processed/core/{eme → decrypt/utils}/clean_old_stored_persistent_info.js +2 -2
  68. package/dist/_esm5.processed/core/{eme → decrypt/utils}/get_drm_system_id.d.ts +0 -0
  69. package/dist/_esm5.processed/core/{eme → decrypt/utils}/get_drm_system_id.js +1 -1
  70. package/dist/_esm5.processed/core/decrypt/utils/init_data_values_container.d.ts +69 -0
  71. package/dist/_esm5.processed/core/decrypt/utils/init_data_values_container.js +99 -0
  72. package/dist/_esm5.processed/core/{eme → decrypt}/utils/is_session_usable.d.ts +0 -1
  73. package/dist/_esm5.processed/core/{eme → decrypt}/utils/is_session_usable.js +4 -5
  74. package/dist/_esm5.processed/core/decrypt/utils/key_id_comparison.d.ts +44 -0
  75. package/dist/_esm5.processed/core/decrypt/utils/key_id_comparison.js +77 -0
  76. package/dist/_esm5.processed/core/decrypt/utils/key_session_record.d.ts +104 -0
  77. package/dist/_esm5.processed/core/decrypt/utils/key_session_record.js +155 -0
  78. package/dist/_esm5.processed/core/decrypt/utils/loaded_sessions_store.d.ts +108 -0
  79. package/dist/_esm5.processed/core/decrypt/utils/loaded_sessions_store.js +303 -0
  80. package/dist/_esm5.processed/core/{eme → decrypt/utils}/media_keys_infos_store.d.ts +4 -4
  81. package/dist/_esm5.processed/core/{eme → decrypt/utils}/media_keys_infos_store.js +0 -0
  82. package/dist/_esm5.processed/core/{eme → decrypt}/utils/persistent_sessions_store.d.ts +8 -18
  83. package/dist/_esm5.processed/core/{eme → decrypt}/utils/persistent_sessions_store.js +119 -97
  84. package/dist/_esm5.processed/core/{eme/utils/init_data_container.d.ts → decrypt/utils/serializable_bytes.d.ts} +8 -5
  85. package/dist/_esm5.processed/core/{eme/utils/init_data_container.js → decrypt/utils/serializable_bytes.js} +9 -9
  86. package/dist/_esm5.processed/core/{eme → decrypt/utils}/server_certificate_store.d.ts +1 -1
  87. package/dist/_esm5.processed/core/{eme → decrypt/utils}/server_certificate_store.js +1 -1
  88. package/dist/_esm5.processed/core/fetchers/manifest/manifest_fetcher.js +2 -2
  89. package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.js +1 -1
  90. package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher_creator.js +1 -1
  91. package/dist/_esm5.processed/core/init/get_initial_time.js +1 -1
  92. package/dist/_esm5.processed/core/init/initialize_directfile.d.ts +1 -1
  93. package/dist/_esm5.processed/core/init/initialize_directfile.js +11 -17
  94. package/dist/_esm5.processed/core/init/initialize_media_source.d.ts +4 -2
  95. package/dist/_esm5.processed/core/init/initialize_media_source.js +18 -69
  96. package/dist/_esm5.processed/core/init/link_drm_and_content.d.ts +61 -0
  97. package/dist/_esm5.processed/core/init/link_drm_and_content.js +94 -0
  98. package/dist/_esm5.processed/core/init/manifest_update_scheduler.js +2 -1
  99. package/dist/_esm5.processed/core/init/stall_avoider.js +1 -1
  100. package/dist/_esm5.processed/core/init/stream_events_emitter/stream_events_emitter.js +1 -1
  101. package/dist/_esm5.processed/core/init/types.d.ts +2 -4
  102. package/dist/_esm5.processed/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.js +1 -1
  103. package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/html_text_segment_buffer.js +3 -1
  104. package/dist/_esm5.processed/core/segment_buffers/inventory/segment_inventory.d.ts +17 -1
  105. package/dist/_esm5.processed/core/segment_buffers/inventory/segment_inventory.js +22 -5
  106. package/dist/_esm5.processed/core/stream/adaptation/adaptation_stream.d.ts +2 -1
  107. package/dist/_esm5.processed/core/stream/adaptation/adaptation_stream.js +6 -3
  108. package/dist/_esm5.processed/core/stream/events_generators.d.ts +8 -3
  109. package/dist/_esm5.processed/core/stream/events_generators.js +3 -2
  110. package/dist/_esm5.processed/core/stream/orchestrator/stream_orchestrator.d.ts +1 -0
  111. package/dist/_esm5.processed/core/stream/orchestrator/stream_orchestrator.js +3 -3
  112. package/dist/_esm5.processed/core/stream/period/create_empty_adaptation_stream.js +2 -1
  113. package/dist/_esm5.processed/core/stream/period/get_adaptation_switch_strategy.js +1 -1
  114. package/dist/_esm5.processed/core/stream/period/period_stream.d.ts +2 -1
  115. package/dist/_esm5.processed/core/stream/period/period_stream.js +3 -3
  116. package/dist/_esm5.processed/core/stream/representation/force_garbage_collection.js +2 -2
  117. package/dist/_esm5.processed/core/stream/representation/get_buffer_status.d.ts +6 -1
  118. package/dist/_esm5.processed/core/stream/representation/get_buffer_status.js +12 -9
  119. package/dist/_esm5.processed/core/stream/representation/get_needed_segments.d.ts +19 -14
  120. package/dist/_esm5.processed/core/stream/representation/get_needed_segments.js +86 -10
  121. package/dist/_esm5.processed/core/stream/representation/get_segment_priority.js +1 -1
  122. package/dist/_esm5.processed/core/stream/representation/push_media_segment.js +3 -3
  123. package/dist/_esm5.processed/core/stream/representation/representation_stream.d.ts +6 -0
  124. package/dist/_esm5.processed/core/stream/representation/representation_stream.js +19 -8
  125. package/dist/_esm5.processed/core/stream/types.d.ts +1 -1
  126. package/dist/_esm5.processed/default_config.d.ts +1114 -0
  127. package/dist/_esm5.processed/default_config.js +1145 -0
  128. package/dist/_esm5.processed/experimental/index.d.ts +2 -0
  129. package/dist/_esm5.processed/experimental/index.js +2 -0
  130. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/push_data.d.ts +1 -0
  131. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/thumbnail_loader.js +1 -1
  132. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/DRMInfos.js +1 -2
  133. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/HDCPPolicy.js +1 -2
  134. package/dist/_esm5.processed/features/features_object.js +1 -1
  135. package/dist/_esm5.processed/features/initialize_features.js +1 -1
  136. package/dist/_esm5.processed/features/list/eme.d.ts +3 -3
  137. package/dist/_esm5.processed/features/list/eme.js +5 -5
  138. package/dist/_esm5.processed/features/types.d.ts +3 -3
  139. package/dist/_esm5.processed/manifest/manifest.d.ts +1 -14
  140. package/dist/_esm5.processed/manifest/manifest.js +10 -74
  141. package/dist/_esm5.processed/manifest/representation.d.ts +35 -3
  142. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/is_period_fulfilled.js +1 -2
  143. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/template.js +1 -2
  144. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.js +1 -1
  145. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_adaptation_sets.js +87 -75
  146. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_mpd.js +1 -2
  147. package/dist/_esm5.processed/parsers/manifest/smooth/create_parser.js +1 -0
  148. package/dist/_esm5.processed/public_types.d.ts +2 -2
  149. package/dist/_esm5.processed/transports/dash/image_pipelines.js +3 -0
  150. package/dist/_esm5.processed/transports/dash/segment_parser.js +6 -3
  151. package/dist/_esm5.processed/transports/dash/text_parser.js +8 -2
  152. package/dist/_esm5.processed/transports/local/segment_parser.js +4 -1
  153. package/dist/_esm5.processed/transports/local/text_parser.js +8 -2
  154. package/dist/_esm5.processed/transports/smooth/pipelines.js +68 -10
  155. package/dist/_esm5.processed/transports/types.d.ts +22 -0
  156. package/dist/_esm5.processed/utils/deep_merge.d.ts +12 -0
  157. package/dist/_esm5.processed/utils/deep_merge.js +53 -0
  158. package/dist/_esm5.processed/utils/reference.d.ts +29 -0
  159. package/dist/_esm5.processed/utils/reference.js +72 -24
  160. package/dist/_esm5.processed/utils/request/fetch.js +1 -2
  161. package/dist/_esm5.processed/utils/request/xhr.js +1 -1
  162. package/dist/_esm5.processed/utils/rx-from_cancellable_promise.js +7 -2
  163. package/dist/_esm5.processed/utils/task_canceller.d.ts +5 -3
  164. package/dist/_esm5.processed/utils/task_canceller.js +3 -3
  165. package/dist/rx-player.js +5002 -3033
  166. package/dist/rx-player.min.js +1 -1
  167. package/dummy +1 -0
  168. package/{dist/_esm5.processed/core/eme/dispose_eme.d.ts → experimental/index.d.ts} +1 -4
  169. package/{dist/_esm5.processed/core/eme/dispose_media_keys.d.ts → experimental/index.js} +1 -6
  170. package/package.json +32 -34
  171. package/scripts/build/templates/experimental/index.d.ts +16 -0
  172. package/scripts/build/templates/experimental/index.js +16 -0
  173. package/sonar-project.properties +1 -1
  174. package/src/README.md +6 -6
  175. package/src/compat/__tests__/should_favour_custom_safari_EME.test.ts +45 -5
  176. package/src/compat/browser_detection.ts +4 -2
  177. package/src/compat/eme/close_session.ts +90 -56
  178. package/src/compat/eme/custom_media_keys/index.ts +21 -38
  179. package/src/compat/eme/custom_media_keys/old_webkit_media_keys.ts +63 -46
  180. package/src/compat/eme/custom_media_keys/webkit_media_keys.ts +51 -49
  181. package/src/compat/eme/generate_key_request.ts +25 -33
  182. package/src/compat/eme/load_session.ts +29 -31
  183. package/src/compat/event_listeners.ts +2 -1
  184. package/src/compat/should_favour_custom_safari_EME.ts +5 -2
  185. package/src/config.ts +17 -1210
  186. package/src/core/README.md +1 -1
  187. package/src/core/abr/bandwidth_estimator.ts +4 -4
  188. package/src/core/abr/network_analyzer.ts +5 -6
  189. package/src/core/api/__tests__/get_player_state.test.ts +3 -3
  190. package/src/core/api/__tests__/option_utils.test.ts +17 -17
  191. package/src/core/api/get_player_state.ts +1 -1
  192. package/src/core/api/index.ts +3 -0
  193. package/src/core/api/option_utils.ts +37 -20
  194. package/src/core/api/playback_observer.ts +12 -8
  195. package/src/core/api/public_api.ts +151 -111
  196. package/src/core/decrypt/README.md +22 -0
  197. package/src/core/decrypt/__tests__/__global__/get_license.test.ts +418 -0
  198. package/src/core/decrypt/__tests__/__global__/init_data.test.ts +675 -0
  199. package/src/core/{eme → decrypt}/__tests__/__global__/media_key_system_access.test.ts +99 -92
  200. package/src/core/decrypt/__tests__/__global__/media_keys.test.ts +156 -0
  201. package/src/core/decrypt/__tests__/__global__/server_certificate.test.ts +262 -0
  202. package/src/core/{eme → decrypt}/__tests__/__global__/utils.ts +31 -93
  203. package/src/core/{eme → decrypt}/attach_media_keys.ts +49 -56
  204. package/src/core/decrypt/clear_on_stop.ts +48 -0
  205. package/src/core/decrypt/content_decryptor.ts +1158 -0
  206. package/src/core/decrypt/create_or_load_session.ts +130 -0
  207. package/src/core/decrypt/create_session.ts +175 -0
  208. package/src/core/decrypt/dispose_decryption_resources.ts +39 -0
  209. package/src/core/{eme → decrypt}/find_key_system.ts +112 -122
  210. package/src/core/{eme → decrypt}/get_current_key_system.ts +1 -1
  211. package/src/core/decrypt/get_media_keys.ts +145 -0
  212. package/src/core/{eme → decrypt}/index.ts +11 -8
  213. package/src/core/decrypt/init_media_keys.ts +51 -0
  214. package/src/core/{eme → decrypt}/session_events_listener.ts +93 -55
  215. package/src/core/decrypt/set_server_certificate.ts +104 -0
  216. package/src/core/{eme → decrypt}/types.ts +128 -258
  217. package/src/core/{eme → decrypt}/utils/__tests__/are_init_values_compatible.test.ts +1 -1
  218. package/src/core/{eme → decrypt/utils}/__tests__/clean_old_loaded_sessions.test.ts +29 -71
  219. package/src/core/{eme → decrypt/utils}/__tests__/clean_old_stored_persistent_info.test.ts +6 -6
  220. package/src/core/{eme → decrypt}/utils/are_init_values_compatible.ts +9 -9
  221. package/src/core/{eme → decrypt/utils}/check_key_statuses.ts +6 -5
  222. package/{dist/_esm5.processed/core/eme/clean_old_loaded_sessions.js → src/core/decrypt/utils/clean_old_loaded_sessions.ts} +20 -20
  223. package/src/core/{eme → decrypt/utils}/clean_old_stored_persistent_info.ts +3 -3
  224. package/src/core/{eme → decrypt/utils}/get_drm_system_id.ts +1 -1
  225. package/src/core/decrypt/utils/init_data_values_container.ts +119 -0
  226. package/src/core/{eme → decrypt}/utils/is_session_usable.ts +4 -5
  227. package/src/core/decrypt/utils/key_id_comparison.ts +82 -0
  228. package/src/core/decrypt/utils/key_session_record.ts +175 -0
  229. package/src/core/decrypt/utils/loaded_sessions_store.ts +318 -0
  230. package/src/core/{eme → decrypt/utils}/media_keys_infos_store.ts +4 -4
  231. package/src/core/{eme → decrypt}/utils/persistent_sessions_store.ts +122 -104
  232. package/src/core/{eme/utils/init_data_container.ts → decrypt/utils/serializable_bytes.ts} +8 -5
  233. package/src/core/{eme → decrypt/utils}/server_certificate_store.ts +2 -2
  234. package/src/core/fetchers/manifest/manifest_fetcher.ts +4 -4
  235. package/src/core/fetchers/segment/segment_fetcher.ts +4 -4
  236. package/src/core/fetchers/segment/segment_fetcher_creator.ts +2 -2
  237. package/src/core/init/.initialize_media_source.ts.un~ +0 -0
  238. package/src/core/init/get_initial_time.ts +2 -1
  239. package/src/core/init/initialize_directfile.ts +17 -20
  240. package/src/core/init/initialize_media_source.ts +42 -105
  241. package/src/core/init/link_drm_and_content.ts +176 -0
  242. package/src/core/init/manifest_update_scheduler.ts +5 -3
  243. package/src/core/init/stall_avoider.ts +6 -5
  244. package/src/core/init/stream_events_emitter/stream_events_emitter.ts +2 -1
  245. package/src/core/init/types.ts +1 -39
  246. package/src/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.ts +2 -1
  247. package/src/core/segment_buffers/implementations/text/html/html_text_segment_buffer.ts +3 -4
  248. package/src/core/segment_buffers/inventory/segment_inventory.ts +42 -8
  249. package/src/core/stream/adaptation/adaptation_stream.ts +7 -1
  250. package/src/core/stream/events_generators.ts +9 -4
  251. package/src/core/stream/orchestrator/stream_orchestrator.ts +9 -4
  252. package/src/core/stream/period/create_empty_adaptation_stream.ts +2 -1
  253. package/src/core/stream/period/get_adaptation_switch_strategy.ts +1 -1
  254. package/src/core/stream/period/period_stream.ts +5 -2
  255. package/src/core/stream/representation/force_garbage_collection.ts +2 -2
  256. package/src/core/stream/representation/get_buffer_status.ts +28 -16
  257. package/src/core/stream/representation/get_needed_segments.ts +124 -28
  258. package/src/core/stream/representation/get_segment_priority.ts +1 -2
  259. package/src/core/stream/representation/push_media_segment.ts +3 -2
  260. package/src/core/stream/representation/representation_stream.ts +30 -7
  261. package/src/core/stream/types.ts +1 -1
  262. package/src/default_config.ts +1241 -0
  263. package/src/experimental/index.ts +5 -0
  264. package/src/experimental/tools/VideoThumbnailLoader/push_data.ts +1 -0
  265. package/src/experimental/tools/VideoThumbnailLoader/thumbnail_loader.ts +2 -1
  266. package/src/experimental/tools/mediaCapabilitiesProber/__tests__/probers/DRMInfos.test.ts +3 -10
  267. package/src/experimental/tools/mediaCapabilitiesProber/__tests__/probers/HDCPPolicy.test.ts +4 -4
  268. package/src/experimental/tools/mediaCapabilitiesProber/probers/DRMInfos.ts +1 -2
  269. package/src/experimental/tools/mediaCapabilitiesProber/probers/HDCPPolicy.ts +1 -2
  270. package/src/features/__tests__/initialize_features.test.ts +2 -2
  271. package/src/features/features_object.ts +1 -1
  272. package/src/features/initialize_features.ts +1 -1
  273. package/src/features/list/__tests__/eme.test.ts +5 -5
  274. package/src/features/list/eme.ts +5 -5
  275. package/src/features/types.ts +3 -10
  276. package/src/manifest/manifest.ts +6 -76
  277. package/src/manifest/representation.ts +36 -3
  278. package/src/parsers/manifest/dash/common/indexes/is_period_fulfilled.ts +1 -2
  279. package/src/parsers/manifest/dash/common/indexes/template.ts +1 -2
  280. package/src/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.ts +1 -1
  281. package/src/parsers/manifest/dash/common/parse_adaptation_sets.ts +109 -64
  282. package/src/parsers/manifest/dash/common/parse_mpd.ts +1 -2
  283. package/src/parsers/manifest/smooth/create_parser.ts +1 -0
  284. package/src/parsers/texttracks/webvtt/html/__tests__/create_styled_element.test.ts +1 -0
  285. package/src/public_types.ts +5 -1
  286. package/src/transports/dash/image_pipelines.ts +3 -0
  287. package/src/transports/dash/segment_parser.ts +5 -0
  288. package/src/transports/dash/text_parser.ts +8 -0
  289. package/src/transports/local/segment_parser.ts +4 -0
  290. package/src/transports/local/text_parser.ts +8 -0
  291. package/src/transports/smooth/pipelines.ts +22 -9
  292. package/src/transports/types.ts +22 -0
  293. package/src/utils/__tests__/deep_merge.test.ts +48 -0
  294. package/src/utils/deep_merge.ts +46 -0
  295. package/src/utils/reference.ts +116 -23
  296. package/src/utils/request/fetch.ts +1 -2
  297. package/src/utils/request/xhr.ts +2 -1
  298. package/src/utils/rx-from_cancellable_promise.ts +7 -2
  299. package/src/utils/task_canceller.ts +6 -4
  300. package/dist/_esm5.processed/core/eme/attach_media_keys.js +0 -57
  301. package/dist/_esm5.processed/core/eme/clean_old_loaded_sessions.d.ts +0 -59
  302. package/dist/_esm5.processed/core/eme/clear_eme_session.js +0 -50
  303. package/dist/_esm5.processed/core/eme/create_session.js +0 -126
  304. package/dist/_esm5.processed/core/eme/dispose_eme.js +0 -23
  305. package/dist/_esm5.processed/core/eme/dispose_media_keys.js +0 -36
  306. package/dist/_esm5.processed/core/eme/eme_manager.d.ts +0 -31
  307. package/dist/_esm5.processed/core/eme/eme_manager.js +0 -278
  308. package/dist/_esm5.processed/core/eme/find_key_system.js +0 -253
  309. package/dist/_esm5.processed/core/eme/get_media_keys.js +0 -85
  310. package/dist/_esm5.processed/core/eme/get_session.js +0 -68
  311. package/dist/_esm5.processed/core/eme/init_media_keys.js +0 -66
  312. package/dist/_esm5.processed/core/eme/session_events_listener.d.ts +0 -41
  313. package/dist/_esm5.processed/core/eme/set_server_certificate.js +0 -85
  314. package/dist/_esm5.processed/core/eme/utils/close_session.js +0 -81
  315. package/dist/_esm5.processed/core/eme/utils/init_data_store.d.ts +0 -115
  316. package/dist/_esm5.processed/core/eme/utils/init_data_store.js +0 -181
  317. package/dist/_esm5.processed/core/eme/utils/loaded_sessions_store.d.ts +0 -123
  318. package/dist/_esm5.processed/core/eme/utils/loaded_sessions_store.js +0 -173
  319. package/dist/_esm5.processed/core/init/create_eme_manager.d.ts +0 -34
  320. package/dist/_esm5.processed/core/init/create_eme_manager.js +0 -52
  321. package/src/core/eme/README.md +0 -26
  322. package/src/core/eme/__tests__/__global__/get_license.test.ts +0 -414
  323. package/src/core/eme/__tests__/__global__/init_data.test.ts +0 -908
  324. package/src/core/eme/__tests__/__global__/media_keys.test.ts +0 -266
  325. package/src/core/eme/__tests__/__global__/server_certificate.test.ts +0 -364
  326. package/src/core/eme/__tests__/init_media_keys.test.ts +0 -182
  327. package/src/core/eme/clean_old_loaded_sessions.ts +0 -96
  328. package/src/core/eme/clear_eme_session.ts +0 -62
  329. package/src/core/eme/create_session.ts +0 -187
  330. package/src/core/eme/dispose_eme.ts +0 -25
  331. package/src/core/eme/dispose_media_keys.ts +0 -46
  332. package/src/core/eme/eme_manager.ts +0 -387
  333. package/src/core/eme/get_media_keys.ts +0 -141
  334. package/src/core/eme/get_session.ts +0 -135
  335. package/src/core/eme/init_media_keys.ts +0 -106
  336. package/src/core/eme/set_server_certificate.ts +0 -115
  337. package/src/core/eme/utils/close_session.ts +0 -113
  338. package/src/core/eme/utils/init_data_store.ts +0 -234
  339. package/src/core/eme/utils/loaded_sessions_store.ts +0 -235
  340. package/src/core/init/create_eme_manager.ts +0 -95
@@ -16,12 +16,13 @@
16
16
  import log from "../../../log";
17
17
  import areArraysOfNumbersEqual from "../../../utils/are_arrays_of_numbers_equal";
18
18
  import { assertInterface } from "../../../utils/assert";
19
- import { base64ToBytes, bytesToBase64, } from "../../../utils/base64";
20
- import { concat } from "../../../utils/byte_parsing";
19
+ import { bytesToBase64 } from "../../../utils/base64";
21
20
  import hashBuffer from "../../../utils/hash_buffer";
22
21
  import isNonEmptyString from "../../../utils/is_non_empty_string";
23
22
  import isNullOrUndefined from "../../../utils/is_null_or_undefined";
24
23
  import areInitializationValuesCompatible from "./are_init_values_compatible";
24
+ import { areKeyIdsEqual } from "./key_id_comparison";
25
+ import SerializableBytes from "./serializable_bytes";
25
26
  /**
26
27
  * Throw if the given storage does not respect the right interface.
27
28
  * @param {Object} storage
@@ -29,37 +30,6 @@ import areInitializationValuesCompatible from "./are_init_values_compatible";
29
30
  function checkStorage(storage) {
30
31
  assertInterface(storage, { save: "function", load: "function" }, "licenseStorage");
31
32
  }
32
- /** Wrap initialization data and allow serialization of it into base64. */
33
- var InitDataContainer = /** @class */ (function () {
34
- /**
35
- * Create a new container, wrapping the initialization data given and allowing
36
- * linearization into base64.
37
- * @param {Uint8Array}
38
- */
39
- function InitDataContainer(initData) {
40
- this.initData = initData;
41
- }
42
- /**
43
- * Convert it to base64.
44
- * `toJSON` is specially interpreted by JavaScript engines to be able to rely
45
- * on it when calling `JSON.stringify` on it or any of its parent objects:
46
- * https://tc39.es/ecma262/#sec-serializejsonproperty
47
- * @returns {string}
48
- */
49
- InitDataContainer.prototype.toJSON = function () {
50
- return bytesToBase64(this.initData);
51
- };
52
- /**
53
- * Decode a base64 sequence representing an initialization data back to an
54
- * Uint8Array.
55
- * @param {string}
56
- * @returns {Uint8Array}
57
- */
58
- InitDataContainer.decode = function (base64) {
59
- return base64ToBytes(base64);
60
- };
61
- return InitDataContainer;
62
- }());
63
33
  /**
64
34
  * Set representing persisted licenses. Depends on a simple local-
65
35
  * storage implementation with a `save`/`load` synchronous interface
@@ -79,13 +49,14 @@ var PersistentSessionsStore = /** @class */ (function () {
79
49
  this._entries = [];
80
50
  this._storage = storage;
81
51
  try {
82
- this._entries = this._storage.load();
83
- if (!Array.isArray(this._entries)) {
84
- this._entries = [];
52
+ var entries = this._storage.load();
53
+ if (!Array.isArray(entries)) {
54
+ entries = [];
85
55
  }
56
+ this._entries = entries;
86
57
  }
87
58
  catch (e) {
88
- log.warn("EME-PSS: Could not get entries from license storage", e);
59
+ log.warn("DRM-PSS: Could not get entries from license storage", e);
89
60
  this.dispose();
90
61
  }
91
62
  }
@@ -106,7 +77,7 @@ var PersistentSessionsStore = /** @class */ (function () {
106
77
  };
107
78
  /**
108
79
  * Retrieve an entry based on its initialization data.
109
- * @param {Uint8Array} initData
80
+ * @param {Object} initData
110
81
  * @param {string|undefined} initDataType
111
82
  * @returns {Object|null}
112
83
  */
@@ -141,9 +112,9 @@ var PersistentSessionsStore = /** @class */ (function () {
141
112
  * @param {string|undefined} initDataType
142
113
  * @param {MediaKeySession} session
143
114
  */
144
- PersistentSessionsStore.prototype.add = function (initData, session) {
115
+ PersistentSessionsStore.prototype.add = function (initData, keyIds, session) {
145
116
  if (isNullOrUndefined(session) || !isNonEmptyString(session.sessionId)) {
146
- log.warn("EME-PSS: Invalid Persisten Session given.");
117
+ log.warn("DRM-PSS: Invalid Persisten Session given.");
147
118
  return;
148
119
  }
149
120
  var sessionId = session.sessionId;
@@ -152,32 +123,46 @@ var PersistentSessionsStore = /** @class */ (function () {
152
123
  return;
153
124
  }
154
125
  else if (currentEntry !== null) { // currentEntry has a different sessionId
155
- this.delete(initData);
126
+ this.delete(currentEntry.sessionId);
127
+ }
128
+ log.info("DRM-PSS: Add new session", sessionId);
129
+ var storedValues = prepareValuesForStore(initData.values.getFormattedValues());
130
+ if (keyIds === undefined) {
131
+ this._entries.push({ version: 3, sessionId: sessionId, values: storedValues,
132
+ initDataType: initData.type });
133
+ }
134
+ else {
135
+ this._entries.push({ version: 4, sessionId: sessionId, keyIds: keyIds.map(function (k) { return new SerializableBytes(k); }),
136
+ values: storedValues,
137
+ initDataType: initData.type });
156
138
  }
157
- log.info("EME-PSS: Add new session", sessionId);
158
- this._entries.push({ version: 3, sessionId: sessionId, values: this._formatValuesForStore(initData.values),
159
- initDataType: initData.type });
160
139
  this._save();
161
140
  };
162
141
  /**
163
- * Delete stored MediaKeySession information based on its initialization
164
- * data.
142
+ * Delete stored MediaKeySession information based on its session id.
165
143
  * @param {Uint8Array} initData
166
144
  * @param {string|undefined} initDataType
167
145
  */
168
- PersistentSessionsStore.prototype.delete = function (initData) {
169
- var index = this._getIndex(initData);
146
+ PersistentSessionsStore.prototype.delete = function (sessionId) {
147
+ var index = -1;
148
+ for (var i = 0; i < this._entries.length; i++) {
149
+ var entry_1 = this._entries[i];
150
+ if (entry_1.sessionId === sessionId) {
151
+ index = i;
152
+ break;
153
+ }
154
+ }
170
155
  if (index === -1) {
171
- log.warn("EME-PSS: initData to delete not found.");
156
+ log.warn("DRM-PSS: initData to delete not found.");
172
157
  return;
173
158
  }
174
159
  var entry = this._entries[index];
175
- log.warn("EME-PSS: Delete session from store", entry.sessionId);
160
+ log.warn("DRM-PSS: Delete session from store", entry.sessionId);
176
161
  this._entries.splice(index, 1);
177
162
  this._save();
178
163
  };
179
164
  PersistentSessionsStore.prototype.deleteOldSessions = function (sessionsToDelete) {
180
- log.info("EME-PSS: Deleting last ".concat(sessionsToDelete, " sessions."));
165
+ log.info("DRM-PSS: Deleting last ".concat(sessionsToDelete, " sessions."));
181
166
  if (sessionsToDelete <= 0) {
182
167
  return;
183
168
  }
@@ -185,7 +170,7 @@ var PersistentSessionsStore = /** @class */ (function () {
185
170
  this._entries.splice(0, sessionsToDelete);
186
171
  }
187
172
  else {
188
- log.warn("EME-PSS: Asked to remove more information that it contains", sessionsToDelete, this._entries.length);
173
+ log.warn("DRM-PSS: Asked to remove more information that it contains", sessionsToDelete, this._entries.length);
189
174
  this._entries = [];
190
175
  }
191
176
  this._save();
@@ -200,60 +185,103 @@ var PersistentSessionsStore = /** @class */ (function () {
200
185
  /**
201
186
  * Retrieve index of an entry.
202
187
  * Returns `-1` if not found.
203
- * @param {Uint8Array} initData
204
- * @param {string|undefined} initDataType
188
+ * @param {Object} initData
205
189
  * @returns {number}
206
190
  */
207
191
  PersistentSessionsStore.prototype._getIndex = function (initData) {
208
- var formatted = this._formatValuesForStore(initData.values);
209
192
  // Older versions of the format include a concatenation of all
210
193
  // initialization data and its hash.
211
- var concatInitData = concat.apply(void 0, initData.values.map(function (i) { return i.data; }));
212
- var concatInitDataHash = hashBuffer(concatInitData);
213
- for (var i = 0; i < this._entries.length; i++) {
214
- var entry = this._entries[i];
194
+ // This is only computed lazily, the first time it is needed.
195
+ var lazyConcatenatedData = null;
196
+ function getConcatenatedInitDataInfo() {
197
+ if (lazyConcatenatedData === null) {
198
+ var concatInitData = initData.values.constructRequestData();
199
+ lazyConcatenatedData = { initData: concatInitData,
200
+ initDataHash: hashBuffer(concatInitData) };
201
+ }
202
+ return lazyConcatenatedData;
203
+ }
204
+ var _loop_1 = function (i) {
205
+ var entry = this_1._entries[i];
215
206
  if (entry.initDataType === initData.type) {
216
207
  switch (entry.version) {
208
+ case 4:
209
+ if (initData.keyIds !== undefined) {
210
+ var foundCompatible = initData.keyIds.every(function (keyId) {
211
+ var keyIdB64 = bytesToBase64(keyId);
212
+ for (var _i = 0, _a = entry.keyIds; _i < _a.length; _i++) {
213
+ var entryKid = _a[_i];
214
+ if (typeof entryKid === "string") {
215
+ if (keyIdB64 === entryKid) {
216
+ return true;
217
+ }
218
+ }
219
+ else if (areKeyIdsEqual(entryKid.initData, keyId)) {
220
+ return true;
221
+ }
222
+ }
223
+ return false;
224
+ });
225
+ if (foundCompatible) {
226
+ return { value: i };
227
+ }
228
+ }
229
+ else {
230
+ var formatted_1 = initData.values.getFormattedValues();
231
+ if (areInitializationValuesCompatible(formatted_1, entry.values)) {
232
+ return { value: i };
233
+ }
234
+ }
235
+ break;
217
236
  case 3:
237
+ var formatted = initData.values.getFormattedValues();
218
238
  if (areInitializationValuesCompatible(formatted, entry.values)) {
219
- return i;
239
+ return { value: i };
220
240
  }
221
241
  break;
222
- case 2:
223
- if (entry.initDataHash === concatInitDataHash) {
242
+ case 2: {
243
+ var _a = getConcatenatedInitDataInfo(), concatInitData = _a.initData, concatHash = _a.initDataHash;
244
+ if (entry.initDataHash === concatHash) {
224
245
  try {
225
246
  var decodedInitData = typeof entry.initData === "string" ?
226
- InitDataContainer.decode(entry.initData) :
247
+ SerializableBytes.decode(entry.initData) :
227
248
  entry.initData.initData;
228
249
  if (areArraysOfNumbersEqual(decodedInitData, concatInitData)) {
229
- return i;
250
+ return { value: i };
230
251
  }
231
252
  }
232
253
  catch (e) {
233
- log.warn("EME-PSS: Could not decode initialization data.", e);
254
+ log.warn("DRM-PSS: Could not decode initialization data.", e);
234
255
  }
235
256
  }
236
257
  break;
237
- case 1:
238
- if (entry.initDataHash === concatInitDataHash) {
258
+ }
259
+ case 1: {
260
+ var _b = getConcatenatedInitDataInfo(), concatInitData = _b.initData, concatHash = _b.initDataHash;
261
+ if (entry.initDataHash === concatHash) {
239
262
  if (typeof entry.initData.length === "undefined") {
240
- // If length is undefined, it has been linearized. We could still
241
- // convert it back to an Uint8Array but this would necessitate some
242
- // ugly unreadable logic for a very very minor possibility.
243
- // Just consider that it is a match based on the hash.
244
- return i;
263
+ return { value: i };
245
264
  }
246
265
  else if (areArraysOfNumbersEqual(entry.initData, concatInitData)) {
247
- return i;
266
+ return { value: i };
248
267
  }
249
268
  }
250
269
  break;
251
- default:
252
- if (entry.initData === concatInitDataHash) {
253
- return i;
270
+ }
271
+ default: {
272
+ var concatHash = getConcatenatedInitDataInfo().initDataHash;
273
+ if (entry.initData === concatHash) {
274
+ return { value: i };
254
275
  }
276
+ }
255
277
  }
256
278
  }
279
+ };
280
+ var this_1 = this;
281
+ for (var i = 0; i < this._entries.length; i++) {
282
+ var state_1 = _loop_1(i);
283
+ if (typeof state_1 === "object")
284
+ return state_1.value;
257
285
  }
258
286
  return -1;
259
287
  };
@@ -265,29 +293,23 @@ var PersistentSessionsStore = /** @class */ (function () {
265
293
  this._storage.save(this._entries);
266
294
  }
267
295
  catch (e) {
268
- log.warn("EME-PSS: Could not save licenses in localStorage");
296
+ log.warn("DRM-PSS: Could not save licenses in localStorage");
269
297
  }
270
298
  };
271
- /**
272
- * Format given initializationData's values so they are ready to be stored:
273
- * - sort them by systemId, so they are faster to compare
274
- * - add hash for each initialization data encountered.
275
- * @param {Array.<Object>} initialValues
276
- * @returns {Array.<Object>}
277
- */
278
- PersistentSessionsStore.prototype._formatValuesForStore = function (initialValues) {
279
- return initialValues.slice()
280
- .sort(function (a, b) { return a.systemId === b.systemId ? 0 :
281
- a.systemId === undefined ? 1 :
282
- b.systemId === undefined ? -1 :
283
- a.systemId < b.systemId ? -1 :
284
- 1; })
285
- .map(function (_a) {
286
- var systemId = _a.systemId, data = _a.data;
287
- return ({ systemId: systemId, data: new InitDataContainer(data),
288
- hash: hashBuffer(data) });
289
- });
290
- };
291
299
  return PersistentSessionsStore;
292
300
  }());
293
301
  export default PersistentSessionsStore;
302
+ /**
303
+ * Format given initializationData's values so they are ready to be stored:
304
+ * - sort them by systemId, so they are faster to compare
305
+ * - add hash for each initialization data encountered.
306
+ * @param {Array.<Object>} initialValues
307
+ * @returns {Array.<Object>}
308
+ */
309
+ function prepareValuesForStore(initialValues) {
310
+ return initialValues
311
+ .map(function (_a) {
312
+ var systemId = _a.systemId, data = _a.data, hash = _a.hash;
313
+ return ({ systemId: systemId, hash: hash, data: new SerializableBytes(data) });
314
+ });
315
+ }
@@ -13,13 +13,16 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- /** Wrap initialization data and allow serialization of it into base64. */
17
- export default class InitDataContainer {
18
- /** The initData itself. */
16
+ /** Wrap byte-based data and allow serialization of it into base64. */
17
+ export default class SerializableBytes {
18
+ /**
19
+ * The data itself. Named `initData` for legacy reasons (cannot be changed
20
+ * because it has an impact on saved persistent session information.
21
+ */
19
22
  initData: Uint8Array;
20
23
  /**
21
- * Create a new container, wrapping the initialization data given and allowing
22
- * linearization into base64.
24
+ * Create a new `SerializableBytes`, wrapping the initialization data
25
+ * given and allowing serialization into base64.
23
26
  * @param {Uint8Array}
24
27
  */
25
28
  constructor(initData: Uint8Array);
@@ -14,14 +14,14 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { base64ToBytes, bytesToBase64, } from "../../../utils/base64";
17
- /** Wrap initialization data and allow serialization of it into base64. */
18
- var InitDataContainer = /** @class */ (function () {
17
+ /** Wrap byte-based data and allow serialization of it into base64. */
18
+ var SerializableBytes = /** @class */ (function () {
19
19
  /**
20
- * Create a new container, wrapping the initialization data given and allowing
21
- * linearization into base64.
20
+ * Create a new `SerializableBytes`, wrapping the initialization data
21
+ * given and allowing serialization into base64.
22
22
  * @param {Uint8Array}
23
23
  */
24
- function InitDataContainer(initData) {
24
+ function SerializableBytes(initData) {
25
25
  this.initData = initData;
26
26
  }
27
27
  /**
@@ -31,7 +31,7 @@ var InitDataContainer = /** @class */ (function () {
31
31
  * https://tc39.es/ecma262/#sec-serializejsonproperty
32
32
  * @returns {string}
33
33
  */
34
- InitDataContainer.prototype.toJSON = function () {
34
+ SerializableBytes.prototype.toJSON = function () {
35
35
  return bytesToBase64(this.initData);
36
36
  };
37
37
  /**
@@ -40,9 +40,9 @@ var InitDataContainer = /** @class */ (function () {
40
40
  * @param {string}
41
41
  * @returns {Uint8Array}
42
42
  */
43
- InitDataContainer.decode = function (base64) {
43
+ SerializableBytes.decode = function (base64) {
44
44
  return base64ToBytes(base64);
45
45
  };
46
- return InitDataContainer;
46
+ return SerializableBytes;
47
47
  }());
48
- export default InitDataContainer;
48
+ export default SerializableBytes;
@@ -13,7 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { ICustomMediaKeys } from "../../compat";
16
+ import { ICustomMediaKeys } from "../../../compat";
17
17
  declare const _default: {
18
18
  /**
19
19
  * Tells the ServerCertificateStore that you begin to call the APIs to set a
@@ -13,7 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import hashBuffer from "../../utils/hash_buffer";
16
+ import hashBuffer from "../../../utils/hash_buffer";
17
17
  /**
18
18
  * Keep track of server certificate which have been set for a MediaKeys.
19
19
  * As it is impossible for a MediaKeys to have his server certificate reset
@@ -58,7 +58,6 @@ import PPromise from "../../../utils/promise";
58
58
  import TaskCanceller from "../../../utils/task_canceller";
59
59
  import errorSelector from "../utils/error_selector";
60
60
  import { tryRequestPromiseWithBackoff, } from "../utils/try_urls_with_backoff";
61
- var DEFAULT_MAX_MANIFEST_REQUEST_RETRY = config.DEFAULT_MAX_MANIFEST_REQUEST_RETRY, DEFAULT_MAX_REQUESTS_RETRY_ON_OFFLINE = config.DEFAULT_MAX_REQUESTS_RETRY_ON_OFFLINE, INITIAL_BACKOFF_DELAY_BASE = config.INITIAL_BACKOFF_DELAY_BASE, MAX_BACKOFF_DELAY_BASE = config.MAX_BACKOFF_DELAY_BASE;
62
61
  /**
63
62
  * Class allowing to facilitate the task of loading and parsing a Manifest.
64
63
  * @class ManifestFetcher
@@ -318,7 +317,8 @@ var ManifestFetcher = /** @class */ (function () {
318
317
  * @returns {Object}
319
318
  */
320
319
  ManifestFetcher.prototype._getBackoffSetting = function (onRetry) {
321
- var _a = this._settings, lowLatencyMode = _a.lowLatencyMode, ogRegular = _a.maxRetryRegular, ogOffline = _a.maxRetryOffline;
320
+ var _a = config.getCurrent(), DEFAULT_MAX_MANIFEST_REQUEST_RETRY = _a.DEFAULT_MAX_MANIFEST_REQUEST_RETRY, DEFAULT_MAX_REQUESTS_RETRY_ON_OFFLINE = _a.DEFAULT_MAX_REQUESTS_RETRY_ON_OFFLINE, INITIAL_BACKOFF_DELAY_BASE = _a.INITIAL_BACKOFF_DELAY_BASE, MAX_BACKOFF_DELAY_BASE = _a.MAX_BACKOFF_DELAY_BASE;
321
+ var _b = this._settings, lowLatencyMode = _b.lowLatencyMode, ogRegular = _b.maxRetryRegular, ogOffline = _b.maxRetryOffline;
322
322
  var baseDelay = lowLatencyMode ? INITIAL_BACKOFF_DELAY_BASE.LOW_LATENCY :
323
323
  INITIAL_BACKOFF_DELAY_BASE.REGULAR;
324
324
  var maxDelay = lowLatencyMode ? MAX_BACKOFF_DELAY_BASE.LOW_LATENCY :
@@ -26,7 +26,6 @@ import objectAssign from "../../../utils/object_assign";
26
26
  import TaskCanceller from "../../../utils/task_canceller";
27
27
  import errorSelector from "../utils/error_selector";
28
28
  import { tryURLsWithBackoff } from "../utils/try_urls_with_backoff";
29
- var DEFAULT_MAX_REQUESTS_RETRY_ON_ERROR = config.DEFAULT_MAX_REQUESTS_RETRY_ON_ERROR, DEFAULT_MAX_REQUESTS_RETRY_ON_OFFLINE = config.DEFAULT_MAX_REQUESTS_RETRY_ON_OFFLINE, INITIAL_BACKOFF_DELAY_BASE = config.INITIAL_BACKOFF_DELAY_BASE, MAX_BACKOFF_DELAY_BASE = config.MAX_BACKOFF_DELAY_BASE;
30
29
  var generateRequestID = idGenerator();
31
30
  /**
32
31
  * Create an `ISegmentFetcher` object which will allow to easily fetch and parse
@@ -271,6 +270,7 @@ export default function createSegmentFetcher(bufferType, pipeline, callbacks, op
271
270
  */
272
271
  export function getSegmentFetcherOptions(bufferType, _a) {
273
272
  var maxRetryRegular = _a.maxRetryRegular, maxRetryOffline = _a.maxRetryOffline, lowLatencyMode = _a.lowLatencyMode;
273
+ var _b = config.getCurrent(), DEFAULT_MAX_REQUESTS_RETRY_ON_ERROR = _b.DEFAULT_MAX_REQUESTS_RETRY_ON_ERROR, DEFAULT_MAX_REQUESTS_RETRY_ON_OFFLINE = _b.DEFAULT_MAX_REQUESTS_RETRY_ON_OFFLINE, INITIAL_BACKOFF_DELAY_BASE = _b.INITIAL_BACKOFF_DELAY_BASE, MAX_BACKOFF_DELAY_BASE = _b.MAX_BACKOFF_DELAY_BASE;
274
274
  return { maxRetryRegular: bufferType === "image" ? 0 :
275
275
  maxRetryRegular !== null && maxRetryRegular !== void 0 ? maxRetryRegular : DEFAULT_MAX_REQUESTS_RETRY_ON_ERROR,
276
276
  maxRetryOffline: maxRetryOffline !== null && maxRetryOffline !== void 0 ? maxRetryOffline : DEFAULT_MAX_REQUESTS_RETRY_ON_OFFLINE,
@@ -17,7 +17,6 @@ import config from "../../../config";
17
17
  import applyPrioritizerToSegmentFetcher from "./prioritized_segment_fetcher";
18
18
  import ObservablePrioritizer from "./prioritizer";
19
19
  import createSegmentFetcher, { getSegmentFetcherOptions, } from "./segment_fetcher";
20
- var MIN_CANCELABLE_PRIORITY = config.MIN_CANCELABLE_PRIORITY, MAX_HIGH_PRIORITY_LEVEL = config.MAX_HIGH_PRIORITY_LEVEL;
21
20
  /**
22
21
  * Interact with the transport pipelines to download segments with the right
23
22
  * priority.
@@ -53,6 +52,7 @@ var SegmentFetcherCreator = /** @class */ (function () {
53
52
  * @param {Object} transport
54
53
  */
55
54
  function SegmentFetcherCreator(transport, options) {
55
+ var _a = config.getCurrent(), MIN_CANCELABLE_PRIORITY = _a.MIN_CANCELABLE_PRIORITY, MAX_HIGH_PRIORITY_LEVEL = _a.MAX_HIGH_PRIORITY_LEVEL;
56
56
  this._transport = transport;
57
57
  this._prioritizer = new ObservablePrioritizer({
58
58
  prioritySteps: { high: MAX_HIGH_PRIORITY_LEVEL,
@@ -15,7 +15,6 @@
15
15
  */
16
16
  import config from "../../config";
17
17
  import log from "../../log";
18
- var DEFAULT_LIVE_GAP = config.DEFAULT_LIVE_GAP;
19
18
  /**
20
19
  * Returns the calculated initial time for the content described by the given
21
20
  * Manifest:
@@ -76,6 +75,7 @@ export default function getInitialTime(manifest, lowLatencyMode, startAt) {
76
75
  var suggestedPresentationDelay = manifest.suggestedPresentationDelay, clockOffset = manifest.clockOffset;
77
76
  var maximumPosition = manifest.getMaximumPosition();
78
77
  var liveTime = void 0;
78
+ var DEFAULT_LIVE_GAP = config.getCurrent().DEFAULT_LIVE_GAP;
79
79
  if (clockOffset == null) {
80
80
  log.info("Init: no clock offset found for a live content, " +
81
81
  "starting close to maximum available position");
@@ -20,7 +20,7 @@
20
20
  import { Observable } from "rxjs";
21
21
  import { IReadOnlySharedReference } from "../../utils/reference";
22
22
  import { PlaybackObserver } from "../api";
23
- import { IKeySystemOption } from "../eme";
23
+ import { IKeySystemOption } from "../decrypt";
24
24
  import { IInitialTimeOptions } from "./get_initial_time";
25
25
  import { IDirectfileEvent } from "./types";
26
26
  export interface IDirectFileOptions {
@@ -21,12 +21,17 @@ import { EMPTY, filter, ignoreElements, merge as observableMerge, mergeMap, swit
21
21
  import { clearElementSrc, setElementSrc$, } from "../../compat";
22
22
  import log from "../../log";
23
23
  import deferSubscriptions from "../../utils/defer_subscriptions";
24
- import createEMEManager from "./create_eme_manager";
25
24
  import emitLoadedEvent from "./emit_loaded_event";
26
25
  import initialSeekAndPlay from "./initial_seek_and_play";
26
+ import linkDrmAndContent from "./link_drm_and_content";
27
27
  import StallAvoider from "./stall_avoider";
28
28
  import throwOnMediaError from "./throw_on_media_error";
29
29
  import updatePlaybackRate from "./update_playback_rate";
30
+ // NOTE As of now (RxJS 7.4.0), RxJS defines `ignoreElements` default
31
+ // first type parameter as `any` instead of the perfectly fine `unknown`,
32
+ // leading to linter issues, as it forbids the usage of `any`.
33
+ // This is why we're disabling the eslint rule.
34
+ /* eslint-disable @typescript-eslint/no-unsafe-argument */
30
35
  /**
31
36
  * calculate initial time as a position in seconds.
32
37
  * @param {HTMLMediaElement} mediaElement
@@ -86,9 +91,8 @@ export default function initializeDirectfileContent(_a) {
86
91
  log.debug("Init: Initial time calculated:", initialTime);
87
92
  var seekAndPlay$ = initialSeekAndPlay({ mediaElement: mediaElement, playbackObserver: playbackObserver, startTime: initialTime,
88
93
  mustAutoPlay: autoPlay }).seekAndPlay$;
89
- // Create EME Manager, an observable which will manage every EME-related
90
- // issue.
91
- var emeManager$ = linkURL$.pipe(mergeMap(function () { return createEMEManager(mediaElement, keySystems, EMPTY); }), deferSubscriptions(), share());
94
+ /** Initialize decryption capabilities and the HTMLMediaElement's src attribute. */
95
+ var drmEvents$ = linkDrmAndContent(mediaElement, keySystems, EMPTY, linkURL$).pipe(deferSubscriptions(), share());
92
96
  // Translate errors coming from the media element into RxPlayer errors
93
97
  // through a throwing Observable.
94
98
  var mediaError$ = throwOnMediaError(mediaElement);
@@ -96,11 +100,6 @@ export default function initializeDirectfileContent(_a) {
96
100
  // Set the speed set by the user on the media element while pausing a
97
101
  // little longer while the buffer is empty.
98
102
  var playbackRate$ = updatePlaybackRate(mediaElement, speed, observation$)
99
- // NOTE As of now (RxJS 7.4.0), RxJS defines `ignoreElements` default
100
- // first type parameter as `any` instead of the perfectly fine `unknown`,
101
- // leading to linter issues, as it forbids the usage of `any`.
102
- // This is why we're disabling the eslint rule.
103
- /* eslint-disable-next-line @typescript-eslint/no-unsafe-argument */
104
103
  .pipe(ignoreElements());
105
104
  /**
106
105
  * Observable trying to avoid various stalling situations, emitting "stalled"
@@ -112,17 +111,12 @@ export default function initializeDirectfileContent(_a) {
112
111
  * media can begin playback.
113
112
  * Also emits warning events if issues arise when doing so.
114
113
  */
115
- var loadingEvts$ = emeManager$.pipe(filter(function isEMEReady(evt) {
116
- if (evt.type === "created-media-keys") {
117
- evt.value.canAttachMediaKeys.setValue(true);
118
- return true;
119
- }
120
- return evt.type === "eme-disabled" || evt.type === "attached-media-keys";
121
- }), take(1), mergeMap(function () { return seekAndPlay$; }), switchMap(function (evt) {
114
+ var loadingEvts$ = drmEvents$.pipe(filter(function (evt) { return evt.type === "decryption-ready" ||
115
+ evt.type === "decryption-disabled"; }), take(1), mergeMap(function () { return seekAndPlay$; }), switchMap(function (evt) {
122
116
  if (evt.type === "warning") {
123
117
  return observableOf(evt);
124
118
  }
125
119
  return emitLoadedEvent(observation$, mediaElement, null, true);
126
120
  }));
127
- return observableMerge(loadingEvts$, emeManager$, mediaError$, playbackRate$, stallAvoider$);
121
+ return observableMerge(loadingEvts$, drmEvents$.pipe(ignoreElements()), mediaError$, playbackRate$, stallAvoider$);
128
122
  }
@@ -17,7 +17,7 @@ import { Observable } from "rxjs";
17
17
  import { IReadOnlySharedReference } from "../../utils/reference";
18
18
  import { IABRManagerArguments } from "../abr";
19
19
  import { PlaybackObserver } from "../api";
20
- import { IKeySystemOption } from "../eme";
20
+ import { IKeySystemOption } from "../decrypt";
21
21
  import { IManifestFetcherParsedResult, IManifestFetcherWarningEvent, ManifestFetcher, SegmentFetcherCreator } from "../fetchers";
22
22
  import { ITextTrackSegmentBufferOptions } from "../segment_buffers";
23
23
  import { IInitialTimeOptions } from "./get_initial_time";
@@ -32,6 +32,8 @@ export interface IInitializeArguments {
32
32
  bufferOptions: {
33
33
  /** Buffer "goal" at which we stop downloading new segments. */
34
34
  wantedBufferAhead: IReadOnlySharedReference<number>;
35
+ /** Buffer maximum size in kiloBytes at which we stop downloading */
36
+ maxVideoBufferSize: IReadOnlySharedReference<number>;
35
37
  /** Max buffer size after the current position, in seconds (we GC further up). */
36
38
  maxBufferAhead: IReadOnlySharedReference<number>;
37
39
  /** Max buffer size before the current position, in seconds (we GC further down). */
@@ -83,7 +85,7 @@ export interface IInitializeArguments {
83
85
  *
84
86
  * - download the content's Manifest and handle its refresh logic
85
87
  *
86
- * - Perform EME management if needed
88
+ * - Perform decryption if needed
87
89
  *
88
90
  * - ask for the choice of the wanted Adaptation through events (e.g. to
89
91
  * choose a language)