shaka-player 4.6.3 → 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.
- package/README.md +1 -0
- package/dist/controls.css +1 -1
- package/dist/controls.css.map +1 -1
- package/dist/deps.js +13 -9
- package/dist/locales.js +33 -33
- package/dist/shaka-player.compiled.d.ts +47 -4
- package/dist/shaka-player.compiled.debug.d.ts +47 -4
- package/dist/shaka-player.compiled.debug.externs.js +50 -2
- package/dist/shaka-player.compiled.debug.js +408 -376
- package/dist/shaka-player.compiled.debug.map +4 -4
- package/dist/shaka-player.compiled.externs.js +50 -2
- package/dist/shaka-player.compiled.js +1134 -1118
- package/dist/shaka-player.compiled.map +4 -4
- package/dist/shaka-player.ui.d.ts +69 -5
- package/dist/shaka-player.ui.debug.d.ts +69 -5
- package/dist/shaka-player.ui.debug.externs.js +82 -2
- package/dist/shaka-player.ui.debug.js +457 -420
- package/dist/shaka-player.ui.debug.map +4 -4
- package/dist/shaka-player.ui.externs.js +82 -2
- package/dist/shaka-player.ui.js +1305 -1289
- package/dist/shaka-player.ui.map +4 -4
- package/externs/mediasession.js +7 -0
- package/externs/shaka/abr_manager.js +8 -0
- package/externs/shaka/manifest.js +3 -3
- package/externs/shaka/player.js +59 -4
- package/lib/abr/simple_abr_manager.js +41 -15
- package/lib/ads/client_side_ad_manager.js +4 -0
- package/lib/ads/media_tailor_ad_manager.js +5 -0
- package/lib/ads/server_side_ad_manager.js +4 -0
- package/lib/cea/cea708_service.js +1 -1
- package/lib/cea/cea708_window.js +95 -7
- package/lib/dash/dash_parser.js +55 -11
- package/lib/hls/hls_parser.js +17 -5
- package/lib/media/adaptation_set_criteria.js +76 -10
- package/lib/media/drm_engine.js +0 -3
- package/lib/media/media_source_engine.js +42 -18
- package/lib/media/segment_reference.js +12 -0
- package/lib/media/streaming_engine.js +58 -5
- package/lib/media/video_wrapper.js +4 -3
- package/lib/player.js +95 -11
- package/lib/text/simple_text_displayer.js +8 -7
- package/lib/text/text_utils.js +39 -13
- package/lib/text/ui_text_displayer.js +20 -11
- package/lib/text/web_vtt_generator.js +1 -1
- package/lib/util/cmsd_manager.js +269 -0
- package/lib/util/content_steering_manager.js +5 -1
- package/lib/util/mime_utils.js +6 -2
- package/lib/util/periods.js +108 -39
- package/lib/util/player_configuration.js +19 -5
- package/lib/util/stream_utils.js +82 -13
- package/package.json +1 -1
- package/ui/audio_language_selection.js +3 -0
- package/ui/controls.js +60 -0
- package/ui/externs/ui.js +12 -1
- package/ui/hidden_fast_forward_button.js +32 -0
- package/ui/hidden_rewind_button.js +32 -0
- package/ui/hidden_seek_button.js +121 -0
- package/ui/less/buttons.less +50 -0
- package/ui/less/containers.less +18 -0
- package/ui/resolution_selection.js +2 -0
- package/ui/ui.js +2 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -75
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -26
- package/.github/ISSUE_TEMPLATE/question.md +0 -26
- package/.github/config.yml +0 -1
- package/.github/workflows/appspot.yaml +0 -39
- package/.github/workflows/build-and-test.yaml +0 -222
- package/.github/workflows/compute-incremental-coverage.py +0 -265
- package/.github/workflows/custom-actions/prep-for-appspot/action.yaml +0 -56
- package/.github/workflows/custom-actions/set-commit-status/action.yaml +0 -37
- package/.github/workflows/deflake.yaml +0 -31
- package/.github/workflows/demo-version-index.yaml +0 -43
- package/.github/workflows/nightly-demo.yaml +0 -42
- package/.github/workflows/release-please.yaml +0 -193
- package/.github/workflows/report-incremental-coverage.yaml +0 -39
- package/.github/workflows/safari-homedir-launcher.sh +0 -18
- package/.github/workflows/selenium-lab-tests.yaml +0 -370
- package/.github/workflows/shaka-bot-commands/command-help.sh +0 -27
- package/.github/workflows/shaka-bot-commands/command-test.sh +0 -56
- package/.github/workflows/shaka-bot-commands/lib.sh +0 -83
- package/.github/workflows/shaka-bot-commands/main.sh +0 -51
- package/.github/workflows/sync-labels.yaml +0 -33
- package/.github/workflows/talk-to-shaka-bot.yaml +0 -29
- package/.github/workflows/update-issues.yaml +0 -31
- package/.github/workflows/update-screenshots.yaml +0 -142
- package/.github/workflows/validate-pr-title.yaml +0 -27
- package/CHANGELOG.md +0 -5764
- package/CODE_OF_CONDUCT.md +0 -93
- package/CONTRIBUTING.md +0 -76
- package/demo/TengwarTelcontar.woff2 +0 -0
- package/demo/app_logo_144.png +0 -0
- package/demo/app_logo_192.png +0 -0
- package/demo/app_logo_256.png +0 -0
- package/demo/app_logo_384.png +0 -0
- package/demo/app_logo_512.png +0 -0
- package/demo/app_manifest.json +0 -29
- package/demo/asset_card.js +0 -410
- package/demo/autoTemplate.txt +0 -61
- package/demo/cast_receiver/idle1.jpg +0 -0
- package/demo/cast_receiver/idle2.jpg +0 -0
- package/demo/cast_receiver/idle3.jpg +0 -0
- package/demo/cast_receiver/index.html +0 -75
- package/demo/cast_receiver/receiver_app.css +0 -111
- package/demo/cast_receiver/receiver_app.js +0 -158
- package/demo/close_button.js +0 -60
- package/demo/common/asset.js +0 -511
- package/demo/common/assets.js +0 -1635
- package/demo/config.js +0 -859
- package/demo/custom.js +0 -907
- package/demo/customWarning.txt +0 -8
- package/demo/demo.less +0 -591
- package/demo/demo_uncompiled.js +0 -11
- package/demo/demo_utils.js +0 -113
- package/demo/favicon.ico +0 -0
- package/demo/front.js +0 -156
- package/demo/icons/README.md +0 -4
- package/demo/icons/baseline-audiotrack-24px.svg +0 -1
- package/demo/icons/baseline-closed_caption-24px.svg +0 -1
- package/demo/icons/baseline-fast_forward-24px.svg +0 -1
- package/demo/icons/baseline-language-24px.svg +0 -1
- package/demo/icons/baseline-live_tv-24px.svg +0 -1
- package/demo/icons/baseline-subtitles-24px.svg +0 -1
- package/demo/icons/baseline-surround_sound-24px.svg +0 -1
- package/demo/icons/custom_ad.svg +0 -1
- package/demo/icons/custom_box_with_text.svg +0 -1
- package/demo/icons/custom_clear_key.svg +0 -1
- package/demo/icons/custom_high_definition.svg +0 -1
- package/demo/icons/custom_playready.svg +0 -1
- package/demo/icons/custom_ultra_high_definition.svg +0 -1
- package/demo/icons/custom_widevine.svg +0 -1
- package/demo/index.html +0 -173
- package/demo/input.js +0 -270
- package/demo/input_container.js +0 -218
- package/demo/load.js +0 -156
- package/demo/main.js +0 -1854
- package/demo/search.js +0 -452
- package/demo/service_worker.js +0 -355
- package/demo/shaka_logo_trans.png +0 -0
- package/demo/tooltip.js +0 -29
- package/demo/visualizer.js +0 -335
- package/demo/visualizer_button.js +0 -84
- package/dist/demo.compiled.debug.js +0 -340
- package/dist/demo.compiled.debug.map +0 -8
- package/dist/demo.compiled.js +0 -340
- package/dist/demo.compiled.map +0 -8
- package/dist/demo.css +0 -6
- package/dist/demo.css.map +0 -1
- package/dist/receiver.compiled.debug.js +0 -187
- package/dist/receiver.compiled.debug.map +0 -8
- package/dist/receiver.compiled.js +0 -187
- package/dist/receiver.compiled.map +0 -8
- package/docs/announcement-list-join-group.png +0 -0
- package/docs/api-mainpage.md +0 -28
- package/docs/design/REDESIGN.md +0 -283
- package/docs/design/architecture.md +0 -13
- package/docs/design/bg-fetch-after.gv +0 -29
- package/docs/design/bg-fetch-after.gv.png +0 -0
- package/docs/design/bg-fetch-before.gv +0 -18
- package/docs/design/bg-fetch-before.gv.png +0 -0
- package/docs/design/bg-fetch.md +0 -134
- package/docs/design/cast.gv +0 -35
- package/docs/design/cast.gv.png +0 -0
- package/docs/design/chromecast.md +0 -151
- package/docs/design/codec_preferences.md +0 -158
- package/docs/design/dash-audio-channels.md +0 -123
- package/docs/design/dash-manifests.md +0 -248
- package/docs/design/dash-timeline.svg +0 -4
- package/docs/design/dataflow.gv +0 -66
- package/docs/design/dataflow.gv.png +0 -0
- package/docs/design/export.md +0 -70
- package/docs/design/fuzzy-locale-matching.md +0 -40
- package/docs/design/gap-jumping.md +0 -151
- package/docs/design/lcevc-architecture.png +0 -0
- package/docs/design/lcevc-demo.png +0 -0
- package/docs/design/lcevc-integration.md +0 -72
- package/docs/design/locale_compatibility.svg +0 -1
- package/docs/design/locales_tree.svg +0 -1
- package/docs/design/localization-design-principles.md +0 -158
- package/docs/design/newdemo.gv +0 -83
- package/docs/design/newdemo.gv.png +0 -0
- package/docs/design/offline.gv +0 -43
- package/docs/design/offline.gv.png +0 -0
- package/docs/design/offline.md +0 -153
- package/docs/design/ownership.gv +0 -76
- package/docs/design/ownership.gv.png +0 -0
- package/docs/design/preload.md +0 -299
- package/docs/design/preload.png +0 -0
- package/docs/design/talking-about-languages.md +0 -46
- package/docs/design/timeline.svg +0 -152
- package/docs/design/ui.md +0 -31
- package/docs/design/ui_player_relationships.svg +0 -1
- package/docs/jsdoc-plugin.js +0 -74
- package/docs/jsdoc-template/README.md +0 -1
- package/docs/jsdoc-template/publish.js +0 -879
- package/docs/jsdoc-template/static/fonts/OpenSans-Bold-webfont.eot +0 -0
- package/docs/jsdoc-template/static/fonts/OpenSans-Bold-webfont.svg +0 -1830
- package/docs/jsdoc-template/static/fonts/OpenSans-Bold-webfont.woff +0 -0
- package/docs/jsdoc-template/static/fonts/OpenSans-BoldItalic-webfont.eot +0 -0
- package/docs/jsdoc-template/static/fonts/OpenSans-BoldItalic-webfont.svg +0 -1830
- package/docs/jsdoc-template/static/fonts/OpenSans-BoldItalic-webfont.woff +0 -0
- package/docs/jsdoc-template/static/fonts/OpenSans-Italic-webfont.eot +0 -0
- package/docs/jsdoc-template/static/fonts/OpenSans-Italic-webfont.svg +0 -1830
- package/docs/jsdoc-template/static/fonts/OpenSans-Italic-webfont.woff +0 -0
- package/docs/jsdoc-template/static/fonts/OpenSans-Light-webfont.eot +0 -0
- package/docs/jsdoc-template/static/fonts/OpenSans-Light-webfont.svg +0 -1831
- package/docs/jsdoc-template/static/fonts/OpenSans-Light-webfont.woff +0 -0
- package/docs/jsdoc-template/static/fonts/OpenSans-LightItalic-webfont.eot +0 -0
- package/docs/jsdoc-template/static/fonts/OpenSans-LightItalic-webfont.svg +0 -1835
- package/docs/jsdoc-template/static/fonts/OpenSans-LightItalic-webfont.woff +0 -0
- package/docs/jsdoc-template/static/fonts/OpenSans-Regular-webfont.eot +0 -0
- package/docs/jsdoc-template/static/fonts/OpenSans-Regular-webfont.svg +0 -1831
- package/docs/jsdoc-template/static/fonts/OpenSans-Regular-webfont.woff +0 -0
- package/docs/jsdoc-template/static/scripts/linenumber.js +0 -44
- package/docs/jsdoc-template/static/scripts/show-widget.js +0 -55
- package/docs/jsdoc-template/static/styles/jsdoc-default.css +0 -438
- package/docs/jsdoc-template/tmpl/augments.tmpl +0 -10
- package/docs/jsdoc-template/tmpl/container.tmpl +0 -205
- package/docs/jsdoc-template/tmpl/details.tmpl +0 -152
- package/docs/jsdoc-template/tmpl/example.tmpl +0 -2
- package/docs/jsdoc-template/tmpl/examples.tmpl +0 -13
- package/docs/jsdoc-template/tmpl/exceptions.tmpl +0 -32
- package/docs/jsdoc-template/tmpl/layout.tmpl +0 -50
- package/docs/jsdoc-template/tmpl/mainpage.tmpl +0 -14
- package/docs/jsdoc-template/tmpl/members.tmpl +0 -47
- package/docs/jsdoc-template/tmpl/method.tmpl +0 -140
- package/docs/jsdoc-template/tmpl/modifies.tmpl +0 -14
- package/docs/jsdoc-template/tmpl/params.tmpl +0 -131
- package/docs/jsdoc-template/tmpl/properties.tmpl +0 -125
- package/docs/jsdoc-template/tmpl/returns.tmpl +0 -19
- package/docs/jsdoc-template/tmpl/source.tmpl +0 -8
- package/docs/jsdoc-template/tmpl/tutorial.tmpl +0 -21
- package/docs/jsdoc-template/tmpl/type.tmpl +0 -7
- package/docs/jsdoc.conf.json +0 -38
- package/docs/shaka-player-logo.png +0 -0
- package/docs/style.md +0 -174
- package/docs/tutorials/a11y.md +0 -64
- package/docs/tutorials/ad_monetization.md +0 -292
- package/docs/tutorials/application-level-redirects.md +0 -94
- package/docs/tutorials/architecture.md +0 -32
- package/docs/tutorials/basic-usage.md +0 -89
- package/docs/tutorials/blob-url.md +0 -15
- package/docs/tutorials/config.md +0 -148
- package/docs/tutorials/debugging.md +0 -189
- package/docs/tutorials/drm-config.md +0 -274
- package/docs/tutorials/errors.md +0 -95
- package/docs/tutorials/fairplay.md +0 -242
- package/docs/tutorials/faq.md +0 -252
- package/docs/tutorials/index.json +0 -29
- package/docs/tutorials/lcevc.md +0 -118
- package/docs/tutorials/license-server-auth.md +0 -248
- package/docs/tutorials/license-wrapping.md +0 -168
- package/docs/tutorials/manifest-parser.md +0 -365
- package/docs/tutorials/network-and-buffering-config.md +0 -119
- package/docs/tutorials/offline.md +0 -683
- package/docs/tutorials/plugins.md +0 -184
- package/docs/tutorials/selenium-grid-config.md +0 -174
- package/docs/tutorials/service-worker.md +0 -106
- package/docs/tutorials/ui-customization.md +0 -288
- package/docs/tutorials/ui.md +0 -230
- package/docs/tutorials/upgrade-manifest.md +0 -281
- package/docs/tutorials/upgrade.md +0 -104
- package/docs/tutorials/welcome.md +0 -108
- package/docs/tutorials/widevine-service-certs.md +0 -45
- package/karma.conf.js +0 -879
- package/maintained-branches.md +0 -15
- package/roadmap.md +0 -186
- package/test/abr/simple_abr_manager_unit.js +0 -398
- package/test/ads/ad_manager_unit.js +0 -260
- package/test/assumptions/uint8_array_unit.js +0 -22
- package/test/cast/cast_proxy_unit.js +0 -736
- package/test/cast/cast_receiver_integration.js +0 -488
- package/test/cast/cast_receiver_unit.js +0 -1183
- package/test/cast/cast_sender_unit.js +0 -973
- package/test/cast/cast_utils_unit.js +0 -311
- package/test/cea/cea608_memory_unit.js +0 -411
- package/test/cea/cea708_service_unit.js +0 -674
- package/test/cea/cea708_window_unit.js +0 -373
- package/test/cea/cea_decoder_unit.js +0 -615
- package/test/cea/dtvcc_packet_builder_unit.js +0 -158
- package/test/cea/dtvcc_packet_unit.js +0 -60
- package/test/cea/mp4_cea_parser_unit.js +0 -127
- package/test/codec_switching/codec_switching_integration.js +0 -182
- package/test/dash/dash_parser_content_protection_unit.js +0 -998
- package/test/dash/dash_parser_integration.js +0 -74
- package/test/dash/dash_parser_live_unit.js +0 -1542
- package/test/dash/dash_parser_manifest_unit.js +0 -3121
- package/test/dash/dash_parser_segment_base_unit.js +0 -421
- package/test/dash/dash_parser_segment_list_unit.js +0 -380
- package/test/dash/dash_parser_segment_template_unit.js +0 -910
- package/test/dash/mpd_utils_unit.js +0 -794
- package/test/demo/demo_unit.js +0 -108
- package/test/deprecate/enforcer_unit.js +0 -74
- package/test/deprecate/version_unit.js +0 -57
- package/test/hls/hls_live_unit.js +0 -1330
- package/test/hls/hls_parser_unit.js +0 -5276
- package/test/hls/manifest_text_parser_unit.js +0 -545
- package/test/media/adaptation_set_criteria_unit.js +0 -806
- package/test/media/adaptation_set_unit.js +0 -229
- package/test/media/buffering_observer_unit.js +0 -143
- package/test/media/closed_caption_parser_unit.js +0 -18
- package/test/media/content_workarounds_unit.js +0 -43
- package/test/media/drm_engine_integration.js +0 -356
- package/test/media/drm_engine_unit.js +0 -2778
- package/test/media/media_source_engine_integration.js +0 -691
- package/test/media/media_source_engine_unit.js +0 -1512
- package/test/media/mp4_segment_index_parser_unit.js +0 -80
- package/test/media/play_rate_controller_unit.js +0 -69
- package/test/media/playhead_unit.js +0 -1394
- package/test/media/presentation_timeline_unit.js +0 -477
- package/test/media/quality_observer_unit.js +0 -138
- package/test/media/region_observer_unit.js +0 -374
- package/test/media/region_timeline_unit.js +0 -139
- package/test/media/segment_index_unit.js +0 -1080
- package/test/media/segment_prefetch_unit.js +0 -243
- package/test/media/segment_reference_unit.js +0 -63
- package/test/media/stall_detector_unit.js +0 -184
- package/test/media/streaming_engine_integration.js +0 -632
- package/test/media/streaming_engine_unit.js +0 -4211
- package/test/media/time_ranges_utils_unit.js +0 -123
- package/test/media/webm_segment_index_parser_unit.js +0 -90
- package/test/mss/mss_parser_content_protection_unit.js +0 -49
- package/test/mss/mss_parser_unit.js +0 -474
- package/test/mss/mss_player_integration.js +0 -124
- package/test/net/data_uri_plugin_unit.js +0 -105
- package/test/net/http_plugin_unit.js +0 -439
- package/test/net/networking_engine_unit.js +0 -1236
- package/test/net/networking_utils_unit.js +0 -37
- package/test/offline/download_progress_estimator_unit.js +0 -90
- package/test/offline/indexeddb_storage_unit.js +0 -192
- package/test/offline/manifest_convert_unit.js +0 -622
- package/test/offline/offline_integration.js +0 -168
- package/test/offline/offline_manifest_parser_unit.js +0 -231
- package/test/offline/offline_scheme_unit.js +0 -154
- package/test/offline/offline_uri_unit.js +0 -59
- package/test/offline/storage_compatibility_unit.js +0 -344
- package/test/offline/storage_integration.js +0 -1858
- package/test/player_external.js +0 -237
- package/test/player_integration.js +0 -1371
- package/test/player_load_graph_integration.js +0 -865
- package/test/player_src_equals_external.js +0 -154
- package/test/player_src_equals_integration.js +0 -527
- package/test/player_unit.js +0 -4434
- package/test/polyfill/media_capabilities_unit.js +0 -277
- package/test/polyfill/patchedmediakeys_apple_unit.js +0 -130
- package/test/test/assets/3675/chunk-stream0-00001.m4s +0 -0
- package/test/test/assets/3675/chunk-stream0-00002.m4s +0 -0
- package/test/test/assets/3675/chunk-stream0-00003.m4s +0 -0
- package/test/test/assets/3675/chunk-stream0-00004.m4s +0 -0
- package/test/test/assets/3675/chunk-stream0-00005.m4s +0 -0
- package/test/test/assets/3675/chunk-stream0-00006.m4s +0 -0
- package/test/test/assets/3675/chunk-stream0-00007.m4s +0 -0
- package/test/test/assets/3675/dash_0.mpd +0 -30
- package/test/test/assets/3675/dash_1.mpd +0 -30
- package/test/test/assets/3675/dash_2.mpd +0 -30
- package/test/test/assets/3675/dash_3.mpd +0 -30
- package/test/test/assets/3675/dash_4.mpd +0 -30
- package/test/test/assets/3675/dash_5.mpd +0 -26
- package/test/test/assets/3675/init-stream0.m4s +0 -0
- package/test/test/assets/audio-xhe-aac.mp4 +0 -0
- package/test/test/assets/audio.ts +0 -0
- package/test/test/assets/captions-test.ts +0 -0
- package/test/test/assets/cea-init.mp4 +0 -0
- package/test/test/assets/cea-segment.mp4 +0 -0
- package/test/test/assets/chapters.srt +0 -11
- package/test/test/assets/chapters.vtt +0 -10
- package/test/test/assets/chapters2.vtt +0 -10
- package/test/test/assets/dash-aes-128/Fragments(video=0,format=mpd-time-csf) +0 -0
- package/test/test/assets/dash-aes-128/Fragments(video=20000000,format=mpd-time-csf) +0 -0
- package/test/test/assets/dash-aes-128/Fragments(video=40000000,format=mpd-time-csf) +0 -0
- package/test/test/assets/dash-aes-128/Fragments(video=60000000,format=mpd-time-csf) +0 -0
- package/test/test/assets/dash-aes-128/Fragments(video=i,format=mpd-time-csf) +0 -0
- package/test/test/assets/dash-aes-128/dash.mpd +0 -18
- package/test/test/assets/dash-aes-128/license +0 -1
- package/test/test/assets/dash-multi-codec/audio_en_2c_128k_aac.mp4 +0 -0
- package/test/test/assets/dash-multi-codec/audio_es_2c_64k_opus.webm +0 -0
- package/test/test/assets/dash-multi-codec/dash.mpd +0 -32
- package/test/test/assets/dash-multi-codec/video_144p_108k_h264.mp4 +0 -0
- package/test/test/assets/db-dump-v1.json +0 -1
- package/test/test/assets/db-dump-v2-broken.json +0 -1
- package/test/test/assets/db-dump-v2-clean.json +0 -1
- package/test/test/assets/db-dump-v3.json +0 -1
- package/test/test/assets/db-dump-v4-broken.json +0 -1
- package/test/test/assets/db-dump-v5.json +0 -1
- package/test/test/assets/empty_caption_video_init.mp4 +0 -0
- package/test/test/assets/empty_caption_video_segment.mp4 +0 -0
- package/test/test/assets/encrypted-sintel-audio-init.mp4 +0 -0
- package/test/test/assets/encrypted-sintel-audio-segment.mp4 +0 -0
- package/test/test/assets/encrypted-sintel-video-init.mp4 +0 -0
- package/test/test/assets/encrypted-sintel-video-segment.mp4 +0 -0
- package/test/test/assets/green-pixel.mp4 +0 -0
- package/test/test/assets/green-pixel.txt +0 -15
- package/test/test/assets/h265-cea-init.mp4 +0 -0
- package/test/test/assets/h265-cea-segment.mp4 +0 -0
- package/test/test/assets/hls-raw-aac/fileSequence0.aac +0 -0
- package/test/test/assets/hls-raw-aac/fileSequence1.aac +0 -0
- package/test/test/assets/hls-raw-aac/fileSequence2.aac +0 -0
- package/test/test/assets/hls-raw-aac/fileSequence3.aac +0 -0
- package/test/test/assets/hls-raw-aac/manifest.m3u8 +0 -4
- package/test/test/assets/hls-raw-aac/stream.m4a.m3u8 +0 -14
- package/test/test/assets/hls-raw-ac3/fileSequence0.ac3 +0 -0
- package/test/test/assets/hls-raw-ac3/fileSequence1.ac3 +0 -0
- package/test/test/assets/hls-raw-ac3/fileSequence2.ac3 +0 -0
- package/test/test/assets/hls-raw-ac3/fileSequence3.ac3 +0 -0
- package/test/test/assets/hls-raw-ac3/fileSequence4.ac3 +0 -0
- package/test/test/assets/hls-raw-ac3/fileSequence5.ac3 +0 -0
- package/test/test/assets/hls-raw-ac3/fileSequence6.ac3 +0 -0
- package/test/test/assets/hls-raw-ac3/fileSequence7.ac3 +0 -0
- package/test/test/assets/hls-raw-ac3/prog_index.m3u8 +0 -31
- package/test/test/assets/hls-raw-ec3/fileSequence0.ec3 +0 -0
- package/test/test/assets/hls-raw-ec3/fileSequence1.ec3 +0 -0
- package/test/test/assets/hls-raw-ec3/fileSequence2.ec3 +0 -0
- package/test/test/assets/hls-raw-ec3/fileSequence3.ec3 +0 -0
- package/test/test/assets/hls-raw-ec3/fileSequence4.ec3 +0 -0
- package/test/test/assets/hls-raw-ec3/fileSequence5.ec3 +0 -0
- package/test/test/assets/hls-raw-ec3/fileSequence6.ec3 +0 -0
- package/test/test/assets/hls-raw-ec3/fileSequence7.ec3 +0 -0
- package/test/test/assets/hls-raw-ec3/prog_index.m3u8 +0 -31
- package/test/test/assets/hls-raw-mp3/chunklist_w905519204.m3u8 +0 -13
- package/test/test/assets/hls-raw-mp3/media_w905519204_0.mp3 +0 -0
- package/test/test/assets/hls-raw-mp3/media_w905519204_1.mp3 +0 -0
- package/test/test/assets/hls-raw-mp3/media_w905519204_2.mp3 +0 -0
- package/test/test/assets/hls-raw-mp3/media_w905519204_3.mp3 +0 -0
- package/test/test/assets/hls-raw-mp3/playlist.m3u8 +0 -4
- package/test/test/assets/hls-ts-aac/playlist.m3u8 +0 -23
- package/test/test/assets/hls-ts-aac/segment_0.ts +0 -0
- package/test/test/assets/hls-ts-aac/segment_1.ts +0 -0
- package/test/test/assets/hls-ts-aac/segment_2.ts +0 -0
- package/test/test/assets/hls-ts-aac/segment_3.ts +0 -0
- package/test/test/assets/hls-ts-aac/segment_4.ts +0 -0
- package/test/test/assets/hls-ts-aac/segment_5.ts +0 -0
- package/test/test/assets/hls-ts-aac/segment_6.ts +0 -0
- package/test/test/assets/hls-ts-aac/segment_7.ts +0 -0
- package/test/test/assets/hls-ts-ac3/ChID_voices_6ch_640kbps_dd_sub_0000.ts +0 -0
- package/test/test/assets/hls-ts-ac3/ChID_voices_6ch_640kbps_dd_sub_0001.ts +0 -0
- package/test/test/assets/hls-ts-ac3/ChID_voices_6ch_640kbps_dd_sub_0002.ts +0 -0
- package/test/test/assets/hls-ts-ac3/ChID_voices_6ch_640kbps_dd_sub_0003.ts +0 -0
- package/test/test/assets/hls-ts-ac3/ChID_voices_6ch_640kbps_dd_sub_0004.ts +0 -0
- package/test/test/assets/hls-ts-ac3/ChID_voices_6ch_640kbps_dd_sub_0005.ts +0 -0
- package/test/test/assets/hls-ts-ac3/prog_index.m3u8 +0 -19
- package/test/test/assets/hls-ts-ec3/ChID_voices_6ch_256kbps_ddp_sub_0000.ts +0 -0
- package/test/test/assets/hls-ts-ec3/ChID_voices_6ch_256kbps_ddp_sub_0001.ts +0 -0
- package/test/test/assets/hls-ts-ec3/ChID_voices_6ch_256kbps_ddp_sub_0002.ts +0 -0
- package/test/test/assets/hls-ts-ec3/ChID_voices_6ch_256kbps_ddp_sub_0003.ts +0 -0
- package/test/test/assets/hls-ts-ec3/ChID_voices_6ch_256kbps_ddp_sub_0004.ts +0 -0
- package/test/test/assets/hls-ts-ec3/ChID_voices_6ch_256kbps_ddp_sub_0005.ts +0 -0
- package/test/test/assets/hls-ts-ec3/prog_index.m3u8 +0 -19
- package/test/test/assets/hls-ts-h264/fileSequence0.ts +0 -0
- package/test/test/assets/hls-ts-h264/fileSequence1.ts +0 -0
- package/test/test/assets/hls-ts-h264/fileSequence2.ts +0 -0
- package/test/test/assets/hls-ts-h264/fileSequence3.ts +0 -0
- package/test/test/assets/hls-ts-h264/fileSequence4.ts +0 -0
- package/test/test/assets/hls-ts-h264/fileSequence5.ts +0 -0
- package/test/test/assets/hls-ts-h264/prog_index.m3u8 +0 -25
- package/test/test/assets/hls-ts-h265/0.ts +0 -0
- package/test/test/assets/hls-ts-h265/hevc.m3u8 +0 -6
- package/test/test/assets/hls-ts-h265/index.m3u8 +0 -7
- package/test/test/assets/hls-ts-mp3/manifest.m3u8 +0 -13
- package/test/test/assets/hls-ts-mp3/media_w239891843_0.ts +0 -0
- package/test/test/assets/hls-ts-mp3/media_w239891843_1.ts +0 -0
- package/test/test/assets/hls-ts-mp3/media_w239891843_2.ts +0 -0
- package/test/test/assets/hls-ts-mp3/media_w239891843_3.ts +0 -0
- package/test/test/assets/hls-ts-muxed-aac-h264/chunk.m3u8 +0 -17
- package/test/test/assets/hls-ts-muxed-aac-h264/n_0_0_0.ts +0 -0
- package/test/test/assets/hls-ts-muxed-aac-h264/n_1_0_0.ts +0 -0
- package/test/test/assets/hls-ts-muxed-aac-h264/n_2_0_0.ts +0 -0
- package/test/test/assets/hls-ts-muxed-aac-h264/n_3_0_0.ts +0 -0
- package/test/test/assets/hls-ts-muxed-aac-h264/n_4_0_0.ts +0 -0
- package/test/test/assets/hls-ts-muxed-aac-h264/n_5_0_0.ts +0 -0
- package/test/test/assets/hls-ts-muxed-aac-h264/playlist.m3u8 +0 -4
- package/test/test/assets/hls-ts-muxed-aac-h265/0.ts +0 -0
- package/test/test/assets/hls-ts-muxed-aac-h265/1.ts +0 -0
- package/test/test/assets/hls-ts-muxed-aac-h265/media.m3u8 +0 -9
- package/test/test/assets/hls-ts-muxed-ac3-h264/media.m3u8 +0 -24
- package/test/test/assets/hls-ts-muxed-ac3-h264/s_00000.ts +0 -0
- package/test/test/assets/hls-ts-muxed-ac3-h264/s_00001.ts +0 -0
- package/test/test/assets/hls-ts-muxed-ac3-h264/s_00002.ts +0 -0
- package/test/test/assets/hls-ts-muxed-ac3-h264/s_00003.ts +0 -0
- package/test/test/assets/hls-ts-muxed-ac3-h264/s_00004.ts +0 -0
- package/test/test/assets/hls-ts-muxed-ac3-h264/s_00005.ts +0 -0
- package/test/test/assets/hls-ts-muxed-ec3-h264/ChID_voices_1280x720p_25fps_h264_6ch_256kbps_ddp_sub_0000.ts +0 -0
- package/test/test/assets/hls-ts-muxed-ec3-h264/ChID_voices_1280x720p_25fps_h264_6ch_256kbps_ddp_sub_0001.ts +0 -0
- package/test/test/assets/hls-ts-muxed-ec3-h264/ChID_voices_1280x720p_25fps_h264_6ch_256kbps_ddp_sub_0002.ts +0 -0
- package/test/test/assets/hls-ts-muxed-ec3-h264/ChID_voices_1280x720p_25fps_h264_6ch_256kbps_ddp_sub_0003.ts +0 -0
- package/test/test/assets/hls-ts-muxed-ec3-h264/prog_index.m3u8 +0 -14
- package/test/test/assets/hls-ts-muxed-mp3-h264/index.m3u8 +0 -23
- package/test/test/assets/hls-ts-muxed-mp3-h264/seg-1-v1-a1.ts +0 -0
- package/test/test/assets/hls-ts-muxed-mp3-h264/seg-2-v1-a1.ts +0 -0
- package/test/test/assets/hls-ts-muxed-mp3-h264/seg-3-v1-a1.ts +0 -0
- package/test/test/assets/hls-ts-muxed-mp3-h264/seg-4-v1-a1.ts +0 -0
- package/test/test/assets/hls-ts-muxed-mp3-h264/seg-5-v1-a1.ts +0 -0
- package/test/test/assets/hls-ts-muxed-mp3-h264/seg-6-v1-a1.ts +0 -0
- package/test/test/assets/hls-ts-muxed-mp3-h264/seg-7-v1-a1.ts +0 -0
- package/test/test/assets/hls-ts-muxed-mp3-h264/seg-8-v1-a1.ts +0 -0
- package/test/test/assets/id3-metadata.aac +0 -0
- package/test/test/assets/id3-metadata.ts +0 -0
- package/test/test/assets/index-segment.mp4 +0 -0
- package/test/test/assets/index-segment.webm +0 -0
- package/test/test/assets/init-segment.webm +0 -0
- package/test/test/assets/large_file.mpd +0 -4930
- package/test/test/assets/multidrm-audio-init.mp4 +0 -0
- package/test/test/assets/multidrm-audio-segment.mp4 +0 -0
- package/test/test/assets/multidrm-video-init.mp4 +0 -0
- package/test/test/assets/multidrm-video-segment.mp4 +0 -0
- package/test/test/assets/multiple-trun-init.mp4 +0 -0
- package/test/test/assets/multiple-trun-segment.mp4 +0 -0
- package/test/test/assets/sintel-audio-init.mp4 +0 -0
- package/test/test/assets/sintel-audio-segment.mp4 +0 -0
- package/test/test/assets/sintel-video-init.mp4 +0 -0
- package/test/test/assets/sintel-video-segment.mp4 +0 -0
- package/test/test/assets/small.mp4 +0 -0
- package/test/test/assets/text-clip-alt.vtt +0 -63
- package/test/test/assets/text-clip.vtt +0 -63
- package/test/test/assets/thumbnails-sprites.vtt +0 -10
- package/test/test/assets/thumbnails.vtt +0 -10
- package/test/test/assets/ttml-init.mp4 +0 -0
- package/test/test/assets/ttml-segment-multiplemdat.mp4 +0 -0
- package/test/test/assets/ttml-segment.mp4 +0 -0
- package/test/test/assets/video.ts +0 -0
- package/test/test/assets/vtt-init.mp4 +0 -0
- package/test/test/assets/vtt-segment-multi-payload.mp4 +0 -0
- package/test/test/assets/vtt-segment-no-duration.mp4 +0 -0
- package/test/test/assets/vtt-segment-settings.mp4 +0 -0
- package/test/test/assets/vtt-segment.mp4 +0 -0
- package/test/test/boot.js +0 -495
- package/test/test/externs/filters.js +0 -44
- package/test/test/externs/fontfaceonload.js +0 -29
- package/test/test/externs/jasmine.js +0 -670
- package/test/test/externs/karma.js +0 -26
- package/test/test/externs/require.js +0 -21
- package/test/test/externs/sprintf.js +0 -18
- package/test/test/namespace.js +0 -10
- package/test/test/util/canned_idb.js +0 -379
- package/test/test/util/cea_utils.js +0 -60
- package/test/test/util/dash_parser_util.js +0 -329
- package/test/test/util/fake_ad.js +0 -321
- package/test/test/util/fake_ad_manager.js +0 -122
- package/test/test/util/fake_demo_main.js +0 -144
- package/test/test/util/fake_drm_engine.js +0 -103
- package/test/test/util/fake_media_source_engine.js +0 -464
- package/test/test/util/fake_networking_engine.js +0 -381
- package/test/test/util/fake_segment_prefetch.js +0 -84
- package/test/test/util/fake_text_displayer.js +0 -60
- package/test/test/util/id3_generator.js +0 -100
- package/test/test/util/indexeddb_utils.js +0 -124
- package/test/test/util/jasmine_fetch.js +0 -382
- package/test/test/util/layout_tests.js +0 -434
- package/test/test/util/loader.js +0 -88
- package/test/test/util/manifest_generator.js +0 -705
- package/test/test/util/manifest_parser_util.js +0 -101
- package/test/test/util/mss_parser_util.js +0 -119
- package/test/test/util/offline_utils.js +0 -105
- package/test/test/util/simple_fakes.js +0 -535
- package/test/test/util/stream_generator.js +0 -676
- package/test/test/util/streaming_engine_util.js +0 -506
- package/test/test/util/test_scheme.js +0 -778
- package/test/test/util/ttml_utils.js +0 -77
- package/test/test/util/ui_utils.js +0 -183
- package/test/test/util/util.js +0 -374
- package/test/test/util/waiter.js +0 -406
- package/test/text/cue_integration.js +0 -51
- package/test/text/lrc_text_parser_unit.js +0 -98
- package/test/text/mp4_ttml_parser_unit.js +0 -171
- package/test/text/mp4_vtt_parser_unit.js +0 -195
- package/test/text/sbv_text_parser_unit.js +0 -81
- package/test/text/simple_text_displayer_unit.js +0 -468
- package/test/text/srt_text_parser_unit.js +0 -163
- package/test/text/ssa_text_parser_unit.js +0 -382
- package/test/text/text_displayer_layout_unit.js +0 -323
- package/test/text/text_engine_unit.js +0 -500
- package/test/text/text_track_integration.js +0 -186
- package/test/text/ttml_text_parser_unit.js +0 -2176
- package/test/text/ui_text_displayer_unit.js +0 -608
- package/test/text/vtt_text_parser_unit.js +0 -1363
- package/test/text/web_vtt_generator_unit.js +0 -144
- package/test/text/web_vtt_layout_integration.js +0 -524
- package/test/transmuxer/transmuxer_engine_integration.js +0 -69
- package/test/transmuxer/transmuxer_integration.js +0 -443
- package/test/ui/ad_ui_unit.js +0 -369
- package/test/ui/localization_unit.js +0 -508
- package/test/ui/ui_customization_unit.js +0 -208
- package/test/ui/ui_integration.js +0 -669
- package/test/ui/ui_unit.js +0 -902
- package/test/util/abortable_operation_unit.js +0 -624
- package/test/util/array_utils_unit.js +0 -58
- package/test/util/buffer_utils_unit.js +0 -185
- package/test/util/cmcd_manager_unit.js +0 -440
- package/test/util/content_steering_manager_unit.js +0 -427
- package/test/util/data_view_reader_unit.js +0 -254
- package/test/util/ebml_parser_unit.js +0 -297
- package/test/util/event_manager_unit.js +0 -185
- package/test/util/fake_event_target_unit.js +0 -123
- package/test/util/id3_utils_unit.js +0 -168
- package/test/util/iterables_unit.js +0 -68
- package/test/util/language_utils_unit.js +0 -240
- package/test/util/manifest_parser_utils_unit.js +0 -55
- package/test/util/mime_utils_unit.js +0 -64
- package/test/util/mp4_box_parsers_unit.js +0 -246
- package/test/util/mp4_parser_unit.js +0 -373
- package/test/util/multi_map_unit.js +0 -94
- package/test/util/object_utils_unit.js +0 -79
- package/test/util/periods_unit.js +0 -1623
- package/test/util/pssh_unit.js +0 -226
- package/test/util/state_history_unit.js +0 -101
- package/test/util/stream_utils_unit.js +0 -1068
- package/test/util/string_utils_unit.js +0 -166
- package/test/util/text_parser_unit.js +0 -165
- package/test/util/ts_parser_unit.js +0 -77
- package/test/util/xml_utils_unit.js +0 -444
package/demo/custom.js
DELETED
|
@@ -1,907 +0,0 @@
|
|
|
1
|
-
/*! @license
|
|
2
|
-
* Shaka Player
|
|
3
|
-
* Copyright 2016 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
goog.provide('shakaDemo.Custom');
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
goog.require('ShakaDemoAssetInfo');
|
|
12
|
-
goog.require('shakaDemo.AssetCard');
|
|
13
|
-
goog.require('shakaDemo.Input');
|
|
14
|
-
goog.require('shakaDemo.InputContainer');
|
|
15
|
-
goog.require('shakaDemo.TextInput');
|
|
16
|
-
|
|
17
|
-
/** @type {?shakaDemo.Custom} */
|
|
18
|
-
let shakaDemoCustom;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Shaka Player demo, custom asset page layout.
|
|
23
|
-
*/
|
|
24
|
-
shakaDemo.Custom = class {
|
|
25
|
-
/**
|
|
26
|
-
* Register the page configuration.
|
|
27
|
-
*/
|
|
28
|
-
static init() {
|
|
29
|
-
const elements = shakaDemoMain.addNavButton('custom');
|
|
30
|
-
shakaDemoCustom = new shakaDemo.Custom(elements.container);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/** @param {!Element} container */
|
|
34
|
-
constructor(container) {
|
|
35
|
-
/** @private {!HTMLDialogElement} */
|
|
36
|
-
this.dialog_ =
|
|
37
|
-
/** @type {!HTMLDialogElement} */(document.createElement('dialog'));
|
|
38
|
-
|
|
39
|
-
this.dialog_.classList.add('mdl-dialog');
|
|
40
|
-
container.appendChild(this.dialog_);
|
|
41
|
-
if (!this.dialog_.showModal) {
|
|
42
|
-
dialogPolyfill.registerDialog(this.dialog_);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/** @private {!Set.<!ShakaDemoAssetInfo>} */
|
|
46
|
-
this.assets_ = this.loadAssetInfos_();
|
|
47
|
-
|
|
48
|
-
/** @private {!HTMLInputElement} */
|
|
49
|
-
this.manifestField_;
|
|
50
|
-
|
|
51
|
-
/** @private {!Array.<!shakaDemo.AssetCard>} */
|
|
52
|
-
this.assetCards_ = [];
|
|
53
|
-
this.savedList_ = document.createElement('div');
|
|
54
|
-
container.appendChild(this.savedList_);
|
|
55
|
-
|
|
56
|
-
// Add the "new" button, which shows the dialog.
|
|
57
|
-
const addButtonContainer = document.createElement('div');
|
|
58
|
-
addButtonContainer.classList.add('add-button-container');
|
|
59
|
-
container.appendChild(addButtonContainer);
|
|
60
|
-
// Style it as an MDL Floating Action Button (FAB).
|
|
61
|
-
const buttonStyle = shakaDemo.Custom.ButtonStyle_.FAB;
|
|
62
|
-
const addButton = this.makeButton_('add', buttonStyle, () => {
|
|
63
|
-
this.showAssetDialog_(ShakaDemoAssetInfo.makeBlankAsset());
|
|
64
|
-
});
|
|
65
|
-
addButtonContainer.appendChild(addButton);
|
|
66
|
-
|
|
67
|
-
document.addEventListener('shaka-main-selected-asset-changed', () => {
|
|
68
|
-
this.updateSelected_();
|
|
69
|
-
});
|
|
70
|
-
document.addEventListener('shaka-main-offline-progress', () => {
|
|
71
|
-
this.updateOfflineProgress_();
|
|
72
|
-
});
|
|
73
|
-
document.addEventListener('shaka-main-page-changed', () => {
|
|
74
|
-
if (!this.savedList_.childNodes.length &&
|
|
75
|
-
!container.classList.contains('hidden')) {
|
|
76
|
-
// Now that the page is showing, create the contents that we deferred
|
|
77
|
-
// until now.
|
|
78
|
-
this.remakeSavedList_();
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/** @return {!Array.<!ShakaDemoAssetInfo>} */
|
|
84
|
-
assets() {
|
|
85
|
-
return Array.from(this.assets_);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Updates progress bars on asset cards.
|
|
90
|
-
* @private
|
|
91
|
-
*/
|
|
92
|
-
updateOfflineProgress_() {
|
|
93
|
-
for (const card of this.assetCards_) {
|
|
94
|
-
card.updateProgress();
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* A utility to simplify the creation of fields on the dialog.
|
|
100
|
-
* @param {!shakaDemo.InputContainer} container
|
|
101
|
-
* @param {string} name
|
|
102
|
-
* @param {function(!HTMLInputElement, !Element)} setup
|
|
103
|
-
* @param {function(!Element, !shakaDemo.Input)} onChange
|
|
104
|
-
* @param {boolean=} isTextArea
|
|
105
|
-
* @private
|
|
106
|
-
*/
|
|
107
|
-
makeField_(container, name, setup, onChange, isTextArea) {
|
|
108
|
-
container.addRow(/* labelString= */ null, /* tooltipString= */ null);
|
|
109
|
-
const input =
|
|
110
|
-
new shakaDemo.TextInput(container, name, onChange, isTextArea);
|
|
111
|
-
input.extra().textContent = name;
|
|
112
|
-
setup(input.input(), input.container());
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* @param {!ShakaDemoAssetInfo} assetInProgress
|
|
117
|
-
* @param {!Array.<!HTMLInputElement>} inputsToCheck
|
|
118
|
-
* @return {!Element} div
|
|
119
|
-
* @private
|
|
120
|
-
*/
|
|
121
|
-
makeAssetDialogContentsHeaders_(assetInProgress, inputsToCheck) {
|
|
122
|
-
const headersDiv = document.createElement('div');
|
|
123
|
-
|
|
124
|
-
// Because this field can theoretically contain an unlimited number of
|
|
125
|
-
// values, it has to take up an entire section by itself.
|
|
126
|
-
const makeEmptyRow = () => {
|
|
127
|
-
makePreFilledRow(/* headerName= */ null, /* headerValue= */ null);
|
|
128
|
-
};
|
|
129
|
-
/**
|
|
130
|
-
* @type {!Array.<{
|
|
131
|
-
* headerName: ?string,
|
|
132
|
-
* div: !Element,
|
|
133
|
-
* }>}
|
|
134
|
-
*/
|
|
135
|
-
const collisionCheckEntries = [];
|
|
136
|
-
/** @type {function(?string, ?string)} */
|
|
137
|
-
const makePreFilledRow = (headerName, headerValue) => {
|
|
138
|
-
const div = document.createElement('div');
|
|
139
|
-
headersDiv.appendChild(div);
|
|
140
|
-
const containerStyle = shakaDemo.InputContainer.Style.VERTICAL;
|
|
141
|
-
const container = new shakaDemo.InputContainer(
|
|
142
|
-
div, 'License Header', containerStyle,
|
|
143
|
-
/* docLink= */ null);
|
|
144
|
-
|
|
145
|
-
const collisionCheckEntry = {
|
|
146
|
-
headerName,
|
|
147
|
-
div,
|
|
148
|
-
};
|
|
149
|
-
collisionCheckEntries.push(collisionCheckEntry);
|
|
150
|
-
|
|
151
|
-
// Don't add a new row for a row that was pre-filled.
|
|
152
|
-
let firstTime = !headerName;
|
|
153
|
-
const onChange = (newHeaderName, newHeaderValue) => {
|
|
154
|
-
if (headerName) {
|
|
155
|
-
// In case the header named changed, remove the old header.
|
|
156
|
-
assetInProgress.licenseRequestHeaders.delete(headerName);
|
|
157
|
-
}
|
|
158
|
-
// Set the new values.
|
|
159
|
-
headerName = newHeaderName;
|
|
160
|
-
collisionCheckEntry.headerName = newHeaderName;
|
|
161
|
-
headerValue = newHeaderValue;
|
|
162
|
-
if (!headerName || !headerValue) {
|
|
163
|
-
if (!firstTime) {
|
|
164
|
-
// The user has set a field that used to be filled to empty.
|
|
165
|
-
// This signals that they probably want to remove this header.
|
|
166
|
-
headersDiv.removeChild(div);
|
|
167
|
-
}
|
|
168
|
-
return;
|
|
169
|
-
}
|
|
170
|
-
if (firstTime) {
|
|
171
|
-
firstTime = false;
|
|
172
|
-
// You have filled out this row for the first time; add a new row, in
|
|
173
|
-
// case the user wants to add more headers.
|
|
174
|
-
makeEmptyRow();
|
|
175
|
-
// Update the componentHandler, to account for the new MDL elements.
|
|
176
|
-
componentHandler.upgradeDom();
|
|
177
|
-
}
|
|
178
|
-
assetInProgress.addLicenseRequestHeader(headerName, headerValue);
|
|
179
|
-
// Eliminate any OTHER header with the same name. Assume this newly
|
|
180
|
-
// added/modified one is the "correct" one.
|
|
181
|
-
for (const entry of collisionCheckEntries) {
|
|
182
|
-
if (entry == collisionCheckEntry) {
|
|
183
|
-
// You can't "collide" with yourself.
|
|
184
|
-
continue;
|
|
185
|
-
}
|
|
186
|
-
if (headerName != entry.headerName) {
|
|
187
|
-
// It's not a collision.
|
|
188
|
-
continue;
|
|
189
|
-
}
|
|
190
|
-
// Remove the entry for the old field from the array.
|
|
191
|
-
const idx = collisionCheckEntries.indexOf(entry);
|
|
192
|
-
collisionCheckEntries.splice(idx, 1);
|
|
193
|
-
// Remove the div for the old field from the overall headers div.
|
|
194
|
-
headersDiv.removeChild(entry.div);
|
|
195
|
-
break;
|
|
196
|
-
}
|
|
197
|
-
};
|
|
198
|
-
|
|
199
|
-
const nameSetup = (input, container) => {
|
|
200
|
-
if (headerName) {
|
|
201
|
-
input.value = headerName;
|
|
202
|
-
}
|
|
203
|
-
};
|
|
204
|
-
const nameOnChange = (input) => {
|
|
205
|
-
onChange(input.value, headerValue);
|
|
206
|
-
};
|
|
207
|
-
this.makeField_(container, 'Header Name', nameSetup, nameOnChange);
|
|
208
|
-
|
|
209
|
-
const valueSetup = (input, container) => {
|
|
210
|
-
if (headerValue) {
|
|
211
|
-
input.value = headerValue;
|
|
212
|
-
}
|
|
213
|
-
};
|
|
214
|
-
const valueOnChange = (input) => {
|
|
215
|
-
onChange(headerName, input.value);
|
|
216
|
-
};
|
|
217
|
-
this.makeField_(container, 'Header Value', valueSetup, valueOnChange);
|
|
218
|
-
};
|
|
219
|
-
if (assetInProgress.licenseRequestHeaders.size == 0) {
|
|
220
|
-
// It starts out with a single empty row, but each time you start filling
|
|
221
|
-
// out one for the first time it adds a new one. Empty rows are ignored in
|
|
222
|
-
// the actual data.
|
|
223
|
-
makeEmptyRow();
|
|
224
|
-
} else {
|
|
225
|
-
// Make a row for each header.
|
|
226
|
-
for (const headerName of assetInProgress.licenseRequestHeaders.keys()) {
|
|
227
|
-
makePreFilledRow(
|
|
228
|
-
headerName, assetInProgress.licenseRequestHeaders.get(headerName));
|
|
229
|
-
}
|
|
230
|
-
// ...and also an empty one at the end.
|
|
231
|
-
makeEmptyRow();
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
return headersDiv;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
/**
|
|
239
|
-
* @param {!ShakaDemoAssetInfo} assetInProgress
|
|
240
|
-
* @param {!Array.<!HTMLInputElement>} inputsToCheck
|
|
241
|
-
* @return {!Element} div
|
|
242
|
-
* @private
|
|
243
|
-
*/
|
|
244
|
-
makeAssetDialogContentsAds_(assetInProgress, inputsToCheck) {
|
|
245
|
-
const adsDiv = document.createElement('div');
|
|
246
|
-
const containerStyle = shakaDemo.InputContainer.Style.VERTICAL;
|
|
247
|
-
const container = new shakaDemo.InputContainer(
|
|
248
|
-
adsDiv, /* headerText= */ null, containerStyle,
|
|
249
|
-
/* docLink= */ null);
|
|
250
|
-
|
|
251
|
-
// Make the ad tag URL field.
|
|
252
|
-
const adTagSetup = (input, container) => {
|
|
253
|
-
if (assetInProgress.adTagUri) {
|
|
254
|
-
input.value = assetInProgress.adTagUri;
|
|
255
|
-
}
|
|
256
|
-
};
|
|
257
|
-
const adTagOnChange = (input) => {
|
|
258
|
-
assetInProgress.adTagUri = input.value;
|
|
259
|
-
};
|
|
260
|
-
this.makeField_(container, 'Ad Tag URL', adTagSetup, adTagOnChange);
|
|
261
|
-
|
|
262
|
-
// Make the content source id field.
|
|
263
|
-
const contentSrcIdSetup = (input, container) => {
|
|
264
|
-
if (assetInProgress.imaContentSrcId) {
|
|
265
|
-
input.value = assetInProgress.imaContentSrcId;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
this.manifestField_.required =
|
|
269
|
-
this.checkManifestRequired_(assetInProgress);
|
|
270
|
-
};
|
|
271
|
-
const contentSrcIdOnChange = (input) => {
|
|
272
|
-
assetInProgress.imaContentSrcId = input.value;
|
|
273
|
-
this.manifestField_.required =
|
|
274
|
-
this.checkManifestRequired_(assetInProgress);
|
|
275
|
-
};
|
|
276
|
-
const contentSrcIdName = 'Content source ID (for VOD DAI Content)';
|
|
277
|
-
this.makeField_(
|
|
278
|
-
container, contentSrcIdName, contentSrcIdSetup, contentSrcIdOnChange);
|
|
279
|
-
|
|
280
|
-
// Make the video id field.
|
|
281
|
-
const videoIdSetup = (input, container) => {
|
|
282
|
-
if (assetInProgress.imaVideoId) {
|
|
283
|
-
input.value = assetInProgress.imaVideoId;
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
this.manifestField_.required =
|
|
287
|
-
this.checkManifestRequired_(assetInProgress);
|
|
288
|
-
};
|
|
289
|
-
const videoIdOnChange = (input) => {
|
|
290
|
-
assetInProgress.imaVideoId = input.value;
|
|
291
|
-
this.manifestField_.required =
|
|
292
|
-
this.checkManifestRequired_(assetInProgress);
|
|
293
|
-
};
|
|
294
|
-
const videoIdName = 'Video ID (for VOD DAI Content)';
|
|
295
|
-
this.makeField_(container, videoIdName, videoIdSetup, videoIdOnChange);
|
|
296
|
-
|
|
297
|
-
// Make the asset key field.
|
|
298
|
-
const assetKeySetup = (input, container) => {
|
|
299
|
-
if (assetInProgress.imaAssetKey) {
|
|
300
|
-
input.value = assetInProgress.imaAssetKey;
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
this.manifestField_.required =
|
|
304
|
-
this.checkManifestRequired_(assetInProgress);
|
|
305
|
-
};
|
|
306
|
-
const assetKeyChange = (input) => {
|
|
307
|
-
assetInProgress.imaAssetKey = input.value;
|
|
308
|
-
this.manifestField_.required =
|
|
309
|
-
this.checkManifestRequired_(assetInProgress);
|
|
310
|
-
};
|
|
311
|
-
const assetKeyName = 'Asset key (for LIVE DAI Content)';
|
|
312
|
-
this.makeField_(container, assetKeyName, assetKeySetup, assetKeyChange);
|
|
313
|
-
|
|
314
|
-
// Make the manifest type field.
|
|
315
|
-
const manifestTypeSetup = (input, container) => {
|
|
316
|
-
if (assetInProgress.imaManifestType) {
|
|
317
|
-
input.value = assetInProgress.imaManifestType;
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
this.manifestField_.required =
|
|
321
|
-
this.checkManifestRequired_(assetInProgress);
|
|
322
|
-
};
|
|
323
|
-
const manifestTypeChange = (input) => {
|
|
324
|
-
assetInProgress.imaManifestType = input.value;
|
|
325
|
-
this.manifestField_.required =
|
|
326
|
-
this.checkManifestRequired_(assetInProgress);
|
|
327
|
-
};
|
|
328
|
-
const manifestTypeName = 'Manifest type (for DAI Content)';
|
|
329
|
-
this.makeField_(
|
|
330
|
-
container, manifestTypeName, manifestTypeSetup, manifestTypeChange);
|
|
331
|
-
|
|
332
|
-
// Make the MediaTailor URL field.
|
|
333
|
-
const mediaTailorSetup = (input, container) => {
|
|
334
|
-
if (assetInProgress.mediaTailorUrl) {
|
|
335
|
-
input.value = assetInProgress.mediaTailorUrl;
|
|
336
|
-
}
|
|
337
|
-
};
|
|
338
|
-
const mediaTailorOnChange = (input) => {
|
|
339
|
-
assetInProgress.setMediaTailor(input.value);
|
|
340
|
-
this.manifestField_.required =
|
|
341
|
-
this.checkManifestRequired_(assetInProgress);
|
|
342
|
-
};
|
|
343
|
-
const mediaTailorName = 'Media Tailor URL';
|
|
344
|
-
this.makeField_(
|
|
345
|
-
container, mediaTailorName, mediaTailorSetup, mediaTailorOnChange);
|
|
346
|
-
|
|
347
|
-
return adsDiv;
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
/**
|
|
351
|
-
* @param {!ShakaDemoAssetInfo} assetInProgress
|
|
352
|
-
* @param {!Array.<!HTMLInputElement>} inputsToCheck
|
|
353
|
-
* @return {!Element} div
|
|
354
|
-
* @private
|
|
355
|
-
*/
|
|
356
|
-
makeAssetDialogContentsDrm_(assetInProgress, inputsToCheck) {
|
|
357
|
-
const drmDiv = document.createElement('div');
|
|
358
|
-
const containerStyle = shakaDemo.InputContainer.Style.VERTICAL;
|
|
359
|
-
const container = new shakaDemo.InputContainer(
|
|
360
|
-
drmDiv, /* headerText= */ null, containerStyle,
|
|
361
|
-
/* docLink= */ null);
|
|
362
|
-
|
|
363
|
-
// The license server and drm system fields need to know each others
|
|
364
|
-
// contents, and react to each others changes, to work.
|
|
365
|
-
// To simplify things, this method picks out the process of setting license
|
|
366
|
-
// server URLs; it can be called within both fields.
|
|
367
|
-
let licenseServerUrlInput;
|
|
368
|
-
let customDrmSystemInput;
|
|
369
|
-
const setLicenseServerURLs = () => {
|
|
370
|
-
const licenseServerURL = licenseServerUrlInput.value;
|
|
371
|
-
const customDRMSystem = customDrmSystemInput.value;
|
|
372
|
-
if (licenseServerURL) {
|
|
373
|
-
assetInProgress.licenseServers.clear();
|
|
374
|
-
if (customDRMSystem) {
|
|
375
|
-
assetInProgress.licenseServers.set(customDRMSystem, licenseServerURL);
|
|
376
|
-
} else {
|
|
377
|
-
// Make a license server entry for every common DRM plugin.
|
|
378
|
-
for (const drmSystem of shakaDemo.Main.commonDrmSystems) {
|
|
379
|
-
assetInProgress.licenseServers.set(drmSystem, licenseServerURL);
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
} else {
|
|
383
|
-
assetInProgress.licenseServers.clear();
|
|
384
|
-
}
|
|
385
|
-
};
|
|
386
|
-
|
|
387
|
-
// Make the license server URL field.
|
|
388
|
-
const licenseSetup = (input, container) => {
|
|
389
|
-
licenseServerUrlInput = input;
|
|
390
|
-
const drmSystems = assetInProgress.licenseServers.keys();
|
|
391
|
-
// Custom assets have only a single license server URL, no matter how
|
|
392
|
-
// many key systems they have. Thus, it's safe to say that the license
|
|
393
|
-
// server URL associated with the first key system is the asset's
|
|
394
|
-
// over-all license server URL.
|
|
395
|
-
const drmSystem = drmSystems.next();
|
|
396
|
-
if (drmSystem && drmSystem.value) {
|
|
397
|
-
input.value = assetInProgress.licenseServers.get(drmSystem.value);
|
|
398
|
-
}
|
|
399
|
-
};
|
|
400
|
-
const licenseOnChange = (input) => {
|
|
401
|
-
setLicenseServerURLs();
|
|
402
|
-
};
|
|
403
|
-
this.makeField_(
|
|
404
|
-
container, 'Custom License Server URL', licenseSetup, licenseOnChange);
|
|
405
|
-
|
|
406
|
-
// Make the license certificate URL field.
|
|
407
|
-
const certSetup = (input, container) => {
|
|
408
|
-
if (assetInProgress.certificateUri) {
|
|
409
|
-
input.value = assetInProgress.certificateUri;
|
|
410
|
-
}
|
|
411
|
-
};
|
|
412
|
-
const certOnChange = (input) => {
|
|
413
|
-
assetInProgress.certificateUri = input.value;
|
|
414
|
-
};
|
|
415
|
-
this.makeField_(
|
|
416
|
-
container, 'Custom License Certificate URL', certSetup, certOnChange);
|
|
417
|
-
|
|
418
|
-
// Make the drm system field.
|
|
419
|
-
const drmSetup = (input, container) => {
|
|
420
|
-
customDrmSystemInput = input;
|
|
421
|
-
const drmSystems = assetInProgress.licenseServers.keys();
|
|
422
|
-
for (const drmSystem of drmSystems) {
|
|
423
|
-
if (!shakaDemo.Main.commonDrmSystems.includes(drmSystem)) {
|
|
424
|
-
input.value = drmSystem;
|
|
425
|
-
break;
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
};
|
|
429
|
-
const drmOnChange = (input) => {
|
|
430
|
-
setLicenseServerURLs();
|
|
431
|
-
};
|
|
432
|
-
this.makeField_(container, 'Custom DRM System', drmSetup, drmOnChange);
|
|
433
|
-
|
|
434
|
-
return drmDiv;
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
/**
|
|
438
|
-
* @param {!ShakaDemoAssetInfo} assetInProgress
|
|
439
|
-
* @param {!Array.<!HTMLInputElement>} inputsToCheck
|
|
440
|
-
* @return {!Element} div
|
|
441
|
-
* @private
|
|
442
|
-
*/
|
|
443
|
-
makeAssetDialogContentsExtraTracks_(assetInProgress, inputsToCheck) {
|
|
444
|
-
const extraTracksDiv = document.createElement('div');
|
|
445
|
-
const containerStyle = shakaDemo.InputContainer.Style.FLEX;
|
|
446
|
-
const container = new shakaDemo.InputContainer(
|
|
447
|
-
extraTracksDiv, /* headerText= */ null, containerStyle,
|
|
448
|
-
/* docLink= */ null);
|
|
449
|
-
container.getClassList().add('wide-input');
|
|
450
|
-
container.setDefaultRowClass('wide-input');
|
|
451
|
-
|
|
452
|
-
const thumbnailsUrlSetup = (input, container) => {
|
|
453
|
-
if (assetInProgress.extraThumbnail.length) {
|
|
454
|
-
input.value = assetInProgress.extraThumbnail[0];
|
|
455
|
-
}
|
|
456
|
-
};
|
|
457
|
-
const thumbnailsUrlOnChange = (input) => {
|
|
458
|
-
assetInProgress.extraThumbnail = [];
|
|
459
|
-
assetInProgress.addExtraThumbnail(input.value);
|
|
460
|
-
};
|
|
461
|
-
|
|
462
|
-
this.makeField_(
|
|
463
|
-
container, 'Thumbnails URL', thumbnailsUrlSetup, thumbnailsUrlOnChange);
|
|
464
|
-
|
|
465
|
-
return extraTracksDiv;
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
/**
|
|
469
|
-
* @param {!ShakaDemoAssetInfo} assetInProgress
|
|
470
|
-
* @param {!Array.<!HTMLInputElement>} inputsToCheck
|
|
471
|
-
* @return {!Element} div
|
|
472
|
-
* @private
|
|
473
|
-
*/
|
|
474
|
-
makeAssetDialogContentsExtra_(assetInProgress, inputsToCheck) {
|
|
475
|
-
const extraConfigDiv = document.createElement('div');
|
|
476
|
-
const containerStyle = shakaDemo.InputContainer.Style.FLEX;
|
|
477
|
-
const container = new shakaDemo.InputContainer(
|
|
478
|
-
extraConfigDiv, /* headerText= */ null, containerStyle,
|
|
479
|
-
/* docLink= */ null);
|
|
480
|
-
container.getClassList().add('wide-input');
|
|
481
|
-
container.setDefaultRowClass('wide-input');
|
|
482
|
-
|
|
483
|
-
const extraSetup = (input, container) => {
|
|
484
|
-
input.setAttribute('rows', 10);
|
|
485
|
-
|
|
486
|
-
if (assetInProgress.extraConfig) {
|
|
487
|
-
// Pretty-print the extra config.
|
|
488
|
-
input.value = JSON.stringify(
|
|
489
|
-
assetInProgress.extraConfig,
|
|
490
|
-
/* replacer= */ null, /* spacing= */ 2);
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
inputsToCheck.push(input);
|
|
494
|
-
|
|
495
|
-
// Make an error that shows up if you did not provide valid JSON.
|
|
496
|
-
const error = document.createElement('span');
|
|
497
|
-
error.classList.add('mdl-textfield__error');
|
|
498
|
-
error.textContent = 'Invalid JSON configuration';
|
|
499
|
-
|
|
500
|
-
container.appendChild(error);
|
|
501
|
-
};
|
|
502
|
-
const extraOnChange = (inputElement, inputWrapper) => {
|
|
503
|
-
try {
|
|
504
|
-
if (!inputElement.value) {
|
|
505
|
-
assetInProgress.extraConfig = null;
|
|
506
|
-
} else {
|
|
507
|
-
const config = /** @type {!Object} */(JSON.parse(inputElement.value));
|
|
508
|
-
assetInProgress.extraConfig = config;
|
|
509
|
-
}
|
|
510
|
-
inputWrapper.setValid(true);
|
|
511
|
-
} catch (exception) {
|
|
512
|
-
inputWrapper.setValid(false);
|
|
513
|
-
}
|
|
514
|
-
};
|
|
515
|
-
const extraConfigLabel = 'Extra Shaka Player configuration (JSON)';
|
|
516
|
-
this.makeField_(
|
|
517
|
-
container, extraConfigLabel, extraSetup, extraOnChange,
|
|
518
|
-
/* isTextArea= */ true);
|
|
519
|
-
|
|
520
|
-
return extraConfigDiv;
|
|
521
|
-
}
|
|
522
|
-
|
|
523
|
-
/**
|
|
524
|
-
* @param {!ShakaDemoAssetInfo} assetInProgress
|
|
525
|
-
* @param {!Array.<!HTMLInputElement>} inputsToCheck
|
|
526
|
-
* @param {!Element} iconDiv
|
|
527
|
-
* @return {!Element} div
|
|
528
|
-
* @private
|
|
529
|
-
*/
|
|
530
|
-
makeAssetDialogContentsMain_(assetInProgress, inputsToCheck, iconDiv) {
|
|
531
|
-
const mainDiv = document.createElement('div');
|
|
532
|
-
const containerStyle = shakaDemo.InputContainer.Style.VERTICAL;
|
|
533
|
-
const container = new shakaDemo.InputContainer(
|
|
534
|
-
mainDiv, /* headerText= */ null, containerStyle,
|
|
535
|
-
/* docLink= */ null);
|
|
536
|
-
|
|
537
|
-
// Make the manifest URL field.
|
|
538
|
-
const manifestSetup = (input, container) => {
|
|
539
|
-
input.value = assetInProgress.manifestUri;
|
|
540
|
-
inputsToCheck.push(input);
|
|
541
|
-
|
|
542
|
-
// Make an error that shows up if you did not provide an URL.
|
|
543
|
-
const error = document.createElement('span');
|
|
544
|
-
error.classList.add('mdl-textfield__error');
|
|
545
|
-
error.textContent = 'Must have a manifest URL, or IMA DAI id fields';
|
|
546
|
-
container.appendChild(error);
|
|
547
|
-
|
|
548
|
-
// Add a regex that will detect empty strings.
|
|
549
|
-
input.required = this.checkManifestRequired_(assetInProgress);
|
|
550
|
-
input.pattern = '^(?!([\r\n\t\f\v ]+)$).*$';
|
|
551
|
-
this.manifestField_ = input;
|
|
552
|
-
};
|
|
553
|
-
const manifestOnChange = (input) => {
|
|
554
|
-
assetInProgress.manifestUri = input.value.trim();
|
|
555
|
-
};
|
|
556
|
-
this.makeField_(container, 'Manifest URL', manifestSetup, manifestOnChange);
|
|
557
|
-
|
|
558
|
-
// Make the name field.
|
|
559
|
-
const nameSetup = (input, container) => {
|
|
560
|
-
input.value = assetInProgress.name;
|
|
561
|
-
inputsToCheck.push(input);
|
|
562
|
-
|
|
563
|
-
// Make an error that shows up if you have an empty/duplicate name.
|
|
564
|
-
const error = document.createElement('span');
|
|
565
|
-
error.classList.add('mdl-textfield__error');
|
|
566
|
-
error.textContent = 'Must be a unique name.';
|
|
567
|
-
container.appendChild(error);
|
|
568
|
-
|
|
569
|
-
// Make a regex that will detect duplicates.
|
|
570
|
-
input.required = true;
|
|
571
|
-
input.pattern = '^(?!( *';
|
|
572
|
-
for (const asset of this.assets_) {
|
|
573
|
-
if (asset == assetInProgress) {
|
|
574
|
-
// If editing an existing asset, it's okay if the name doesn't change.
|
|
575
|
-
continue;
|
|
576
|
-
}
|
|
577
|
-
const escape = (input) => {
|
|
578
|
-
return input.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
579
|
-
};
|
|
580
|
-
input.pattern += '|' + escape(asset.name);
|
|
581
|
-
}
|
|
582
|
-
input.pattern += ')$).*$';
|
|
583
|
-
};
|
|
584
|
-
const nameOnChange = (input) => {
|
|
585
|
-
assetInProgress.name = input.value;
|
|
586
|
-
};
|
|
587
|
-
this.makeField_(container, 'Name', nameSetup, nameOnChange);
|
|
588
|
-
|
|
589
|
-
// Make the icon field.
|
|
590
|
-
const iconSetup = (input, container) => {
|
|
591
|
-
if (assetInProgress.iconUri) {
|
|
592
|
-
input.value = assetInProgress.iconUri;
|
|
593
|
-
|
|
594
|
-
const img =
|
|
595
|
-
/** @type {!HTMLImageElement} */(document.createElement('img'));
|
|
596
|
-
img.src = input.value;
|
|
597
|
-
img.alt = ''; // Not necessary to understand the page
|
|
598
|
-
iconDiv.appendChild(img);
|
|
599
|
-
}
|
|
600
|
-
};
|
|
601
|
-
|
|
602
|
-
const iconOnChange = (input) => {
|
|
603
|
-
shaka.util.Dom.removeAllChildren(iconDiv);
|
|
604
|
-
assetInProgress.iconUri = input.value;
|
|
605
|
-
|
|
606
|
-
if (input.value) {
|
|
607
|
-
const img =
|
|
608
|
-
/** @type {!HTMLImageElement} */(document.createElement('img'));
|
|
609
|
-
img.src = input.value;
|
|
610
|
-
img.alt = ''; // Not necessary to understand the page
|
|
611
|
-
iconDiv.appendChild(img);
|
|
612
|
-
}
|
|
613
|
-
};
|
|
614
|
-
this.makeField_(container, 'Icon URL', iconSetup, iconOnChange);
|
|
615
|
-
|
|
616
|
-
// Make the MIME type field.
|
|
617
|
-
const mimeTypeSetup = (input, container) => {
|
|
618
|
-
if (assetInProgress.mimeType) {
|
|
619
|
-
input.value = assetInProgress.mimeType;
|
|
620
|
-
}
|
|
621
|
-
};
|
|
622
|
-
|
|
623
|
-
const mimeTypeOnChange = (input) => {
|
|
624
|
-
assetInProgress.mimeType = input.value || null;
|
|
625
|
-
};
|
|
626
|
-
this.makeField_(container, 'MIME Type', mimeTypeSetup, mimeTypeOnChange);
|
|
627
|
-
|
|
628
|
-
return mainDiv;
|
|
629
|
-
}
|
|
630
|
-
|
|
631
|
-
/**
|
|
632
|
-
* @param {!ShakaDemoAssetInfo} assetInProgress
|
|
633
|
-
* @private
|
|
634
|
-
*/
|
|
635
|
-
checkManifestRequired_(assetInProgress) {
|
|
636
|
-
// The manifest field is required unless we're getting the manifest
|
|
637
|
-
// from the Google Ad Manager using IMA ids.
|
|
638
|
-
const isDaiAdManifest = (assetInProgress.imaContentSrcId &&
|
|
639
|
-
assetInProgress.imaVideoId) || assetInProgress.imaAssetKey != null;
|
|
640
|
-
// Or if we are getting it from AWS Elemental MediaTailor.
|
|
641
|
-
const isMediaTailor = !!assetInProgress.mediaTailorUrl;
|
|
642
|
-
return !isDaiAdManifest && !isMediaTailor;
|
|
643
|
-
}
|
|
644
|
-
|
|
645
|
-
/**
|
|
646
|
-
* @param {!ShakaDemoAssetInfo} assetInProgress
|
|
647
|
-
* @param {!Array.<!HTMLInputElement>} inputsToCheck
|
|
648
|
-
* @return {!Element} div
|
|
649
|
-
* @private
|
|
650
|
-
*/
|
|
651
|
-
makeAssetDialogContentsFinish_(assetInProgress, inputsToCheck) {
|
|
652
|
-
const finishDiv = document.createElement('tr');
|
|
653
|
-
|
|
654
|
-
const buttonStyle = shakaDemo.Custom.ButtonStyle_.RAISED;
|
|
655
|
-
finishDiv.appendChild(this.makeButton_('Save', buttonStyle, () => {
|
|
656
|
-
for (const input of inputsToCheck) {
|
|
657
|
-
if (!input.validity.valid) {
|
|
658
|
-
return;
|
|
659
|
-
}
|
|
660
|
-
}
|
|
661
|
-
shakaDemoMain.setupOfflineSupport(assetInProgress);
|
|
662
|
-
this.assets_.add(assetInProgress);
|
|
663
|
-
this.saveAssetInfos_(this.assets_);
|
|
664
|
-
this.remakeSavedList_();
|
|
665
|
-
this.dialog_.close();
|
|
666
|
-
}));
|
|
667
|
-
finishDiv.appendChild(this.makeButton_('Cancel', buttonStyle, () => {
|
|
668
|
-
this.dialog_.close();
|
|
669
|
-
}));
|
|
670
|
-
|
|
671
|
-
return finishDiv;
|
|
672
|
-
}
|
|
673
|
-
|
|
674
|
-
/**
|
|
675
|
-
* @param {!ShakaDemoAssetInfo} assetInProgress
|
|
676
|
-
* @private
|
|
677
|
-
*/
|
|
678
|
-
showAssetDialog_(assetInProgress) {
|
|
679
|
-
// Remove buttons for any previous assets.
|
|
680
|
-
shaka.util.Dom.removeAllChildren(this.dialog_);
|
|
681
|
-
|
|
682
|
-
// An array of inputs which have validity checks which we care about.
|
|
683
|
-
/** @type {!Array.<!HTMLInputElement>} */
|
|
684
|
-
const inputsToCheck = [];
|
|
685
|
-
|
|
686
|
-
// Make the contents divs.
|
|
687
|
-
const iconDiv = document.createElement('div');
|
|
688
|
-
const mainDiv = this.makeAssetDialogContentsMain_(
|
|
689
|
-
assetInProgress, inputsToCheck, iconDiv);
|
|
690
|
-
const drmDiv = this.makeAssetDialogContentsDrm_(
|
|
691
|
-
assetInProgress, inputsToCheck);
|
|
692
|
-
const headersDiv = this.makeAssetDialogContentsHeaders_(
|
|
693
|
-
assetInProgress, inputsToCheck);
|
|
694
|
-
const adsDiv = this.makeAssetDialogContentsAds_(
|
|
695
|
-
assetInProgress, inputsToCheck);
|
|
696
|
-
const extraTracksDiv = this.makeAssetDialogContentsExtraTracks_(
|
|
697
|
-
assetInProgress, inputsToCheck);
|
|
698
|
-
const extraConfigDiv = this.makeAssetDialogContentsExtra_(
|
|
699
|
-
assetInProgress, inputsToCheck);
|
|
700
|
-
const finishDiv = this.makeAssetDialogContentsFinish_(
|
|
701
|
-
assetInProgress, inputsToCheck);
|
|
702
|
-
|
|
703
|
-
// Make the buttons that control which tab is visible.
|
|
704
|
-
const tabDiv = document.createElement('tr');
|
|
705
|
-
const tabsToHide = [];
|
|
706
|
-
const buttonsToSwitch = [];
|
|
707
|
-
const addTabButton = (name, tabToShow, startOn) => {
|
|
708
|
-
const buttonStyle = shakaDemo.Custom.ButtonStyle_.PLAIN;
|
|
709
|
-
const button = this.makeButton_(name, buttonStyle, () => {
|
|
710
|
-
for (const tab of tabsToHide) {
|
|
711
|
-
tab.classList.add('hidden');
|
|
712
|
-
}
|
|
713
|
-
tabToShow.classList.remove('hidden');
|
|
714
|
-
for (const button of buttonsToSwitch) {
|
|
715
|
-
button.classList.remove('mdl-button--accent');
|
|
716
|
-
}
|
|
717
|
-
button.classList.add('mdl-button--accent');
|
|
718
|
-
});
|
|
719
|
-
tabDiv.appendChild(button);
|
|
720
|
-
tabsToHide.push(tabToShow);
|
|
721
|
-
buttonsToSwitch.push(button);
|
|
722
|
-
if (startOn) {
|
|
723
|
-
button.classList.add('mdl-button--accent');
|
|
724
|
-
} else {
|
|
725
|
-
tabToShow.classList.add('hidden');
|
|
726
|
-
}
|
|
727
|
-
};
|
|
728
|
-
addTabButton('Main', mainDiv, /* startOn= */ true);
|
|
729
|
-
addTabButton('Drm', drmDiv, /* startOn= */ false);
|
|
730
|
-
addTabButton('Headers', headersDiv, /* startOn= */ false);
|
|
731
|
-
addTabButton('Ads', adsDiv, /* startOn= */ false);
|
|
732
|
-
addTabButton('Extra Tracks', extraTracksDiv, /* startOn= */ false);
|
|
733
|
-
addTabButton('Extra Config', extraConfigDiv, /* startOn= */ false);
|
|
734
|
-
|
|
735
|
-
// Append the divs in the desired order.
|
|
736
|
-
this.dialog_.appendChild(tabDiv);
|
|
737
|
-
this.dialog_.appendChild(mainDiv);
|
|
738
|
-
this.dialog_.appendChild(drmDiv);
|
|
739
|
-
this.dialog_.appendChild(headersDiv);
|
|
740
|
-
this.dialog_.appendChild(adsDiv);
|
|
741
|
-
this.dialog_.appendChild(extraTracksDiv);
|
|
742
|
-
this.dialog_.appendChild(extraConfigDiv);
|
|
743
|
-
this.dialog_.appendChild(finishDiv);
|
|
744
|
-
this.dialog_.appendChild(iconDiv);
|
|
745
|
-
|
|
746
|
-
// Update the componentHandler, to account for the new MDL elements.
|
|
747
|
-
componentHandler.upgradeDom();
|
|
748
|
-
|
|
749
|
-
// Show the dialog last, so that it knows where to place it.
|
|
750
|
-
this.dialog_.showModal();
|
|
751
|
-
}
|
|
752
|
-
|
|
753
|
-
/**
|
|
754
|
-
* @return {!Set.<!ShakaDemoAssetInfo>}
|
|
755
|
-
* @private
|
|
756
|
-
*/
|
|
757
|
-
loadAssetInfos_() {
|
|
758
|
-
const savedString = window.localStorage.getItem(shakaDemo.Custom.saveId_);
|
|
759
|
-
if (savedString) {
|
|
760
|
-
const assets =
|
|
761
|
-
/** @type {!Array.<!ShakaDemoAssetInfo>} */(JSON.parse(savedString));
|
|
762
|
-
return new Set(assets.map((json) => {
|
|
763
|
-
const asset = ShakaDemoAssetInfo.fromJSON(json);
|
|
764
|
-
shakaDemoMain.setupOfflineSupport(asset);
|
|
765
|
-
return asset;
|
|
766
|
-
}));
|
|
767
|
-
}
|
|
768
|
-
return new Set();
|
|
769
|
-
}
|
|
770
|
-
|
|
771
|
-
/**
|
|
772
|
-
* @param {!Set.<!ShakaDemoAssetInfo>} assetInfos
|
|
773
|
-
* @private
|
|
774
|
-
*/
|
|
775
|
-
saveAssetInfos_(assetInfos) {
|
|
776
|
-
const saveId = shakaDemo.Custom.saveId_;
|
|
777
|
-
const assets = Array.from(assetInfos);
|
|
778
|
-
window.localStorage.setItem(saveId, JSON.stringify(assets));
|
|
779
|
-
}
|
|
780
|
-
|
|
781
|
-
/**
|
|
782
|
-
* @param {string} name
|
|
783
|
-
* @param {shakaDemo.Custom.ButtonStyle_} buttonStyle
|
|
784
|
-
* What style should this button be in?
|
|
785
|
-
* @param {function()} callback
|
|
786
|
-
* @return {!Element}
|
|
787
|
-
* @private
|
|
788
|
-
*/
|
|
789
|
-
makeButton_(name, buttonStyle, callback) {
|
|
790
|
-
const button = document.createElement('button');
|
|
791
|
-
switch (buttonStyle) {
|
|
792
|
-
case shakaDemo.Custom.ButtonStyle_.FAB: {
|
|
793
|
-
button.classList.add('mdl-button--fab');
|
|
794
|
-
button.classList.add('mdl-button--colored');
|
|
795
|
-
const icon = document.createElement('i');
|
|
796
|
-
icon.classList.add('material-icons-round');
|
|
797
|
-
icon.textContent = name;
|
|
798
|
-
button.appendChild(icon);
|
|
799
|
-
} break;
|
|
800
|
-
case shakaDemo.Custom.ButtonStyle_.RAISED:
|
|
801
|
-
button.textContent = name;
|
|
802
|
-
button.classList.add('mdl-button--raised');
|
|
803
|
-
break;
|
|
804
|
-
case shakaDemo.Custom.ButtonStyle_.PLAIN:
|
|
805
|
-
button.textContent = name;
|
|
806
|
-
break;
|
|
807
|
-
}
|
|
808
|
-
button.addEventListener('click', callback);
|
|
809
|
-
button.classList.add('mdl-button');
|
|
810
|
-
button.classList.add('mdl-js-button');
|
|
811
|
-
button.classList.add('mdl-js-ripple-effect');
|
|
812
|
-
return button;
|
|
813
|
-
}
|
|
814
|
-
|
|
815
|
-
/**
|
|
816
|
-
* @param {!ShakaDemoAssetInfo} asset
|
|
817
|
-
* @return {!shakaDemo.AssetCard}
|
|
818
|
-
* @private
|
|
819
|
-
*/
|
|
820
|
-
createAssetCardFor_(asset) {
|
|
821
|
-
const savedList = this.savedList_;
|
|
822
|
-
const isFeatured = false;
|
|
823
|
-
return new shakaDemo.AssetCard(savedList, asset, isFeatured, (c) => {
|
|
824
|
-
c.addButton('Play', () => {
|
|
825
|
-
shakaDemoMain.loadAsset(asset);
|
|
826
|
-
this.updateSelected_();
|
|
827
|
-
});
|
|
828
|
-
c.addButton('Edit', async () => {
|
|
829
|
-
if (asset.unstoreCallback) {
|
|
830
|
-
await asset.unstoreCallback();
|
|
831
|
-
this.saveAssetInfos_(this.assets_);
|
|
832
|
-
this.remakeSavedList_();
|
|
833
|
-
}
|
|
834
|
-
this.showAssetDialog_(asset);
|
|
835
|
-
});
|
|
836
|
-
c.addButton('Delete', async () => {
|
|
837
|
-
this.assets_.delete(asset);
|
|
838
|
-
if (asset.unstoreCallback) {
|
|
839
|
-
await asset.unstoreCallback();
|
|
840
|
-
}
|
|
841
|
-
this.saveAssetInfos_(this.assets_);
|
|
842
|
-
this.remakeSavedList_();
|
|
843
|
-
}, 'Delete this custom asset?');
|
|
844
|
-
c.addStoreButton();
|
|
845
|
-
});
|
|
846
|
-
}
|
|
847
|
-
|
|
848
|
-
/**
|
|
849
|
-
* Updates which asset card is selected.
|
|
850
|
-
* @private
|
|
851
|
-
*/
|
|
852
|
-
updateSelected_() {
|
|
853
|
-
for (const card of this.assetCards_) {
|
|
854
|
-
card.selectByAsset(shakaDemoMain.selectedAsset);
|
|
855
|
-
}
|
|
856
|
-
}
|
|
857
|
-
|
|
858
|
-
/** @private */
|
|
859
|
-
remakeSavedList_() {
|
|
860
|
-
shaka.util.Dom.removeAllChildren(this.savedList_);
|
|
861
|
-
|
|
862
|
-
if (this.assets_.size == 0) {
|
|
863
|
-
// Add in a message telling you what to do.
|
|
864
|
-
const makeMessage = (textClass, text) => {
|
|
865
|
-
const textElement = document.createElement('h2');
|
|
866
|
-
textElement.classList.add('mdl-typography--' + textClass);
|
|
867
|
-
textElement.textContent = text;
|
|
868
|
-
this.savedList_.appendChild(textElement);
|
|
869
|
-
};
|
|
870
|
-
makeMessage('title', 'Try Shaka Player with your own content!');
|
|
871
|
-
makeMessage('body-2', 'Press the button below to add a custom asset.');
|
|
872
|
-
makeMessage('body-1',
|
|
873
|
-
'Custom assets will remain even after reloading the page.');
|
|
874
|
-
} else {
|
|
875
|
-
// Make asset cards for the assets.
|
|
876
|
-
this.assetCards_ = Array.from(this.assets_).map((asset) => {
|
|
877
|
-
return this.createAssetCardFor_(asset);
|
|
878
|
-
});
|
|
879
|
-
this.updateSelected_();
|
|
880
|
-
}
|
|
881
|
-
}
|
|
882
|
-
};
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
/**
|
|
886
|
-
* @enum {number}
|
|
887
|
-
* @private
|
|
888
|
-
*/
|
|
889
|
-
shakaDemo.Custom.ButtonStyle_ = {
|
|
890
|
-
RAISED: 0,
|
|
891
|
-
FAB: 1,
|
|
892
|
-
PLAIN: 2,
|
|
893
|
-
};
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
/**
|
|
897
|
-
* The name of the field in window.localStorage that is used to store a user's
|
|
898
|
-
* custom assets.
|
|
899
|
-
* @const {string}
|
|
900
|
-
*/
|
|
901
|
-
shakaDemo.Custom.saveId_ = 'shakaPlayerDemoSavedAssets';
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
document.addEventListener('shaka-main-loaded', shakaDemo.Custom.init);
|
|
905
|
-
document.addEventListener('shaka-main-cleanup', () => {
|
|
906
|
-
shakaDemoCustom = null;
|
|
907
|
-
});
|