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
@@ -35,11 +35,13 @@ To get the sources and compile the library, you will need:
35
35
  * _NOTE: A local web server is required because browsers place restrictions
36
36
  on applications from file:/// URLs._
37
37
 
38
+ If you just want to compile for export to other projects, you might consider compiling through a docker container. (see compile instructions)
39
+
38
40
  To quickly install these prerequisites on Ubuntu or Debian, you can run this
39
41
  script:
40
42
 
41
43
  ```sh
42
- curl https://raw.githubusercontent.com/google/shaka-player/master/build/install-linux-prereqs.sh | bash
44
+ curl https://raw.githubusercontent.com/shaka-project/shaka-player/main/build/install-linux-prereqs.sh | bash
43
45
  ```
44
46
 
45
47
  We do not provide detailed instructions or scripts for installing these
@@ -51,7 +53,7 @@ links above to download and install the prerequisites manually on any OS.
51
53
  #### Get the source
52
54
 
53
55
  ```sh
54
- git clone https://github.com/google/shaka-player.git
56
+ git clone https://github.com/shaka-project/shaka-player.git
55
57
  cd shaka-player
56
58
  ```
57
59
 
@@ -62,6 +64,12 @@ cd shaka-player
62
64
  python build/all.py
63
65
  ```
64
66
 
67
+ Alternatively you can use a docker container:
68
+ ```sh
69
+ cd build/docker
70
+ docker-compose run --rm shaka-compiler
71
+ ```
72
+
65
73
  The output is:
66
74
  * dist/shaka-player.compiled.js (compiled bundle)
67
75
  * dist/shaka-player.compiled.debug.js (debug bundle)
package/externs/cmcd.js CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  /**
8
8
  * @fileoverview Externs for CMCD data.
9
- * @see https://github.com/google/shaka-player/issues/3619
9
+ * @see https://github.com/shaka-project/shaka-player/issues/3619
10
10
  * @see https://cdn.cta.tech/cta/media/media/resources/standards/pdfs/cta-5004-final.pdf
11
11
  *
12
12
  * @externs
@@ -0,0 +1,15 @@
1
+ /*! @license
2
+ * Shaka Player
3
+ * Copyright 2016 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+
7
+ /**
8
+ * @fileoverview Externs for Shaka polyfills
9
+ *
10
+ * @externs
11
+ */
12
+
13
+
14
+ /** @type {boolean} */
15
+ window.shakaMediaKeysPolyfill;
@@ -17,7 +17,8 @@
17
17
  * textStreams: !Array.<shaka.extern.Stream>,
18
18
  * imageStreams: !Array.<shaka.extern.Stream>,
19
19
  * offlineSessionIds: !Array.<string>,
20
- * minBufferTime: number
20
+ * minBufferTime: number,
21
+ * sequenceMode: boolean
21
22
  * }}
22
23
  *
23
24
  * @description
@@ -72,6 +73,9 @@
72
73
  * The minimum number of seconds of content that must be buffered before
73
74
  * playback can begin. Can be overridden by a higher value from the Player
74
75
  * configuration.
76
+ * @property {boolean} sequenceMode
77
+ * If true, we will append the media segments using sequence mode; that is to
78
+ * say, ignoring any timestamps inside the media files.
75
79
  *
76
80
  * @exportDoc
77
81
  */
@@ -60,6 +60,9 @@ shaka.extern.RetryParameters;
60
60
  * retryParameters: !shaka.extern.RetryParameters,
61
61
  * licenseRequestType: ?string,
62
62
  * sessionId: ?string,
63
+ * drmInfo: ?shaka.extern.DrmInfo,
64
+ * initData: ?Uint8Array,
65
+ * initDataType: ?string,
63
66
  * streamDataCallback: ?function(BufferSource):!Promise
64
67
  * }}
65
68
  *
@@ -90,6 +93,15 @@ shaka.extern.RetryParameters;
90
93
  * @property {?string} sessionId
91
94
  * If this is a LICENSE request, this field contains the session ID of the
92
95
  * EME session that made the request.
96
+ * @property {?shaka.extern.DrmInfo} drmInfo
97
+ * If this is a LICENSE request, this field contains the DRM info used to
98
+ * initialize EME.
99
+ * @property {?Uint8Array} initData
100
+ * If this is a LICENSE request, this field contains the initData info used
101
+ * to initialize EME.
102
+ * @property {?string} initDataType
103
+ * If this is a LICENSE request, this field contains the initDataType info
104
+ * used to initialize EME.
93
105
  * @property {?function(BufferSource):!Promise} streamDataCallback
94
106
  * A callback function to handle the chunked data of the ReadableStream.
95
107
  * @exportDoc
@@ -73,7 +73,8 @@ shaka.extern.StoredContent;
73
73
  * sessionIds: !Array.<string>,
74
74
  * drmInfo: ?shaka.extern.DrmInfo,
75
75
  * appMetadata: Object,
76
- * isIncomplete: (boolean|undefined)
76
+ * isIncomplete: (boolean|undefined),
77
+ * sequenceMode: (boolean|undefined)
77
78
  * }}
78
79
  *
79
80
  * @property {number} creationTime
@@ -98,6 +99,9 @@ shaka.extern.StoredContent;
98
99
  * A metadata object passed from the application.
99
100
  * @property {(boolean|undefined)} isIncomplete
100
101
  * If true, the content is still downloading.
102
+ * @property {(boolean|undefined)} sequenceMode
103
+ * If true, we will append the media segments using sequence mode; that is to
104
+ * say, ignoring any timestamps inside the media files.
101
105
  */
102
106
  shaka.extern.ManifestDB;
103
107
 
@@ -208,6 +208,8 @@ shaka.extern.BufferedInfo;
208
208
  * pixelAspectRatio: ?string,
209
209
  * hdr: ?string,
210
210
  * mimeType: ?string,
211
+ * audioMimeType: ?string,
212
+ * videoMimeType: ?string,
211
213
  * codecs: ?string,
212
214
  * audioCodec: ?string,
213
215
  * videoCodec: ?string,
@@ -267,6 +269,10 @@ shaka.extern.BufferedInfo;
267
269
  * The video HDR provided in the manifest, if present.
268
270
  * @property {?string} mimeType
269
271
  * The MIME type of the content provided in the manifest.
272
+ * @property {?string} audioMimeType
273
+ * The audio MIME type of the content provided in the manifest.
274
+ * @property {?string} videoMimeType
275
+ * The video MIME type of the content provided in the manifest.
270
276
  * @property {?string} codecs
271
277
  * The audio/video codecs string provided in the manifest, if present.
272
278
  * @property {?string} audioCodec
@@ -612,9 +618,6 @@ shaka.extern.AdvancedDrmConfiguration;
612
618
  * clearKeys: !Object.<string, string>,
613
619
  * delayLicenseRequestUntilPlayed: boolean,
614
620
  * advanced: Object.<string, shaka.extern.AdvancedDrmConfiguration>,
615
- * initDataTransform:
616
- * ((function(!Uint8Array, string, ?shaka.extern.DrmInfo):!Uint8Array)|
617
- * undefined),
618
621
  * logLicenseExchange: boolean,
619
622
  * updateExpirationTime: number,
620
623
  * preferredKeySystems: !Array.<string>
@@ -638,14 +641,6 @@ shaka.extern.AdvancedDrmConfiguration;
638
641
  * <i>Optional.</i> <br>
639
642
  * A dictionary which maps key system IDs to advanced DRM configuration for
640
643
  * those key systems.
641
- * @property
642
- * {((function(!Uint8Array, string, ?shaka.extern.DrmInfo):!Uint8Array)|
643
- * undefined)}
644
- * initDataTransform
645
- * <i>Optional.</i><br>
646
- * If given, this function is called with the init data from the
647
- * manifest/media and should return the (possibly transformed) init data to
648
- * pass to the browser.
649
644
  * @property {boolean} logLicenseExchange
650
645
  * <i>Optional.</i><br>
651
646
  * If set to <code>true</code>, prints logs containing the license exchange.
@@ -740,9 +735,10 @@ shaka.extern.DashManifestConfiguration;
740
735
  * @typedef {{
741
736
  * ignoreTextStreamFailures: boolean,
742
737
  * ignoreImageStreamFailures: boolean,
743
- * useFullSegmentsForStartTime: boolean,
744
738
  * defaultAudioCodec: string,
745
- * defaultVideoCodec: string
739
+ * defaultVideoCodec: string,
740
+ * ignoreManifestProgramDateTime: boolean,
741
+ * mediaPlaylistFullMimeType: string
746
742
  * }}
747
743
  *
748
744
  * @property {boolean} ignoreTextStreamFailures
@@ -751,15 +747,26 @@ shaka.extern.DashManifestConfiguration;
751
747
  * @property {boolean} ignoreImageStreamFailures
752
748
  * If <code>true</code>, ignore any errors in a image stream and filter out
753
749
  * those streams.
754
- * @property {boolean} useFullSegmentsForStartTime
755
- * If <code>true</code>, force HlsParser to use a full segment request for
756
- * determining start time in case the server does not support partial requests
757
750
  * @property {string} defaultAudioCodec
758
751
  * The default audio codec if it is not specified in the HLS playlist.
759
752
  * <i>Defaults to <code>'mp4a.40.2'</code>.</i>
760
753
  * @property {string} defaultVideoCodec
761
754
  * The default video codec if it is not specified in the HLS playlist.
762
755
  * <i>Defaults to <code>'avc1.42E01E'</code>.</i>
756
+ * @property {boolean} ignoreManifestProgramDateTime
757
+ * If <code>true</code>, the HLS parser will ignore the
758
+ * <code>EXT-X-PROGRAM-DATE-TIME</code> tags in the manifest.
759
+ * Meant for tags that are incorrect or malformed.
760
+ * <i>Defaults to <code>false</code>.</i>
761
+ * @property {string} mediaPlaylistFullMimeType
762
+ * A string containing a full mime type, including both the basic mime type
763
+ * and also the codecs. Used when the HLS parser parses a media playlist
764
+ * directly, required since all of the mime type and codecs information is
765
+ * contained within the master playlist.
766
+ * You can use the <code>shaka.util.MimeUtils.getFullType()</code> utility to
767
+ * format this value.
768
+ * <i>Defaults to
769
+ * <code>'video/mp2t; codecs="avc1.42E01E, mp4a.40.2"'</code>.</i>
763
770
  * @exportDoc
764
771
  */
765
772
  shaka.extern.HlsManifestConfiguration;
@@ -774,6 +781,7 @@ shaka.extern.HlsManifestConfiguration;
774
781
  * disableText: boolean,
775
782
  * disableThumbnails: boolean,
776
783
  * defaultPresentationDelay: number,
784
+ * segmentRelativeVttTiming: boolean,
777
785
  * dash: shaka.extern.DashManifestConfiguration,
778
786
  * hls: shaka.extern.HlsManifestConfiguration
779
787
  * }}
@@ -805,6 +813,10 @@ shaka.extern.HlsManifestConfiguration;
805
813
  * configured or set as 0.
806
814
  * For HLS, the default value is 3 segments duration if not configured or
807
815
  * set as 0.
816
+ * @property {boolean} segmentRelativeVttTiming
817
+ * Option to calculate VTT text timings relative to the segment start
818
+ * instead of relative to the period start (which is the default).
819
+ * Defaults to <code>false</code>.
808
820
  * @property {shaka.extern.DashManifestConfiguration} dash
809
821
  * Advanced parameters used by the DASH manifest parser.
810
822
  * @property {shaka.extern.HlsManifestConfiguration} hls
@@ -826,8 +838,6 @@ shaka.extern.ManifestConfiguration;
826
838
  * alwaysStreamText: boolean,
827
839
  * startAtSegmentBoundary: boolean,
828
840
  * gapDetectionThreshold: number,
829
- * smallGapLimit: number,
830
- * jumpLargeGaps: boolean,
831
841
  * durationBackoff: number,
832
842
  * forceTransmuxTS: boolean,
833
843
  * safeSeekOffset: number,
@@ -882,18 +892,8 @@ shaka.extern.ManifestConfiguration;
882
892
  * to <code>false</code>.
883
893
  * @property {number} gapDetectionThreshold
884
894
  * TThe maximum distance (in seconds) before a gap when we'll automatically
885
- * jump. This value defaults to <code>0.1</code>, except in Edge Legacy, IE,
895
+ * jump. This value defaults to <code>0.1</code>, except in Edge Legacy,
886
896
  * Tizen, Chromecast that value defaults value is <code>0.5</code>
887
- * @property {number} smallGapLimit
888
- * The limit (in seconds) for a gap in the media to be considered "small".
889
- * Small gaps are jumped automatically without events. Large gaps result
890
- * in a Player event and can be jumped.
891
- * @property {boolean} jumpLargeGaps
892
- * If <code>true</code>, jump large gaps in addition to small gaps. A
893
- * <code>largegap</code> event will be raised first. Then, if the app doesn't
894
- * call <code>preventDefault()</code> on the event, the Player will jump the
895
- * gap. If <code>false</code>, then the event will be raised, but the gap
896
- * will not be jumped.
897
897
  * @property {number} durationBackoff
898
898
  * By default, we will not allow seeking to exactly the duration of a
899
899
  * presentation. This field is the number of seconds before duration we will
@@ -928,8 +928,9 @@ shaka.extern.ManifestConfiguration;
928
928
  * @property {boolean} useNativeHlsOnSafari
929
929
  * Desktop Safari has both MediaSource and their native HLS implementation.
930
930
  * Depending on the application's needs, it may prefer one over the other.
931
- * Examples: FairPlay is only supported via Safari's native HLS, but it
932
- * doesn't have an API for selecting specific tracks.
931
+ * Warning when disabled: Where single-key DRM streams work fine, multi-keys
932
+ * streams is showing unexpected behaviours (stall, audio playing with video
933
+ * freezes, ...). Use with care.
933
934
  * @property {number} inaccurateManifestTolerance
934
935
  * The maximum difference, in seconds, between the times in the manifest and
935
936
  * the times in the segments. Larger values allow us to compensate for more
@@ -1074,7 +1075,8 @@ shaka.extern.CmcdConfiguration;
1074
1075
  * function(shaka.extern.TrackList):!Promise<shaka.extern.TrackList>,
1075
1076
  * downloadSizeCallback: function(number):!Promise<boolean>,
1076
1077
  * progressCallback: function(shaka.extern.StoredContent,number),
1077
- * usePersistentLicense: boolean
1078
+ * usePersistentLicense: boolean,
1079
+ * numberOfParallelDownloads: number
1078
1080
  * }}
1079
1081
  *
1080
1082
  * @property {function(shaka.extern.TrackList):!Promise<shaka.extern.TrackList>}
@@ -1097,6 +1099,11 @@ shaka.extern.CmcdConfiguration;
1097
1099
  * license. A network will be required to retrieve a temporary license to
1098
1100
  * view.
1099
1101
  * Defaults to <code>true</code>.
1102
+ * @property {number} numberOfParallelDownloads
1103
+ * Number of parallel downloads.
1104
+ * Note: normally browsers limit to 5 request in parallel, so putting a
1105
+ * number higher than this will not help it download faster.
1106
+ * Defaults to <code>5</code>.
1100
1107
  * @exportDoc
1101
1108
  */
1102
1109
  shaka.extern.OfflineConfiguration;
@@ -380,17 +380,6 @@ shaka.extern.Cue = class {
380
380
  * @exportDoc
381
381
  */
382
382
  this.lineBreak;
383
-
384
- /**
385
- * @deprecated
386
- * "spacer" is deprecated and will be removed in v4. Use "lineBreak"
387
- * instead.
388
- * Whether or not the cue only acts as a line break between two nested cues.
389
- * Should only appear in nested cues.
390
- * @type {boolean}
391
- * @exportDoc
392
- */
393
- this.spacer;
394
383
  }
395
384
  };
396
385
 
@@ -426,6 +415,13 @@ shaka.extern.TextParser = class {
426
415
  * @exportDoc
427
416
  */
428
417
  parseMedia(data, timeContext) {}
418
+
419
+ /**
420
+ * Notifies the stream if the manifest is in sequence mode or not.
421
+ *
422
+ * @param {boolean} sequenceMode
423
+ */
424
+ setSequenceMode(sequenceMode) {}
429
425
  };
430
426
 
431
427
 
@@ -435,7 +431,8 @@ shaka.extern.TextParser = class {
435
431
  * @typedef {{
436
432
  * periodStart: number,
437
433
  * segmentStart: number,
438
- * segmentEnd: number
434
+ * segmentEnd: number,
435
+ * vttOffset: number
439
436
  * }}
440
437
  *
441
438
  * @property {number} periodStart
@@ -444,6 +441,9 @@ shaka.extern.TextParser = class {
444
441
  * The absolute start time of the segment in seconds.
445
442
  * @property {number} segmentEnd
446
443
  * The absolute end time of the segment in seconds.
444
+ * @property {number} vttOffset
445
+ * The start time relative to either segment or period start depending
446
+ * on <code>segmentRelativeVttTiming</code> configuration.
447
447
  *
448
448
  * @exportDoc
449
449
  */
@@ -0,0 +1,15 @@
1
+ /*! @license
2
+ * Shaka Player
3
+ * Copyright 2016 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+
7
+ /**
8
+ * @fileoverview Externs for SourceBuffer which are missing from the Closure
9
+ * compiler.
10
+ *
11
+ * @externs
12
+ */
13
+
14
+ /** @type {string} */
15
+ SourceBuffer.prototype.mode;
package/karma.conf.js CHANGED
@@ -9,11 +9,13 @@
9
9
 
10
10
  const Jimp = require('jimp');
11
11
  const fs = require('fs');
12
+ const glob = require('glob');
12
13
  const path = require('path');
13
14
  const rimraf = require('rimraf');
14
15
  const {ssim} = require('ssim.js');
15
16
  const util = require('karma/common/util');
16
17
  const which = require('which');
18
+ const yaml = require('js-yaml');
17
19
 
18
20
  /**
19
21
  * @param {Object} config
@@ -43,6 +45,58 @@ module.exports = (config) => {
43
45
  const settings =
44
46
  settingsIndex >= 0 ? JSON.parse(args[settingsIndex + 1]) : {};
45
47
 
48
+ if (settings.grid_config) {
49
+ const gridBrowserMetadata =
50
+ yaml.load(fs.readFileSync(settings.grid_config, 'utf8'));
51
+ const customLaunchers = {};
52
+ const [gridHostname, gridPort] = settings.grid_address.split(':');
53
+ console.log(`Using Selenium grid at ${gridHostname}:${gridPort}`);
54
+
55
+ // By default, run on all grid browsers instead of the platform-specific
56
+ // default. This does not disable local browsers, though. Users can still
57
+ // specify a mix of grid and local browsers explicitly.
58
+ settings.default_browsers = [];
59
+
60
+ for (const name in gridBrowserMetadata) {
61
+ if (name == 'vars') {
62
+ // Skip variable defs in the YAML file
63
+ continue;
64
+ }
65
+
66
+ const metadata = gridBrowserMetadata[name];
67
+
68
+ const launcher = {};
69
+ customLaunchers[name] = launcher;
70
+
71
+ // Disabled-by-default browsers are still defined, but not put in the
72
+ // default list. A user can ask for one explicitly. This allows us to
73
+ // disable a browser that is down for some reason in the lab, but still
74
+ // ask for it manually if we want to test it before re-enabling it for
75
+ // everyone.
76
+ if (!metadata.disabled) {
77
+ settings.default_browsers.push(name);
78
+ }
79
+
80
+ // Add standard WebDriver configs.
81
+ Object.assign(launcher, {
82
+ base: 'WebDriver',
83
+ config: {hostname: gridHostname, port: gridPort},
84
+ pseudoActivityInterval: 20000,
85
+ browserName: metadata.browser,
86
+ platform: metadata.os,
87
+ version: metadata.version,
88
+ });
89
+
90
+ if (metadata.extra_config) {
91
+ Object.assign(launcher, metadata.extra_config);
92
+ }
93
+ }
94
+
95
+ config.set({
96
+ customLaunchers: customLaunchers,
97
+ });
98
+ }
99
+
46
100
  if (settings.browsers && settings.browsers.length == 1 &&
47
101
  settings.browsers[0] == 'help') {
48
102
  console.log('Available browsers:');
@@ -53,6 +107,24 @@ module.exports = (config) => {
53
107
  process.exit(1);
54
108
  }
55
109
 
110
+ // Resolve the set of browsers we will use.
111
+ const browserSet = new Set(settings.browsers && settings.browsers.length ?
112
+ settings.browsers : settings.default_browsers);
113
+ if (settings.exclude_browsers) {
114
+ for (const excluded of settings.exclude_browsers) {
115
+ browserSet.delete(excluded);
116
+ }
117
+ }
118
+
119
+ let browsers = Array.from(browserSet).sort();
120
+ if (settings.no_browsers) {
121
+ console.warn(
122
+ '--no-browsers: In this mode, you must connect browsers to Karma.');
123
+ browsers = null;
124
+ } else {
125
+ console.warn('Running tests on: ' + browsers.join(', '));
126
+ }
127
+
56
128
  config.set({
57
129
  // base path that will be used to resolve all patterns (eg. files, exclude)
58
130
  basePath: '.',
@@ -87,7 +159,7 @@ module.exports = (config) => {
87
159
  // Promise polyfill, required since we test uncompiled code on IE11
88
160
  'node_modules/es6-promise-polyfill/promise.js',
89
161
  // Babel polyfill, required for async/await
90
- 'node_modules/babel-polyfill/dist/polyfill.js',
162
+ 'node_modules/@babel/polyfill/dist/polyfill.js',
91
163
  // TextDecoder polyfill, required for TextDecoder/TextEncoder on IE and
92
164
  // legacy Edge
93
165
  // eslint-disable-next-line max-len
@@ -107,46 +179,46 @@ module.exports = (config) => {
107
179
  'dist/deps.js',
108
180
  'shaka-player.uncompiled.js',
109
181
 
182
+ // the demo's config tab will register with shakaDemoMain, and will be
183
+ // tested in test/demo/demo_unit.js
184
+ 'demo/config.js',
185
+
110
186
  // cajon module (an AMD variant of requirejs) next
111
187
  'node_modules/cajon/cajon.js',
112
188
 
113
- // bootstrapping for the test suite
114
- 'test/test/boot.js',
189
+ // define the test namespace next (shaka.test)
190
+ 'test/test/namespace.js',
115
191
 
116
- // test utils next
192
+ // test utilities next, which fill in that namespace
117
193
  'test/test/util/*.js',
118
194
 
119
- // list of test assets next
120
- 'demo/common/message_ids.js',
121
- 'demo/common/asset.js',
122
- 'demo/common/assets.js',
195
+ // bootstrapping for the test suite last; this will load the actual tests
196
+ 'test/test/boot.js',
123
197
 
124
198
  // if --test-custom-asset *is not* present, we will add unit tests.
125
199
  // if --quick *is not* present, we will add integration tests.
126
200
  // if --external *is* present, we will add external asset tests.
127
201
 
128
- // load relevant demo files
129
- {
130
- pattern: 'demo/!(main|load|demo_uncompiled|service_worker).js',
131
- included: true,
132
- },
133
-
134
- // source files - these are only watched and served
202
+ // source files - these are only watched and served.
203
+ // anything not listed here can't be dynamically loaded by other scripts.
135
204
  {pattern: 'lib/**/*.js', included: false},
136
205
  {pattern: 'ui/**/*.js', included: false},
137
206
  {pattern: 'ui/**/*.less', included: false},
138
207
  {pattern: 'third_party/**/*.js', included: false},
139
- {
140
- pattern: 'node_modules/google-closure-library/closure/goog/**/*.js',
141
- included: false,
142
- },
208
+ {pattern: 'test/**/*.js', included: false},
143
209
  {pattern: 'test/test/assets/*', included: false},
144
210
  {pattern: 'test/test/assets/3675/*', included: false},
145
211
  {pattern: 'dist/shaka-player.ui.js', included: false},
146
212
  {pattern: 'dist/locales.js', included: false},
213
+ {pattern: 'demo/**/*.js', included: false},
147
214
  {pattern: 'demo/locales/en.json', included: false},
148
215
  {pattern: 'demo/locales/source.json', included: false},
149
- {pattern: 'node_modules/**/*.js', included: false},
216
+ {pattern: 'node_modules/sprintf-js/src/sprintf.js', included: false},
217
+ {pattern: 'node_modules/less/dist/less.js', included: false},
218
+ {
219
+ pattern: 'node_modules/fontfaceonload/dist/fontfaceonload.js',
220
+ included: false,
221
+ },
150
222
  ],
151
223
 
152
224
  // NOTE: Do not use proxies at all! They cannot be used with the --hostname
@@ -212,7 +284,7 @@ module.exports = (config) => {
212
284
 
213
285
  // Set which browsers to run on. If this is null, then Karma will wait for
214
286
  // an incoming connection.
215
- browsers: settings.browsers,
287
+ browsers,
216
288
 
217
289
  // Enable / disable colors in the output (reporters and logs). Defaults
218
290
  // to true.
@@ -243,6 +315,7 @@ module.exports = (config) => {
243
315
 
244
316
  specReporter: {
245
317
  suppressSkipped: true,
318
+ showBrowser: true,
246
319
  },
247
320
  });
248
321
 
@@ -260,7 +333,7 @@ module.exports = (config) => {
260
333
 
261
334
  babelPreprocessor: {
262
335
  options: {
263
- presets: ['env'],
336
+ presets: ['@babel/preset-env'],
264
337
  // Add source maps so that backtraces refer to the original code.
265
338
  // Babel will output inline source maps, and the 'sourcemap'
266
339
  // preprocessor will read them and feed them to Karma. Karma will
@@ -283,26 +356,30 @@ module.exports = (config) => {
283
356
  });
284
357
  }
285
358
 
359
+ const clientArgs = config.client.args[0];
360
+ clientArgs.testFiles = [];
361
+
286
362
  if (settings.test_custom_asset) {
287
363
  // If testing custom assets, we don't serve other unit or integration tests.
288
364
  // External asset tests are the basis for custom asset testing, so this file
289
365
  // is automatically included.
290
- config.files.push('test/player_external.js');
366
+ clientArgs.testFiles.push('test/player_external.js');
291
367
  } else {
292
368
  // In a normal test run, we serve unit tests.
293
- config.files.push('test/**/*_unit.js');
369
+ clientArgs.testFiles.push('test/**/*_unit.js');
294
370
 
295
371
  if (!settings.quick) {
296
372
  // If --quick is present, we don't serve integration tests.
297
- config.files.push('test/**/*_integration.js');
373
+ clientArgs.testFiles.push('test/**/*_integration.js');
298
374
  }
299
375
  if (settings.external) {
300
376
  // If --external is present, we serve external asset tests.
301
- config.files.push('test/**/*_external.js');
377
+ clientArgs.testFiles.push('test/**/*_external.js');
302
378
  }
303
379
  }
304
- // We just modified the config in-place. No need for config.set() after we
305
- // push to config.files.
380
+
381
+ // These are the test files that will be dynamically loaded by boot.js.
382
+ clientArgs.testFiles = resolveGlobs(clientArgs.testFiles);
306
383
 
307
384
  const reporters = [];
308
385
 
@@ -347,14 +424,44 @@ module.exports = (config) => {
347
424
  const seed = settings.seed == null ? new Date().getTime() : settings.seed;
348
425
 
349
426
  // Run tests in a random order.
350
- const clientArgs = config.client.args[0];
351
427
  clientArgs.random = true;
352
428
  clientArgs.seed = seed;
353
429
 
354
430
  console.log('Using a random test order (--random) with --seed=' + seed);
355
431
  }
432
+
433
+ if (settings.tls_key && settings.tls_cert) {
434
+ config.set({
435
+ protocol: 'https',
436
+ httpsServerOptions: {
437
+ key: fs.readFileSync(settings.tls_key),
438
+ cert: fs.readFileSync(settings.tls_cert),
439
+ },
440
+ });
441
+ }
356
442
  };
357
443
 
444
+ /**
445
+ * Resolves a list of paths using globs into a list of explicit paths.
446
+ * Paths are all relative to the source directory.
447
+ *
448
+ * @param {!Array.<string>} list
449
+ * @return {!Array.<string>}
450
+ */
451
+ function resolveGlobs(list) {
452
+ const options = {
453
+ cwd: __dirname,
454
+ };
455
+
456
+ const resolved = [];
457
+ for (const path of list) {
458
+ for (const resolvedPath of glob.sync(path, options)) {
459
+ resolved.push(resolvedPath);
460
+ }
461
+ }
462
+ return resolved;
463
+ }
464
+
358
465
  /**
359
466
  * Determines which launchers and customLaunchers can be used and returns an
360
467
  * array of strings.
@@ -421,7 +528,7 @@ function allUsableBrowserLaunchers(config) {
421
528
  browsers.push(...Object.keys(config.customLaunchers));
422
529
  }
423
530
 
424
- return browsers;
531
+ return browsers.sort();
425
532
  }
426
533
 
427
534
  /**