rx-player 4.5.0-dev.2026021900 → 4.5.0-dev.2026032600

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 (290) hide show
  1. package/CHANGELOG.md +15 -3
  2. package/VERSION +1 -1
  3. package/dist/commonjs/__GENERATED_CODE/embedded_dash_wasm.d.ts.map +1 -1
  4. package/dist/commonjs/__GENERATED_CODE/embedded_dash_wasm.js +1 -1
  5. package/dist/commonjs/__GENERATED_CODE/embedded_worker.d.ts.map +1 -1
  6. package/dist/commonjs/__GENERATED_CODE/embedded_worker.js +1 -1
  7. package/dist/commonjs/compat/browser_compatibility_types.d.ts +16 -14
  8. package/dist/commonjs/compat/browser_compatibility_types.d.ts.map +1 -1
  9. package/dist/commonjs/compat/browser_compatibility_types.js +7 -4
  10. package/dist/commonjs/compat/browser_version.d.ts +2 -1
  11. package/dist/commonjs/compat/browser_version.d.ts.map +1 -1
  12. package/dist/commonjs/compat/browser_version.js +13 -0
  13. package/dist/commonjs/compat/disable_remote_playback_on_managed_media_source.d.ts.map +1 -1
  14. package/dist/commonjs/compat/disable_remote_playback_on_managed_media_source.js +1 -1
  15. package/dist/commonjs/compat/is_codec_supported.d.ts.map +1 -1
  16. package/dist/commonjs/compat/is_codec_supported.js +4 -3
  17. package/dist/commonjs/compat/should_patch_out_dolby_vision_config_data_from_mp4.d.ts +26 -0
  18. package/dist/commonjs/compat/should_patch_out_dolby_vision_config_data_from_mp4.d.ts.map +1 -0
  19. package/dist/commonjs/compat/should_patch_out_dolby_vision_config_data_from_mp4.js +45 -0
  20. package/dist/commonjs/core/cmcd/cmcd_data_builder.js +2 -2
  21. package/dist/commonjs/core/entry/content_preparer.d.ts +1 -6
  22. package/dist/commonjs/core/entry/content_preparer.d.ts.map +1 -1
  23. package/dist/commonjs/core/entry/content_preparer.js +2 -125
  24. package/dist/commonjs/core/entry/core_entry.d.ts +1 -1
  25. package/dist/commonjs/core/entry/core_entry.d.ts.map +1 -1
  26. package/dist/commonjs/core/entry/core_entry.js +2 -7
  27. package/dist/commonjs/core/entry/core_text_displayer_interface.d.ts.map +1 -1
  28. package/dist/commonjs/core/entry/core_text_displayer_interface.js +3 -1
  29. package/dist/commonjs/core/entry/index.d.ts +1 -1
  30. package/dist/commonjs/core/entry/index.d.ts.map +1 -1
  31. package/dist/commonjs/core/entry/utils.d.ts +64 -0
  32. package/dist/commonjs/core/entry/utils.d.ts.map +1 -1
  33. package/dist/commonjs/core/entry/utils.js +165 -0
  34. package/dist/commonjs/core/fetchers/segment/segment_fetcher.d.ts.map +1 -1
  35. package/dist/commonjs/core/fetchers/segment/segment_fetcher.js +2 -1
  36. package/dist/commonjs/core/fetchers/segment/segment_queue.d.ts +5 -6
  37. package/dist/commonjs/core/fetchers/segment/segment_queue.d.ts.map +1 -1
  38. package/dist/commonjs/core/fetchers/thumbnails/thumbnail_fetcher.d.ts.map +1 -1
  39. package/dist/commonjs/core/fetchers/thumbnails/thumbnail_fetcher.js +34 -30
  40. package/dist/commonjs/experimental/features/worker/index.d.ts +2 -1
  41. package/dist/commonjs/experimental/features/worker/index.d.ts.map +1 -1
  42. package/dist/commonjs/experimental/features/worker/index.js +4 -3
  43. package/dist/commonjs/experimental/tools/VideoThumbnailLoader/prepare_source_buffer.d.ts.map +1 -1
  44. package/dist/commonjs/experimental/tools/VideoThumbnailLoader/prepare_source_buffer.js +2 -1
  45. package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/probers/defaultCodecsFinder.d.ts.map +1 -1
  46. package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/probers/defaultCodecsFinder.js +8 -6
  47. package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/probers/mediaContentType.d.ts.map +1 -1
  48. package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/probers/mediaContentType.js +4 -3
  49. package/dist/commonjs/initialize_worker.js +1 -1
  50. package/dist/commonjs/main_thread/api/debug/modules/segment_buffer_content.js +3 -3
  51. package/dist/commonjs/main_thread/api/public_api.js +3 -3
  52. package/dist/commonjs/main_thread/init/utils/update_manifest_codec_support.d.ts.map +1 -1
  53. package/dist/commonjs/main_thread/init/utils/update_manifest_codec_support.js +24 -12
  54. package/dist/commonjs/manifest/classes/adaptation.d.ts.map +1 -1
  55. package/dist/commonjs/manifest/classes/adaptation.js +3 -1
  56. package/dist/commonjs/manifest/classes/representation.d.ts +6 -2
  57. package/dist/commonjs/manifest/classes/representation.d.ts.map +1 -1
  58. package/dist/commonjs/manifest/classes/representation.js +45 -23
  59. package/dist/commonjs/manifest/types.d.ts +14 -6
  60. package/dist/commonjs/manifest/types.d.ts.map +1 -1
  61. package/dist/commonjs/manifest/utils.js +4 -4
  62. package/dist/commonjs/mse/main_media_source_interface.d.ts.map +1 -1
  63. package/dist/commonjs/mse/main_media_source_interface.js +3 -2
  64. package/dist/commonjs/mse/worker_media_source_interface.d.ts.map +1 -1
  65. package/dist/commonjs/parsers/containers/isobmff/get_box.d.ts +12 -1
  66. package/dist/commonjs/parsers/containers/isobmff/get_box.d.ts.map +1 -1
  67. package/dist/commonjs/parsers/containers/isobmff/get_box.js +16 -0
  68. package/dist/commonjs/parsers/containers/isobmff/index.d.ts +2 -1
  69. package/dist/commonjs/parsers/containers/isobmff/index.d.ts.map +1 -1
  70. package/dist/commonjs/parsers/containers/isobmff/index.js +3 -1
  71. package/dist/commonjs/parsers/containers/isobmff/remove_dolby_vision_config_data.d.ts +13 -0
  72. package/dist/commonjs/parsers/containers/isobmff/remove_dolby_vision_config_data.d.ts.map +1 -0
  73. package/dist/commonjs/parsers/containers/isobmff/remove_dolby_vision_config_data.js +180 -0
  74. package/dist/commonjs/parsers/manifest/metaplaylist/metaplaylist_parser.js +4 -4
  75. package/dist/commonjs/parsers/texttracks/ttml/html/apply_line_height.d.ts.map +1 -1
  76. package/dist/commonjs/parsers/texttracks/ttml/html/apply_line_height.js +16 -1
  77. package/dist/commonjs/transports/dash/segment_parser.d.ts.map +1 -1
  78. package/dist/commonjs/transports/dash/segment_parser.js +6 -0
  79. package/dist/commonjs/transports/metaplaylist/pipelines.d.ts.map +1 -1
  80. package/dist/commonjs/transports/metaplaylist/pipelines.js +2 -1
  81. package/dist/commonjs/transports/smooth/pipelines.js +3 -3
  82. package/dist/commonjs/transports/types.d.ts +28 -2
  83. package/dist/commonjs/transports/types.d.ts.map +1 -1
  84. package/dist/commonjs/transports/utils/parse_text_track.js +1 -1
  85. package/dist/es2017/__GENERATED_CODE/embedded_dash_wasm.d.ts.map +1 -1
  86. package/dist/es2017/__GENERATED_CODE/embedded_dash_wasm.js +1 -1
  87. package/dist/es2017/__GENERATED_CODE/embedded_worker.d.ts.map +1 -1
  88. package/dist/es2017/__GENERATED_CODE/embedded_worker.js +1 -1
  89. package/dist/es2017/compat/browser_compatibility_types.d.ts +16 -14
  90. package/dist/es2017/compat/browser_compatibility_types.d.ts.map +1 -1
  91. package/dist/es2017/compat/browser_compatibility_types.js +7 -1
  92. package/dist/es2017/compat/browser_version.d.ts +2 -1
  93. package/dist/es2017/compat/browser_version.d.ts.map +1 -1
  94. package/dist/es2017/compat/browser_version.js +13 -1
  95. package/dist/es2017/compat/disable_remote_playback_on_managed_media_source.d.ts.map +1 -1
  96. package/dist/es2017/compat/disable_remote_playback_on_managed_media_source.js +2 -2
  97. package/dist/es2017/compat/is_codec_supported.d.ts.map +1 -1
  98. package/dist/es2017/compat/is_codec_supported.js +2 -1
  99. package/dist/es2017/compat/should_patch_out_dolby_vision_config_data_from_mp4.d.ts +26 -0
  100. package/dist/es2017/compat/should_patch_out_dolby_vision_config_data_from_mp4.d.ts.map +1 -0
  101. package/dist/es2017/compat/should_patch_out_dolby_vision_config_data_from_mp4.js +42 -0
  102. package/dist/es2017/core/cmcd/cmcd_data_builder.js +2 -2
  103. package/dist/es2017/core/entry/content_preparer.d.ts +1 -6
  104. package/dist/es2017/core/entry/content_preparer.d.ts.map +1 -1
  105. package/dist/es2017/core/entry/content_preparer.js +1 -76
  106. package/dist/es2017/core/entry/core_entry.d.ts +1 -1
  107. package/dist/es2017/core/entry/core_entry.d.ts.map +1 -1
  108. package/dist/es2017/core/entry/core_entry.js +2 -7
  109. package/dist/es2017/core/entry/core_text_displayer_interface.d.ts.map +1 -1
  110. package/dist/es2017/core/entry/core_text_displayer_interface.js +3 -1
  111. package/dist/es2017/core/entry/index.d.ts +1 -1
  112. package/dist/es2017/core/entry/index.d.ts.map +1 -1
  113. package/dist/es2017/core/entry/utils.d.ts +64 -0
  114. package/dist/es2017/core/entry/utils.d.ts.map +1 -1
  115. package/dist/es2017/core/entry/utils.js +98 -0
  116. package/dist/es2017/core/fetchers/segment/segment_fetcher.d.ts.map +1 -1
  117. package/dist/es2017/core/fetchers/segment/segment_fetcher.js +2 -1
  118. package/dist/es2017/core/fetchers/segment/segment_queue.d.ts +5 -6
  119. package/dist/es2017/core/fetchers/segment/segment_queue.d.ts.map +1 -1
  120. package/dist/es2017/core/fetchers/thumbnails/thumbnail_fetcher.d.ts.map +1 -1
  121. package/dist/es2017/core/fetchers/thumbnails/thumbnail_fetcher.js +21 -16
  122. package/dist/es2017/experimental/features/worker/index.d.ts +2 -1
  123. package/dist/es2017/experimental/features/worker/index.d.ts.map +1 -1
  124. package/dist/es2017/experimental/features/worker/index.js +2 -3
  125. package/dist/es2017/experimental/tools/VideoThumbnailLoader/prepare_source_buffer.d.ts.map +1 -1
  126. package/dist/es2017/experimental/tools/VideoThumbnailLoader/prepare_source_buffer.js +2 -1
  127. package/dist/es2017/experimental/tools/mediaCapabilitiesProber/probers/defaultCodecsFinder.d.ts.map +1 -1
  128. package/dist/es2017/experimental/tools/mediaCapabilitiesProber/probers/defaultCodecsFinder.js +3 -1
  129. package/dist/es2017/experimental/tools/mediaCapabilitiesProber/probers/mediaContentType.d.ts.map +1 -1
  130. package/dist/es2017/experimental/tools/mediaCapabilitiesProber/probers/mediaContentType.js +2 -1
  131. package/dist/es2017/initialize_worker.js +1 -1
  132. package/dist/es2017/main_thread/api/debug/modules/segment_buffer_content.js +3 -3
  133. package/dist/es2017/main_thread/api/public_api.js +3 -3
  134. package/dist/es2017/main_thread/init/utils/update_manifest_codec_support.d.ts.map +1 -1
  135. package/dist/es2017/main_thread/init/utils/update_manifest_codec_support.js +9 -7
  136. package/dist/es2017/manifest/classes/adaptation.d.ts.map +1 -1
  137. package/dist/es2017/manifest/classes/adaptation.js +3 -1
  138. package/dist/es2017/manifest/classes/representation.d.ts +6 -2
  139. package/dist/es2017/manifest/classes/representation.d.ts.map +1 -1
  140. package/dist/es2017/manifest/classes/representation.js +45 -23
  141. package/dist/es2017/manifest/types.d.ts +14 -6
  142. package/dist/es2017/manifest/types.d.ts.map +1 -1
  143. package/dist/es2017/manifest/utils.js +4 -4
  144. package/dist/es2017/mse/main_media_source_interface.d.ts.map +1 -1
  145. package/dist/es2017/mse/main_media_source_interface.js +2 -1
  146. package/dist/es2017/mse/worker_media_source_interface.d.ts.map +1 -1
  147. package/dist/es2017/parsers/containers/isobmff/get_box.d.ts +12 -1
  148. package/dist/es2017/parsers/containers/isobmff/get_box.d.ts.map +1 -1
  149. package/dist/es2017/parsers/containers/isobmff/get_box.js +16 -1
  150. package/dist/es2017/parsers/containers/isobmff/index.d.ts +2 -1
  151. package/dist/es2017/parsers/containers/isobmff/index.d.ts.map +1 -1
  152. package/dist/es2017/parsers/containers/isobmff/index.js +2 -1
  153. package/dist/es2017/parsers/containers/isobmff/remove_dolby_vision_config_data.d.ts +13 -0
  154. package/dist/es2017/parsers/containers/isobmff/remove_dolby_vision_config_data.d.ts.map +1 -0
  155. package/dist/es2017/parsers/containers/isobmff/remove_dolby_vision_config_data.js +155 -0
  156. package/dist/es2017/parsers/manifest/metaplaylist/metaplaylist_parser.js +4 -4
  157. package/dist/es2017/parsers/texttracks/ttml/html/apply_line_height.d.ts.map +1 -1
  158. package/dist/es2017/parsers/texttracks/ttml/html/apply_line_height.js +16 -1
  159. package/dist/es2017/transports/dash/segment_parser.d.ts.map +1 -1
  160. package/dist/es2017/transports/dash/segment_parser.js +7 -1
  161. package/dist/es2017/transports/metaplaylist/pipelines.d.ts.map +1 -1
  162. package/dist/es2017/transports/metaplaylist/pipelines.js +2 -1
  163. package/dist/es2017/transports/smooth/pipelines.js +3 -3
  164. package/dist/es2017/transports/types.d.ts +28 -2
  165. package/dist/es2017/transports/types.d.ts.map +1 -1
  166. package/dist/es2017/transports/utils/parse_text_track.js +1 -1
  167. package/dist/mpd-parser.wasm +0 -0
  168. package/dist/worker.js +8 -8
  169. package/eslint.config.mjs +1 -14
  170. package/package.json +19 -22
  171. package/src/__GENERATED_CODE/embedded_dash_wasm.ts +1 -1
  172. package/src/__GENERATED_CODE/embedded_worker.ts +1 -1
  173. package/src/compat/__tests__/browser_compatibility_types.test.ts +15 -26
  174. package/src/compat/__tests__/browser_version.test.ts +57 -18
  175. package/src/compat/__tests__/clear_element_src.test.ts +20 -40
  176. package/src/compat/__tests__/is_codec_supported.test.ts +39 -44
  177. package/src/compat/__tests__/is_vtt_cue.test.ts +5 -8
  178. package/src/compat/__tests__/make_vtt_cue.test.ts +20 -31
  179. package/src/compat/__tests__/remove_cue.test.ts +8 -20
  180. package/src/compat/__tests__/should_patch_out_dolby_vision_config_data_from_mp4.test.ts +78 -0
  181. package/src/compat/browser_compatibility_types.ts +8 -1
  182. package/src/compat/browser_version.ts +17 -1
  183. package/src/compat/disable_remote_playback_on_managed_media_source.ts +2 -2
  184. package/src/compat/is_codec_supported.ts +2 -1
  185. package/src/compat/should_patch_out_dolby_vision_config_data_from_mp4.ts +50 -0
  186. package/src/core/adaptive/__tests__/adaptive_representation_selector.test.ts +774 -0
  187. package/src/core/adaptive/__tests__/buffer_based_chooser.test.ts +26 -84
  188. package/src/core/adaptive/__tests__/guess_based_chooser.test.ts +5 -2
  189. package/src/core/adaptive/utils/__tests__/bandwidth_estimator.test.ts +117 -0
  190. package/src/core/adaptive/utils/__tests__/last_estimate_storage.test.ts +76 -0
  191. package/src/core/adaptive/utils/__tests__/pending_requests_store.test.ts +5 -2
  192. package/src/core/adaptive/utils/__tests__/representation_score_calculator.test.ts +4 -2
  193. package/src/core/cmcd/__tests__/cmcd_data_builder.test.ts +464 -0
  194. package/src/core/cmcd/cmcd_data_builder.ts +2 -2
  195. package/src/core/entry/__tests__/FreezeResolver.test.ts +1 -1
  196. package/src/core/entry/__tests__/content_time_boundaries_observer.test.ts +1 -2
  197. package/src/core/entry/__tests__/core_text_displayer_interface.test.ts +205 -0
  198. package/src/core/entry/__tests__/get_buffered_data_per_media_buffer.test.ts +95 -0
  199. package/src/core/entry/__tests__/track_choice_setter.test.ts +288 -0
  200. package/src/core/entry/__tests__/utils.test.ts +315 -0
  201. package/src/core/entry/content_preparer.ts +7 -118
  202. package/src/core/entry/core_entry.ts +7 -14
  203. package/src/core/entry/core_text_displayer_interface.ts +3 -1
  204. package/src/core/entry/index.ts +1 -1
  205. package/src/core/entry/utils.ts +151 -0
  206. package/src/core/fetchers/__tests__/cdn_prioritizer.test.ts +166 -0
  207. package/src/core/fetchers/manifest/__tests__/manifest_fetcher.test.ts +803 -0
  208. package/src/core/fetchers/segment/__tests__/segment_fetcher.test.ts +872 -0
  209. package/src/core/fetchers/segment/__tests__/segment_queue.test.ts +557 -0
  210. package/src/core/fetchers/segment/segment_fetcher.ts +2 -1
  211. package/src/core/fetchers/segment/segment_queue.ts +5 -6
  212. package/src/core/fetchers/thumbnails/__tests__/thumbnail_fetcher.test.ts +435 -0
  213. package/src/core/fetchers/thumbnails/thumbnail_fetcher.ts +28 -20
  214. package/src/core/fetchers/utils/__tests__/schedule_request.test.ts +331 -0
  215. package/src/core/stream/adaptation/__tests__/get_representations_switch_strategy.test.ts +4 -3
  216. package/src/core/stream/representation/utils/__tests__/append_segment_to_buffer.test.ts +1 -1
  217. package/src/core/stream/representation/utils/__tests__/get_segment_priority.test.ts +1 -1
  218. package/src/core/stream/representation/utils/__tests__/push_init_segment.test.ts +1 -1
  219. package/src/core/stream/representation/utils/__tests__/push_media_segment.test.ts +1 -1
  220. package/src/errors/__tests__/format_error.test.ts +23 -24
  221. package/src/experimental/features/worker/index.ts +2 -4
  222. package/src/experimental/tools/VideoThumbnailLoader/prepare_source_buffer.ts +2 -1
  223. package/src/experimental/tools/mediaCapabilitiesProber/__tests__/probers/mediaDisplayInfos.test.ts +106 -0
  224. package/src/experimental/tools/mediaCapabilitiesProber/probers/__tests__/HDCPPolicy.test.ts +19 -42
  225. package/src/experimental/tools/mediaCapabilitiesProber/probers/__tests__/decodingInfo.test.ts +33 -40
  226. package/src/experimental/tools/mediaCapabilitiesProber/probers/__tests__/defaultCodecsFinder.test.ts +44 -68
  227. package/src/experimental/tools/mediaCapabilitiesProber/probers/__tests__/mediaContentType.test.ts +45 -80
  228. package/src/experimental/tools/mediaCapabilitiesProber/probers/defaultCodecsFinder.ts +3 -1
  229. package/src/experimental/tools/mediaCapabilitiesProber/probers/mediaContentType.ts +2 -1
  230. package/src/features/__tests__/add_features.test.ts +12 -27
  231. package/src/initialize_worker.ts +1 -1
  232. package/src/main_thread/api/__tests__/option_utils.test.ts +38 -67
  233. package/src/main_thread/api/__tests__/public_api.test.ts +56 -138
  234. package/src/main_thread/api/debug/modules/segment_buffer_content.ts +3 -3
  235. package/src/main_thread/api/public_api.ts +3 -3
  236. package/src/main_thread/decrypt/__tests__/__global__/find_key_system.test.ts +46 -28
  237. package/src/main_thread/decrypt/__tests__/__global__/get_license.test.ts +40 -10
  238. package/src/main_thread/decrypt/__tests__/__global__/init_data.test.ts +112 -129
  239. package/src/main_thread/decrypt/__tests__/__global__/media_key_system_access.test.ts +282 -377
  240. package/src/main_thread/decrypt/__tests__/__global__/media_keys.test.ts +70 -63
  241. package/src/main_thread/decrypt/__tests__/__global__/server_certificate.test.ts +73 -54
  242. package/src/main_thread/decrypt/__tests__/__global__/utils.ts +43 -83
  243. package/src/main_thread/decrypt/__tests__/find_key_system.test.ts +36 -17
  244. package/src/main_thread/decrypt/utils/__tests__/clean_old_stored_persistent_info.test.ts +44 -48
  245. package/src/main_thread/init/utils/__tests__/are_same_stream_events.test.ts +7 -22
  246. package/src/main_thread/init/utils/__tests__/refresh_scheduled_events_list.test.ts +3 -6
  247. package/src/main_thread/init/utils/__tests__/update_manifest_codec_support.test.ts +42 -19
  248. package/src/main_thread/init/utils/update_manifest_codec_support.ts +8 -6
  249. package/src/manifest/classes/__tests__/adaptation.test.ts +69 -125
  250. package/src/manifest/classes/__tests__/manifest.test.ts +88 -95
  251. package/src/manifest/classes/__tests__/period.test.ts +167 -117
  252. package/src/manifest/classes/__tests__/representation.test.ts +84 -25
  253. package/src/manifest/classes/__tests__/update_periods.test.ts +96 -225
  254. package/src/manifest/classes/adaptation.ts +4 -1
  255. package/src/manifest/classes/representation.ts +59 -27
  256. package/src/manifest/types.ts +14 -6
  257. package/src/manifest/utils.ts +4 -4
  258. package/src/mse/__tests__/main_media_source_interface.test.ts +848 -0
  259. package/src/mse/__tests__/worker_media_source_interface.test.ts +608 -0
  260. package/src/mse/main_media_source_interface.ts +2 -1
  261. package/src/mse/worker_media_source_interface.ts +2 -2
  262. package/src/parsers/containers/isobmff/__tests__/get_box.test.ts +449 -0
  263. package/src/parsers/containers/isobmff/__tests__/remove_dolby_vision_config_data.test.ts +282 -0
  264. package/src/parsers/containers/isobmff/get_box.ts +17 -0
  265. package/src/parsers/containers/isobmff/index.ts +8 -1
  266. package/src/parsers/containers/isobmff/remove_dolby_vision_config_data.ts +179 -0
  267. package/src/parsers/manifest/dash/common/__tests__/get_clock_offset.test.ts +19 -25
  268. package/src/parsers/manifest/dash/common/__tests__/get_http_utc-timing_url.test.ts +7 -19
  269. package/src/parsers/manifest/dash/js-parser/node_parsers/__tests__/ContentProtection.test.ts +26 -37
  270. package/src/parsers/manifest/dash/js-parser/node_parsers/__tests__/Initialization.test.ts +24 -53
  271. package/src/parsers/manifest/dash/js-parser/node_parsers/__tests__/SegmentURL.test.ts +31 -78
  272. package/src/parsers/manifest/metaplaylist/metaplaylist_parser.ts +6 -4
  273. package/src/parsers/manifest/utils/__tests__/update_segment_timeline.test.ts +79 -87
  274. package/src/parsers/texttracks/ttml/__tests__/resolve_styles_inheritance.test.ts +20 -26
  275. package/src/parsers/texttracks/ttml/html/__tests__/__global__/html_ttml_parser.test.ts +2 -7
  276. package/src/parsers/texttracks/ttml/html/apply_line_height.ts +16 -1
  277. package/src/parsers/texttracks/webvtt/__tests__/parse_cue_block.test.ts +33 -30
  278. package/src/parsers/texttracks/webvtt/__tests__/parse_style_block.test.ts +33 -100
  279. package/src/parsers/texttracks/webvtt/html/__tests__/convert_payload_to_html.test.ts +16 -18
  280. package/src/parsers/texttracks/webvtt/html/__tests__/parse_webvtt_to_div.test.ts +73 -78
  281. package/src/parsers/texttracks/webvtt/html/__tests__/to_html.test.ts +36 -37
  282. package/src/transports/dash/segment_parser.ts +13 -0
  283. package/src/transports/metaplaylist/pipelines.ts +2 -1
  284. package/src/transports/smooth/isobmff/__tests__/create_boxes.test.ts +150 -127
  285. package/src/transports/smooth/pipelines.ts +3 -3
  286. package/src/transports/types.ts +28 -2
  287. package/src/transports/utils/__tests__/check_isobmff_integrity.test.ts +49 -75
  288. package/src/transports/utils/parse_text_track.ts +1 -1
  289. package/src/utils/__tests__/base64.test.ts +159 -191
  290. package/src/utils/__tests__/object_assign.test.ts +2 -2
@@ -171,7 +171,10 @@ export default class Adaptation implements IAdaptationMetadata {
171
171
  const reprObject: IRepresentationFilterRepresentation = {
172
172
  id: representation.id,
173
173
  bitrate: representation.bitrate,
174
- codecs: representation.codecs,
174
+ codecs:
175
+ representation.chosenCodec !== undefined
176
+ ? [representation.chosenCodec]
177
+ : representation.baseCodecs,
175
178
  height: representation.height,
176
179
  width: representation.width,
177
180
  frameRate: representation.frameRate,
@@ -71,9 +71,13 @@ class Representation implements IRepresentationMetadata {
71
71
  */
72
72
  public isSpatialAudio?: boolean | undefined;
73
73
  /**
74
- * @see IRepresentationMetadata.codecs
74
+ * @see IRepresentationMetadata.baseCodecs
75
75
  */
76
- public codecs: string[];
76
+ public baseCodecs: string[];
77
+ /**
78
+ * @see IRepresentationMetadata.chosenCodec
79
+ */
80
+ public chosenCodec: string | undefined;
77
81
  /**
78
82
  * @see IRepresentationMetadata.mimeType
79
83
  */
@@ -139,7 +143,7 @@ class Representation implements IRepresentationMetadata {
139
143
  this.uniqueId = generateRepresentationUniqueId();
140
144
  this.shouldBeAvoided = false;
141
145
  this.bitrate = args.bitrate;
142
- this.codecs = [];
146
+ this.baseCodecs = [];
143
147
  this.trackType = trackType;
144
148
 
145
149
  if (args.isSpatialAudio !== undefined) {
@@ -176,38 +180,54 @@ class Representation implements IRepresentationMetadata {
176
180
  const isEncrypted = this.contentProtections !== undefined;
177
181
 
178
182
  if (trackType === "audio" || trackType === "video") {
183
+ /**
184
+ * - `true` -> We found a supported codec linked to this Representation
185
+ * - `false` -> We did not find yet a supported codec linked to this
186
+ * Representation
187
+ * - `undefined` -> The current prefered codec has its support not
188
+ * known yet.
189
+ */
190
+ let foundSupportedCodec: boolean | undefined = false;
191
+
179
192
  // Supplemental codecs are defined as backwards-compatible codecs enhancing
180
193
  // the experience of a base layer codec
181
194
  if (args.supplementalCodecs !== undefined) {
182
- const isSupplementaryCodecSupported = cachedCodecSupport.isSupported(
195
+ this.baseCodecs.push(args.supplementalCodecs);
196
+ foundSupportedCodec = cachedCodecSupport.isSupported(
183
197
  this.mimeType ?? "",
184
198
  args.supplementalCodecs ?? "",
185
199
  isEncrypted,
186
200
  );
187
-
188
- if (isSupplementaryCodecSupported !== false) {
189
- this.codecs = [args.supplementalCodecs];
190
- this.isSupported = isSupplementaryCodecSupported;
201
+ if (foundSupportedCodec === true) {
202
+ log.debug("manifest", "supplementalCodec is supported as per the cache", {
203
+ codec: args.supplementalCodecs,
204
+ });
205
+ this.chosenCodec = args.supplementalCodecs;
191
206
  }
192
207
  }
193
- if (this.isSupported !== true) {
194
- if (this.codecs.length > 0) {
195
- // We couldn't check for support of another supplemental codec.
196
- // Just push that codec without testing support yet, we'll check
197
- // support later.
198
- this.codecs.push(args.codecs ?? "");
199
- } else {
200
- this.codecs = args.codecs === undefined ? [] : [args.codecs];
201
- this.isSupported = cachedCodecSupport.isSupported(
202
- this.mimeType ?? "",
203
- args.codecs ?? "",
204
- isEncrypted,
205
- );
206
- }
208
+
209
+ if (args.codecs !== undefined) {
210
+ this.baseCodecs.push(args.codecs);
207
211
  }
212
+
213
+ if (foundSupportedCodec === false) {
214
+ foundSupportedCodec = cachedCodecSupport.isSupported(
215
+ this.mimeType ?? "",
216
+ args.codecs ?? "",
217
+ isEncrypted,
218
+ );
219
+ // Put the generic codec as a fallback anyway if supplemental ones
220
+ // aren't present or supported.
221
+ log.debug("manifest", "codec is supported as per the cache", {
222
+ codec: args.codecs,
223
+ });
224
+ this.chosenCodec = args.codecs;
225
+ }
226
+ this.isSupported = foundSupportedCodec;
208
227
  } else {
209
228
  if (args.codecs !== undefined) {
210
- this.codecs.push(args.codecs);
229
+ this.baseCodecs.push(args.codecs);
230
+ this.chosenCodec = args.codecs;
211
231
  }
212
232
  this.isSupported = true;
213
233
  }
@@ -233,7 +253,7 @@ class Representation implements IRepresentationMetadata {
233
253
  const isEncrypted = this.contentProtections !== undefined;
234
254
  let isSupported: boolean | undefined = false;
235
255
  const mimeType = this.mimeType ?? "";
236
- let codecs = this.codecs ?? [];
256
+ let codecs = this.baseCodecs ?? [];
237
257
  if (codecs.length === 0) {
238
258
  codecs = [""];
239
259
  }
@@ -241,7 +261,8 @@ class Representation implements IRepresentationMetadata {
241
261
  for (const codec of codecs) {
242
262
  isSupported = cachedCodecSupport.isSupported(mimeType, codec, isEncrypted);
243
263
  if (isSupported === true) {
244
- this.codecs = [codec];
264
+ log.debug("manifest", "codec is found to be supported", { codec });
265
+ this.chosenCodec = codec;
245
266
  break;
246
267
  }
247
268
  if (isSupported === undefined) {
@@ -271,7 +292,17 @@ class Representation implements IRepresentationMetadata {
271
292
  * @returns {string}
272
293
  */
273
294
  public getMimeTypeString(): string {
274
- return `${this.mimeType ?? ""};codecs="${this.codecs?.[0] ?? ""}"`;
295
+ let codec = this.chosenCodec;
296
+ if (codec === undefined) {
297
+ log.warn(
298
+ "manifest",
299
+ "Asked for mimetype string when codec support is yet unknown, attempting with first known linked codec",
300
+ );
301
+ if (this.baseCodecs !== undefined) {
302
+ codec = this.baseCodecs[0];
303
+ }
304
+ }
305
+ return `${this.mimeType ?? ""};codecs="${codec ?? ""}"`;
275
306
  }
276
307
 
277
308
  /**
@@ -483,7 +514,8 @@ class Representation implements IRepresentationMetadata {
483
514
  id: this.id,
484
515
  uniqueId: this.uniqueId,
485
516
  bitrate: this.bitrate,
486
- codecs: this.codecs,
517
+ baseCodecs: this.baseCodecs,
518
+ chosenCodec: this.chosenCodec,
487
519
  mimeType: this.mimeType,
488
520
  width: this.width,
489
521
  height: this.height,
@@ -431,14 +431,22 @@ export interface IRepresentationMetadata {
431
431
  * In that scenario, we could have an array with two elements:
432
432
  * 1. The Dolby Vision codec
433
433
  * 2. The base HDR10 codec, hopefully with higher device compatibility.
434
+ */
435
+ baseCodecs?: string[];
436
+ /**
437
+ * `baseCodecs` can define multiple codecs linked to this `Representation`,
438
+ * e.g. Dolby Vision retro-compatible to a non-Dolby Vision HEVC-based
439
+ * codec).
440
+ *
441
+ * But on the current device, we'll generally want to announce a unique
442
+ * codec, after checking the one that is supported.
443
+ *
444
+ * This is what `chosenCodecs` is for: the actual codec to rely on.
434
445
  *
435
- * To note that we should aim to have the shorter array possible to always
436
- * expose the actually relied-on codec through the API. The idea could be
437
- * to only have several elements in this Array _BEFORE_ testing for codec
438
- * support on the current device, only to then remove all non-used codecs to
439
- * keep the one actually relied on.
446
+ * Set to `undefined` initially until we know which codec from `baseCodecs`
447
+ * is supported.
440
448
  */
441
- codecs?: string[];
449
+ chosenCodec?: string | undefined;
442
450
  /**
443
451
  * A string describing the mime-type for this Representation.
444
452
  * Examples: audio/mp4, video/webm, application/mp4, text/plain
@@ -328,12 +328,12 @@ export function toVideoTrack(
328
328
  export function toAudioRepresentation(
329
329
  representation: IRepresentationMetadata,
330
330
  ): IAudioRepresentation {
331
- const { id, bitrate, codecs, isSpatialAudio, isSupported, decipherable } =
331
+ const { id, bitrate, chosenCodec, isSpatialAudio, isSupported, decipherable } =
332
332
  representation;
333
333
  return {
334
334
  id,
335
335
  bitrate,
336
- codec: codecs?.[0],
336
+ codec: chosenCodec,
337
337
  isSpatialAudio,
338
338
  isCodecSupported: isSupported,
339
339
  decipherable,
@@ -353,7 +353,7 @@ export function toVideoRepresentation(
353
353
  frameRate,
354
354
  width,
355
355
  height,
356
- codecs,
356
+ chosenCodec,
357
357
  hdrInfo,
358
358
  isSupported,
359
359
  decipherable,
@@ -365,7 +365,7 @@ export function toVideoRepresentation(
365
365
  frameRate,
366
366
  width,
367
367
  height,
368
- codec: codecs?.[0],
368
+ codec: chosenCodec,
369
369
  hdrInfo,
370
370
  isCodecSupported: isSupported,
371
371
  decipherable,