shaka-player 4.6.4 → 4.7.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 (598) hide show
  1. package/README.md +1 -0
  2. package/dist/controls.css +1 -1
  3. package/dist/controls.css.map +1 -1
  4. package/dist/deps.js +9 -5
  5. package/dist/locales.js +29 -29
  6. package/dist/shaka-player.compiled.d.ts +46 -3
  7. package/dist/shaka-player.compiled.debug.d.ts +46 -3
  8. package/dist/shaka-player.compiled.debug.externs.js +45 -0
  9. package/dist/shaka-player.compiled.debug.js +382 -351
  10. package/dist/shaka-player.compiled.debug.map +4 -4
  11. package/dist/shaka-player.compiled.externs.js +45 -0
  12. package/dist/shaka-player.compiled.js +1135 -1121
  13. package/dist/shaka-player.compiled.map +4 -4
  14. package/dist/shaka-player.ui.d.ts +68 -4
  15. package/dist/shaka-player.ui.debug.d.ts +68 -4
  16. package/dist/shaka-player.ui.debug.externs.js +77 -0
  17. package/dist/shaka-player.ui.debug.js +428 -392
  18. package/dist/shaka-player.ui.debug.map +4 -4
  19. package/dist/shaka-player.ui.externs.js +77 -0
  20. package/dist/shaka-player.ui.js +1304 -1290
  21. package/dist/shaka-player.ui.map +4 -4
  22. package/externs/mediasession.js +7 -0
  23. package/externs/shaka/abr_manager.js +8 -0
  24. package/externs/shaka/manifest.js +3 -3
  25. package/externs/shaka/player.js +59 -4
  26. package/lib/abr/simple_abr_manager.js +41 -15
  27. package/lib/cea/cea708_service.js +1 -1
  28. package/lib/cea/cea708_window.js +95 -7
  29. package/lib/dash/dash_parser.js +55 -11
  30. package/lib/media/adaptation_set_criteria.js +76 -10
  31. package/lib/media/media_source_engine.js +42 -18
  32. package/lib/media/segment_reference.js +12 -0
  33. package/lib/media/streaming_engine.js +55 -3
  34. package/lib/player.js +92 -6
  35. package/lib/util/cmsd_manager.js +269 -0
  36. package/lib/util/content_steering_manager.js +5 -1
  37. package/lib/util/mime_utils.js +6 -2
  38. package/lib/util/periods.js +108 -39
  39. package/lib/util/player_configuration.js +19 -5
  40. package/lib/util/stream_utils.js +82 -13
  41. package/package.json +1 -1
  42. package/ui/audio_language_selection.js +3 -0
  43. package/ui/controls.js +60 -0
  44. package/ui/externs/ui.js +12 -1
  45. package/ui/hidden_fast_forward_button.js +32 -0
  46. package/ui/hidden_rewind_button.js +32 -0
  47. package/ui/hidden_seek_button.js +121 -0
  48. package/ui/less/buttons.less +50 -0
  49. package/ui/less/containers.less +18 -0
  50. package/ui/resolution_selection.js +2 -0
  51. package/ui/ui.js +2 -0
  52. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -75
  53. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -26
  54. package/.github/ISSUE_TEMPLATE/question.md +0 -26
  55. package/.github/config.yml +0 -1
  56. package/.github/workflows/appspot.yaml +0 -39
  57. package/.github/workflows/build-and-test.yaml +0 -222
  58. package/.github/workflows/compute-incremental-coverage.py +0 -265
  59. package/.github/workflows/custom-actions/prep-for-appspot/action.yaml +0 -56
  60. package/.github/workflows/custom-actions/set-commit-status/action.yaml +0 -37
  61. package/.github/workflows/deflake.yaml +0 -31
  62. package/.github/workflows/demo-version-index.yaml +0 -43
  63. package/.github/workflows/nightly-demo.yaml +0 -42
  64. package/.github/workflows/release-please.yaml +0 -193
  65. package/.github/workflows/report-incremental-coverage.yaml +0 -39
  66. package/.github/workflows/safari-homedir-launcher.sh +0 -18
  67. package/.github/workflows/selenium-lab-tests.yaml +0 -370
  68. package/.github/workflows/shaka-bot-commands/command-help.sh +0 -27
  69. package/.github/workflows/shaka-bot-commands/command-test.sh +0 -56
  70. package/.github/workflows/shaka-bot-commands/lib.sh +0 -83
  71. package/.github/workflows/shaka-bot-commands/main.sh +0 -51
  72. package/.github/workflows/sync-labels.yaml +0 -33
  73. package/.github/workflows/talk-to-shaka-bot.yaml +0 -29
  74. package/.github/workflows/update-issues.yaml +0 -31
  75. package/.github/workflows/update-screenshots.yaml +0 -142
  76. package/.github/workflows/validate-pr-title.yaml +0 -27
  77. package/CHANGELOG.md +0 -5774
  78. package/CODE_OF_CONDUCT.md +0 -93
  79. package/CONTRIBUTING.md +0 -76
  80. package/demo/TengwarTelcontar.woff2 +0 -0
  81. package/demo/app_logo_144.png +0 -0
  82. package/demo/app_logo_192.png +0 -0
  83. package/demo/app_logo_256.png +0 -0
  84. package/demo/app_logo_384.png +0 -0
  85. package/demo/app_logo_512.png +0 -0
  86. package/demo/app_manifest.json +0 -29
  87. package/demo/asset_card.js +0 -410
  88. package/demo/autoTemplate.txt +0 -61
  89. package/demo/cast_receiver/idle1.jpg +0 -0
  90. package/demo/cast_receiver/idle2.jpg +0 -0
  91. package/demo/cast_receiver/idle3.jpg +0 -0
  92. package/demo/cast_receiver/index.html +0 -75
  93. package/demo/cast_receiver/receiver_app.css +0 -111
  94. package/demo/cast_receiver/receiver_app.js +0 -158
  95. package/demo/close_button.js +0 -60
  96. package/demo/common/asset.js +0 -510
  97. package/demo/common/assets.js +0 -1634
  98. package/demo/config.js +0 -859
  99. package/demo/custom.js +0 -907
  100. package/demo/customWarning.txt +0 -8
  101. package/demo/demo.less +0 -591
  102. package/demo/demo_uncompiled.js +0 -11
  103. package/demo/demo_utils.js +0 -113
  104. package/demo/favicon.ico +0 -0
  105. package/demo/front.js +0 -156
  106. package/demo/icons/README.md +0 -4
  107. package/demo/icons/baseline-audiotrack-24px.svg +0 -1
  108. package/demo/icons/baseline-closed_caption-24px.svg +0 -1
  109. package/demo/icons/baseline-fast_forward-24px.svg +0 -1
  110. package/demo/icons/baseline-language-24px.svg +0 -1
  111. package/demo/icons/baseline-live_tv-24px.svg +0 -1
  112. package/demo/icons/baseline-subtitles-24px.svg +0 -1
  113. package/demo/icons/baseline-surround_sound-24px.svg +0 -1
  114. package/demo/icons/custom_ad.svg +0 -1
  115. package/demo/icons/custom_box_with_text.svg +0 -1
  116. package/demo/icons/custom_clear_key.svg +0 -1
  117. package/demo/icons/custom_high_definition.svg +0 -1
  118. package/demo/icons/custom_playready.svg +0 -1
  119. package/demo/icons/custom_ultra_high_definition.svg +0 -1
  120. package/demo/icons/custom_widevine.svg +0 -1
  121. package/demo/index.html +0 -173
  122. package/demo/input.js +0 -270
  123. package/demo/input_container.js +0 -218
  124. package/demo/load.js +0 -156
  125. package/demo/main.js +0 -1854
  126. package/demo/search.js +0 -452
  127. package/demo/service_worker.js +0 -355
  128. package/demo/shaka_logo_trans.png +0 -0
  129. package/demo/tooltip.js +0 -29
  130. package/demo/visualizer.js +0 -335
  131. package/demo/visualizer_button.js +0 -84
  132. package/dist/demo.compiled.debug.js +0 -340
  133. package/dist/demo.compiled.debug.map +0 -8
  134. package/dist/demo.compiled.js +0 -340
  135. package/dist/demo.compiled.map +0 -8
  136. package/dist/demo.css +0 -6
  137. package/dist/demo.css.map +0 -1
  138. package/dist/receiver.compiled.debug.js +0 -187
  139. package/dist/receiver.compiled.debug.map +0 -8
  140. package/dist/receiver.compiled.js +0 -187
  141. package/dist/receiver.compiled.map +0 -8
  142. package/docs/announcement-list-join-group.png +0 -0
  143. package/docs/api-mainpage.md +0 -28
  144. package/docs/design/REDESIGN.md +0 -283
  145. package/docs/design/architecture.md +0 -13
  146. package/docs/design/bg-fetch-after.gv +0 -29
  147. package/docs/design/bg-fetch-after.gv.png +0 -0
  148. package/docs/design/bg-fetch-before.gv +0 -18
  149. package/docs/design/bg-fetch-before.gv.png +0 -0
  150. package/docs/design/bg-fetch.md +0 -134
  151. package/docs/design/cast.gv +0 -35
  152. package/docs/design/cast.gv.png +0 -0
  153. package/docs/design/chromecast.md +0 -151
  154. package/docs/design/codec_preferences.md +0 -158
  155. package/docs/design/dash-audio-channels.md +0 -123
  156. package/docs/design/dash-manifests.md +0 -248
  157. package/docs/design/dash-timeline.svg +0 -4
  158. package/docs/design/dataflow.gv +0 -66
  159. package/docs/design/dataflow.gv.png +0 -0
  160. package/docs/design/export.md +0 -70
  161. package/docs/design/fuzzy-locale-matching.md +0 -40
  162. package/docs/design/gap-jumping.md +0 -151
  163. package/docs/design/lcevc-architecture.png +0 -0
  164. package/docs/design/lcevc-demo.png +0 -0
  165. package/docs/design/lcevc-integration.md +0 -72
  166. package/docs/design/locale_compatibility.svg +0 -1
  167. package/docs/design/locales_tree.svg +0 -1
  168. package/docs/design/localization-design-principles.md +0 -158
  169. package/docs/design/newdemo.gv +0 -83
  170. package/docs/design/newdemo.gv.png +0 -0
  171. package/docs/design/offline.gv +0 -43
  172. package/docs/design/offline.gv.png +0 -0
  173. package/docs/design/offline.md +0 -153
  174. package/docs/design/ownership.gv +0 -76
  175. package/docs/design/ownership.gv.png +0 -0
  176. package/docs/design/preload.md +0 -299
  177. package/docs/design/preload.png +0 -0
  178. package/docs/design/talking-about-languages.md +0 -46
  179. package/docs/design/timeline.svg +0 -152
  180. package/docs/design/ui.md +0 -31
  181. package/docs/design/ui_player_relationships.svg +0 -1
  182. package/docs/jsdoc-plugin.js +0 -74
  183. package/docs/jsdoc-template/README.md +0 -1
  184. package/docs/jsdoc-template/publish.js +0 -879
  185. package/docs/jsdoc-template/static/fonts/OpenSans-Bold-webfont.eot +0 -0
  186. package/docs/jsdoc-template/static/fonts/OpenSans-Bold-webfont.svg +0 -1830
  187. package/docs/jsdoc-template/static/fonts/OpenSans-Bold-webfont.woff +0 -0
  188. package/docs/jsdoc-template/static/fonts/OpenSans-BoldItalic-webfont.eot +0 -0
  189. package/docs/jsdoc-template/static/fonts/OpenSans-BoldItalic-webfont.svg +0 -1830
  190. package/docs/jsdoc-template/static/fonts/OpenSans-BoldItalic-webfont.woff +0 -0
  191. package/docs/jsdoc-template/static/fonts/OpenSans-Italic-webfont.eot +0 -0
  192. package/docs/jsdoc-template/static/fonts/OpenSans-Italic-webfont.svg +0 -1830
  193. package/docs/jsdoc-template/static/fonts/OpenSans-Italic-webfont.woff +0 -0
  194. package/docs/jsdoc-template/static/fonts/OpenSans-Light-webfont.eot +0 -0
  195. package/docs/jsdoc-template/static/fonts/OpenSans-Light-webfont.svg +0 -1831
  196. package/docs/jsdoc-template/static/fonts/OpenSans-Light-webfont.woff +0 -0
  197. package/docs/jsdoc-template/static/fonts/OpenSans-LightItalic-webfont.eot +0 -0
  198. package/docs/jsdoc-template/static/fonts/OpenSans-LightItalic-webfont.svg +0 -1835
  199. package/docs/jsdoc-template/static/fonts/OpenSans-LightItalic-webfont.woff +0 -0
  200. package/docs/jsdoc-template/static/fonts/OpenSans-Regular-webfont.eot +0 -0
  201. package/docs/jsdoc-template/static/fonts/OpenSans-Regular-webfont.svg +0 -1831
  202. package/docs/jsdoc-template/static/fonts/OpenSans-Regular-webfont.woff +0 -0
  203. package/docs/jsdoc-template/static/scripts/linenumber.js +0 -44
  204. package/docs/jsdoc-template/static/scripts/show-widget.js +0 -55
  205. package/docs/jsdoc-template/static/styles/jsdoc-default.css +0 -438
  206. package/docs/jsdoc-template/tmpl/augments.tmpl +0 -10
  207. package/docs/jsdoc-template/tmpl/container.tmpl +0 -205
  208. package/docs/jsdoc-template/tmpl/details.tmpl +0 -152
  209. package/docs/jsdoc-template/tmpl/example.tmpl +0 -2
  210. package/docs/jsdoc-template/tmpl/examples.tmpl +0 -13
  211. package/docs/jsdoc-template/tmpl/exceptions.tmpl +0 -32
  212. package/docs/jsdoc-template/tmpl/layout.tmpl +0 -50
  213. package/docs/jsdoc-template/tmpl/mainpage.tmpl +0 -14
  214. package/docs/jsdoc-template/tmpl/members.tmpl +0 -47
  215. package/docs/jsdoc-template/tmpl/method.tmpl +0 -140
  216. package/docs/jsdoc-template/tmpl/modifies.tmpl +0 -14
  217. package/docs/jsdoc-template/tmpl/params.tmpl +0 -131
  218. package/docs/jsdoc-template/tmpl/properties.tmpl +0 -125
  219. package/docs/jsdoc-template/tmpl/returns.tmpl +0 -19
  220. package/docs/jsdoc-template/tmpl/source.tmpl +0 -8
  221. package/docs/jsdoc-template/tmpl/tutorial.tmpl +0 -21
  222. package/docs/jsdoc-template/tmpl/type.tmpl +0 -7
  223. package/docs/jsdoc.conf.json +0 -38
  224. package/docs/shaka-player-logo.png +0 -0
  225. package/docs/style.md +0 -174
  226. package/docs/tutorials/a11y.md +0 -64
  227. package/docs/tutorials/ad_monetization.md +0 -292
  228. package/docs/tutorials/application-level-redirects.md +0 -94
  229. package/docs/tutorials/architecture.md +0 -32
  230. package/docs/tutorials/basic-usage.md +0 -89
  231. package/docs/tutorials/blob-url.md +0 -15
  232. package/docs/tutorials/config.md +0 -148
  233. package/docs/tutorials/debugging.md +0 -189
  234. package/docs/tutorials/drm-config.md +0 -274
  235. package/docs/tutorials/errors.md +0 -95
  236. package/docs/tutorials/fairplay.md +0 -242
  237. package/docs/tutorials/faq.md +0 -252
  238. package/docs/tutorials/index.json +0 -29
  239. package/docs/tutorials/lcevc.md +0 -118
  240. package/docs/tutorials/license-server-auth.md +0 -248
  241. package/docs/tutorials/license-wrapping.md +0 -168
  242. package/docs/tutorials/manifest-parser.md +0 -365
  243. package/docs/tutorials/network-and-buffering-config.md +0 -119
  244. package/docs/tutorials/offline.md +0 -683
  245. package/docs/tutorials/plugins.md +0 -184
  246. package/docs/tutorials/selenium-grid-config.md +0 -174
  247. package/docs/tutorials/service-worker.md +0 -106
  248. package/docs/tutorials/ui-customization.md +0 -288
  249. package/docs/tutorials/ui.md +0 -232
  250. package/docs/tutorials/upgrade-manifest.md +0 -281
  251. package/docs/tutorials/upgrade.md +0 -104
  252. package/docs/tutorials/welcome.md +0 -108
  253. package/docs/tutorials/widevine-service-certs.md +0 -45
  254. package/karma.conf.js +0 -879
  255. package/maintained-branches.md +0 -15
  256. package/roadmap.md +0 -186
  257. package/test/abr/simple_abr_manager_unit.js +0 -398
  258. package/test/ads/ad_manager_unit.js +0 -260
  259. package/test/assumptions/uint8_array_unit.js +0 -22
  260. package/test/cast/cast_proxy_unit.js +0 -736
  261. package/test/cast/cast_receiver_integration.js +0 -488
  262. package/test/cast/cast_receiver_unit.js +0 -1183
  263. package/test/cast/cast_sender_unit.js +0 -973
  264. package/test/cast/cast_utils_unit.js +0 -311
  265. package/test/cea/cea608_memory_unit.js +0 -411
  266. package/test/cea/cea708_service_unit.js +0 -674
  267. package/test/cea/cea708_window_unit.js +0 -373
  268. package/test/cea/cea_decoder_unit.js +0 -615
  269. package/test/cea/dtvcc_packet_builder_unit.js +0 -158
  270. package/test/cea/dtvcc_packet_unit.js +0 -60
  271. package/test/cea/mp4_cea_parser_unit.js +0 -127
  272. package/test/codec_switching/codec_switching_integration.js +0 -182
  273. package/test/dash/dash_parser_content_protection_unit.js +0 -998
  274. package/test/dash/dash_parser_integration.js +0 -74
  275. package/test/dash/dash_parser_live_unit.js +0 -1542
  276. package/test/dash/dash_parser_manifest_unit.js +0 -3121
  277. package/test/dash/dash_parser_segment_base_unit.js +0 -421
  278. package/test/dash/dash_parser_segment_list_unit.js +0 -380
  279. package/test/dash/dash_parser_segment_template_unit.js +0 -910
  280. package/test/dash/mpd_utils_unit.js +0 -794
  281. package/test/demo/demo_unit.js +0 -108
  282. package/test/deprecate/enforcer_unit.js +0 -74
  283. package/test/deprecate/version_unit.js +0 -57
  284. package/test/hls/hls_live_unit.js +0 -1330
  285. package/test/hls/hls_parser_unit.js +0 -5276
  286. package/test/hls/manifest_text_parser_unit.js +0 -545
  287. package/test/media/adaptation_set_criteria_unit.js +0 -806
  288. package/test/media/adaptation_set_unit.js +0 -229
  289. package/test/media/buffering_observer_unit.js +0 -143
  290. package/test/media/closed_caption_parser_unit.js +0 -18
  291. package/test/media/content_workarounds_unit.js +0 -43
  292. package/test/media/drm_engine_integration.js +0 -356
  293. package/test/media/drm_engine_unit.js +0 -2805
  294. package/test/media/media_source_engine_integration.js +0 -691
  295. package/test/media/media_source_engine_unit.js +0 -1512
  296. package/test/media/mp4_segment_index_parser_unit.js +0 -80
  297. package/test/media/play_rate_controller_unit.js +0 -69
  298. package/test/media/playhead_unit.js +0 -1394
  299. package/test/media/presentation_timeline_unit.js +0 -477
  300. package/test/media/quality_observer_unit.js +0 -138
  301. package/test/media/region_observer_unit.js +0 -374
  302. package/test/media/region_timeline_unit.js +0 -139
  303. package/test/media/segment_index_unit.js +0 -1080
  304. package/test/media/segment_prefetch_unit.js +0 -243
  305. package/test/media/segment_reference_unit.js +0 -63
  306. package/test/media/stall_detector_unit.js +0 -184
  307. package/test/media/streaming_engine_integration.js +0 -632
  308. package/test/media/streaming_engine_unit.js +0 -4211
  309. package/test/media/time_ranges_utils_unit.js +0 -123
  310. package/test/media/webm_segment_index_parser_unit.js +0 -90
  311. package/test/mss/mss_parser_content_protection_unit.js +0 -49
  312. package/test/mss/mss_parser_unit.js +0 -474
  313. package/test/mss/mss_player_integration.js +0 -124
  314. package/test/net/data_uri_plugin_unit.js +0 -105
  315. package/test/net/http_plugin_unit.js +0 -439
  316. package/test/net/networking_engine_unit.js +0 -1236
  317. package/test/net/networking_utils_unit.js +0 -37
  318. package/test/offline/download_progress_estimator_unit.js +0 -90
  319. package/test/offline/indexeddb_storage_unit.js +0 -192
  320. package/test/offline/manifest_convert_unit.js +0 -622
  321. package/test/offline/offline_integration.js +0 -168
  322. package/test/offline/offline_manifest_parser_unit.js +0 -231
  323. package/test/offline/offline_scheme_unit.js +0 -154
  324. package/test/offline/offline_uri_unit.js +0 -59
  325. package/test/offline/storage_compatibility_unit.js +0 -344
  326. package/test/offline/storage_integration.js +0 -1858
  327. package/test/player_external.js +0 -237
  328. package/test/player_integration.js +0 -1371
  329. package/test/player_load_graph_integration.js +0 -865
  330. package/test/player_src_equals_external.js +0 -154
  331. package/test/player_src_equals_integration.js +0 -527
  332. package/test/player_unit.js +0 -4434
  333. package/test/polyfill/media_capabilities_unit.js +0 -277
  334. package/test/polyfill/patchedmediakeys_apple_unit.js +0 -130
  335. package/test/test/assets/3675/chunk-stream0-00001.m4s +0 -0
  336. package/test/test/assets/3675/chunk-stream0-00002.m4s +0 -0
  337. package/test/test/assets/3675/chunk-stream0-00003.m4s +0 -0
  338. package/test/test/assets/3675/chunk-stream0-00004.m4s +0 -0
  339. package/test/test/assets/3675/chunk-stream0-00005.m4s +0 -0
  340. package/test/test/assets/3675/chunk-stream0-00006.m4s +0 -0
  341. package/test/test/assets/3675/chunk-stream0-00007.m4s +0 -0
  342. package/test/test/assets/3675/dash_0.mpd +0 -30
  343. package/test/test/assets/3675/dash_1.mpd +0 -30
  344. package/test/test/assets/3675/dash_2.mpd +0 -30
  345. package/test/test/assets/3675/dash_3.mpd +0 -30
  346. package/test/test/assets/3675/dash_4.mpd +0 -30
  347. package/test/test/assets/3675/dash_5.mpd +0 -26
  348. package/test/test/assets/3675/init-stream0.m4s +0 -0
  349. package/test/test/assets/audio-xhe-aac.mp4 +0 -0
  350. package/test/test/assets/audio.ts +0 -0
  351. package/test/test/assets/captions-test.ts +0 -0
  352. package/test/test/assets/cea-init.mp4 +0 -0
  353. package/test/test/assets/cea-segment.mp4 +0 -0
  354. package/test/test/assets/chapters.srt +0 -11
  355. package/test/test/assets/chapters.vtt +0 -10
  356. package/test/test/assets/chapters2.vtt +0 -10
  357. package/test/test/assets/dash-aes-128/Fragments(video=0,format=mpd-time-csf) +0 -0
  358. package/test/test/assets/dash-aes-128/Fragments(video=20000000,format=mpd-time-csf) +0 -0
  359. package/test/test/assets/dash-aes-128/Fragments(video=40000000,format=mpd-time-csf) +0 -0
  360. package/test/test/assets/dash-aes-128/Fragments(video=60000000,format=mpd-time-csf) +0 -0
  361. package/test/test/assets/dash-aes-128/Fragments(video=i,format=mpd-time-csf) +0 -0
  362. package/test/test/assets/dash-aes-128/dash.mpd +0 -18
  363. package/test/test/assets/dash-aes-128/license +0 -1
  364. package/test/test/assets/dash-multi-codec/audio_en_2c_128k_aac.mp4 +0 -0
  365. package/test/test/assets/dash-multi-codec/audio_es_2c_64k_opus.webm +0 -0
  366. package/test/test/assets/dash-multi-codec/dash.mpd +0 -32
  367. package/test/test/assets/dash-multi-codec/video_144p_108k_h264.mp4 +0 -0
  368. package/test/test/assets/db-dump-v1.json +0 -1
  369. package/test/test/assets/db-dump-v2-broken.json +0 -1
  370. package/test/test/assets/db-dump-v2-clean.json +0 -1
  371. package/test/test/assets/db-dump-v3.json +0 -1
  372. package/test/test/assets/db-dump-v4-broken.json +0 -1
  373. package/test/test/assets/db-dump-v5.json +0 -1
  374. package/test/test/assets/empty_caption_video_init.mp4 +0 -0
  375. package/test/test/assets/empty_caption_video_segment.mp4 +0 -0
  376. package/test/test/assets/encrypted-sintel-audio-init.mp4 +0 -0
  377. package/test/test/assets/encrypted-sintel-audio-segment.mp4 +0 -0
  378. package/test/test/assets/encrypted-sintel-video-init.mp4 +0 -0
  379. package/test/test/assets/encrypted-sintel-video-segment.mp4 +0 -0
  380. package/test/test/assets/green-pixel.mp4 +0 -0
  381. package/test/test/assets/green-pixel.txt +0 -15
  382. package/test/test/assets/h265-cea-init.mp4 +0 -0
  383. package/test/test/assets/h265-cea-segment.mp4 +0 -0
  384. package/test/test/assets/hls-raw-aac/fileSequence0.aac +0 -0
  385. package/test/test/assets/hls-raw-aac/fileSequence1.aac +0 -0
  386. package/test/test/assets/hls-raw-aac/fileSequence2.aac +0 -0
  387. package/test/test/assets/hls-raw-aac/fileSequence3.aac +0 -0
  388. package/test/test/assets/hls-raw-aac/manifest.m3u8 +0 -4
  389. package/test/test/assets/hls-raw-aac/stream.m4a.m3u8 +0 -14
  390. package/test/test/assets/hls-raw-ac3/fileSequence0.ac3 +0 -0
  391. package/test/test/assets/hls-raw-ac3/fileSequence1.ac3 +0 -0
  392. package/test/test/assets/hls-raw-ac3/fileSequence2.ac3 +0 -0
  393. package/test/test/assets/hls-raw-ac3/fileSequence3.ac3 +0 -0
  394. package/test/test/assets/hls-raw-ac3/fileSequence4.ac3 +0 -0
  395. package/test/test/assets/hls-raw-ac3/fileSequence5.ac3 +0 -0
  396. package/test/test/assets/hls-raw-ac3/fileSequence6.ac3 +0 -0
  397. package/test/test/assets/hls-raw-ac3/fileSequence7.ac3 +0 -0
  398. package/test/test/assets/hls-raw-ac3/prog_index.m3u8 +0 -31
  399. package/test/test/assets/hls-raw-ec3/fileSequence0.ec3 +0 -0
  400. package/test/test/assets/hls-raw-ec3/fileSequence1.ec3 +0 -0
  401. package/test/test/assets/hls-raw-ec3/fileSequence2.ec3 +0 -0
  402. package/test/test/assets/hls-raw-ec3/fileSequence3.ec3 +0 -0
  403. package/test/test/assets/hls-raw-ec3/fileSequence4.ec3 +0 -0
  404. package/test/test/assets/hls-raw-ec3/fileSequence5.ec3 +0 -0
  405. package/test/test/assets/hls-raw-ec3/fileSequence6.ec3 +0 -0
  406. package/test/test/assets/hls-raw-ec3/fileSequence7.ec3 +0 -0
  407. package/test/test/assets/hls-raw-ec3/prog_index.m3u8 +0 -31
  408. package/test/test/assets/hls-raw-mp3/chunklist_w905519204.m3u8 +0 -13
  409. package/test/test/assets/hls-raw-mp3/media_w905519204_0.mp3 +0 -0
  410. package/test/test/assets/hls-raw-mp3/media_w905519204_1.mp3 +0 -0
  411. package/test/test/assets/hls-raw-mp3/media_w905519204_2.mp3 +0 -0
  412. package/test/test/assets/hls-raw-mp3/media_w905519204_3.mp3 +0 -0
  413. package/test/test/assets/hls-raw-mp3/playlist.m3u8 +0 -4
  414. package/test/test/assets/hls-ts-aac/playlist.m3u8 +0 -23
  415. package/test/test/assets/hls-ts-aac/segment_0.ts +0 -0
  416. package/test/test/assets/hls-ts-aac/segment_1.ts +0 -0
  417. package/test/test/assets/hls-ts-aac/segment_2.ts +0 -0
  418. package/test/test/assets/hls-ts-aac/segment_3.ts +0 -0
  419. package/test/test/assets/hls-ts-aac/segment_4.ts +0 -0
  420. package/test/test/assets/hls-ts-aac/segment_5.ts +0 -0
  421. package/test/test/assets/hls-ts-aac/segment_6.ts +0 -0
  422. package/test/test/assets/hls-ts-aac/segment_7.ts +0 -0
  423. package/test/test/assets/hls-ts-ac3/ChID_voices_6ch_640kbps_dd_sub_0000.ts +0 -0
  424. package/test/test/assets/hls-ts-ac3/ChID_voices_6ch_640kbps_dd_sub_0001.ts +0 -0
  425. package/test/test/assets/hls-ts-ac3/ChID_voices_6ch_640kbps_dd_sub_0002.ts +0 -0
  426. package/test/test/assets/hls-ts-ac3/ChID_voices_6ch_640kbps_dd_sub_0003.ts +0 -0
  427. package/test/test/assets/hls-ts-ac3/ChID_voices_6ch_640kbps_dd_sub_0004.ts +0 -0
  428. package/test/test/assets/hls-ts-ac3/ChID_voices_6ch_640kbps_dd_sub_0005.ts +0 -0
  429. package/test/test/assets/hls-ts-ac3/prog_index.m3u8 +0 -19
  430. package/test/test/assets/hls-ts-ec3/ChID_voices_6ch_256kbps_ddp_sub_0000.ts +0 -0
  431. package/test/test/assets/hls-ts-ec3/ChID_voices_6ch_256kbps_ddp_sub_0001.ts +0 -0
  432. package/test/test/assets/hls-ts-ec3/ChID_voices_6ch_256kbps_ddp_sub_0002.ts +0 -0
  433. package/test/test/assets/hls-ts-ec3/ChID_voices_6ch_256kbps_ddp_sub_0003.ts +0 -0
  434. package/test/test/assets/hls-ts-ec3/ChID_voices_6ch_256kbps_ddp_sub_0004.ts +0 -0
  435. package/test/test/assets/hls-ts-ec3/ChID_voices_6ch_256kbps_ddp_sub_0005.ts +0 -0
  436. package/test/test/assets/hls-ts-ec3/prog_index.m3u8 +0 -19
  437. package/test/test/assets/hls-ts-h264/fileSequence0.ts +0 -0
  438. package/test/test/assets/hls-ts-h264/fileSequence1.ts +0 -0
  439. package/test/test/assets/hls-ts-h264/fileSequence2.ts +0 -0
  440. package/test/test/assets/hls-ts-h264/fileSequence3.ts +0 -0
  441. package/test/test/assets/hls-ts-h264/fileSequence4.ts +0 -0
  442. package/test/test/assets/hls-ts-h264/fileSequence5.ts +0 -0
  443. package/test/test/assets/hls-ts-h264/prog_index.m3u8 +0 -25
  444. package/test/test/assets/hls-ts-h265/0.ts +0 -0
  445. package/test/test/assets/hls-ts-h265/hevc.m3u8 +0 -6
  446. package/test/test/assets/hls-ts-h265/index.m3u8 +0 -7
  447. package/test/test/assets/hls-ts-mp3/manifest.m3u8 +0 -13
  448. package/test/test/assets/hls-ts-mp3/media_w239891843_0.ts +0 -0
  449. package/test/test/assets/hls-ts-mp3/media_w239891843_1.ts +0 -0
  450. package/test/test/assets/hls-ts-mp3/media_w239891843_2.ts +0 -0
  451. package/test/test/assets/hls-ts-mp3/media_w239891843_3.ts +0 -0
  452. package/test/test/assets/hls-ts-muxed-aac-h264/chunk.m3u8 +0 -17
  453. package/test/test/assets/hls-ts-muxed-aac-h264/n_0_0_0.ts +0 -0
  454. package/test/test/assets/hls-ts-muxed-aac-h264/n_1_0_0.ts +0 -0
  455. package/test/test/assets/hls-ts-muxed-aac-h264/n_2_0_0.ts +0 -0
  456. package/test/test/assets/hls-ts-muxed-aac-h264/n_3_0_0.ts +0 -0
  457. package/test/test/assets/hls-ts-muxed-aac-h264/n_4_0_0.ts +0 -0
  458. package/test/test/assets/hls-ts-muxed-aac-h264/n_5_0_0.ts +0 -0
  459. package/test/test/assets/hls-ts-muxed-aac-h264/playlist.m3u8 +0 -4
  460. package/test/test/assets/hls-ts-muxed-aac-h265/0.ts +0 -0
  461. package/test/test/assets/hls-ts-muxed-aac-h265/1.ts +0 -0
  462. package/test/test/assets/hls-ts-muxed-aac-h265/media.m3u8 +0 -9
  463. package/test/test/assets/hls-ts-muxed-ac3-h264/media.m3u8 +0 -24
  464. package/test/test/assets/hls-ts-muxed-ac3-h264/s_00000.ts +0 -0
  465. package/test/test/assets/hls-ts-muxed-ac3-h264/s_00001.ts +0 -0
  466. package/test/test/assets/hls-ts-muxed-ac3-h264/s_00002.ts +0 -0
  467. package/test/test/assets/hls-ts-muxed-ac3-h264/s_00003.ts +0 -0
  468. package/test/test/assets/hls-ts-muxed-ac3-h264/s_00004.ts +0 -0
  469. package/test/test/assets/hls-ts-muxed-ac3-h264/s_00005.ts +0 -0
  470. package/test/test/assets/hls-ts-muxed-ec3-h264/ChID_voices_1280x720p_25fps_h264_6ch_256kbps_ddp_sub_0000.ts +0 -0
  471. package/test/test/assets/hls-ts-muxed-ec3-h264/ChID_voices_1280x720p_25fps_h264_6ch_256kbps_ddp_sub_0001.ts +0 -0
  472. package/test/test/assets/hls-ts-muxed-ec3-h264/ChID_voices_1280x720p_25fps_h264_6ch_256kbps_ddp_sub_0002.ts +0 -0
  473. package/test/test/assets/hls-ts-muxed-ec3-h264/ChID_voices_1280x720p_25fps_h264_6ch_256kbps_ddp_sub_0003.ts +0 -0
  474. package/test/test/assets/hls-ts-muxed-ec3-h264/prog_index.m3u8 +0 -14
  475. package/test/test/assets/hls-ts-muxed-mp3-h264/index.m3u8 +0 -23
  476. package/test/test/assets/hls-ts-muxed-mp3-h264/seg-1-v1-a1.ts +0 -0
  477. package/test/test/assets/hls-ts-muxed-mp3-h264/seg-2-v1-a1.ts +0 -0
  478. package/test/test/assets/hls-ts-muxed-mp3-h264/seg-3-v1-a1.ts +0 -0
  479. package/test/test/assets/hls-ts-muxed-mp3-h264/seg-4-v1-a1.ts +0 -0
  480. package/test/test/assets/hls-ts-muxed-mp3-h264/seg-5-v1-a1.ts +0 -0
  481. package/test/test/assets/hls-ts-muxed-mp3-h264/seg-6-v1-a1.ts +0 -0
  482. package/test/test/assets/hls-ts-muxed-mp3-h264/seg-7-v1-a1.ts +0 -0
  483. package/test/test/assets/hls-ts-muxed-mp3-h264/seg-8-v1-a1.ts +0 -0
  484. package/test/test/assets/id3-metadata.aac +0 -0
  485. package/test/test/assets/id3-metadata.ts +0 -0
  486. package/test/test/assets/index-segment.mp4 +0 -0
  487. package/test/test/assets/index-segment.webm +0 -0
  488. package/test/test/assets/init-segment.webm +0 -0
  489. package/test/test/assets/large_file.mpd +0 -4930
  490. package/test/test/assets/multidrm-audio-init.mp4 +0 -0
  491. package/test/test/assets/multidrm-audio-segment.mp4 +0 -0
  492. package/test/test/assets/multidrm-video-init.mp4 +0 -0
  493. package/test/test/assets/multidrm-video-segment.mp4 +0 -0
  494. package/test/test/assets/multiple-trun-init.mp4 +0 -0
  495. package/test/test/assets/multiple-trun-segment.mp4 +0 -0
  496. package/test/test/assets/sintel-audio-init.mp4 +0 -0
  497. package/test/test/assets/sintel-audio-segment.mp4 +0 -0
  498. package/test/test/assets/sintel-video-init.mp4 +0 -0
  499. package/test/test/assets/sintel-video-segment.mp4 +0 -0
  500. package/test/test/assets/small.mp4 +0 -0
  501. package/test/test/assets/text-clip-alt.vtt +0 -63
  502. package/test/test/assets/text-clip.vtt +0 -63
  503. package/test/test/assets/thumbnails-sprites.vtt +0 -10
  504. package/test/test/assets/thumbnails.vtt +0 -10
  505. package/test/test/assets/ttml-init.mp4 +0 -0
  506. package/test/test/assets/ttml-segment-multiplemdat.mp4 +0 -0
  507. package/test/test/assets/ttml-segment.mp4 +0 -0
  508. package/test/test/assets/video.ts +0 -0
  509. package/test/test/assets/vtt-init.mp4 +0 -0
  510. package/test/test/assets/vtt-segment-multi-payload.mp4 +0 -0
  511. package/test/test/assets/vtt-segment-no-duration.mp4 +0 -0
  512. package/test/test/assets/vtt-segment-settings.mp4 +0 -0
  513. package/test/test/assets/vtt-segment.mp4 +0 -0
  514. package/test/test/boot.js +0 -495
  515. package/test/test/externs/filters.js +0 -44
  516. package/test/test/externs/fontfaceonload.js +0 -29
  517. package/test/test/externs/jasmine.js +0 -670
  518. package/test/test/externs/karma.js +0 -26
  519. package/test/test/externs/require.js +0 -21
  520. package/test/test/externs/sprintf.js +0 -18
  521. package/test/test/namespace.js +0 -10
  522. package/test/test/util/canned_idb.js +0 -379
  523. package/test/test/util/cea_utils.js +0 -60
  524. package/test/test/util/dash_parser_util.js +0 -329
  525. package/test/test/util/fake_ad.js +0 -321
  526. package/test/test/util/fake_ad_manager.js +0 -122
  527. package/test/test/util/fake_demo_main.js +0 -144
  528. package/test/test/util/fake_drm_engine.js +0 -103
  529. package/test/test/util/fake_media_source_engine.js +0 -464
  530. package/test/test/util/fake_networking_engine.js +0 -381
  531. package/test/test/util/fake_segment_prefetch.js +0 -84
  532. package/test/test/util/fake_text_displayer.js +0 -60
  533. package/test/test/util/id3_generator.js +0 -100
  534. package/test/test/util/indexeddb_utils.js +0 -124
  535. package/test/test/util/jasmine_fetch.js +0 -382
  536. package/test/test/util/layout_tests.js +0 -435
  537. package/test/test/util/loader.js +0 -88
  538. package/test/test/util/manifest_generator.js +0 -705
  539. package/test/test/util/manifest_parser_util.js +0 -101
  540. package/test/test/util/mss_parser_util.js +0 -119
  541. package/test/test/util/offline_utils.js +0 -105
  542. package/test/test/util/simple_fakes.js +0 -535
  543. package/test/test/util/stream_generator.js +0 -676
  544. package/test/test/util/streaming_engine_util.js +0 -506
  545. package/test/test/util/test_scheme.js +0 -778
  546. package/test/test/util/ttml_utils.js +0 -77
  547. package/test/test/util/ui_utils.js +0 -183
  548. package/test/test/util/util.js +0 -374
  549. package/test/test/util/waiter.js +0 -406
  550. package/test/text/cue_integration.js +0 -51
  551. package/test/text/lrc_text_parser_unit.js +0 -98
  552. package/test/text/mp4_ttml_parser_unit.js +0 -171
  553. package/test/text/mp4_vtt_parser_unit.js +0 -195
  554. package/test/text/sbv_text_parser_unit.js +0 -81
  555. package/test/text/simple_text_displayer_unit.js +0 -468
  556. package/test/text/srt_text_parser_unit.js +0 -163
  557. package/test/text/ssa_text_parser_unit.js +0 -382
  558. package/test/text/text_displayer_layout_unit.js +0 -323
  559. package/test/text/text_engine_unit.js +0 -500
  560. package/test/text/text_track_integration.js +0 -186
  561. package/test/text/ttml_text_parser_unit.js +0 -2176
  562. package/test/text/ui_text_displayer_unit.js +0 -608
  563. package/test/text/vtt_text_parser_unit.js +0 -1363
  564. package/test/text/web_vtt_generator_unit.js +0 -144
  565. package/test/text/web_vtt_layout_integration.js +0 -524
  566. package/test/transmuxer/transmuxer_engine_integration.js +0 -69
  567. package/test/transmuxer/transmuxer_integration.js +0 -443
  568. package/test/ui/ad_ui_unit.js +0 -369
  569. package/test/ui/localization_unit.js +0 -508
  570. package/test/ui/ui_customization_unit.js +0 -208
  571. package/test/ui/ui_integration.js +0 -669
  572. package/test/ui/ui_unit.js +0 -902
  573. package/test/util/abortable_operation_unit.js +0 -624
  574. package/test/util/array_utils_unit.js +0 -58
  575. package/test/util/buffer_utils_unit.js +0 -185
  576. package/test/util/cmcd_manager_unit.js +0 -440
  577. package/test/util/content_steering_manager_unit.js +0 -427
  578. package/test/util/data_view_reader_unit.js +0 -254
  579. package/test/util/ebml_parser_unit.js +0 -297
  580. package/test/util/event_manager_unit.js +0 -185
  581. package/test/util/fake_event_target_unit.js +0 -123
  582. package/test/util/id3_utils_unit.js +0 -168
  583. package/test/util/iterables_unit.js +0 -68
  584. package/test/util/language_utils_unit.js +0 -240
  585. package/test/util/manifest_parser_utils_unit.js +0 -55
  586. package/test/util/mime_utils_unit.js +0 -64
  587. package/test/util/mp4_box_parsers_unit.js +0 -246
  588. package/test/util/mp4_parser_unit.js +0 -373
  589. package/test/util/multi_map_unit.js +0 -94
  590. package/test/util/object_utils_unit.js +0 -79
  591. package/test/util/periods_unit.js +0 -1623
  592. package/test/util/pssh_unit.js +0 -226
  593. package/test/util/state_history_unit.js +0 -101
  594. package/test/util/stream_utils_unit.js +0 -1068
  595. package/test/util/string_utils_unit.js +0 -166
  596. package/test/util/text_parser_unit.js +0 -165
  597. package/test/util/ts_parser_unit.js +0 -77
  598. package/test/util/xml_utils_unit.js +0 -444
@@ -1,1623 +0,0 @@
1
- /*! @license
2
- * Shaka Player
3
- * Copyright 2016 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
-
7
- describe('PeriodCombiner', () => {
8
- // These test cases don't really read well as "it" statements. Phrasing them
9
- // that way would make the names very long, so here we break with that
10
- // convention.
11
-
12
- /** @type {shaka.util.PeriodCombiner} */
13
- let combiner;
14
-
15
- const makeAudioStreamWithRoles = (id, roles, primary = true) => {
16
- const stream = makeAudioStream('en');
17
- stream.originalId = id;
18
- stream.roles = roles;
19
- stream.primary = primary;
20
- return stream;
21
- };
22
-
23
- beforeEach(() => {
24
- combiner = new shaka.util.PeriodCombiner();
25
- });
26
-
27
- afterEach(() => {
28
- combiner.release();
29
- });
30
-
31
- it('Ad insertion - join during main content', async () => {
32
- /** @type {!Array.<shaka.extern.Period>} */
33
- const periods = [
34
- {
35
- id: 'main',
36
- videoStreams: [
37
- makeVideoStream(1080),
38
- makeVideoStream(720),
39
- makeVideoStream(480),
40
- ],
41
- audioStreams: [
42
- makeAudioStream('en', /* channels= */ 6),
43
- makeAudioStream('en', /* channels= */ 2),
44
- ],
45
- textStreams: [],
46
- imageStreams: [],
47
- },
48
- {
49
- id: 'ad',
50
- videoStreams: [
51
- makeVideoStream(480),
52
- ],
53
- audioStreams: [
54
- makeAudioStream('en', /* channels= */ 2),
55
- ],
56
- textStreams: [],
57
- imageStreams: [],
58
- },
59
- ];
60
-
61
- // Start with the first period only.
62
- await combiner.combinePeriods(periods.slice(0, 1), /* isDynamic= */ true);
63
- expect(combiner.getVariants()).toEqual(jasmine.arrayWithExactContents([
64
- makeAVVariant(1080, 'en', /* channels= */ 6),
65
- makeAVVariant(1080, 'en', /* channels= */ 2),
66
- makeAVVariant(720, 'en', /* channels= */ 6),
67
- makeAVVariant(720, 'en', /* channels= */ 2),
68
- makeAVVariant(480, 'en', /* channels= */ 6),
69
- makeAVVariant(480, 'en', /* channels= */ 2),
70
- ]));
71
-
72
- // Add the second period.
73
- await combiner.combinePeriods(periods, /* isDynamic= */ true);
74
- const variants = combiner.getVariants();
75
- expect(variants).toEqual(jasmine.arrayWithExactContents([
76
- makeAVVariant(1080, 'en', /* channels= */ 6),
77
- makeAVVariant(1080, 'en', /* channels= */ 2),
78
- makeAVVariant(720, 'en', /* channels= */ 6),
79
- makeAVVariant(720, 'en', /* channels= */ 2),
80
- makeAVVariant(480, 'en', /* channels= */ 6),
81
- makeAVVariant(480, 'en', /* channels= */ 2),
82
- ]));
83
-
84
- const h1080Surround = variants.find(
85
- (v) => v.video.height == 1080 && v.audio.channelsCount == 6);
86
- const h720Surround = variants.find(
87
- (v) => v.video.height == 720 && v.audio.channelsCount == 6);
88
- const h480Surround = variants.find(
89
- (v) => v.video.height == 480 && v.audio.channelsCount == 6);
90
-
91
- const h1080Stereo = variants.find(
92
- (v) => v.video.height == 1080 && v.audio.channelsCount == 2);
93
- const h720Stereo = variants.find(
94
- (v) => v.video.height == 720 && v.audio.channelsCount == 2);
95
- const h480Stereo = variants.find(
96
- (v) => v.video.height == 480 && v.audio.channelsCount == 2);
97
-
98
- // We can use the originalId field to see what each track is composed of.
99
- expect(h1080Surround.video.originalId).toBe('1080,480');
100
- expect(h1080Surround.audio.originalId).toBe('en-6c,en');
101
- expect(h720Surround.video.originalId).toBe('720,480');
102
- expect(h720Surround.audio.originalId).toBe('en-6c,en');
103
- expect(h480Surround.video.originalId).toBe('480,480');
104
- expect(h480Surround.audio.originalId).toBe('en-6c,en');
105
-
106
- expect(h1080Stereo.video.originalId).toBe('1080,480');
107
- expect(h1080Stereo.audio.originalId).toBe('en,en');
108
- expect(h720Stereo.video.originalId).toBe('720,480');
109
- expect(h720Stereo.audio.originalId).toBe('en,en');
110
- expect(h480Stereo.video.originalId).toBe('480,480');
111
- expect(h480Stereo.audio.originalId).toBe('en,en');
112
- });
113
-
114
- it('Ad insertion - join during ad', async () => {
115
- /** @type {!Array.<shaka.extern.Period>} */
116
- const periods = [
117
- {
118
- id: 'ad',
119
- videoStreams: [
120
- makeVideoStream(480),
121
- ],
122
- audioStreams: [
123
- makeAudioStream('en', /* channels= */ 2),
124
- ],
125
- textStreams: [],
126
- imageStreams: [],
127
- },
128
- {
129
- id: 'main',
130
- videoStreams: [
131
- makeVideoStream(1080),
132
- makeVideoStream(480),
133
- makeVideoStream(720),
134
- ],
135
- audioStreams: [
136
- makeAudioStream('en', /* channels= */ 6),
137
- makeAudioStream('en', /* channels= */ 2),
138
- ],
139
- textStreams: [],
140
- imageStreams: [],
141
- },
142
- ];
143
-
144
- // Start with the first period only.
145
- await combiner.combinePeriods(periods.slice(0, 1), /* isDynamic= */ true);
146
- expect(combiner.getVariants()).toEqual(jasmine.arrayWithExactContents([
147
- makeAVVariant(480, 'en', /* channels= */ 2),
148
- ]));
149
-
150
- // Add the second period.
151
- await combiner.combinePeriods(periods, /* isDynamic= */ true);
152
- const variants = combiner.getVariants();
153
- expect(variants).toEqual(jasmine.arrayWithExactContents([
154
- makeAVVariant(1080, 'en', /* channels= */ 6),
155
- makeAVVariant(1080, 'en', /* channels= */ 2),
156
- makeAVVariant(720, 'en', /* channels= */ 6),
157
- makeAVVariant(720, 'en', /* channels= */ 2),
158
- makeAVVariant(480, 'en', /* channels= */ 6),
159
- makeAVVariant(480, 'en', /* channels= */ 2),
160
- ]));
161
-
162
- const h1080Surround = variants.find(
163
- (v) => v.video.height == 1080 && v.audio.channelsCount == 6);
164
- const h720Surround = variants.find(
165
- (v) => v.video.height == 720 && v.audio.channelsCount == 6);
166
- const h480Surround = variants.find(
167
- (v) => v.video.height == 480 && v.audio.channelsCount == 6);
168
-
169
- const h1080Stereo = variants.find(
170
- (v) => v.video.height == 1080 && v.audio.channelsCount == 2);
171
- const h720Stereo = variants.find(
172
- (v) => v.video.height == 720 && v.audio.channelsCount == 2);
173
- const h480Stereo = variants.find(
174
- (v) => v.video.height == 480 && v.audio.channelsCount == 2);
175
-
176
- // We can use the originalId field to see what each track is composed of.
177
- expect(h1080Surround.video.originalId).toBe('480,1080');
178
- expect(h1080Surround.audio.originalId).toBe('en,en-6c');
179
- expect(h720Surround.video.originalId).toBe('480,720');
180
- expect(h720Surround.audio.originalId).toBe('en,en-6c');
181
- expect(h480Surround.video.originalId).toBe('480,480');
182
- expect(h480Surround.audio.originalId).toBe('en,en-6c');
183
-
184
- expect(h1080Stereo.video.originalId).toBe('480,1080');
185
- expect(h1080Stereo.audio.originalId).toBe('en,en');
186
- expect(h720Stereo.video.originalId).toBe('480,720');
187
- expect(h720Stereo.audio.originalId).toBe('en,en');
188
- expect(h480Stereo.video.originalId).toBe('480,480');
189
- expect(h480Stereo.audio.originalId).toBe('en,en');
190
- });
191
-
192
- it('Ad insertion - smaller ad, res not found in main content', async () => {
193
- /** @type {!Array.<shaka.extern.Period>} */
194
- const periods = [
195
- {
196
- id: '1',
197
- videoStreams: [
198
- makeVideoStream(1080),
199
- makeVideoStream(720),
200
- ],
201
- audioStreams: [
202
- makeAudioStream('en'),
203
- ],
204
- textStreams: [],
205
- imageStreams: [],
206
- },
207
- {
208
- id: '2',
209
- videoStreams: [
210
- makeVideoStream(480),
211
- ],
212
- audioStreams: [
213
- makeAudioStream('en'),
214
- ],
215
- textStreams: [],
216
- imageStreams: [],
217
- },
218
- ];
219
-
220
- // Start with the first period only.
221
- await combiner.combinePeriods(periods.slice(0, 1), /* isDynamic= */ true);
222
- expect(combiner.getVariants()).toEqual(jasmine.arrayWithExactContents([
223
- makeAVVariant(1080, 'en'),
224
- makeAVVariant(720, 'en'),
225
- ]));
226
-
227
- // Add the second period.
228
- await combiner.combinePeriods(periods, /* isDynamic= */ true);
229
- const variants = combiner.getVariants();
230
- expect(variants).toEqual(jasmine.arrayWithExactContents([
231
- makeAVVariant(1080, 'en'),
232
- makeAVVariant(720, 'en'),
233
- ]));
234
-
235
- // We can use the originalId field to see what each track is composed of.
236
- const h1080 = variants.find((v) => v.video.height == 1080);
237
- const h720 = variants.find((v) => v.video.height == 720);
238
- expect(h1080.video.originalId).toBe('1080,480');
239
- expect(h720.video.originalId).toBe('720,480');
240
- });
241
-
242
- it('Ad insertion - larger ad, res not found in main content', async () => {
243
- /** @type {!Array.<shaka.extern.Period>} */
244
- const periods = [
245
- {
246
- id: '1',
247
- videoStreams: [
248
- makeVideoStream(720),
249
- makeVideoStream(480),
250
- ],
251
- audioStreams: [
252
- makeAudioStream('en'),
253
- ],
254
- textStreams: [],
255
- imageStreams: [],
256
- },
257
- {
258
- id: '2',
259
- videoStreams: [
260
- makeVideoStream(1080),
261
- ],
262
- audioStreams: [
263
- makeAudioStream('en'),
264
- ],
265
- textStreams: [],
266
- imageStreams: [],
267
- },
268
- ];
269
-
270
- // Start with the first period only.
271
- await combiner.combinePeriods(periods.slice(0, 1), /* isDynamic= */ true);
272
- expect(combiner.getVariants()).toEqual(jasmine.arrayWithExactContents([
273
- makeAVVariant(720, 'en'),
274
- makeAVVariant(480, 'en'),
275
- ]));
276
-
277
- // Add the second period.
278
- await combiner.combinePeriods(periods, /* isDynamic= */ true);
279
- const variants = combiner.getVariants();
280
- expect(variants.length).toBe(2);
281
-
282
- // We can use the originalId field to see what each track is composed of.
283
- const originalIds = variants.map((v) => v.video.originalId);
284
- expect(originalIds).toEqual(jasmine.arrayWithExactContents([
285
- '720,1080',
286
- '480,1080',
287
- ]));
288
- });
289
-
290
- it('Language changes during and after an ad', async () => {
291
- /** @type {!Array.<shaka.extern.Period>} */
292
- const periods = [
293
- {
294
- id: 'show1',
295
- videoStreams: [
296
- makeVideoStream(1080),
297
- makeVideoStream(480),
298
- ],
299
- audioStreams: [
300
- makeAudioStream('es', /* channels= */ 2, /* primary= */ true),
301
- makeAudioStream('fr', /* channels= */ 2, /* primary= */ false),
302
- ],
303
- textStreams: [],
304
- imageStreams: [],
305
- },
306
- {
307
- id: 'ad',
308
- videoStreams: [
309
- makeVideoStream(480),
310
- ],
311
- audioStreams: [
312
- makeAudioStream('en'),
313
- ],
314
- textStreams: [],
315
- imageStreams: [],
316
- },
317
- {
318
- id: 'show2',
319
- videoStreams: [
320
- makeVideoStream(1080),
321
- makeVideoStream(480),
322
- ],
323
- audioStreams: [
324
- makeAudioStream('es', /* channels= */ 2, /* primary= */ false),
325
- makeAudioStream('fr', /* channels= */ 2, /* primary= */ true),
326
- ],
327
- textStreams: [],
328
- imageStreams: [],
329
- },
330
- ];
331
-
332
- await combiner.combinePeriods(periods, /* isDynamic= */ false);
333
- const variants = combiner.getVariants();
334
- expect(variants).toEqual(jasmine.arrayWithExactContents([
335
- makeAVVariant(1080, 'es'),
336
- makeAVVariant(480, 'es'),
337
- makeAVVariant(1080, 'en'),
338
- makeAVVariant(480, 'en'),
339
- makeAVVariant(1080, 'fr'),
340
- makeAVVariant(480, 'fr'),
341
- ]));
342
-
343
- // We can use the originalId field to see what each track is composed of.
344
-
345
- // The Spanish track is primary in the first period and has English 480p in
346
- // the middle period.
347
- const spanish = variants.find(
348
- (v) => v.video.height == 1080 && v.language == 'es');
349
- expect(spanish.audio.originalId).toBe('es*,en,es');
350
- expect(spanish.audio.originalLanguage).toBe('es');
351
- expect(spanish.video.originalId).toBe('1080,480,1080');
352
-
353
- // The French track is primary in the last period and has English 480p in
354
- // the middle period.
355
- const french = variants.find(
356
- (v) => v.video.height == 1080 && v.language == 'fr');
357
- expect(french.audio.originalId).toBe('fr,en,fr*');
358
- expect(french.audio.originalLanguage).toBe('fr');
359
- expect(french.video.originalId).toBe('1080,480,1080');
360
-
361
- // Because there's no English in the first or last periods, the English
362
- // track follows the "primary" language in those periods.
363
- const english = variants.find(
364
- (v) => v.video.height == 1080 && v.language == 'en');
365
- expect(english.audio.originalId).toBe('es*,en,fr*');
366
- expect(english.audio.originalLanguage).toBe('en');
367
- expect(english.video.originalId).toBe('1080,480,1080');
368
- });
369
-
370
- it('VOD playlist of completely unrelated periods', async () => {
371
- /** @type {!Array.<shaka.extern.Period>} */
372
- const periods = [
373
- {
374
- id: 'show1',
375
- videoStreams: [
376
- makeVideoStream(1080),
377
- ],
378
- audioStreams: [
379
- makeAudioStream('es'),
380
- ],
381
- textStreams: [],
382
- imageStreams: [],
383
- },
384
- {
385
- id: 'show2',
386
- videoStreams: [
387
- makeVideoStream(1080),
388
- ],
389
- audioStreams: [
390
- makeAudioStream('en'),
391
- ],
392
- textStreams: [],
393
- imageStreams: [],
394
- },
395
- ];
396
-
397
- await combiner.combinePeriods(periods, /* isDynamic= */ false);
398
- const variants = combiner.getVariants();
399
- expect(variants).toEqual(jasmine.arrayWithExactContents([
400
- makeAVVariant(1080, 'es'),
401
- makeAVVariant(1080, 'en'),
402
- ]));
403
-
404
- // We can use the originalId field to see what each track is composed of.
405
-
406
- // Both tracks are composed of the same things.
407
- const spanish = variants.find(
408
- (v) => v.video.height == 1080 && v.language == 'es');
409
- const english = variants.find(
410
- (v) => v.video.height == 1080 && v.language == 'en');
411
- expect(spanish.audio.originalId).toBe('es,en');
412
- expect(spanish.audio.originalLanguage).toBe('es');
413
- expect(english.audio.originalId).toBe('es,en');
414
- expect(english.audio.originalLanguage).toBe('en');
415
- });
416
-
417
- it('Multiple representations of the same resolution', async () => {
418
- /** @type {shaka.extern.Stream} */
419
- const video1 = makeVideoStream(480);
420
- video1.bandwidth = 1;
421
- /** @type {shaka.extern.Stream} */
422
- const video2 = makeVideoStream(480);
423
- video2.bandwidth = 2;
424
- /** @type {!Array.<shaka.extern.Period>} */
425
- const periods = [
426
- {
427
- id: '1',
428
- videoStreams: [
429
- video1,
430
- video2,
431
- ],
432
- audioStreams: [
433
- makeAudioStream('en'),
434
- ],
435
- textStreams: [],
436
- imageStreams: [],
437
- },
438
- ];
439
-
440
- await combiner.combinePeriods(periods, /* isDynamic= */ true);
441
- const variants = combiner.getVariants();
442
- expect(variants).toEqual(jasmine.arrayWithExactContents([
443
- makeAVVariant(480, 'en', /* channels= */ 2),
444
- makeAVVariant(480, 'en', /* channels= */ 2),
445
- ]));
446
-
447
- const lowBandwidth = variants.find(
448
- (v) => v.video.height == 480 && v.bandwidth == 1);
449
- const highBandwidth = variants.find(
450
- (v) => v.video.height == 480 && v.bandwidth == 2);
451
- expect(lowBandwidth.video.originalId).toBe('480');
452
- expect(highBandwidth.video.originalId).toBe('480');
453
- });
454
-
455
- it('Filters out duplicate streams', async () => {
456
- // v1 and v3 are duplicates
457
- const v1 = makeVideoStream(1280);
458
- v1.frameRate = 30000/1001;
459
- v1.originalId = 'v1';
460
- v1.bandwidth = 6200000;
461
-
462
- const v2 = makeVideoStream(1920);
463
- v2.frameRate = 30000/1001;
464
- v2.originalId = 'v2';
465
- v2.bandwidth = 8000000;
466
-
467
- const v3 = makeVideoStream(1280);
468
- v3.frameRate = 30000/1001;
469
- v3.originalId = 'v3';
470
- v3.bandwidth = 6200000;
471
-
472
- // a1 and a2 are duplicates.
473
- const a1 = makeAudioStream('en', /* channels= */ 2);
474
- a1.originalId = 'a1';
475
- a1.bandwidth = 65106;
476
- a1.roles = ['role1', 'role2'];
477
- a1.codecs = 'mp4a.40.2';
478
-
479
- const a2 = makeAudioStream('en', /* channels= */ 2);
480
- a2.originalId = 'a2';
481
- a2.bandwidth = 65106;
482
- a2.roles = ['role1', 'role2'];
483
- a2.codecs = 'mp4a.40.2';
484
-
485
- const a3 = makeAudioStream('en', /* channels= */ 2);
486
- a3.originalId = 'a3';
487
- a3.bandwidth = 97065;
488
- a3.roles = ['role1', 'role2'];
489
- a3.codecs = 'mp4a.40.2';
490
-
491
- // a4 has a different label from a3, and should not
492
- // be filtered out.
493
- const a4 = makeAudioStream('en', /* channels= */ 2);
494
- a4.originalId = 'a4';
495
- a4.bandwidth = 97065;
496
- a4.roles = ['role1', 'role2'];
497
- a4.label = 'Surround';
498
- a4.codecs = 'mp4a.40.2';
499
-
500
- // a5 has a different codec from a3, and should not
501
- // be filtered out.
502
- const a5 = makeAudioStream('en', /* channels= */ 2);
503
- a5.originalId = 'a5';
504
- a5.bandwidth = 97065;
505
- a5.roles = ['role1', 'role2'];
506
- a5.codecs = 'ec-3';
507
-
508
- // t1 and t3 are duplicates.
509
- const t1 = makeTextStream('en');
510
- t1.originalId = 't1';
511
- t1.roles = ['role1'];
512
- t1.bandwidth = 1158;
513
-
514
- const t2 = makeTextStream('en');
515
- t2.originalId = 't2';
516
- t2.roles = ['role1', 'role2'];
517
- t2.bandwidth = 1172;
518
-
519
- const t3 = makeTextStream('en');
520
- t3.originalId = 't3';
521
- t3.roles = ['role1'];
522
- t3.bandwidth = 1158;
523
-
524
- // t4 has a different bandwidth from t3, and should not
525
- // be filtered out.
526
- const t4 = makeTextStream('en');
527
- t4.originalId = 't4';
528
- t4.roles = ['role1'];
529
- t4.bandwidth = 1186;
530
-
531
- // i1 and i3 are duplicates.
532
- const i1 = makeImageStream(240);
533
- i1.originalId = 'i1';
534
-
535
- const i2 = makeImageStream(480);
536
- i2.originalId = 'i2';
537
-
538
- const i3 = makeImageStream(240);
539
- i3.originalId = 'i3';
540
-
541
- /** @type {!Array.<shaka.extern.Period>} */
542
- const periods = [
543
- {
544
- id: '1',
545
- videoStreams: [
546
- v1,
547
- v2,
548
- v3,
549
- ],
550
- audioStreams: [
551
- a1,
552
- a2,
553
- a3,
554
- a4,
555
- a5,
556
- ],
557
- textStreams: [
558
- t1,
559
- t2,
560
- t3,
561
- t4,
562
- ],
563
- imageStreams: [
564
- i1,
565
- i2,
566
- i3,
567
- ],
568
- },
569
- ];
570
-
571
- await combiner.combinePeriods(periods, /* isDynamic= */ true);
572
- const variants = combiner.getVariants();
573
- expect(variants.length).toBe(8);
574
-
575
- // v3 should've been filtered out
576
- const videoIds = variants.map((v) => v.video.originalId);
577
- for (const id of videoIds) {
578
- expect(id).not.toBe('v3');
579
- }
580
-
581
- // a2 should've been filtered out
582
- const audioIds = variants.map((v) => v.audio.originalId);
583
- for (const id of audioIds) {
584
- expect(id).not.toBe('a2');
585
- }
586
-
587
- const textStreams = combiner.getTextStreams();
588
- expect(textStreams.length).toBe(3);
589
-
590
- // t3 should've been filtered out
591
- const textIds = textStreams.map((t) => t.originalId);
592
- for (const id of textIds) {
593
- expect(id).not.toBe('t3');
594
- }
595
-
596
- const imageStreams = combiner.getImageStreams();
597
- expect(imageStreams.length).toBe(2);
598
-
599
- // i3 should've been filtered out
600
- const imageIds = imageStreams.map((i) => i.originalId);
601
- for (const id of imageIds) {
602
- expect(id).not.toBe('i3');
603
- }
604
- });
605
-
606
- // Regression test for #3383, where we failed on multi-period content with
607
- // multiple image streams per period.
608
- it('Can handle multiple image streams', async () => {
609
- /** @type {!Array.<shaka.extern.Period>} */
610
- const periods = [
611
- {
612
- id: '1',
613
- videoStreams: [
614
- makeVideoStream(1280),
615
- ],
616
- audioStreams: [],
617
- textStreams: [],
618
- imageStreams: [
619
- makeImageStream(240),
620
- makeImageStream(480),
621
- ],
622
- },
623
- {
624
- id: '2',
625
- videoStreams: [
626
- makeVideoStream(1280),
627
- ],
628
- audioStreams: [],
629
- textStreams: [],
630
- imageStreams: [
631
- makeImageStream(240),
632
- makeImageStream(480),
633
- ],
634
- },
635
- ];
636
-
637
- await combiner.combinePeriods(periods, /* isDynamic= */ true);
638
-
639
- const imageStreams = combiner.getImageStreams();
640
- expect(imageStreams.length).toBe(2);
641
-
642
- const imageIds = imageStreams.map((i) => i.originalId);
643
- expect(imageIds).toEqual([
644
- '240,240',
645
- '480,480',
646
- ]);
647
- });
648
-
649
- it('handles text track gaps', async () => {
650
- /** @type {!Array.<shaka.extern.Period>} */
651
- const periods = [
652
- {
653
- id: '1',
654
- videoStreams: [
655
- makeVideoStream(1080),
656
- ],
657
- audioStreams: [
658
- makeAudioStream('en'),
659
- ],
660
- textStreams: [
661
- makeTextStream('en'),
662
- ],
663
- imageStreams: [],
664
- },
665
- {
666
- id: '2',
667
- videoStreams: [
668
- makeVideoStream(1080),
669
- ],
670
- audioStreams: [
671
- makeAudioStream('en'),
672
- ],
673
- textStreams: [
674
- /* No text streams */
675
- ],
676
- imageStreams: [],
677
- },
678
- {
679
- id: '3',
680
- videoStreams: [
681
- makeVideoStream(1080),
682
- ],
683
- audioStreams: [
684
- makeAudioStream('en'),
685
- ],
686
- textStreams: [
687
- makeTextStream('en'),
688
- makeTextStream('spa'),
689
- ],
690
- imageStreams: [],
691
- },
692
- ];
693
-
694
- await combiner.combinePeriods(periods, /* isDynamic= */ false);
695
- const textStreams = combiner.getTextStreams();
696
- expect(textStreams).toEqual(jasmine.arrayWithExactContents([
697
- jasmine.objectContaining({
698
- language: 'es',
699
- }),
700
- jasmine.objectContaining({
701
- language: 'en',
702
- }),
703
- ]));
704
-
705
- // We can use the originalId field to see what each track is composed of.
706
-
707
- // Both tracks are composed of the same things.
708
- const spanish = textStreams.find((s) => s.language == 'es');
709
- const english = textStreams.find((s) => s.language == 'en');
710
- expect(spanish.originalId).toBe(',,es');
711
- expect(spanish.originalLanguage).toBe('spa');
712
- expect(english.originalId).toBe('en,,en');
713
- expect(english.originalLanguage).toBe('en');
714
- });
715
-
716
- it('handles image track gaps', async () => {
717
- /** @type {!Array.<shaka.extern.Period>} */
718
- const periods = [
719
- {
720
- id: '1',
721
- videoStreams: [
722
- makeVideoStream(1080),
723
- ],
724
- audioStreams: [
725
- makeAudioStream('en'),
726
- ],
727
- textStreams: [],
728
- imageStreams: [
729
- makeImageStream(240),
730
- ],
731
- },
732
- {
733
- id: '2',
734
- videoStreams: [
735
- makeVideoStream(1080),
736
- ],
737
- audioStreams: [
738
- makeAudioStream('en'),
739
- ],
740
- textStreams: [],
741
- imageStreams: [
742
- /* No image streams in this period */
743
- ],
744
- },
745
- {
746
- id: '3',
747
- videoStreams: [
748
- makeVideoStream(1080),
749
- ],
750
- audioStreams: [
751
- makeAudioStream('en'),
752
- ],
753
- textStreams: [],
754
- imageStreams: [
755
- makeImageStream(240),
756
- makeImageStream(480),
757
- ],
758
- },
759
- ];
760
-
761
- await combiner.combinePeriods(periods, /* isDynamic= */ false);
762
- const imageStreams = combiner.getImageStreams();
763
- expect(imageStreams).toEqual(jasmine.arrayWithExactContents([
764
- jasmine.objectContaining({
765
- height: 240,
766
- }),
767
- jasmine.objectContaining({
768
- height: 480,
769
- }),
770
- ]));
771
-
772
- // We can use the originalId field to see what each track is composed of.
773
-
774
- const i240 = imageStreams.find((s) => s.height == 240);
775
- const i480 = imageStreams.find((s) => s.height == 480);
776
- expect(i240.originalId).toBe('240,,240');
777
- expect(i480.originalId).toBe('240,,480');
778
- });
779
-
780
- it('Disjoint audio channels', async () => {
781
- /** @type {!Array.<shaka.extern.Period>} */
782
- const periods = [
783
- {
784
- id: '1',
785
- videoStreams: [
786
- makeVideoStream(1080),
787
- ],
788
- audioStreams: [
789
- makeAudioStream('en', /* channels= */ 6),
790
- ],
791
- textStreams: [],
792
- imageStreams: [],
793
- },
794
- {
795
- id: '2',
796
- videoStreams: [
797
- makeVideoStream(1080),
798
- ],
799
- audioStreams: [
800
- makeAudioStream('en', /* channels= */ 2),
801
- ],
802
- textStreams: [],
803
- imageStreams: [],
804
- },
805
- ];
806
-
807
- await combiner.combinePeriods(periods, /* isDynamic= */ false);
808
- const variants = combiner.getVariants();
809
- expect(variants).toEqual(jasmine.arrayWithExactContents([
810
- makeAVVariant(1080, 'en', /* channels= */ 6),
811
- ]));
812
-
813
- // We can use the originalId field to see what each track is composed of.
814
-
815
- // There is only one track. The whole thing gets "upgraded" to 6-channel
816
- // surround.
817
- const audio = variants[0].audio;
818
- expect(audio.originalId).toBe('en-6c,en');
819
- });
820
-
821
- it('Disjoint audio sample rates, ascending order', async () => {
822
- const makeAudioStreamWithSampleRate = (rate) => {
823
- const stream = makeAudioStream('en');
824
- stream.audioSamplingRate = rate;
825
- stream.originalId = rate.toString();
826
- return stream;
827
- };
828
-
829
- /** @type {!Array.<shaka.extern.Period>} */
830
- const periods = [
831
- {
832
- id: '1',
833
- videoStreams: [
834
- makeVideoStream(1080),
835
- ],
836
- audioStreams: [
837
- makeAudioStreamWithSampleRate(48000),
838
- ],
839
- textStreams: [],
840
- imageStreams: [],
841
- },
842
- {
843
- id: '2',
844
- videoStreams: [
845
- makeVideoStream(1080),
846
- ],
847
- audioStreams: [
848
- makeAudioStreamWithSampleRate(44100),
849
- ],
850
- textStreams: [],
851
- imageStreams: [],
852
- },
853
- ];
854
-
855
- await combiner.combinePeriods(periods, /* isDynamic= */ false);
856
- const variants = combiner.getVariants();
857
- expect(variants).toEqual(jasmine.arrayWithExactContents([
858
- makeAVVariant(1080, 'en'),
859
- ]));
860
-
861
- // We can use the originalId field to see what each track is composed of.
862
-
863
- // There is only one track.
864
- const audio = variants[0].audio;
865
- expect(audio.audioSamplingRate).toBe(48000);
866
- expect(audio.originalId).toBe('48000,44100');
867
- });
868
-
869
- it('Disjoint audio sample rates, descending order', async () => {
870
- const makeAudioStreamWithSampleRate = (rate) => {
871
- const stream = makeAudioStream('en');
872
- stream.audioSamplingRate = rate;
873
- stream.originalId = rate.toString();
874
- return stream;
875
- };
876
-
877
- /** @type {!Array.<shaka.extern.Period>} */
878
- const periods = [
879
- {
880
- id: '1',
881
- videoStreams: [
882
- makeVideoStream(1080),
883
- ],
884
- audioStreams: [
885
- makeAudioStreamWithSampleRate(44100),
886
- ],
887
- textStreams: [],
888
- imageStreams: [],
889
- },
890
- {
891
- id: '2',
892
- videoStreams: [
893
- makeVideoStream(1080),
894
- ],
895
- audioStreams: [
896
- makeAudioStreamWithSampleRate(48000),
897
- ],
898
- textStreams: [],
899
- imageStreams: [],
900
- },
901
- ];
902
-
903
- await combiner.combinePeriods(periods, /* isDynamic= */ false);
904
- const variants = combiner.getVariants();
905
- expect(variants).toEqual(jasmine.arrayWithExactContents([
906
- makeAVVariant(1080, 'en'),
907
- ]));
908
-
909
- // We can use the originalId field to see what each track is composed of.
910
-
911
- // There is only one track.
912
- const audio = variants[0].audio;
913
- expect(audio.audioSamplingRate).toBe(44100);
914
- expect(audio.originalId).toBe('44100,48000');
915
- });
916
-
917
- it('ignores newly added codecs', async () => {
918
- const newCodec = makeVideoStream(720);
919
- newCodec.codecs = 'foo.abcd';
920
-
921
- /** @type {!Array.<shaka.extern.Period>} */
922
- const periods = [
923
- {
924
- id: '1',
925
- videoStreams: [
926
- makeVideoStream(1080),
927
- ],
928
- audioStreams: [],
929
- textStreams: [],
930
- imageStreams: [],
931
- },
932
- {
933
- id: '2',
934
- videoStreams: [
935
- makeVideoStream(1080),
936
- newCodec,
937
- ],
938
- audioStreams: [],
939
- textStreams: [],
940
- imageStreams: [],
941
- },
942
- ];
943
-
944
- await combiner.combinePeriods(periods, /* isDynamic= */ false);
945
- const variants = combiner.getVariants();
946
- expect(variants.length).toBe(1);
947
- });
948
-
949
-
950
- it('Matches streams with no roles', async () => {
951
- const stream1 = makeAudioStream('en', /* channels= */ 2);
952
- stream1.originalId = '1';
953
- stream1.bandwidth = 129597;
954
- stream1.codecs = 'mp4a.40.2';
955
-
956
- const stream2 = makeAudioStream('en', /* channels= */ 2);
957
- stream2.originalId = '2';
958
- stream2.bandwidth = 129637;
959
- stream2.codecs = 'mp4a.40.2';
960
- stream2.roles = ['description'];
961
-
962
- const stream3 = makeAudioStream('en', /* channels= */ 2);
963
- stream3.originalId = '3';
964
- stream3.bandwidth = 131037;
965
- stream3.codecs = 'mp4a.40.2';
966
-
967
- const stream4 = makeAudioStream('en', /* channels= */ 2);
968
- stream4.originalId = '4';
969
- stream4.bandwidth = 131034;
970
- stream4.codecs = 'mp4a.40.2';
971
- stream4.roles = ['description'];
972
-
973
- /** @type {!Array.<shaka.extern.Period>} */
974
- const periods = [
975
- {
976
- id: '0',
977
- videoStreams: [
978
- makeVideoStream(1080),
979
- ],
980
- audioStreams: [
981
- stream1,
982
- stream2,
983
- ],
984
- textStreams: [],
985
- imageStreams: [],
986
- },
987
- {
988
- id: '1',
989
- videoStreams: [
990
- makeVideoStream(1080),
991
- ],
992
- audioStreams: [
993
- stream3,
994
- stream4,
995
- ],
996
- textStreams: [],
997
- imageStreams: [],
998
- },
999
- ];
1000
-
1001
- await combiner.combinePeriods(periods, /* isDynamic= */ true);
1002
- const variants = combiner.getVariants();
1003
- expect(variants.length).toBe(2);
1004
- // We can use the originalId field to see what each track is composed of.
1005
- const audio1 = variants[0].audio;
1006
- expect(audio1.roles).toEqual([]);
1007
- expect(audio1.originalId).toBe('1,3');
1008
-
1009
- const audio2 = variants[1].audio;
1010
- expect(audio2.roles).toEqual(['description']);
1011
- expect(audio2.originalId).toBe('2,4');
1012
- });
1013
-
1014
- it('Matches streams with related codecs', async () => {
1015
- const stream1 = makeVideoStream(1080);
1016
- stream1.originalId = '1';
1017
- stream1.bandwidth = 120000;
1018
- stream1.codecs = 'hvc1.1.4.L126.B0';
1019
-
1020
- const stream2 = makeVideoStream(1080);
1021
- stream2.originalId = '2';
1022
- stream2.bandwidth = 120000;
1023
- stream2.codecs = 'hev1.2.4.L123.B0';
1024
-
1025
- const stream3 = makeVideoStream(1080);
1026
- stream3.originalId = '3';
1027
- stream3.bandwidth = 120000;
1028
- stream3.codecs = 'dvhe.05.01';
1029
-
1030
- const stream4 = makeVideoStream(1080);
1031
- stream4.originalId = '4';
1032
- stream4.bandwidth = 120000;
1033
- stream4.codecs = 'dvh1.05.01';
1034
-
1035
- const stream5 = makeVideoStream(1080);
1036
- stream5.originalId = '5';
1037
- stream5.bandwidth = 120000;
1038
- stream5.codecs = 'avc1.42001f';
1039
-
1040
- const stream6 = makeVideoStream(1080);
1041
- stream6.originalId = '6';
1042
- stream6.bandwidth = 120000;
1043
- stream6.codecs = 'avc3.42001f';
1044
-
1045
- const stream7 = makeVideoStream(1080);
1046
- stream7.originalId = '7';
1047
- stream7.bandwidth = 120000;
1048
- stream7.codecs = 'vp09.00.10.08';
1049
-
1050
- const stream8 = makeVideoStream(1080);
1051
- stream8.originalId = '8';
1052
- stream8.bandwidth = 120000;
1053
- stream8.codecs = 'vp09.01.20.08.01';
1054
-
1055
- /** @type {!Array.<shaka.extern.Period>} */
1056
- const periods = [
1057
- {
1058
- id: '0',
1059
- videoStreams: [
1060
- stream1, stream3, stream5, stream7,
1061
- ],
1062
- audioStreams: [],
1063
- textStreams: [],
1064
- imageStreams: [],
1065
- },
1066
- {
1067
- id: '1',
1068
- videoStreams: [
1069
- stream2, stream4, stream6, stream8,
1070
- ],
1071
- audioStreams: [],
1072
- textStreams: [],
1073
- imageStreams: [],
1074
- },
1075
- ];
1076
-
1077
- await combiner.combinePeriods(periods, /* isDynamic= */ true);
1078
- const variants = combiner.getVariants();
1079
- expect(variants.length).toBe(4);
1080
- // We can use the originalId field to see what each track is composed of.
1081
- const video1 = variants[0].video;
1082
- expect(video1.originalId).toBe('1,2');
1083
-
1084
- const video2 = variants[1].video;
1085
- expect(video2.originalId).toBe('3,4');
1086
-
1087
- const video3 = variants[2].video;
1088
- expect(video3.originalId).toBe('5,6');
1089
-
1090
- const video4 = variants[3].video;
1091
- expect(video4.originalId).toBe('7,8');
1092
- });
1093
-
1094
- it('Matches streams with most roles in common', async () => {
1095
- const makeAudioStreamWithRoles = (roles) => {
1096
- const stream = makeAudioStream('en');
1097
- stream.roles = roles;
1098
- return stream;
1099
- };
1100
-
1101
- const stream1 = makeAudioStreamWithRoles(['role1', 'role2']);
1102
- stream1.originalId = 'stream1';
1103
-
1104
- const stream2 = makeAudioStreamWithRoles(['role1']);
1105
- stream2.originalId = 'stream2';
1106
-
1107
- const stream3 = makeAudioStreamWithRoles(['role1', 'role2']);
1108
- stream3.originalId = 'stream3';
1109
-
1110
- const stream4 = makeAudioStreamWithRoles(['role1']);
1111
- stream4.originalId = 'stream4';
1112
-
1113
- /** @type {!Array.<shaka.extern.Period>} */
1114
- const periods = [
1115
- {
1116
- id: '1',
1117
- videoStreams: [
1118
- makeVideoStream(1080),
1119
- ],
1120
- audioStreams: [
1121
- stream1,
1122
- stream2,
1123
- ],
1124
- textStreams: [],
1125
- imageStreams: [],
1126
- },
1127
- {
1128
- id: '2',
1129
- videoStreams: [
1130
- makeVideoStream(1080),
1131
- ],
1132
- audioStreams: [
1133
- stream3,
1134
- stream4,
1135
- ],
1136
- textStreams: [],
1137
- imageStreams: [],
1138
- },
1139
- ];
1140
-
1141
- await combiner.combinePeriods(periods, /* isDynamic= */ false);
1142
- const variants = combiner.getVariants();
1143
-
1144
- expect(variants).toEqual(jasmine.arrayWithExactContents([
1145
- makeAVVariant(1080, 'en', 2, ['role1', 'role2']),
1146
- makeAVVariant(1080, 'en', 2, ['role1']),
1147
- ]));
1148
-
1149
- // We can use the originalId field to see what each track is composed of.
1150
- expect(variants[0].audio.originalId).toBe('stream1,stream3');
1151
- expect(variants[1].audio.originalId).toBe('stream2,stream4');
1152
- });
1153
-
1154
- it('Matches streams with roles in common', async () => {
1155
- /** @type {!Array.<shaka.extern.Period>} */
1156
- const periods = [
1157
- {
1158
- id: '1',
1159
- videoStreams: [
1160
- makeVideoStream(720),
1161
- makeVideoStream(1080),
1162
- ],
1163
- audioStreams: [
1164
- makeAudioStreamWithRoles('stream1', ['main']),
1165
- makeAudioStreamWithRoles('stream2', ['description'], false),
1166
- ],
1167
- textStreams: [],
1168
- imageStreams: [],
1169
- },
1170
- {
1171
- id: '2',
1172
- videoStreams: [
1173
- makeVideoStream(720),
1174
- makeVideoStream(1080),
1175
- ],
1176
- audioStreams: [
1177
- makeAudioStreamWithRoles('stream1', ['main']),
1178
- makeAudioStreamWithRoles('stream2', ['description'], false),
1179
- ],
1180
- textStreams: [],
1181
- imageStreams: [],
1182
- },
1183
- ];
1184
-
1185
- await combiner.combinePeriods(periods, /* isDynamic= */ false);
1186
- const variants = combiner.getVariants();
1187
-
1188
- console.log(variants);
1189
-
1190
- expect(variants.length).toBe(4);
1191
-
1192
- expect(variants).toEqual(jasmine.arrayWithExactContents([
1193
- makeAVVariant(720, 'en', 2, ['main']),
1194
- makeAVVariant(1080, 'en', 2, ['main']),
1195
- makeAVVariant(720, 'en', 2, ['description']),
1196
- makeAVVariant(1080, 'en', 2, ['description']),
1197
- ]));
1198
-
1199
- // We can use the originalId field to see what each track is composed of.
1200
- expect(variants[0].audio.originalId).toBe('stream1,stream1');
1201
- expect(variants[1].audio.originalId).toBe('stream1,stream1');
1202
- expect(variants[2].audio.originalId).toBe('stream2,stream2');
1203
- expect(variants[3].audio.originalId).toBe('stream2,stream2');
1204
- });
1205
-
1206
- it('Matches streams with mismatched roles', async () => {
1207
- /** @type {!Array.<shaka.extern.Period>} */
1208
- const periods = [
1209
- {
1210
- id: '0',
1211
- videoStreams: [
1212
- makeVideoStream(720),
1213
- makeVideoStream(1080),
1214
- ],
1215
- audioStreams: [
1216
- makeAudioStreamWithRoles('stream1', ['main']),
1217
- ],
1218
- textStreams: [],
1219
- imageStreams: [],
1220
- },
1221
- {
1222
- id: '1',
1223
- videoStreams: [
1224
- makeVideoStream(720),
1225
- makeVideoStream(1080),
1226
- ],
1227
- audioStreams: [
1228
- makeAudioStreamWithRoles('stream1', ['main']),
1229
- makeAudioStreamWithRoles('stream2', ['description'], false),
1230
- ],
1231
- textStreams: [],
1232
- imageStreams: [],
1233
- },
1234
- {
1235
- id: '2',
1236
- videoStreams: [
1237
- makeVideoStream(720),
1238
- makeVideoStream(1080),
1239
- ],
1240
- audioStreams: [
1241
- makeAudioStreamWithRoles('stream1', ['main']),
1242
- ],
1243
- textStreams: [],
1244
- imageStreams: [],
1245
- },
1246
- {
1247
- id: '3',
1248
- videoStreams: [
1249
- makeVideoStream(720),
1250
- makeVideoStream(1080),
1251
- ],
1252
- audioStreams: [
1253
- makeAudioStreamWithRoles('stream1', ['main']),
1254
- makeAudioStreamWithRoles('stream2', ['description'], false),
1255
- ],
1256
- textStreams: [],
1257
- imageStreams: [],
1258
- },
1259
- ];
1260
-
1261
- await combiner.combinePeriods(periods, /* isDynamic= */ false);
1262
- const variants = combiner.getVariants();
1263
-
1264
- console.log(variants);
1265
-
1266
- expect(variants.length).toBe(4);
1267
-
1268
- expect(variants).toEqual(jasmine.arrayWithExactContents([
1269
- makeAVVariant(720, 'en', 2, ['main']),
1270
- makeAVVariant(1080, 'en', 2, ['main']),
1271
- makeAVVariant(720, 'en', 2, ['description', 'main']),
1272
- makeAVVariant(1080, 'en', 2, ['description', 'main']),
1273
- ]));
1274
-
1275
- // We can use the originalId field to see what each track is composed of.
1276
- expect(variants[0].audio.originalId)
1277
- .toBe('stream1,stream1,stream1,stream1');
1278
-
1279
- expect(variants[1].audio.originalId)
1280
- .toBe('stream1,stream1,stream1,stream1');
1281
-
1282
- expect(variants[2].audio.originalId)
1283
- .toBe('stream1,stream2,stream1,stream2');
1284
-
1285
- expect(variants[3].audio.originalId)
1286
- .toBe('stream1,stream2,stream1,stream2');
1287
- });
1288
-
1289
- it('The number of variants stays stable after many periods ' +
1290
- 'when going between similar content and varying ads', async () => {
1291
- // This test is based on the content from
1292
- // https://github.com/shaka-project/shaka-player/issues/2716
1293
- // that used to cause our period flattening logic to keep
1294
- // creating new variants for every new period added.
1295
- // It's ok to create a few additional variants/streams,
1296
- // but we should stabilize eventually and keep the number
1297
- // of variants from growing indefinitely.
1298
-
1299
- // 1st period streams
1300
- const v1 = makeVideoStream(720);
1301
- v1.frameRate = 30000/1001;
1302
- v1.bandwidth = 6200000;
1303
-
1304
- const v2 = makeVideoStream(1080);
1305
- v2.frameRate = 30000/1001;
1306
- v2.bandwidth = 8000000;
1307
-
1308
- const v3 = makeVideoStream(272);
1309
- v3.frameRate = 15000/1001;
1310
- v3.bandwidth = 400000;
1311
-
1312
- const v4 = makeVideoStream(360);
1313
- v4.frameRate = 30000/1001;
1314
- v4.bandwidth = 800000;
1315
-
1316
- const v5 = makeVideoStream(432);
1317
- v5.frameRate = 30000/1001;
1318
- v5.bandwidth = 1200000;
1319
-
1320
- // 2nd period streams
1321
- const v6 = makeVideoStream(432);
1322
- v6.frameRate = 24000/1001;
1323
- v6.bandwidth = 933000;
1324
-
1325
- const v7 = makeVideoStream(360);
1326
- v7.frameRate = 30000/1001;
1327
- v7.bandwidth = 363000;
1328
-
1329
- const v8 = makeVideoStream(540);
1330
- v8.frameRate = 15000/1001;
1331
- v8.bandwidth = 1780000;
1332
-
1333
- const v9 = makeVideoStream(720);
1334
- v9.frameRate = 30000/1001;
1335
- v9.bandwidth = 3940000;
1336
-
1337
- const v10 = makeVideoStream(360);
1338
- v10.frameRate = 30000/1001;
1339
- v10.bandwidth = 599000;
1340
-
1341
-
1342
- // 3nd period streams
1343
- const v11 = makeVideoStream(432);
1344
- v11.frameRate = 24000/1001;
1345
- v11.bandwidth = 894000;
1346
-
1347
- const v12 = makeVideoStream(360);
1348
- v12.frameRate = 30000/1001;
1349
- v12.bandwidth = 365000;
1350
-
1351
- const v13 = makeVideoStream(540);
1352
- v13.frameRate = 15000/1001;
1353
- v13.bandwidth = 1611000;
1354
-
1355
- const v14 = makeVideoStream(720);
1356
- v14.frameRate = 30000/1001;
1357
- v14.bandwidth = 3967000;
1358
-
1359
- const v15 = makeVideoStream(360);
1360
- v15.frameRate = 30000/1001;
1361
- v15.bandwidth = 570000;
1362
-
1363
- // 4th period streams
1364
- const v16 = makeVideoStream(432);
1365
- v16.frameRate = 24000/1001;
1366
- v16.bandwidth = 933000;
1367
-
1368
- const v17 = makeVideoStream(360);
1369
- v17.frameRate = 24000/1001;
1370
- v17.bandwidth = 363000;
1371
-
1372
- const v18 = makeVideoStream(540);
1373
- v18.frameRate = 24000/1001;
1374
- v18.bandwidth = 1780000;
1375
-
1376
- const v19 = makeVideoStream(720);
1377
- v19.frameRate = 24000/1001;
1378
- v19.bandwidth = 3940000;
1379
-
1380
- const v20 = makeVideoStream(360);
1381
- v20.frameRate = 24000/1001;
1382
- v20.bandwidth = 570005990000;
1383
-
1384
- /** @type {!Array.<shaka.extern.Period>} */
1385
- const periods = [
1386
- {
1387
- id: '1',
1388
- videoStreams: [v1, v2, v3, v4, v5],
1389
- audioStreams: [],
1390
- textStreams: [],
1391
- imageStreams: [],
1392
- },
1393
- {
1394
- id: '2',
1395
- videoStreams: [v6, v7, v8, v9, v10],
1396
- audioStreams: [],
1397
- textStreams: [],
1398
- imageStreams: [],
1399
- },
1400
- {
1401
- id: '3',
1402
- videoStreams: [v11, v12, v13, v14, v15],
1403
- audioStreams: [],
1404
- textStreams: [],
1405
- imageStreams: [],
1406
- },
1407
- {
1408
- id: '4',
1409
- videoStreams: [v16, v17, v18, v19, v20],
1410
- audioStreams: [],
1411
- textStreams: [],
1412
- imageStreams: [],
1413
- },
1414
- {
1415
- id: '5',
1416
- // Same as 1st
1417
- videoStreams: [v1, v2, v3, v4, v5],
1418
- audioStreams: [],
1419
- textStreams: [],
1420
- imageStreams: [],
1421
- },
1422
- {
1423
- id: '6',
1424
- // Same as 2nd
1425
- videoStreams: [v6, v7, v8, v9, v10],
1426
- audioStreams: [],
1427
- textStreams: [],
1428
- imageStreams: [],
1429
- },
1430
- {
1431
- id: '7',
1432
- // Same as 3rd
1433
- videoStreams: [v11, v12, v13, v14, v15],
1434
- audioStreams: [],
1435
- textStreams: [],
1436
- imageStreams: [],
1437
- },
1438
- {
1439
- id: '8',
1440
- // Same as 4th
1441
- videoStreams: [v16, v17, v18, v19, v20],
1442
- audioStreams: [],
1443
- textStreams: [],
1444
- imageStreams: [],
1445
- },
1446
- // Adding the 1st period again since it was the one that used to
1447
- // cause trouble when repeated.
1448
- {
1449
- id: '9',
1450
- // Same as 1st and 5th
1451
- videoStreams: [v1, v2, v3, v4, v5],
1452
- audioStreams: [],
1453
- textStreams: [],
1454
- imageStreams: [],
1455
- },
1456
- ];
1457
-
1458
- await combiner.combinePeriods(periods.slice(0, 4), /* isDynamic= */ true);
1459
- const variantsAfter4Periods = combiner.getVariants();
1460
-
1461
- await combiner.combinePeriods(periods.slice(0, 8), /* isDynamic= */ true);
1462
- const variantsAfter8Periods = combiner.getVariants();
1463
- expect(variantsAfter4Periods).toEqual(variantsAfter8Periods);
1464
-
1465
- await combiner.combinePeriods(periods, /* isDynamic= */ true);
1466
- const variantsAfterAllPeriods = combiner.getVariants();
1467
- expect(variantsAfter4Periods).toEqual(variantsAfterAllPeriods);
1468
- });
1469
-
1470
-
1471
- describe('compareClosestPreferLower', () => {
1472
- const PeriodCombiner = shaka.util.PeriodCombiner;
1473
- const {BETTER, EQUAL, WORSE} = shaka.util.PeriodCombiner.BetterOrWorse;
1474
-
1475
- it('Prefers value equal to the output', () => {
1476
- let isCandidateBetter = PeriodCombiner.compareClosestPreferLower(
1477
- /* output= */ 5, /* bestValue= */ 5, /* candidateValue= */ 3);
1478
- expect(isCandidateBetter).toBe(WORSE);
1479
-
1480
- // Make sure it works correctly whether it's the candidate or the best
1481
- // value that is equal to the output.
1482
- isCandidateBetter = PeriodCombiner.compareClosestPreferLower(
1483
- /* output= */ 5, /* bestValue= */ 3, /* candidateValue= */ 5);
1484
- expect(isCandidateBetter).toBe(BETTER);
1485
- });
1486
-
1487
- it('Prefers a value lower than the output', () => {
1488
- let isCandidateBetter = PeriodCombiner.compareClosestPreferLower(
1489
- /* output= */ 5, /* bestValue= */ 3, /* candidateValue= */ 6);
1490
- expect(isCandidateBetter).toBe(WORSE);
1491
-
1492
- isCandidateBetter = PeriodCombiner.compareClosestPreferLower(
1493
- /* output= */ 5, /* bestValue= */ 7, /* candidateValue= */ 2);
1494
- expect(isCandidateBetter).toBe(BETTER);
1495
- });
1496
-
1497
- it('If both values are lower than the output,' +
1498
- ' prefer the one that\'s closer', () => {
1499
- let isCandidateBetter = PeriodCombiner.compareClosestPreferLower(
1500
- /* output= */ 5, /* bestValue= */ 4, /* candidateValue= */ 3);
1501
- expect(isCandidateBetter).toBe(WORSE);
1502
-
1503
- isCandidateBetter = PeriodCombiner.compareClosestPreferLower(
1504
- /* output= */ 5, /* bestValue= */ 2, /* candidateValue= */ 3);
1505
- expect(isCandidateBetter).toBe(BETTER);
1506
- });
1507
-
1508
- it('If both values are greater than the output,' +
1509
- ' prefer the one that\'s closer', () => {
1510
- let isCandidateBetter = PeriodCombiner.compareClosestPreferLower(
1511
- /* output= */ 5, /* bestValue= */ 6, /* candidateValue= */ 7);
1512
- expect(isCandidateBetter).toBe(WORSE);
1513
-
1514
- isCandidateBetter = PeriodCombiner.compareClosestPreferLower(
1515
- /* output= */ 5, /* bestValue= */ 9, /* candidateValue= */ 8);
1516
- expect(isCandidateBetter).toBe(BETTER);
1517
- });
1518
- });
1519
-
1520
- /** @type {number} */
1521
- let nextId = 0;
1522
-
1523
- /**
1524
- * @param {number} height
1525
- * @return {shaka.extern.Stream}
1526
- * @suppress {accessControls}
1527
- */
1528
- function makeVideoStream(height) {
1529
- const width = height * 4 / 3;
1530
- const streamGenerator = new shaka.test.ManifestGenerator.Stream(
1531
- /* manifest= */ null,
1532
- /* isPartial= */ false,
1533
- /* id= */ nextId++,
1534
- /* type= */ shaka.util.ManifestParserUtils.ContentType.VIDEO,
1535
- /* lang= */ 'und');
1536
- streamGenerator.size(width, height);
1537
- streamGenerator.originalId = height.toString();
1538
- return streamGenerator.build_();
1539
- }
1540
-
1541
- /**
1542
- * @param {string} language
1543
- * @param {number=} channels
1544
- * @param {boolean=} primary
1545
- * @return {shaka.extern.Stream}
1546
- * @suppress {accessControls}
1547
- */
1548
- function makeAudioStream(language, channels = 2, primary = false) {
1549
- const streamGenerator = new shaka.test.ManifestGenerator.Stream(
1550
- /* manifest= */ null,
1551
- /* isPartial= */ false,
1552
- /* id= */ nextId++,
1553
- /* type= */ shaka.util.ManifestParserUtils.ContentType.AUDIO,
1554
- language);
1555
- streamGenerator.primary = primary;
1556
- streamGenerator.channelsCount = channels;
1557
- streamGenerator.originalId = primary ?
1558
- streamGenerator.language + '*' : streamGenerator.language;
1559
- if (channels != 2) {
1560
- streamGenerator.originalId += `-${channels}c`;
1561
- }
1562
- return streamGenerator.build_();
1563
- }
1564
-
1565
- /**
1566
- * @param {string} language
1567
- * @param {boolean=} primary
1568
- * @return {shaka.extern.Stream}
1569
- * @suppress {accessControls}
1570
- */
1571
- function makeTextStream(language, primary = false) {
1572
- const streamGenerator = new shaka.test.ManifestGenerator.Stream(
1573
- /* manifest= */ null,
1574
- /* isPartial= */ false,
1575
- /* id= */ nextId++,
1576
- /* type= */ shaka.util.ManifestParserUtils.ContentType.TEXT,
1577
- language);
1578
- streamGenerator.primary = primary;
1579
- streamGenerator.originalId = primary ?
1580
- streamGenerator.language + '*' : streamGenerator.language;
1581
- return streamGenerator.build_();
1582
- }
1583
-
1584
- /**
1585
- * @param {number} height
1586
- * @return {shaka.extern.Stream}
1587
- * @suppress {accessControls}
1588
- */
1589
- function makeImageStream(height) {
1590
- const width = height * 4 / 3;
1591
- const streamGenerator = new shaka.test.ManifestGenerator.Stream(
1592
- /* manifest= */ null,
1593
- /* isPartial= */ false,
1594
- /* id= */ nextId++,
1595
- /* type= */ shaka.util.ManifestParserUtils.ContentType.IMAGE);
1596
- streamGenerator.size(width, height);
1597
- streamGenerator.originalId = height.toString();
1598
- streamGenerator.mime('image/jpeg');
1599
- streamGenerator.tilesLayout = '1x1';
1600
- return streamGenerator.build_();
1601
- }
1602
-
1603
- /**
1604
- * @param {number} height
1605
- * @param {string} language
1606
- * @param {number=} channels
1607
- * @return {shaka.extern.Variant}
1608
- */
1609
- function makeAVVariant(height, language, channels = 2, roles = []) {
1610
- const variant = jasmine.objectContaining({
1611
- language,
1612
- audio: jasmine.objectContaining({
1613
- language,
1614
- roles,
1615
- channelsCount: channels,
1616
- }),
1617
- video: jasmine.objectContaining({
1618
- height,
1619
- }),
1620
- });
1621
- return /** @type {shaka.extern.Variant} */(/** @type {?} */(variant));
1622
- }
1623
- });