shaka-player 3.3.2 → 4.0.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/.csslintrc +11 -1
- package/.github/ISSUE_TEMPLATE/bug_report.md +1 -1
- package/.github/pull_request_template.md +6 -34
- package/.github/workflows/build-and-test.yaml +129 -0
- package/.github/workflows/custom-actions/prep-for-appspot/action.yaml +56 -0
- package/.github/workflows/custom-actions/set-commit-status/action.yaml +41 -0
- package/.github/workflows/demo-version-index.yaml +37 -0
- package/.github/workflows/nightly-demo.yaml +42 -0
- package/.github/workflows/release-please.yaml +168 -0
- package/.github/workflows/safari-homedir-launcher.sh +18 -0
- package/.github/workflows/selenium-lab-tests.yaml +92 -0
- package/.github/workflows/sync-labels.yaml +33 -0
- package/.github/workflows/update-issues.yaml +29 -0
- package/.github/workflows/validate-pr-title.yaml +35 -0
- package/AUTHORS +3 -0
- package/CHANGELOG.md +1866 -1675
- package/CONTRIBUTING.md +2 -2
- package/CONTRIBUTORS +3 -0
- package/README.md +16 -13
- package/app-engine/README.md +9 -0
- package/app-engine/demo-version-index/README.md +14 -0
- package/app-engine/demo-version-index/app.yaml +28 -0
- package/app-engine/demo-version-index/generate.py +164 -0
- package/app-engine/demo-version-index/main.py +11 -0
- package/app-engine/demo-version-index/requirements.txt +5 -0
- package/app-engine/demo-version-index/templates/index.html +114 -0
- package/app-engine/shaka-player-demo/README.md +18 -0
- package/app-engine/shaka-player-demo/app.yaml +61 -0
- package/app-engine/shaka-player-demo/main.py +95 -0
- package/app-engine/shaka-player-demo/posters/10yo.png +0 -0
- package/app-engine/shaka-player-demo/posters/10yo.xcf +0 -0
- package/app-engine/shaka-player-demo/posters/1yo.jpg +0 -0
- package/app-engine/shaka-player-demo/posters/2yo.png +0 -0
- package/app-engine/shaka-player-demo/posters/2yo.xcf +0 -0
- package/app-engine/shaka-player-demo/posters/3yo.png +0 -0
- package/app-engine/shaka-player-demo/posters/3yo.xcf +0 -0
- package/app-engine/shaka-player-demo/posters/4yo.png +0 -0
- package/app-engine/shaka-player-demo/posters/4yo.xcf +0 -0
- package/app-engine/shaka-player-demo/posters/5yo.png +0 -0
- package/app-engine/shaka-player-demo/posters/5yo.xcf +0 -0
- package/app-engine/shaka-player-demo/posters/6yo.png +0 -0
- package/app-engine/shaka-player-demo/posters/6yo.xcf +0 -0
- package/app-engine/shaka-player-demo/posters/7yo.png +0 -0
- package/app-engine/shaka-player-demo/posters/7yo.xcf +0 -0
- package/app-engine/shaka-player-demo/posters/8yo.png +0 -0
- package/app-engine/shaka-player-demo/posters/8yo.xcf +0 -0
- package/app-engine/shaka-player-demo/posters/9yo.png +0 -0
- package/app-engine/shaka-player-demo/posters/9yo.xcf +0 -0
- package/app-engine/shaka-player-demo/posters/audioOnly.gif +0 -0
- package/app-engine/shaka-player-demo/posters/audioRickRoll.gif +0 -0
- package/app-engine/shaka-player-demo/posters/colorbars.gif +0 -0
- package/app-engine/shaka-player-demo/posters/fireworks.jpg +0 -0
- package/app-engine/shaka-player-demo/posters/party-hat.png +0 -0
- package/app-engine/shaka-player-demo/posters/sources.txt +46 -0
- package/app-engine/shaka-player-demo/posters/standard.png +0 -0
- package/app-engine/shaka-player-demo/posters/trek.jpg +0 -0
- package/app-engine/shaka-player-demo/posters/valentines.png +0 -0
- package/app-engine/shaka-player-demo/posters/zombie.jpg +0 -0
- package/app-engine/shaka-player-demo/posters.py +110 -0
- package/app-engine/shaka-player-demo/requirements.txt +5 -0
- package/app-engine/shaka-player-demo/time.txt +1 -0
- package/build/README.md +3 -3
- package/build/checkversion.py +1 -1
- package/build/compiler.py +1 -1
- package/build/conformance.textproto +13 -0
- package/build/docker/Dockerfile +20 -0
- package/build/docker/docker-compose.yml +10 -0
- package/build/gendeps.py +18 -15
- package/build/shaka-lab.yaml +161 -0
- package/build/shakaBuildHelpers.py +4 -29
- package/build/test.py +94 -29
- package/build/types/core +0 -1
- package/build/types/polyfill +1 -3
- package/build/wrapper.template.js +2 -2
- package/demo/TengwarTelcontar.woff2 +0 -0
- package/demo/asset_card.js +1 -2
- package/demo/cast_receiver/index.html +1 -1
- package/demo/cast_receiver/receiver_app.css +14 -14
- package/demo/common/asset.js +17 -1
- package/demo/common/assets.js +31 -0
- package/demo/common/message_ids.js +6 -3
- package/demo/config.js +10 -12
- package/demo/custom.js +39 -1
- package/demo/customWarning.txt +2 -2
- package/demo/demo.less +29 -18
- package/demo/demo_uncompiled.js +1 -13
- package/demo/demo_utils.js +0 -1
- package/demo/index.html +1 -1
- package/demo/locales/en.json +6 -3
- package/demo/locales/source.json +22 -10
- package/demo/main.js +12 -9
- package/demo/search.js +2 -1
- package/dist/controls.css +3 -3
- package/dist/controls.css.map +1 -1
- package/dist/demo.compiled.debug.js +236 -232
- package/dist/demo.compiled.debug.map +4 -4
- package/dist/demo.compiled.js +236 -232
- package/dist/demo.compiled.map +4 -4
- package/dist/demo.css +1 -1
- package/dist/demo.css.map +1 -1
- package/dist/deps.js +229 -226
- package/dist/locales.js +34 -32
- package/dist/receiver.compiled.debug.js +75 -73
- package/dist/receiver.compiled.debug.map +4 -4
- package/dist/receiver.compiled.js +75 -73
- package/dist/receiver.compiled.map +4 -4
- package/dist/shaka-player.compiled.d.ts +321 -314
- package/dist/shaka-player.compiled.debug.d.ts +321 -314
- package/dist/shaka-player.compiled.debug.externs.js +140 -129
- package/dist/shaka-player.compiled.debug.js +527 -592
- package/dist/shaka-player.compiled.debug.map +4 -4
- package/dist/shaka-player.compiled.externs.js +140 -129
- package/dist/shaka-player.compiled.js +836 -860
- package/dist/shaka-player.compiled.map +4 -4
- package/dist/shaka-player.ui.d.ts +367 -358
- package/dist/shaka-player.ui.debug.d.ts +367 -358
- package/dist/shaka-player.ui.debug.externs.js +148 -129
- package/dist/shaka-player.ui.debug.js +586 -649
- package/dist/shaka-player.ui.debug.map +4 -4
- package/dist/shaka-player.ui.externs.js +148 -129
- package/dist/shaka-player.ui.js +1008 -1028
- package/dist/shaka-player.ui.map +4 -4
- package/docs/design/REDESIGN.md +33 -33
- package/docs/design/bg-fetch.md +2 -2
- package/docs/design/codec_preferences.md +1 -1
- package/docs/design/dash-audio-channels.md +3 -3
- package/docs/design/dash-manifests.md +1 -1
- package/docs/design/gap-jumping.md +3 -3
- package/docs/design/preload.md +2 -2
- package/docs/tutorials/config.md +0 -2
- package/docs/tutorials/drm-config.md +5 -0
- package/docs/tutorials/fairplay.md +7 -22
- package/docs/tutorials/faq.md +8 -19
- package/docs/tutorials/index.json +3 -8
- package/docs/tutorials/plugins.md +4 -6
- package/docs/tutorials/selenium-grid-config.md +122 -0
- package/docs/tutorials/upgrade.md +83 -11
- package/docs/tutorials/welcome.md +10 -2
- package/externs/cmcd.js +1 -1
- package/externs/polyfill.js +15 -0
- package/externs/shaka/manifest.js +5 -1
- package/externs/shaka/net.js +12 -0
- package/externs/shaka/offline.js +5 -1
- package/externs/shaka/player.js +39 -32
- package/externs/shaka/text.js +12 -12
- package/externs/sourcebuffer.js +15 -0
- package/karma.conf.js +137 -30
- package/lib/abr/simple_abr_manager.js +12 -6
- package/lib/ads/client_side_ad.js +13 -2
- package/lib/ads/client_side_ad_manager.js +22 -4
- package/lib/cast/cast_proxy.js +3 -4
- package/lib/cast/cast_utils.js +0 -1
- package/lib/cea/cea608_data_channel.js +2 -2
- package/lib/cea/cea708_service.js +5 -4
- package/lib/cea/mp4_cea_parser.js +11 -5
- package/lib/cea/sei_processor.js +6 -3
- package/lib/dash/content_protection.js +85 -5
- package/lib/dash/dash_parser.js +10 -12
- package/lib/dash/mpd_utils.js +4 -5
- package/lib/dash/segment_list.js +1 -2
- package/lib/dash/segment_template.js +3 -3
- package/lib/hls/hls_parser.js +386 -749
- package/lib/hls/manifest_text_parser.js +5 -6
- package/lib/media/adaptation_set.js +1 -2
- package/lib/media/content_workarounds.js +2 -2
- package/lib/media/drm_engine.js +105 -55
- package/lib/media/gap_jumping_controller.js +10 -45
- package/lib/media/media_source_engine.js +90 -17
- package/lib/media/mp4_segment_index_parser.js +1 -4
- package/lib/media/playhead.js +4 -7
- package/lib/media/presentation_timeline.js +19 -10
- package/lib/media/segment_index.js +13 -46
- package/lib/media/segment_reference.js +47 -1
- package/lib/media/streaming_engine.js +35 -17
- package/lib/media/time_ranges_utils.js +5 -12
- package/lib/media/video_wrapper.js +1 -1
- package/lib/net/networking_engine.js +4 -1
- package/lib/offline/indexeddb/v1_storage_cell.js +1 -0
- package/lib/offline/indexeddb/v2_storage_cell.js +1 -0
- package/lib/offline/manifest_converter.js +1 -0
- package/lib/offline/storage.js +104 -136
- package/lib/player.js +50 -216
- package/lib/polyfill/all.js +2 -3
- package/lib/polyfill/encryption_scheme.js +1 -1
- package/lib/polyfill/media_capabilities.js +15 -9
- package/lib/polyfill/mediasource.js +0 -28
- package/lib/polyfill/patchedmediakeys_nop.js +2 -0
- package/lib/polyfill/patchedmediakeys_webkit.js +2 -0
- package/lib/polyfill/symbol.js +46 -0
- package/lib/text/cue.js +1 -7
- package/lib/text/lrc_text_parser.js +8 -0
- package/lib/text/mp4_ttml_parser.js +8 -0
- package/lib/text/mp4_vtt_parser.js +8 -0
- package/lib/text/sbv_text_parser.js +8 -0
- package/lib/text/simple_text_displayer.js +3 -8
- package/lib/text/srt_text_parser.js +8 -0
- package/lib/text/ssa_text_parser.js +8 -0
- package/lib/text/text_engine.js +19 -3
- package/lib/text/ttml_text_parser.js +16 -5
- package/lib/text/ui_text_displayer.js +2 -8
- package/lib/text/vtt_text_parser.js +24 -2
- package/lib/text/web_vtt_generator.js +1 -7
- package/lib/util/buffer_utils.js +1 -3
- package/lib/util/ebml_parser.js +3 -3
- package/lib/util/error.js +10 -14
- package/lib/util/fairplay_utils.js +109 -0
- package/lib/util/functional.js +0 -42
- package/lib/util/iterables.js +0 -46
- package/lib/util/mime_utils.js +2 -0
- package/lib/util/mp4_box_parsers.js +1 -4
- package/lib/util/mp4_parser.js +5 -7
- package/lib/util/periods.js +10 -11
- package/lib/util/platform.js +48 -3
- package/lib/util/player_configuration.js +12 -6
- package/lib/util/pssh.js +24 -8
- package/lib/util/stream_utils.js +96 -25
- package/lib/util/string_utils.js +3 -5
- package/lib/util/uint8array_utils.js +3 -21
- package/lib/util/xml_utils.js +16 -8
- package/package.json +61 -36
- package/roadmap.md +27 -27
- package/shaka-player.uncompiled.js +1 -3
- package/test/abr/simple_abr_manager_unit.js +3 -8
- package/test/ads/ad_manager_unit.js +0 -6
- package/test/cast/cast_proxy_unit.js +0 -8
- package/test/cast/cast_receiver_integration.js +1 -18
- package/test/cast/cast_receiver_unit.js +1 -9
- package/test/cast/cast_sender_unit.js +0 -6
- package/test/cast/cast_utils_unit.js +1 -13
- package/test/cea/cea608_memory_unit.js +0 -5
- package/test/cea/cea708_service_unit.js +0 -7
- package/test/cea/cea708_window_unit.js +0 -5
- package/test/cea/cea_decoder_unit.js +0 -6
- package/test/cea/dtvcc_packet_builder_unit.js +0 -3
- package/test/cea/dtvcc_packet_unit.js +0 -5
- package/test/cea/mp4_cea_parser_unit.js +0 -4
- package/test/dash/dash_parser_content_protection_unit.js +45 -10
- package/test/dash/dash_parser_live_unit.js +2 -15
- package/test/dash/dash_parser_manifest_unit.js +2 -40
- package/test/dash/dash_parser_segment_base_unit.js +1 -8
- package/test/dash/dash_parser_segment_list_unit.js +1 -7
- package/test/dash/dash_parser_segment_template_unit.js +3 -13
- package/test/dash/mpd_utils_unit.js +3 -11
- package/test/demo/demo_unit.js +2 -6
- package/test/deprecate/enforcer_unit.js +0 -4
- package/test/deprecate/version_unit.js +0 -2
- package/test/hls/hls_live_unit.js +101 -234
- package/test/hls/hls_parser_unit.js +517 -447
- package/test/hls/manifest_text_parser_unit.js +0 -10
- package/test/media/adaptation_set_criteria_unit.js +3 -7
- package/test/media/adaptation_set_unit.js +0 -2
- package/test/media/buffering_observer_unit.js +1 -4
- package/test/media/closed_caption_parser_unit.js +0 -3
- package/test/media/drm_engine_integration.js +2 -15
- package/test/media/drm_engine_unit.js +90 -144
- package/test/media/manifest_parser_unit.js +0 -4
- package/test/media/media_source_engine_integration.js +26 -10
- package/test/media/media_source_engine_unit.js +8 -20
- package/test/media/mp4_segment_index_parser_unit.js +0 -4
- package/test/media/play_rate_controller_unit.js +0 -4
- package/test/media/playhead_unit.js +35 -207
- package/test/media/presentation_timeline_unit.js +4 -7
- package/test/media/quality_observer_unit.js +0 -4
- package/test/media/region_observer_unit.js +1 -6
- package/test/media/region_timeline_unit.js +0 -3
- package/test/media/segment_index_unit.js +15 -31
- package/test/media/segment_reference_unit.js +0 -3
- package/test/media/stall_detector_unit.js +0 -5
- package/test/media/streaming_engine_integration.js +13 -75
- package/test/media/streaming_engine_unit.js +14 -37
- package/test/media/time_ranges_utils_unit.js +0 -7
- package/test/media/transmuxer_integration.js +0 -6
- package/test/media/webm_segment_index_parser_unit.js +0 -4
- package/test/net/data_uri_plugin_unit.js +0 -7
- package/test/net/http_plugin_unit.js +0 -9
- package/test/net/networking_engine_unit.js +0 -11
- package/test/offline/download_progress_estimator_unit.js +0 -2
- package/test/offline/indexeddb_storage_unit.js +0 -6
- package/test/offline/manifest_convert_unit.js +34 -12
- package/test/offline/offline_integration.js +1 -10
- package/test/offline/offline_manifest_parser_unit.js +1 -6
- package/test/offline/offline_scheme_unit.js +0 -8
- package/test/offline/offline_uri_unit.js +0 -2
- package/test/offline/storage_compatibility_unit.js +1 -14
- package/test/offline/storage_integration.js +6 -31
- package/test/player_external.js +1 -15
- package/test/player_integration.js +38 -28
- package/test/player_load_graph_integration.js +1 -6
- package/test/player_src_equals_external.js +3 -9
- package/test/player_src_equals_integration.js +0 -7
- package/test/player_unit.js +78 -37
- package/test/routing/walker_unit.js +0 -8
- package/test/test/assets/large_file.mpd +1 -1
- package/test/test/boot.js +75 -22
- package/test/test/externs/jasmine.js +2 -2
- package/test/test/externs/karma.js +4 -0
- package/test/test/namespace.js +10 -0
- package/test/test/util/canned_idb.js +0 -8
- package/test/test/util/cea_utils.js +0 -6
- package/test/test/util/dash_parser_util.js +0 -13
- package/test/test/util/fake_ad.js +0 -3
- package/test/test/util/fake_ad_manager.js +0 -9
- package/test/test/util/fake_demo_main.js +0 -5
- package/test/test/util/fake_drm_engine.js +0 -6
- package/test/test/util/fake_media_source_engine.js +11 -11
- package/test/test/util/fake_networking_engine.js +0 -5
- package/test/test/util/fake_text_displayer.js +0 -5
- package/test/test/util/indexeddb_utils.js +1 -10
- package/test/test/util/jasmine_fetch.js +0 -1
- package/test/test/util/loader.js +0 -18
- package/test/test/util/manifest_generator.js +12 -15
- package/test/test/util/manifest_parser_util.js +4 -7
- package/test/test/util/offline_utils.js +1 -5
- package/test/test/util/simple_fakes.js +9 -26
- package/test/test/util/stream_generator.js +0 -14
- package/test/test/util/streaming_engine_util.js +1 -15
- package/test/test/util/test_scheme.js +25 -20
- package/test/test/util/ttml_utils.js +0 -2
- package/test/test/util/ui_utils.js +0 -9
- package/test/test/util/util.js +9 -23
- package/test/test/util/waiter.js +84 -43
- package/test/text/cue_integration.js +2 -6
- package/test/text/lrc_text_parser_unit.js +6 -11
- package/test/text/mp4_ttml_parser_unit.js +6 -10
- package/test/text/mp4_vtt_parser_unit.js +7 -12
- package/test/text/sbv_text_parser_unit.js +5 -10
- package/test/text/simple_text_displayer_unit.js +1 -8
- package/test/text/srt_text_parser_unit.js +5 -10
- package/test/text/ssa_text_parser_unit.js +17 -34
- package/test/text/text_engine_unit.js +47 -12
- package/test/text/text_track_integration.js +0 -2
- package/test/text/ttml_text_parser_unit.js +79 -88
- package/test/text/ui_text_displayer_unit.js +44 -41
- package/test/text/vtt_text_parser_unit.js +55 -66
- package/test/text/web_vtt_generator_unit.js +0 -3
- package/test/ui/ad_ui_unit.js +0 -11
- package/test/ui/localization_unit.js +0 -3
- package/test/ui/text_displayer_layout_unit.js +1 -12
- package/test/ui/ui_customization_unit.js +0 -6
- package/test/ui/ui_integration.js +0 -32
- package/test/ui/ui_unit.js +28 -17
- package/test/util/abortable_operation_unit.js +4 -9
- package/test/util/array_utils_unit.js +0 -2
- package/test/util/buffer_utils_unit.js +0 -2
- package/test/util/cmcd_manager_unit.js +3 -3
- package/test/util/data_view_reader_unit.js +0 -4
- package/test/util/ebml_parser_unit.js +0 -4
- package/test/util/event_manager_unit.js +0 -3
- package/test/util/fake_event_target_unit.js +0 -5
- package/test/util/iterables_unit.js +0 -64
- package/test/util/language_utils_unit.js +0 -3
- package/test/util/manifest_parser_utils_unit.js +0 -2
- package/test/util/mp4_box_parsers_unit.js +0 -5
- package/test/util/mp4_parser_unit.js +0 -4
- package/test/util/multi_map_unit.js +0 -3
- package/test/util/object_utils_unit.js +0 -2
- package/test/util/periods_unit.js +14 -7
- package/test/util/pssh_unit.js +0 -5
- package/test/util/state_history_unit.js +0 -2
- package/test/util/stream_utils_unit.js +26 -15
- package/test/util/string_utils_unit.js +0 -6
- package/test/util/text_parser_unit.js +0 -2
- package/test/util/xml_utils_unit.js +0 -4
- package/ui/controls.js +65 -40
- package/ui/fullscreen_button.js +26 -6
- package/ui/less/ad_controls.less +6 -6
- package/ui/less/buttons.less +6 -6
- package/ui/less/containers.less +10 -12
- package/ui/less/overflow_menu.less +4 -4
- package/ui/less/range_elements.less +7 -2
- package/ui/less/tooltip.less +4 -4
- package/ui/locales/en.json +1 -0
- package/ui/locales/sjn-translations.yaml +257 -0
- package/ui/locales/sjn.json +42 -0
- package/ui/locales/source.json +5 -0
- package/ui/resolution_selection.js +31 -33
- package/ui/seek_bar.js +2 -1
- package/ui/ui.js +0 -17
- package/.github/workflows/build_and_test.yaml +0 -73
- package/.github/workflows/release.yaml +0 -53
- package/docs/tutorials/upgrade-v2-5.md +0 -441
- package/docs/tutorials/upgrade-v3.md +0 -38
- package/externs/svgelement.js +0 -18
- package/externs/webcrypto.js +0 -18
- package/lib/polyfill/mathround.js +0 -49
- package/lib/polyfill/patchedmediakeys_apple.js +0 -744
- package/lib/polyfill/patchedmediakeys_ms.js +0 -698
- package/lib/util/mutex.js +0 -52
- package/test/util/functional_unit.js +0 -82
package/lib/player.js
CHANGED
|
@@ -43,7 +43,6 @@ goog.require('shaka.util.Error');
|
|
|
43
43
|
goog.require('shaka.util.EventManager');
|
|
44
44
|
goog.require('shaka.util.FakeEvent');
|
|
45
45
|
goog.require('shaka.util.FakeEventTarget');
|
|
46
|
-
goog.require('shaka.util.Functional');
|
|
47
46
|
goog.require('shaka.util.IDestroyable');
|
|
48
47
|
goog.require('shaka.util.LanguageUtils');
|
|
49
48
|
goog.require('shaka.util.ManifestParserUtils');
|
|
@@ -301,22 +300,6 @@ goog.requireType('shaka.routing.Payload');
|
|
|
301
300
|
*/
|
|
302
301
|
|
|
303
302
|
|
|
304
|
-
/**
|
|
305
|
-
* @event shaka.Player.LargeGapEvent
|
|
306
|
-
* @description Fired when the playhead enters a large gap. If the
|
|
307
|
-
* <code>streaming.jumpLargeGaps</code> configuration is set, the default
|
|
308
|
-
* action of this event is to jump the gap; this can be prevented by calling
|
|
309
|
-
* <code>preventDefault()</code> on the event object.
|
|
310
|
-
* @property {string} type
|
|
311
|
-
* 'largegap'
|
|
312
|
-
* @property {number} currentTime
|
|
313
|
-
* The current time of the playhead.
|
|
314
|
-
* @property {number} gapSize
|
|
315
|
-
* The size of the gap, in seconds.
|
|
316
|
-
* @exportDoc
|
|
317
|
-
*/
|
|
318
|
-
|
|
319
|
-
|
|
320
303
|
/**
|
|
321
304
|
* @event shaka.Player.ManifestParsedEvent
|
|
322
305
|
* @description Fired after the manifest has been parsed, but before anything
|
|
@@ -576,8 +559,7 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
576
559
|
this.adManager_ = null;
|
|
577
560
|
|
|
578
561
|
if (shaka.Player.adManagerFactory_) {
|
|
579
|
-
this.adManager_ =
|
|
580
|
-
shaka.util.Functional.callFactory(shaka.Player.adManagerFactory_);
|
|
562
|
+
this.adManager_ = shaka.Player.adManagerFactory_();
|
|
581
563
|
}
|
|
582
564
|
|
|
583
565
|
// If the browser comes back online after being offline, then try to play
|
|
@@ -847,10 +829,10 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
847
829
|
return false;
|
|
848
830
|
}
|
|
849
831
|
|
|
850
|
-
// We do not support iOS 9, 10, or
|
|
851
|
-
// Safari.
|
|
832
|
+
// We do not support iOS 9, 10, 11 or 12, nor those same versions of
|
|
833
|
+
// desktop Safari.
|
|
852
834
|
const safariVersion = shaka.util.Platform.safariVersion();
|
|
853
|
-
if (safariVersion && safariVersion <
|
|
835
|
+
if (safariVersion && safariVersion < 13) {
|
|
854
836
|
return false;
|
|
855
837
|
}
|
|
856
838
|
|
|
@@ -1560,8 +1542,7 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
1560
1542
|
// text displayer and streaming engine are always in sync, wait until they
|
|
1561
1543
|
// are both initialized before setting the initial value.
|
|
1562
1544
|
const textDisplayerFactory = this.config_.textDisplayFactory;
|
|
1563
|
-
const textDisplayer =
|
|
1564
|
-
shaka.util.Functional.callFactory(textDisplayerFactory);
|
|
1545
|
+
const textDisplayer = textDisplayerFactory();
|
|
1565
1546
|
this.lastTextFactory_ = textDisplayerFactory;
|
|
1566
1547
|
|
|
1567
1548
|
const mediaSourceEngine = this.createMediaSourceEngine(
|
|
@@ -1571,6 +1552,8 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
1571
1552
|
(metadata, offset, endTime) => {
|
|
1572
1553
|
this.processTimedMetadataMediaSrc_(metadata, offset, endTime);
|
|
1573
1554
|
});
|
|
1555
|
+
const {segmentRelativeVttTiming} = this.config_.manifest;
|
|
1556
|
+
mediaSourceEngine.setSegmentRelativeVttTiming(segmentRelativeVttTiming);
|
|
1574
1557
|
|
|
1575
1558
|
// Wait for media source engine to finish opening. This promise should
|
|
1576
1559
|
// NEVER be rejected as per the media source engine implementation.
|
|
@@ -1632,7 +1615,7 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
1632
1615
|
this.config_.manifest.retryParameters,
|
|
1633
1616
|
has.mimeType);
|
|
1634
1617
|
goog.asserts.assert(this.parserFactory_, 'Must have manifest parser');
|
|
1635
|
-
this.parser_ =
|
|
1618
|
+
this.parser_ = this.parserFactory_();
|
|
1636
1619
|
|
|
1637
1620
|
const manifestConfig =
|
|
1638
1621
|
shaka.util.ObjectUtils.cloneObject(this.config_.manifest);
|
|
@@ -1918,13 +1901,7 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
1918
1901
|
const abrFactory = this.config_.abrFactory;
|
|
1919
1902
|
if (!this.abrManager_ || this.abrManagerFactory_ != abrFactory) {
|
|
1920
1903
|
this.abrManagerFactory_ = abrFactory;
|
|
1921
|
-
this.abrManager_ =
|
|
1922
|
-
if (typeof this.abrManager_.playbackRateChanged != 'function') {
|
|
1923
|
-
shaka.Deprecate.deprecateFeature(4,
|
|
1924
|
-
'AbrManager',
|
|
1925
|
-
'Please use an AbrManager with playbackRateChanged function.');
|
|
1926
|
-
this.abrManager_.playbackRateChanged = (rate) => {};
|
|
1927
|
-
}
|
|
1904
|
+
this.abrManager_ = abrFactory();
|
|
1928
1905
|
this.abrManager_.configure(this.config_.abr);
|
|
1929
1906
|
}
|
|
1930
1907
|
|
|
@@ -2217,6 +2194,14 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
2217
2194
|
|
|
2218
2195
|
this.playhead_ = new shaka.media.SrcEqualsPlayhead(has.mediaElement);
|
|
2219
2196
|
|
|
2197
|
+
// This flag is used below in the language preference setup and
|
|
2198
|
+
// track-management to check if this load was canceled before the necessary
|
|
2199
|
+
// events fired.
|
|
2200
|
+
let unloaded = false;
|
|
2201
|
+
this.cleanupOnUnload_.push(() => {
|
|
2202
|
+
unloaded = true;
|
|
2203
|
+
});
|
|
2204
|
+
|
|
2220
2205
|
if (has.startTime != null) {
|
|
2221
2206
|
this.playhead_.setStartTime(has.startTime);
|
|
2222
2207
|
}
|
|
@@ -2244,7 +2229,8 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
2244
2229
|
|
|
2245
2230
|
// Wait for the 'loadedmetadata' event to measure load() latency, but only
|
|
2246
2231
|
// if preload is set in a way that would result in this event firing
|
|
2247
|
-
// automatically.
|
|
2232
|
+
// automatically.
|
|
2233
|
+
// See https://github.com/shaka-project/shaka-player/issues/2483
|
|
2248
2234
|
if (this.video_.preload != 'none') {
|
|
2249
2235
|
this.eventManager_.listenOnce(this.video_, 'loadedmetadata', () => {
|
|
2250
2236
|
const now = Date.now() / 1000;
|
|
@@ -2267,6 +2253,12 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
2267
2253
|
}
|
|
2268
2254
|
if (this.video_.textTracks) {
|
|
2269
2255
|
this.eventManager_.listen(this.video_.textTracks, 'addtrack', (e) => {
|
|
2256
|
+
// If we have moved on to another piece of content while waiting for
|
|
2257
|
+
// the above event, we should not process tracks here.
|
|
2258
|
+
if (unloaded) {
|
|
2259
|
+
return;
|
|
2260
|
+
}
|
|
2261
|
+
|
|
2270
2262
|
const trackEvent = /** @type {!TrackEvent} */(e);
|
|
2271
2263
|
if (trackEvent.track) {
|
|
2272
2264
|
const track = trackEvent.track;
|
|
@@ -2326,13 +2318,6 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
2326
2318
|
fullyLoaded.resolve();
|
|
2327
2319
|
});
|
|
2328
2320
|
|
|
2329
|
-
// This flag is used below in the language preference setup to check if this
|
|
2330
|
-
// load was canceled before the necessary events fire.
|
|
2331
|
-
let unloaded = false;
|
|
2332
|
-
this.cleanupOnUnload_.push(() => {
|
|
2333
|
-
unloaded = true;
|
|
2334
|
-
});
|
|
2335
|
-
|
|
2336
2321
|
// We can't switch to preferred languages, though, until the data is loaded.
|
|
2337
2322
|
shaka.util.MediaReadyState.waitForReadyState(this.video_,
|
|
2338
2323
|
HTMLMediaElement.HAVE_CURRENT_DATA,
|
|
@@ -2487,12 +2472,16 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
2487
2472
|
// In Safari the initial assignment does not always work, so we schedule
|
|
2488
2473
|
// this process to be repeated several times to ensure that it has been put
|
|
2489
2474
|
// in the correct mode.
|
|
2490
|
-
new shaka.util.Timer(() => {
|
|
2475
|
+
const timer = new shaka.util.Timer(() => {
|
|
2491
2476
|
const textTracks = this.getMetadataTracks_();
|
|
2492
2477
|
for (const textTrack of textTracks) {
|
|
2493
2478
|
textTrack.mode = 'hidden';
|
|
2494
2479
|
}
|
|
2495
|
-
}).tickNow().tickAfter(
|
|
2480
|
+
}).tickNow().tickAfter(0.5);
|
|
2481
|
+
|
|
2482
|
+
this.cleanupOnUnload_.push(() => {
|
|
2483
|
+
timer.stop();
|
|
2484
|
+
});
|
|
2496
2485
|
}
|
|
2497
2486
|
|
|
2498
2487
|
|
|
@@ -2560,12 +2549,16 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
2560
2549
|
// In Safari the initial assignment does not always work, so we schedule
|
|
2561
2550
|
// this process to be repeated several times to ensure that it has been put
|
|
2562
2551
|
// in the correct mode.
|
|
2563
|
-
new shaka.util.Timer(() => {
|
|
2552
|
+
const timer = new shaka.util.Timer(() => {
|
|
2564
2553
|
const chaptersTracks = this.getChaptersTracks_();
|
|
2565
2554
|
for (const chaptersTrack of chaptersTracks) {
|
|
2566
2555
|
chaptersTrack.mode = 'hidden';
|
|
2567
2556
|
}
|
|
2568
|
-
}).tickNow().tickAfter(
|
|
2557
|
+
}).tickNow().tickAfter(0.5);
|
|
2558
|
+
|
|
2559
|
+
this.cleanupOnUnload_.push(() => {
|
|
2560
|
+
timer.stop();
|
|
2561
|
+
});
|
|
2569
2562
|
}
|
|
2570
2563
|
|
|
2571
2564
|
/**
|
|
@@ -2667,8 +2660,7 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
2667
2660
|
this.manifest_,
|
|
2668
2661
|
this.config_.streaming,
|
|
2669
2662
|
startTime,
|
|
2670
|
-
() => this.onSeek_()
|
|
2671
|
-
(event) => this.dispatchEvent(event));
|
|
2663
|
+
() => this.onSeek_());
|
|
2672
2664
|
}
|
|
2673
2665
|
|
|
2674
2666
|
/**
|
|
@@ -2927,17 +2919,6 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
2927
2919
|
|
|
2928
2920
|
goog.asserts.assert(typeof(config) == 'object', 'Should be an object!');
|
|
2929
2921
|
|
|
2930
|
-
// Deprecate 'manifest.dash.defaultPresentationDelay' configuration.
|
|
2931
|
-
if (config['manifest'] && config['manifest']['dash'] &&
|
|
2932
|
-
'defaultPresentationDelay' in config['manifest']['dash']) {
|
|
2933
|
-
shaka.Deprecate.deprecateFeature(4,
|
|
2934
|
-
'manifest.dash.defaultPresentationDelay configuration',
|
|
2935
|
-
'Please Use manifest.defaultPresentationDelay instead.');
|
|
2936
|
-
config['manifest']['defaultPresentationDelay'] =
|
|
2937
|
-
config['manifest']['dash']['defaultPresentationDelay'];
|
|
2938
|
-
delete config['manifest']['dash']['defaultPresentationDelay'];
|
|
2939
|
-
}
|
|
2940
|
-
|
|
2941
2922
|
// If lowLatencyMode is enabled, and inaccurateManifestTolerance and
|
|
2942
2923
|
// rebufferingGoal are not specified, set inaccurateManifestTolerance to 0
|
|
2943
2924
|
// and rebufferingGoal to 0.01 by default for low latency streaming.
|
|
@@ -3004,10 +2985,13 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
3004
2985
|
}
|
|
3005
2986
|
|
|
3006
2987
|
if (this.mediaSourceEngine_) {
|
|
2988
|
+
const {segmentRelativeVttTiming} = this.config_.manifest;
|
|
2989
|
+
this.mediaSourceEngine_.setSegmentRelativeVttTiming(
|
|
2990
|
+
segmentRelativeVttTiming);
|
|
2991
|
+
|
|
3007
2992
|
const textDisplayerFactory = this.config_.textDisplayFactory;
|
|
3008
2993
|
if (this.lastTextFactory_ != textDisplayerFactory) {
|
|
3009
|
-
const displayer =
|
|
3010
|
-
shaka.util.Functional.callFactory(textDisplayerFactory);
|
|
2994
|
+
const displayer = textDisplayerFactory();
|
|
3011
2995
|
this.mediaSourceEngine_.setTextDisplayer(displayer);
|
|
3012
2996
|
this.lastTextFactory_ = textDisplayerFactory;
|
|
3013
2997
|
|
|
@@ -3704,7 +3688,8 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
3704
3688
|
this.streamingEngine_.switchTextStream(stream);
|
|
3705
3689
|
this.onTextChanged_();
|
|
3706
3690
|
|
|
3707
|
-
// Workaround for
|
|
3691
|
+
// Workaround for
|
|
3692
|
+
// https://github.com/shaka-project/shaka-player/issues/1299
|
|
3708
3693
|
// When track is selected, back-propagate the language to
|
|
3709
3694
|
// currentTextLanguage_.
|
|
3710
3695
|
this.currentTextLanguage_ = stream.language;
|
|
@@ -3780,7 +3765,8 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
3780
3765
|
this.switchVariant_(variant, /* fromAdaptation= */ false, clearBuffer,
|
|
3781
3766
|
safeMargin);
|
|
3782
3767
|
|
|
3783
|
-
// Workaround for
|
|
3768
|
+
// Workaround for
|
|
3769
|
+
// https://github.com/shaka-project/shaka-player/issues/1299
|
|
3784
3770
|
// When track is selected, back-propagate the language to
|
|
3785
3771
|
// currentAudioLanguage_.
|
|
3786
3772
|
this.currentAdaptationSetCriteria_ = new shaka.media.ExampleBasedCriteria(
|
|
@@ -4390,158 +4376,6 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
4390
4376
|
return this.stats_.getBlob();
|
|
4391
4377
|
}
|
|
4392
4378
|
|
|
4393
|
-
/**
|
|
4394
|
-
* Adds the given text track to the loaded manifest. <code>load()</code> must
|
|
4395
|
-
* resolve before calling. The presentation must have a duration.
|
|
4396
|
-
*
|
|
4397
|
-
* This returns the created track, which can immediately be selected by the
|
|
4398
|
-
* application. The track will not be automatically selected.
|
|
4399
|
-
*
|
|
4400
|
-
* @param {string} uri
|
|
4401
|
-
* @param {string} language
|
|
4402
|
-
* @param {string} kind
|
|
4403
|
-
* @param {string=} mimeType
|
|
4404
|
-
* @param {string=} codec
|
|
4405
|
-
* @param {string=} label
|
|
4406
|
-
* @param {boolean=} forced
|
|
4407
|
-
* @return {shaka.extern.Track}
|
|
4408
|
-
* @export
|
|
4409
|
-
*/
|
|
4410
|
-
addTextTrack(uri, language, kind, mimeType, codec, label, forced = false) {
|
|
4411
|
-
shaka.Deprecate.deprecateFeature(4,
|
|
4412
|
-
'addTextTrack',
|
|
4413
|
-
'Please use an addTextTrackAsync.');
|
|
4414
|
-
if (this.loadMode_ != shaka.Player.LoadMode.MEDIA_SOURCE &&
|
|
4415
|
-
this.loadMode_ != shaka.Player.LoadMode.SRC_EQUALS) {
|
|
4416
|
-
shaka.log.error(
|
|
4417
|
-
'Must call load() and wait for it to resolve before adding text ' +
|
|
4418
|
-
'tracks.');
|
|
4419
|
-
throw new shaka.util.Error(
|
|
4420
|
-
shaka.util.Error.Severity.RECOVERABLE,
|
|
4421
|
-
shaka.util.Error.Category.PLAYER,
|
|
4422
|
-
shaka.util.Error.Code.CONTENT_NOT_LOADED);
|
|
4423
|
-
}
|
|
4424
|
-
|
|
4425
|
-
if (!mimeType) {
|
|
4426
|
-
// Try using the uri extension.
|
|
4427
|
-
const extension = shaka.media.ManifestParser.getExtension(uri);
|
|
4428
|
-
mimeType = shaka.Player.TEXT_EXTENSIONS_TO_MIME_TYPES_[extension];
|
|
4429
|
-
|
|
4430
|
-
if (!mimeType) {
|
|
4431
|
-
shaka.log.error(
|
|
4432
|
-
'The mimeType has not been provided and it could not be deduced ' +
|
|
4433
|
-
'from its extension.');
|
|
4434
|
-
throw new shaka.util.Error(
|
|
4435
|
-
shaka.util.Error.Severity.RECOVERABLE,
|
|
4436
|
-
shaka.util.Error.Category.TEXT,
|
|
4437
|
-
shaka.util.Error.Code.TEXT_COULD_NOT_GUESS_MIME_TYPE,
|
|
4438
|
-
extension);
|
|
4439
|
-
}
|
|
4440
|
-
}
|
|
4441
|
-
|
|
4442
|
-
if (this.loadMode_ == shaka.Player.LoadMode.SRC_EQUALS) {
|
|
4443
|
-
if (mimeType != 'text/vtt') {
|
|
4444
|
-
shaka.log.error('Only WebVTT is supported when using src=');
|
|
4445
|
-
throw new shaka.util.Error(
|
|
4446
|
-
shaka.util.Error.Severity.RECOVERABLE,
|
|
4447
|
-
shaka.util.Error.Category.TEXT,
|
|
4448
|
-
shaka.util.Error.Code.TEXT_ONLY_WEBVTT_SRC_EQUALS,
|
|
4449
|
-
mimeType);
|
|
4450
|
-
}
|
|
4451
|
-
if (forced) {
|
|
4452
|
-
// See: https://github.com/whatwg/html/issues/4472
|
|
4453
|
-
kind = 'forced';
|
|
4454
|
-
}
|
|
4455
|
-
const trackElement =
|
|
4456
|
-
/** @type {!HTMLTrackElement} */(document.createElement('track'));
|
|
4457
|
-
trackElement.src = this.cmcdManager_.appendTextTrackData(uri);
|
|
4458
|
-
trackElement.label = label || '';
|
|
4459
|
-
trackElement.kind = kind;
|
|
4460
|
-
trackElement.srclang = language;
|
|
4461
|
-
// Because we're pulling in the text track file via Javascript, the
|
|
4462
|
-
// same-origin policy applies. If you'd like to have a player served
|
|
4463
|
-
// from one domain, but the text track served from another, you'll
|
|
4464
|
-
// need to enable CORS in order to do so. In addition to enabling CORS
|
|
4465
|
-
// on the server serving the text tracks, you will need to add the
|
|
4466
|
-
// crossorigin attribute to the video element itself.
|
|
4467
|
-
if (!this.video_.getAttribute('crossorigin')) {
|
|
4468
|
-
this.video_.setAttribute('crossorigin', 'anonymous');
|
|
4469
|
-
}
|
|
4470
|
-
this.video_.appendChild(trackElement);
|
|
4471
|
-
const textTracks = this.getTextTracks();
|
|
4472
|
-
const srcTrack = textTracks.find((t) => {
|
|
4473
|
-
return t.language == language &&
|
|
4474
|
-
t.label == (label || '') &&
|
|
4475
|
-
t.kind == kind;
|
|
4476
|
-
});
|
|
4477
|
-
if (srcTrack) {
|
|
4478
|
-
this.onTracksChanged_();
|
|
4479
|
-
return srcTrack;
|
|
4480
|
-
}
|
|
4481
|
-
// This should not happen, but there are browser implementations that may
|
|
4482
|
-
// not support the Track element.
|
|
4483
|
-
shaka.log.error('Cannot add this text when loaded with src=');
|
|
4484
|
-
throw new shaka.util.Error(
|
|
4485
|
-
shaka.util.Error.Severity.RECOVERABLE,
|
|
4486
|
-
shaka.util.Error.Category.TEXT,
|
|
4487
|
-
shaka.util.Error.Code.CANNOT_ADD_EXTERNAL_TEXT_TO_SRC_EQUALS);
|
|
4488
|
-
}
|
|
4489
|
-
|
|
4490
|
-
const ContentType = shaka.util.ManifestParserUtils.ContentType;
|
|
4491
|
-
|
|
4492
|
-
const duration = this.manifest_.presentationTimeline.getDuration();
|
|
4493
|
-
if (duration == Infinity) {
|
|
4494
|
-
throw new shaka.util.Error(
|
|
4495
|
-
shaka.util.Error.Severity.RECOVERABLE,
|
|
4496
|
-
shaka.util.Error.Category.MANIFEST,
|
|
4497
|
-
shaka.util.Error.Code.CANNOT_ADD_EXTERNAL_TEXT_TO_LIVE_STREAM);
|
|
4498
|
-
}
|
|
4499
|
-
|
|
4500
|
-
/** @type {shaka.extern.Stream} */
|
|
4501
|
-
const stream = {
|
|
4502
|
-
id: this.nextExternalStreamId_++,
|
|
4503
|
-
originalId: null,
|
|
4504
|
-
createSegmentIndex: () => Promise.resolve(),
|
|
4505
|
-
segmentIndex: shaka.media.SegmentIndex.forSingleSegment(
|
|
4506
|
-
/* startTime= */ 0,
|
|
4507
|
-
/* duration= */ duration,
|
|
4508
|
-
/* uris= */ [uri]),
|
|
4509
|
-
mimeType: mimeType || '',
|
|
4510
|
-
codecs: codec || '',
|
|
4511
|
-
kind: kind,
|
|
4512
|
-
encrypted: false,
|
|
4513
|
-
drmInfos: [],
|
|
4514
|
-
keyIds: new Set(),
|
|
4515
|
-
language: language,
|
|
4516
|
-
label: label || null,
|
|
4517
|
-
type: ContentType.TEXT,
|
|
4518
|
-
primary: false,
|
|
4519
|
-
trickModeVideo: null,
|
|
4520
|
-
emsgSchemeIdUris: null,
|
|
4521
|
-
roles: [],
|
|
4522
|
-
forced: !!forced,
|
|
4523
|
-
channelsCount: null,
|
|
4524
|
-
audioSamplingRate: null,
|
|
4525
|
-
spatialAudio: false,
|
|
4526
|
-
closedCaptions: null,
|
|
4527
|
-
};
|
|
4528
|
-
|
|
4529
|
-
const fullMimeType = shaka.util.MimeUtils.getFullType(
|
|
4530
|
-
stream.mimeType, stream.codecs);
|
|
4531
|
-
const supported = shaka.text.TextEngine.isTypeSupported(fullMimeType);
|
|
4532
|
-
if (!supported) {
|
|
4533
|
-
throw new shaka.util.Error(
|
|
4534
|
-
shaka.util.Error.Severity.CRITICAL,
|
|
4535
|
-
shaka.util.Error.Category.TEXT,
|
|
4536
|
-
shaka.util.Error.Code.MISSING_TEXT_PLUGIN,
|
|
4537
|
-
mimeType);
|
|
4538
|
-
}
|
|
4539
|
-
|
|
4540
|
-
this.manifest_.textStreams.push(stream);
|
|
4541
|
-
this.onTracksChanged_();
|
|
4542
|
-
return shaka.util.StreamUtils.textStreamToTrack(stream);
|
|
4543
|
-
}
|
|
4544
|
-
|
|
4545
4379
|
/**
|
|
4546
4380
|
* Adds the given text track to the loaded manifest. <code>load()</code> must
|
|
4547
4381
|
* resolve before calling. The presentation must have a duration.
|
|
@@ -4846,6 +4680,7 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
4846
4680
|
periodStart: 0,
|
|
4847
4681
|
segmentStart: 0,
|
|
4848
4682
|
segmentEnd: this.video_.duration,
|
|
4683
|
+
vttOffset: 0,
|
|
4849
4684
|
};
|
|
4850
4685
|
const data = shaka.util.BufferUtils.toUint8(buffer);
|
|
4851
4686
|
const cues = obj.parseMedia(data, time);
|
|
@@ -5252,7 +5087,7 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
5252
5087
|
// If the playback rate changes while seeking, Edge will cache the playback
|
|
5253
5088
|
// rate and use it after seeking.
|
|
5254
5089
|
//
|
|
5255
|
-
// https://github.com/
|
|
5090
|
+
// https://github.com/shaka-project/shaka-player/issues/951
|
|
5256
5091
|
if (newRate == 0) {
|
|
5257
5092
|
return;
|
|
5258
5093
|
}
|
|
@@ -6498,7 +6333,6 @@ shaka.Player.EventName = {
|
|
|
6498
6333
|
Emsg: 'emsg',
|
|
6499
6334
|
Error: 'error',
|
|
6500
6335
|
ExpirationUpdated: 'expirationupdated',
|
|
6501
|
-
LargeGap: 'largegap',
|
|
6502
6336
|
Loaded: 'loaded',
|
|
6503
6337
|
Loading: 'loading',
|
|
6504
6338
|
ManifestParsed: 'manifestparsed',
|
|
@@ -6558,7 +6392,7 @@ shaka.Player.TYPICAL_BUFFERING_THRESHOLD_ = 0.5;
|
|
|
6558
6392
|
* @define {string} A version number taken from git at compile time.
|
|
6559
6393
|
* @export
|
|
6560
6394
|
*/
|
|
6561
|
-
shaka.Player.version = '
|
|
6395
|
+
shaka.Player.version = 'v4.0.0-uncompiled';
|
|
6562
6396
|
|
|
6563
6397
|
// Initialize the deprecation system using the version string we just set
|
|
6564
6398
|
// on the player.
|
package/lib/polyfill/all.js
CHANGED
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
goog.provide('shaka.polyfill');
|
|
8
8
|
|
|
9
9
|
goog.require('shaka.log');
|
|
10
|
-
goog.require('shaka.util.Iterables');
|
|
11
10
|
|
|
12
11
|
|
|
13
12
|
/**
|
|
@@ -40,8 +39,8 @@ shaka.polyfill = class {
|
|
|
40
39
|
*/
|
|
41
40
|
static register(polyfill, priority) {
|
|
42
41
|
const newItem = {priority: priority || 0, callback: polyfill};
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
for (let i = 0; i < shaka.polyfill.polyfills_.length; i++) {
|
|
43
|
+
const item = shaka.polyfill.polyfills_[i];
|
|
45
44
|
if (item.priority < newItem.priority) {
|
|
46
45
|
shaka.polyfill.polyfills_.splice(i, 0, newItem);
|
|
47
46
|
return;
|
|
@@ -12,7 +12,7 @@ goog.require('shaka.polyfill');
|
|
|
12
12
|
* @summary A polyfill to add support for EncryptionScheme queries in EME.
|
|
13
13
|
* @see https://wicg.github.io/encrypted-media-encryption-scheme/
|
|
14
14
|
* @see https://github.com/w3c/encrypted-media/pull/457
|
|
15
|
-
* @see https://github.com/
|
|
15
|
+
* @see https://github.com/shaka-project/eme-encryption-scheme-polyfill
|
|
16
16
|
* @export
|
|
17
17
|
*/
|
|
18
18
|
shaka.polyfill.EncryptionScheme = class {
|
|
@@ -24,23 +24,29 @@ shaka.polyfill.MediaCapabilities = class {
|
|
|
24
24
|
* @export
|
|
25
25
|
*/
|
|
26
26
|
static install() {
|
|
27
|
-
// Since MediaCapabilities is not fully supported on Chromecast yet,
|
|
28
|
-
// should always install polyfill for Chromecast.
|
|
27
|
+
// Since MediaCapabilities is not fully supported on some Chromecast yet,
|
|
28
|
+
// we should always install polyfill for all Chromecast not Android-based.
|
|
29
29
|
// TODO: re-evaluate MediaCapabilities in the future versions of Chromecast.
|
|
30
30
|
// Since MediaCapabilities implementation is buggy in Apple browsers, we
|
|
31
31
|
// should always install polyfill for Apple browsers.
|
|
32
|
-
// See: https://github.com/
|
|
32
|
+
// See: https://github.com/shaka-project/shaka-player/issues/3530
|
|
33
33
|
// TODO: re-evaluate MediaCapabilities in the future versions of Apple
|
|
34
34
|
// Browsers.
|
|
35
35
|
// Since MediaCapabilities implementation is buggy in PS5 browsers, we
|
|
36
36
|
// should always install polyfill for PS5 browsers.
|
|
37
|
-
// See: https://github.com/
|
|
37
|
+
// See: https://github.com/shaka-project/shaka-player/issues/3582
|
|
38
38
|
// TODO: re-evaluate MediaCapabilities in the future versions of PS5
|
|
39
39
|
// Browsers.
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
let canUseNativeMCap = true;
|
|
41
|
+
if (shaka.util.Platform.isApple() ||
|
|
42
|
+
shaka.util.Platform.isPS5() ||
|
|
43
|
+
shaka.util.Platform.isChromecast()) {
|
|
44
|
+
canUseNativeMCap = false;
|
|
45
|
+
}
|
|
46
|
+
if (shaka.util.Platform.isAndroidCastDevice()) {
|
|
47
|
+
canUseNativeMCap = true;
|
|
48
|
+
}
|
|
49
|
+
if (canUseNativeMCap && navigator.mediaCapabilities) {
|
|
44
50
|
shaka.log.info(
|
|
45
51
|
'MediaCapabilities: Native mediaCapabilities support found.');
|
|
46
52
|
return;
|
|
@@ -54,7 +60,7 @@ shaka.polyfill.MediaCapabilities = class {
|
|
|
54
60
|
|
|
55
61
|
// Keep the patched MediaCapabilities object from being garbage-collected in
|
|
56
62
|
// Safari.
|
|
57
|
-
// See https://github.com/
|
|
63
|
+
// See https://github.com/shaka-project/shaka-player/issues/3696#issuecomment-1009472718
|
|
58
64
|
shaka.polyfill.MediaCapabilities.originalMcap =
|
|
59
65
|
navigator.mediaCapabilities;
|
|
60
66
|
|
|
@@ -38,11 +38,6 @@ shaka.polyfill.MediaSource = class {
|
|
|
38
38
|
// Chromecast cannot make accurate determinations via isTypeSupported.
|
|
39
39
|
shaka.polyfill.MediaSource.patchCastIsTypeSupported_();
|
|
40
40
|
} else if (safariVersion) {
|
|
41
|
-
// TS content is broken on Safari in general.
|
|
42
|
-
// See https://github.com/google/shaka-player/issues/743
|
|
43
|
-
// and https://bugs.webkit.org/show_bug.cgi?id=165342
|
|
44
|
-
shaka.polyfill.MediaSource.rejectTsContent_();
|
|
45
|
-
|
|
46
41
|
// NOTE: shaka.Player.isBrowserSupported() has its own restrictions on
|
|
47
42
|
// Safari version.
|
|
48
43
|
if (safariVersion <= 12) {
|
|
@@ -127,29 +122,6 @@ shaka.polyfill.MediaSource = class {
|
|
|
127
122
|
};
|
|
128
123
|
}
|
|
129
124
|
|
|
130
|
-
/**
|
|
131
|
-
* Patch isTypeSupported() to reject TS content. Used to avoid TS-related MSE
|
|
132
|
-
* bugs on Safari.
|
|
133
|
-
*
|
|
134
|
-
* @private
|
|
135
|
-
*/
|
|
136
|
-
static rejectTsContent_() {
|
|
137
|
-
const originalIsTypeSupported = MediaSource.isTypeSupported;
|
|
138
|
-
|
|
139
|
-
MediaSource.isTypeSupported = (mimeType) => {
|
|
140
|
-
// Parse the basic MIME type from its parameters.
|
|
141
|
-
const pieces = mimeType.split(/ *; */);
|
|
142
|
-
const basicMimeType = pieces[0];
|
|
143
|
-
const container = basicMimeType.split('/')[1];
|
|
144
|
-
|
|
145
|
-
if (container.toLowerCase() == 'mp2t') {
|
|
146
|
-
return false;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
return originalIsTypeSupported(mimeType);
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
|
|
153
125
|
/**
|
|
154
126
|
* Patch |MediaSource.isTypeSupported| to always reject |codec|. This is used
|
|
155
127
|
* when we know that we are on a platform that does not work well with a given
|
|
@@ -49,6 +49,8 @@ shaka.polyfill.PatchedMediaKeysNop = class {
|
|
|
49
49
|
// These are not usable, but allow Player.isBrowserSupported to pass.
|
|
50
50
|
window.MediaKeys = PatchedMediaKeysNop.MediaKeys;
|
|
51
51
|
window.MediaKeySystemAccess = PatchedMediaKeysNop.MediaKeySystemAccess;
|
|
52
|
+
|
|
53
|
+
window.shakaMediaKeysPolyfill = true;
|
|
52
54
|
}
|
|
53
55
|
|
|
54
56
|
/**
|
|
@@ -72,6 +72,8 @@ shaka.polyfill.PatchedMediaKeysWebkit = class {
|
|
|
72
72
|
PatchedMediaKeysWebkit.setMediaKeys;
|
|
73
73
|
window.MediaKeys = PatchedMediaKeysWebkit.MediaKeys;
|
|
74
74
|
window.MediaKeySystemAccess = PatchedMediaKeysWebkit.MediaKeySystemAccess;
|
|
75
|
+
|
|
76
|
+
window.shakaMediaKeysPolyfill = true;
|
|
75
77
|
}
|
|
76
78
|
|
|
77
79
|
/**
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/*! @license
|
|
2
|
+
* Shaka Player
|
|
3
|
+
* Copyright 2016 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
goog.provide('shaka.polyfill.Symbol');
|
|
7
|
+
|
|
8
|
+
goog.require('shaka.log');
|
|
9
|
+
goog.require('shaka.polyfill');
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @summary A polyfill to provide Symbol.prototype.description in all browsers.
|
|
13
|
+
* See: https://caniuse.com/mdn-javascript_builtins_symbol_description
|
|
14
|
+
* @export
|
|
15
|
+
*/
|
|
16
|
+
shaka.polyfill.Symbol = class {
|
|
17
|
+
/**
|
|
18
|
+
* Install the polyfill if needed.
|
|
19
|
+
* @export
|
|
20
|
+
*/
|
|
21
|
+
static install() {
|
|
22
|
+
shaka.log.debug('Symbol.install');
|
|
23
|
+
|
|
24
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
25
|
+
const proto = Symbol.prototype;
|
|
26
|
+
|
|
27
|
+
if (!('description' in proto)) {
|
|
28
|
+
Object.defineProperty(proto, 'description', {
|
|
29
|
+
get: shaka.polyfill.Symbol.getSymbolDescription_,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @this {Symbol}
|
|
36
|
+
* @return {(string|undefined)}
|
|
37
|
+
* @private
|
|
38
|
+
*/
|
|
39
|
+
static getSymbolDescription_() {
|
|
40
|
+
const m = /\((.*)\)/.exec(this.toString());
|
|
41
|
+
return m ? m[1] : undefined;
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
shaka.polyfill.register(shaka.polyfill.Symbol.install);
|
package/lib/text/cue.js
CHANGED
|
@@ -234,12 +234,6 @@ shaka.text.Cue = class {
|
|
|
234
234
|
*/
|
|
235
235
|
this.lineBreak = false;
|
|
236
236
|
|
|
237
|
-
/**
|
|
238
|
-
* @override
|
|
239
|
-
* @exportInterface
|
|
240
|
-
*/
|
|
241
|
-
this.spacer = false;
|
|
242
|
-
|
|
243
237
|
/**
|
|
244
238
|
* @override
|
|
245
239
|
* @exportInterface
|
|
@@ -294,7 +288,7 @@ shaka.text.Cue = class {
|
|
|
294
288
|
// Compare the start time, end time and payload of the cues first for
|
|
295
289
|
// performance optimization. We can avoid the more expensive recursive
|
|
296
290
|
// checks if the top-level properties don't match.
|
|
297
|
-
// See: https://github.com/
|
|
291
|
+
// See: https://github.com/shaka-project/shaka-player/issues/3018
|
|
298
292
|
if (cue1.startTime != cue2.startTime || cue1.endTime != cue2.endTime ||
|
|
299
293
|
cue1.payload != cue2.payload) {
|
|
300
294
|
return false;
|