rx-player 4.4.0 → 4.4.1-dev.2025101500

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 (341) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +52 -113
  3. package/VERSION +1 -1
  4. package/dist/commonjs/__GENERATED_CODE/embedded_worker.d.ts.map +1 -1
  5. package/dist/commonjs/__GENERATED_CODE/embedded_worker.js +1 -1
  6. package/dist/commonjs/core/{main/common → entry}/FreezeResolver.d.ts +3 -3
  7. package/dist/commonjs/core/entry/FreezeResolver.d.ts.map +1 -0
  8. package/dist/commonjs/core/{main/common → entry}/FreezeResolver.js +3 -3
  9. package/dist/{es2017/core/main/worker → commonjs/core/entry}/content_preparer.d.ts +22 -15
  10. package/dist/commonjs/core/entry/content_preparer.d.ts.map +1 -0
  11. package/dist/commonjs/core/{main/worker → entry}/content_preparer.js +62 -64
  12. package/dist/{es2017/core/main/common → commonjs/core/entry}/content_time_boundaries_observer.d.ts +5 -5
  13. package/dist/commonjs/core/entry/content_time_boundaries_observer.d.ts.map +1 -0
  14. package/dist/commonjs/core/{main/common → entry}/content_time_boundaries_observer.js +6 -6
  15. package/dist/commonjs/core/entry/core_entry.d.ts +36 -0
  16. package/dist/commonjs/core/entry/core_entry.d.ts.map +1 -0
  17. package/dist/commonjs/core/{main/worker/worker_main.js → entry/core_entry.js} +192 -153
  18. package/dist/commonjs/core/{main/worker/worker_text_displayer_interface.d.ts → entry/core_text_displayer_interface.d.ts} +11 -11
  19. package/dist/commonjs/core/entry/core_text_displayer_interface.d.ts.map +1 -0
  20. package/dist/commonjs/core/{main/worker/worker_text_displayer_interface.js → entry/core_text_displayer_interface.js} +22 -22
  21. package/dist/commonjs/core/{main/common → entry}/create_content_time_boundaries_observer.d.ts +6 -6
  22. package/dist/commonjs/core/entry/create_content_time_boundaries_observer.d.ts.map +1 -0
  23. package/dist/commonjs/core/{main/common → entry}/create_content_time_boundaries_observer.js +1 -1
  24. package/dist/commonjs/core/{main/common → entry}/get_buffered_data_per_media_buffer.d.ts +4 -4
  25. package/dist/commonjs/core/entry/get_buffered_data_per_media_buffer.d.ts.map +1 -0
  26. package/dist/commonjs/core/{main/common → entry}/get_buffered_data_per_media_buffer.js +1 -1
  27. package/dist/{es2017/core/main/common → commonjs/core/entry}/get_thumbnail_data.d.ts +3 -3
  28. package/dist/commonjs/core/entry/get_thumbnail_data.d.ts.map +1 -0
  29. package/dist/commonjs/core/{main/common → entry}/get_thumbnail_data.js +2 -2
  30. package/dist/commonjs/core/entry/index.d.ts +5 -0
  31. package/dist/commonjs/core/entry/index.d.ts.map +1 -0
  32. package/dist/commonjs/core/entry/index.js +4 -0
  33. package/dist/{es2017/core/main/common → commonjs/core/entry}/synchronize_sinks_on_observation.d.ts +2 -2
  34. package/dist/commonjs/core/entry/synchronize_sinks_on_observation.d.ts.map +1 -0
  35. package/dist/commonjs/core/{main/worker → entry}/track_choice_setter.d.ts +4 -4
  36. package/dist/commonjs/core/entry/track_choice_setter.d.ts.map +1 -0
  37. package/dist/commonjs/core/{main/worker → entry}/track_choice_setter.js +4 -4
  38. package/dist/commonjs/core/entry/utils.d.ts +3 -0
  39. package/dist/commonjs/core/entry/utils.d.ts.map +1 -0
  40. package/dist/commonjs/core/entry/utils.js +11 -0
  41. package/dist/commonjs/core/stream/orchestrator/stream_orchestrator.d.ts.map +1 -1
  42. package/dist/commonjs/core/stream/orchestrator/stream_orchestrator.js +17 -0
  43. package/dist/commonjs/core/types.d.ts +519 -1
  44. package/dist/commonjs/core/types.d.ts.map +1 -1
  45. package/dist/commonjs/core/types.js +1 -0
  46. package/dist/commonjs/experimental/features/local.d.ts.map +1 -1
  47. package/dist/commonjs/experimental/features/local.js +7 -1
  48. package/dist/commonjs/experimental/features/metaplaylist.d.ts.map +1 -1
  49. package/dist/commonjs/experimental/features/metaplaylist.js +7 -1
  50. package/dist/commonjs/experimental/features/multi_thread.d.ts.map +1 -1
  51. package/dist/commonjs/experimental/features/multi_thread.js +6 -2
  52. package/dist/commonjs/features/features_object.js +1 -1
  53. package/dist/commonjs/features/list/dash.d.ts.map +1 -1
  54. package/dist/commonjs/features/list/dash.js +7 -1
  55. package/dist/commonjs/features/list/dash_wasm.d.ts.map +1 -1
  56. package/dist/commonjs/features/list/dash_wasm.js +7 -1
  57. package/dist/commonjs/features/list/media_source_main.d.ts.map +1 -1
  58. package/dist/commonjs/features/list/media_source_main.js +7 -1
  59. package/dist/commonjs/features/list/smooth.d.ts.map +1 -1
  60. package/dist/commonjs/features/list/smooth.js +7 -1
  61. package/dist/commonjs/features/types.d.ts +20 -4
  62. package/dist/commonjs/features/types.d.ts.map +1 -1
  63. package/dist/commonjs/main_thread/api/public_api.d.ts.map +1 -1
  64. package/dist/commonjs/main_thread/api/public_api.js +39 -42
  65. package/dist/commonjs/main_thread/core_interface/base.d.ts +13 -0
  66. package/dist/commonjs/main_thread/core_interface/base.d.ts.map +1 -0
  67. package/dist/commonjs/main_thread/core_interface/base.js +32 -0
  68. package/dist/commonjs/main_thread/core_interface/monothread.d.ts +13 -0
  69. package/dist/commonjs/main_thread/core_interface/monothread.d.ts.map +1 -0
  70. package/dist/commonjs/main_thread/core_interface/monothread.js +56 -0
  71. package/dist/commonjs/main_thread/core_interface/multithread.d.ts +25 -0
  72. package/dist/commonjs/main_thread/core_interface/multithread.d.ts.map +1 -0
  73. package/dist/commonjs/main_thread/core_interface/multithread.js +67 -0
  74. package/dist/commonjs/main_thread/core_interface/types.d.ts +6 -0
  75. package/dist/commonjs/main_thread/core_interface/types.d.ts.map +1 -0
  76. package/dist/commonjs/main_thread/core_interface/types.js +2 -0
  77. package/dist/commonjs/main_thread/init/media_source_content_initializer.d.ts +166 -108
  78. package/dist/commonjs/main_thread/init/media_source_content_initializer.d.ts.map +1 -1
  79. package/dist/commonjs/main_thread/init/media_source_content_initializer.js +1492 -919
  80. package/dist/commonjs/main_thread/init/utils/create_core_playback_observer.d.ts.map +1 -1
  81. package/dist/commonjs/main_thread/init/utils/create_core_playback_observer.js +2 -1
  82. package/dist/commonjs/main_thread/init/utils/update_manifest_codec_support.d.ts +1 -1
  83. package/dist/commonjs/main_thread/init/utils/update_manifest_codec_support.d.ts.map +1 -1
  84. package/dist/commonjs/main_thread/types.d.ts +537 -0
  85. package/dist/commonjs/main_thread/types.d.ts.map +1 -1
  86. package/dist/commonjs/manifest/utils.d.ts.map +1 -1
  87. package/dist/commonjs/manifest/utils.js +18 -4
  88. package/dist/commonjs/mse/worker_media_source_interface.d.ts +2 -2
  89. package/dist/commonjs/mse/worker_media_source_interface.d.ts.map +1 -1
  90. package/dist/commonjs/mse/worker_media_source_interface.js +12 -12
  91. package/dist/commonjs/parsers/manifest/smooth/create_parser.d.ts +1 -1
  92. package/dist/commonjs/parsers/manifest/smooth/create_parser.d.ts.map +1 -1
  93. package/dist/commonjs/parsers/manifest/smooth/create_parser.js +31 -27
  94. package/dist/commonjs/parsers/manifest/smooth/parse_C_nodes.d.ts +3 -2
  95. package/dist/commonjs/parsers/manifest/smooth/parse_C_nodes.d.ts.map +1 -1
  96. package/dist/commonjs/parsers/manifest/smooth/parse_C_nodes.js +16 -7
  97. package/dist/commonjs/parsers/manifest/smooth/parse_protection_node.d.ts +3 -2
  98. package/dist/commonjs/parsers/manifest/smooth/parse_protection_node.d.ts.map +1 -1
  99. package/dist/commonjs/parsers/manifest/smooth/parse_protection_node.js +37 -6
  100. package/dist/commonjs/parsers/manifest/smooth/utils/parseBoolean.d.ts +1 -1
  101. package/dist/commonjs/parsers/manifest/smooth/utils/parseBoolean.d.ts.map +1 -1
  102. package/dist/commonjs/parsers/manifest/smooth/utils/reduceChildren.d.ts +3 -2
  103. package/dist/commonjs/parsers/manifest/smooth/utils/reduceChildren.d.ts.map +1 -1
  104. package/dist/commonjs/parsers/manifest/smooth/utils/reduceChildren.js +28 -5
  105. package/dist/{es2017/playback_observer/worker_playback_observer.d.ts → commonjs/playback_observer/core_playback_observer.d.ts} +8 -8
  106. package/dist/commonjs/playback_observer/core_playback_observer.d.ts.map +1 -0
  107. package/dist/commonjs/playback_observer/{worker_playback_observer.js → core_playback_observer.js} +13 -13
  108. package/dist/commonjs/transports/smooth/pipelines.d.ts.map +1 -1
  109. package/dist/commonjs/transports/smooth/pipelines.js +25 -3
  110. package/dist/commonjs/worker_entry_point.js +62 -2
  111. package/dist/es2017/__GENERATED_CODE/embedded_worker.d.ts.map +1 -1
  112. package/dist/es2017/__GENERATED_CODE/embedded_worker.js +1 -1
  113. package/dist/es2017/core/{main/common → entry}/FreezeResolver.d.ts +3 -3
  114. package/dist/es2017/core/entry/FreezeResolver.d.ts.map +1 -0
  115. package/dist/es2017/core/{main/common → entry}/FreezeResolver.js +3 -3
  116. package/dist/{commonjs/core/main/worker → es2017/core/entry}/content_preparer.d.ts +22 -15
  117. package/dist/es2017/core/entry/content_preparer.d.ts.map +1 -0
  118. package/dist/es2017/core/{main/worker → entry}/content_preparer.js +53 -55
  119. package/dist/{commonjs/core/main/common → es2017/core/entry}/content_time_boundaries_observer.d.ts +5 -5
  120. package/dist/es2017/core/entry/content_time_boundaries_observer.d.ts.map +1 -0
  121. package/dist/es2017/core/{main/common → entry}/content_time_boundaries_observer.js +6 -6
  122. package/dist/es2017/core/entry/core_entry.d.ts +36 -0
  123. package/dist/es2017/core/entry/core_entry.d.ts.map +1 -0
  124. package/dist/es2017/core/{main/worker/worker_main.js → entry/core_entry.js} +153 -114
  125. package/dist/es2017/core/{main/worker/worker_text_displayer_interface.d.ts → entry/core_text_displayer_interface.d.ts} +11 -11
  126. package/dist/es2017/core/entry/core_text_displayer_interface.d.ts.map +1 -0
  127. package/dist/es2017/core/{main/worker/worker_text_displayer_interface.js → entry/core_text_displayer_interface.js} +10 -10
  128. package/dist/es2017/core/{main/common → entry}/create_content_time_boundaries_observer.d.ts +6 -6
  129. package/dist/es2017/core/entry/create_content_time_boundaries_observer.d.ts.map +1 -0
  130. package/dist/es2017/core/{main/common → entry}/create_content_time_boundaries_observer.js +1 -1
  131. package/dist/es2017/core/{main/common → entry}/get_buffered_data_per_media_buffer.d.ts +4 -4
  132. package/dist/es2017/core/entry/get_buffered_data_per_media_buffer.d.ts.map +1 -0
  133. package/dist/es2017/core/{main/common → entry}/get_buffered_data_per_media_buffer.js +1 -1
  134. package/dist/{commonjs/core/main/common → es2017/core/entry}/get_thumbnail_data.d.ts +3 -3
  135. package/dist/es2017/core/entry/get_thumbnail_data.d.ts.map +1 -0
  136. package/dist/es2017/core/{main/common → entry}/get_thumbnail_data.js +2 -2
  137. package/dist/es2017/core/entry/index.d.ts +5 -0
  138. package/dist/es2017/core/entry/index.d.ts.map +1 -0
  139. package/dist/es2017/core/entry/index.js +2 -0
  140. package/dist/{commonjs/core/main/common → es2017/core/entry}/synchronize_sinks_on_observation.d.ts +2 -2
  141. package/dist/es2017/core/entry/synchronize_sinks_on_observation.d.ts.map +1 -0
  142. package/dist/es2017/core/{main/worker → entry}/track_choice_setter.d.ts +4 -4
  143. package/dist/es2017/core/entry/track_choice_setter.d.ts.map +1 -0
  144. package/dist/es2017/core/{main/worker → entry}/track_choice_setter.js +4 -4
  145. package/dist/es2017/core/entry/utils.d.ts +3 -0
  146. package/dist/es2017/core/entry/utils.d.ts.map +1 -0
  147. package/dist/es2017/core/entry/utils.js +8 -0
  148. package/dist/es2017/core/stream/orchestrator/stream_orchestrator.d.ts.map +1 -1
  149. package/dist/es2017/core/stream/orchestrator/stream_orchestrator.js +18 -1
  150. package/dist/es2017/core/types.d.ts +519 -1
  151. package/dist/es2017/core/types.d.ts.map +1 -1
  152. package/dist/es2017/core/types.js +1 -0
  153. package/dist/es2017/experimental/features/local.d.ts.map +1 -1
  154. package/dist/es2017/experimental/features/local.js +7 -1
  155. package/dist/es2017/experimental/features/metaplaylist.d.ts.map +1 -1
  156. package/dist/es2017/experimental/features/metaplaylist.js +7 -1
  157. package/dist/es2017/experimental/features/multi_thread.d.ts.map +1 -1
  158. package/dist/es2017/experimental/features/multi_thread.js +6 -2
  159. package/dist/es2017/features/features_object.js +1 -1
  160. package/dist/es2017/features/list/dash.d.ts.map +1 -1
  161. package/dist/es2017/features/list/dash.js +7 -1
  162. package/dist/es2017/features/list/dash_wasm.d.ts.map +1 -1
  163. package/dist/es2017/features/list/dash_wasm.js +7 -1
  164. package/dist/es2017/features/list/media_source_main.d.ts.map +1 -1
  165. package/dist/es2017/features/list/media_source_main.js +7 -1
  166. package/dist/es2017/features/list/smooth.d.ts.map +1 -1
  167. package/dist/es2017/features/list/smooth.js +7 -1
  168. package/dist/es2017/features/types.d.ts +20 -4
  169. package/dist/es2017/features/types.d.ts.map +1 -1
  170. package/dist/es2017/main_thread/api/public_api.d.ts.map +1 -1
  171. package/dist/es2017/main_thread/api/public_api.js +40 -43
  172. package/dist/es2017/main_thread/core_interface/base.d.ts +13 -0
  173. package/dist/es2017/main_thread/core_interface/base.d.ts.map +1 -0
  174. package/dist/es2017/main_thread/core_interface/base.js +28 -0
  175. package/dist/es2017/main_thread/core_interface/monothread.d.ts +13 -0
  176. package/dist/es2017/main_thread/core_interface/monothread.d.ts.map +1 -0
  177. package/dist/es2017/main_thread/core_interface/monothread.js +32 -0
  178. package/dist/es2017/main_thread/core_interface/multithread.d.ts +25 -0
  179. package/dist/es2017/main_thread/core_interface/multithread.d.ts.map +1 -0
  180. package/dist/es2017/main_thread/core_interface/multithread.js +45 -0
  181. package/dist/es2017/main_thread/core_interface/types.d.ts +6 -0
  182. package/dist/es2017/main_thread/core_interface/types.d.ts.map +1 -0
  183. package/dist/es2017/main_thread/core_interface/types.js +1 -0
  184. package/dist/es2017/main_thread/init/media_source_content_initializer.d.ts +166 -108
  185. package/dist/es2017/main_thread/init/media_source_content_initializer.d.ts.map +1 -1
  186. package/dist/es2017/main_thread/init/media_source_content_initializer.js +1405 -760
  187. package/dist/es2017/main_thread/init/utils/create_core_playback_observer.d.ts.map +1 -1
  188. package/dist/es2017/main_thread/init/utils/create_core_playback_observer.js +2 -1
  189. package/dist/es2017/main_thread/init/utils/update_manifest_codec_support.d.ts +1 -1
  190. package/dist/es2017/main_thread/init/utils/update_manifest_codec_support.d.ts.map +1 -1
  191. package/dist/es2017/main_thread/types.d.ts +537 -0
  192. package/dist/es2017/main_thread/types.d.ts.map +1 -1
  193. package/dist/es2017/manifest/utils.d.ts.map +1 -1
  194. package/dist/es2017/manifest/utils.js +16 -4
  195. package/dist/es2017/mse/worker_media_source_interface.d.ts +2 -2
  196. package/dist/es2017/mse/worker_media_source_interface.d.ts.map +1 -1
  197. package/dist/es2017/mse/worker_media_source_interface.js +12 -12
  198. package/dist/es2017/parsers/manifest/smooth/create_parser.d.ts +1 -1
  199. package/dist/es2017/parsers/manifest/smooth/create_parser.d.ts.map +1 -1
  200. package/dist/es2017/parsers/manifest/smooth/create_parser.js +31 -27
  201. package/dist/es2017/parsers/manifest/smooth/parse_C_nodes.d.ts +3 -2
  202. package/dist/es2017/parsers/manifest/smooth/parse_C_nodes.d.ts.map +1 -1
  203. package/dist/es2017/parsers/manifest/smooth/parse_C_nodes.js +16 -7
  204. package/dist/es2017/parsers/manifest/smooth/parse_protection_node.d.ts +3 -2
  205. package/dist/es2017/parsers/manifest/smooth/parse_protection_node.d.ts.map +1 -1
  206. package/dist/es2017/parsers/manifest/smooth/parse_protection_node.js +15 -6
  207. package/dist/es2017/parsers/manifest/smooth/utils/parseBoolean.d.ts +1 -1
  208. package/dist/es2017/parsers/manifest/smooth/utils/parseBoolean.d.ts.map +1 -1
  209. package/dist/es2017/parsers/manifest/smooth/utils/reduceChildren.d.ts +3 -2
  210. package/dist/es2017/parsers/manifest/smooth/utils/reduceChildren.d.ts.map +1 -1
  211. package/dist/es2017/parsers/manifest/smooth/utils/reduceChildren.js +6 -5
  212. package/dist/{commonjs/playback_observer/worker_playback_observer.d.ts → es2017/playback_observer/core_playback_observer.d.ts} +8 -8
  213. package/dist/es2017/playback_observer/core_playback_observer.d.ts.map +1 -0
  214. package/dist/es2017/playback_observer/{worker_playback_observer.js → core_playback_observer.js} +2 -2
  215. package/dist/es2017/transports/smooth/pipelines.d.ts.map +1 -1
  216. package/dist/es2017/transports/smooth/pipelines.js +25 -3
  217. package/dist/es2017/worker_entry_point.js +62 -2
  218. package/dist/rx-player.js +21882 -19021
  219. package/dist/rx-player.min.js +20 -20
  220. package/dist/worker.js +8 -8
  221. package/package.json +1 -1
  222. package/src/README.md +88 -198
  223. package/src/__GENERATED_CODE/embedded_worker.ts +1 -1
  224. package/src/core/{main/common → entry}/FreezeResolver.ts +7 -7
  225. package/src/core/{main → entry}/README.md +1 -1
  226. package/src/core/{main/worker → entry}/content_preparer.ts +77 -76
  227. package/src/core/{main/common → entry}/content_time_boundaries_observer.ts +10 -10
  228. package/src/core/{main/worker/worker_main.ts → entry/core_entry.ts} +223 -149
  229. package/src/core/{main/worker/worker_text_displayer_interface.ts → entry/core_text_displayer_interface.ts} +26 -26
  230. package/src/core/{main/common → entry}/create_content_time_boundaries_observer.ts +7 -7
  231. package/src/core/{main/common → entry}/get_buffered_data_per_media_buffer.ts +6 -6
  232. package/src/core/{main/common → entry}/get_thumbnail_data.ts +5 -5
  233. package/src/core/entry/index.ts +4 -0
  234. package/src/core/{main/common → entry}/synchronize_sinks_on_observation.ts +2 -2
  235. package/src/core/{main/worker → entry}/track_choice_setter.ts +7 -7
  236. package/src/core/entry/utils.ts +11 -0
  237. package/src/core/stream/orchestrator/stream_orchestrator.ts +26 -1
  238. package/src/core/types.ts +631 -3
  239. package/src/experimental/features/__tests__/local.test.ts +11 -2
  240. package/src/experimental/features/__tests__/metaplaylist.test.ts +11 -2
  241. package/src/experimental/features/__tests__/multi_thread.test.ts +8 -3
  242. package/src/experimental/features/local.ts +7 -1
  243. package/src/experimental/features/metaplaylist.ts +7 -1
  244. package/src/experimental/features/multi_thread.ts +6 -2
  245. package/src/features/features_object.ts +1 -1
  246. package/src/features/list/__tests__/dash.test.ts +12 -3
  247. package/src/features/list/__tests__/smooth.test.ts +11 -2
  248. package/src/features/list/dash.ts +7 -1
  249. package/src/features/list/dash_wasm.ts +7 -1
  250. package/src/features/list/media_source_main.ts +7 -1
  251. package/src/features/list/smooth.ts +7 -1
  252. package/src/features/types.ts +23 -4
  253. package/src/main_thread/README.md +8 -0
  254. package/src/main_thread/api/public_api.ts +46 -48
  255. package/src/main_thread/core_interface/README.md +22 -0
  256. package/src/main_thread/core_interface/base.ts +36 -0
  257. package/src/main_thread/core_interface/monothread.ts +46 -0
  258. package/src/main_thread/core_interface/multithread.ts +49 -0
  259. package/src/main_thread/core_interface/types.ts +5 -0
  260. package/src/main_thread/init/media_source_content_initializer.ts +2034 -1152
  261. package/src/main_thread/init/utils/create_core_playback_observer.ts +2 -1
  262. package/src/main_thread/init/utils/update_manifest_codec_support.ts +1 -1
  263. package/src/main_thread/types.ts +610 -0
  264. package/src/manifest/utils.ts +20 -4
  265. package/src/mse/worker_media_source_interface.ts +35 -35
  266. package/src/parsers/manifest/smooth/create_parser.ts +40 -34
  267. package/src/parsers/manifest/smooth/parse_C_nodes.ts +19 -8
  268. package/src/parsers/manifest/smooth/parse_protection_node.ts +17 -9
  269. package/src/parsers/manifest/smooth/utils/parseBoolean.ts +1 -1
  270. package/src/parsers/manifest/smooth/utils/reduceChildren.ts +10 -7
  271. package/src/playback_observer/{worker_playback_observer.ts → core_playback_observer.ts} +13 -13
  272. package/src/transports/smooth/pipelines.ts +25 -5
  273. package/src/worker_entry_point.ts +71 -2
  274. package/dist/commonjs/core/main/common/FreezeResolver.d.ts.map +0 -1
  275. package/dist/commonjs/core/main/common/content_time_boundaries_observer.d.ts.map +0 -1
  276. package/dist/commonjs/core/main/common/create_content_time_boundaries_observer.d.ts.map +0 -1
  277. package/dist/commonjs/core/main/common/get_buffered_data_per_media_buffer.d.ts.map +0 -1
  278. package/dist/commonjs/core/main/common/get_thumbnail_data.d.ts.map +0 -1
  279. package/dist/commonjs/core/main/common/synchronize_sinks_on_observation.d.ts.map +0 -1
  280. package/dist/commonjs/core/main/worker/content_preparer.d.ts.map +0 -1
  281. package/dist/commonjs/core/main/worker/globals.d.ts +0 -14
  282. package/dist/commonjs/core/main/worker/globals.d.ts.map +0 -1
  283. package/dist/commonjs/core/main/worker/globals.js +0 -26
  284. package/dist/commonjs/core/main/worker/index.d.ts +0 -3
  285. package/dist/commonjs/core/main/worker/index.d.ts.map +0 -1
  286. package/dist/commonjs/core/main/worker/index.js +0 -4
  287. package/dist/commonjs/core/main/worker/send_message.d.ts +0 -4
  288. package/dist/commonjs/core/main/worker/send_message.d.ts.map +0 -1
  289. package/dist/commonjs/core/main/worker/send_message.js +0 -23
  290. package/dist/commonjs/core/main/worker/track_choice_setter.d.ts.map +0 -1
  291. package/dist/commonjs/core/main/worker/worker_main.d.ts +0 -2
  292. package/dist/commonjs/core/main/worker/worker_main.d.ts.map +0 -1
  293. package/dist/commonjs/core/main/worker/worker_text_displayer_interface.d.ts.map +0 -1
  294. package/dist/commonjs/main_thread/init/multi_thread_content_initializer.d.ts +0 -308
  295. package/dist/commonjs/main_thread/init/multi_thread_content_initializer.d.ts.map +0 -1
  296. package/dist/commonjs/main_thread/init/multi_thread_content_initializer.js +0 -1713
  297. package/dist/commonjs/main_thread/init/send_message.d.ts +0 -3
  298. package/dist/commonjs/main_thread/init/send_message.d.ts.map +0 -1
  299. package/dist/commonjs/main_thread/init/send_message.js +0 -13
  300. package/dist/commonjs/multithread_types.d.ts +0 -915
  301. package/dist/commonjs/multithread_types.d.ts.map +0 -1
  302. package/dist/commonjs/multithread_types.js +0 -7
  303. package/dist/commonjs/playback_observer/worker_playback_observer.d.ts.map +0 -1
  304. package/dist/es2017/core/main/common/FreezeResolver.d.ts.map +0 -1
  305. package/dist/es2017/core/main/common/content_time_boundaries_observer.d.ts.map +0 -1
  306. package/dist/es2017/core/main/common/create_content_time_boundaries_observer.d.ts.map +0 -1
  307. package/dist/es2017/core/main/common/get_buffered_data_per_media_buffer.d.ts.map +0 -1
  308. package/dist/es2017/core/main/common/get_thumbnail_data.d.ts.map +0 -1
  309. package/dist/es2017/core/main/common/synchronize_sinks_on_observation.d.ts.map +0 -1
  310. package/dist/es2017/core/main/worker/content_preparer.d.ts.map +0 -1
  311. package/dist/es2017/core/main/worker/globals.d.ts +0 -14
  312. package/dist/es2017/core/main/worker/globals.d.ts.map +0 -1
  313. package/dist/es2017/core/main/worker/globals.js +0 -18
  314. package/dist/es2017/core/main/worker/index.d.ts +0 -3
  315. package/dist/es2017/core/main/worker/index.d.ts.map +0 -1
  316. package/dist/es2017/core/main/worker/index.js +0 -2
  317. package/dist/es2017/core/main/worker/send_message.d.ts +0 -4
  318. package/dist/es2017/core/main/worker/send_message.d.ts.map +0 -1
  319. package/dist/es2017/core/main/worker/send_message.js +0 -19
  320. package/dist/es2017/core/main/worker/track_choice_setter.d.ts.map +0 -1
  321. package/dist/es2017/core/main/worker/worker_main.d.ts +0 -2
  322. package/dist/es2017/core/main/worker/worker_main.d.ts.map +0 -1
  323. package/dist/es2017/core/main/worker/worker_text_displayer_interface.d.ts.map +0 -1
  324. package/dist/es2017/main_thread/init/multi_thread_content_initializer.d.ts +0 -308
  325. package/dist/es2017/main_thread/init/multi_thread_content_initializer.d.ts.map +0 -1
  326. package/dist/es2017/main_thread/init/multi_thread_content_initializer.js +0 -1559
  327. package/dist/es2017/main_thread/init/send_message.d.ts +0 -3
  328. package/dist/es2017/main_thread/init/send_message.d.ts.map +0 -1
  329. package/dist/es2017/main_thread/init/send_message.js +0 -10
  330. package/dist/es2017/multithread_types.d.ts +0 -915
  331. package/dist/es2017/multithread_types.d.ts.map +0 -1
  332. package/dist/es2017/multithread_types.js +0 -6
  333. package/dist/es2017/playback_observer/worker_playback_observer.d.ts.map +0 -1
  334. package/src/core/main/worker/globals.ts +0 -38
  335. package/src/core/main/worker/index.ts +0 -2
  336. package/src/core/main/worker/send_message.ts +0 -28
  337. package/src/main_thread/init/multi_thread_content_initializer.ts +0 -2330
  338. package/src/main_thread/init/send_message.ts +0 -15
  339. package/src/multithread_types.ts +0 -1095
  340. /package/dist/commonjs/core/{main/common → entry}/synchronize_sinks_on_observation.js +0 -0
  341. /package/dist/es2017/core/{main/common → entry}/synchronize_sinks_on_observation.js +0 -0
@@ -14,7 +14,8 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import getBufferedDataPerMediaBuffer from "../../../core/main/common/get_buffered_data_per_media_buffer";
17
+ // TODO: move that file somewhere else
18
+ import getBufferedDataPerMediaBuffer from "../../../core/entry/get_buffered_data_per_media_buffer";
18
19
  import type { IPausedPlaybackObservation } from "../../../core/types";
19
20
  import type { IManifestMetadata } from "../../../manifest";
20
21
  import { getMaximumSafePosition } from "../../../manifest";
@@ -2,10 +2,10 @@ import type { IMediaElement } from "../../../compat/browser_compatibility_types"
2
2
  import isCodecSupported from "../../../compat/is_codec_supported";
3
3
  import type { IManifestMetadata } from "../../../manifest";
4
4
  import type Manifest from "../../../manifest/classes";
5
- import type { ICodecSupportInfo } from "../../../multithread_types";
6
5
  import isNullOrUndefined from "../../../utils/is_null_or_undefined";
7
6
  import type ContentDecryptor from "../../decrypt";
8
7
  import { ContentDecryptorState } from "../../decrypt";
8
+ import type { ICodecSupportInfo } from "../../types";
9
9
 
10
10
  /**
11
11
  * Returns a list of all codecs that the support is not known yet on the given
@@ -1,3 +1,19 @@
1
+ import type {
2
+ IResolutionInfo,
3
+ IManifestFetcherSettings,
4
+ ISegmentQueueCreatorBackoffOptions,
5
+ IPausedPlaybackObservation,
6
+ IRepresentationsChoice,
7
+ ITrackSwitchingMode,
8
+ } from "../core/types";
9
+ import type { IDefaultConfig } from "../default_config";
10
+ import type { ISerializedSourceBufferError } from "../errors/source_buffer_error";
11
+ import type { SourceBufferType } from "../mse";
12
+ import type { IFreezingStatus, IRebufferingStatus } from "../playback_observer";
13
+ import type { ICmcdOptions, IRepresentationFilter, ITrackType } from "../public_types";
14
+ import type { ITransportOptions } from "../transports";
15
+ import type { ILogFormat, ILoggerLevel } from "../utils/logger";
16
+ import type { IRange } from "../utils/ranges";
1
17
  import type RxPlayer from "./api";
2
18
  import type { IContentProtection, IProcessedProtectionData } from "./decrypt";
3
19
  import type { ITextDisplayer, ITextDisplayerData } from "./text_displayer";
@@ -12,3 +28,597 @@ export type {
12
28
  ITextDisplayer,
13
29
  ITextDisplayerData,
14
30
  };
31
+
32
+ /**
33
+ * First message sent by the main thread to the Core.
34
+ * The Core should only receive one `IInitMessage` at most and it should be
35
+ * always the first message received.
36
+ *
37
+ * Allows for Core initialization.
38
+ */
39
+ export interface IInitMessage {
40
+ type: MainThreadMessageType.Init;
41
+ value: {
42
+ /** Link to the DASH_WASM's feature WebAssembly file to parse DASH MPDs. */
43
+ dashWasmUrl: string | undefined;
44
+ /**
45
+ * If `true` the final element on the current page displaying the content
46
+ * can display video content.
47
+ *
48
+ * If `false`, it cannot, but it can be assumed to be able to play audio
49
+ * content.
50
+ * An example where it would be set to `false` is for `HTMLAudioElement`
51
+ * elements (`<audio>` tags).
52
+ */
53
+ hasVideo: boolean;
54
+ /** Initial logging level that should be set. */
55
+ logLevel: ILoggerLevel;
56
+ /** Intitial logger's log format that should be set. */
57
+ logFormat: ILogFormat;
58
+ /**
59
+ * If `true`, logs should be sent back to the main thread, through a
60
+ * `ILogMessageCoreMessage` message.
61
+ */
62
+ sendBackLogs: boolean;
63
+ /**
64
+ * Value of `Date.now()` at the time the `timestamp` property was generated.
65
+ *
66
+ * This is mostly useful for timestamp synchronization: by calling both
67
+ * `performance.now` (the same call on the main thread made to calculate
68
+ * `timestamp` - but which is not synchronized initially to the Core's)
69
+ * and `Date.now()` both on the main thread and on the Core,
70
+ * calculating the difference between the two and comparing both the main
71
+ * thread's difference and the Core's difference, you're able to
72
+ * produce a relatively-synchronized timestamp between the two if they run
73
+ * in different environment, e.g. a WebWorker.
74
+ */
75
+ date: number;
76
+ /**
77
+ * Value returned by `performance.now()` at the same time `date` was
78
+ * calculated.
79
+ *
80
+ * Allows for timestamp synchronization.
81
+ * @see date property.
82
+ */
83
+ timestamp: number;
84
+ };
85
+ }
86
+
87
+ /** Options needed when initializing a new content. */
88
+ export interface IContentInitializationData {
89
+ /**
90
+ * Identifier uniquely identifying a specific content.
91
+ *
92
+ * Protects against all kind of race conditions or asynchronous issues.
93
+ */
94
+ contentId: string;
95
+ /**
96
+ * When set to an object, enable "Common Media Client Data", or "CMCD".
97
+ */
98
+ cmcd?: ICmcdOptions | undefined;
99
+ /**
100
+ * If `true`, the RxPlayer can enable its "Representation avoidance"
101
+ * mechanism, where it avoid loading Representation that it suspect
102
+ * have issues being decoded on the current device.
103
+ */
104
+ enableRepresentationAvoidance: boolean;
105
+ /**
106
+ * URL at which the content's Manifest is accessible.
107
+ * `undefined` if unknown.
108
+ */
109
+ url?: string | undefined;
110
+ /** If `true`, text buffer (e.g. for subtitles) is enabled. */
111
+ hasText: boolean;
112
+ /**
113
+ * The type of "transport" wanted, e.g. "dash" or "smooth".
114
+ */
115
+ transport: string;
116
+ /** Options relative to the streaming protocol. */
117
+ transportOptions: Omit<ITransportOptions, "representationFilter"> & {
118
+ representationFilter?: IRepresentationFilter | string | undefined;
119
+ };
120
+ /** Initial video bitrate on which the adaptive logic will base itself. */
121
+ initialVideoBitrate?: number | undefined;
122
+ /** Initial audio bitrate on which the adaptive logic will base itself. */
123
+ initialAudioBitrate?: number | undefined;
124
+ /**
125
+ * Options relative to the fetching and refreshing of the Manifest.
126
+ */
127
+ manifestRetryOptions: Omit<IManifestFetcherSettings, "cmcdDataBuilder">;
128
+ /** Options relative to the fetching of media segments. */
129
+ segmentRetryOptions: ISegmentQueueCreatorBackoffOptions;
130
+ /**
131
+ * If `true`, MSE API should be used in the core part of the RxPlayer when
132
+ * relying on a WebWorker.
133
+ * If `false`, they should be relied on on main thread.
134
+ *
135
+ * This might depend on both browser capabilities and preferences. It is
136
+ * assumed that the caller perform all those checks, the core won't check
137
+ * again the validity of this value.
138
+ */
139
+ useMseInWorker: boolean;
140
+ }
141
+
142
+ export interface ILogLevelUpdateMessage {
143
+ type: MainThreadMessageType.LogLevelUpdate;
144
+ value: {
145
+ /** The new logger level that should be set. */
146
+ logLevel: ILoggerLevel;
147
+ /** Intitial logger's log format that should be set. */
148
+ logFormat: ILogFormat;
149
+ /**
150
+ * If `true`, logs should be sent back to the main thread, through a
151
+ * `ILogMessageCoreMessage` message.
152
+ */
153
+ sendBackLogs: boolean;
154
+ };
155
+ }
156
+
157
+ /** Message sent by the main thread to update the Worker's global config. */
158
+ export interface IConfigUpdateMessage {
159
+ type: MainThreadMessageType.ConfigUpdate;
160
+ value: Partial<IDefaultConfig>;
161
+ }
162
+
163
+ /**
164
+ * Message sent by the main thread when a new content should be "prepared".
165
+ *
166
+ * You can begin performing operarions which do not interrupt the previous
167
+ * content, like fetching its Manifest.
168
+ *
169
+ * Note that on the receivings-side, you only need to prepare one content at
170
+ * most. Meaning that if multiple `IPrepareContentMessage` arrive in a row, you
171
+ * can stop the preparation of previous contents.
172
+ */
173
+ export interface IPrepareContentMessage {
174
+ type: MainThreadMessageType.PrepareContent;
175
+ value: IContentInitializationData;
176
+ }
177
+
178
+ /**
179
+ * Message sent by the main thread to stop playback of the last prepared content
180
+ * (through a `IPrepareContentMessage`) - if it was playing - and dispose all
181
+ * associated resources.
182
+ */
183
+ export interface IStopContentMessage {
184
+ type: MainThreadMessageType.StopContent;
185
+ /**
186
+ * Same `contentId` than for the corresponding `IPrepareContentMessage` message.
187
+ *
188
+ * Allows to ensure no race condition lead to actually stopping another content
189
+ * than the one meant by the main thread.
190
+ */
191
+ contentId: string;
192
+ value: null;
193
+ }
194
+
195
+ /**
196
+ * Message sent by the main thread to start playback of the last prepared content
197
+ * (through a `IPrepareContentMessage`).
198
+ */
199
+ export interface IStartPreparedContentMessage {
200
+ type: MainThreadMessageType.StartPreparedContent;
201
+ /**
202
+ * Same `contentId` than for the corresponding `IPrepareContentMessage` message.
203
+ *
204
+ * Allows to ensure no race condition lead to starting another content than
205
+ * the one meant by the main thread.
206
+ */
207
+ contentId: string;
208
+ value: IStartPreparedContentMessageValue;
209
+ }
210
+
211
+ /** Options needed when starting a new content. */
212
+ export interface IStartPreparedContentMessageValue {
213
+ /** The start time at which we should play, in seconds. */
214
+ initialTime: number;
215
+ /** The current playback observation. */
216
+ initialObservation: ISerializedPlaybackObservation;
217
+ /**
218
+ * Hex-encoded string identifying the key system used.
219
+ * May be cross-referenced with the content's metadata when performing
220
+ * optimizations.
221
+ */
222
+ drmSystemId: string | undefined;
223
+ /**
224
+ * Enable/Disable fastSwitching: allow to replace lower-quality segments by
225
+ * higher-quality ones to have a faster transition.
226
+ */
227
+ enableFastSwitching: boolean;
228
+ /** Behavior when a new video and/or audio codec is encountered. */
229
+ onCodecSwitch: "continue" | "reload";
230
+
231
+ // TODO prepare chosen Adaptations here?
232
+ // In which case the Period's `id` should probably be given instead of the
233
+ // `initialTime`
234
+ }
235
+
236
+ /**
237
+ * Message sent by the main thread when it has updated its list of supported
238
+ * codecs and has reasons to think that the Core is not aware of it
239
+ * (e.g. their support was not set in a Manifest).
240
+ */
241
+ export interface ICodecSupportUpdateMessage {
242
+ type: MainThreadMessageType.CodecSupportUpdate;
243
+ value: ICodecSupportInfo[];
244
+ }
245
+
246
+ export interface ICodecSupportInfo {
247
+ mimeType: string;
248
+ codec: string;
249
+ supported?: boolean | undefined;
250
+ supportedIfEncrypted?: boolean | undefined;
251
+ }
252
+
253
+ /**
254
+ * Message sent by the main thread to the Core regularly after an
255
+ * `IPrepareContentMessage` to provide various media-related metadata
256
+ * only obtainable on the main thread.
257
+ *
258
+ * Those messages are sent until the `IStopContentMessage` for that same
259
+ * `contentId`.
260
+ */
261
+ export interface IPlaybackObservationMessage {
262
+ type: MainThreadMessageType.PlaybackObservation;
263
+ /**
264
+ * Same `contentId` than for the corresponding `IPrepareContentMessage` message.
265
+ * Allows to prevent race conditions.
266
+ */
267
+ contentId: string;
268
+ /** The media-related metadata that has just been observed now. */
269
+ value: ISerializedPlaybackObservation;
270
+ }
271
+
272
+ /**
273
+ * Message sent by the main thread when at least one of the `Representation` of
274
+ * the current content just had a change of decipherability status.
275
+ *
276
+ * That is if one of the Representation either:
277
+ * - became undecipherable
278
+ * - became decipherable
279
+ * - had its decipherability status transition from being known to unknown
280
+ */
281
+ export interface IDecipherabilityStatusChangedMessage {
282
+ type: MainThreadMessageType.DecipherabilityStatusUpdate;
283
+ /**
284
+ * Same `contentId` than for the corresponding `IPrepareContentMessage` message.
285
+ * Allows to prevent race conditions.
286
+ */
287
+ contentId: string;
288
+ /** List of the `Representation` which had their decipherability status updated. */
289
+ value: IDecipherabilityStatusChangedPayload[];
290
+ }
291
+
292
+ /** Object describing the new decipherability status of a `Representation`. */
293
+ export interface IDecipherabilityStatusChangedPayload {
294
+ /** `uniqueId` for the concerned `Representation`. */
295
+ representationUniqueId: string;
296
+ /**
297
+ * If set to `true`, the `Representation` became decipherable.
298
+ *
299
+ * If set to `false`, the `Representation` became undecipherable.
300
+ *
301
+ * If set to `undefined`, the `Representation`'s decipherability status became
302
+ * unknown.
303
+ */
304
+ decipherable: boolean | undefined;
305
+ }
306
+
307
+ /** Message allowing to update the URL of the content being played. */
308
+ export interface IUpdateContentUrlsMessage {
309
+ type: MainThreadMessageType.ContentUrlsUpdate;
310
+ /**
311
+ * Same `contentId` than for the corresponding `IPrepareContentMessage` message.
312
+ * Allows to prevent race conditions.
313
+ */
314
+ contentId: string;
315
+ /** Information on the new URL to set. */
316
+ value: IUpdateContentUrlsMessageValue;
317
+ }
318
+
319
+ /** Payload of an `IUpdateContentUrlsMessage`. */
320
+ export interface IUpdateContentUrlsMessageValue {
321
+ /**
322
+ * URLs to reach that Manifest from the most prioritized URL to the least
323
+ * prioritized URL.
324
+ */
325
+ urls: string[] | undefined;
326
+ /**
327
+ * If `true` the resource in question (e.g. DASH's MPD) will be refreshed
328
+ * immediately.
329
+ */
330
+ refreshNow: boolean;
331
+ }
332
+
333
+ export interface ITrackUpdateMessage {
334
+ type: MainThreadMessageType.TrackUpdate;
335
+ contentId: string;
336
+ value: {
337
+ periodId: string;
338
+ bufferType: ITrackType;
339
+ choice: ITrackUpdateChoiceObject | null | undefined;
340
+ };
341
+ }
342
+
343
+ export interface ITrackUpdateChoiceObject {
344
+ /** The Adaptation choosen. */
345
+ adaptationId: string;
346
+
347
+ /** "Switching mode" in which the track switch should happen. */
348
+ switchingMode: ITrackSwitchingMode;
349
+
350
+ /**
351
+ * Shared reference allowing to indicate which Representations from
352
+ * that Adaptation are allowed.
353
+ */
354
+ initialRepresentations: IRepresentationsChoice;
355
+
356
+ /** Relative resuming position after a track change */
357
+ relativeResumingPosition: number | undefined;
358
+ }
359
+
360
+ export interface IRepresentationUpdateMessage {
361
+ type: MainThreadMessageType.RepresentationUpdate;
362
+ contentId: string;
363
+ value: {
364
+ periodId: string;
365
+ bufferType: ITrackType;
366
+ adaptationId: string;
367
+ choice: IRepresentationsChoice;
368
+ };
369
+ }
370
+
371
+ /** Media-related metadata. */
372
+ export interface ISerializedPlaybackObservation {
373
+ /**
374
+ * Information on whether the media element was paused at the time of the
375
+ * Observation.
376
+ */
377
+ paused: IPausedPlaybackObservation;
378
+ position: [number, number | null];
379
+ /** `readyState` property of the HTMLMediaElement. */
380
+ readyState: number;
381
+ /** Target playback rate at which we want to play the content. */
382
+ speed: number;
383
+ /** Theoretical maximum position on the content that can currently be played. */
384
+ maximumPosition: number;
385
+ /**
386
+ * Ranges of buffered data per type of media.
387
+ *
388
+ * `null` as a record's value if no buffer exists for that type of media.
389
+ *
390
+ * `null` as a `buffered` value if this could not have been obtained on the
391
+ * current environment (e.g. in the main thread).
392
+ */
393
+ buffered: Record<ITrackType, IRange[] | null>;
394
+ duration: number;
395
+ /**
396
+ * Set if the player is short on audio and/or video media data and is a such,
397
+ * rebuffering.
398
+ * `null` if not.
399
+ */
400
+ rebuffering: IRebufferingStatus | null;
401
+ /**
402
+ * Set if the player is frozen, that is, stuck in place for unknown reason.
403
+ * Note that this reason can be a valid one, such as a necessary license not
404
+ * being obtained yet.
405
+ *
406
+ * `null` if the player is not frozen.
407
+ */
408
+ freezing: IFreezingStatus | null;
409
+ /**
410
+ * Gap between `currentTime` and the next position with un-buffered data.
411
+ * `Infinity` if we don't have buffered data right now.
412
+ * `undefined` if we cannot determine the buffer gap.
413
+ */
414
+ bufferGap: number | undefined;
415
+ /**
416
+ * Indicates whether the user agent believes it has enough buffered data to ensure
417
+ * uninterrupted playback for a meaningful period or needs more data.
418
+ * It also reflects whether the user agent can retrieve and buffer data in an
419
+ * energy-efficient manner while maintaining the desired memory usage.
420
+ * `true` indicates that the buffer is low, and more data should be buffered.
421
+ * `false` indicates that there is enough buffered data, and no additional data needs
422
+ * to be buffered at this time.
423
+ */
424
+ canStream: boolean;
425
+ /** If `true` the content is loaded until its maximum position. */
426
+ fullyLoaded: boolean;
427
+ }
428
+
429
+ /**
430
+ * Sent when the main thread had to "reload" the media source.
431
+ * The worker should understand that this MediaSource won't be used anymore.
432
+ */
433
+ export interface ITriggerMediaSourceReloadMainMessage {
434
+ type: MainThreadMessageType.MediaSourceReload;
435
+ /** Identify the MediaSource concerned by this message. */
436
+ mediaSourceId: string;
437
+ /** No message is necessary. */
438
+ value: null;
439
+ }
440
+
441
+ /**
442
+ * Sent when the SourceBuffer linked to the given `mediaSourceId` and
443
+ * `SourceBufferType`, running on the main thread, succeeded to perform the last
444
+ * operation given to it (either through an `AppendBufferCoreMessage` or a
445
+ * `RemoveBufferCoreMessage`).
446
+ */
447
+ export interface ISourceBufferOperationSuccessMainMessage {
448
+ type: MainThreadMessageType.SourceBufferSuccess;
449
+ /**
450
+ * Identify the MediaSource which contains the SourceBuffer concerned by
451
+ * this update.
452
+ */
453
+ mediaSourceId: string;
454
+ /**
455
+ * Id uniquely identifying this SourceBuffer.
456
+ * It should be the same `SourceBufferType` than the one on the
457
+ * `CreateSourceBufferCoreMessage`.
458
+ */
459
+ sourceBufferType: SourceBufferType;
460
+ /** Identify the corresponding SourceBuffer operation. */
461
+ operationId: string;
462
+ value: {
463
+ /**
464
+ * New contiguous buffered time ranges, in chronological order in seconds.
465
+ */
466
+ buffered: IRange[];
467
+ };
468
+ }
469
+
470
+ export interface ISourceBufferErrorMainMessage {
471
+ type: MainThreadMessageType.SourceBufferError;
472
+ /**
473
+ * Identify the MediaSource which contains the SourceBuffer concerned by
474
+ * this update.
475
+ */
476
+ mediaSourceId: string;
477
+ /** Identify the SourceBuffer in question. */
478
+ sourceBufferType: SourceBufferType;
479
+ /** Identify the corresponding SourceBuffer operation. */
480
+ operationId: string;
481
+ value:
482
+ | ISerializedSourceBufferError
483
+ | {
484
+ /**
485
+ * Identify a cancellation-specific error (the corresponding operation
486
+ * was cancelled.
487
+ */
488
+ errorName: "CancellationError";
489
+ };
490
+ }
491
+
492
+ /**
493
+ * Sent by the main thread to a Worker when the MediaSource linked to the
494
+ * `mediaSourceId` changed its readyState.
495
+ *
496
+ * This message is only sent if the MediaSource is created on the main thread.
497
+ */
498
+ export interface IMediaSourceReadyStateChangeMainMessage {
499
+ type: MainThreadMessageType.MediaSourceReadyStateChange;
500
+ /** Identify the MediaSource through this unique identifier. */
501
+ mediaSourceId: string;
502
+ value: ReadyState;
503
+ }
504
+
505
+ export interface IPushTextDataSuccessMessage {
506
+ type: MainThreadMessageType.PushTextDataSuccess;
507
+ contentId: string;
508
+ value: {
509
+ ranges: IRange[];
510
+ };
511
+ }
512
+
513
+ export interface IRemoveTextDataSuccessMessage {
514
+ type: MainThreadMessageType.RemoveTextDataSuccess;
515
+ contentId: string;
516
+ value: {
517
+ ranges: IRange[];
518
+ };
519
+ }
520
+
521
+ export interface IPushTextDataErrorMessage {
522
+ type: MainThreadMessageType.PushTextDataError;
523
+ contentId: string;
524
+ value: {
525
+ message: string;
526
+ };
527
+ }
528
+
529
+ export interface IRemoveTextDataErrorMessage {
530
+ type: MainThreadMessageType.RemoveTextDataError;
531
+ contentId: string;
532
+ value: {
533
+ message: string;
534
+ };
535
+ }
536
+
537
+ /** Message sent from main thread when it wants to fetch thumbnail data. */
538
+ export interface IThumbnailDataRequestMainMessage {
539
+ type: MainThreadMessageType.ThumbnailDataRequest;
540
+ contentId: string;
541
+ value: {
542
+ requestId: number;
543
+ periodId: string;
544
+ thumbnailTrackId: string;
545
+ time: number;
546
+ };
547
+ }
548
+
549
+ /**
550
+ * Template for a message originating from main thread to update
551
+ * `SharedReference` objects (a common abstraction of the RxPlayer allowing for
552
+ * passing values whose updates can be listened to through a callback).
553
+ *
554
+ * Here, `TRefName` is the "name" of the `SharedReference` (the identifier
555
+ * choosen for it) and `TRefType` is the type of its value.
556
+ */
557
+ export interface IReferenceUpdate<TRefName extends string, TRefType> {
558
+ type: MainThreadMessageType.ReferenceUpdate;
559
+ value: { name: TRefName; newVal: TRefType };
560
+ }
561
+
562
+ export type IReferenceUpdateMessage =
563
+ | IReferenceUpdate<"wantedBufferAhead", number>
564
+ | IReferenceUpdate<"maxVideoBufferSize", number>
565
+ | IReferenceUpdate<"maxBufferBehind", number>
566
+ | IReferenceUpdate<"maxBufferAhead", number>
567
+ | IReferenceUpdate<"limitVideoResolution", IResolutionInfo>
568
+ | IReferenceUpdate<"throttleVideoBitrate", number>;
569
+
570
+ export interface IPullSegmentSinkStoreInfos {
571
+ type: MainThreadMessageType.PullSegmentSinkStoreInfos;
572
+ value: { requestId: number };
573
+ }
574
+
575
+ export const enum MainThreadMessageType {
576
+ Init = "init",
577
+ PushTextDataSuccess = "add-text-success",
578
+ RemoveTextDataSuccess = "remove-text-success",
579
+ PushTextDataError = "push-text-error",
580
+ RemoveTextDataError = "remove-text-error",
581
+ CodecSupportUpdate = "codec-support-update",
582
+ ContentUrlsUpdate = "urls-update",
583
+ ConfigUpdate = "config-update",
584
+ DecipherabilityStatusUpdate = "decipherability-update",
585
+ LogLevelUpdate = "log-level-update",
586
+ MediaSourceReadyStateChange = "media-source-ready-state-change",
587
+ PlaybackObservation = "observation",
588
+ PrepareContent = "prepare",
589
+ ReferenceUpdate = "ref-update",
590
+ RepresentationUpdate = "rep-update",
591
+ MediaSourceReload = "ms-reload",
592
+ SourceBufferError = "sb-error",
593
+ SourceBufferSuccess = "sb-success",
594
+ StartPreparedContent = "start",
595
+ StopContent = "stop",
596
+ TrackUpdate = "track-update",
597
+ PullSegmentSinkStoreInfos = "pull-segment-sink-store-infos",
598
+ ThumbnailDataRequest = "thumbnail-request",
599
+ }
600
+
601
+ export type IMainThreadMessage =
602
+ | IInitMessage
603
+ | ILogLevelUpdateMessage
604
+ | IConfigUpdateMessage
605
+ | IPrepareContentMessage
606
+ | IStopContentMessage
607
+ | IStartPreparedContentMessage
608
+ | IReferenceUpdateMessage
609
+ | ICodecSupportUpdateMessage
610
+ | IPlaybackObservationMessage
611
+ | IDecipherabilityStatusChangedMessage
612
+ | IUpdateContentUrlsMessage
613
+ | ITriggerMediaSourceReloadMainMessage
614
+ | ISourceBufferErrorMainMessage
615
+ | ISourceBufferOperationSuccessMainMessage
616
+ | ITrackUpdateMessage
617
+ | IRepresentationUpdateMessage
618
+ | IPushTextDataSuccessMessage
619
+ | IRemoveTextDataSuccessMessage
620
+ | IPushTextDataErrorMessage
621
+ | IRemoveTextDataErrorMessage
622
+ | IMediaSourceReadyStateChangeMainMessage
623
+ | IPullSegmentSinkStoreInfos
624
+ | IThumbnailDataRequestMainMessage;
@@ -14,6 +14,7 @@ import arrayFind from "../utils/array_find";
14
14
  import isNullOrUndefined from "../utils/is_null_or_undefined";
15
15
  import getMonotonicTimeStamp from "../utils/monotonic_timestamp";
16
16
  import { objectValues } from "../utils/object_values";
17
+ import { ManifestMetadataFormat } from "./types";
17
18
  import type {
18
19
  IAdaptationMetadata,
19
20
  IManifestMetadata,
@@ -448,7 +449,9 @@ export function updateDecipherabilityFromKeyIds(
448
449
  },
449
450
  ): IDecipherabilityStatusChangedElement[] {
450
451
  const { whitelistedKeyIds, blacklistedKeyIds, delistedKeyIds } = updates;
451
- return updateRepresentationsDeciperability(manifest, (representation) => {
452
+ const isDecipherable = (
453
+ representation: IRepresentationMetadata,
454
+ ): boolean | undefined => {
452
455
  if (representation.contentProtections === undefined) {
453
456
  return representation.decipherable;
454
457
  }
@@ -473,7 +476,14 @@ export function updateDecipherabilityFromKeyIds(
473
476
  }
474
477
  }
475
478
  return representation.decipherable;
476
- });
479
+ };
480
+
481
+ if (manifest.manifestFormat === ManifestMetadataFormat.Class) {
482
+ (manifest as IManifest).updateRepresentationsDeciperability(({ representation }) => {
483
+ return isDecipherable(representation);
484
+ });
485
+ }
486
+ return updateRepresentationsDeciperability(manifest, isDecipherable);
477
487
  }
478
488
 
479
489
  /**
@@ -486,7 +496,7 @@ export function updateDecipherabilityFromProtectionData(
486
496
  manifest: IManifestMetadata,
487
497
  initData: IProcessedProtectionData,
488
498
  ): IDecipherabilityStatusChangedElement[] {
489
- return updateRepresentationsDeciperability(manifest, (representation) => {
499
+ const isDecipherable = (representation: IRepresentationMetadata) => {
490
500
  if (representation.decipherable === false) {
491
501
  return false;
492
502
  }
@@ -510,7 +520,13 @@ export function updateDecipherabilityFromProtectionData(
510
520
  }
511
521
  }
512
522
  return representation.decipherable;
513
- });
523
+ };
524
+ if (manifest.manifestFormat === ManifestMetadataFormat.Class) {
525
+ (manifest as IManifest).updateRepresentationsDeciperability(({ representation }) => {
526
+ return isDecipherable(representation);
527
+ });
528
+ }
529
+ return updateRepresentationsDeciperability(manifest, isDecipherable);
514
530
  }
515
531
 
516
532
  /**