shaka-player 3.3.2 → 4.0.0

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 (389) hide show
  1. package/.csslintrc +11 -1
  2. package/.github/ISSUE_TEMPLATE/bug_report.md +1 -1
  3. package/.github/pull_request_template.md +6 -34
  4. package/.github/workflows/build-and-test.yaml +129 -0
  5. package/.github/workflows/custom-actions/prep-for-appspot/action.yaml +56 -0
  6. package/.github/workflows/custom-actions/set-commit-status/action.yaml +41 -0
  7. package/.github/workflows/demo-version-index.yaml +37 -0
  8. package/.github/workflows/nightly-demo.yaml +42 -0
  9. package/.github/workflows/release-please.yaml +168 -0
  10. package/.github/workflows/safari-homedir-launcher.sh +18 -0
  11. package/.github/workflows/selenium-lab-tests.yaml +92 -0
  12. package/.github/workflows/sync-labels.yaml +33 -0
  13. package/.github/workflows/update-issues.yaml +29 -0
  14. package/.github/workflows/validate-pr-title.yaml +35 -0
  15. package/AUTHORS +3 -0
  16. package/CHANGELOG.md +1866 -1675
  17. package/CONTRIBUTING.md +2 -2
  18. package/CONTRIBUTORS +3 -0
  19. package/README.md +16 -13
  20. package/app-engine/README.md +9 -0
  21. package/app-engine/demo-version-index/README.md +14 -0
  22. package/app-engine/demo-version-index/app.yaml +28 -0
  23. package/app-engine/demo-version-index/generate.py +164 -0
  24. package/app-engine/demo-version-index/main.py +11 -0
  25. package/app-engine/demo-version-index/requirements.txt +5 -0
  26. package/app-engine/demo-version-index/templates/index.html +114 -0
  27. package/app-engine/shaka-player-demo/README.md +18 -0
  28. package/app-engine/shaka-player-demo/app.yaml +61 -0
  29. package/app-engine/shaka-player-demo/main.py +95 -0
  30. package/app-engine/shaka-player-demo/posters/10yo.png +0 -0
  31. package/app-engine/shaka-player-demo/posters/10yo.xcf +0 -0
  32. package/app-engine/shaka-player-demo/posters/1yo.jpg +0 -0
  33. package/app-engine/shaka-player-demo/posters/2yo.png +0 -0
  34. package/app-engine/shaka-player-demo/posters/2yo.xcf +0 -0
  35. package/app-engine/shaka-player-demo/posters/3yo.png +0 -0
  36. package/app-engine/shaka-player-demo/posters/3yo.xcf +0 -0
  37. package/app-engine/shaka-player-demo/posters/4yo.png +0 -0
  38. package/app-engine/shaka-player-demo/posters/4yo.xcf +0 -0
  39. package/app-engine/shaka-player-demo/posters/5yo.png +0 -0
  40. package/app-engine/shaka-player-demo/posters/5yo.xcf +0 -0
  41. package/app-engine/shaka-player-demo/posters/6yo.png +0 -0
  42. package/app-engine/shaka-player-demo/posters/6yo.xcf +0 -0
  43. package/app-engine/shaka-player-demo/posters/7yo.png +0 -0
  44. package/app-engine/shaka-player-demo/posters/7yo.xcf +0 -0
  45. package/app-engine/shaka-player-demo/posters/8yo.png +0 -0
  46. package/app-engine/shaka-player-demo/posters/8yo.xcf +0 -0
  47. package/app-engine/shaka-player-demo/posters/9yo.png +0 -0
  48. package/app-engine/shaka-player-demo/posters/9yo.xcf +0 -0
  49. package/app-engine/shaka-player-demo/posters/audioOnly.gif +0 -0
  50. package/app-engine/shaka-player-demo/posters/audioRickRoll.gif +0 -0
  51. package/app-engine/shaka-player-demo/posters/colorbars.gif +0 -0
  52. package/app-engine/shaka-player-demo/posters/fireworks.jpg +0 -0
  53. package/app-engine/shaka-player-demo/posters/party-hat.png +0 -0
  54. package/app-engine/shaka-player-demo/posters/sources.txt +46 -0
  55. package/app-engine/shaka-player-demo/posters/standard.png +0 -0
  56. package/app-engine/shaka-player-demo/posters/trek.jpg +0 -0
  57. package/app-engine/shaka-player-demo/posters/valentines.png +0 -0
  58. package/app-engine/shaka-player-demo/posters/zombie.jpg +0 -0
  59. package/app-engine/shaka-player-demo/posters.py +110 -0
  60. package/app-engine/shaka-player-demo/requirements.txt +5 -0
  61. package/app-engine/shaka-player-demo/time.txt +1 -0
  62. package/build/README.md +3 -3
  63. package/build/checkversion.py +1 -1
  64. package/build/compiler.py +1 -1
  65. package/build/conformance.textproto +13 -0
  66. package/build/docker/Dockerfile +20 -0
  67. package/build/docker/docker-compose.yml +10 -0
  68. package/build/gendeps.py +18 -15
  69. package/build/shaka-lab.yaml +161 -0
  70. package/build/shakaBuildHelpers.py +4 -29
  71. package/build/test.py +94 -29
  72. package/build/types/core +0 -1
  73. package/build/types/polyfill +1 -3
  74. package/build/wrapper.template.js +2 -2
  75. package/demo/TengwarTelcontar.woff2 +0 -0
  76. package/demo/asset_card.js +1 -2
  77. package/demo/cast_receiver/index.html +1 -1
  78. package/demo/cast_receiver/receiver_app.css +14 -14
  79. package/demo/common/asset.js +17 -1
  80. package/demo/common/assets.js +31 -0
  81. package/demo/common/message_ids.js +6 -3
  82. package/demo/config.js +10 -12
  83. package/demo/custom.js +39 -1
  84. package/demo/customWarning.txt +2 -2
  85. package/demo/demo.less +29 -18
  86. package/demo/demo_uncompiled.js +1 -13
  87. package/demo/demo_utils.js +0 -1
  88. package/demo/index.html +1 -1
  89. package/demo/locales/en.json +6 -3
  90. package/demo/locales/source.json +22 -10
  91. package/demo/main.js +12 -9
  92. package/demo/search.js +2 -1
  93. package/dist/controls.css +3 -3
  94. package/dist/controls.css.map +1 -1
  95. package/dist/demo.compiled.debug.js +236 -232
  96. package/dist/demo.compiled.debug.map +4 -4
  97. package/dist/demo.compiled.js +236 -232
  98. package/dist/demo.compiled.map +4 -4
  99. package/dist/demo.css +1 -1
  100. package/dist/demo.css.map +1 -1
  101. package/dist/deps.js +229 -226
  102. package/dist/locales.js +34 -32
  103. package/dist/receiver.compiled.debug.js +75 -73
  104. package/dist/receiver.compiled.debug.map +4 -4
  105. package/dist/receiver.compiled.js +75 -73
  106. package/dist/receiver.compiled.map +4 -4
  107. package/dist/shaka-player.compiled.d.ts +321 -314
  108. package/dist/shaka-player.compiled.debug.d.ts +321 -314
  109. package/dist/shaka-player.compiled.debug.externs.js +140 -129
  110. package/dist/shaka-player.compiled.debug.js +527 -592
  111. package/dist/shaka-player.compiled.debug.map +4 -4
  112. package/dist/shaka-player.compiled.externs.js +140 -129
  113. package/dist/shaka-player.compiled.js +836 -860
  114. package/dist/shaka-player.compiled.map +4 -4
  115. package/dist/shaka-player.ui.d.ts +367 -358
  116. package/dist/shaka-player.ui.debug.d.ts +367 -358
  117. package/dist/shaka-player.ui.debug.externs.js +148 -129
  118. package/dist/shaka-player.ui.debug.js +586 -649
  119. package/dist/shaka-player.ui.debug.map +4 -4
  120. package/dist/shaka-player.ui.externs.js +148 -129
  121. package/dist/shaka-player.ui.js +1008 -1028
  122. package/dist/shaka-player.ui.map +4 -4
  123. package/docs/design/REDESIGN.md +33 -33
  124. package/docs/design/bg-fetch.md +2 -2
  125. package/docs/design/codec_preferences.md +1 -1
  126. package/docs/design/dash-audio-channels.md +3 -3
  127. package/docs/design/dash-manifests.md +1 -1
  128. package/docs/design/gap-jumping.md +3 -3
  129. package/docs/design/preload.md +2 -2
  130. package/docs/tutorials/config.md +0 -2
  131. package/docs/tutorials/drm-config.md +5 -0
  132. package/docs/tutorials/fairplay.md +7 -22
  133. package/docs/tutorials/faq.md +8 -19
  134. package/docs/tutorials/index.json +3 -8
  135. package/docs/tutorials/plugins.md +4 -6
  136. package/docs/tutorials/selenium-grid-config.md +122 -0
  137. package/docs/tutorials/upgrade.md +83 -11
  138. package/docs/tutorials/welcome.md +10 -2
  139. package/externs/cmcd.js +1 -1
  140. package/externs/polyfill.js +15 -0
  141. package/externs/shaka/manifest.js +5 -1
  142. package/externs/shaka/net.js +12 -0
  143. package/externs/shaka/offline.js +5 -1
  144. package/externs/shaka/player.js +39 -32
  145. package/externs/shaka/text.js +12 -12
  146. package/externs/sourcebuffer.js +15 -0
  147. package/karma.conf.js +137 -30
  148. package/lib/abr/simple_abr_manager.js +12 -6
  149. package/lib/ads/client_side_ad.js +13 -2
  150. package/lib/ads/client_side_ad_manager.js +22 -4
  151. package/lib/cast/cast_proxy.js +3 -4
  152. package/lib/cast/cast_utils.js +0 -1
  153. package/lib/cea/cea608_data_channel.js +2 -2
  154. package/lib/cea/cea708_service.js +5 -4
  155. package/lib/cea/mp4_cea_parser.js +11 -5
  156. package/lib/cea/sei_processor.js +6 -3
  157. package/lib/dash/content_protection.js +85 -5
  158. package/lib/dash/dash_parser.js +10 -12
  159. package/lib/dash/mpd_utils.js +4 -5
  160. package/lib/dash/segment_list.js +1 -2
  161. package/lib/dash/segment_template.js +3 -3
  162. package/lib/hls/hls_parser.js +386 -749
  163. package/lib/hls/manifest_text_parser.js +5 -6
  164. package/lib/media/adaptation_set.js +1 -2
  165. package/lib/media/content_workarounds.js +2 -2
  166. package/lib/media/drm_engine.js +105 -55
  167. package/lib/media/gap_jumping_controller.js +10 -45
  168. package/lib/media/media_source_engine.js +90 -17
  169. package/lib/media/mp4_segment_index_parser.js +1 -4
  170. package/lib/media/playhead.js +4 -7
  171. package/lib/media/presentation_timeline.js +19 -10
  172. package/lib/media/segment_index.js +13 -46
  173. package/lib/media/segment_reference.js +47 -1
  174. package/lib/media/streaming_engine.js +35 -17
  175. package/lib/media/time_ranges_utils.js +5 -12
  176. package/lib/media/video_wrapper.js +1 -1
  177. package/lib/net/networking_engine.js +4 -1
  178. package/lib/offline/indexeddb/v1_storage_cell.js +1 -0
  179. package/lib/offline/indexeddb/v2_storage_cell.js +1 -0
  180. package/lib/offline/manifest_converter.js +1 -0
  181. package/lib/offline/storage.js +104 -136
  182. package/lib/player.js +50 -216
  183. package/lib/polyfill/all.js +2 -3
  184. package/lib/polyfill/encryption_scheme.js +1 -1
  185. package/lib/polyfill/media_capabilities.js +15 -9
  186. package/lib/polyfill/mediasource.js +0 -28
  187. package/lib/polyfill/patchedmediakeys_nop.js +2 -0
  188. package/lib/polyfill/patchedmediakeys_webkit.js +2 -0
  189. package/lib/polyfill/symbol.js +46 -0
  190. package/lib/text/cue.js +1 -7
  191. package/lib/text/lrc_text_parser.js +8 -0
  192. package/lib/text/mp4_ttml_parser.js +8 -0
  193. package/lib/text/mp4_vtt_parser.js +8 -0
  194. package/lib/text/sbv_text_parser.js +8 -0
  195. package/lib/text/simple_text_displayer.js +3 -8
  196. package/lib/text/srt_text_parser.js +8 -0
  197. package/lib/text/ssa_text_parser.js +8 -0
  198. package/lib/text/text_engine.js +19 -3
  199. package/lib/text/ttml_text_parser.js +16 -5
  200. package/lib/text/ui_text_displayer.js +2 -8
  201. package/lib/text/vtt_text_parser.js +24 -2
  202. package/lib/text/web_vtt_generator.js +1 -7
  203. package/lib/util/buffer_utils.js +1 -3
  204. package/lib/util/ebml_parser.js +3 -3
  205. package/lib/util/error.js +10 -14
  206. package/lib/util/fairplay_utils.js +109 -0
  207. package/lib/util/functional.js +0 -42
  208. package/lib/util/iterables.js +0 -46
  209. package/lib/util/mime_utils.js +2 -0
  210. package/lib/util/mp4_box_parsers.js +1 -4
  211. package/lib/util/mp4_parser.js +5 -7
  212. package/lib/util/periods.js +10 -11
  213. package/lib/util/platform.js +48 -3
  214. package/lib/util/player_configuration.js +12 -6
  215. package/lib/util/pssh.js +24 -8
  216. package/lib/util/stream_utils.js +96 -25
  217. package/lib/util/string_utils.js +3 -5
  218. package/lib/util/uint8array_utils.js +3 -21
  219. package/lib/util/xml_utils.js +16 -8
  220. package/package.json +61 -36
  221. package/roadmap.md +27 -27
  222. package/shaka-player.uncompiled.js +1 -3
  223. package/test/abr/simple_abr_manager_unit.js +3 -8
  224. package/test/ads/ad_manager_unit.js +0 -6
  225. package/test/cast/cast_proxy_unit.js +0 -8
  226. package/test/cast/cast_receiver_integration.js +1 -18
  227. package/test/cast/cast_receiver_unit.js +1 -9
  228. package/test/cast/cast_sender_unit.js +0 -6
  229. package/test/cast/cast_utils_unit.js +1 -13
  230. package/test/cea/cea608_memory_unit.js +0 -5
  231. package/test/cea/cea708_service_unit.js +0 -7
  232. package/test/cea/cea708_window_unit.js +0 -5
  233. package/test/cea/cea_decoder_unit.js +0 -6
  234. package/test/cea/dtvcc_packet_builder_unit.js +0 -3
  235. package/test/cea/dtvcc_packet_unit.js +0 -5
  236. package/test/cea/mp4_cea_parser_unit.js +0 -4
  237. package/test/dash/dash_parser_content_protection_unit.js +45 -10
  238. package/test/dash/dash_parser_live_unit.js +2 -15
  239. package/test/dash/dash_parser_manifest_unit.js +2 -40
  240. package/test/dash/dash_parser_segment_base_unit.js +1 -8
  241. package/test/dash/dash_parser_segment_list_unit.js +1 -7
  242. package/test/dash/dash_parser_segment_template_unit.js +3 -13
  243. package/test/dash/mpd_utils_unit.js +3 -11
  244. package/test/demo/demo_unit.js +2 -6
  245. package/test/deprecate/enforcer_unit.js +0 -4
  246. package/test/deprecate/version_unit.js +0 -2
  247. package/test/hls/hls_live_unit.js +101 -234
  248. package/test/hls/hls_parser_unit.js +517 -447
  249. package/test/hls/manifest_text_parser_unit.js +0 -10
  250. package/test/media/adaptation_set_criteria_unit.js +3 -7
  251. package/test/media/adaptation_set_unit.js +0 -2
  252. package/test/media/buffering_observer_unit.js +1 -4
  253. package/test/media/closed_caption_parser_unit.js +0 -3
  254. package/test/media/drm_engine_integration.js +2 -15
  255. package/test/media/drm_engine_unit.js +90 -144
  256. package/test/media/manifest_parser_unit.js +0 -4
  257. package/test/media/media_source_engine_integration.js +26 -10
  258. package/test/media/media_source_engine_unit.js +8 -20
  259. package/test/media/mp4_segment_index_parser_unit.js +0 -4
  260. package/test/media/play_rate_controller_unit.js +0 -4
  261. package/test/media/playhead_unit.js +35 -207
  262. package/test/media/presentation_timeline_unit.js +4 -7
  263. package/test/media/quality_observer_unit.js +0 -4
  264. package/test/media/region_observer_unit.js +1 -6
  265. package/test/media/region_timeline_unit.js +0 -3
  266. package/test/media/segment_index_unit.js +15 -31
  267. package/test/media/segment_reference_unit.js +0 -3
  268. package/test/media/stall_detector_unit.js +0 -5
  269. package/test/media/streaming_engine_integration.js +13 -75
  270. package/test/media/streaming_engine_unit.js +14 -37
  271. package/test/media/time_ranges_utils_unit.js +0 -7
  272. package/test/media/transmuxer_integration.js +0 -6
  273. package/test/media/webm_segment_index_parser_unit.js +0 -4
  274. package/test/net/data_uri_plugin_unit.js +0 -7
  275. package/test/net/http_plugin_unit.js +0 -9
  276. package/test/net/networking_engine_unit.js +0 -11
  277. package/test/offline/download_progress_estimator_unit.js +0 -2
  278. package/test/offline/indexeddb_storage_unit.js +0 -6
  279. package/test/offline/manifest_convert_unit.js +34 -12
  280. package/test/offline/offline_integration.js +1 -10
  281. package/test/offline/offline_manifest_parser_unit.js +1 -6
  282. package/test/offline/offline_scheme_unit.js +0 -8
  283. package/test/offline/offline_uri_unit.js +0 -2
  284. package/test/offline/storage_compatibility_unit.js +1 -14
  285. package/test/offline/storage_integration.js +6 -31
  286. package/test/player_external.js +1 -15
  287. package/test/player_integration.js +38 -28
  288. package/test/player_load_graph_integration.js +1 -6
  289. package/test/player_src_equals_external.js +3 -9
  290. package/test/player_src_equals_integration.js +0 -7
  291. package/test/player_unit.js +78 -37
  292. package/test/routing/walker_unit.js +0 -8
  293. package/test/test/assets/large_file.mpd +1 -1
  294. package/test/test/boot.js +75 -22
  295. package/test/test/externs/jasmine.js +2 -2
  296. package/test/test/externs/karma.js +4 -0
  297. package/test/test/namespace.js +10 -0
  298. package/test/test/util/canned_idb.js +0 -8
  299. package/test/test/util/cea_utils.js +0 -6
  300. package/test/test/util/dash_parser_util.js +0 -13
  301. package/test/test/util/fake_ad.js +0 -3
  302. package/test/test/util/fake_ad_manager.js +0 -9
  303. package/test/test/util/fake_demo_main.js +0 -5
  304. package/test/test/util/fake_drm_engine.js +0 -6
  305. package/test/test/util/fake_media_source_engine.js +11 -11
  306. package/test/test/util/fake_networking_engine.js +0 -5
  307. package/test/test/util/fake_text_displayer.js +0 -5
  308. package/test/test/util/indexeddb_utils.js +1 -10
  309. package/test/test/util/jasmine_fetch.js +0 -1
  310. package/test/test/util/loader.js +0 -18
  311. package/test/test/util/manifest_generator.js +12 -15
  312. package/test/test/util/manifest_parser_util.js +4 -7
  313. package/test/test/util/offline_utils.js +1 -5
  314. package/test/test/util/simple_fakes.js +9 -26
  315. package/test/test/util/stream_generator.js +0 -14
  316. package/test/test/util/streaming_engine_util.js +1 -15
  317. package/test/test/util/test_scheme.js +25 -20
  318. package/test/test/util/ttml_utils.js +0 -2
  319. package/test/test/util/ui_utils.js +0 -9
  320. package/test/test/util/util.js +9 -23
  321. package/test/test/util/waiter.js +84 -43
  322. package/test/text/cue_integration.js +2 -6
  323. package/test/text/lrc_text_parser_unit.js +6 -11
  324. package/test/text/mp4_ttml_parser_unit.js +6 -10
  325. package/test/text/mp4_vtt_parser_unit.js +7 -12
  326. package/test/text/sbv_text_parser_unit.js +5 -10
  327. package/test/text/simple_text_displayer_unit.js +1 -8
  328. package/test/text/srt_text_parser_unit.js +5 -10
  329. package/test/text/ssa_text_parser_unit.js +17 -34
  330. package/test/text/text_engine_unit.js +47 -12
  331. package/test/text/text_track_integration.js +0 -2
  332. package/test/text/ttml_text_parser_unit.js +79 -88
  333. package/test/text/ui_text_displayer_unit.js +44 -41
  334. package/test/text/vtt_text_parser_unit.js +55 -66
  335. package/test/text/web_vtt_generator_unit.js +0 -3
  336. package/test/ui/ad_ui_unit.js +0 -11
  337. package/test/ui/localization_unit.js +0 -3
  338. package/test/ui/text_displayer_layout_unit.js +1 -12
  339. package/test/ui/ui_customization_unit.js +0 -6
  340. package/test/ui/ui_integration.js +0 -32
  341. package/test/ui/ui_unit.js +28 -17
  342. package/test/util/abortable_operation_unit.js +4 -9
  343. package/test/util/array_utils_unit.js +0 -2
  344. package/test/util/buffer_utils_unit.js +0 -2
  345. package/test/util/cmcd_manager_unit.js +3 -3
  346. package/test/util/data_view_reader_unit.js +0 -4
  347. package/test/util/ebml_parser_unit.js +0 -4
  348. package/test/util/event_manager_unit.js +0 -3
  349. package/test/util/fake_event_target_unit.js +0 -5
  350. package/test/util/iterables_unit.js +0 -64
  351. package/test/util/language_utils_unit.js +0 -3
  352. package/test/util/manifest_parser_utils_unit.js +0 -2
  353. package/test/util/mp4_box_parsers_unit.js +0 -5
  354. package/test/util/mp4_parser_unit.js +0 -4
  355. package/test/util/multi_map_unit.js +0 -3
  356. package/test/util/object_utils_unit.js +0 -2
  357. package/test/util/periods_unit.js +14 -7
  358. package/test/util/pssh_unit.js +0 -5
  359. package/test/util/state_history_unit.js +0 -2
  360. package/test/util/stream_utils_unit.js +26 -15
  361. package/test/util/string_utils_unit.js +0 -6
  362. package/test/util/text_parser_unit.js +0 -2
  363. package/test/util/xml_utils_unit.js +0 -4
  364. package/ui/controls.js +65 -40
  365. package/ui/fullscreen_button.js +26 -6
  366. package/ui/less/ad_controls.less +6 -6
  367. package/ui/less/buttons.less +6 -6
  368. package/ui/less/containers.less +10 -12
  369. package/ui/less/overflow_menu.less +4 -4
  370. package/ui/less/range_elements.less +7 -2
  371. package/ui/less/tooltip.less +4 -4
  372. package/ui/locales/en.json +1 -0
  373. package/ui/locales/sjn-translations.yaml +257 -0
  374. package/ui/locales/sjn.json +42 -0
  375. package/ui/locales/source.json +5 -0
  376. package/ui/resolution_selection.js +31 -33
  377. package/ui/seek_bar.js +2 -1
  378. package/ui/ui.js +0 -17
  379. package/.github/workflows/build_and_test.yaml +0 -73
  380. package/.github/workflows/release.yaml +0 -53
  381. package/docs/tutorials/upgrade-v2-5.md +0 -441
  382. package/docs/tutorials/upgrade-v3.md +0 -38
  383. package/externs/svgelement.js +0 -18
  384. package/externs/webcrypto.js +0 -18
  385. package/lib/polyfill/mathround.js +0 -49
  386. package/lib/polyfill/patchedmediakeys_apple.js +0 -744
  387. package/lib/polyfill/patchedmediakeys_ms.js +0 -698
  388. package/lib/util/mutex.js +0 -52
  389. package/test/util/functional_unit.js +0 -82
@@ -9,8 +9,6 @@ goog.provide('shaka.util.Mp4Parser');
9
9
  goog.require('goog.asserts');
10
10
  goog.require('shaka.log');
11
11
  goog.require('shaka.util.DataViewReader');
12
- goog.require('shaka.util.Functional');
13
- goog.require('shaka.util.Iterables');
14
12
 
15
13
 
16
14
  /**
@@ -229,8 +227,7 @@ shaka.util.Mp4Parser = class {
229
227
  // start position. The header size varies.
230
228
  const headerSize = shaka.util.Mp4Parser.headerSize(box);
231
229
  const count = box.reader.readUint32();
232
- for (const _ of shaka.util.Iterables.range(count)) {
233
- shaka.util.Functional.ignored(_);
230
+ for (let i = 0; i < count; i++) {
234
231
  box.parser.parseNext(box.start + headerSize, box.reader, box.partialOkay);
235
232
  if (box.parser.done_) {
236
233
  break;
@@ -302,9 +299,10 @@ shaka.util.Mp4Parser = class {
302
299
  * @export
303
300
  */
304
301
  static headerSize(box) {
305
- return /* basic header */ 8
306
- + /* additional 64-bit size field */ (box.has64BitSize ? 8 : 0)
307
- + /* version and flags for a "full" box */ (box.flags != null ? 4 : 0);
302
+ const basicHeaderSize = 8;
303
+ const _64BitFieldSize = box.has64BitSize ? 8 : 0;
304
+ const versionAndFlagsSize = box.flags != null ? 4 : 0;
305
+ return basicHeaderSize + _64BitFieldSize + versionAndFlagsSize;
308
306
  }
309
307
  };
310
308
 
@@ -14,7 +14,6 @@ goog.require('shaka.media.SegmentIndex');
14
14
  goog.require('shaka.util.ArrayUtils');
15
15
  goog.require('shaka.util.Error');
16
16
  goog.require('shaka.util.IReleasable');
17
- goog.require('shaka.util.Iterables');
18
17
  goog.require('shaka.util.LanguageUtils');
19
18
  goog.require('shaka.util.ManifestParserUtils');
20
19
  goog.require('shaka.util.MapUtils');
@@ -98,7 +97,6 @@ shaka.util.PeriodCombiner = class {
98
97
  */
99
98
  async combinePeriods(periods, isDynamic) {
100
99
  const ContentType = shaka.util.ManifestParserUtils.ContentType;
101
- const Iterables = shaka.util.Iterables;
102
100
 
103
101
  shaka.util.PeriodCombiner.filterOutAudioStreamDuplicates_(periods);
104
102
  shaka.util.PeriodCombiner.filterOutVideoStreamDuplicates_(periods);
@@ -118,7 +116,8 @@ shaka.util.PeriodCombiner = class {
118
116
  // Find the first period we haven't seen before. Tag all the periods we
119
117
  // see now as "used".
120
118
  let firstNewPeriodIndex = -1;
121
- for (const {i, item: period} of Iterables.enumerate(periods)) {
119
+ for (let i = 0; i < periods.length; i++) {
120
+ const period = periods[i];
122
121
  if (this.usedPeriodIds_.has(period.id)) {
123
122
  // This isn't new.
124
123
  } else {
@@ -301,6 +300,7 @@ shaka.util.PeriodCombiner = class {
301
300
  t1.label == t2.label &&
302
301
  t1.codecs == t2.codecs &&
303
302
  t1.mimeType == t2.mimeType &&
303
+ t1.bandwidth == t2.bandwidth &&
304
304
  ArrayUtils.hasSameElements(t1.roles, t2.roles)) {
305
305
  duplicate = true;
306
306
  }
@@ -510,13 +510,12 @@ shaka.util.PeriodCombiner = class {
510
510
  static async combine_(
511
511
  outputStreams, streamsPerPeriod, firstNewPeriodIndex, clone, concat) {
512
512
  const ContentType = shaka.util.ManifestParserUtils.ContentType;
513
- const Iterables = shaka.util.Iterables;
514
513
 
515
514
  const unusedStreamsPerPeriod = [];
516
- for (const {i, item: streams} of Iterables.enumerate(streamsPerPeriod)) {
515
+ for (let i = 0; i < streamsPerPeriod.length; i++) {
517
516
  if (i >= firstNewPeriodIndex) {
518
517
  // This periods streams are all new.
519
- unusedStreamsPerPeriod.push(new Set(streams));
518
+ unusedStreamsPerPeriod.push(new Set(streamsPerPeriod[i]));
520
519
  } else {
521
520
  // This period's streams have all been used already.
522
521
  unusedStreamsPerPeriod.push(new Set());
@@ -668,12 +667,12 @@ shaka.util.PeriodCombiner = class {
668
667
 
669
668
  // Concatenate the new matches onto the stream, starting at the first new
670
669
  // period.
671
- const Iterables = shaka.util.Iterables;
672
670
  // Satisfy the compiler about the type.
673
671
  // Also checks if the segmentIndex is still valid after the async
674
672
  // operations, to make sure we stop if the active stream has changed.
675
673
  if (outputStream.segmentIndex instanceof shaka.media.MetaSegmentIndex) {
676
- for (const {i, item: match} of Iterables.enumerate(streams)) {
674
+ for (let i = 0; i < streams.length; i++) {
675
+ const match = streams[i];
677
676
  if (match.segmentIndex && i >= firstNewPeriodIndex) {
678
677
  goog.asserts.assert(match.segmentIndex,
679
678
  'stream should have a segmentIndex.');
@@ -768,9 +767,9 @@ shaka.util.PeriodCombiner = class {
768
767
 
769
768
  // Concatenate the new matches onto the stream, starting at the first new
770
769
  // period.
771
- const Iterables = shaka.util.Iterables;
772
- for (const {i, item: match} of Iterables.enumerate(matches)) {
770
+ for (let i = 0; i < matches.length; i++) {
773
771
  if (i >= firstNewPeriodIndex) {
772
+ const match = matches[i];
774
773
  concat(outputStream, match);
775
774
 
776
775
  // We only consider an audio stream "used" if its language is related to
@@ -1210,7 +1209,7 @@ shaka.util.PeriodCombiner = class {
1210
1209
  // [r1, r2, r3, r4].
1211
1210
  // If we match stream1 with stream3 due to the same role overlap,
1212
1211
  // stream2 is likely to be left unmatched and error out later.
1213
- // See https://github.com/google/shaka-player/issues/2542 for
1212
+ // See https://github.com/shaka-project/shaka-player/issues/2542 for
1214
1213
  // more details.
1215
1214
  return candidate.roles.length < best.roles.length;
1216
1215
  }
@@ -142,6 +142,18 @@ shaka.util.Platform = class {
142
142
  return shaka.util.Platform.userAgentContains_('Web0S');
143
143
  }
144
144
 
145
+ /**
146
+ * Check if the current platform is a WebOS 3.
147
+ *
148
+ * @return {boolean}
149
+ */
150
+ static isWebOS3() {
151
+ // See: http://webostv.developer.lge.com/discover/specifications/web-engine/
152
+ return shaka.util.Platform.userAgentContains_('Web0S') &&
153
+ shaka.util.Platform.userAgentContains_(
154
+ 'Chrome/38.0.2125.122 Safari/537.36');
155
+ }
156
+
145
157
  /**
146
158
  * Check if the current platform is a Google Chromecast.
147
159
  *
@@ -151,6 +163,16 @@ shaka.util.Platform = class {
151
163
  return shaka.util.Platform.userAgentContains_('CrKey');
152
164
  }
153
165
 
166
+ /**
167
+ * Check if the current platform is a Android-based Cast devices.
168
+ *
169
+ * @return {boolean}
170
+ */
171
+ static isAndroidCastDevice() {
172
+ return shaka.util.Platform.isChromecast() &&
173
+ shaka.util.Platform.userAgentContains_('Android');
174
+ }
175
+
154
176
  /**
155
177
  * Check if the current platform is Google Chrome.
156
178
  *
@@ -174,8 +196,8 @@ shaka.util.Platform = class {
174
196
  * @return {boolean}
175
197
  */
176
198
  static isApple() {
177
- return !!navigator.vendor && navigator.vendor.includes('Apple')
178
- && !shaka.util.Platform.isTizen();
199
+ return !!navigator.vendor && navigator.vendor.includes('Apple') &&
200
+ !shaka.util.Platform.isTizen();
179
201
  }
180
202
 
181
203
  /**
@@ -228,6 +250,16 @@ shaka.util.Platform = class {
228
250
  return null;
229
251
  }
230
252
 
253
+ /**
254
+ * Check if the current platform is Apple Safari
255
+ * or Safari-based iOS browsers.
256
+ *
257
+ * @return {boolean}
258
+ */
259
+ static isSafari() {
260
+ return !!shaka.util.Platform.safariVersion();
261
+ }
262
+
231
263
  /**
232
264
  * Guesses if the platform is a mobile one (iOS or Android).
233
265
  *
@@ -312,12 +344,25 @@ shaka.util.Platform = class {
312
344
  * initialization segments.
313
345
  *
314
346
  * @return {boolean}
315
- * @see https://github.com/google/shaka-player/issues/2759
347
+ * @see https://github.com/shaka-project/shaka-player/issues/2759
316
348
  */
317
349
  static requiresEncryptionInfoInAllInitSegments() {
318
350
  const Platform = shaka.util.Platform;
319
351
  return Platform.isTizen() || Platform.isXboxOne();
320
352
  }
353
+
354
+ /**
355
+ * Returns true if MediaKeys is polyfilled
356
+ *
357
+ * @return {boolean}
358
+ */
359
+ static isMediaKeysPolyfilled() {
360
+ if (window.shakaMediaKeysPolyfill) {
361
+ return true;
362
+ }
363
+
364
+ return false;
365
+ }
321
366
  };
322
367
 
323
368
  /** @private {shaka.util.Timer} */
@@ -9,7 +9,6 @@ goog.provide('shaka.util.PlayerConfiguration');
9
9
  goog.require('goog.asserts');
10
10
  goog.require('shaka.abr.SimpleAbrManager');
11
11
  goog.require('shaka.log');
12
- goog.require('shaka.media.DrmEngine');
13
12
  goog.require('shaka.net.NetworkingEngine');
14
13
  goog.require('shaka.util.ConfigUtils');
15
14
  goog.require('shaka.util.LanguageUtils');
@@ -30,7 +29,10 @@ goog.require('shaka.util.Platform');
30
29
  * @export
31
30
  */
32
31
  shaka.util.PlayerConfiguration = class {
33
- /** @return {shaka.extern.PlayerConfiguration} */
32
+ /**
33
+ * @return {shaka.extern.PlayerConfiguration}
34
+ * @export
35
+ */
34
36
  static createDefault() {
35
37
  // This is a relatively safe default in the absence of clues from the
36
38
  // browser. For slower connections, the default estimate may be too high.
@@ -72,7 +74,6 @@ shaka.util.PlayerConfiguration = class {
72
74
  clearKeys: {}, // key is arbitrary key system ID, value must be string
73
75
  advanced: {}, // key is arbitrary key system ID, value is a record type
74
76
  delayLicenseRequestUntilPlayed: false,
75
- initDataTransform: shaka.media.DrmEngine.defaultInitDataTransform,
76
77
  logLicenseExchange: false,
77
78
  updateExpirationTime: 1,
78
79
  preferredKeySystems: [],
@@ -86,6 +87,7 @@ shaka.util.PlayerConfiguration = class {
86
87
  disableText: false,
87
88
  disableThumbnails: false,
88
89
  defaultPresentationDelay: 0,
90
+ segmentRelativeVttTiming: false,
89
91
  dash: {
90
92
  clockSyncUri: '',
91
93
  ignoreDrmInfo: false,
@@ -100,6 +102,8 @@ shaka.util.PlayerConfiguration = class {
100
102
  keySystemsByURI: {
101
103
  'urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b':
102
104
  'org.w3.clearkey',
105
+ 'urn:uuid:e2719d58-a985-b3c9-781a-b030af78d30e':
106
+ 'org.w3.clearkey',
103
107
  'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed':
104
108
  'com.widevine.alpha',
105
109
  'urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95':
@@ -119,9 +123,11 @@ shaka.util.PlayerConfiguration = class {
119
123
  hls: {
120
124
  ignoreTextStreamFailures: false,
121
125
  ignoreImageStreamFailures: false,
122
- useFullSegmentsForStartTime: false,
123
126
  defaultAudioCodec: 'mp4a.40.2',
124
127
  defaultVideoCodec: 'avc1.42E01E',
128
+ ignoreManifestProgramDateTime: false,
129
+ mediaPlaylistFullMimeType:
130
+ 'video/mp2t; codecs="avc1.42E01E, mp4a.40.2"',
125
131
  },
126
132
  };
127
133
 
@@ -143,8 +149,6 @@ shaka.util.PlayerConfiguration = class {
143
149
  alwaysStreamText: false,
144
150
  startAtSegmentBoundary: false,
145
151
  gapDetectionThreshold: 0.1,
146
- smallGapLimit: 0.5,
147
- jumpLargeGaps: false,
148
152
  durationBackoff: 1,
149
153
  forceTransmuxTS: false,
150
154
  // Offset by 5 seconds since Chromecast takes a few seconds to start
@@ -218,6 +222,8 @@ shaka.util.PlayerConfiguration = class {
218
222
  // unexpected behaviours when someone tries to plays downloaded content
219
223
  // without a persistent license.
220
224
  usePersistentLicense: true,
225
+
226
+ numberOfParallelDownloads: 5,
221
227
  };
222
228
 
223
229
  const abr = {
package/lib/util/pssh.js CHANGED
@@ -9,8 +9,6 @@ goog.provide('shaka.util.Pssh');
9
9
  goog.require('goog.asserts');
10
10
  goog.require('shaka.log');
11
11
  goog.require('shaka.util.BufferUtils');
12
- goog.require('shaka.util.Functional');
13
- goog.require('shaka.util.Iterables');
14
12
  goog.require('shaka.util.Mp4Parser');
15
13
  goog.require('shaka.util.Uint8ArrayUtils');
16
14
 
@@ -83,8 +81,7 @@ shaka.util.Pssh = class {
83
81
  shaka.util.Uint8ArrayUtils.toHex(box.reader.readBytes(16)));
84
82
  if (box.version > 0) {
85
83
  const numKeyIds = box.reader.readUint32();
86
- for (const _ of shaka.util.Iterables.range(numKeyIds)) {
87
- shaka.util.Functional.ignored(_);
84
+ for (let i = 0; i < numKeyIds; i++) {
88
85
  const keyId =
89
86
  shaka.util.Uint8ArrayUtils.toHex(box.reader.readBytes(16));
90
87
  this.cencKeyIds.push(keyId);
@@ -93,16 +90,21 @@ shaka.util.Pssh = class {
93
90
  }
94
91
 
95
92
  /**
96
- * Creates a pssh blob from the given system ID and data.
93
+ * Creates a pssh blob from the given system ID, data, keyIds and version.
97
94
  *
98
95
  * @param {!Uint8Array} data
99
96
  * @param {!Uint8Array} systemId
97
+ * @param {!Set.<string>} keyIds
98
+ * @param {number} version
100
99
  * @return {!Uint8Array}
101
100
  */
102
- static createPssh(data, systemId) {
101
+ static createPssh(data, systemId, keyIds, version) {
103
102
  goog.asserts.assert(systemId.byteLength == 16, 'Invalid system ID length');
104
103
  const dataLength = data.length;
105
- const psshSize = 0x4 + 0x4 + 0x4 + systemId.length + 0x4 + dataLength;
104
+ let psshSize = 0x4 + 0x4 + 0x4 + systemId.length + 0x4 + dataLength;
105
+ if (version > 0) {
106
+ psshSize += 0x4 + (16 * keyIds.size);
107
+ }
106
108
 
107
109
  /** @type {!Uint8Array} */
108
110
  const psshBox = new Uint8Array(psshSize);
@@ -114,10 +116,24 @@ shaka.util.Pssh = class {
114
116
  byteCursor += 0x4;
115
117
  psshData.setUint32(byteCursor, 0x70737368); // 'pssh'
116
118
  byteCursor += 0x4;
117
- psshData.setUint32(byteCursor, 0); // flags
119
+ (version < 1) ? psshData.setUint32(byteCursor, 0) :
120
+ psshData.setUint32(byteCursor, 0x01000000); // version + flags
118
121
  byteCursor += 0x4;
119
122
  psshBox.set(systemId, byteCursor);
120
123
  byteCursor += systemId.length;
124
+
125
+ // if version > 0, add KID count and kid values.
126
+ if (version > 0) {
127
+ psshData.setUint32(byteCursor, keyIds.size); // KID_count
128
+ byteCursor += 0x4;
129
+ const Uint8ArrayUtils = shaka.util.Uint8ArrayUtils;
130
+ for (const keyId of keyIds) {
131
+ const KID = Uint8ArrayUtils.fromHex(keyId);
132
+ psshBox.set(KID, byteCursor);
133
+ byteCursor += KID.length;
134
+ }
135
+ }
136
+
121
137
  psshData.setUint32(byteCursor, dataLength);
122
138
  byteCursor += 0x4;
123
139
  psshBox.set(data, byteCursor);
@@ -406,7 +406,7 @@ shaka.util.StreamUtils = class {
406
406
  shaka.util.StreamUtils.filterManifestByCurrentVariant(
407
407
  currentVariant, manifest);
408
408
  shaka.util.StreamUtils.filterTextStreams_(manifest);
409
- shaka.util.StreamUtils.filterImageStreams_(manifest);
409
+ await shaka.util.StreamUtils.filterImageStreams_(manifest);
410
410
  }
411
411
 
412
412
 
@@ -425,7 +425,7 @@ shaka.util.StreamUtils = class {
425
425
  await shaka.util.StreamUtils.getDecodingInfosForVariants(
426
426
  manifest.variants, usePersistentLicenses, /* srcEquals= */ false);
427
427
  manifest.variants = manifest.variants.filter((variant) => {
428
- // See: https://github.com/google/shaka-player/issues/3860
428
+ // See: https://github.com/shaka-project/shaka-player/issues/3860
429
429
  const video = variant.video;
430
430
  const ContentType = shaka.util.ManifestParserUtils.ContentType;
431
431
  if (video) {
@@ -461,7 +461,7 @@ shaka.util.StreamUtils = class {
461
461
  }
462
462
  }
463
463
 
464
- // See: https://github.com/google/shaka-player/issues/3380
464
+ // See: https://github.com/shaka-project/shaka-player/issues/3380
465
465
  if (shaka.util.Platform.isXboxOne() && video &&
466
466
  ((video.width && video.width > 1920) ||
467
467
  (video.height && video.height > 1080)) &&
@@ -720,7 +720,8 @@ shaka.util.StreamUtils = class {
720
720
  static getCorrectAudioCodecs_(codecs) {
721
721
  // Some Tizen devices seem to misreport AC-3 support, but correctly
722
722
  // report EC-3 support. So query EC-3 as a fallback for AC-3.
723
- // See https://github.com/google/shaka-player/issues/2989 for details.
723
+ // See https://github.com/shaka-project/shaka-player/issues/2989 for
724
+ // details.
724
725
  if (shaka.util.Platform.isTizen()) {
725
726
  return codecs.toLowerCase() == 'ac-3' ? 'ec-3' : codecs;
726
727
  } else {
@@ -812,37 +813,57 @@ shaka.util.StreamUtils = class {
812
813
  * @param {shaka.extern.Manifest} manifest
813
814
  * @private
814
815
  */
815
- static filterImageStreams_(manifest) {
816
- // Filter image streams.
817
- manifest.imageStreams = manifest.imageStreams.filter((stream) => {
818
- // TODO: re-examine this and avoid allow-listing the MIME types we can
819
- // accept.
820
- const validMimeTypes = [
821
- 'image/svg+xml',
822
- 'image/png',
823
- 'image/jpeg',
824
- ];
825
- const Platform = shaka.util.Platform;
826
- // Add webp support to popular platforms that support it.
827
- const webpSupport = Platform.isWebOS() ||
828
- Platform.isTizen() ||
829
- Platform.isChromecast();
830
- if (webpSupport) {
831
- validMimeTypes.push('image/webp');
816
+ static async filterImageStreams_(manifest) {
817
+ const imageStreams = [];
818
+ for (const stream of manifest.imageStreams) {
819
+ const mimeType = stream.mimeType;
820
+ if (!shaka.util.StreamUtils.supportedImageMimeTypes_.has(mimeType)) {
821
+ const minImage = shaka.util.StreamUtils.minImage_.get(mimeType);
822
+ if (minImage) {
823
+ // eslint-disable-next-line no-await-in-loop
824
+ const res = await shaka.util.StreamUtils.isImageSupported_(minImage);
825
+ shaka.util.StreamUtils.supportedImageMimeTypes_.set(mimeType, res);
826
+ } else {
827
+ shaka.util.StreamUtils.supportedImageMimeTypes_.set(mimeType, false);
828
+ }
832
829
  }
833
- // TODO: add support to image/webp and image/avif
834
- const keep = validMimeTypes.includes(stream.mimeType);
830
+
831
+ const keep =
832
+ shaka.util.StreamUtils.supportedImageMimeTypes_.get(mimeType);
835
833
 
836
834
  if (!keep) {
837
835
  shaka.log.debug('Dropping image stream. Is not supported by the ' +
838
836
  'platform.', stream);
837
+ } else {
838
+ imageStreams.push(stream);
839
839
  }
840
+ }
841
+ manifest.imageStreams = imageStreams;
842
+ }
840
843
 
841
- return keep;
844
+ /**
845
+ * @param {string} minImage
846
+ * @return {!Promise.<boolean>}
847
+ * @private
848
+ */
849
+ static isImageSupported_(minImage) {
850
+ return new Promise((resolve) => {
851
+ const imageElement = /** @type {HTMLImageElement} */(new Image());
852
+ imageElement.src = minImage;
853
+ if ('decode' in imageElement) {
854
+ imageElement.decode().then(() => {
855
+ resolve(true);
856
+ }).catch(() => {
857
+ resolve(false);
858
+ });
859
+ } else {
860
+ imageElement.onload = imageElement.onerror = () => {
861
+ resolve(imageElement.height === 2);
862
+ };
863
+ }
842
864
  });
843
865
  }
844
866
 
845
-
846
867
  /**
847
868
  * @param {shaka.extern.Stream} s0
848
869
  * @param {shaka.extern.Stream} s1
@@ -877,6 +898,11 @@ shaka.util.StreamUtils = class {
877
898
  /** @type {?shaka.extern.Stream} */
878
899
  const video = variant.video;
879
900
 
901
+ /** @type {?string} */
902
+ const audioMimeType = audio ? audio.mimeType : null;
903
+ /** @type {?string} */
904
+ const videoMimeType = video ? video.mimeType : null;
905
+
880
906
  /** @type {?string} */
881
907
  const audioCodec = audio ? audio.codecs : null;
882
908
  /** @type {?string} */
@@ -941,6 +967,8 @@ shaka.util.StreamUtils = class {
941
967
  pixelAspectRatio: null,
942
968
  hdr: null,
943
969
  mimeType: mimeType,
970
+ audioMimeType: audioMimeType,
971
+ videoMimeType: videoMimeType,
944
972
  codecs: codecs.join(', '),
945
973
  audioCodec: audioCodec,
946
974
  videoCodec: videoCodec,
@@ -1008,6 +1036,8 @@ shaka.util.StreamUtils = class {
1008
1036
  pixelAspectRatio: null,
1009
1037
  hdr: null,
1010
1038
  mimeType: stream.mimeType,
1039
+ audioMimeType: null,
1040
+ videoMimeType: null,
1011
1041
  codecs: stream.codecs || null,
1012
1042
  audioCodec: null,
1013
1043
  videoCodec: null,
@@ -1080,6 +1110,8 @@ shaka.util.StreamUtils = class {
1080
1110
  pixelAspectRatio: null,
1081
1111
  hdr: null,
1082
1112
  mimeType: stream.mimeType,
1113
+ audioMimeType: null,
1114
+ videoMimeType: null,
1083
1115
  codecs: null,
1084
1116
  audioCodec: null,
1085
1117
  videoCodec: null,
@@ -1198,6 +1230,8 @@ shaka.util.StreamUtils = class {
1198
1230
  pixelAspectRatio: null,
1199
1231
  hdr: null,
1200
1232
  mimeType: null,
1233
+ audioMimeType: null,
1234
+ videoMimeType: null,
1201
1235
  codecs: null,
1202
1236
  audioCodec: null,
1203
1237
  videoCodec: null,
@@ -1502,3 +1536,40 @@ shaka.util.StreamUtils.DecodingAttributes = {
1502
1536
  POWER: 'powerEfficient',
1503
1537
  BANDWIDTH: 'bandwidth',
1504
1538
  };
1539
+
1540
+ /**
1541
+ * @private {!Map.<string, boolean>}
1542
+ */
1543
+ shaka.util.StreamUtils.supportedImageMimeTypes_ = new Map()
1544
+ .set('image/svg+xml', true)
1545
+ .set('image/png', true)
1546
+ .set('image/jpeg', true)
1547
+ .set('image/jpg', true);
1548
+
1549
+ /**
1550
+ * @const {string}
1551
+ * @private
1552
+ */
1553
+ shaka.util.StreamUtils.minWebPImage_ = 'data:image/webp;base64,UklGRjoAAABXRU' +
1554
+ 'JQVlA4IC4AAACyAgCdASoCAAIALmk0mk0iIiIiIgBoSygABc6WWgAA/veff/0PP8bA//LwY' +
1555
+ 'AAA';
1556
+
1557
+ /**
1558
+ * @const {string}
1559
+ * @private
1560
+ */
1561
+ shaka.util.StreamUtils.minAvifImage_ = 'data:image/avif;base64,AAAAIGZ0eXBhdm' +
1562
+ 'lmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljd' +
1563
+ 'AAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEA' +
1564
+ 'AAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAA' +
1565
+ 'AamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAA' +
1566
+ 'xhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAA' +
1567
+ 'CVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A=';
1568
+
1569
+ /**
1570
+ * @const {!Map.<string, string>}
1571
+ * @private
1572
+ */
1573
+ shaka.util.StreamUtils.minImage_ = new Map()
1574
+ .set('image/webp', shaka.util.StreamUtils.minWebPImage_)
1575
+ .set('image/avif', shaka.util.StreamUtils.minAvifImage_);
@@ -10,7 +10,6 @@ goog.require('goog.asserts');
10
10
  goog.require('shaka.log');
11
11
  goog.require('shaka.util.BufferUtils');
12
12
  goog.require('shaka.util.Error');
13
- goog.require('shaka.util.Iterables');
14
13
  goog.require('shaka.util.Lazy');
15
14
 
16
15
 
@@ -81,7 +80,7 @@ shaka.util.StringUtils = class {
81
80
  const length = Math.floor(data.byteLength / 2);
82
81
  const arr = new Uint16Array(length);
83
82
  const dataView = shaka.util.BufferUtils.toDataView(data);
84
- for (const i of shaka.util.Iterables.range(length)) {
83
+ for (let i = 0; i < length; i++) {
85
84
  arr[i] = dataView.getUint16(i * 2, littleEndian);
86
85
  }
87
86
  return shaka.util.StringUtils.fromCharCode(arr);
@@ -158,9 +157,8 @@ shaka.util.StringUtils = class {
158
157
  static toUTF16(str, littleEndian) {
159
158
  const result = new ArrayBuffer(str.length * 2);
160
159
  const view = new DataView(result);
161
- const enumerate = (it) => shaka.util.Iterables.enumerate(it);
162
- for (const {i, item} of enumerate(str)) {
163
- const value = item.charCodeAt(0);
160
+ for (let i = 0; i < str.length; ++i) {
161
+ const value = str.charCodeAt(i);
164
162
  view.setUint16(/* position= */ i * 2, value, littleEndian);
165
163
  }
166
164
  return result;
@@ -6,9 +6,7 @@
6
6
 
7
7
  goog.provide('shaka.util.Uint8ArrayUtils');
8
8
 
9
- goog.require('shaka.Deprecate');
10
9
  goog.require('shaka.util.BufferUtils');
11
- goog.require('shaka.util.Iterables');
12
10
  goog.require('shaka.util.StringUtils');
13
11
 
14
12
 
@@ -18,21 +16,6 @@ goog.require('shaka.util.StringUtils');
18
16
  * @export
19
17
  */
20
18
  shaka.util.Uint8ArrayUtils = class {
21
- /**
22
- * Compare two Uint8Arrays for equality.
23
- * @param {Uint8Array} arr1
24
- * @param {Uint8Array} arr2
25
- * @return {boolean}
26
- * @deprecated
27
- * @export
28
- */
29
- static equal(arr1, arr2) {
30
- shaka.Deprecate.deprecateFeature(4,
31
- 'shaka.util.Uint8ArrayUtils.equal',
32
- 'Please use shaka.util.BufferUtils.equal instead.');
33
- return shaka.util.BufferUtils.equal(arr1, arr2);
34
- }
35
-
36
19
  /**
37
20
  * Convert a buffer to a base64 string. The output will be standard
38
21
  * alphabet as opposed to base64url safe alphabet.
@@ -74,9 +57,8 @@ shaka.util.Uint8ArrayUtils = class {
74
57
  // byte.
75
58
  const bytes = window.atob(str.replace(/-/g, '+').replace(/_/g, '/'));
76
59
  const result = new Uint8Array(bytes.length);
77
- const enumerate = (it) => shaka.util.Iterables.enumerate(it);
78
- for (const {i, item} of enumerate(bytes)) {
79
- result[i] = item.charCodeAt(0);
60
+ for (let i = 0; i < bytes.length; ++i) {
61
+ result[i] = bytes.charCodeAt(i);
80
62
  }
81
63
  return result;
82
64
  }
@@ -91,7 +73,7 @@ shaka.util.Uint8ArrayUtils = class {
91
73
  static fromHex(str) {
92
74
  const size = str.length / 2;
93
75
  const arr = new Uint8Array(size);
94
- for (const i of shaka.util.Iterables.range(size)) {
76
+ for (let i = 0; i < size; i++) {
95
77
  arr[i] = window.parseInt(str.substr(i * 2, 2), 16);
96
78
  }
97
79
  return arr;
@@ -57,9 +57,13 @@ shaka.util.XmlUtils = class {
57
57
  * @return {!Array.<!Element>} The child XML elements.
58
58
  */
59
59
  static findChildren(elem, name) {
60
- return Array.from(elem.childNodes).filter((child) => {
61
- return child instanceof Element && child.tagName == name;
62
- });
60
+ const found = [];
61
+ for (const child of elem.childNodes) {
62
+ if (child instanceof Element && child.tagName == name) {
63
+ found.push(child);
64
+ }
65
+ }
66
+ return found;
63
67
  }
64
68
 
65
69
 
@@ -82,10 +86,14 @@ shaka.util.XmlUtils = class {
82
86
  * @return {!Array.<!Element>} The child XML elements.
83
87
  */
84
88
  static findChildrenNS(elem, ns, name) {
85
- return Array.from(elem.childNodes).filter((child) => {
86
- return child instanceof Element && child.localName == name &&
87
- child.namespaceURI == ns;
88
- });
89
+ const found = [];
90
+ for (const child of elem.childNodes) {
91
+ if (child instanceof Element && child.localName == name &&
92
+ child.namespaceURI == ns) {
93
+ found.push(child);
94
+ }
95
+ }
96
+ return found;
89
97
  }
90
98
 
91
99
 
@@ -191,7 +199,7 @@ shaka.util.XmlUtils = class {
191
199
  }
192
200
 
193
201
  const result = Date.parse(dateString);
194
- return (!isNaN(result) ? Math.floor(result / 1000.0) : null);
202
+ return isNaN(result) ? null : (result / 1000.0);
195
203
  }
196
204
 
197
205