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,998 +0,0 @@
1
- /*! @license
2
- * Shaka Player
3
- * Copyright 2016 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
-
7
- // Test DRM-related parsing.
8
- describe('DashParser ContentProtection', () => {
9
- const Dash = shaka.test.Dash;
10
- const ContentProtection = shaka.dash.ContentProtection;
11
- const strToXml = (str) => {
12
- const parser = new DOMParser();
13
- return parser.parseFromString(str, 'application/xml').documentElement;
14
- };
15
-
16
- /**
17
- * Tests that the parser produces the correct results.
18
- *
19
- * @param {string} manifestText
20
- * @param {Object} expected A Manifest-like object. The parser output is
21
- * expected to match this.
22
- * @param {boolean=} ignoreDrmInfo
23
- * @return {!Promise}
24
- */
25
- async function testDashParser(manifestText, expected, ignoreDrmInfo = false) {
26
- const netEngine = new shaka.test.FakeNetworkingEngine();
27
- netEngine.setDefaultText(manifestText);
28
- const dashParser = new shaka.dash.DashParser();
29
-
30
- const config = shaka.util.PlayerConfiguration.createDefault().manifest;
31
- config.dash.ignoreDrmInfo = ignoreDrmInfo || false;
32
- dashParser.configure(config);
33
-
34
- const playerInterface = {
35
- networkingEngine: netEngine,
36
- modifyManifestRequest: (request, manifestInfo) => {},
37
- modifySegmentRequest: (request, segmentInfo) => {},
38
- filter: (manifest) => Promise.resolve(),
39
- makeTextStreamsForClosedCaptions: (manifest) => {},
40
- onTimelineRegionAdded: fail, // Should not have any EventStream elements.
41
- onEvent: fail,
42
- onError: fail,
43
- isLowLatencyMode: () => false,
44
- isAutoLowLatencyMode: () => false,
45
- enableLowLatencyMode: () => {},
46
- updateDuration: () => {},
47
- newDrmInfo: (stream) => {},
48
- onManifestUpdated: () => {},
49
- getBandwidthEstimate: () => 1e6,
50
- };
51
-
52
- const actual = await dashParser.start(
53
- 'http://example.com', playerInterface);
54
- expect(actual).toEqual(expected);
55
- // When the above expectation fails, it is far too hard to read the output
56
- // and debug the test failure. So we also do these more targetted
57
- // comparisons below, which will be easier to read and debug. The full
58
- // comparison above remains to catch anything we haven't written a more
59
- // targetted expectation for below.
60
-
61
- for (let i = 0; i < actual.variants.length; ++i) {
62
- // NOTE: ['sample'] is how we get access to the partial object given to
63
- // jasmine.objectContaining().
64
-
65
- const actualVariant = actual.variants[i];
66
- const expectedVariant = expected['sample'].variants[i];
67
-
68
- const actualVideo = actualVariant.video;
69
- const expectedVideo = expectedVariant['sample'].video;
70
-
71
- const actualDrmInfos = actualVideo.drmInfos;
72
- const expectedDrmInfos = expectedVideo['sample'].drmInfos;
73
- expect(actualDrmInfos).withContext(`video drmInfos, i=${i}`)
74
- .toEqual(expectedDrmInfos);
75
-
76
- const actualKeyIds = actualVideo.keyIds;
77
- const expectedKeyIds = expectedVideo['sample'].keyIds;
78
- expect(actualKeyIds).withContext(`video keyIds, i=${i}`)
79
- .toEqual(expectedKeyIds);
80
- }
81
- }
82
-
83
- /**
84
- * Build a simple manifest with ContentProtection lines inserted into the
85
- * AdaptationSet and each Representation.
86
- *
87
- * @param {!Array.<string>} adaptationSetLines
88
- * @param {!Array.<string>} representation1Lines
89
- * @param {!Array.<string>} representation2Lines
90
- * @return {string}
91
- */
92
- function buildManifestText(
93
- adaptationSetLines, representation1Lines, representation2Lines) {
94
- const template = [
95
- '<MPD xmlns="urn:mpeg:DASH:schema:MPD:2011"',
96
- ' xmlns:cenc="urn:mpeg:cenc:2013"',
97
- ' xmlns:mspr="urn:microsoft:playready">',
98
- ' <Period duration="PT30S">',
99
- ' <SegmentTemplate media="s.mp4" duration="2" />',
100
- ' <AdaptationSet mimeType="video/mp4" codecs="avc1.4d401f">',
101
- '%(adaptationSetLines)s',
102
- ' <Representation bandwidth="50" width="576" height="432">',
103
- '%(representation1Lines)s',
104
- ' </Representation>',
105
- ' <Representation bandwidth="100" width="576" height="432">',
106
- '%(representation2Lines)s',
107
- ' </Representation>',
108
- ' </AdaptationSet>',
109
- ' </Period>',
110
- '</MPD>',
111
- ].join('\n');
112
- return sprintf(template, {
113
- adaptationSetLines: adaptationSetLines.join('\n'),
114
- representation1Lines: representation1Lines.join('\n'),
115
- representation2Lines: representation2Lines.join('\n'),
116
- });
117
- }
118
-
119
- /**
120
- * Build an expected manifest which checks DRM-related fields.
121
- *
122
- * @param {!Array.<!Object>} drmInfos A list of DrmInfo-like objects.
123
- * @param {!Array.<string>=} keyIds The key IDs to attach to each variant.
124
- * Will default to the keyIds from the first drmInfo object.
125
- * @return {Object} A Manifest-like object.
126
- */
127
- function buildExpectedManifest(drmInfos, keyIds) {
128
- if (!keyIds) {
129
- if (drmInfos.length) {
130
- // NOTE: ['sample'] is how we get access to the partial object given to
131
- // jasmine.objectContaining().
132
- keyIds = Array.from(drmInfos[0]['sample'].keyIds);
133
- } else {
134
- keyIds = [];
135
- }
136
- }
137
-
138
- const variants = [];
139
- const numVariants = 2;
140
- for (let i = 0; i < numVariants; i++) {
141
- const variant = jasmine.objectContaining({
142
- video: jasmine.objectContaining({
143
- keyIds: new Set(keyIds[i] ? [keyIds[i]] : []),
144
- drmInfos,
145
- }),
146
- });
147
- variants.push(variant);
148
- }
149
-
150
- return jasmine.objectContaining({
151
- variants: variants,
152
- textStreams: [],
153
- });
154
- }
155
-
156
- /**
157
- * Build an expected DrmInfo based on a key system and optional key IDs and
158
- * init data.
159
- *
160
- * @param {string} keySystem
161
- * @param {!Array.<string>=} keyIds
162
- * @param {!Array.<shaka.extern.InitDataOverride>=} initData
163
- * @return {Object} A DrmInfo-like object.
164
- */
165
- function buildDrmInfo(keySystem, keyIds = [], initData = []) {
166
- return jasmine.objectContaining({
167
- keySystem,
168
- keyIds: new Set(keyIds),
169
- initData,
170
- });
171
- }
172
-
173
- /**
174
- * Build an expected InitDataOverride based on base-64-encoded PSSHs and
175
- * optional key IDs.
176
- *
177
- * @param {!Array.<string>} base64Psshs
178
- * @param {!Array.<string>=} keyIds
179
- * @return {!Array.<shaka.extern.InitDataOverride>}
180
- */
181
- function buildInitData(base64Psshs, keyIds = []) {
182
- return base64Psshs.map((base64, index) => {
183
- /** @type {shaka.extern.InitDataOverride} */
184
- const initData = {
185
- initDataType: 'cenc',
186
- initData: shaka.util.Uint8ArrayUtils.fromBase64(base64),
187
- keyId: keyIds[index] || null,
188
- };
189
- return initData;
190
- });
191
- }
192
-
193
- it('handles clear content', async () => {
194
- const source = buildManifestText([], [], []);
195
- const expected = buildExpectedManifest([]);
196
- await testDashParser(source, expected);
197
- });
198
-
199
- describe('maps standard scheme IDs', () => {
200
- /**
201
- * @param {string} name A name for the test
202
- * @param {!Array.<string>} uuids DRM scheme UUIDs
203
- * @param {!Array.<string>} keySystems expected key system IDs
204
- */
205
- function testKeySystemMappings(name, uuids, keySystems) {
206
- it(name, async () => {
207
- const adaptationSetLines = uuids.map((uri) => {
208
- return sprintf('<ContentProtection schemeIdUri="urn:uuid:%s" />',
209
- uri);
210
- });
211
- const source = buildManifestText(adaptationSetLines, [], []);
212
- const drmInfos = keySystems.map((keySystem) => {
213
- return buildDrmInfo(keySystem);
214
- });
215
- const expected = buildExpectedManifest(drmInfos);
216
- await testDashParser(source, expected);
217
- });
218
- }
219
-
220
- testKeySystemMappings('for Widevine',
221
- ['edef8ba9-79d6-4ace-a3c8-27dcd51d21ed'], ['com.widevine.alpha']);
222
- testKeySystemMappings('for PlayReady',
223
- ['9a04f079-9840-4286-ab92-e65be0885f95'], ['com.microsoft.playready']);
224
- testKeySystemMappings('for old PlayReady',
225
- ['79f0049a-4098-8642-ab92-e65be0885f95'], ['com.microsoft.playready']);
226
- testKeySystemMappings('for Adobe Primetime',
227
- ['f239e769-efa3-4850-9c16-a903c6932efb'], ['com.adobe.primetime']);
228
-
229
- testKeySystemMappings('for multiple DRMs in the specified order',
230
- [
231
- 'edef8ba9-79d6-4ace-a3c8-27dcd51d21ed',
232
- '9a04f079-9840-4286-ab92-e65be0885f95',
233
- ], [
234
- 'com.widevine.alpha',
235
- 'com.microsoft.playready',
236
- ]);
237
-
238
- testKeySystemMappings('in a case-insensitive way',
239
- [
240
- 'EDEF8BA9-79D6-4ACE-A3C8-27DCD51D21ED',
241
- '9A04F079-9840-4286-AB92-E65BE0885F95',
242
- 'F239E769-EFA3-4850-9C16-A903C6932EFB',
243
- ], [
244
- 'com.widevine.alpha',
245
- 'com.microsoft.playready',
246
- 'com.adobe.primetime',
247
- ]);
248
- });
249
-
250
- it('inherits key IDs from AdaptationSet to Representation', async () => {
251
- const source = buildManifestText([
252
- // AdaptationSet lines
253
- '<ContentProtection',
254
- ' schemeIdUri="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed" />',
255
- '<ContentProtection',
256
- ' schemeIdUri="urn:mpeg:dash:mp4protection:2011" value="cenc"',
257
- ' cenc:default_KID="DEADBEEF-FEED-BAAD-F00D-000008675309" />',
258
- ], [], []);
259
- const expected = buildExpectedManifest([
260
- buildDrmInfo('com.widevine.alpha', [
261
- // Representation 1 & 2 key ID deduplicated in DrmInfo
262
- 'deadbeeffeedbaadf00d000008675309',
263
- ]),
264
- ],
265
- [
266
- // Representation 1 key ID
267
- 'deadbeeffeedbaadf00d000008675309',
268
- // Representation 2 key ID
269
- 'deadbeeffeedbaadf00d000008675309',
270
- ]);
271
- await testDashParser(source, expected);
272
- });
273
-
274
- it('sets key IDs for the init data', async () => {
275
- const source = buildManifestText([
276
- // AdaptationSet lines
277
- ], [
278
- // Representation 1 lines
279
- '<ContentProtection',
280
- ' schemeIdUri="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"',
281
- ' value="cenc"',
282
- ' cenc:default_KID="DEADBEEF-FEED-BAAD-F00D-000008675309">',
283
- ' <cenc:pssh>bm8gaHVtYW4gY2FuIHJlYWQgYmFzZTY0IGRpcmVjdGx5</cenc:pssh>',
284
- '</ContentProtection>',
285
- ], []);
286
-
287
- const initData = buildInitData(
288
- ['bm8gaHVtYW4gY2FuIHJlYWQgYmFzZTY0IGRpcmVjdGx5'], // PSSHs
289
- ['deadbeeffeedbaadf00d000008675309']); // key ID for init data
290
- const expected = buildExpectedManifest([
291
- buildDrmInfo('com.widevine.alpha',
292
- ['deadbeeffeedbaadf00d000008675309'], // key ID
293
- initData),
294
- ]);
295
- await testDashParser(source, expected);
296
- });
297
-
298
- it('lets Representations override key IDs', async () => {
299
- const source = buildManifestText([
300
- // AdaptationSet lines
301
- '<ContentProtection',
302
- ' schemeIdUri="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed" />',
303
- '<ContentProtection',
304
- ' schemeIdUri="urn:mpeg:dash:mp4protection:2011" value="cenc"',
305
- ' cenc:default_KID="DEADBEEF-FEED-BAAD-F00D-000008675309" />',
306
- ], [
307
- // Representation 1 lines
308
- '<ContentProtection',
309
- ' schemeIdUri="urn:mpeg:dash:mp4protection:2011" value="cenc"',
310
- ' cenc:default_KID="BAADF00D-FEED-DEAF-BEEF-000004390116" />',
311
- ], [
312
- // Representation 2 lines
313
- '<ContentProtection',
314
- ' schemeIdUri="urn:mpeg:dash:mp4protection:2011" value="cenc"',
315
- ' cenc:default_KID="BAADF00D-FEED-DEAF-BEEF-018006492568" />',
316
- ]);
317
- const expected = buildExpectedManifest([
318
- buildDrmInfo('com.widevine.alpha', [
319
- // Representation 1 key ID
320
- 'baadf00dfeeddeafbeef000004390116',
321
- // Representation 2 key ID
322
- 'baadf00dfeeddeafbeef018006492568',
323
- ]),
324
- ]);
325
- await testDashParser(source, expected);
326
- });
327
-
328
- it('extracts embedded PSSHs', async () => {
329
- const source = buildManifestText([
330
- // AdaptationSet lines
331
- '<ContentProtection',
332
- ' schemeIdUri="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed">',
333
- ' <cenc:pssh>ZmFrZSBXaWRldmluZSBQU1NI</cenc:pssh>',
334
- '</ContentProtection>',
335
- '<ContentProtection',
336
- ' schemeIdUri="urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95">',
337
- ' <cenc:pssh>bm8gaHVtYW4gY2FuIHJlYWQgYmFzZTY0IGRpcmVjdGx5</cenc:pssh>',
338
- '</ContentProtection>',
339
- ], [], []);
340
- const expected = buildExpectedManifest([
341
- buildDrmInfo('com.widevine.alpha',
342
- [], // key IDs
343
- buildInitData(['ZmFrZSBXaWRldmluZSBQU1NI'])),
344
- buildDrmInfo('com.microsoft.playready',
345
- [], // key IDs
346
- buildInitData(['bm8gaHVtYW4gY2FuIHJlYWQgYmFzZTY0IGRpcmVjdGx5'])),
347
- ]);
348
- await testDashParser(source, expected);
349
- });
350
-
351
- it('extracts embedded PSSHs with mspr:pro', async () => {
352
- const source = buildManifestText([
353
- // AdaptationSet lines
354
- '<ContentProtection',
355
- ' schemeIdUri="urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95">',
356
- ' <mspr:pro>UGxheXJlYWR5</mspr:pro>',
357
- '</ContentProtection>',
358
- ], [], []);
359
- const expected = buildExpectedManifest([
360
- buildDrmInfo('com.microsoft.playready',
361
- [], // key IDs
362
- buildInitData([
363
- 'AAAAKXBzc2gAAAAAmgTweZhAQoarkuZb4IhflQAAAAlQbGF5cmVhZHk=',
364
- ])),
365
- ]);
366
- await testDashParser(source, expected);
367
- });
368
-
369
- it('extracts embedded PSSHs and prefer cenc:pssh over mspr:pro', async () => {
370
- const source = buildManifestText([
371
- // AdaptationSet lines
372
- '<ContentProtection',
373
- ' schemeIdUri="urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95">',
374
- ' <cenc:pssh>bm8gaHVtYW4gY2FuIHJlYWQgYmFzZTY0IGRpcmVjdGx5</cenc:pssh>',
375
- ' <mspr:pro>ZmFrZSBQbGF5cmVhZHkgUFJP</mspr:pro>',
376
- '</ContentProtection>',
377
- ], [], []);
378
- const expected = buildExpectedManifest([
379
- buildDrmInfo('com.microsoft.playready',
380
- [], // key IDs
381
- buildInitData(['bm8gaHVtYW4gY2FuIHJlYWQgYmFzZTY0IGRpcmVjdGx5'])),
382
- ]);
383
- await testDashParser(source, expected);
384
- });
385
-
386
- it('assumes all known key systems for generic CENC', async () => {
387
- const source = buildManifestText([
388
- // AdaptationSet lines
389
- '<ContentProtection',
390
- ' schemeIdUri="urn:mpeg:dash:mp4protection:2011" value="cenc" />',
391
- ], [], []);
392
- // The order does not matter here, so use arrayContaining.
393
- // NOTE: the buildDrmInfo calls here specify no init data
394
- const drmInfos = jasmine.arrayContaining([
395
- buildDrmInfo('com.widevine.alpha'),
396
- buildDrmInfo('com.microsoft.playready'),
397
- buildDrmInfo('com.adobe.primetime'),
398
- ]);
399
- const expected = buildExpectedManifest(
400
- /** @type {!Array.<shaka.extern.DrmInfo>} */(drmInfos),
401
- [], // key IDs
402
- );
403
- await testDashParser(source, expected);
404
- });
405
-
406
- it('assumes all known key systems when ignoreDrmInfo is set', async () => {
407
- const source = buildManifestText([
408
- // AdaptationSet lines
409
- '<ContentProtection',
410
- ' schemeIdUri="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed">',
411
- ' <cenc:pssh>ZmFrZSBXaWRldmluZSBQU1NI</cenc:pssh>',
412
- '</ContentProtection>',
413
- '<ContentProtection',
414
- ' schemeIdUri="urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95">',
415
- ' <cenc:pssh>bm8gaHVtYW4gY2FuIHJlYWQgYmFzZTY0IGRpcm</cenc:pssh>',
416
- '</ContentProtection>',
417
- ], [], []);
418
-
419
- // The order does not matter here, so use arrayContaining.
420
- // NOTE: the buildDrmInfo calls here specify no init data
421
- const drmInfos = jasmine.arrayContaining([
422
- buildDrmInfo('com.widevine.alpha'),
423
- buildDrmInfo('com.microsoft.playready'),
424
- buildDrmInfo('com.adobe.primetime'),
425
- ]);
426
- const expected = buildExpectedManifest(
427
- /** @type {!Array.<shaka.extern.DrmInfo>} */(drmInfos),
428
- []); // key IDs
429
- await testDashParser(source, expected, /* ignoreDrmInfo= */ true);
430
- });
431
-
432
- it('parses key IDs when ignoreDrmInfo flag is set', async () => {
433
- const source = buildManifestText([
434
- // AdaptationSet lines
435
- '<ContentProtection',
436
- ' schemeIdUri="urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95"',
437
- ' cenc:default_KID="DEADBEEF-FEED-BAAD-F00D-000008675309" />',
438
- '<ContentProtection',
439
- ' schemeIdUri="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"',
440
- ' cenc:default_KID="DEADBEEF-FEED-BAAD-F00D-000008675309" />',
441
- ], [], []);
442
- const keyIds = [
443
- // Representation 1 & 2 key ID deduplicated in DrmInfo
444
- 'deadbeeffeedbaadf00d000008675309',
445
- ];
446
- const variantKeyIds = [
447
- // Representation 1 key ID
448
- 'deadbeeffeedbaadf00d000008675309',
449
- // Representation 2 key ID
450
- 'deadbeeffeedbaadf00d000008675309',
451
- ];
452
-
453
- const expected = buildExpectedManifest([
454
- buildDrmInfo('com.widevine.alpha', keyIds),
455
- // PlayReady has two associated UUIDs, so it appears twice.
456
- buildDrmInfo('com.microsoft.playready', keyIds),
457
- buildDrmInfo('com.microsoft.playready', keyIds),
458
- buildDrmInfo('com.adobe.primetime', keyIds),
459
- ], variantKeyIds);
460
- await testDashParser(source, expected, /* ignoreDrmInfo= */ true);
461
- });
462
-
463
- it('inherits PSSH from generic CENC into all key systems', async () => {
464
- const source = buildManifestText([
465
- // AdaptationSet lines
466
- '<ContentProtection',
467
- ' schemeIdUri="urn:mpeg:dash:mp4protection:2011" value="cenc">',
468
- ' <cenc:pssh>b25lIGhlYWRlciB0byBydWxlIHRoZW0gYWxs</cenc:pssh>',
469
- '</ContentProtection>',
470
- '<ContentProtection',
471
- ' schemeIdUri="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed" />',
472
- '<ContentProtection',
473
- ' schemeIdUri="urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95" />',
474
- ], [], []);
475
- const expected = buildExpectedManifest([
476
- buildDrmInfo('com.widevine.alpha',
477
- [], // key IDs
478
- buildInitData(['b25lIGhlYWRlciB0byBydWxlIHRoZW0gYWxs'])),
479
- buildDrmInfo('com.microsoft.playready',
480
- [], // key IDs
481
- buildInitData(['b25lIGhlYWRlciB0byBydWxlIHRoZW0gYWxs'])),
482
- ]);
483
- await testDashParser(source, expected);
484
- });
485
-
486
- it('lets key systems override generic PSSH', async () => {
487
- const source = buildManifestText([
488
- // AdaptationSet lines
489
- '<ContentProtection',
490
- ' schemeIdUri="urn:mpeg:dash:mp4protection:2011" value="cenc">',
491
- ' <cenc:pssh>b25lIGhlYWRlciB0byBydWxlIHRoZW0gYWxs</cenc:pssh>',
492
- '</ContentProtection>',
493
- '<ContentProtection',
494
- ' schemeIdUri="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed">',
495
- ' <cenc:pssh>',
496
- ' VGltZSBpcyBhbiBpbGx1c2lvbi4gTHVuY2h0aW1lIGRvdWJseSBzby4=',
497
- ' </cenc:pssh>',
498
- '</ContentProtection>',
499
- '<ContentProtection',
500
- ' schemeIdUri="urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95" />',
501
- ], [], []);
502
- const expected = buildExpectedManifest([
503
- buildDrmInfo('com.widevine.alpha',
504
- [], // key IDs
505
- buildInitData(
506
- ['VGltZSBpcyBhbiBpbGx1c2lvbi4gTHVuY2h0aW1lIGRvdWJseSBzby4='])),
507
- buildDrmInfo('com.microsoft.playready',
508
- [], // key IDs
509
- buildInitData(['b25lIGhlYWRlciB0byBydWxlIHRoZW0gYWxs'])),
510
- ]);
511
- await testDashParser(source, expected);
512
- });
513
-
514
- it('ignores custom or unknown schemes', async () => {
515
- const source = buildManifestText([
516
- // AdaptationSet lines
517
- '<ContentProtection',
518
- ' schemeIdUri="urn:uuid:feedbaad-f00d-2bee-baad-d00d00000000" />',
519
- '<ContentProtection',
520
- ' schemeIdUri="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed" />',
521
- '<ContentProtection',
522
- ' schemeIdUri="http://example.com/drm" />',
523
- ], [], []);
524
- const expected = buildExpectedManifest([
525
- buildDrmInfo('com.widevine.alpha'),
526
- ]);
527
- await testDashParser(source, expected);
528
- });
529
-
530
- it('inserts a placeholder for unrecognized schemes', async () => {
531
- const source = buildManifestText([
532
- // AdaptationSet lines
533
- '<ContentProtection',
534
- ' schemeIdUri="urn:uuid:feedbaad-f00d-2bee-baad-d00d00000000" />',
535
- '<ContentProtection',
536
- ' schemeIdUri="http://example.com/drm" />',
537
- '<ContentProtection',
538
- ' schemeIdUri="urn:mpeg:dash:mp4protection:2011" value="cenc"',
539
- ' cenc:default_KID="DEADBEEF-FEED-BAAD-F00D-000008675309" />',
540
- ], [], []);
541
- const expected = buildExpectedManifest([
542
- // placeholder: only unrecognized schemes found
543
- buildDrmInfo('', [
544
- // Representation 1 & 2 key ID deduplicated in DrmInfo
545
- 'deadbeeffeedbaadf00d000008675309',
546
- ]),
547
- ],
548
- [
549
- // Representation 1 key ID
550
- 'deadbeeffeedbaadf00d000008675309',
551
- // Representation 2 key ID
552
- 'deadbeeffeedbaadf00d000008675309',
553
- ]);
554
- await testDashParser(source, expected);
555
- });
556
-
557
- it('can specify ContentProtection in Representation only', async () => {
558
- const source = buildManifestText([
559
- // AdaptationSet lines
560
- ], [
561
- // Representation 1 lines
562
- '<ContentProtection',
563
- ' schemeIdUri="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed" />',
564
- ], [
565
- // Representation 2 lines
566
- '<ContentProtection',
567
- ' schemeIdUri="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed" />',
568
- ]);
569
- const expected = buildExpectedManifest([
570
- buildDrmInfo('com.widevine.alpha'),
571
- ]);
572
- await testDashParser(source, expected);
573
- });
574
-
575
- it('still keeps per-Representation key IDs when merging', async () => {
576
- const source = buildManifestText([
577
- // AdaptationSet lines
578
- ], [
579
- // Representation 1 lines
580
- '<ContentProtection',
581
- ' schemeIdUri="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed" />',
582
- '<ContentProtection',
583
- ' schemeIdUri="urn:mpeg:dash:mp4protection:2011" value="cenc"',
584
- ' cenc:default_KID="DEADBEEF-FEED-BAAD-F00D-000008675309" />',
585
- ], [
586
- // Representation 2 lines
587
- '<ContentProtection',
588
- ' schemeIdUri="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed" />',
589
- '<ContentProtection',
590
- ' schemeIdUri="urn:mpeg:dash:mp4protection:2011" value="cenc"',
591
- ' cenc:default_KID="BAADF00D-FEED-DEAF-BEEF-000004390116" />',
592
- ]);
593
- const expected = buildExpectedManifest([
594
- buildDrmInfo('com.widevine.alpha', [
595
- // Representation 1 key ID
596
- 'deadbeeffeedbaadf00d000008675309',
597
- // Representation 2 key ID
598
- 'baadf00dfeeddeafbeef000004390116',
599
- ]),
600
- ]);
601
- await testDashParser(source, expected);
602
- });
603
-
604
- it('parses key IDs from non-cenc in Representation', async () => {
605
- const source = buildManifestText([
606
- // AdaptationSet lines
607
- ], [
608
- // Representation 1 lines
609
- '<ContentProtection',
610
- ' schemeIdUri="urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95"',
611
- ' cenc:default_KID="DEADBEEF-FEED-BAAD-F00D-000008675309" />',
612
- '<ContentProtection',
613
- ' schemeIdUri="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"',
614
- ' cenc:default_KID="DEADBEEF-FEED-BAAD-F00D-000008675309" />',
615
- ], [
616
- // Representation 2 lines
617
- '<ContentProtection',
618
- ' schemeIdUri="urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95"',
619
- ' cenc:default_KID="BAADF00D-FEED-DEAF-BEEF-000004390116" />',
620
- '<ContentProtection',
621
- ' schemeIdUri="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"',
622
- ' cenc:default_KID="BAADF00D-FEED-DEAF-BEEF-000004390116" />',
623
- ]);
624
- const keyIds = [
625
- // Representation 1 key ID
626
- 'deadbeeffeedbaadf00d000008675309',
627
- // Representation 2 key ID
628
- 'baadf00dfeeddeafbeef000004390116',
629
- ];
630
- const expected = buildExpectedManifest([
631
- buildDrmInfo('com.microsoft.playready', keyIds),
632
- buildDrmInfo('com.widevine.alpha', keyIds),
633
- ]);
634
- await testDashParser(source, expected);
635
- });
636
-
637
- it('parses key IDs from non-cenc in AdaptationSet', async () => {
638
- const source = buildManifestText([
639
- // AdaptationSet lines
640
- '<ContentProtection',
641
- ' schemeIdUri="urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95"',
642
- ' cenc:default_KID="DEADBEEF-FEED-BAAD-F00D-000008675309" />',
643
- '<ContentProtection',
644
- ' schemeIdUri="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"',
645
- ' cenc:default_KID="DEADBEEF-FEED-BAAD-F00D-000008675309" />',
646
- ], [], []);
647
- const keyIds = [
648
- // Representation 1 & 2 key ID deduplicated in DrmInfo
649
- 'deadbeeffeedbaadf00d000008675309',
650
- ];
651
- const variantKeyIds = [
652
- // Representation 1 key ID
653
- 'deadbeeffeedbaadf00d000008675309',
654
- // Representation 2 key ID
655
- 'deadbeeffeedbaadf00d000008675309',
656
- ];
657
- const expected = buildExpectedManifest([
658
- buildDrmInfo('com.microsoft.playready', keyIds),
659
- buildDrmInfo('com.widevine.alpha', keyIds),
660
- ], variantKeyIds);
661
- await testDashParser(source, expected);
662
- });
663
-
664
- it('ignores elements missing @schemeIdUri', async () => {
665
- const source = buildManifestText([
666
- // AdaptationSet lines
667
- '<ContentProtection />',
668
- '<ContentProtection',
669
- ' schemeIdUri="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed" />',
670
- ], [], []);
671
- const expected = buildExpectedManifest([
672
- buildDrmInfo('com.widevine.alpha'),
673
- ]);
674
- await testDashParser(source, expected);
675
- });
676
-
677
- it('handles non-default namespace names', async () => {
678
- const source = [
679
- '<MPD xmlns="urn:mpeg:DASH:schema:MPD:2011"',
680
- ' xmlns:foo="urn:mpeg:cenc:2013">',
681
- ' <Period duration="PT30S">',
682
- ' <SegmentTemplate media="s.mp4" duration="2" />',
683
- ' <AdaptationSet mimeType="video/mp4" codecs="avc1.4d401f">',
684
- ' <ContentProtection',
685
- ' schemeIdUri="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed">',
686
- ' <foo:pssh>b25lIGhlYWRlciB0byBydWxlIHRoZW0gYWxs</foo:pssh>',
687
- ' </ContentProtection>',
688
- ' <Representation bandwidth="50" width="576" height="432" />',
689
- ' <Representation bandwidth="100" width="576" height="432" />',
690
- ' </AdaptationSet>',
691
- ' </Period>',
692
- '</MPD>',
693
- ].join('\n');
694
- const expected = buildExpectedManifest([
695
- buildDrmInfo('com.widevine.alpha',
696
- [], // key IDs
697
- buildInitData(['b25lIGhlYWRlciB0byBydWxlIHRoZW0gYWxs'])),
698
- ]);
699
- await testDashParser(source, expected);
700
- });
701
-
702
- it('fails for no schemes common', async () => {
703
- const source = buildManifestText([
704
- // AdaptationSet lines
705
- ], [
706
- // Representation 1 lines
707
- '<ContentProtection',
708
- ' schemeIdUri="urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95" />',
709
- ], [
710
- // Representation 2 lines
711
- '<ContentProtection',
712
- ' schemeIdUri="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed" />',
713
- ]);
714
- const expected = new shaka.util.Error(
715
- shaka.util.Error.Severity.CRITICAL,
716
- shaka.util.Error.Category.MANIFEST,
717
- shaka.util.Error.Code.DASH_NO_COMMON_KEY_SYSTEM);
718
- await Dash.testFails(source, expected);
719
- });
720
-
721
- it('fails for invalid PSSH encoding', async () => {
722
- const source = buildManifestText([
723
- // AdaptationSet lines
724
- '<ContentProtection',
725
- ' schemeIdUri="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed">',
726
- ' <cenc:pssh>foobar!</cenc:pssh>',
727
- '</ContentProtection>',
728
- ], [], []);
729
- const expected = new shaka.util.Error(
730
- shaka.util.Error.Severity.CRITICAL,
731
- shaka.util.Error.Category.MANIFEST,
732
- shaka.util.Error.Code.DASH_PSSH_BAD_ENCODING);
733
- await Dash.testFails(source, expected);
734
- });
735
-
736
- it('fails for conflicting default key IDs', async () => {
737
- const source = buildManifestText([
738
- // AdaptationSet lines
739
- '<ContentProtection',
740
- ' schemeIdUri="urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95"',
741
- ' cenc:default_KID="DEADBEEF-FEED-BAAD-F00D-000008675309" />',
742
- '<ContentProtection',
743
- ' schemeIdUri="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"',
744
- ' cenc:default_KID="BAADF00D-FEED-DEAF-BEEF-000004390116" />',
745
- ], [], []);
746
- const expected = new shaka.util.Error(
747
- shaka.util.Error.Severity.CRITICAL,
748
- shaka.util.Error.Category.MANIFEST,
749
- shaka.util.Error.Code.DASH_CONFLICTING_KEY_IDS);
750
- await Dash.testFails(source, expected);
751
- });
752
-
753
- it('fails for multiple key IDs', async () => {
754
- const source = buildManifestText([
755
- // AdaptationSet lines
756
- '<ContentProtection',
757
- ' schemeIdUri="urn:mpeg:dash:mp4protection:2011" value="cenc"',
758
- ' cenc:default_KID="BAADF00D-FEED-DEAF-BEEF-000004390116 foobar" />',
759
- '<ContentProtection',
760
- ' schemeIdUri="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed" />',
761
- ], [], []);
762
- const expected = new shaka.util.Error(
763
- shaka.util.Error.Severity.CRITICAL,
764
- shaka.util.Error.Category.MANIFEST,
765
- shaka.util.Error.Code.DASH_MULTIPLE_KEY_IDS_NOT_SUPPORTED);
766
- await Dash.testFails(source, expected);
767
- });
768
-
769
- describe('getWidevineLicenseUrl', () => {
770
- it('valid ms:laurl node', () => {
771
- const input = {
772
- init: null,
773
- keyId: null,
774
- schemeUri: '',
775
- node: strToXml([
776
- '<test xmlns:ms="urn:microsoft">',
777
- ' <ms:laurl licenseUrl="www.example.com"></ms:laurl>',
778
- '</test>',
779
- ].join('\n')),
780
- };
781
- const actual = ContentProtection.getWidevineLicenseUrl(input);
782
- expect(actual).toBe('www.example.com');
783
- });
784
-
785
- it('ms:laurl without license url', () => {
786
- const input = {
787
- init: null,
788
- keyId: null,
789
- schemeUri: '',
790
- node: strToXml([
791
- '<test xmlns:ms="urn:microsoft">',
792
- ' <ms:laurl></ms:laurl>',
793
- '</test>',
794
- ].join('\n')),
795
- };
796
- const actual = ContentProtection.getWidevineLicenseUrl(input);
797
- expect(actual).toBe('');
798
- });
799
-
800
- it('valid dashif:Laurl node', () => {
801
- const input = {
802
- init: null,
803
- keyId: null,
804
- schemeUri: '',
805
- node: strToXml([
806
- '<test xmlns:dashif="https://dashif.org/CPS">',
807
- ' <dashif:Laurl>www.example.com</dashif:Laurl>',
808
- '</test>',
809
- ].join('\n')),
810
- };
811
- const actual = ContentProtection.getWidevineLicenseUrl(input);
812
- expect(actual).toBe('www.example.com');
813
- });
814
-
815
- it('dashif:Laurl without license url', () => {
816
- const input = {
817
- init: null,
818
- keyId: null,
819
- schemeUri: '',
820
- node: strToXml([
821
- '<test xmlns:dashif="https://dashif.org/CPS">',
822
- ' <dashif:Laurl></dashif:Laurl>',
823
- '</test>',
824
- ].join('\n')),
825
- };
826
- const actual = ContentProtection.getWidevineLicenseUrl(input);
827
- expect(actual).toBe('');
828
- });
829
-
830
- it('no ms:laurl node or dashif:Laurl node', () => {
831
- const input = {
832
- init: null,
833
- keyId: null,
834
- schemeUri: '',
835
- node: strToXml('<test></test>'),
836
- };
837
- const actual = ContentProtection.getWidevineLicenseUrl(input);
838
- expect(actual).toBe('');
839
- });
840
- });
841
-
842
- describe('getClearKeyLicenseUrl', () => {
843
- it('valid clearkey:Laurl node', () => {
844
- const input = {
845
- init: null,
846
- keyId: null,
847
- schemeUri: '',
848
- node: strToXml([
849
- '<test xmlns:clearkey="http://dashif.org/guidelines/clearKey">',
850
- ' <clearkey:Laurl ',
851
- ' Lic_type="EME-1.0">www.example.com</clearkey:Laurl>',
852
- '</test>',
853
- ].join('\n')),
854
- };
855
- const actual = ContentProtection.getClearKeyLicenseUrl(input);
856
- expect(actual).toBe('www.example.com');
857
- });
858
-
859
- it('clearkey:Laurl without license url', () => {
860
- const input = {
861
- init: null,
862
- keyId: null,
863
- schemeUri: '',
864
- node: strToXml([
865
- '<test xmlns:clearkey="http://dashif.org/guidelines/clearKey">',
866
- ' <clearkey:Laurl Lic_type="EME-1.0"></clearkey:Laurl>',
867
- '</test>',
868
- ].join('\n')),
869
- };
870
- const actual = ContentProtection.getClearKeyLicenseUrl(input);
871
- expect(actual).toBe('');
872
- });
873
-
874
- it('valid dashif:Laurl node', () => {
875
- const input = {
876
- init: null,
877
- keyId: null,
878
- schemeUri: '',
879
- node: strToXml([
880
- '<test xmlns:dashif="https://dashif.org/CPS">',
881
- ' <dashif:Laurl>www.example.com</dashif:Laurl>',
882
- '</test>',
883
- ].join('\n')),
884
- };
885
- const actual = ContentProtection.getClearKeyLicenseUrl(input);
886
- expect(actual).toBe('www.example.com');
887
- });
888
-
889
- it('dashif:Laurl without license url', () => {
890
- const input = {
891
- init: null,
892
- keyId: null,
893
- schemeUri: '',
894
- node: strToXml([
895
- '<test xmlns:dashif="https://dashif.org/CPS">',
896
- ' <dashif:Laurl></dashif:Laurl>',
897
- '</test>',
898
- ].join('\n')),
899
- };
900
- const actual = ContentProtection.getClearKeyLicenseUrl(input);
901
- expect(actual).toBe('');
902
- });
903
-
904
- it('no clearkey:Laurl or dashif:Laurl node', () => {
905
- const input = {
906
- init: null,
907
- keyId: null,
908
- schemeUri: '',
909
- node: strToXml('<test></test>'),
910
- };
911
- const actual = ContentProtection.getClearKeyLicenseUrl(input);
912
- expect(actual).toBe('');
913
- });
914
- });
915
-
916
- describe('getPlayReadyLicenseURL', () => {
917
- it('mspro', () => {
918
- const laurl = [
919
- '<WRMHEADER>',
920
- ' <DATA>',
921
- ' <LA_URL>www.example.com</LA_URL>',
922
- ' </DATA>',
923
- '</WRMHEADER>',
924
- ].join('\n');
925
- const laurlCodes = laurl.split('').map((c) => {
926
- return c.charCodeAt();
927
- });
928
- const prBytes = new Uint16Array([
929
- // pr object size (in num bytes).
930
- // + 10 for PRO size, count, and type
931
- laurl.length * 2 + 10, 0,
932
- // record count
933
- 1,
934
- // type
935
- ContentProtection.PLAYREADY_RECORD_TYPES.RIGHTS_MANAGEMENT,
936
- // record size (in num bytes)
937
- laurl.length * 2,
938
- // value
939
- ].concat(laurlCodes));
940
-
941
- const encodedPrObject = shaka.util.Uint8ArrayUtils.toBase64(prBytes);
942
- const input = {
943
- init: null,
944
- keyId: null,
945
- schemeUri: '',
946
- node:
947
- strToXml([
948
- '<test xmlns:mspr="urn:microsoft:playready">',
949
- ' <mspr:pro>' + encodedPrObject + '</mspr:pro>',
950
- '</test>',
951
- ].join('\n')),
952
- };
953
- const actual = ContentProtection.getPlayReadyLicenseUrl(input);
954
- expect(actual).toBe('www.example.com');
955
- });
956
-
957
- it('valid dashif:Laurl node', () => {
958
- const input = {
959
- init: null,
960
- keyId: null,
961
- schemeUri: '',
962
- node: strToXml([
963
- '<test xmlns:dashif="https://dashif.org/CPS">',
964
- ' <dashif:Laurl>www.example.com</dashif:Laurl>',
965
- '</test>',
966
- ].join('\n')),
967
- };
968
- const actual = ContentProtection.getPlayReadyLicenseUrl(input);
969
- expect(actual).toBe('www.example.com');
970
- });
971
-
972
- it('dashif:Laurl without license url', () => {
973
- const input = {
974
- init: null,
975
- keyId: null,
976
- schemeUri: '',
977
- node: strToXml([
978
- '<test xmlns:dashif="https://dashif.org/CPS">',
979
- ' <dashif:Laurl></dashif:Laurl>',
980
- '</test>',
981
- ].join('\n')),
982
- };
983
- const actual = ContentProtection.getPlayReadyLicenseUrl(input);
984
- expect(actual).toBe('');
985
- });
986
-
987
- it('no mspro or dashif:Laurl node', () => {
988
- const input = {
989
- init: null,
990
- keyId: null,
991
- schemeUri: '',
992
- node: strToXml('<test></test>'),
993
- };
994
- const actual = ContentProtection.getPlayReadyLicenseUrl(input);
995
- expect(actual).toBe('');
996
- });
997
- });
998
- });