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.
- package/README.md +1 -0
- package/dist/controls.css +1 -1
- package/dist/controls.css.map +1 -1
- package/dist/deps.js +9 -5
- package/dist/locales.js +29 -29
- package/dist/shaka-player.compiled.d.ts +46 -3
- package/dist/shaka-player.compiled.debug.d.ts +46 -3
- package/dist/shaka-player.compiled.debug.externs.js +45 -0
- package/dist/shaka-player.compiled.debug.js +382 -351
- package/dist/shaka-player.compiled.debug.map +4 -4
- package/dist/shaka-player.compiled.externs.js +45 -0
- package/dist/shaka-player.compiled.js +1135 -1121
- package/dist/shaka-player.compiled.map +4 -4
- package/dist/shaka-player.ui.d.ts +68 -4
- package/dist/shaka-player.ui.debug.d.ts +68 -4
- package/dist/shaka-player.ui.debug.externs.js +77 -0
- package/dist/shaka-player.ui.debug.js +428 -392
- package/dist/shaka-player.ui.debug.map +4 -4
- package/dist/shaka-player.ui.externs.js +77 -0
- package/dist/shaka-player.ui.js +1304 -1290
- 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/cea/cea708_service.js +1 -1
- package/lib/cea/cea708_window.js +95 -7
- package/lib/dash/dash_parser.js +55 -11
- package/lib/media/adaptation_set_criteria.js +76 -10
- package/lib/media/media_source_engine.js +42 -18
- package/lib/media/segment_reference.js +12 -0
- package/lib/media/streaming_engine.js +55 -3
- package/lib/player.js +92 -6
- 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 -5774
- 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 -510
- package/demo/common/assets.js +0 -1634
- 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 -232
- 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 -2805
- 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 -435
- 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
|
@@ -1,292 +0,0 @@
|
|
|
1
|
-
# Monetization with Ads
|
|
2
|
-
|
|
3
|
-
Shaka Player provides an API for serving ads to make monetization easier
|
|
4
|
-
for apps. Our current API is tailored for our integration with the
|
|
5
|
-
[Interactive Media Ads][] SDKs, but we plan to extend our support to
|
|
6
|
-
other ad providers in v3.1+.
|
|
7
|
-
Please note that the current API is likely to undergo significant
|
|
8
|
-
changes as our support extends.
|
|
9
|
-
|
|
10
|
-
#### AWS Elemental MediaTailor Integration
|
|
11
|
-
|
|
12
|
-
Shaka Player provides an integration with the [AWS Elemental MediaTailor][].
|
|
13
|
-
We support Client Side, Server Side and overlays ad insertion.
|
|
14
|
-
|
|
15
|
-
[AWS Elemental MediaTailor]: https://aws.amazon.com/mediatailor/
|
|
16
|
-
|
|
17
|
-
All ad insertion experiences are available through the
|
|
18
|
-
{@linksource shaka.extern.IAdManager} object on the Player.
|
|
19
|
-
|
|
20
|
-
If you're not using Shaka's UI library, you will
|
|
21
|
-
also need to create a `<div>` over your video element to serve as an ad
|
|
22
|
-
container.
|
|
23
|
-
|
|
24
|
-
Start by initializing the server side logic.
|
|
25
|
-
With Shaka UI:
|
|
26
|
-
|
|
27
|
-
```js
|
|
28
|
-
const video = document.getElementById('video');
|
|
29
|
-
const ui = video['ui'];
|
|
30
|
-
const controls = video.ui.getControls();
|
|
31
|
-
// If you're using a non-UI build, this is the div you'll need to create
|
|
32
|
-
// for your layout.
|
|
33
|
-
const container = controls.getServerSideAdContainer();
|
|
34
|
-
const player = controls.getPlayer();
|
|
35
|
-
const netEngine = player.getNetworkingEngine();
|
|
36
|
-
const adManager = player.getAdManager();
|
|
37
|
-
adManager.initMediaTailor(container, netEngine, video);
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
Requesting a Client Side stream:
|
|
41
|
-
|
|
42
|
-
```js
|
|
43
|
-
const mediaTailorUrl = 'https://d305rncpy6ne2q.cloudfront.net/v1/session/94063eadf7d8c56e9e2edd84fdf897826a70d0df/SFP-MediaTailor-VOD-HLS-DASH/out/v1/b94f3611978f419985a18335bac9d9cb/ddb73bf548a44551a0059c346226445a/eaa5485198bf497284559efb8172425e/index.mpd';
|
|
44
|
-
const mediaTailorAdsParams = {
|
|
45
|
-
adsParams: {
|
|
46
|
-
assetid: 'test2',
|
|
47
|
-
podduration: '15',
|
|
48
|
-
},
|
|
49
|
-
};
|
|
50
|
-
const uri = await adManager.requestMediaTailorStream(mediaTailorUrl, mediaTailorAdsParams);
|
|
51
|
-
player.load(uri);
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
Requesting a Server Side stream:
|
|
55
|
-
|
|
56
|
-
```js
|
|
57
|
-
const mediaTailorUrl = 'https://ad391cc0d55b44c6a86d232548adc225.mediatailor.us-east-1.amazonaws.com/v1/session/d02fedbbc5a68596164208dd24e9b48aa60dadc7/singssai/master.m3u8';
|
|
58
|
-
const uri = await adManager.requestMediaTailorStream(mediaTailorUrl);
|
|
59
|
-
player.load(uri);
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
Note: overlays ad insertions is the same as server side.
|
|
63
|
-
|
|
64
|
-
#### IMA SDK Integration
|
|
65
|
-
|
|
66
|
-
Shaka Player provides an integration with the [Interactive Media Ads][] SDKs.
|
|
67
|
-
We support both Client Side and Server Side ad insertion.
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
[Interactive Media Ads]: https://developers.google.com/interactive-media-ads
|
|
71
|
-
|
|
72
|
-
Both the Client Side and the Server Side ad insertion experiences are available
|
|
73
|
-
through the {@linksource shaka.extern.IAdManager} object on the Player.
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
```js
|
|
77
|
-
const adManager = player.getAdManager();
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
First, you'll need to include the IMA SDK(s) on your HTML page:
|
|
81
|
-
|
|
82
|
-
```html
|
|
83
|
-
<!DOCTYPE html>
|
|
84
|
-
<html>
|
|
85
|
-
<head>
|
|
86
|
-
<!-- Shaka Player ui compiled library: -->
|
|
87
|
-
<script src="dist/shaka-player.ui.js"></script>
|
|
88
|
-
<!-- Shaka Player ui compiled library default CSS: -->
|
|
89
|
-
<link rel="stylesheet" type="text/css" href="dist/controls.css">
|
|
90
|
-
<!-- IMA HTML5 SDK (for serving Client Side ads): -->
|
|
91
|
-
<script type="text/javascript" src="https://imasdk.googleapis.com/js/sdkloader/ima3.js"></script>
|
|
92
|
-
<!-- IMA DAI SDK (for serving Server Side ads): -->
|
|
93
|
-
<script type="text/javascript" src="https://imasdk.googleapis.com/js/sdkloader/ima3_dai.js"></script>
|
|
94
|
-
<!-- Your application source: -->
|
|
95
|
-
<script src="myapp.js"></script>
|
|
96
|
-
</head>
|
|
97
|
-
</html>
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
#### Streaming with Client Side Ads Insertion
|
|
101
|
-
|
|
102
|
-
To integrate Client Side ads into a presentation, you need to have your ad tag
|
|
103
|
-
URIs. If you're not using Shaka's UI library, you will also need to create a
|
|
104
|
-
`<div>` over your video element to serve as an ad container.
|
|
105
|
-
|
|
106
|
-
Start by initializing the client side logic.
|
|
107
|
-
With Shaka UI:
|
|
108
|
-
|
|
109
|
-
```js
|
|
110
|
-
const adManager = player.getAdManager();
|
|
111
|
-
const video = document.getElementById('video');
|
|
112
|
-
const ui = video['ui'];
|
|
113
|
-
// If you're using a non-UI build, this is the div you'll need to create
|
|
114
|
-
// for your layout. The ad manager will clear this div, when it unloads, so
|
|
115
|
-
// don't pass in a div that contains non-ad elements.
|
|
116
|
-
const container = video.ui.getControls().getClientSideAdContainer();
|
|
117
|
-
adManager.initClientSide(container, video);
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
With the client side logic initialized, you can request ads at any time during
|
|
121
|
-
the presentation.
|
|
122
|
-
|
|
123
|
-
```js
|
|
124
|
-
const adsRequest = new google.ima.AdsRequest();
|
|
125
|
-
// Your ad tag url should go here. We are using a sample ad tag from the
|
|
126
|
-
// IMA HTML5 SDK implementation guide for this tutorial.
|
|
127
|
-
adsRequest.adTagUrl = 'https://pubads.g.doubleclick.net/gampad/ads?' +
|
|
128
|
-
'sz=640x480&iu=/124319096/external/single_ad_samples&ciu_szs=300x250&' +
|
|
129
|
-
'impl=s&gdfp_req=1&env=vp&output=vast&unviewed_position_start=1&' +
|
|
130
|
-
'cust_params=deployment%3Ddevsite%26sample_ct%3Dlinear&correlator=';
|
|
131
|
-
adManager.requestClientSideAds(adsRequest);
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
See: [google.ima.AdsRequest][] for details on the request object.
|
|
135
|
-
|
|
136
|
-
[google.ima.AdsRequest]: https://developers.google.com/interactive-media-ads/docs/sdks/html5/v3/reference/js/ima.AdsRequest
|
|
137
|
-
|
|
138
|
-
Control the rendering of ads:
|
|
139
|
-
|
|
140
|
-
```js
|
|
141
|
-
const adsRenderingSettings = new google.ima.AdsRenderingSettings();
|
|
142
|
-
adsRenderingSettings.restoreCustomPlaybackStateOnAdBreakComplete = true;
|
|
143
|
-
adManager.initClientSide(container, video, adsRenderingSettings);
|
|
144
|
-
// Updates the ads rendering settings.
|
|
145
|
-
adManager.updateClientSideAdsRenderingSettings(adsRenderingSettings);
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
See: [google.ima.AdsRenderingSettings][] for details on the request object.
|
|
149
|
-
|
|
150
|
-
[google.ima.AdsRenderingSettings]: https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/reference/js/google.ima.AdsRenderingSettings
|
|
151
|
-
|
|
152
|
-
#### Streaming with Server Side Ads Insertion
|
|
153
|
-
|
|
154
|
-
To integrate Server Side ads into a presentation, you need to have a Google Ad
|
|
155
|
-
Manager account and host your streams on Google Ad Manager's servers. To find
|
|
156
|
-
out more about the Google Ad Manager service or sign up for an account, visit
|
|
157
|
-
https://admanager.google.com/
|
|
158
|
-
|
|
159
|
-
If you're not using Shaka's UI library, you will
|
|
160
|
-
also need to create a `<div>` over your video element to serve as an ad
|
|
161
|
-
container.
|
|
162
|
-
|
|
163
|
-
Start by initializing the server side logic.
|
|
164
|
-
With Shaka UI:
|
|
165
|
-
|
|
166
|
-
```js
|
|
167
|
-
const adManager = player.getAdManager();
|
|
168
|
-
const video = document.getElementById('video');
|
|
169
|
-
const ui = video['ui'];
|
|
170
|
-
// If you're using a non-UI build, this is the div you'll need to create
|
|
171
|
-
// for your layout.
|
|
172
|
-
const container = video.ui.getControls().getServerSideAdContainer();
|
|
173
|
-
adManager.initServerSide(container, video);
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
With server side logic initialized, you can request and load streams with
|
|
177
|
-
dynamically inserted ads.
|
|
178
|
-
|
|
179
|
-
Requesting a VOD stream:
|
|
180
|
-
|
|
181
|
-
```js
|
|
182
|
-
const streamRequest = new google.ima.dai.api.VODStreamRequest();
|
|
183
|
-
// Your stream information will go here. We are using IMA's sample stream info
|
|
184
|
-
// in this tutorial.
|
|
185
|
-
streamRequest.contentSourceId = '2528370';
|
|
186
|
-
streamRequest.videoId = 'tears-of-steel';
|
|
187
|
-
const uri = await adManager.requestServerSideStream(streamRequest);
|
|
188
|
-
player.load(uri);
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
`shaka.extern.IAdManager.requestServerSideStream()` returns a Promise with a
|
|
192
|
-
manifest URI that points to a stream with ads inserted.
|
|
193
|
-
|
|
194
|
-
See [google.ima.dai.api.VODStreamRequest][] for details on the request object.
|
|
195
|
-
|
|
196
|
-
[google.ima.dai.api.VODStreamRequest]: https://developers.google.com/interactive-media-ads/docs/sdks/html5/dai/reference/js/VODStreamRequest
|
|
197
|
-
|
|
198
|
-
Requesting a LIVE stream:
|
|
199
|
-
|
|
200
|
-
```js
|
|
201
|
-
const streamRequest = new google.ima.dai.api.LiveStreamRequest();
|
|
202
|
-
// Your stream information will go here. We are using IMA's sample stream info
|
|
203
|
-
// in this tutorial.
|
|
204
|
-
streamRequest.assetKey = 'sN_IYUG8STe1ZzhIIE_ksA';
|
|
205
|
-
const uri = await adManager.requestServerSideStream(streamRequest);
|
|
206
|
-
player.load(uri);
|
|
207
|
-
```
|
|
208
|
-
|
|
209
|
-
See: [google.ima.dai.api.LiveStreamRequest][] for details on the request object.
|
|
210
|
-
|
|
211
|
-
[google.ima.dai.api.LiveStreamRequest]: https://developers.google.com/interactive-media-ads/docs/sdks/html5/dai/reference/js/LiveStreamRequest
|
|
212
|
-
|
|
213
|
-
If you are using Shaka's UI library, we will automatically hook up our ad UI.
|
|
214
|
-
|
|
215
|
-
#### Listening To Ad Events
|
|
216
|
-
We unify Server Side and Client Side ad events into our own Shaka ad events and
|
|
217
|
-
objects. which your application can listen to and interact with.
|
|
218
|
-
Check out the {@link shaka.ads.AdManager#event:AdBreakReadyEvent|full list of
|
|
219
|
-
ad events} for details.
|
|
220
|
-
|
|
221
|
-
Let's register a simple listener to Shaka's AD_STARTED event. It will log the
|
|
222
|
-
start of the ad in the console.
|
|
223
|
-
|
|
224
|
-
```js
|
|
225
|
-
adManager.addEventListener(shaka.ads.AdManager.AD_STARTED, () => {
|
|
226
|
-
console.log('An ad has started');
|
|
227
|
-
});
|
|
228
|
-
```
|
|
229
|
-
|
|
230
|
-
Every shaka ad event contains an original SDK event and an ad object if those
|
|
231
|
-
are available. Most apps are unlikely to need them, but if you have a use case
|
|
232
|
-
that requires access to those, here is how to get them:
|
|
233
|
-
|
|
234
|
-
```js
|
|
235
|
-
// Note that unlike in the previous example, we are capturing the AD_STARTED
|
|
236
|
-
// event object here (the "e" parameter of the lambda function) so we can access
|
|
237
|
-
// its properties.
|
|
238
|
-
adManager.addEventListener(shaka.ads.AdManager.AD_STARTED, (e) => {
|
|
239
|
-
const sdkAdObject = e['sdkAdObject'];
|
|
240
|
-
const originalEvent = e['originalEvent'];
|
|
241
|
-
});
|
|
242
|
-
```
|
|
243
|
-
|
|
244
|
-
#### Accommodating IMA Power Users
|
|
245
|
-
If you have an existing IMA integration you want to plug into Shaka, or you want
|
|
246
|
-
to use more intricate SDK capabilities not exposed through our API, we provide a
|
|
247
|
-
way to do that.
|
|
248
|
-
Listen to the {@link shaka.ads.AdManager#event:ImaAdManagerLoadedEvent} for
|
|
249
|
-
Client Side or the {@link shaka.ads.AdManager#event:ImaStreamManagerLoadedEvent}
|
|
250
|
-
for Server Side to get the IMA [AdManager][] or [StreamManager][] objects.
|
|
251
|
-
|
|
252
|
-
```js
|
|
253
|
-
adManager.addEventListener(shaka.ads.AdManager.IMA_AD_MANAGER_LOADED, (e) => {
|
|
254
|
-
const imaAdManager = e['imaAdManager'];
|
|
255
|
-
});
|
|
256
|
-
|
|
257
|
-
adManager.addEventListener(shaka.ads.AdManager.IMA_STREAM_MANAGER_LOADED, (e) => {
|
|
258
|
-
const imaStreamManager = e['imaStreamManager'];
|
|
259
|
-
});
|
|
260
|
-
```
|
|
261
|
-
[AdManager]: https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/reference/js/google.ima.AdsManager
|
|
262
|
-
[StreamManager]: https://developers.google.com/interactive-media-ads/docs/sdks/html5/dai/reference/js/StreamManager
|
|
263
|
-
|
|
264
|
-
#### Disabling Cookies For Serving Limited Ads
|
|
265
|
-
The server side IMA SDK allows limited ads to be served when the user does not
|
|
266
|
-
give or denies consent to cookies. To allow this, set the `ltd` parameter using
|
|
267
|
-
`StreamRequest.adTagParameters` as described in the [IMA limited ads guide][].
|
|
268
|
-
To set up cookie-less manifest and segment requests, use an appropriate
|
|
269
|
-
`requestFilter`. Please note that `request.withCredentials` flag is `false` by
|
|
270
|
-
default, so you should only need to set this if you've enabled it in other parts of
|
|
271
|
-
your code.
|
|
272
|
-
|
|
273
|
-
```js
|
|
274
|
-
player.getNetworkingEngine().registerRequestFilter(function(type, request, context) {
|
|
275
|
-
if (type == shaka.net.NetworkingEngine.RequestType.MANIFEST ||
|
|
276
|
-
type == shaka.net.NetworkingEngine.RequestType.SEGMENT) {
|
|
277
|
-
request.withCredentials = false;
|
|
278
|
-
}
|
|
279
|
-
});
|
|
280
|
-
```
|
|
281
|
-
[IMA limited ads guide]: https://developers.devsite.corp.google.com/interactive-media-ads/docs/sdks/html5/dai/limited-ads
|
|
282
|
-
|
|
283
|
-
#### Custom Ad Manager Implementations
|
|
284
|
-
Our architecture supports custom ad manager implementations. Every ad manager
|
|
285
|
-
should implement the {@linksource shaka.extern.IAdManager} interface. To make
|
|
286
|
-
the player use a custom ad manager implementation, invoke the code to set it
|
|
287
|
-
before instantiating the player.
|
|
288
|
-
|
|
289
|
-
```js
|
|
290
|
-
// myapp.CustomAdManager is a placeholder name for your ad manager implementation.
|
|
291
|
-
shaka.Player.setAdManagerFactory(() => new myapp.CustomAdManager());
|
|
292
|
-
```
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
# Application-Level Redirects
|
|
2
|
-
|
|
3
|
-
Not all browsers will follow an HTTP redirect on a preflighted cross-origin
|
|
4
|
-
request. For more detailed background on Cross-Origin Resource Sharing (CORS),
|
|
5
|
-
see [MDN's CORS article](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS)
|
|
6
|
-
and in particular, the section titled "Preflighted requests and redirects".
|
|
7
|
-
|
|
8
|
-
Some services have decided to work around this limitation by not using HTTP
|
|
9
|
-
redirects at all, but rather using a technique called Application-Level
|
|
10
|
-
Redirects or ALRs. In this setup, the server will return an HTTP 200 response
|
|
11
|
-
instead of an HTTP 302 redirect, and the new URL will be placed in the response
|
|
12
|
-
body where the client can access it.
|
|
13
|
-
|
|
14
|
-
With Shaka Player, it is possible to support this scheme through response
|
|
15
|
-
filters. The ALR response filter examines the response, determines if the
|
|
16
|
-
response is an ALR, and if so, starts a new request. The response to the new
|
|
17
|
-
request replaces the original response.
|
|
18
|
-
|
|
19
|
-
There are many potential reasons for these redirects, such as authentication or
|
|
20
|
-
load-balancing. There are also many possible schemes for a server to signal an
|
|
21
|
-
Application-Level Redirect to a client. Because it is "application-level", it
|
|
22
|
-
is completely up to the application to define how it works. Therefore we do not
|
|
23
|
-
offer built-in ALR functionality in Shaka Player. Instead, we give a full
|
|
24
|
-
example here of how a particular ALR scheme might work.
|
|
25
|
-
|
|
26
|
-
In this example, the ALR's full response body is the new URL. It can be
|
|
27
|
-
detected by looking for "http" in the beginning of the response body. These
|
|
28
|
-
ALRs are done on manifest requests, for the specific purpose of cookie-based
|
|
29
|
-
authentication. So the filter below checks for `RequestType.MANIFEST` and sets
|
|
30
|
-
`allowCrossSiteCredentials`. Please customize these details for your own
|
|
31
|
-
purposes and ALR schemes.
|
|
32
|
-
|
|
33
|
-
```js
|
|
34
|
-
// The UTF-8 characters "h", "t", "t", and "p".
|
|
35
|
-
const HTTP_IN_HEX = 0x68747470;
|
|
36
|
-
|
|
37
|
-
const RequestType = shaka.net.NetworkingEngine.RequestType;
|
|
38
|
-
|
|
39
|
-
player.getNetworkingEngine().registerResponseFilter(async (type, response, context) => {
|
|
40
|
-
// NOTE: If the system requires an ALR for both manifests and segments,
|
|
41
|
-
// remove this RequestType check.
|
|
42
|
-
if (type != RequestType.MANIFEST) {
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const dataView = new DataView(response.data);
|
|
47
|
-
if (response.data.byteLength < 4 ||
|
|
48
|
-
dataView.getUint32(0) != HTTP_IN_HEX) {
|
|
49
|
-
// Our ALRs are detected by a response body which is a URL.
|
|
50
|
-
// This doesn't start with "http", so it is not an ALR.
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// It's an Application-Level Redirect (ALR). That requires us to get the new
|
|
55
|
-
// URL and follow it.
|
|
56
|
-
|
|
57
|
-
// Interpret the response data as a URL string.
|
|
58
|
-
const responseAsString = shaka.util.StringUtils.fromUTF8(response.data);
|
|
59
|
-
|
|
60
|
-
// For maximum flexibility for those who will copy and paste this whole code
|
|
61
|
-
// snippet, check the type of the request to determine what retry parameters
|
|
62
|
-
// to use. Those who are reading and customizing this code can hard-code the
|
|
63
|
-
// parameters instead.
|
|
64
|
-
let retryParameters;
|
|
65
|
-
if (type == RequestType.MANIFEST) {
|
|
66
|
-
retryParameters = player.getConfiguration().manifest.retryParameters;
|
|
67
|
-
} else if (type == RequestType.SEGMENT) {
|
|
68
|
-
retryParameters = player.getConfiguration().streaming.retryParameters;
|
|
69
|
-
} else if (type == RequestType.LICENSE) {
|
|
70
|
-
retryParameters = player.getConfiguration().drm.retryParameters;
|
|
71
|
-
} else {
|
|
72
|
-
retryParameters = shaka.net.NetworkingEngine.defaultRetryParameters();
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// Make another request for the redirect URL.
|
|
76
|
-
const uris = [responseAsString];
|
|
77
|
-
const redirectRequest =
|
|
78
|
-
shaka.net.NetworkingEngine.makeRequest(uris, retryParameters);
|
|
79
|
-
|
|
80
|
-
// NOTE: Only do this if the purpose of the redirect is authentication. If
|
|
81
|
-
// the ALR is meant for something like load-balancing, remove the next line.
|
|
82
|
-
redirectRequest.allowCrossSiteCredentials = true;
|
|
83
|
-
|
|
84
|
-
const requestOperation =
|
|
85
|
-
player.getNetworkingEngine().request(type, redirectRequest);
|
|
86
|
-
const redirectResponse = await requestOperation.promise;
|
|
87
|
-
|
|
88
|
-
// Modify the original response to contain the results of the redirect
|
|
89
|
-
// response.
|
|
90
|
-
response.data = redirectResponse.data;
|
|
91
|
-
response.headers = redirectResponse.headers;
|
|
92
|
-
response.uri = redirectResponse.uri;
|
|
93
|
-
});
|
|
94
|
-
```
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
# Architecture Diagrams
|
|
2
|
-
|
|
3
|
-
<img
|
|
4
|
-
src="../design/dataflow.gv.png"
|
|
5
|
-
alt="Shaka data flow diagram"
|
|
6
|
-
style="max-width: 100%">
|
|
7
|
-
|
|
8
|
-
<img
|
|
9
|
-
src="../design/ownership.gv.png"
|
|
10
|
-
alt="Shaka ownership diagram"
|
|
11
|
-
style="max-width: 100%">
|
|
12
|
-
|
|
13
|
-
<img
|
|
14
|
-
src="../design/cast.gv.png"
|
|
15
|
-
alt="Shaka cast diagram"
|
|
16
|
-
style="max-width: 100%;">
|
|
17
|
-
|
|
18
|
-
<img
|
|
19
|
-
src="../design/offline.gv.png"
|
|
20
|
-
alt="Shaka offline diagram"
|
|
21
|
-
style="max-width: 100%">
|
|
22
|
-
|
|
23
|
-
<img
|
|
24
|
-
src="../design/timeline.svg"
|
|
25
|
-
alt="PresentationTimeline diagram"
|
|
26
|
-
style="max-width: 100%">
|
|
27
|
-
|
|
28
|
-
<img
|
|
29
|
-
src="../design/newdemo.gv.png"
|
|
30
|
-
alt="Demo page architecture"
|
|
31
|
-
style="max-width: 100%">
|
|
32
|
-
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
# Basic Usage
|
|
2
|
-
|
|
3
|
-
Basic usage of Shaka Player is very easy:
|
|
4
|
-
|
|
5
|
-
1. Start with {@tutorial welcome} and compile the library.
|
|
6
|
-
2. Create a simple HTML page with a video or audio element.
|
|
7
|
-
3. In your application's JavaScript -
|
|
8
|
-
1. Install Shaka's polyfills.
|
|
9
|
-
2. Check for browser support.
|
|
10
|
-
3. Create a Player object to wrap the media element.
|
|
11
|
-
4. Listen for errors.
|
|
12
|
-
5. Load a manifest.
|
|
13
|
-
|
|
14
|
-
```html
|
|
15
|
-
<!DOCTYPE html>
|
|
16
|
-
<html>
|
|
17
|
-
<head>
|
|
18
|
-
<!-- Shaka Player compiled library: -->
|
|
19
|
-
<script src="dist/shaka-player.compiled.js"></script>
|
|
20
|
-
<!-- Your application source: -->
|
|
21
|
-
<script src="myapp.js"></script>
|
|
22
|
-
</head>
|
|
23
|
-
<body>
|
|
24
|
-
<video id="video"
|
|
25
|
-
width="640"
|
|
26
|
-
poster="//shaka-player-demo.appspot.com/assets/poster.jpg"
|
|
27
|
-
controls autoplay></video>
|
|
28
|
-
</body>
|
|
29
|
-
</html>
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
```js
|
|
33
|
-
// myapp.js
|
|
34
|
-
|
|
35
|
-
const manifestUri =
|
|
36
|
-
'https://storage.googleapis.com/shaka-demo-assets/angel-one/dash.mpd';
|
|
37
|
-
|
|
38
|
-
function initApp() {
|
|
39
|
-
// Install built-in polyfills to patch browser incompatibilities.
|
|
40
|
-
shaka.polyfill.installAll();
|
|
41
|
-
|
|
42
|
-
// Check to see if the browser supports the basic APIs Shaka needs.
|
|
43
|
-
if (shaka.Player.isBrowserSupported()) {
|
|
44
|
-
// Everything looks good!
|
|
45
|
-
initPlayer();
|
|
46
|
-
} else {
|
|
47
|
-
// This browser does not have the minimum set of APIs we need.
|
|
48
|
-
console.error('Browser not supported!');
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
async function initPlayer() {
|
|
53
|
-
// Create a Player instance.
|
|
54
|
-
const video = document.getElementById('video');
|
|
55
|
-
const player = new shaka.Player();
|
|
56
|
-
await player.attach(video);
|
|
57
|
-
|
|
58
|
-
// Attach player to the window to make it easy to access in the JS console.
|
|
59
|
-
window.player = player;
|
|
60
|
-
|
|
61
|
-
// Listen for error events.
|
|
62
|
-
player.addEventListener('error', onErrorEvent);
|
|
63
|
-
|
|
64
|
-
// Try to load a manifest.
|
|
65
|
-
// This is an asynchronous process.
|
|
66
|
-
try {
|
|
67
|
-
await player.load(manifestUri);
|
|
68
|
-
// This runs if the asynchronous load is successful.
|
|
69
|
-
console.log('The video has now been loaded!');
|
|
70
|
-
} catch (e) {
|
|
71
|
-
// onError is executed if the asynchronous load fails.
|
|
72
|
-
onError(e);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
function onErrorEvent(event) {
|
|
77
|
-
// Extract the shaka.util.Error object from the event.
|
|
78
|
-
onError(event.detail);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
function onError(error) {
|
|
82
|
-
// Log the error.
|
|
83
|
-
console.error('Error code', error.code, 'object', error);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
document.addEventListener('DOMContentLoaded', initApp);
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
That's it!
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# Blob URL
|
|
2
|
-
|
|
3
|
-
In case you need shaka-player to load a blob url mpd:
|
|
4
|
-
|
|
5
|
-
`player.load(computedMpdBlobURL, startTime, 'application/dash+xml');`
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
In case you need shaka-player to load a blob url m3u8 :
|
|
9
|
-
|
|
10
|
-
`player.load(computedMpdBlobURL, startTime, 'application/x-mpegurl');`
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
Note: relative URIs in the manifest are broken because the original manifest URI is lost. This can be worked around with either absolute URIs or the use of BaseURL element in DASH.
|
|
14
|
-
|
|
15
|
-
Note: this tutorial only applies to v3.3 or higher
|
package/docs/tutorials/config.md
DELETED
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
# Configuration
|
|
2
|
-
|
|
3
|
-
The goal of this tutorial is to introduce Shaka's configuration system and the
|
|
4
|
-
concepts on which it is built. More detail can be found in the API docs.
|
|
5
|
-
|
|
6
|
-
Shaka's `Player` object has a hierarchical configuration. The overall player
|
|
7
|
-
config contains sub-configs for various parts of the system, such as manifests,
|
|
8
|
-
streaming, and DRM.
|
|
9
|
-
|
|
10
|
-
To see the current config, you can use `player.getConfiguration()`. If you run
|
|
11
|
-
this without setting anything first, you get the default configuration.
|
|
12
|
-
|
|
13
|
-
`Player` also has a `configure()` method that takes it's argument(s) in one of two
|
|
14
|
-
forms:
|
|
15
|
-
|
|
16
|
-
1. A plain, anonymous object. Any fields you leave out of the config object
|
|
17
|
-
will retain their existing values, and any fields you explicitly set as
|
|
18
|
-
`undefined` will be reverted to their default value. For example:
|
|
19
|
-
|
|
20
|
-
```js
|
|
21
|
-
player.configure({
|
|
22
|
-
streaming: {
|
|
23
|
-
bufferingGoal: 120
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
2. For setting a single field, a name (full path) of the field can be provided
|
|
29
|
-
as the first argument (a string) and value of the field as the second. For
|
|
30
|
-
example:
|
|
31
|
-
|
|
32
|
-
```js
|
|
33
|
-
player.configure('streaming.bufferingGoal', 120);
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
You can use the code from {@tutorial basic-usage} and try these examples in
|
|
37
|
-
the JS console:
|
|
38
|
-
|
|
39
|
-
```js
|
|
40
|
-
player.getConfiguration();
|
|
41
|
-
|
|
42
|
-
=> Object
|
|
43
|
-
abr: Object
|
|
44
|
-
bandwidthDowngradeTarget: 0.95
|
|
45
|
-
bandwidthUpgradeTarget: 0.85
|
|
46
|
-
defaultBandwidthEstimate: 500000
|
|
47
|
-
enabled: true
|
|
48
|
-
restrictions: Object
|
|
49
|
-
switchInterval: 8
|
|
50
|
-
abrFactory: Function
|
|
51
|
-
drm: Object
|
|
52
|
-
advanced: Object
|
|
53
|
-
clearKeys: Object
|
|
54
|
-
retryParameters: Object
|
|
55
|
-
backoffFactor: 2
|
|
56
|
-
baseDelay: 1000
|
|
57
|
-
fuzzFactor: 0.5
|
|
58
|
-
maxAttempts: 2
|
|
59
|
-
timeout: 0
|
|
60
|
-
servers: Object
|
|
61
|
-
manifest: Object
|
|
62
|
-
dash: Object
|
|
63
|
-
retryParameters: Object
|
|
64
|
-
playRangeEnd: Infinity
|
|
65
|
-
playRangeStart: 0
|
|
66
|
-
preferredAudioLanguage: ""
|
|
67
|
-
preferredAudioLabel: ""
|
|
68
|
-
preferredTextLanguage: ""
|
|
69
|
-
restrictions: Object
|
|
70
|
-
streaming: Object
|
|
71
|
-
bufferBehind: 30
|
|
72
|
-
bufferingGoal: 10
|
|
73
|
-
durationBackoff: 1
|
|
74
|
-
failureCallback: Function
|
|
75
|
-
ignoreTextStreamFailures: false
|
|
76
|
-
alwaysStreamText: false
|
|
77
|
-
rebufferingGoal: 2
|
|
78
|
-
retryParameters: Object
|
|
79
|
-
startAtSegmentBoundary: false
|
|
80
|
-
safeSeekOffset: 5
|
|
81
|
-
segmentPrefetchLimit: 0
|
|
82
|
-
textDisplayFactory: Function
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
// Example configurations, all of which are arbitrary:
|
|
86
|
-
|
|
87
|
-
// set audio language preference to Canadian French:
|
|
88
|
-
player.configure('preferredAudioLanguage', 'fr-CA');
|
|
89
|
-
// NOTE: language preferences affect the next call to load()
|
|
90
|
-
|
|
91
|
-
// set text language preference to Greek and buffering goal to 2 minutes:
|
|
92
|
-
player.configure({
|
|
93
|
-
preferredTextLanguage: 'el',
|
|
94
|
-
streaming: {
|
|
95
|
-
bufferingGoal: 120
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
// check audio language preference, which is still Canadian French:
|
|
100
|
-
player.getConfiguration().preferredAudioLanguage
|
|
101
|
-
|
|
102
|
-
// check buffering goal, which is 2 minutes:
|
|
103
|
-
player.getConfiguration().streaming.bufferingGoal
|
|
104
|
-
|
|
105
|
-
// check rebuffering goal, which is still the default of 2 seconds:
|
|
106
|
-
player.getConfiguration().streaming.rebufferingGoal
|
|
107
|
-
|
|
108
|
-
// set the rebuffering goal to 15 seconds and revert buffering goal to default:
|
|
109
|
-
player.configure({
|
|
110
|
-
streaming: {
|
|
111
|
-
bufferingGoal: undefined,
|
|
112
|
-
rebufferingGoal: 15
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
Some of these fields have immediate effects (such as networking settings and
|
|
118
|
-
buffering settings) while some will not have any effect until the next call to
|
|
119
|
-
`load()` (such as DRM settings, manifest settings, and language settings).
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
#### Low latency streaming
|
|
123
|
-
|
|
124
|
-
With `.streaming.lowLatencyMode` set to true,
|
|
125
|
-
`.streaming.inaccurateManifestTolerance` is set to 0 by default,
|
|
126
|
-
`.streaming.rebufferingGoal` is set to 0.01 by default, and
|
|
127
|
-
`.streaming.segmentPrefetchLimit` is set to 2 by default.
|
|
128
|
-
|
|
129
|
-
To customize the values of inaccurateManifestTolerance, rebufferingGoal and
|
|
130
|
-
segmentPrefetchLimit with low latency mode, you can set the fields in the same
|
|
131
|
-
or subsequent call to configure().
|
|
132
|
-
```js
|
|
133
|
-
player.configure({
|
|
134
|
-
streaming: {
|
|
135
|
-
lowLatencyMode: true,
|
|
136
|
-
inaccurateManifestTolerance: 0,
|
|
137
|
-
rebufferingGoal: 0.01,
|
|
138
|
-
segmentPrefetchLimit: 2,
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
#### Detailed API Docs
|
|
146
|
-
|
|
147
|
-
For more detail on individual configuration options, please see the API docs for
|
|
148
|
-
{@link shaka.extern.PlayerConfiguration} and {@link shaka.Player#configure}.
|