shaka-player 3.3.2 → 3.3.5
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 +29 -0
- package/.github/workflows/nightly-demo.yaml +42 -0
- package/.github/workflows/release-please.yaml +147 -0
- package/.github/workflows/safari-homedir-launcher.sh +18 -0
- package/.github/workflows/selenium-lab-tests.yaml +92 -0
- package/AUTHORS +2 -0
- package/CHANGELOG.md +1718 -1675
- package/CONTRIBUTING.md +2 -2
- package/CONTRIBUTORS +2 -0
- package/README.md +7 -7
- 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 +2 -0
- package/app-engine/demo-version-index/main.py +162 -0
- package/app-engine/demo-version-index/requirements.txt +6 -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 +2 -2
- 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 +163 -0
- package/build/shakaBuildHelpers.py +4 -29
- package/build/test.py +94 -29
- package/build/types/core +0 -1
- package/build/types/polyfill +1 -0
- 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/assets.js +2 -0
- package/demo/config.js +0 -1
- package/demo/custom.js +0 -1
- package/demo/customWarning.txt +2 -2
- package/demo/demo.less +29 -18
- package/demo/demo_uncompiled.js +1 -13
- package/demo/index.html +1 -1
- package/demo/main.js +3 -3
- package/dist/controls.css +3 -3
- package/dist/controls.css.map +1 -1
- package/dist/demo.compiled.debug.js +191 -194
- package/dist/demo.compiled.debug.map +4 -4
- package/dist/demo.compiled.js +191 -194
- package/dist/demo.compiled.map +4 -4
- package/dist/demo.css +1 -1
- package/dist/demo.css.map +1 -1
- package/dist/deps.js +232 -226
- package/dist/locales.js +30 -30
- package/dist/receiver.compiled.debug.js +43 -45
- package/dist/receiver.compiled.debug.map +4 -4
- package/dist/receiver.compiled.js +43 -45
- package/dist/receiver.compiled.map +4 -4
- package/dist/shaka-player.compiled.d.ts +247 -236
- package/dist/shaka-player.compiled.debug.d.ts +247 -236
- package/dist/shaka-player.compiled.debug.externs.js +15 -3
- package/dist/shaka-player.compiled.debug.js +284 -290
- package/dist/shaka-player.compiled.debug.map +4 -4
- package/dist/shaka-player.compiled.externs.js +15 -3
- package/dist/shaka-player.compiled.js +855 -859
- package/dist/shaka-player.compiled.map +4 -4
- package/dist/shaka-player.ui.d.ts +291 -280
- package/dist/shaka-player.ui.debug.d.ts +291 -280
- package/dist/shaka-player.ui.debug.externs.js +15 -3
- package/dist/shaka-player.ui.debug.js +296 -302
- package/dist/shaka-player.ui.debug.map +4 -4
- package/dist/shaka-player.ui.externs.js +15 -3
- package/dist/shaka-player.ui.js +1005 -1009
- 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/faq.md +8 -8
- package/docs/tutorials/index.json +1 -0
- package/docs/tutorials/plugins.md +3 -3
- package/docs/tutorials/selenium-grid-config.md +122 -0
- package/docs/tutorials/welcome.md +10 -2
- package/externs/cmcd.js +1 -1
- package/karma.conf.js +141 -30
- package/lib/abr/simple_abr_manager.js +12 -6
- package/lib/cast/cast_proxy.js +3 -4
- 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/dash_parser.js +11 -14
- 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 +34 -20
- package/lib/hls/manifest_text_parser.js +3 -3
- package/lib/media/adaptation_set.js +1 -2
- package/lib/media/content_workarounds.js +2 -2
- package/lib/media/drm_engine.js +3 -2
- package/lib/media/media_source_engine.js +10 -3
- package/lib/media/mp4_segment_index_parser.js +1 -4
- package/lib/media/playhead.js +2 -2
- package/lib/media/presentation_timeline.js +18 -8
- package/lib/media/streaming_engine.js +6 -6
- package/lib/media/time_ranges_utils.js +1 -3
- package/lib/media/video_wrapper.js +1 -1
- package/lib/net/networking_engine.js +1 -1
- package/lib/offline/indexeddb/storage_mechanism.js +4 -2
- package/lib/offline/storage.js +96 -95
- package/lib/player.js +190 -114
- package/lib/polyfill/all.js +2 -3
- package/lib/polyfill/encryption_scheme.js +1 -1
- package/lib/polyfill/media_capabilities.js +3 -3
- package/lib/polyfill/mediasource.js +1 -1
- package/lib/polyfill/symbol.js +46 -0
- package/lib/text/cue.js +1 -1
- package/lib/text/simple_text_displayer.js +2 -1
- package/lib/text/ttml_text_parser.js +8 -5
- package/lib/text/ui_text_displayer.js +1 -1
- package/lib/util/buffer_utils.js +1 -3
- package/lib/util/config_utils.js +25 -0
- package/lib/util/ebml_parser.js +3 -3
- package/lib/util/error.js +8 -1
- package/lib/util/iterables.js +0 -46
- package/lib/util/manifest_parser_utils.js +1 -1
- package/lib/util/mime_utils.js +48 -1
- package/lib/util/mp4_box_parsers.js +1 -4
- package/lib/util/mp4_parser.js +5 -7
- package/lib/util/periods.js +15 -15
- package/lib/util/platform.js +3 -3
- package/lib/util/player_configuration.js +9 -14
- package/lib/util/pssh.js +1 -4
- package/lib/util/stream_utils.js +8 -5
- package/lib/util/string_utils.js +3 -5
- package/lib/util/uint8array_utils.js +3 -5
- package/lib/util/xml_utils.js +15 -7
- package/package.json +61 -36
- package/roadmap.md +17 -17
- package/shaka-player.uncompiled.js +1 -0
- 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 +1 -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 +0 -9
- package/test/dash/mpd_utils_unit.js +3 -11
- package/test/demo/demo_unit.js +0 -5
- package/test/deprecate/enforcer_unit.js +0 -4
- package/test/deprecate/version_unit.js +0 -2
- package/test/hls/hls_live_unit.js +28 -14
- package/test/hls/hls_parser_unit.js +2 -15
- package/test/hls/manifest_text_parser_unit.js +19 -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 +4 -24
- package/test/media/manifest_parser_unit.js +0 -4
- package/test/media/media_source_engine_integration.js +1 -7
- package/test/media/media_source_engine_unit.js +5 -18
- 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 +8 -16
- 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 +0 -6
- 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 +11 -36
- package/test/media/streaming_engine_unit.js +11 -35
- package/test/media/time_ranges_utils_unit.js +0 -2
- 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 +1 -7
- package/test/offline/manifest_convert_unit.js +0 -8
- package/test/offline/offline_integration.js +1 -10
- package/test/offline/offline_manifest_parser_unit.js +0 -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 +2 -15
- package/test/offline/storage_integration.js +1 -27
- package/test/player_external.js +9 -11
- package/test/player_integration.js +28 -38
- 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 +81 -90
- package/test/player_unit.js +150 -38
- package/test/routing/walker_unit.js +0 -8
- package/test/test/assets/large_file.mpd +1 -1
- package/test/test/boot.js +84 -22
- package/test/test/externs/filters.js +4 -0
- 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 +0 -7
- 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 +9 -14
- package/test/test/util/manifest_parser_util.js +0 -6
- package/test/test/util/offline_utils.js +0 -5
- package/test/test/util/simple_fakes.js +40 -28
- package/test/test/util/stream_generator.js +0 -14
- package/test/test/util/streaming_engine_util.js +0 -15
- package/test/test/util/test_scheme.js +1 -19
- package/test/test/util/ttml_utils.js +0 -2
- package/test/test/util/ui_utils.js +0 -9
- package/test/test/util/util.js +5 -19
- package/test/test/util/waiter.js +84 -43
- package/test/text/cue_integration.js +0 -4
- package/test/text/lrc_text_parser_unit.js +0 -4
- package/test/text/mp4_ttml_parser_unit.js +0 -6
- package/test/text/mp4_vtt_parser_unit.js +1 -7
- package/test/text/sbv_text_parser_unit.js +0 -4
- package/test/text/simple_text_displayer_unit.js +1 -8
- package/test/text/srt_text_parser_unit.js +0 -4
- package/test/text/ssa_text_parser_unit.js +0 -5
- package/test/text/text_engine_unit.js +2 -7
- package/test/text/text_track_integration.js +0 -2
- package/test/text/ttml_text_parser_unit.js +2 -11
- package/test/text/ui_text_displayer_unit.js +44 -41
- package/test/text/vtt_text_parser_unit.js +0 -9
- 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 -16
- package/test/ui/ui_unit.js +1 -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 +0 -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/functional_unit.js +1 -1
- 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/mime_utils_unit.js +54 -0
- 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 +93 -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 +3 -8
- 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/less/ad_controls.less +6 -6
- package/ui/less/buttons.less +6 -6
- package/ui/less/containers.less +13 -15
- 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/sjn-translations.yaml +257 -0
- package/ui/locales/sjn.json +42 -0
- package/ui/seek_bar.js +2 -1
- package/.github/workflows/build_and_test.yaml +0 -73
- package/.github/workflows/release.yaml +0 -53
- package/docs/tutorials/gsoc-ideas-list.md +0 -3
- package/externs/svgelement.js +0 -18
- package/externs/webcrypto.js +0 -18
- package/lib/util/mutex.js +0 -52
package/lib/player.js
CHANGED
|
@@ -440,8 +440,23 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
440
440
|
*/
|
|
441
441
|
this.isTextVisible_ = false;
|
|
442
442
|
|
|
443
|
-
/**
|
|
444
|
-
|
|
443
|
+
/**
|
|
444
|
+
* For listeners scoped to the lifetime of the Player instance.
|
|
445
|
+
* @private {shaka.util.EventManager}
|
|
446
|
+
*/
|
|
447
|
+
this.globalEventManager_ = new shaka.util.EventManager();
|
|
448
|
+
|
|
449
|
+
/**
|
|
450
|
+
* For listeners scoped to the lifetime of the media element attachment.
|
|
451
|
+
* @private {shaka.util.EventManager}
|
|
452
|
+
*/
|
|
453
|
+
this.attachEventManager_ = new shaka.util.EventManager();
|
|
454
|
+
|
|
455
|
+
/**
|
|
456
|
+
* For listeners scoped to the lifetime of the loaded content.
|
|
457
|
+
* @private {shaka.util.EventManager}
|
|
458
|
+
*/
|
|
459
|
+
this.loadEventManager_ = new shaka.util.EventManager();
|
|
445
460
|
|
|
446
461
|
/** @private {shaka.net.NetworkingEngine} */
|
|
447
462
|
this.networkingEngine_ = null;
|
|
@@ -582,7 +597,7 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
582
597
|
|
|
583
598
|
// If the browser comes back online after being offline, then try to play
|
|
584
599
|
// again.
|
|
585
|
-
this.
|
|
600
|
+
this.globalEventManager_.listen(window, 'online', () => {
|
|
586
601
|
this.retryStreaming();
|
|
587
602
|
});
|
|
588
603
|
|
|
@@ -770,10 +785,18 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
770
785
|
});
|
|
771
786
|
await this.walker_.destroy();
|
|
772
787
|
|
|
773
|
-
// Tear-down the event
|
|
774
|
-
if (this.
|
|
775
|
-
this.
|
|
776
|
-
this.
|
|
788
|
+
// Tear-down the event managers to ensure handlers stop firing.
|
|
789
|
+
if (this.globalEventManager_) {
|
|
790
|
+
this.globalEventManager_.release();
|
|
791
|
+
this.globalEventManager_ = null;
|
|
792
|
+
}
|
|
793
|
+
if (this.attachEventManager_) {
|
|
794
|
+
this.attachEventManager_.release();
|
|
795
|
+
this.attachEventManager_ = null;
|
|
796
|
+
}
|
|
797
|
+
if (this.loadEventManager_) {
|
|
798
|
+
this.loadEventManager_.release();
|
|
799
|
+
this.loadEventManager_ = null;
|
|
777
800
|
}
|
|
778
801
|
|
|
779
802
|
this.abrManagerFactory_ = null;
|
|
@@ -1316,7 +1339,7 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
1316
1339
|
has.mediaElement = wants.mediaElement;
|
|
1317
1340
|
|
|
1318
1341
|
const onError = (error) => this.onVideoError_(error);
|
|
1319
|
-
this.
|
|
1342
|
+
this.attachEventManager_.listen(has.mediaElement, 'error', onError);
|
|
1320
1343
|
}
|
|
1321
1344
|
|
|
1322
1345
|
this.video_ = has.mediaElement;
|
|
@@ -1343,10 +1366,10 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
1343
1366
|
* @private
|
|
1344
1367
|
*/
|
|
1345
1368
|
onDetach_(has, wants) {
|
|
1346
|
-
// If we
|
|
1369
|
+
// If we were going from "detached" to "detached" we wouldn't have
|
|
1347
1370
|
// a media element to detach from.
|
|
1348
1371
|
if (has.mediaElement) {
|
|
1349
|
-
this.
|
|
1372
|
+
this.attachEventManager_.removeAll();
|
|
1350
1373
|
has.mediaElement = null;
|
|
1351
1374
|
}
|
|
1352
1375
|
|
|
@@ -1404,11 +1427,7 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
1404
1427
|
// In most cases we should have a media element. The one exception would
|
|
1405
1428
|
// be if there was an error and we, by chance, did not have a media element.
|
|
1406
1429
|
if (has.mediaElement) {
|
|
1407
|
-
this.
|
|
1408
|
-
this.eventManager_.unlisten(has.mediaElement, 'playing');
|
|
1409
|
-
this.eventManager_.unlisten(has.mediaElement, 'pause');
|
|
1410
|
-
this.eventManager_.unlisten(has.mediaElement, 'ended');
|
|
1411
|
-
this.eventManager_.unlisten(has.mediaElement, 'ratechange');
|
|
1430
|
+
this.loadEventManager_.removeAll();
|
|
1412
1431
|
}
|
|
1413
1432
|
|
|
1414
1433
|
// Some observers use some playback components, shutting down the observers
|
|
@@ -1902,18 +1921,18 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
1902
1921
|
this.assetUri_ = assetUri;
|
|
1903
1922
|
|
|
1904
1923
|
this.playRateController_ = new shaka.media.PlayRateController({
|
|
1905
|
-
getRate: () =>
|
|
1906
|
-
getDefaultRate: () =>
|
|
1907
|
-
setRate: (rate) => {
|
|
1908
|
-
movePlayhead: (delta) => {
|
|
1924
|
+
getRate: () => mediaElement.playbackRate,
|
|
1925
|
+
getDefaultRate: () => mediaElement.defaultPlaybackRate,
|
|
1926
|
+
setRate: (rate) => { mediaElement.playbackRate = rate; },
|
|
1927
|
+
movePlayhead: (delta) => { mediaElement.currentTime += delta; },
|
|
1909
1928
|
});
|
|
1910
1929
|
|
|
1911
1930
|
const updateStateHistory = () => this.updateStateHistory_();
|
|
1912
1931
|
const onRateChange = () => this.onRateChange_();
|
|
1913
|
-
this.
|
|
1914
|
-
this.
|
|
1915
|
-
this.
|
|
1916
|
-
this.
|
|
1932
|
+
this.loadEventManager_.listen(mediaElement, 'playing', updateStateHistory);
|
|
1933
|
+
this.loadEventManager_.listen(mediaElement, 'pause', updateStateHistory);
|
|
1934
|
+
this.loadEventManager_.listen(mediaElement, 'ended', updateStateHistory);
|
|
1935
|
+
this.loadEventManager_.listen(mediaElement, 'ratechange', onRateChange);
|
|
1917
1936
|
|
|
1918
1937
|
const abrFactory = this.config_.abrFactory;
|
|
1919
1938
|
if (!this.abrManager_ || this.abrManagerFactory_ != abrFactory) {
|
|
@@ -1976,6 +1995,24 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
1976
1995
|
// "streaming" so that they can access internal information.
|
|
1977
1996
|
this.loadMode_ = shaka.Player.LoadMode.MEDIA_SOURCE;
|
|
1978
1997
|
|
|
1998
|
+
if (mediaElement.textTracks) {
|
|
1999
|
+
this.loadEventManager_.listen(
|
|
2000
|
+
mediaElement.textTracks, 'addtrack', (e) => {
|
|
2001
|
+
const trackEvent = /** @type {!TrackEvent} */(e);
|
|
2002
|
+
if (trackEvent.track) {
|
|
2003
|
+
const track = trackEvent.track;
|
|
2004
|
+
goog.asserts.assert(
|
|
2005
|
+
track instanceof TextTrack, 'Wrong track type!');
|
|
2006
|
+
|
|
2007
|
+
switch (track.kind) {
|
|
2008
|
+
case 'chapters':
|
|
2009
|
+
this.activateChaptersTrack_(track);
|
|
2010
|
+
break;
|
|
2011
|
+
}
|
|
2012
|
+
}
|
|
2013
|
+
});
|
|
2014
|
+
}
|
|
2015
|
+
|
|
1979
2016
|
// The event must be fired after we filter by restrictions but before the
|
|
1980
2017
|
// active stream is picked to allow those listening for the "streaming"
|
|
1981
2018
|
// event to make changes before streaming starts.
|
|
@@ -2062,7 +2099,7 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
2062
2099
|
}
|
|
2063
2100
|
|
|
2064
2101
|
// Wait for the 'loadedmetadata' event to measure load() latency.
|
|
2065
|
-
this.
|
|
2102
|
+
this.loadEventManager_.listenOnce(mediaElement, 'loadedmetadata', () => {
|
|
2066
2103
|
const now = Date.now() / 1000;
|
|
2067
2104
|
const delta = now - wants.startTimeOfLoad;
|
|
2068
2105
|
this.stats_.setLoadLatency(delta);
|
|
@@ -2215,17 +2252,26 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
2215
2252
|
// Save the uri so that it can be used outside of the load-graph.
|
|
2216
2253
|
this.assetUri_ = has.uri;
|
|
2217
2254
|
|
|
2218
|
-
|
|
2255
|
+
const mediaElement = has.mediaElement;
|
|
2256
|
+
|
|
2257
|
+
this.playhead_ = new shaka.media.SrcEqualsPlayhead(mediaElement);
|
|
2258
|
+
|
|
2259
|
+
// This flag is used below in the language preference setup to check if
|
|
2260
|
+
// this load was canceled before the necessary awaits completed.
|
|
2261
|
+
let unloaded = false;
|
|
2262
|
+
this.cleanupOnUnload_.push(() => {
|
|
2263
|
+
unloaded = true;
|
|
2264
|
+
});
|
|
2219
2265
|
|
|
2220
2266
|
if (has.startTime != null) {
|
|
2221
2267
|
this.playhead_.setStartTime(has.startTime);
|
|
2222
2268
|
}
|
|
2223
2269
|
|
|
2224
2270
|
this.playRateController_ = new shaka.media.PlayRateController({
|
|
2225
|
-
getRate: () =>
|
|
2226
|
-
getDefaultRate: () =>
|
|
2227
|
-
setRate: (rate) => {
|
|
2228
|
-
movePlayhead: (delta) => {
|
|
2271
|
+
getRate: () => mediaElement.playbackRate,
|
|
2272
|
+
getDefaultRate: () => mediaElement.defaultPlaybackRate,
|
|
2273
|
+
setRate: (rate) => { mediaElement.playbackRate = rate; },
|
|
2274
|
+
movePlayhead: (delta) => { mediaElement.currentTime += delta; },
|
|
2229
2275
|
});
|
|
2230
2276
|
|
|
2231
2277
|
// We need to start the buffer management code near the end because it will
|
|
@@ -2237,16 +2283,17 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
2237
2283
|
// Add all media element listeners.
|
|
2238
2284
|
const updateStateHistory = () => this.updateStateHistory_();
|
|
2239
2285
|
const onRateChange = () => this.onRateChange_();
|
|
2240
|
-
this.
|
|
2241
|
-
this.
|
|
2242
|
-
this.
|
|
2243
|
-
this.
|
|
2286
|
+
this.loadEventManager_.listen(mediaElement, 'playing', updateStateHistory);
|
|
2287
|
+
this.loadEventManager_.listen(mediaElement, 'pause', updateStateHistory);
|
|
2288
|
+
this.loadEventManager_.listen(mediaElement, 'ended', updateStateHistory);
|
|
2289
|
+
this.loadEventManager_.listen(mediaElement, 'ratechange', onRateChange);
|
|
2244
2290
|
|
|
2245
2291
|
// Wait for the 'loadedmetadata' event to measure load() latency, but only
|
|
2246
2292
|
// if preload is set in a way that would result in this event firing
|
|
2247
|
-
// automatically.
|
|
2248
|
-
|
|
2249
|
-
|
|
2293
|
+
// automatically.
|
|
2294
|
+
// See https://github.com/shaka-project/shaka-player/issues/2483
|
|
2295
|
+
if (mediaElement.preload != 'none') {
|
|
2296
|
+
this.loadEventManager_.listenOnce(mediaElement, 'loadedmetadata', () => {
|
|
2250
2297
|
const now = Date.now() / 1000;
|
|
2251
2298
|
const delta = now - wants.startTimeOfLoad;
|
|
2252
2299
|
this.stats_.setLoadLatency(delta);
|
|
@@ -2256,38 +2303,47 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
2256
2303
|
// The audio tracks are only available on Safari at the moment, but this
|
|
2257
2304
|
// drives the tracks API for Safari's native HLS. So when they change,
|
|
2258
2305
|
// fire the corresponding Shaka Player event.
|
|
2259
|
-
if (
|
|
2260
|
-
this.
|
|
2261
|
-
|
|
2262
|
-
this.
|
|
2263
|
-
|
|
2306
|
+
if (mediaElement.audioTracks) {
|
|
2307
|
+
this.loadEventManager_.listen(
|
|
2308
|
+
mediaElement.audioTracks, 'addtrack', () => this.onTracksChanged_());
|
|
2309
|
+
this.loadEventManager_.listen(
|
|
2310
|
+
mediaElement.audioTracks, 'removetrack',
|
|
2311
|
+
() => this.onTracksChanged_());
|
|
2312
|
+
this.loadEventManager_.listen(
|
|
2313
|
+
mediaElement.audioTracks, 'change', () => this.onTracksChanged_());
|
|
2314
|
+
}
|
|
2315
|
+
|
|
2316
|
+
if (mediaElement.textTracks) {
|
|
2317
|
+
this.loadEventManager_.listen(
|
|
2318
|
+
mediaElement.textTracks, 'addtrack', (e) => {
|
|
2319
|
+
const trackEvent = /** @type {!TrackEvent} */(e);
|
|
2320
|
+
if (trackEvent.track) {
|
|
2321
|
+
const track = trackEvent.track;
|
|
2322
|
+
goog.asserts.assert(
|
|
2323
|
+
track instanceof TextTrack, 'Wrong track type!');
|
|
2324
|
+
|
|
2325
|
+
switch (track.kind) {
|
|
2326
|
+
case 'metadata':
|
|
2327
|
+
this.processTimedMetadataSrcEqls_(track);
|
|
2328
|
+
break;
|
|
2329
|
+
|
|
2330
|
+
case 'chapters':
|
|
2331
|
+
this.activateChaptersTrack_(track);
|
|
2332
|
+
break;
|
|
2333
|
+
|
|
2334
|
+
default:
|
|
2335
|
+
this.onTracksChanged_();
|
|
2336
|
+
break;
|
|
2337
|
+
}
|
|
2338
|
+
}
|
|
2339
|
+
});
|
|
2340
|
+
|
|
2341
|
+
this.loadEventManager_.listen(
|
|
2342
|
+
mediaElement.textTracks, 'removetrack',
|
|
2343
|
+
() => this.onTracksChanged_());
|
|
2344
|
+
this.loadEventManager_.listen(
|
|
2345
|
+
mediaElement.textTracks, 'change',
|
|
2264
2346
|
() => this.onTracksChanged_());
|
|
2265
|
-
this.eventManager_.listen(
|
|
2266
|
-
this.video_.audioTracks, 'change', () => this.onTracksChanged_());
|
|
2267
|
-
}
|
|
2268
|
-
if (this.video_.textTracks) {
|
|
2269
|
-
this.eventManager_.listen(this.video_.textTracks, 'addtrack', (e) => {
|
|
2270
|
-
const trackEvent = /** @type {!TrackEvent} */(e);
|
|
2271
|
-
if (trackEvent.track) {
|
|
2272
|
-
const track = trackEvent.track;
|
|
2273
|
-
goog.asserts.assert(track instanceof TextTrack, 'Wrong track type!');
|
|
2274
|
-
switch (track.kind) {
|
|
2275
|
-
case 'metadata':
|
|
2276
|
-
this.processTimedMetadataSrcEqls_(track);
|
|
2277
|
-
break;
|
|
2278
|
-
case 'chapters':
|
|
2279
|
-
this.processChaptersTrack_(track);
|
|
2280
|
-
break;
|
|
2281
|
-
default:
|
|
2282
|
-
this.onTracksChanged_();
|
|
2283
|
-
break;
|
|
2284
|
-
}
|
|
2285
|
-
}
|
|
2286
|
-
});
|
|
2287
|
-
this.eventManager_.listen(
|
|
2288
|
-
this.video_.textTracks, 'removetrack', () => this.onTracksChanged_());
|
|
2289
|
-
this.eventManager_.listen(
|
|
2290
|
-
this.video_.textTracks, 'change', () => this.onTracksChanged_());
|
|
2291
2347
|
}
|
|
2292
2348
|
|
|
2293
2349
|
const extension = shaka.media.ManifestParser.getExtension(has.uri);
|
|
@@ -2296,14 +2352,14 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
2296
2352
|
|
|
2297
2353
|
// By setting |src| we are done "loading" with src=. We don't need to set
|
|
2298
2354
|
// the current time because |playhead| will do that for us.
|
|
2299
|
-
|
|
2355
|
+
mediaElement.src = this.cmcdManager_.appendSrcData(has.uri, mimeType);
|
|
2300
2356
|
|
|
2301
2357
|
// Tizen 3 / WebOS won't load anything unless you call load() explicitly,
|
|
2302
2358
|
// no matter the value of the preload attribute. This is harmful on some
|
|
2303
2359
|
// other platforms by triggering unbounded loading of media data, but is
|
|
2304
2360
|
// necessary here.
|
|
2305
2361
|
if (shaka.util.Platform.isTizen() || shaka.util.Platform.isWebOS()) {
|
|
2306
|
-
|
|
2362
|
+
mediaElement.load();
|
|
2307
2363
|
}
|
|
2308
2364
|
|
|
2309
2365
|
// Set the load mode last so that we know that all our components are
|
|
@@ -2319,31 +2375,18 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
2319
2375
|
// wait for the full data, that won't happen on Safari until the play button
|
|
2320
2376
|
// is hit.
|
|
2321
2377
|
const fullyLoaded = new shaka.util.PublicPromise();
|
|
2322
|
-
shaka.util.MediaReadyState.waitForReadyState(
|
|
2378
|
+
shaka.util.MediaReadyState.waitForReadyState(mediaElement,
|
|
2323
2379
|
HTMLMediaElement.HAVE_METADATA,
|
|
2324
|
-
this.
|
|
2380
|
+
this.loadEventManager_,
|
|
2325
2381
|
() => {
|
|
2326
2382
|
fullyLoaded.resolve();
|
|
2327
2383
|
});
|
|
2328
2384
|
|
|
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
2385
|
// We can't switch to preferred languages, though, until the data is loaded.
|
|
2337
|
-
shaka.util.MediaReadyState.waitForReadyState(
|
|
2386
|
+
shaka.util.MediaReadyState.waitForReadyState(mediaElement,
|
|
2338
2387
|
HTMLMediaElement.HAVE_CURRENT_DATA,
|
|
2339
|
-
this.
|
|
2388
|
+
this.loadEventManager_,
|
|
2340
2389
|
async () => {
|
|
2341
|
-
// If we have moved on to another piece of content while waiting for
|
|
2342
|
-
// the above event, we should not change tracks here.
|
|
2343
|
-
if (unloaded) {
|
|
2344
|
-
return;
|
|
2345
|
-
}
|
|
2346
|
-
|
|
2347
2390
|
this.setupPreferredAudioOnSrc_();
|
|
2348
2391
|
|
|
2349
2392
|
// Applying the text preference too soon can result in it being
|
|
@@ -2351,8 +2394,9 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
2351
2394
|
const textTracks = this.getFilteredTextTracks_();
|
|
2352
2395
|
if (!textTracks.find((t) => t.mode != 'disabled')) {
|
|
2353
2396
|
await new Promise((resolve) => {
|
|
2354
|
-
this.
|
|
2355
|
-
|
|
2397
|
+
this.loadEventManager_.listenOnce(
|
|
2398
|
+
mediaElement.textTracks, 'change', resolve);
|
|
2399
|
+
|
|
2356
2400
|
// We expect the event to fire because it does on Safari.
|
|
2357
2401
|
// But in case it doesn't on some other platform or future
|
|
2358
2402
|
// version, move on in 1 second no matter what. This keeps the
|
|
@@ -2371,10 +2415,10 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
2371
2415
|
this.setupPreferredTextOnSrc_();
|
|
2372
2416
|
});
|
|
2373
2417
|
|
|
2374
|
-
if (
|
|
2418
|
+
if (mediaElement.error) {
|
|
2375
2419
|
// Already failed!
|
|
2376
2420
|
fullyLoaded.reject(this.videoErrorToShakaError_());
|
|
2377
|
-
} else if (
|
|
2421
|
+
} else if (mediaElement.preload == 'none') {
|
|
2378
2422
|
shaka.log.alwaysWarn(
|
|
2379
2423
|
'With <video preload="none">, the browser will not load anything ' +
|
|
2380
2424
|
'until play() is called. We are unable to measure load latency in ' +
|
|
@@ -2385,7 +2429,7 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
2385
2429
|
fullyLoaded.resolve();
|
|
2386
2430
|
}
|
|
2387
2431
|
|
|
2388
|
-
this.
|
|
2432
|
+
this.loadEventManager_.listenOnce(mediaElement, 'error', () => {
|
|
2389
2433
|
fullyLoaded.reject(this.videoErrorToShakaError_());
|
|
2390
2434
|
});
|
|
2391
2435
|
|
|
@@ -2469,7 +2513,7 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
2469
2513
|
|
|
2470
2514
|
// Hidden mode is required for the cuechange event to launch correctly
|
|
2471
2515
|
track.mode = 'hidden';
|
|
2472
|
-
this.
|
|
2516
|
+
this.loadEventManager_.listen(track, 'cuechange', () => {
|
|
2473
2517
|
if (!track.activeCues) {
|
|
2474
2518
|
return;
|
|
2475
2519
|
}
|
|
@@ -2487,12 +2531,16 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
2487
2531
|
// In Safari the initial assignment does not always work, so we schedule
|
|
2488
2532
|
// this process to be repeated several times to ensure that it has been put
|
|
2489
2533
|
// in the correct mode.
|
|
2490
|
-
new shaka.util.Timer(() => {
|
|
2534
|
+
const timer = new shaka.util.Timer(() => {
|
|
2491
2535
|
const textTracks = this.getMetadataTracks_();
|
|
2492
2536
|
for (const textTrack of textTracks) {
|
|
2493
2537
|
textTrack.mode = 'hidden';
|
|
2494
2538
|
}
|
|
2495
|
-
}).tickNow().tickAfter(
|
|
2539
|
+
}).tickNow().tickAfter(0.5);
|
|
2540
|
+
|
|
2541
|
+
this.cleanupOnUnload_.push(() => {
|
|
2542
|
+
timer.stop();
|
|
2543
|
+
});
|
|
2496
2544
|
}
|
|
2497
2545
|
|
|
2498
2546
|
|
|
@@ -2543,12 +2591,12 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
2543
2591
|
}
|
|
2544
2592
|
|
|
2545
2593
|
/**
|
|
2546
|
-
*
|
|
2594
|
+
* Set the mode on a chapters track so that it loads.
|
|
2547
2595
|
*
|
|
2548
2596
|
* @param {?TextTrack} track
|
|
2549
2597
|
* @private
|
|
2550
2598
|
*/
|
|
2551
|
-
|
|
2599
|
+
activateChaptersTrack_(track) {
|
|
2552
2600
|
if (!track || track.kind != 'chapters') {
|
|
2553
2601
|
return;
|
|
2554
2602
|
}
|
|
@@ -2560,12 +2608,13 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
2560
2608
|
// In Safari the initial assignment does not always work, so we schedule
|
|
2561
2609
|
// this process to be repeated several times to ensure that it has been put
|
|
2562
2610
|
// in the correct mode.
|
|
2563
|
-
new shaka.util.Timer(() => {
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2611
|
+
const timer = new shaka.util.Timer(() => {
|
|
2612
|
+
track.mode = 'hidden';
|
|
2613
|
+
}).tickNow().tickAfter(0.5);
|
|
2614
|
+
|
|
2615
|
+
this.cleanupOnUnload_.push(() => {
|
|
2616
|
+
timer.stop();
|
|
2617
|
+
});
|
|
2569
2618
|
}
|
|
2570
2619
|
|
|
2571
2620
|
/**
|
|
@@ -3704,7 +3753,8 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
3704
3753
|
this.streamingEngine_.switchTextStream(stream);
|
|
3705
3754
|
this.onTextChanged_();
|
|
3706
3755
|
|
|
3707
|
-
// Workaround for
|
|
3756
|
+
// Workaround for
|
|
3757
|
+
// https://github.com/shaka-project/shaka-player/issues/1299
|
|
3708
3758
|
// When track is selected, back-propagate the language to
|
|
3709
3759
|
// currentTextLanguage_.
|
|
3710
3760
|
this.currentTextLanguage_ = stream.language;
|
|
@@ -3780,7 +3830,8 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
3780
3830
|
this.switchVariant_(variant, /* fromAdaptation= */ false, clearBuffer,
|
|
3781
3831
|
safeMargin);
|
|
3782
3832
|
|
|
3783
|
-
// Workaround for
|
|
3833
|
+
// Workaround for
|
|
3834
|
+
// https://github.com/shaka-project/shaka-player/issues/1299
|
|
3784
3835
|
// When track is selected, back-propagate the language to
|
|
3785
3836
|
// currentAudioLanguage_.
|
|
3786
3837
|
this.currentAdaptationSetCriteria_ = new shaka.media.ExampleBasedCriteria(
|
|
@@ -4703,25 +4754,41 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
4703
4754
|
if (!mimeType) {
|
|
4704
4755
|
mimeType = await this.getTextMimetype_(uri);
|
|
4705
4756
|
}
|
|
4757
|
+
|
|
4706
4758
|
let adCuePoints = [];
|
|
4707
4759
|
if (this.adManager_) {
|
|
4708
4760
|
try {
|
|
4709
4761
|
adCuePoints = this.adManager_.getServerSideCuePoints();
|
|
4710
4762
|
} catch (error) {}
|
|
4711
4763
|
}
|
|
4712
|
-
|
|
4713
|
-
|
|
4764
|
+
|
|
4765
|
+
/** @type {!HTMLTrackElement} */
|
|
4766
|
+
const trackElement = await this.addSrcTrackElement_(
|
|
4767
|
+
uri, language, /* kind= */ 'chapters', mimeType, /* label= */ '',
|
|
4768
|
+
adCuePoints);
|
|
4769
|
+
|
|
4714
4770
|
const chaptersTracks = this.getChaptersTracks();
|
|
4715
4771
|
const chaptersTrack = chaptersTracks.find((t) => {
|
|
4716
4772
|
return t.language == language;
|
|
4717
4773
|
});
|
|
4774
|
+
|
|
4718
4775
|
if (chaptersTrack) {
|
|
4719
|
-
|
|
4720
|
-
|
|
4721
|
-
|
|
4722
|
-
|
|
4776
|
+
await new Promise((resolve, reject) => {
|
|
4777
|
+
// The chapter data isn't available until the 'load' event fires, and
|
|
4778
|
+
// that won't happen until the chapters track is activated by the
|
|
4779
|
+
// activateChaptersTrack_ method.
|
|
4780
|
+
this.loadEventManager_.listenOnce(trackElement, 'load', resolve);
|
|
4781
|
+
this.loadEventManager_.listenOnce(trackElement, 'error', (event) => {
|
|
4782
|
+
reject(new shaka.util.Error(
|
|
4783
|
+
shaka.util.Error.Severity.RECOVERABLE,
|
|
4784
|
+
shaka.util.Error.Category.TEXT,
|
|
4785
|
+
shaka.util.Error.Code.CHAPTERS_TRACK_FAILED));
|
|
4786
|
+
});
|
|
4787
|
+
});
|
|
4788
|
+
|
|
4723
4789
|
return chaptersTrack;
|
|
4724
4790
|
}
|
|
4791
|
+
|
|
4725
4792
|
// This should not happen, but there are browser implementations that may
|
|
4726
4793
|
// not support the Track element.
|
|
4727
4794
|
shaka.log.error('Cannot add this text when loaded with src=');
|
|
@@ -4775,6 +4842,7 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
4775
4842
|
* @param {string} mimeType
|
|
4776
4843
|
* @param {string} label
|
|
4777
4844
|
* @param {!Array.<!shaka.extern.AdCuePoint>} adCuePoints
|
|
4845
|
+
* @return {!Promise.<!HTMLTrackElement>}
|
|
4778
4846
|
* @private
|
|
4779
4847
|
*/
|
|
4780
4848
|
async addSrcTrackElement_(uri, language, kind, mimeType, label,
|
|
@@ -4790,12 +4858,14 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
4790
4858
|
uri = shaka.media.MediaSourceEngine.createObjectURL(blob);
|
|
4791
4859
|
mimeType = 'text/vtt';
|
|
4792
4860
|
}
|
|
4861
|
+
|
|
4793
4862
|
const trackElement =
|
|
4794
4863
|
/** @type {!HTMLTrackElement} */(document.createElement('track'));
|
|
4795
4864
|
trackElement.src = this.cmcdManager_.appendTextTrackData(uri);
|
|
4796
4865
|
trackElement.label = label;
|
|
4797
4866
|
trackElement.kind = kind;
|
|
4798
4867
|
trackElement.srclang = language;
|
|
4868
|
+
|
|
4799
4869
|
// Because we're pulling in the text track file via Javascript, the
|
|
4800
4870
|
// same-origin policy applies. If you'd like to have a player served
|
|
4801
4871
|
// from one domain, but the text track served from another, you'll
|
|
@@ -4805,7 +4875,9 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
4805
4875
|
if (!this.video_.getAttribute('crossorigin')) {
|
|
4806
4876
|
this.video_.setAttribute('crossorigin', 'anonymous');
|
|
4807
4877
|
}
|
|
4878
|
+
|
|
4808
4879
|
this.video_.appendChild(trackElement);
|
|
4880
|
+
return trackElement;
|
|
4809
4881
|
}
|
|
4810
4882
|
|
|
4811
4883
|
/**
|
|
@@ -5175,7 +5247,8 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
5175
5247
|
}
|
|
5176
5248
|
|
|
5177
5249
|
await stream.createSegmentIndex();
|
|
5178
|
-
const
|
|
5250
|
+
const iter = stream.segmentIndex.getIteratorForTime(time);
|
|
5251
|
+
const ref = iter ? iter.next().value : null;
|
|
5179
5252
|
if (!ref) {
|
|
5180
5253
|
return null;
|
|
5181
5254
|
}
|
|
@@ -5252,7 +5325,7 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
5252
5325
|
// If the playback rate changes while seeking, Edge will cache the playback
|
|
5253
5326
|
// rate and use it after seeking.
|
|
5254
5327
|
//
|
|
5255
|
-
// https://github.com/
|
|
5328
|
+
// https://github.com/shaka-project/shaka-player/issues/951
|
|
5256
5329
|
if (newRate == 0) {
|
|
5257
5330
|
return;
|
|
5258
5331
|
}
|
|
@@ -5844,7 +5917,10 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
5844
5917
|
} // if (keyIds.size)
|
|
5845
5918
|
|
|
5846
5919
|
if (tracksChanged) {
|
|
5847
|
-
this.updateAbrManagerVariants_();
|
|
5920
|
+
const variantsUpdated = this.updateAbrManagerVariants_();
|
|
5921
|
+
if (!variantsUpdated) {
|
|
5922
|
+
return;
|
|
5923
|
+
}
|
|
5848
5924
|
}
|
|
5849
5925
|
|
|
5850
5926
|
const currentVariant = this.streamingEngine_.getCurrentVariant();
|
|
@@ -6558,7 +6634,7 @@ shaka.Player.TYPICAL_BUFFERING_THRESHOLD_ = 0.5;
|
|
|
6558
6634
|
* @define {string} A version number taken from git at compile time.
|
|
6559
6635
|
* @export
|
|
6560
6636
|
*/
|
|
6561
|
-
shaka.Player.version = 'v3.3.
|
|
6637
|
+
shaka.Player.version = 'v3.3.5-uncompiled';
|
|
6562
6638
|
|
|
6563
6639
|
// Initialize the deprecation system using the version string we just set
|
|
6564
6640
|
// 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 {
|
|
@@ -29,12 +29,12 @@ shaka.polyfill.MediaCapabilities = class {
|
|
|
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
40
|
if (!shaka.util.Platform.isChromecast() &&
|
|
@@ -54,7 +54,7 @@ shaka.polyfill.MediaCapabilities = class {
|
|
|
54
54
|
|
|
55
55
|
// Keep the patched MediaCapabilities object from being garbage-collected in
|
|
56
56
|
// Safari.
|
|
57
|
-
// See https://github.com/
|
|
57
|
+
// See https://github.com/shaka-project/shaka-player/issues/3696#issuecomment-1009472718
|
|
58
58
|
shaka.polyfill.MediaCapabilities.originalMcap =
|
|
59
59
|
navigator.mediaCapabilities;
|
|
60
60
|
|
|
@@ -39,7 +39,7 @@ shaka.polyfill.MediaSource = class {
|
|
|
39
39
|
shaka.polyfill.MediaSource.patchCastIsTypeSupported_();
|
|
40
40
|
} else if (safariVersion) {
|
|
41
41
|
// TS content is broken on Safari in general.
|
|
42
|
-
// See https://github.com/
|
|
42
|
+
// See https://github.com/shaka-project/shaka-player/issues/743
|
|
43
43
|
// and https://bugs.webkit.org/show_bug.cgi?id=165342
|
|
44
44
|
shaka.polyfill.MediaSource.rejectTsContent_();
|
|
45
45
|
|