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,365 +0,0 @@
|
|
|
1
|
-
# Manifest Parser Plugins
|
|
2
|
-
|
|
3
|
-
## Overview
|
|
4
|
-
|
|
5
|
-
This tutorial shows how to make a basic manifest parser plugin. This allows an
|
|
6
|
-
app to define a custom manifest format and still use Shaka Player to handle the
|
|
7
|
-
streaming and track switching.
|
|
8
|
-
|
|
9
|
-
The function of a manifest parser is to take a URL that was passed to `load()`
|
|
10
|
-
and give us back a manifest object. The parser should fetch the URL, parse the
|
|
11
|
-
manifest, and convert it to our format.
|
|
12
|
-
|
|
13
|
-
```js
|
|
14
|
-
function MyManifestParser() {
|
|
15
|
-
this.curId_ = 0;
|
|
16
|
-
this.config_ = null;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
MyManifestParser.prototype.configure = function(config) {
|
|
20
|
-
this.config_ = config;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
MyManifestParser.prototype.start = async function(uri, playerInterface) {
|
|
24
|
-
const type = shaka.net.NetworkingEngine.RequestType.MANIFEST;
|
|
25
|
-
const request = {
|
|
26
|
-
uris: [uri],
|
|
27
|
-
method: 'GET',
|
|
28
|
-
retryParameters: this.config_.retryParameters
|
|
29
|
-
};
|
|
30
|
-
const response =
|
|
31
|
-
await playerInterface.networkingEngine.request(type, request).promise;
|
|
32
|
-
return this.loadManifest_(response.data);
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
MyManifestParser.prototype.stop = function() {
|
|
36
|
-
return Promise.resolve();
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
shaka.media.ManifestParser.registerParserByExtension('json', MyManifestParser);
|
|
41
|
-
shaka.media.ManifestParser.registerParserByMime(
|
|
42
|
-
'application/json', MyManifestParser);
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
First, this defines a constructor called `MyManifestParser`. This is called by
|
|
46
|
-
the `Player` to create new parser instances. A new instance is created for
|
|
47
|
-
*each* load. This should setup any initial state that is needed.
|
|
48
|
-
|
|
49
|
-
#### configure
|
|
50
|
-
|
|
51
|
-
This method is called right after creating the object and when the configuration
|
|
52
|
-
changes. This is passed a {@link shaka.extern.ManifestConfiguration} object
|
|
53
|
-
from the Player.
|
|
54
|
-
|
|
55
|
-
#### start
|
|
56
|
-
|
|
57
|
-
This method is called to load the manifest. This is called with a string URI
|
|
58
|
-
that is passed to `load()` and a
|
|
59
|
-
{@link shaka.extern.ManifestParser.PlayerInterface} object. The interface
|
|
60
|
-
object contains a number of fields that are used to interact with the Player.
|
|
61
|
-
This includes the `NetworkingEngine` instance to make network requests. This
|
|
62
|
-
also includes callback methods that allow the parser to raise Player events and
|
|
63
|
-
filter the variants. This method should return a Promise that will resolve with
|
|
64
|
-
the parsed manifest.
|
|
65
|
-
|
|
66
|
-
#### stop
|
|
67
|
-
|
|
68
|
-
This method is called as part of `player.unload()`. This method should stop any
|
|
69
|
-
background timers and free any state. It is invalid to use the config object or
|
|
70
|
-
anything from the Player interface given to `start` after this is called. We
|
|
71
|
-
don't reuse parser instances, so we will *not* call `start()` again after this
|
|
72
|
-
is called. This should return a Promise that resolves when this object is
|
|
73
|
-
destroyed.
|
|
74
|
-
|
|
75
|
-
#### registration
|
|
76
|
-
|
|
77
|
-
At the end of the file, you should register the parser with the library. This
|
|
78
|
-
will allow it to be used by the `Player`. There are two methods:
|
|
79
|
-
`registerParserByExtension` and `registerParserByMime`. They both add parsers
|
|
80
|
-
to a registry of manifest parsers. When the Player gets a URI, it will
|
|
81
|
-
determine which parser to use. It will first try based on the file extension,
|
|
82
|
-
then it will make a HEAD request to the URI to get back a MIME type.
|
|
83
|
-
|
|
84
|
-
If you wish to unregister a parser, you can do so with
|
|
85
|
-
{@link shaka.media.ManifestParser.unregisterParserByMime}. Parsers registered
|
|
86
|
-
by extension cannot be unregistered at this time.
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
## Variants and Streams
|
|
90
|
-
|
|
91
|
-
The audio and video content of our Manifest structure is stored, on the highest
|
|
92
|
-
level, in an array of Variants. A Variant represents an audio+video pair.
|
|
93
|
-
The array holds all possible pairs the Player can choose from.
|
|
94
|
-
While playing, we will give these to the app (through `getVariantTracks`) and
|
|
95
|
-
will switch between them (if ABR is enabled).
|
|
96
|
-
|
|
97
|
-
A stream represents a collection of media data segments. The segments are all
|
|
98
|
-
the same type (audio/video/text) and all from the same version of the media
|
|
99
|
-
(e.g. English vs Spanish or 720p vs 1080p). A Stream object holds metadata that
|
|
100
|
-
describes what the stream contains as well as how to get the segments. Only one
|
|
101
|
-
stream of each type will be playing at once.
|
|
102
|
-
|
|
103
|
-
Multiple Variants can hold the same streams. For example, both the 720p and the
|
|
104
|
-
1080p variant can refer to the same audio stream. In this case, both Variant
|
|
105
|
-
objects must refer to the **same object**. It is not enough to use the same
|
|
106
|
-
stream ID; it must be the same object.
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
## Periods
|
|
110
|
-
|
|
111
|
-
While some manifest formats, such as MPEG-DASH, have the concept of a period,
|
|
112
|
-
our internal manifest structure (as of Shaka Player v3.0) does not organize
|
|
113
|
-
streams based on periods. If you are writing a manifest parser for such a
|
|
114
|
-
format, you will need to generate Variants yourself, combining together periods
|
|
115
|
-
and their component streams as needed. The resulting
|
|
116
|
-
{@link shaka.extern.Stream} objects should each span the entire presentation.
|
|
117
|
-
|
|
118
|
-
All media times in the manifest are relative to the presentation, *not* the
|
|
119
|
-
Period. This means that you must account for period start times in your segment
|
|
120
|
-
references. (This changed in Shaka Player v3.0.)
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
## PresentationTimeline
|
|
124
|
-
|
|
125
|
-
{@link shaka.media.PresentationTimeline}
|
|
126
|
-
|
|
127
|
-
The segment index doesn't need to handle segment availability for live
|
|
128
|
-
content. All the segment index needs to do is return the segment references.
|
|
129
|
-
The `presentationTimeline` in the manifest will be used to handle availability.
|
|
130
|
-
All times in the timeline are in seconds; 0 represents when the live stream
|
|
131
|
-
started.
|
|
132
|
-
|
|
133
|
-
An availability window defines a moving time window in which a segment can be
|
|
134
|
-
downloaded. This is defined by a segment availability duration that indicates
|
|
135
|
-
the number of seconds that a segment will remain available. So if the
|
|
136
|
-
availability duration is 60 seconds, then the last 60 seconds of content is
|
|
137
|
-
available.
|
|
138
|
-
|
|
139
|
-
The same timeline class handles on-demand content, too. The availability window
|
|
140
|
-
starts at 0 and ends at the duration of the media.
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
## Media Segments
|
|
144
|
-
|
|
145
|
-
A Stream contains a number of segment references contained in a segment index.
|
|
146
|
-
A segment reference contains important metadata about the segment: the start
|
|
147
|
-
and end times, the URL, and optionally a byte range into that URL. A segment
|
|
148
|
-
reference is created using the {@link shaka.media.SegmentReference} constructor.
|
|
149
|
-
|
|
150
|
-
Rather than storing the references in a raw array, the manifest parser stores
|
|
151
|
-
them in a {@link shaka.media.SegmentIndex} object. This object is allowed to
|
|
152
|
-
be null before createSegmentIndex() is called, and thus defer the translation of
|
|
153
|
-
abstract segment descriptions (such as DASH's `SegmentTemplate`) into concrete
|
|
154
|
-
ones until necessary.
|
|
155
|
-
|
|
156
|
-
Media segment times are all in terms of the presentation timeline. So if the
|
|
157
|
-
content was originally multi-period, the period start time must be accounted for
|
|
158
|
-
in the reference's `timestampOffset` field.
|
|
159
|
-
|
|
160
|
-
First we ask for the index that corresponds with a start time. Then on update,
|
|
161
|
-
we increment the index and ask for segments in order. The value of the index
|
|
162
|
-
doesn't matter, but indices must be sequential integers.
|
|
163
|
-
|
|
164
|
-
#### createSegmentIndex():Promise
|
|
165
|
-
|
|
166
|
-
This is called first before any other method. This allows an index to be
|
|
167
|
-
fetched over the network, if needed. This method should return a Promise that
|
|
168
|
-
will resolve when the segment index is ready. This is only ever called once.
|
|
169
|
-
|
|
170
|
-
#### segmentIndex
|
|
171
|
-
|
|
172
|
-
This is *not* a function, but a {@link shaka.media.SegmentIndex} tracking all
|
|
173
|
-
available segments.
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
## shaka.media.SegmentIndex
|
|
177
|
-
|
|
178
|
-
To help in handling segment references, there is a
|
|
179
|
-
{@link shaka.media.SegmentIndex} type. This is given an array of references.
|
|
180
|
-
It handles merging new segments, and expanding the list of segments for live
|
|
181
|
-
streams.
|
|
182
|
-
|
|
183
|
-
```js
|
|
184
|
-
const references = refs.map(function(r) {
|
|
185
|
-
// Should return an array of possible URI choices; this is used for failover
|
|
186
|
-
// in the event of network error. This is a function to defer calculations.
|
|
187
|
-
const getUris = function() { return [r.uri]; };
|
|
188
|
-
|
|
189
|
-
return new shaka.media.SegmentReference(
|
|
190
|
-
r.start, r.end, getUris,
|
|
191
|
-
/* startByte */ 0,
|
|
192
|
-
/* endByte */ null,
|
|
193
|
-
initSegmentReference,
|
|
194
|
-
/* timestampOffset */ 0,
|
|
195
|
-
/* appendWindowStart */ 0,
|
|
196
|
-
/* appendWindowEnd */ Infinity);
|
|
197
|
-
});
|
|
198
|
-
|
|
199
|
-
const index = new shaka.media.SegmentIndex(references);
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
To merge updates and remove old references to reduce the memory footprint,
|
|
203
|
-
simply create a new array of segments and call `mergeAndEvict`. Any
|
|
204
|
-
existing segments will be updated, new segments will be added, and old
|
|
205
|
-
unavailable references will be removed.
|
|
206
|
-
|
|
207
|
-
To expand the list of references on a timer, as is done for DASH's
|
|
208
|
-
SegmentTemplate, call `index.updateEvery` with a callback that evicts old
|
|
209
|
-
references and returns an array of new references.
|
|
210
|
-
|
|
211
|
-
```js
|
|
212
|
-
index.updateEvery(updateIntervalSeconds, () => {
|
|
213
|
-
// Evict old references
|
|
214
|
-
index.evict(windowStartTime);
|
|
215
|
-
|
|
216
|
-
// Generate new references to append to the end of the index
|
|
217
|
-
const references = [];
|
|
218
|
-
// ...
|
|
219
|
-
return references;
|
|
220
|
-
});
|
|
221
|
-
```
|
|
222
|
-
|
|
223
|
-
If the callback returns null, the update timer for this index will be stopped.
|
|
224
|
-
(NOTE: This method was introduced in v3.0.0, but the interpretation of the
|
|
225
|
-
callback's return changed in v3.0.8 to fix a bug in our DASH SegmentTemplate
|
|
226
|
-
support. We apologize for any inconvenience.)
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
## Manifest Updates
|
|
230
|
-
|
|
231
|
-
In order to support Live content, the manifest may need to be updated. In the
|
|
232
|
-
`start()` method, the manifest parser should start its own timers (e.g.
|
|
233
|
-
`setInterval`) to update the manifest. Then it should re-parse the manifest
|
|
234
|
-
periodically. To add new segments to the streams, simply add them to the
|
|
235
|
-
segment index. Because the original manifest object is modified in-place,
|
|
236
|
-
adding them to the index will allow the Player to use them.
|
|
237
|
-
|
|
238
|
-
After adding new content, you should call the `filter` method on the player
|
|
239
|
-
interface. This removes any streams that were added that are incompatible with
|
|
240
|
-
the platform. Keep in mind that this is an asynchronous method, and thus you
|
|
241
|
-
will need to use it in conjunction with `.then()` or `await`.
|
|
242
|
-
You should also call the `makeTextStreamsForClosedCaptions` method on the
|
|
243
|
-
player interface, which is required for embedded captions (for example, CEA
|
|
244
|
-
608) to work; it makes dummy text streams to represent these tracks.
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
## Full Manifest Parser Example
|
|
248
|
-
|
|
249
|
-
```js
|
|
250
|
-
MyManifestParser.prototype.loadManifest_ = function(data) {
|
|
251
|
-
// |data| is the response data from load(); but in this example, we ignore it.
|
|
252
|
-
|
|
253
|
-
// The arguments are only used for live.
|
|
254
|
-
const timeline = new shaka.media.PresentationTimeline(null, 0);
|
|
255
|
-
timeline.setDuration(3600); // seconds
|
|
256
|
-
|
|
257
|
-
return {
|
|
258
|
-
presentationTimeline: timeline,
|
|
259
|
-
minBufferTime: 5, // seconds
|
|
260
|
-
offlineSessionIds: [],
|
|
261
|
-
variants: [
|
|
262
|
-
this.loadVariant_(true, true),
|
|
263
|
-
this.loadVariant_(true, false)
|
|
264
|
-
],
|
|
265
|
-
textStreams: [
|
|
266
|
-
this.loadStream_('text'),
|
|
267
|
-
this.loadStream_('text')
|
|
268
|
-
]
|
|
269
|
-
};
|
|
270
|
-
};
|
|
271
|
-
|
|
272
|
-
MyManifestParser.prototype.loadVariant_ = function(hasVideo, hasAudio) {
|
|
273
|
-
console.assert(hasVideo || hasAudio);
|
|
274
|
-
|
|
275
|
-
return {
|
|
276
|
-
id: this.curId_++, // globally unique ID
|
|
277
|
-
language: 'en',
|
|
278
|
-
primary: false,
|
|
279
|
-
audio: hasAudio ? this.loadStream_('audio') : null,
|
|
280
|
-
video: hasVideo ? this.loadStream_('video') : null,
|
|
281
|
-
bandwidth: 8000, // bits/sec, audio+video combined
|
|
282
|
-
allowedByApplication: true, // always initially true
|
|
283
|
-
allowedByKeySystem: true // always initially true
|
|
284
|
-
};
|
|
285
|
-
};
|
|
286
|
-
|
|
287
|
-
MyManifestParser.prototype.loadStream_ = function(type) {
|
|
288
|
-
const getUris = function() { return ['https://example.com/init']; };
|
|
289
|
-
const initSegmentReference = new shaka.media.InitSegmentReference(getUris,
|
|
290
|
-
/* startByte= */ 0, /* endByte= */ null);
|
|
291
|
-
|
|
292
|
-
const index = new shaka.media.SegmentIndex([
|
|
293
|
-
// Times are in seconds, relative to the presentation
|
|
294
|
-
this.loadReference_(0, 0, 10, initSegmentReference),
|
|
295
|
-
this.loadReference_(1, 10, 20, initSegmentReference),
|
|
296
|
-
this.loadReference_(2, 20, 30, initSegmentReference),
|
|
297
|
-
]);
|
|
298
|
-
|
|
299
|
-
const id = this.curId_++;
|
|
300
|
-
return {
|
|
301
|
-
id: id, // globally unique ID
|
|
302
|
-
originalId: id, // original ID from manifest, if any
|
|
303
|
-
createSegmentIndex: function() { return Promise.resolve(); },
|
|
304
|
-
segmentIndex: index,
|
|
305
|
-
mimeType: type == 'video' ?
|
|
306
|
-
'video/webm' : (type == 'audio' ? 'audio/webm' : 'text/vtt'),
|
|
307
|
-
codecs: type == 'video' ? 'vp9' : (type == 'audio' ? 'vorbis' : ''),
|
|
308
|
-
frameRate: type == 'video' ? 24 : undefined,
|
|
309
|
-
pixelAspectRatio: type == 'video' ? 4 / 3 : undefined,
|
|
310
|
-
bandwidth: 4000, // bits/sec
|
|
311
|
-
width: type == 'video' ? 640 : undefined,
|
|
312
|
-
height: type == 'video' ? 480 : undefined,
|
|
313
|
-
kind: type == 'text' ? 'subtitles' : undefined,
|
|
314
|
-
channelsCount: type == 'audio' ? 2 : undefined,
|
|
315
|
-
encrypted: false,
|
|
316
|
-
drmInfos: [],
|
|
317
|
-
keyIds: new Set(),
|
|
318
|
-
language: 'en',
|
|
319
|
-
label: 'my_stream',
|
|
320
|
-
type: type,
|
|
321
|
-
primary: false,
|
|
322
|
-
trickModeVideo: null,
|
|
323
|
-
emsgSchemeIdUris: null,
|
|
324
|
-
roles: []
|
|
325
|
-
channelsCount: type == 'audio' ? 6 : null,
|
|
326
|
-
audioSamplingRate: type == 'audio' ? 44100 : null,
|
|
327
|
-
closedCaptions: new Map(),
|
|
328
|
-
};
|
|
329
|
-
};
|
|
330
|
-
|
|
331
|
-
MyManifestParser.prototype.loadReference_ =
|
|
332
|
-
function(position, start, end, initSegmentReference) {
|
|
333
|
-
const getUris = function() { return ['https://example.com/ref_' + position]; };
|
|
334
|
-
return new shaka.media.SegmentReference(
|
|
335
|
-
start, end, getUris,
|
|
336
|
-
/* startByte */ 0,
|
|
337
|
-
/* endByte */ null,
|
|
338
|
-
initSegmentReference,
|
|
339
|
-
/* timestampOffset */ 0,
|
|
340
|
-
/* appendWindowStart */ 0,
|
|
341
|
-
/* appendWindowEnd */ Infinity);
|
|
342
|
-
};
|
|
343
|
-
```
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
## Encrypted Content
|
|
347
|
-
|
|
348
|
-
If your content is encrypted, there are a few changes to the manifest you need
|
|
349
|
-
to do. First, for each Stream that contains encrypted content, you need to set
|
|
350
|
-
`stream.encrypted` to true and put the key IDs that the stream is encrypted with
|
|
351
|
-
in the `stream.keyIds` set. Filling out the `keyIds` is technically optional,
|
|
352
|
-
but it allows the player to choose streams more intelligently based on which
|
|
353
|
-
keys are available. If `keyIds` is not filled out, missing keys may cause
|
|
354
|
-
playback to stall.
|
|
355
|
-
|
|
356
|
-
You must also set `stream.drmInfos` to an array of {@link shaka.extern.DrmInfo}
|
|
357
|
-
objects. All the fields (except the key-system name) can be set to the default
|
|
358
|
-
and will be replaced by settings from the Player configuration. If the
|
|
359
|
-
`drmInfos` array is empty, the content is expected to be clear.
|
|
360
|
-
|
|
361
|
-
If you set `drmInfo.initData` to a non-empty array, we will use that to
|
|
362
|
-
initialize EME. We will override any encryption info in the media (e.g.
|
|
363
|
-
`pssh` boxes in MP4). If you don't set this field (and it isn't set in the
|
|
364
|
-
app config), then we will initialize EME based on the encryption info in the
|
|
365
|
-
media.
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
# Network and Buffering Configuration
|
|
2
|
-
|
|
3
|
-
#### Networking Configuration
|
|
4
|
-
|
|
5
|
-
Shaka Player has separate network retry settings for each of the different
|
|
6
|
-
types of requests: manifest, license, and segment requests. For example, you
|
|
7
|
-
may want a failed license request to be retried differently from a failed
|
|
8
|
-
segment request.
|
|
9
|
-
|
|
10
|
-
The three separate retry settings are found under `drm.retryParameters` (for
|
|
11
|
-
license requests), `manifest.retryParameters` (for manifest requests), and
|
|
12
|
-
`streaming.retryParameters` (for segment requests). All three structures are
|
|
13
|
-
identical:
|
|
14
|
-
|
|
15
|
-
```js
|
|
16
|
-
retryParameters: {
|
|
17
|
-
timeout: 30000, // timeout in ms, after which we abort
|
|
18
|
-
stallTimeout: 5000, // stall timeout in ms, after which we abort
|
|
19
|
-
connectionTimeout: 10000, // connection timeout in ms, after which we abort
|
|
20
|
-
maxAttempts: 2, // the maximum number of requests before we fail
|
|
21
|
-
baseDelay: 1000, // the base delay in ms between retries
|
|
22
|
-
backoffFactor: 2, // the multiplicative backoff factor between retries
|
|
23
|
-
fuzzFactor: 0.5, // the fuzz factor to apply to each retry delay
|
|
24
|
-
}
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
Each time we retry, the backoff factor is applied to the delay between retries.
|
|
28
|
-
So, for example, if the base delay is 1s, and the backoff factor is 2:
|
|
29
|
-
|
|
30
|
-
1. initial request at time t = 0 seconds
|
|
31
|
-
2. delay of 1, retry at t = (0 + 1) = 1
|
|
32
|
-
3. delay of 2, retry at t = (1 + 2) = 3
|
|
33
|
-
4. delay of 4, retry at t = (3 + 4) = 7
|
|
34
|
-
5. delay of 8, retry at t = (7 + 8) = 15
|
|
35
|
-
|
|
36
|
-
and so on. To avoid many clients hammering a server at the same exact time,
|
|
37
|
-
we also apply a fuzz factor. A fuzz factor of 0.5 means we fuzz the delay
|
|
38
|
-
50% in either direction. So if the ideal delay is 8, the actual delay will be
|
|
39
|
-
randomly chosen between 4 and 12. To extend our earlier example:
|
|
40
|
-
|
|
41
|
-
1. initial request
|
|
42
|
-
2. delay of 1±50% (0.5 to 1.5), retry
|
|
43
|
-
3. delay of 2±50% (1 to 3), retry
|
|
44
|
-
4. delay of 4±50% (2 to 6), retry
|
|
45
|
-
5. delay of 8±50% (4 to 12), retry
|
|
46
|
-
|
|
47
|
-
You should consider the default backoff and fuzz factors as a recommendation of
|
|
48
|
-
best practice. The base delay, timeout, and maximum number of attempts should
|
|
49
|
-
be customized for your application's requirements.
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
#### Buffering Configuration
|
|
53
|
-
|
|
54
|
-
Shaka Player's buffering system has three parameters, all of which are nested
|
|
55
|
-
under `streaming` in the config object: `bufferingGoal`, `rebufferingGoal`, and
|
|
56
|
-
`bufferBehind`. All are expressed in seconds.
|
|
57
|
-
|
|
58
|
-
`bufferingGoal` is the amount of content we try to buffer. For example, if
|
|
59
|
-
this is set to 30, we fetch segments until we have at least 30 seconds buffered.
|
|
60
|
-
|
|
61
|
-
`rebufferingGoal` is the amount of content we have to have buffered before we
|
|
62
|
-
can play. For example, if this is 15, we stay in a buffering state until we
|
|
63
|
-
have at least 15 seconds buffered. This affects both buffering at startup
|
|
64
|
-
and rebuffering later during playback.
|
|
65
|
-
|
|
66
|
-
`bufferBehind` is the amount of content we keep in buffer behind the playhead.
|
|
67
|
-
For example, if this is 30, we keep 30 seconds of content buffered behind the
|
|
68
|
-
video's `currentTime`. When we have more than 30 seconds buffered behind,
|
|
69
|
-
content will be removed from the start of the buffer to save memory.
|
|
70
|
-
This is a minimum; if the stream's max segment size is longer than the
|
|
71
|
-
'bufferBehind', then that will be used instead.
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
*NOTES:*
|
|
75
|
-
- *`rebufferingGoal` should always be less than `bufferingGoal`.*
|
|
76
|
-
- *A DASH manifest's `minBufferTime`, if greater, overrides `rebufferingGoal`.*
|
|
77
|
-
- *You can ignore `minBufferTime` by setting the
|
|
78
|
-
`manifest.dash.ignoreMinBufferTime` configuration to true.*
|
|
79
|
-
|
|
80
|
-
All of these settings should be customized for your application. The default
|
|
81
|
-
values are very conservative.
|
|
82
|
-
|
|
83
|
-
#### Buffering and Adaptation
|
|
84
|
-
|
|
85
|
-
While we are playing, we will only buffer the currently chosen stream. We do
|
|
86
|
-
not download other bitrates until AbrManager tells us to switch. We also (by
|
|
87
|
-
default) do not clear the buffer when we adapt. This means that when we adapt
|
|
88
|
-
to a different bitrate, it may not be visible for a while because the old
|
|
89
|
-
buffer will still be used. There will be at most `bufferingGoal` seconds left
|
|
90
|
-
of the old bitrate in the buffer.
|
|
91
|
-
|
|
92
|
-
#### Try it out
|
|
93
|
-
|
|
94
|
-
Use the code from {@tutorial basic-usage} and try configuring some of these
|
|
95
|
-
parameters in `initPlayer()` to see how they affect playback.
|
|
96
|
-
|
|
97
|
-
#### Server Considerations
|
|
98
|
-
|
|
99
|
-
Shaka Player makes a number of requests to various servers while streaming. You
|
|
100
|
-
need to make sure that Shaka has correct access to those resources. Browsers
|
|
101
|
-
impose several restrictions on the content that a webpage has access to.
|
|
102
|
-
|
|
103
|
-
One restriction is [CORS][] (Cross-Origin Resource Sharing). This requires
|
|
104
|
-
network requests to be made to the same origin, or for the server to explicitly
|
|
105
|
-
give access. An "origin" refers to the domain name (e.g., `api.example.com`),
|
|
106
|
-
the scheme (e.g., `https:`), and the port (e.g., 80). If you host your assets on
|
|
107
|
-
a different origin than your web app, then you'll need to set CORS headers on
|
|
108
|
-
the asset server to ensure we have access. For some content, this will also
|
|
109
|
-
require allowing the `Range` header by sending the CORS header
|
|
110
|
-
`Access-Control-Allow-Headers`.
|
|
111
|
-
|
|
112
|
-
Another restriction is called mixed-content. If your webpage is accessed using
|
|
113
|
-
`https:`, then all resources that are loaded also need to be loaded using
|
|
114
|
-
`https:`. This means that the manifest and all the media segments need to be
|
|
115
|
-
loaded using `https:`. This can be most easily done by either having all the
|
|
116
|
-
URLs in your manifests always use `https:`, or by having it not include the
|
|
117
|
-
scheme (e.g., `//example.com/file.mp4`).
|
|
118
|
-
|
|
119
|
-
[CORS]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS
|