rx-player 3.26.2 → 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 (500) hide show
  1. package/.github/workflows/perfs.yml +22 -0
  2. package/CHANGELOG.md +33 -1
  3. package/FILES.md +5 -4
  4. package/VERSION +1 -1
  5. package/dist/_esm5.processed/compat/browser_detection.d.ts +4 -2
  6. package/dist/_esm5.processed/compat/browser_detection.js +4 -2
  7. package/dist/_esm5.processed/compat/eme/close_session.d.ts +11 -5
  8. package/dist/_esm5.processed/compat/eme/close_session.js +144 -36
  9. package/dist/_esm5.processed/compat/eme/custom_media_keys/index.d.ts +3 -5
  10. package/dist/_esm5.processed/compat/eme/custom_media_keys/index.js +27 -24
  11. package/dist/_esm5.processed/compat/eme/custom_media_keys/old_webkit_media_keys.js +53 -34
  12. package/dist/_esm5.processed/compat/eme/custom_media_keys/webkit_media_keys.js +43 -41
  13. package/dist/_esm5.processed/compat/eme/generate_key_request.d.ts +2 -3
  14. package/dist/_esm5.processed/compat/eme/generate_key_request.js +22 -26
  15. package/dist/_esm5.processed/compat/eme/load_session.d.ts +1 -2
  16. package/dist/_esm5.processed/compat/eme/load_session.js +68 -17
  17. package/dist/_esm5.processed/compat/event_listeners.js +2 -1
  18. package/dist/_esm5.processed/compat/should_favour_custom_safari_EME.js +2 -2
  19. package/dist/_esm5.processed/config.d.ts +166 -1080
  20. package/dist/_esm5.processed/config.js +17 -1119
  21. package/dist/_esm5.processed/core/abr/bandwidth_estimator.js +4 -1
  22. package/dist/_esm5.processed/core/abr/buffer_based_chooser.d.ts +28 -6
  23. package/dist/_esm5.processed/core/abr/buffer_based_chooser.js +63 -12
  24. package/dist/_esm5.processed/core/abr/network_analyzer.d.ts +1 -1
  25. package/dist/_esm5.processed/core/abr/network_analyzer.js +2 -1
  26. package/dist/_esm5.processed/core/abr/pending_requests_store.js +3 -5
  27. package/dist/_esm5.processed/core/abr/representation_estimator.d.ts +1 -1
  28. package/dist/_esm5.processed/core/abr/representation_estimator.js +2 -2
  29. package/dist/_esm5.processed/core/api/get_player_state.js +1 -1
  30. package/dist/_esm5.processed/core/api/index.d.ts +2 -1
  31. package/dist/_esm5.processed/core/api/media_element_track_choice_manager.d.ts +6 -0
  32. package/dist/_esm5.processed/core/api/media_element_track_choice_manager.js +22 -4
  33. package/dist/_esm5.processed/core/api/option_utils.d.ts +3 -1
  34. package/dist/_esm5.processed/core/api/option_utils.js +19 -6
  35. package/dist/_esm5.processed/core/api/playback_observer.js +5 -1
  36. package/dist/_esm5.processed/core/api/public_api.d.ts +82 -71
  37. package/dist/_esm5.processed/core/api/public_api.js +72 -33
  38. package/dist/_esm5.processed/core/api/track_choice_manager.d.ts +6 -6
  39. package/dist/_esm5.processed/core/{eme → decrypt}/__tests__/__global__/utils.d.ts +7 -51
  40. package/dist/_esm5.processed/core/{eme → decrypt}/__tests__/__global__/utils.js +30 -75
  41. package/dist/_esm5.processed/core/{eme → decrypt}/attach_media_keys.d.ts +12 -12
  42. package/dist/_esm5.processed/core/decrypt/attach_media_keys.js +104 -0
  43. package/dist/_esm5.processed/core/{eme/clear_eme_session.d.ts → decrypt/clear_on_stop.d.ts} +3 -4
  44. package/dist/_esm5.processed/core/decrypt/clear_on_stop.js +41 -0
  45. package/dist/_esm5.processed/core/decrypt/content_decryptor.d.ts +216 -0
  46. package/dist/_esm5.processed/core/decrypt/content_decryptor.js +866 -0
  47. package/dist/_esm5.processed/core/{eme/get_session.d.ts → decrypt/create_or_load_session.d.ts} +28 -26
  48. package/dist/_esm5.processed/core/decrypt/create_or_load_session.js +124 -0
  49. package/dist/_esm5.processed/core/{eme → decrypt}/create_session.d.ts +22 -19
  50. package/dist/_esm5.processed/core/decrypt/create_session.js +174 -0
  51. package/dist/_esm5.processed/core/decrypt/dispose_decryption_resources.d.ts +21 -0
  52. package/dist/_esm5.processed/core/decrypt/dispose_decryption_resources.js +81 -0
  53. package/dist/_esm5.processed/core/{eme → decrypt}/find_key_system.d.ts +11 -14
  54. package/dist/_esm5.processed/core/decrypt/find_key_system.js +300 -0
  55. package/dist/_esm5.processed/core/{eme → decrypt}/get_current_key_system.d.ts +0 -0
  56. package/dist/_esm5.processed/core/{eme → decrypt}/get_current_key_system.js +1 -1
  57. package/dist/_esm5.processed/core/{eme → decrypt}/get_media_keys.d.ts +13 -5
  58. package/dist/_esm5.processed/core/decrypt/get_media_keys.js +153 -0
  59. package/dist/_esm5.processed/core/{eme → decrypt}/index.d.ts +5 -6
  60. package/dist/_esm5.processed/core/{eme → decrypt}/index.js +5 -5
  61. package/dist/_esm5.processed/core/{eme → decrypt}/init_media_keys.d.ts +6 -4
  62. package/dist/_esm5.processed/core/decrypt/init_media_keys.js +82 -0
  63. package/dist/_esm5.processed/core/decrypt/session_events_listener.d.ts +77 -0
  64. package/dist/_esm5.processed/core/{eme → decrypt}/session_events_listener.js +25 -24
  65. package/dist/_esm5.processed/core/{eme → decrypt}/set_server_certificate.d.ts +15 -6
  66. package/dist/_esm5.processed/core/decrypt/set_server_certificate.js +141 -0
  67. package/dist/_esm5.processed/core/{eme → decrypt}/types.d.ts +120 -242
  68. package/dist/_esm5.processed/core/{eme → decrypt}/types.js +0 -0
  69. package/dist/_esm5.processed/core/{eme → decrypt}/utils/are_init_values_compatible.d.ts +3 -3
  70. package/dist/_esm5.processed/core/{eme → decrypt}/utils/are_init_values_compatible.js +5 -5
  71. package/dist/_esm5.processed/core/{eme → decrypt/utils}/check_key_statuses.d.ts +2 -2
  72. package/dist/_esm5.processed/core/{eme → decrypt/utils}/check_key_statuses.js +4 -3
  73. package/dist/_esm5.processed/core/{eme/utils/close_session.d.ts → decrypt/utils/clean_old_loaded_sessions.d.ts} +8 -7
  74. package/dist/_esm5.processed/core/decrypt/utils/clean_old_loaded_sessions.js +85 -0
  75. package/dist/_esm5.processed/core/{eme → decrypt/utils}/clean_old_stored_persistent_info.d.ts +1 -1
  76. package/dist/_esm5.processed/core/{eme → decrypt/utils}/clean_old_stored_persistent_info.js +2 -2
  77. package/dist/_esm5.processed/core/{eme → decrypt/utils}/get_drm_system_id.d.ts +0 -0
  78. package/dist/_esm5.processed/core/{eme → decrypt/utils}/get_drm_system_id.js +1 -1
  79. package/dist/_esm5.processed/core/decrypt/utils/init_data_values_container.d.ts +69 -0
  80. package/dist/_esm5.processed/core/decrypt/utils/init_data_values_container.js +99 -0
  81. package/dist/_esm5.processed/core/{eme → decrypt}/utils/is_session_usable.d.ts +0 -1
  82. package/dist/_esm5.processed/core/{eme → decrypt}/utils/is_session_usable.js +4 -5
  83. package/dist/_esm5.processed/core/decrypt/utils/key_id_comparison.d.ts +44 -0
  84. package/dist/_esm5.processed/core/decrypt/utils/key_id_comparison.js +77 -0
  85. package/dist/_esm5.processed/core/decrypt/utils/key_session_record.d.ts +104 -0
  86. package/dist/_esm5.processed/core/decrypt/utils/key_session_record.js +155 -0
  87. package/dist/_esm5.processed/core/decrypt/utils/loaded_sessions_store.d.ts +108 -0
  88. package/dist/_esm5.processed/core/decrypt/utils/loaded_sessions_store.js +303 -0
  89. package/dist/_esm5.processed/core/{eme → decrypt/utils}/media_keys_infos_store.d.ts +4 -4
  90. package/dist/_esm5.processed/core/{eme → decrypt/utils}/media_keys_infos_store.js +0 -0
  91. package/dist/_esm5.processed/core/{eme → decrypt}/utils/persistent_sessions_store.d.ts +8 -18
  92. package/dist/_esm5.processed/core/{eme → decrypt}/utils/persistent_sessions_store.js +119 -97
  93. package/dist/_esm5.processed/core/{eme/utils/init_data_container.d.ts → decrypt/utils/serializable_bytes.d.ts} +8 -5
  94. package/dist/_esm5.processed/core/{eme/utils/init_data_container.js → decrypt/utils/serializable_bytes.js} +9 -9
  95. package/dist/_esm5.processed/core/{eme → decrypt/utils}/server_certificate_store.d.ts +1 -1
  96. package/dist/_esm5.processed/core/{eme → decrypt/utils}/server_certificate_store.js +1 -1
  97. package/dist/_esm5.processed/core/fetchers/manifest/manifest_fetcher.d.ts +4 -4
  98. package/dist/_esm5.processed/core/fetchers/manifest/manifest_fetcher.js +3 -3
  99. package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.d.ts +2 -2
  100. package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.js +6 -2
  101. package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher_creator.js +1 -1
  102. package/dist/_esm5.processed/core/fetchers/utils/try_urls_with_backoff.js +1 -1
  103. package/dist/_esm5.processed/core/init/get_initial_time.js +1 -1
  104. package/dist/_esm5.processed/core/init/initialize_directfile.d.ts +3 -3
  105. package/dist/_esm5.processed/core/init/initialize_directfile.js +11 -17
  106. package/dist/_esm5.processed/core/init/initialize_media_source.d.ts +5 -3
  107. package/dist/_esm5.processed/core/init/initialize_media_source.js +18 -69
  108. package/dist/_esm5.processed/core/init/link_drm_and_content.d.ts +61 -0
  109. package/dist/_esm5.processed/core/init/link_drm_and_content.js +94 -0
  110. package/dist/_esm5.processed/core/init/manifest_update_scheduler.d.ts +4 -4
  111. package/dist/_esm5.processed/core/init/manifest_update_scheduler.js +2 -1
  112. package/dist/_esm5.processed/core/init/stall_avoider.js +1 -1
  113. package/dist/_esm5.processed/core/init/stream_events_emitter/are_same_stream_events.d.ts +4 -4
  114. package/dist/_esm5.processed/core/init/stream_events_emitter/stream_events_emitter.js +1 -1
  115. package/dist/_esm5.processed/core/init/stream_events_emitter/types.d.ts +2 -2
  116. package/dist/_esm5.processed/core/init/types.d.ts +2 -4
  117. package/dist/_esm5.processed/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.js +1 -1
  118. package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/html_text_segment_buffer.d.ts +3 -3
  119. package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/html_text_segment_buffer.js +3 -1
  120. package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/text_track_cues_store.js +32 -31
  121. package/dist/_esm5.processed/core/segment_buffers/implementations/text/native/native_text_segment_buffer.d.ts +4 -4
  122. package/dist/_esm5.processed/core/segment_buffers/inventory/segment_inventory.d.ts +17 -1
  123. package/dist/_esm5.processed/core/segment_buffers/inventory/segment_inventory.js +22 -5
  124. package/dist/_esm5.processed/core/stream/adaptation/adaptation_stream.d.ts +2 -1
  125. package/dist/_esm5.processed/core/stream/adaptation/adaptation_stream.js +6 -3
  126. package/dist/_esm5.processed/core/stream/events_generators.d.ts +8 -3
  127. package/dist/_esm5.processed/core/stream/events_generators.js +3 -2
  128. package/dist/_esm5.processed/core/stream/orchestrator/stream_orchestrator.d.ts +1 -0
  129. package/dist/_esm5.processed/core/stream/orchestrator/stream_orchestrator.js +3 -3
  130. package/dist/_esm5.processed/core/stream/period/create_empty_adaptation_stream.js +2 -1
  131. package/dist/_esm5.processed/core/stream/period/get_adaptation_switch_strategy.js +1 -1
  132. package/dist/_esm5.processed/core/stream/period/period_stream.d.ts +2 -1
  133. package/dist/_esm5.processed/core/stream/period/period_stream.js +3 -3
  134. package/dist/_esm5.processed/core/stream/representation/force_garbage_collection.js +5 -6
  135. package/dist/_esm5.processed/core/stream/representation/get_buffer_status.d.ts +6 -1
  136. package/dist/_esm5.processed/core/stream/representation/get_buffer_status.js +12 -9
  137. package/dist/_esm5.processed/core/stream/representation/get_needed_segments.d.ts +19 -14
  138. package/dist/_esm5.processed/core/stream/representation/get_needed_segments.js +86 -10
  139. package/dist/_esm5.processed/core/stream/representation/get_segment_priority.js +1 -1
  140. package/dist/_esm5.processed/core/stream/representation/push_media_segment.js +3 -3
  141. package/dist/_esm5.processed/core/stream/representation/representation_stream.d.ts +6 -0
  142. package/dist/_esm5.processed/core/stream/representation/representation_stream.js +19 -8
  143. package/dist/_esm5.processed/core/stream/types.d.ts +1 -1
  144. package/dist/_esm5.processed/default_config.d.ts +1114 -0
  145. package/dist/_esm5.processed/default_config.js +1145 -0
  146. package/dist/_esm5.processed/errors/request_error.js +3 -1
  147. package/dist/_esm5.processed/experimental/index.d.ts +2 -0
  148. package/dist/_esm5.processed/experimental/index.js +2 -0
  149. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/push_data.d.ts +1 -0
  150. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/thumbnail_loader.d.ts +2 -2
  151. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/thumbnail_loader.js +2 -4
  152. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/api/probeMediaConfiguration.d.ts +1 -1
  153. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/api/probeMediaConfiguration.js +1 -1
  154. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/DRMInfos.js +1 -2
  155. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/HDCPPolicy.js +1 -2
  156. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/types.d.ts +3 -3
  157. package/dist/_esm5.processed/features/features_object.js +1 -1
  158. package/dist/_esm5.processed/features/initialize_features.js +1 -1
  159. package/dist/_esm5.processed/features/list/eme.d.ts +3 -3
  160. package/dist/_esm5.processed/features/list/eme.js +5 -5
  161. package/dist/_esm5.processed/features/types.d.ts +3 -3
  162. package/dist/_esm5.processed/manifest/adaptation.d.ts +2 -2
  163. package/dist/_esm5.processed/manifest/adaptation.js +3 -1
  164. package/dist/_esm5.processed/manifest/manifest.d.ts +10 -23
  165. package/dist/_esm5.processed/manifest/manifest.js +10 -74
  166. package/dist/_esm5.processed/manifest/period.d.ts +3 -3
  167. package/dist/_esm5.processed/manifest/representation.d.ts +37 -5
  168. package/dist/_esm5.processed/manifest/representation_index/types.d.ts +18 -18
  169. package/dist/_esm5.processed/manifest/types.d.ts +3 -3
  170. package/dist/_esm5.processed/parsers/manifest/dash/common/get_hdr_information.d.ts +1 -1
  171. package/dist/_esm5.processed/parsers/manifest/dash/common/get_periods_time_infos.d.ts +3 -3
  172. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/base.d.ts +6 -6
  173. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/get_init_segment.d.ts +3 -3
  174. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/get_segments_from_timeline.d.ts +2 -2
  175. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/is_period_fulfilled.js +1 -2
  176. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/list.d.ts +14 -14
  177. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/template.d.ts +17 -17
  178. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/template.js +1 -2
  179. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_elements.js +1 -1
  180. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.d.ts +28 -20
  181. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.js +20 -5
  182. package/dist/_esm5.processed/parsers/manifest/dash/common/infer_adaptation_type.d.ts +2 -2
  183. package/dist/_esm5.processed/parsers/manifest/dash/common/manifest_bounds_calculator.d.ts +1 -1
  184. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_adaptation_sets.d.ts +17 -35
  185. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_adaptation_sets.js +109 -96
  186. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_mpd.d.ts +8 -8
  187. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_mpd.js +1 -2
  188. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_periods.d.ts +18 -27
  189. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_periods.js +25 -23
  190. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representation_index.d.ts +21 -15
  191. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representation_index.js +19 -19
  192. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representations.d.ts +15 -38
  193. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representations.js +8 -8
  194. package/dist/_esm5.processed/parsers/manifest/dash/node_parser_types.d.ts +30 -30
  195. package/dist/_esm5.processed/parsers/manifest/dash/parsers_types.d.ts +3 -3
  196. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/dash-wasm-parser.js +1 -1
  197. package/dist/_esm5.processed/parsers/manifest/metaplaylist/metaplaylist_parser.d.ts +2 -2
  198. package/dist/_esm5.processed/parsers/manifest/smooth/create_parser.d.ts +7 -7
  199. package/dist/_esm5.processed/parsers/manifest/smooth/create_parser.js +1 -0
  200. package/dist/_esm5.processed/parsers/manifest/smooth/representation_index.d.ts +8 -8
  201. package/dist/_esm5.processed/parsers/manifest/types.d.ts +28 -28
  202. package/dist/_esm5.processed/parsers/manifest/utils/clear_timeline_from_position.d.ts +3 -2
  203. package/dist/_esm5.processed/parsers/manifest/utils/clear_timeline_from_position.js +15 -5
  204. package/dist/_esm5.processed/parsers/manifest/utils/index_helpers.d.ts +2 -2
  205. package/dist/_esm5.processed/parsers/manifest/utils/update_segment_timeline.d.ts +11 -1
  206. package/dist/_esm5.processed/parsers/manifest/utils/update_segment_timeline.js +31 -19
  207. package/dist/_esm5.processed/parsers/texttracks/webvtt/html/to_html.d.ts +2 -2
  208. package/dist/_esm5.processed/parsers/texttracks/webvtt/parse_cue_block.d.ts +1 -1
  209. package/dist/_esm5.processed/public_types.d.ts +2 -2
  210. package/dist/_esm5.processed/transports/dash/add_segment_integrity_checks_to_loader.js +2 -1
  211. package/dist/_esm5.processed/transports/dash/image_pipelines.js +4 -1
  212. package/dist/_esm5.processed/transports/dash/init_segment_loader.js +1 -1
  213. package/dist/_esm5.processed/transports/dash/manifest_parser.js +1 -1
  214. package/dist/_esm5.processed/transports/dash/segment_loader.d.ts +2 -2
  215. package/dist/_esm5.processed/transports/dash/segment_loader.js +2 -2
  216. package/dist/_esm5.processed/transports/dash/segment_parser.d.ts +1 -1
  217. package/dist/_esm5.processed/transports/dash/segment_parser.js +6 -3
  218. package/dist/_esm5.processed/transports/dash/text_loader.d.ts +1 -1
  219. package/dist/_esm5.processed/transports/dash/text_loader.js +1 -1
  220. package/dist/_esm5.processed/transports/dash/text_parser.d.ts +1 -1
  221. package/dist/_esm5.processed/transports/dash/text_parser.js +8 -2
  222. package/dist/_esm5.processed/transports/local/segment_loader.d.ts +1 -2
  223. package/dist/_esm5.processed/transports/local/segment_loader.js +1 -1
  224. package/dist/_esm5.processed/transports/local/segment_parser.js +4 -1
  225. package/dist/_esm5.processed/transports/local/text_parser.js +8 -2
  226. package/dist/_esm5.processed/transports/metaplaylist/manifest_loader.d.ts +1 -1
  227. package/dist/_esm5.processed/transports/metaplaylist/pipelines.js +1 -1
  228. package/dist/_esm5.processed/transports/smooth/pipelines.js +69 -11
  229. package/dist/_esm5.processed/transports/smooth/segment_loader.d.ts +0 -1
  230. package/dist/_esm5.processed/transports/smooth/segment_loader.js +2 -2
  231. package/dist/_esm5.processed/transports/types.d.ts +58 -30
  232. package/dist/_esm5.processed/transports/utils/call_custom_manifest_loader.js +1 -1
  233. package/dist/_esm5.processed/transports/utils/generate_manifest_loader.d.ts +1 -1
  234. package/dist/_esm5.processed/utils/cancellable_sleep.js +1 -1
  235. package/dist/_esm5.processed/utils/cast_to_observable.d.ts +1 -2
  236. package/dist/_esm5.processed/utils/cast_to_observable.js +1 -1
  237. package/dist/_esm5.processed/utils/deep_merge.d.ts +12 -0
  238. package/dist/_esm5.processed/utils/deep_merge.js +53 -0
  239. package/dist/_esm5.processed/utils/reference.d.ts +29 -0
  240. package/dist/_esm5.processed/utils/reference.js +72 -24
  241. package/dist/_esm5.processed/utils/request/fetch.d.ts +4 -5
  242. package/dist/_esm5.processed/utils/request/fetch.js +8 -6
  243. package/dist/_esm5.processed/utils/request/xhr.d.ts +6 -6
  244. package/dist/_esm5.processed/utils/request/xhr.js +3 -2
  245. package/dist/_esm5.processed/utils/rx-from_cancellable_promise.d.ts +1 -2
  246. package/dist/_esm5.processed/utils/rx-from_cancellable_promise.js +7 -2
  247. package/dist/_esm5.processed/utils/task_canceller.d.ts +5 -3
  248. package/dist/_esm5.processed/utils/task_canceller.js +3 -3
  249. package/dist/rx-player.js +5242 -3190
  250. package/dist/rx-player.min.js +1 -1
  251. package/dummy +1 -0
  252. package/{dist/_esm5.processed/core/eme/dispose_eme.d.ts → experimental/index.d.ts} +1 -4
  253. package/{dist/_esm5.processed/core/eme/dispose_media_keys.d.ts → experimental/index.js} +1 -6
  254. package/package.json +33 -36
  255. package/scripts/build/templates/experimental/index.d.ts +16 -0
  256. package/scripts/build/templates/experimental/index.js +16 -0
  257. package/scripts/doc-generator/generate_header_html.js +6 -7
  258. package/scripts/doc-generator/generate_page_html.js +3 -4
  259. package/scripts/doc-generator/generate_page_list_html.js +4 -5
  260. package/scripts/doc-generator/generate_sidebar_html.js +4 -7
  261. package/scripts/doc-generator/utils.js +0 -11
  262. package/scripts/generate_demo_list.js +3 -3
  263. package/scripts/generate_documentation_list.js +3 -3
  264. package/scripts/launch_static_server.js +127 -67
  265. package/scripts/run_standalone_demo.js +1 -0
  266. package/scripts/start_demo_web_server.js +1 -0
  267. package/sonar-project.properties +1 -1
  268. package/src/README.md +6 -6
  269. package/src/compat/__tests__/fullscreen.test.ts +7 -7
  270. package/src/compat/__tests__/is_vtt_cue.test.ts +1 -1
  271. package/src/compat/__tests__/should_favour_custom_safari_EME.test.ts +45 -5
  272. package/src/compat/browser_detection.ts +4 -2
  273. package/src/compat/eme/close_session.ts +90 -56
  274. package/src/compat/eme/custom_media_keys/ie11_media_keys.ts +1 -1
  275. package/src/compat/eme/custom_media_keys/index.ts +28 -41
  276. package/src/compat/eme/custom_media_keys/old_webkit_media_keys.ts +63 -46
  277. package/src/compat/eme/custom_media_keys/webkit_media_keys.ts +51 -49
  278. package/src/compat/eme/generate_key_request.ts +25 -33
  279. package/src/compat/eme/load_session.ts +29 -31
  280. package/src/compat/event_listeners.ts +2 -1
  281. package/src/compat/should_favour_custom_safari_EME.ts +5 -2
  282. package/src/config.ts +17 -1210
  283. package/src/core/README.md +1 -1
  284. package/src/core/abr/__tests__/{get_estimate_from_buffer_levels.test.ts → buffer_based_chooser.test.ts} +94 -123
  285. package/src/core/abr/bandwidth_estimator.ts +4 -4
  286. package/src/core/abr/buffer_based_chooser.ts +85 -20
  287. package/src/core/abr/network_analyzer.ts +6 -7
  288. package/src/core/abr/pending_requests_store.ts +3 -5
  289. package/src/core/abr/representation_estimator.ts +6 -3
  290. package/src/core/api/__tests__/get_player_state.test.ts +3 -3
  291. package/src/core/api/__tests__/option_utils.test.ts +17 -17
  292. package/src/core/api/get_player_state.ts +1 -1
  293. package/src/core/api/index.ts +3 -0
  294. package/src/core/api/media_element_track_choice_manager.ts +22 -3
  295. package/src/core/api/option_utils.ts +37 -20
  296. package/src/core/api/playback_observer.ts +12 -8
  297. package/src/core/api/public_api.ts +152 -112
  298. package/src/core/api/track_choice_manager.ts +10 -9
  299. package/src/core/decrypt/README.md +22 -0
  300. package/src/core/decrypt/__tests__/__global__/get_license.test.ts +418 -0
  301. package/src/core/decrypt/__tests__/__global__/init_data.test.ts +675 -0
  302. package/src/core/{eme → decrypt}/__tests__/__global__/media_key_system_access.test.ts +99 -92
  303. package/src/core/decrypt/__tests__/__global__/media_keys.test.ts +156 -0
  304. package/src/core/decrypt/__tests__/__global__/server_certificate.test.ts +262 -0
  305. package/src/core/{eme → decrypt}/__tests__/__global__/utils.ts +36 -103
  306. package/src/core/{eme → decrypt}/attach_media_keys.ts +49 -56
  307. package/src/core/decrypt/clear_on_stop.ts +48 -0
  308. package/src/core/decrypt/content_decryptor.ts +1158 -0
  309. package/src/core/decrypt/create_or_load_session.ts +130 -0
  310. package/src/core/decrypt/create_session.ts +175 -0
  311. package/src/core/decrypt/dispose_decryption_resources.ts +39 -0
  312. package/src/core/{eme → decrypt}/find_key_system.ts +126 -134
  313. package/src/core/{eme → decrypt}/get_current_key_system.ts +1 -1
  314. package/src/core/decrypt/get_media_keys.ts +145 -0
  315. package/src/core/{eme → decrypt}/index.ts +11 -8
  316. package/src/core/decrypt/init_media_keys.ts +51 -0
  317. package/src/core/{eme → decrypt}/session_events_listener.ts +93 -55
  318. package/src/core/decrypt/set_server_certificate.ts +104 -0
  319. package/src/core/{eme → decrypt}/types.ts +129 -259
  320. package/src/core/{eme → decrypt}/utils/__tests__/are_init_values_compatible.test.ts +1 -1
  321. package/src/core/{eme → decrypt/utils}/__tests__/clean_old_loaded_sessions.test.ts +29 -71
  322. package/src/core/{eme → decrypt/utils}/__tests__/clean_old_stored_persistent_info.test.ts +6 -6
  323. package/src/core/{eme → decrypt}/utils/are_init_values_compatible.ts +9 -9
  324. package/src/core/{eme → decrypt/utils}/check_key_statuses.ts +6 -5
  325. package/{dist/_esm5.processed/core/eme/clean_old_loaded_sessions.js → src/core/decrypt/utils/clean_old_loaded_sessions.ts} +20 -20
  326. package/src/core/{eme → decrypt/utils}/clean_old_stored_persistent_info.ts +3 -3
  327. package/src/core/{eme → decrypt/utils}/get_drm_system_id.ts +1 -1
  328. package/src/core/decrypt/utils/init_data_values_container.ts +119 -0
  329. package/src/core/{eme → decrypt}/utils/is_session_usable.ts +4 -5
  330. package/src/core/decrypt/utils/key_id_comparison.ts +82 -0
  331. package/src/core/decrypt/utils/key_session_record.ts +175 -0
  332. package/src/core/decrypt/utils/loaded_sessions_store.ts +318 -0
  333. package/src/core/{eme → decrypt/utils}/media_keys_infos_store.ts +4 -4
  334. package/src/core/{eme → decrypt}/utils/persistent_sessions_store.ts +122 -104
  335. package/src/core/{eme/utils/init_data_container.ts → decrypt/utils/serializable_bytes.ts} +8 -5
  336. package/src/core/{eme → decrypt/utils}/server_certificate_store.ts +2 -2
  337. package/src/core/fetchers/manifest/manifest_fetcher.ts +9 -9
  338. package/src/core/fetchers/segment/segment_fetcher.ts +10 -7
  339. package/src/core/fetchers/segment/segment_fetcher_creator.ts +2 -2
  340. package/src/core/fetchers/utils/try_urls_with_backoff.ts +1 -1
  341. package/src/core/init/.initialize_media_source.ts.un~ +0 -0
  342. package/src/core/init/get_initial_time.ts +2 -1
  343. package/src/core/init/initialize_directfile.ts +19 -22
  344. package/src/core/init/initialize_media_source.ts +43 -106
  345. package/src/core/init/link_drm_and_content.ts +176 -0
  346. package/src/core/init/manifest_update_scheduler.ts +12 -10
  347. package/src/core/init/stall_avoider.ts +6 -5
  348. package/src/core/init/stream_events_emitter/are_same_stream_events.ts +4 -4
  349. package/src/core/init/stream_events_emitter/stream_events_emitter.ts +2 -1
  350. package/src/core/init/stream_events_emitter/types.ts +2 -2
  351. package/src/core/init/types.ts +1 -39
  352. package/src/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.ts +2 -1
  353. package/src/core/segment_buffers/implementations/text/html/html_text_segment_buffer.ts +6 -7
  354. package/src/core/segment_buffers/implementations/text/html/text_track_cues_store.ts +32 -31
  355. package/src/core/segment_buffers/implementations/text/native/native_text_segment_buffer.ts +4 -4
  356. package/src/core/segment_buffers/inventory/segment_inventory.ts +42 -8
  357. package/src/core/stream/adaptation/adaptation_stream.ts +7 -1
  358. package/src/core/stream/events_generators.ts +9 -4
  359. package/src/core/stream/orchestrator/stream_orchestrator.ts +9 -4
  360. package/src/core/stream/period/create_empty_adaptation_stream.ts +2 -1
  361. package/src/core/stream/period/get_adaptation_switch_strategy.ts +1 -1
  362. package/src/core/stream/period/period_stream.ts +5 -2
  363. package/src/core/stream/representation/force_garbage_collection.ts +5 -7
  364. package/src/core/stream/representation/get_buffer_status.ts +28 -16
  365. package/src/core/stream/representation/get_needed_segments.ts +124 -28
  366. package/src/core/stream/representation/get_segment_priority.ts +1 -2
  367. package/src/core/stream/representation/push_media_segment.ts +3 -2
  368. package/src/core/stream/representation/representation_stream.ts +30 -7
  369. package/src/core/stream/types.ts +1 -1
  370. package/src/default_config.ts +1241 -0
  371. package/src/errors/request_error.ts +4 -1
  372. package/src/experimental/index.ts +5 -0
  373. package/src/experimental/tools/VideoThumbnailLoader/push_data.ts +1 -0
  374. package/src/experimental/tools/VideoThumbnailLoader/thumbnail_loader.ts +5 -7
  375. package/src/experimental/tools/mediaCapabilitiesProber/__tests__/probers/DRMInfos.test.ts +3 -10
  376. package/src/experimental/tools/mediaCapabilitiesProber/__tests__/probers/HDCPPolicy.test.ts +4 -4
  377. package/src/experimental/tools/mediaCapabilitiesProber/api/index.ts +1 -1
  378. package/src/experimental/tools/mediaCapabilitiesProber/api/probeMediaConfiguration.ts +3 -3
  379. package/src/experimental/tools/mediaCapabilitiesProber/probers/DRMInfos.ts +1 -2
  380. package/src/experimental/tools/mediaCapabilitiesProber/probers/HDCPPolicy.ts +1 -2
  381. package/src/experimental/tools/mediaCapabilitiesProber/types.ts +3 -3
  382. package/src/features/__tests__/initialize_features.test.ts +2 -2
  383. package/src/features/features_object.ts +1 -1
  384. package/src/features/initialize_features.ts +1 -1
  385. package/src/features/list/__tests__/eme.test.ts +5 -5
  386. package/src/features/list/eme.ts +5 -5
  387. package/src/features/types.ts +3 -10
  388. package/src/manifest/adaptation.ts +6 -4
  389. package/src/manifest/manifest.ts +16 -86
  390. package/src/manifest/period.ts +3 -3
  391. package/src/manifest/representation.ts +38 -5
  392. package/src/manifest/representation_index/types.ts +18 -18
  393. package/src/manifest/types.ts +3 -3
  394. package/src/parsers/manifest/dash/common/__tests__/manifest_bounds_calculator.test.ts +1 -0
  395. package/src/parsers/manifest/dash/common/get_hdr_information.ts +1 -1
  396. package/src/parsers/manifest/dash/common/get_periods_time_infos.ts +3 -3
  397. package/src/parsers/manifest/dash/common/indexes/base.ts +6 -6
  398. package/src/parsers/manifest/dash/common/indexes/get_init_segment.ts +4 -2
  399. package/src/parsers/manifest/dash/common/indexes/get_segments_from_timeline.ts +2 -2
  400. package/src/parsers/manifest/dash/common/indexes/is_period_fulfilled.ts +1 -2
  401. package/src/parsers/manifest/dash/common/indexes/list.ts +14 -14
  402. package/src/parsers/manifest/dash/common/indexes/template.ts +18 -18
  403. package/src/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_elements.ts +1 -1
  404. package/src/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.ts +51 -23
  405. package/src/parsers/manifest/dash/common/infer_adaptation_type.ts +2 -2
  406. package/src/parsers/manifest/dash/common/manifest_bounds_calculator.ts +1 -1
  407. package/src/parsers/manifest/dash/common/parse_adaptation_sets.ts +167 -134
  408. package/src/parsers/manifest/dash/common/parse_mpd.ts +9 -10
  409. package/src/parsers/manifest/dash/common/parse_periods.ts +80 -79
  410. package/src/parsers/manifest/dash/common/parse_representation_index.ts +83 -75
  411. package/src/parsers/manifest/dash/common/parse_representations.ts +44 -63
  412. package/src/parsers/manifest/dash/node_parser_types.ts +30 -30
  413. package/src/parsers/manifest/dash/parsers_types.ts +3 -3
  414. package/src/parsers/manifest/dash/wasm-parser/ts/dash-wasm-parser.ts +1 -1
  415. package/src/parsers/manifest/metaplaylist/metaplaylist_parser.ts +4 -4
  416. package/src/parsers/manifest/smooth/create_parser.ts +24 -21
  417. package/src/parsers/manifest/smooth/representation_index.ts +14 -14
  418. package/src/parsers/manifest/types.ts +28 -28
  419. package/src/parsers/manifest/utils/__tests__/update_segment_timeline.test.ts +31 -33
  420. package/src/parsers/manifest/utils/clear_timeline_from_position.ts +15 -6
  421. package/src/parsers/manifest/utils/index_helpers.ts +2 -2
  422. package/src/parsers/manifest/utils/update_segment_timeline.ts +32 -21
  423. package/src/parsers/texttracks/webvtt/html/__tests__/create_styled_element.test.ts +1 -0
  424. package/src/parsers/texttracks/webvtt/html/to_html.ts +2 -2
  425. package/src/parsers/texttracks/webvtt/parse_cue_block.ts +1 -1
  426. package/src/public_types.ts +5 -1
  427. package/src/transports/dash/add_segment_integrity_checks_to_loader.ts +2 -2
  428. package/src/transports/dash/image_pipelines.ts +4 -1
  429. package/src/transports/dash/init_segment_loader.ts +1 -1
  430. package/src/transports/dash/manifest_parser.ts +1 -1
  431. package/src/transports/dash/segment_loader.ts +7 -7
  432. package/src/transports/dash/segment_parser.ts +8 -1
  433. package/src/transports/dash/text_loader.ts +2 -2
  434. package/src/transports/dash/text_parser.ts +11 -1
  435. package/src/transports/local/segment_loader.ts +4 -4
  436. package/src/transports/local/segment_parser.ts +4 -0
  437. package/src/transports/local/text_parser.ts +8 -0
  438. package/src/transports/metaplaylist/manifest_loader.ts +1 -1
  439. package/src/transports/metaplaylist/pipelines.ts +1 -1
  440. package/src/transports/smooth/pipelines.ts +29 -16
  441. package/src/transports/smooth/segment_loader.ts +8 -8
  442. package/src/transports/types.ts +59 -30
  443. package/src/transports/utils/call_custom_manifest_loader.ts +6 -6
  444. package/src/transports/utils/generate_manifest_loader.ts +1 -1
  445. package/src/utils/__tests__/deep_merge.test.ts +48 -0
  446. package/src/utils/__tests__/flat_map.test.ts +12 -7
  447. package/src/utils/cancellable_sleep.ts +1 -1
  448. package/src/utils/cast_to_observable.ts +1 -2
  449. package/src/utils/deep_merge.ts +46 -0
  450. package/src/utils/reference.ts +116 -23
  451. package/src/utils/request/fetch.ts +17 -15
  452. package/src/utils/request/xhr.ts +11 -8
  453. package/src/utils/rx-from_cancellable_promise.ts +8 -4
  454. package/src/utils/task_canceller.ts +6 -4
  455. package/tsconfig.json +1 -2
  456. package/tsconfig.modules.json +1 -2
  457. package/dist/_esm5.processed/core/abr/get_estimate_from_buffer_levels.d.ts +0 -29
  458. package/dist/_esm5.processed/core/abr/get_estimate_from_buffer_levels.js +0 -67
  459. package/dist/_esm5.processed/core/eme/attach_media_keys.js +0 -57
  460. package/dist/_esm5.processed/core/eme/clean_old_loaded_sessions.d.ts +0 -59
  461. package/dist/_esm5.processed/core/eme/clear_eme_session.js +0 -50
  462. package/dist/_esm5.processed/core/eme/create_session.js +0 -126
  463. package/dist/_esm5.processed/core/eme/dispose_eme.js +0 -23
  464. package/dist/_esm5.processed/core/eme/dispose_media_keys.js +0 -36
  465. package/dist/_esm5.processed/core/eme/eme_manager.d.ts +0 -31
  466. package/dist/_esm5.processed/core/eme/eme_manager.js +0 -278
  467. package/dist/_esm5.processed/core/eme/find_key_system.js +0 -243
  468. package/dist/_esm5.processed/core/eme/get_media_keys.js +0 -85
  469. package/dist/_esm5.processed/core/eme/get_session.js +0 -68
  470. package/dist/_esm5.processed/core/eme/init_media_keys.js +0 -66
  471. package/dist/_esm5.processed/core/eme/session_events_listener.d.ts +0 -41
  472. package/dist/_esm5.processed/core/eme/set_server_certificate.js +0 -85
  473. package/dist/_esm5.processed/core/eme/utils/close_session.js +0 -81
  474. package/dist/_esm5.processed/core/eme/utils/init_data_store.d.ts +0 -115
  475. package/dist/_esm5.processed/core/eme/utils/init_data_store.js +0 -181
  476. package/dist/_esm5.processed/core/eme/utils/loaded_sessions_store.d.ts +0 -123
  477. package/dist/_esm5.processed/core/eme/utils/loaded_sessions_store.js +0 -173
  478. package/dist/_esm5.processed/core/init/create_eme_manager.d.ts +0 -34
  479. package/dist/_esm5.processed/core/init/create_eme_manager.js +0 -52
  480. package/src/core/abr/get_estimate_from_buffer_levels.ts +0 -85
  481. package/src/core/eme/README.md +0 -26
  482. package/src/core/eme/__tests__/__global__/get_license.test.ts +0 -414
  483. package/src/core/eme/__tests__/__global__/init_data.test.ts +0 -908
  484. package/src/core/eme/__tests__/__global__/media_keys.test.ts +0 -266
  485. package/src/core/eme/__tests__/__global__/server_certificate.test.ts +0 -364
  486. package/src/core/eme/__tests__/init_media_keys.test.ts +0 -182
  487. package/src/core/eme/clean_old_loaded_sessions.ts +0 -96
  488. package/src/core/eme/clear_eme_session.ts +0 -62
  489. package/src/core/eme/create_session.ts +0 -187
  490. package/src/core/eme/dispose_eme.ts +0 -25
  491. package/src/core/eme/dispose_media_keys.ts +0 -46
  492. package/src/core/eme/eme_manager.ts +0 -387
  493. package/src/core/eme/get_media_keys.ts +0 -141
  494. package/src/core/eme/get_session.ts +0 -135
  495. package/src/core/eme/init_media_keys.ts +0 -106
  496. package/src/core/eme/set_server_certificate.ts +0 -115
  497. package/src/core/eme/utils/close_session.ts +0 -113
  498. package/src/core/eme/utils/init_data_store.ts +0 -234
  499. package/src/core/eme/utils/loaded_sessions_store.ts +0 -235
  500. package/src/core/init/create_eme_manager.ts +0 -95
@@ -26,7 +26,7 @@ import { IIndexSegment } from "../index_helpers";
26
26
  describe("Manifest Parsers utils - updateSegmentTimeline", () => {
27
27
  let logWarnSpy : jest.MockInstance<void, unknown[]> | undefined;
28
28
  let updateSegmentTimeline : ((a : IIndexSegment[],
29
- b : IIndexSegment[]) => void) | undefined;
29
+ b : IIndexSegment[]) => boolean) | undefined;
30
30
  beforeEach(() => {
31
31
  jest.resetModules();
32
32
 
@@ -44,7 +44,7 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
44
44
  const oldTimeline : IIndexSegment[] = [];
45
45
  const newTimeline1 = [{ start: 0, duration: 1000, repeatCount: 10 }];
46
46
  const newTimeline2 : IIndexSegment[] = [];
47
- updateSegmentTimeline?.(oldTimeline, newTimeline1);
47
+ expect(updateSegmentTimeline?.(oldTimeline, newTimeline1)).toEqual(true);
48
48
  expect(oldTimeline).toEqual(newTimeline1);
49
49
 
50
50
  oldTimeline.length = 0; // reset
@@ -57,7 +57,7 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
57
57
  const oldTimeline = [{ start: 0, duration: 1000, repeatCount: 10 }];
58
58
  const newTimeline : IIndexSegment[] = [];
59
59
  const oldTimelineCloned = oldTimeline.slice();
60
- updateSegmentTimeline?.(oldTimeline, newTimeline);
60
+ expect(updateSegmentTimeline?.(oldTimeline, newTimeline)).toEqual(false);
61
61
  expect(oldTimeline).toEqual(oldTimelineCloned);
62
62
  expect(logWarnSpy).not.toHaveBeenCalled();
63
63
  });
@@ -66,7 +66,7 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
66
66
  const oldTimeline1 = [{ start: 0, duration: 1000, repeatCount: 10 }];
67
67
  const newTimeline1 = [{ start: 0, duration: 1000, repeatCount: 10 }];
68
68
  const oldTimeline1Cloned = oldTimeline1.slice();
69
- updateSegmentTimeline?.(oldTimeline1, newTimeline1);
69
+ expect(updateSegmentTimeline?.(oldTimeline1, newTimeline1)).toEqual(false);
70
70
  expect(oldTimeline1).toEqual(oldTimeline1Cloned);
71
71
 
72
72
  const oldTimeline2 = [ { start: 0, duration: 1000, repeatCount: 10 },
@@ -76,7 +76,7 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
76
76
  { start: 11000, duration: 1000, repeatCount: 0 },
77
77
  { start: 12000, duration: 1000, repeatCount: 1 } ];
78
78
  const oldTimeline2Cloned = oldTimeline2.slice();
79
- updateSegmentTimeline?.(oldTimeline2, newTimeline2);
79
+ expect(updateSegmentTimeline?.(oldTimeline2, newTimeline2)).toEqual(false);
80
80
  expect(oldTimeline2).toEqual(oldTimeline2Cloned);
81
81
  expect(logWarnSpy).not.toHaveBeenCalled();
82
82
  });
@@ -93,7 +93,7 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
93
93
 
94
94
  let err = null;
95
95
  try {
96
- updateSegmentTimeline?.(oldTimeline1, newTimeline1);
96
+ expect(updateSegmentTimeline?.(oldTimeline1, newTimeline1)).not.toHaveReturned();
97
97
  } catch (e) {
98
98
  err = e;
99
99
  }
@@ -121,7 +121,7 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
121
121
  { start: 25100, duration: 1000, repeatCount: 1 } ];
122
122
  const oldTimeline1Cloned = oldTimeline1.slice();
123
123
  const newTimeline1Cloned = newTimeline1.slice();
124
- updateSegmentTimeline?.(oldTimeline1, newTimeline1);
124
+ expect(updateSegmentTimeline?.(oldTimeline1, newTimeline1)).toEqual(false);
125
125
  expect(oldTimeline1).toEqual([...oldTimeline1Cloned, ...newTimeline1Cloned]);
126
126
  expect(logWarnSpy).not.toHaveBeenCalled();
127
127
 
@@ -134,7 +134,7 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
134
134
  { start: 25100, duration: 1000, repeatCount: 1 } ];
135
135
  const oldTimeline2Cloned = oldTimeline2.slice();
136
136
  const newTimeline2Cloned = newTimeline2.slice();
137
- updateSegmentTimeline?.(oldTimeline2, newTimeline2);
137
+ expect(updateSegmentTimeline?.(oldTimeline2, newTimeline2)).toEqual(false);
138
138
  expect(oldTimeline2).toEqual([...oldTimeline2Cloned, ...newTimeline2Cloned]);
139
139
  expect(logWarnSpy).not.toHaveBeenCalled();
140
140
  });
@@ -147,7 +147,7 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
147
147
  const newTimeline1 = [ { start: 12000, duration: 1000, repeatCount: 11 },
148
148
  { start: 24000, duration: 1100, repeatCount: 0 },
149
149
  { start: 25100, duration: 1000, repeatCount: 1 } ];
150
- updateSegmentTimeline?.(oldTimeline1, newTimeline1);
150
+ expect(updateSegmentTimeline?.(oldTimeline1, newTimeline1)).toEqual(false);
151
151
  expect(oldTimeline1).toEqual([
152
152
  { start: 0, duration: 500, repeatCount: 20 },
153
153
  { start: 11000, duration: 1000, repeatCount: 0 },
@@ -161,7 +161,7 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
161
161
  const newTimeline2 = [ { start: 20000, duration: 1000, repeatCount: 3 },
162
162
  { start: 24000, duration: 1100, repeatCount: 0 },
163
163
  { start: 25100, duration: 1000, repeatCount: 1 } ];
164
- updateSegmentTimeline?.(oldTimeline2, newTimeline2);
164
+ expect(updateSegmentTimeline?.(oldTimeline2, newTimeline2)).toEqual(false);
165
165
  expect(oldTimeline2).toEqual([
166
166
  { start: 0, duration: 500, repeatCount: 20 },
167
167
  { start: 11000, duration: 1000, repeatCount: 8 },
@@ -180,7 +180,7 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
180
180
  { start: 1500, duration: 1000, repeatCount: 0 },
181
181
  { start: 2500, duration: 500, repeatCount: 0 },
182
182
  { start: 3000, duration: 5000, repeatCount: 0 } ];
183
- updateSegmentTimeline?.(oldTimeline1, newTimeline1);
183
+ expect(updateSegmentTimeline?.(oldTimeline1, newTimeline1)).toEqual(false);
184
184
  expect(oldTimeline1).toEqual([
185
185
  { start: 0, duration: 1000, repeatCount: 0 },
186
186
  { start: 1000, duration: 500, repeatCount: 0 },
@@ -199,7 +199,7 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
199
199
  { start: 12000, duration: 1000, repeatCount: 0 },
200
200
  { start: 13000, duration: 7000, repeatCount: 0 },
201
201
  { start: 20000, duration: 5000, repeatCount: 0 } ];
202
- updateSegmentTimeline?.(oldTimeline1, newTimeline1);
202
+ expect(updateSegmentTimeline?.(oldTimeline1, newTimeline1)).toEqual(false);
203
203
  expect(oldTimeline1).toEqual([
204
204
  { start: 0, duration: 1000, repeatCount: 0 },
205
205
  { start: 1000, duration: 500, repeatCount: 21 },
@@ -215,7 +215,7 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
215
215
  { start: 12000, duration: 1000, repeatCount: 0 },
216
216
  { start: 13000, duration: 7000, repeatCount: 0 },
217
217
  { start: 20000, duration: 5000, repeatCount: 0 } ];
218
- updateSegmentTimeline?.(oldTimeline2, newTimeline2);
218
+ expect(updateSegmentTimeline?.(oldTimeline2, newTimeline2)).toEqual(false);
219
219
  expect(oldTimeline2).toEqual([
220
220
  { start: 1000, duration: 500, repeatCount: 21 },
221
221
  { start: 12000, duration: 1000, repeatCount: 0 },
@@ -229,7 +229,7 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
229
229
  { start: 12000, duration: 1000, repeatCount: 0 },
230
230
  { start: 13000, duration: 7000, repeatCount: 0 },
231
231
  { start: 20000, duration: 5000, repeatCount: 0 } ];
232
- updateSegmentTimeline?.(oldTimeline3, newTimeline3);
232
+ expect(updateSegmentTimeline?.(oldTimeline3, newTimeline3)).toEqual(false);
233
233
  expect(oldTimeline3).toEqual([
234
234
  { start: 1000, duration: 500, repeatCount: -1 },
235
235
  { start: 12000, duration: 1000, repeatCount: 0 },
@@ -247,7 +247,7 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
247
247
  { start: 12000, duration: 1000, repeatCount: 0 },
248
248
  { start: 13000, duration: 7000, repeatCount: 0 },
249
249
  { start: 20000, duration: 5000, repeatCount: 0 } ];
250
- updateSegmentTimeline?.(oldTimeline1, newTimeline1);
250
+ expect(updateSegmentTimeline?.(oldTimeline1, newTimeline1)).toEqual(false);
251
251
  expect(oldTimeline1).toEqual([
252
252
  { start: 0, duration: 1000, repeatCount: 0 },
253
253
  { start: 1000, duration: 500, repeatCount: 0 },
@@ -264,7 +264,7 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
264
264
  { start: 12000, duration: 1000, repeatCount: 0 },
265
265
  { start: 13000, duration: 7000, repeatCount: 0 },
266
266
  { start: 20000, duration: 5000, repeatCount: 0 } ];
267
- updateSegmentTimeline?.(oldTimeline2, newTimeline2);
267
+ expect(updateSegmentTimeline?.(oldTimeline2, newTimeline2)).toEqual(false);
268
268
  expect(oldTimeline2).toEqual([
269
269
  { start: 0, duration: 1000, repeatCount: 0 },
270
270
  { start: 1000, duration: 500, repeatCount: 3 },
@@ -287,7 +287,7 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
287
287
  { start: 12700, duration: 1000, repeatCount: 0 },
288
288
  { start: 13700, duration: 7000, repeatCount: 0 },
289
289
  { start: 20700, duration: 5000, repeatCount: 0 } ];
290
- updateSegmentTimeline?.(oldTimeline1, newTimeline1);
290
+ expect(updateSegmentTimeline?.(oldTimeline1, newTimeline1)).toEqual(false);
291
291
  expect(oldTimeline1).toEqual([
292
292
  { start: 0, duration: 1000, repeatCount: 0 },
293
293
  { start: 1000, duration: 500, repeatCount: 2 },
@@ -308,7 +308,7 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
308
308
  { start: 12700, duration: 1000, repeatCount: 0 },
309
309
  { start: 13700, duration: 7000, repeatCount: 0 },
310
310
  { start: 20700, duration: 5000, repeatCount: 0 } ];
311
- updateSegmentTimeline?.(oldTimeline2, newTimeline2);
311
+ expect(updateSegmentTimeline?.(oldTimeline2, newTimeline2)).toEqual(false);
312
312
  expect(oldTimeline2).toEqual([
313
313
  { start: 0, duration: 1000, repeatCount: 0 },
314
314
  { start: 1000, duration: 500, repeatCount: 2 },
@@ -326,7 +326,7 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
326
326
  const oldTimeline3 = [ { start: 0, duration: 1000, repeatCount: 0 },
327
327
  { start: 1000, duration: 500, repeatCount: 21 } ];
328
328
  const newTimeline3 = [ { start: 2700, duration: 500, repeatCount: 19 } ];
329
- updateSegmentTimeline?.(oldTimeline3, newTimeline3);
329
+ expect(updateSegmentTimeline?.(oldTimeline3, newTimeline3)).toEqual(false);
330
330
  expect(oldTimeline3).toEqual([
331
331
  { start: 0, duration: 1000, repeatCount: 0 },
332
332
  { start: 1000, duration: 500, repeatCount: 2 },
@@ -348,7 +348,7 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
348
348
  { start: 12000, duration: 1000, repeatCount: 0 },
349
349
  { start: 13000, duration: 7000, repeatCount: 0 },
350
350
  { start: 20000, duration: 5000, repeatCount: 0 } ];
351
- updateSegmentTimeline?.(oldTimeline1, newTimeline1);
351
+ expect(updateSegmentTimeline?.(oldTimeline1, newTimeline1)).toEqual(false);
352
352
  expect(oldTimeline1).toEqual([
353
353
  { start: 0, duration: 1000, repeatCount: 0 },
354
354
  { start: 1000, duration: 500, repeatCount: 1 },
@@ -369,7 +369,7 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
369
369
  { start: 12000, duration: 1000, repeatCount: 0 },
370
370
  { start: 13000, duration: 7000, repeatCount: 0 },
371
371
  { start: 20000, duration: 5000, repeatCount: 0 } ];
372
- updateSegmentTimeline?.(oldTimeline2, newTimeline2);
372
+ expect(updateSegmentTimeline?.(oldTimeline2, newTimeline2)).toEqual(false);
373
373
  expect(oldTimeline2).toEqual([
374
374
  { start: 0, duration: 1000, repeatCount: 0 },
375
375
  { start: 1000, duration: 500, repeatCount: 1 },
@@ -386,7 +386,7 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
386
386
 
387
387
  const oldTimeline3 = [ { start: 1000, duration: 500, repeatCount: 21 } ];
388
388
  const newTimeline3 = [ { start: 2000, duration: 1000, repeatCount: 9 } ];
389
- updateSegmentTimeline?.(oldTimeline3, newTimeline3);
389
+ expect(updateSegmentTimeline?.(oldTimeline3, newTimeline3)).toEqual(false);
390
390
  expect(oldTimeline3).toEqual([
391
391
  { start: 1000, duration: 500, repeatCount: 1 },
392
392
  { start: 2000, duration: 1000, repeatCount: 9 },
@@ -407,10 +407,8 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
407
407
  { start: 12000, duration: 1000, repeatCount: 0 },
408
408
  { start: 13000, duration: 7000, repeatCount: 0 },
409
409
  { start: 20000, duration: 5000, repeatCount: 0 } ];
410
- updateSegmentTimeline?.(oldTimeline1, newTimeline1);
410
+ expect(updateSegmentTimeline?.(oldTimeline1, newTimeline1)).toEqual(true);
411
411
  expect(oldTimeline1).toEqual([
412
- { start: 0, duration: 1000, repeatCount: 0 },
413
- { start: 1000, duration: 500, repeatCount: 0 },
414
412
  { start: 2000, duration: 1000, repeatCount: 0 },
415
413
  { start: 3000, duration: 9000, repeatCount: 0 },
416
414
  { start: 12000, duration: 1000, repeatCount: 0 },
@@ -419,7 +417,7 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
419
417
  ]);
420
418
  expect(logWarnSpy).toHaveBeenCalledTimes(1);
421
419
  expect(logWarnSpy).toHaveBeenCalledWith(
422
- "RepresentationIndex: Manifest update removed previous segments"
420
+ "RepresentationIndex: Manifest update removed all previous segments"
423
421
  );
424
422
  });
425
423
 
@@ -429,7 +427,7 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
429
427
  const oldTimeline1 = [ { start: 0, duration: 1000, repeatCount: 0 },
430
428
  { start: 1000, duration: 500, repeatCount: 21 } ];
431
429
  const newTimeline1 = [ { start: 1000, duration: 500, repeatCount: 51 } ];
432
- updateSegmentTimeline?.(oldTimeline1, newTimeline1);
430
+ expect(updateSegmentTimeline?.(oldTimeline1, newTimeline1)).toEqual(false);
433
431
  expect(oldTimeline1).toEqual([
434
432
  { start: 0, duration: 1000, repeatCount: 0 },
435
433
  { start: 1000, duration: 500, repeatCount: 51 },
@@ -437,13 +435,13 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
437
435
 
438
436
  const oldTimeline2 = [ { start: 1000, duration: 500, repeatCount: 64 } ];
439
437
  const newTimeline2 = [ { start: 1000, duration: 500, repeatCount: 72 } ];
440
- updateSegmentTimeline?.(oldTimeline2, newTimeline2);
438
+ expect(updateSegmentTimeline?.(oldTimeline2, newTimeline2)).toEqual(false);
441
439
  expect(oldTimeline2).toEqual([ { start: 1000, duration: 500, repeatCount: 72 } ]);
442
440
 
443
441
  const oldTimeline3 = [ { start: 1000, duration: 500, repeatCount: 64 } ];
444
442
  const newTimeline3 = [ { start: 1000, duration: 500, repeatCount: 72 },
445
443
  { start: 37500, duration: 1000, repeatCount: 5 }];
446
- updateSegmentTimeline?.(oldTimeline3, newTimeline3);
444
+ expect(updateSegmentTimeline?.(oldTimeline3, newTimeline3)).toEqual(false);
447
445
  expect(oldTimeline3).toEqual([
448
446
  { start: 1000, duration: 500, repeatCount: 72 },
449
447
  { start: 37500, duration: 1000, repeatCount: 5 },
@@ -460,7 +458,7 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
460
458
  { start: 12000, duration: 1000, repeatCount: 0 },
461
459
  { start: 13000, duration: 7000, repeatCount: 0 },
462
460
  { start: 20000, duration: 5000, repeatCount: 0 } ];
463
- updateSegmentTimeline?.(oldTimeline1, newTimeline1);
461
+ expect(updateSegmentTimeline?.(oldTimeline1, newTimeline1)).toEqual(true);
464
462
  expect(oldTimeline1).toEqual([
465
463
  { start: 0, duration: 1000, repeatCount: 0 },
466
464
  { start: 1000, duration: 500, repeatCount: 21 },
@@ -484,7 +482,7 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
484
482
  { start: 12000, duration: 1000, repeatCount: 0 },
485
483
  { start: 13000, duration: 7000, repeatCount: 0 },
486
484
  { start: 20000, duration: 5000, repeatCount: 0 } ];
487
- updateSegmentTimeline?.(oldTimeline2, newTimeline2);
485
+ expect(updateSegmentTimeline?.(oldTimeline2, newTimeline2)).toEqual(true);
488
486
  expect(oldTimeline2).toEqual([
489
487
  { start: 0, duration: 1000, repeatCount: 0 },
490
488
  { start: 1000, duration: 500, repeatCount: 21 },
@@ -507,7 +505,7 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
507
505
  { start: 20000, duration: 5000, repeatCount: 0 } ];
508
506
  const newTimeline1 = [ { start: 0, duration: 1000, repeatCount: 0 },
509
507
  { start: 1000, duration: 500, repeatCount: 21 } ];
510
- updateSegmentTimeline?.(oldTimeline1, newTimeline1);
508
+ expect(updateSegmentTimeline?.(oldTimeline1, newTimeline1)).toEqual(false);
511
509
  expect(oldTimeline1).toEqual([
512
510
  { start: 1000, duration: 500, repeatCount: 21 },
513
511
  { start: 12000, duration: 1000, repeatCount: 0 },
@@ -529,7 +527,7 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
529
527
  { start: 20000, duration: 5000, repeatCount: -1 } ];
530
528
  const newTimeline2 = [ { start: 0, duration: 1000, repeatCount: 0 },
531
529
  { start: 1000, duration: 500, repeatCount: 21 } ];
532
- updateSegmentTimeline?.(oldTimeline2, newTimeline2);
530
+ expect(updateSegmentTimeline?.(oldTimeline2, newTimeline2)).toEqual(false);
533
531
  expect(oldTimeline2).toEqual([
534
532
  { start: 1000, duration: 500, repeatCount: 21 },
535
533
  { start: 12000, duration: 1000, repeatCount: 0 },
@@ -20,27 +20,33 @@ import { IIndexSegment } from "./index_helpers";
20
20
  * Remove segments which starts before the given `firstAvailablePosition` from
21
21
  * the timeline. `firstAvailablePosition` has to be time scaled.
22
22
  * @param {Array.<Object>}
23
- * @returns {number}
23
+ * @returns {number} - Returns the number of removed segments. This includes
24
+ * potential implicit segment from decremented `repeatCount` attributes.
24
25
  */
25
26
  export default function clearTimelineFromPosition(
26
27
  timeline : IIndexSegment[],
27
28
  firstAvailablePosition : number
28
- ) : void {
29
+ ) : number {
30
+ let nbEltsRemoved = 0;
29
31
  while (timeline.length > 0) {
30
32
  const firstElt = timeline[0];
31
33
  if (firstElt.start >= firstAvailablePosition) {
32
- return; // all clear
34
+ return nbEltsRemoved; // all clear
33
35
  }
34
36
 
35
- if (firstElt.repeatCount <= 0) {
37
+ if (firstElt.repeatCount === -1) {
38
+ return nbEltsRemoved;
39
+ } else if (firstElt.repeatCount === 0) {
36
40
  timeline.shift();
41
+ nbEltsRemoved += 1;
37
42
  } else { // we have a segment repetition
38
43
  const nextElt = timeline[1];
39
44
  if (nextElt !== undefined && nextElt.start <= firstAvailablePosition) {
40
45
  timeline.shift();
46
+ nbEltsRemoved += 1;
41
47
  } else { // no next segment or next segment is available
42
48
  if (firstElt.duration <= 0) {
43
- return;
49
+ return nbEltsRemoved;
44
50
  }
45
51
 
46
52
  let nextStart = firstElt.start + firstElt.duration;
@@ -53,13 +59,16 @@ export default function clearTimelineFromPosition(
53
59
  }
54
60
  if (nextRepeat > firstElt.repeatCount) { // every start is before
55
61
  timeline.shift();
62
+ nbEltsRemoved = firstElt.repeatCount + 1;
56
63
  } else { // some repetitions start after and some before
57
64
  const newRepeat = firstElt.repeatCount - nextRepeat;
58
65
  firstElt.start = nextStart;
59
66
  firstElt.repeatCount = newRepeat;
60
- return;
67
+ nbEltsRemoved += nextRepeat;
68
+ return nbEltsRemoved;
61
69
  }
62
70
  }
63
71
  }
64
72
  }
73
+ return nbEltsRemoved;
65
74
  }
@@ -28,7 +28,7 @@ export interface IIndexSegment {
28
28
  */
29
29
  repeatCount: number;
30
30
  /** Optional byte-range the segment is available at when requested. */
31
- range?: [number, number];
31
+ range?: [number, number] | undefined;
32
32
  }
33
33
 
34
34
  /**
@@ -42,7 +42,7 @@ export interface IIndexSegment {
42
42
  export function calculateRepeat(
43
43
  element : IIndexSegment,
44
44
  nextElement? : IIndexSegment | null | undefined,
45
- maxPosition? : number
45
+ maxPosition? : number | undefined
46
46
  ) : number {
47
47
  const { repeatCount } = element;
48
48
 
@@ -24,22 +24,31 @@ import {
24
24
  /**
25
25
  * Update a complete array of segments in a given timeline with a [generally]
26
26
  * smaller but [generally] newer set of segments.
27
+ *
28
+ * Returns a boolean:
29
+ * - If set to `true`, the old timeline was emptied and completely replaced by
30
+ * the content of the newer timeline.
31
+ * This could happen either if a problem happened while trying to update or
32
+ * when the update is actually bigger than what it is updating.
33
+ * - If set to `false`, the older timeline was either updated to add the newer
34
+ * segments, or untouched.
35
+ *
27
36
  * @param {Array.<Object>} oldTimeline
28
37
  * @param {Array.<Object>} newTimeline
38
+ * @returns {boolean}
29
39
  */
30
40
  export default function updateSegmentTimeline(
31
41
  oldTimeline : IIndexSegment[],
32
42
  newTimeline : IIndexSegment[]
33
- ) : void {
34
- const prevTimelineLength = oldTimeline.length;
43
+ ) : boolean {
35
44
  if (oldTimeline.length === 0) {
36
- oldTimeline.splice(0, prevTimelineLength, ...newTimeline);
37
- return;
38
- }
39
- if (newTimeline.length === 0) {
40
- return;
45
+ oldTimeline.push(...newTimeline);
46
+ return true;
47
+ } else if (newTimeline.length === 0) {
48
+ return false;
41
49
  }
42
50
 
51
+ const prevTimelineLength = oldTimeline.length;
43
52
  const newIndexStart = newTimeline[0].start;
44
53
 
45
54
  const oldLastElt = oldTimeline[prevTimelineLength - 1];
@@ -53,29 +62,31 @@ export default function updateSegmentTimeline(
53
62
  const currStart = oldTimeline[i].start;
54
63
  if (currStart === newIndexStart) {
55
64
  // replace that one and those after it
56
- oldTimeline.splice(i, prevTimelineLength - i, ...newTimeline);
57
- return;
65
+ const nbEltsToRemove = prevTimelineLength - i;
66
+ oldTimeline.splice(i, nbEltsToRemove, ...newTimeline);
67
+ return false;
58
68
  } else if (currStart < newIndexStart) { // first to be before
59
69
  const currElt = oldTimeline[i];
60
70
  if (currElt.start + currElt.duration > newIndexStart) {
61
- // the new Manifest overlaps a previous segment (weird). Remove the latter.
62
- log.warn("RepresentationIndex: Manifest update removed previous segments");
63
- oldTimeline.splice(i, prevTimelineLength - i, ...newTimeline);
64
- return;
71
+ // The new Manifest overlaps a previous segment (weird)
72
+ // In that improbable case, we'll just completely replace segments
73
+ log.warn("RepresentationIndex: Manifest update removed all previous segments");
74
+ oldTimeline.splice(0, prevTimelineLength, ...newTimeline);
75
+ return true;
65
76
  } else if (currElt.repeatCount === undefined || currElt.repeatCount <= 0) {
66
77
  if (currElt.repeatCount < 0) {
67
78
  currElt.repeatCount = Math.floor((newIndexStart - currElt.start) /
68
79
  currElt.duration) - 1;
69
80
  }
70
81
  oldTimeline.splice(i + 1, prevTimelineLength - (i + 1), ...newTimeline);
71
- return;
82
+ return false;
72
83
  }
73
84
  // else, there is a positive repeat we might want to update
74
85
  const eltLastTime = currElt.start + currElt.duration * (currElt.repeatCount + 1);
75
86
  if (eltLastTime <= newIndexStart) { // our new index comes directly after
76
87
  // put it after this one
77
88
  oldTimeline.splice(i + 1, prevTimelineLength - (i + 1), ...newTimeline);
78
- return;
89
+ return false;
79
90
  }
80
91
 
81
92
  const newCurrRepeat = ((newIndexStart - currElt.start) / currElt.duration) - 1;
@@ -88,14 +99,14 @@ export default function updateSegmentTimeline(
88
99
  oldTimeline.splice(i, prevTimelineLength - i, ...newTimeline);
89
100
  oldTimeline[i].start = currElt.start;
90
101
  oldTimeline[i].repeatCount = newRepeatCount;
91
- return;
102
+ return false;
92
103
  }
93
104
  log.warn("RepresentationIndex: Manifest update removed previous segments");
94
105
  oldTimeline[i].repeatCount = Math.floor(newCurrRepeat);
95
106
 
96
107
  // put it after this one
97
108
  oldTimeline.splice(i + 1, prevTimelineLength - (i + 1), ...newTimeline);
98
- return;
109
+ return false;
99
110
  }
100
111
  }
101
112
 
@@ -107,11 +118,11 @@ export default function updateSegmentTimeline(
107
118
  if (prevLastElt.repeatCount !== undefined && prevLastElt.repeatCount < 0) {
108
119
  if (prevLastElt.start > newLastElt.start) {
109
120
  log.warn("RepresentationIndex: The new index is older than the previous one");
110
- return; // the old comes after
121
+ return false;
111
122
  } else { // the new has more depth
112
123
  log.warn("RepresentationIndex: The new index is \"bigger\" than the previous one");
113
124
  oldTimeline.splice(0, prevTimelineLength, ...newTimeline);
114
- return;
125
+ return true;
115
126
  }
116
127
  }
117
128
  const prevLastTime = prevLastElt.start + prevLastElt.duration *
@@ -120,11 +131,11 @@ export default function updateSegmentTimeline(
120
131
  (newLastElt.repeatCount + 1);
121
132
  if (prevLastTime >= newLastTime) {
122
133
  log.warn("RepresentationIndex: The new index is older than the previous one");
123
- return; // the old comes after
134
+ return false;
124
135
  }
125
136
 
126
137
  // the new one has more depth. full update
127
138
  log.warn("RepresentationIndex: The new index is \"bigger\" than the previous one");
128
139
  oldTimeline.splice(0, prevTimelineLength, ...newTimeline);
129
- return;
140
+ return true;
130
141
  }
@@ -75,6 +75,7 @@ describe("parsers - webvtt - createStyledElement", () => {
75
75
  node.appendChild(textNode);
76
76
 
77
77
  const styleElements = {
78
+ // eslint-disable-next-line @typescript-eslint/naming-convention
78
79
  "#text": "color: yellow",
79
80
  };
80
81
 
@@ -39,10 +39,10 @@ export default function toHTML(
39
39
  cueObj : { start : number;
40
40
  end : number;
41
41
  settings: Partial<Record<string, string>>;
42
- header? : string;
42
+ header? : string | undefined;
43
43
  payload : string[]; },
44
44
  styling : { classes : IStyleElements;
45
- global? : string; }
45
+ global? : string | undefined; }
46
46
  ) : IVTTHTMLCue {
47
47
  const { start, end, settings, header, payload } = cueObj;
48
48
 
@@ -78,7 +78,7 @@ function parseTimeAndSettings(
78
78
 
79
79
  export interface IVTTCueObject { start : number;
80
80
  end : number;
81
- header? : string;
81
+ header : string | undefined;
82
82
  settings: Partial<Record<string, string>>;
83
83
  payload : string[]; }
84
84
 
@@ -45,13 +45,17 @@ export {
45
45
  ITextTrackPreference,
46
46
  IVideoTrackPreference,
47
47
 
48
+ IBitrateEstimate,
49
+ IPositionUpdateItem as IPositionUpdate,
50
+ IPlayerState,
51
+
48
52
  IStreamEvent,
49
53
  IStreamEventData,
50
54
  } from "./core/api";
51
55
  export {
52
56
  IPersistentSessionInfo,
53
57
  IPersistentSessionStorage,
54
- } from "./core/eme";
58
+ } from "./core/decrypt";
55
59
  export { ICustomError as IPlayerError } from "./errors";
56
60
  export {
57
61
  IExposedAdaptation as IAdaptation,
@@ -14,6 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
+ import PPromise from "../../utils/promise";
17
18
  import TaskCanceller, {
18
19
  CancellationError,
19
20
  } from "../../utils/task_canceller";
@@ -32,8 +33,7 @@ export default function addSegmentIntegrityChecks<T>(
32
33
  segmentLoader : ISegmentLoader<T>
33
34
  ) : ISegmentLoader<T> {
34
35
  return (url, content, initialCancelSignal, callbacks) => {
35
- return new Promise((res, rej) => {
36
-
36
+ return new PPromise((res, rej) => {
37
37
  const canceller = new TaskCanceller();
38
38
  const unregisterCancelLstnr = initialCancelSignal
39
39
  .register(function onCheckCancellation(err : CancellationError) {
@@ -14,8 +14,8 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import PPromise from "pinkie";
18
17
  import features from "../../features";
18
+ import PPromise from "../../utils/promise";
19
19
  import request from "../../utils/request";
20
20
  import takeFirstSet from "../../utils/take_first_set";
21
21
  import { CancellationSignal } from "../../utils/task_canceller";
@@ -78,6 +78,7 @@ export function imageParser(
78
78
  if (content.segment.isInit) { // image init segment has no use
79
79
  return { segmentType: "init",
80
80
  initializationData: null,
81
+ initializationDataSize: 0,
81
82
  protectionDataUpdate: false,
82
83
  initTimescale: undefined };
83
84
  }
@@ -92,6 +93,7 @@ export function imageParser(
92
93
  if (data === null || features.imageParser === null) {
93
94
  return { segmentType: "media",
94
95
  chunkData: null,
96
+ chunkSize: 0,
95
97
  chunkInfos: { duration: segment.duration,
96
98
  time: segment.time },
97
99
  chunkOffset,
@@ -107,6 +109,7 @@ export function imageParser(
107
109
  end: Number.MAX_VALUE,
108
110
  timescale: 1,
109
111
  type: "bif" },
112
+ chunkSize: undefined,
110
113
  chunkInfos: { time: 0,
111
114
  duration: Number.MAX_VALUE },
112
115
  chunkOffset,
@@ -14,9 +14,9 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import PPromise from "pinkie";
18
17
  import { ISegment } from "../../manifest";
19
18
  import { concat } from "../../utils/byte_parsing";
19
+ import PPromise from "../../utils/promise";
20
20
  import request from "../../utils/request";
21
21
  import { CancellationSignal } from "../../utils/task_canceller";
22
22
  import {
@@ -14,7 +14,6 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import PPromise from "pinkie";
18
17
  import { formatError } from "../../errors";
19
18
  import features from "../../features";
20
19
  import log from "../../log";
@@ -24,6 +23,7 @@ import {
24
23
  ILoadedResource,
25
24
  } from "../../parsers/manifest/dash/parsers_types";
26
25
  import objectAssign from "../../utils/object_assign";
26
+ import PPromise from "../../utils/promise";
27
27
  import request from "../../utils/request";
28
28
  import {
29
29
  strToUtf8,
@@ -14,8 +14,8 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import PPromise from "pinkie";
18
17
  import { CustomLoaderError } from "../../errors";
18
+ import PPromise from "../../utils/promise";
19
19
  import request, {
20
20
  fetchIsSupported,
21
21
  } from "../../utils/request";
@@ -94,8 +94,8 @@ export default function generateSegmentLoader(
94
94
  { lowLatencyMode,
95
95
  segmentLoader: customSegmentLoader,
96
96
  checkMediaSegmentIntegrity } : { lowLatencyMode: boolean;
97
- segmentLoader? : ICustomSegmentLoader;
98
- checkMediaSegmentIntegrity? : boolean; }
97
+ segmentLoader? : ICustomSegmentLoader | undefined;
98
+ checkMediaSegmentIntegrity? : boolean | undefined; }
99
99
  ) : ISegmentLoader<Uint8Array | ArrayBuffer | null> {
100
100
  return checkMediaSegmentIntegrity !== true ? segmentLoader :
101
101
  addSegmentIntegrityChecks(segmentLoader);
@@ -130,7 +130,7 @@ export default function generateSegmentLoader(
130
130
  transport: "dash",
131
131
  url };
132
132
 
133
- return new Promise((res, rej) => {
133
+ return new PPromise((res, rej) => {
134
134
  /** `true` when the custom segmentLoader should not be active anymore. */
135
135
  let hasFinished = false;
136
136
 
@@ -140,8 +140,8 @@ export default function generateSegmentLoader(
140
140
  */
141
141
  const resolve = (
142
142
  _args : { data : ArrayBuffer|Uint8Array;
143
- size? : number;
144
- duration? : number; }
143
+ size? : number | undefined;
144
+ duration? : number | undefined; }
145
145
  ) => {
146
146
  if (hasFinished || cancelSignal.isCancelled) {
147
147
  return;
@@ -183,7 +183,7 @@ export default function generateSegmentLoader(
183
183
  const progress = (
184
184
  _args : { duration : number;
185
185
  size : number;
186
- totalSize? : number; }
186
+ totalSize? : number | undefined; }
187
187
  ) => {
188
188
  if (hasFinished || cancelSignal.isCancelled) {
189
189
  return;