shaka-player 3.3.0 → 3.3.3
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 +130 -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 +145 -0
- package/.github/workflows/safari-homedir-launcher.sh +18 -0
- package/.github/workflows/selenium-lab-tests.yaml +93 -0
- package/AUTHORS +2 -0
- package/CHANGELOG.md +1722 -1640
- 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 +1 -1
- package/build/checkversion.py +1 -1
- package/build/conformance.textproto +196 -169
- 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 +93 -28
- 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 +233 -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 +272 -238
- package/dist/shaka-player.compiled.debug.d.ts +272 -238
- package/dist/shaka-player.compiled.debug.externs.js +53 -16
- package/dist/shaka-player.compiled.debug.js +393 -394
- package/dist/shaka-player.compiled.debug.map +4 -4
- package/dist/shaka-player.compiled.externs.js +53 -16
- package/dist/shaka-player.compiled.js +840 -843
- package/dist/shaka-player.compiled.map +4 -4
- package/dist/shaka-player.ui.d.ts +318 -293
- package/dist/shaka-player.ui.debug.d.ts +318 -293
- package/dist/shaka-player.ui.debug.externs.js +55 -27
- package/dist/shaka-player.ui.debug.js +415 -417
- package/dist/shaka-player.ui.debug.map +4 -4
- package/dist/shaka-player.ui.externs.js +55 -27
- package/dist/shaka-player.ui.js +997 -1000
- 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 +186 -0
- package/externs/shaka/player.js +8 -0
- package/externs/shaka/text.js +10 -0
- package/karma.conf.js +156 -45
- package/lib/abr/simple_abr_manager.js +12 -6
- package/lib/ads/ad_manager.js +1 -0
- package/lib/cast/cast_proxy.js +6 -4
- package/lib/cast/cast_receiver.js +3 -0
- 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 +40 -30
- 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 +41 -9
- package/lib/hls/manifest_text_parser.js +4 -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 +3 -2
- 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/quality_observer.js +17 -34
- package/lib/media/region_observer.js +39 -33
- package/lib/media/region_timeline.js +17 -19
- package/lib/media/segment_index.js +2 -1
- package/lib/media/segment_reference.js +19 -1
- package/lib/media/streaming_engine.js +12 -9
- package/lib/media/time_ranges_utils.js +1 -3
- package/lib/media/video_wrapper.js +1 -1
- package/lib/net/networking_engine.js +5 -1
- package/lib/offline/storage.js +12 -13
- package/lib/player.js +87 -41
- package/lib/polyfill/all.js +2 -3
- package/lib/polyfill/encryption_scheme.js +1 -1
- package/lib/polyfill/media_capabilities.js +32 -17
- package/lib/polyfill/mediasource.js +1 -1
- package/lib/polyfill/symbol.js +46 -0
- package/lib/text/cue.js +7 -1
- package/lib/text/simple_text_displayer.js +2 -1
- package/lib/text/ttml_text_parser.js +92 -63
- package/lib/text/ui_text_displayer.js +18 -12
- package/lib/util/buffer_utils.js +1 -3
- package/lib/util/cmcd_manager.js +47 -201
- package/lib/util/ebml_parser.js +3 -3
- package/lib/util/error.js +1 -1
- package/lib/util/fake_event_target.js +21 -1
- package/lib/util/iterables.js +0 -46
- 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 +3 -3
- package/lib/util/pssh.js +1 -4
- package/lib/util/stream_utils.js +88 -11
- package/lib/util/string_utils.js +3 -5
- package/lib/util/uint8array_utils.js +3 -5
- package/lib/util/xml_utils.js +34 -7
- package/package.json +62 -40
- 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 +0 -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 +45 -15
- package/test/dash/dash_parser_manifest_unit.js +4 -17
- 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 +2 -14
- package/test/hls/hls_parser_unit.js +76 -15
- 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 +7 -27
- package/test/media/manifest_parser_unit.js +0 -4
- package/test/media/media_source_engine_integration.js +0 -7
- package/test/media/media_source_engine_unit.js +1 -14
- 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 +4 -5
- package/test/media/region_observer_unit.js +40 -10
- package/test/media/region_timeline_unit.js +40 -25
- 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 -37
- package/test/media/streaming_engine_unit.js +155 -34
- 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 +0 -6
- 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 +1 -14
- package/test/offline/storage_integration.js +1 -27
- package/test/player_external.js +2 -10
- package/test/player_integration.js +63 -36
- 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 +41 -15
- package/test/player_unit.js +71 -46
- package/test/routing/walker_unit.js +0 -8
- package/test/test/assets/chapters.vtt +2 -2
- package/test/test/assets/chapters2.vtt +10 -0
- 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 +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 +9 -26
- 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 +79 -0
- package/test/test/util/ui_utils.js +0 -9
- package/test/test/util/util.js +15 -26
- 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 +10 -23
- 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 +499 -239
- 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 +9 -19
- 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 +29 -18
- 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/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 +39 -38
- 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/third_party/closure-uri/uri.js +21 -0
- package/ui/controls.js +3 -0
- package/ui/less/ad_controls.less +4 -4
- package/ui/less/buttons.less +5 -5
- package/ui/less/containers.less +9 -11
- package/ui/less/overflow_menu.less +4 -4
- package/ui/less/range_elements.less +5 -0
- package/ui/less/tooltip.less +1 -1
- package/ui/locales/sjn-translations.yaml +257 -0
- package/ui/locales/sjn.json +42 -0
- package/ui/localization.js +12 -36
- package/ui/text_selection.js +1 -0
- package/externs/media_capabilities.js +0 -16
- package/externs/svgelement.js +0 -18
- package/externs/webcrypto.js +0 -18
|
@@ -8,16 +8,19 @@ goog.provide('shaka.media.RegionObserver');
|
|
|
8
8
|
|
|
9
9
|
goog.require('shaka.media.IPlayheadObserver');
|
|
10
10
|
goog.require('shaka.media.RegionTimeline');
|
|
11
|
+
goog.require('shaka.util.EventManager');
|
|
12
|
+
goog.require('shaka.util.FakeEvent');
|
|
13
|
+
goog.require('shaka.util.FakeEventTarget');
|
|
11
14
|
|
|
12
15
|
|
|
13
16
|
/**
|
|
14
17
|
* The region observer watches a region timeline and playhead, and fires events
|
|
15
|
-
* (
|
|
18
|
+
* ('enter', 'exit', 'skip') as the playhead moves.
|
|
16
19
|
*
|
|
17
20
|
* @implements {shaka.media.IPlayheadObserver}
|
|
18
21
|
* @final
|
|
19
22
|
*/
|
|
20
|
-
shaka.media.RegionObserver = class {
|
|
23
|
+
shaka.media.RegionObserver = class extends shaka.util.FakeEventTarget {
|
|
21
24
|
/**
|
|
22
25
|
* Create a region observer for the given timeline. The observer does not
|
|
23
26
|
* own the timeline, only uses it. This means that the observer should NOT
|
|
@@ -26,6 +29,8 @@ shaka.media.RegionObserver = class {
|
|
|
26
29
|
* @param {!shaka.media.RegionTimeline} timeline
|
|
27
30
|
*/
|
|
28
31
|
constructor(timeline) {
|
|
32
|
+
super();
|
|
33
|
+
|
|
29
34
|
/** @private {shaka.media.RegionTimeline} */
|
|
30
35
|
this.timeline_ = timeline;
|
|
31
36
|
|
|
@@ -39,13 +44,6 @@ shaka.media.RegionObserver = class {
|
|
|
39
44
|
*/
|
|
40
45
|
this.oldPosition_ = new Map();
|
|
41
46
|
|
|
42
|
-
/** @private {shaka.media.RegionObserver.EventListener} */
|
|
43
|
-
this.onEnter_ = (region, seeking) => {};
|
|
44
|
-
/** @private {shaka.media.RegionObserver.EventListener} */
|
|
45
|
-
this.onExit_ = (region, seeking) => {};
|
|
46
|
-
/** @private {shaka.media.RegionObserver.EventListener} */
|
|
47
|
-
this.onSkip_ = (region, seeking) => {};
|
|
48
|
-
|
|
49
47
|
// To make the rules easier to read, alias all the relative positions.
|
|
50
48
|
const RelativePosition = shaka.media.RegionObserver.RelativePosition_;
|
|
51
49
|
const BEFORE_THE_REGION = RelativePosition.BEFORE_THE_REGION;
|
|
@@ -62,39 +60,48 @@ shaka.media.RegionObserver = class {
|
|
|
62
60
|
{
|
|
63
61
|
weWere: null,
|
|
64
62
|
weAre: IN_THE_REGION,
|
|
65
|
-
invoke: (region, seeking) => this.
|
|
63
|
+
invoke: (region, seeking) => this.onEvent_('enter', region, seeking),
|
|
66
64
|
},
|
|
67
65
|
{
|
|
68
66
|
weWere: BEFORE_THE_REGION,
|
|
69
67
|
weAre: IN_THE_REGION,
|
|
70
|
-
invoke: (region, seeking) => this.
|
|
68
|
+
invoke: (region, seeking) => this.onEvent_('enter', region, seeking),
|
|
71
69
|
},
|
|
72
70
|
{
|
|
73
71
|
weWere: AFTER_THE_REGION,
|
|
74
72
|
weAre: IN_THE_REGION,
|
|
75
|
-
invoke: (region, seeking) => this.
|
|
73
|
+
invoke: (region, seeking) => this.onEvent_('enter', region, seeking),
|
|
76
74
|
},
|
|
77
75
|
{
|
|
78
76
|
weWere: IN_THE_REGION,
|
|
79
77
|
weAre: BEFORE_THE_REGION,
|
|
80
|
-
invoke: (region, seeking) => this.
|
|
78
|
+
invoke: (region, seeking) => this.onEvent_('exit', region, seeking),
|
|
81
79
|
},
|
|
82
80
|
{
|
|
83
81
|
weWere: IN_THE_REGION,
|
|
84
82
|
weAre: AFTER_THE_REGION,
|
|
85
|
-
invoke: (region, seeking) => this.
|
|
83
|
+
invoke: (region, seeking) => this.onEvent_('exit', region, seeking),
|
|
86
84
|
},
|
|
87
85
|
{
|
|
88
86
|
weWere: BEFORE_THE_REGION,
|
|
89
87
|
weAre: AFTER_THE_REGION,
|
|
90
|
-
invoke: (region, seeking) => this.
|
|
88
|
+
invoke: (region, seeking) => this.onEvent_('skip', region, seeking),
|
|
91
89
|
},
|
|
92
90
|
{
|
|
93
91
|
weWere: AFTER_THE_REGION,
|
|
94
92
|
weAre: BEFORE_THE_REGION,
|
|
95
|
-
invoke: (region, seeking) => this.
|
|
93
|
+
invoke: (region, seeking) => this.onEvent_('skip', region, seeking),
|
|
96
94
|
},
|
|
97
95
|
];
|
|
96
|
+
|
|
97
|
+
/** @private {shaka.util.EventManager} */
|
|
98
|
+
this.eventManager_ = new shaka.util.EventManager();
|
|
99
|
+
|
|
100
|
+
this.eventManager_.listen(this.timeline_, 'regionremove', (event) => {
|
|
101
|
+
/** @type {shaka.extern.TimelineRegionInfo} */
|
|
102
|
+
const region = event['region'];
|
|
103
|
+
this.oldPosition_.delete(region);
|
|
104
|
+
});
|
|
98
105
|
}
|
|
99
106
|
|
|
100
107
|
/** @override */
|
|
@@ -105,11 +112,10 @@ shaka.media.RegionObserver = class {
|
|
|
105
112
|
// needed.
|
|
106
113
|
this.oldPosition_.clear();
|
|
107
114
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
this.onSkip_ = (region, seeking) => {};
|
|
115
|
+
this.eventManager_.release();
|
|
116
|
+
this.eventManager_ = null;
|
|
117
|
+
|
|
118
|
+
super.release();
|
|
113
119
|
}
|
|
114
120
|
|
|
115
121
|
/** @override */
|
|
@@ -134,20 +140,20 @@ shaka.media.RegionObserver = class {
|
|
|
134
140
|
}
|
|
135
141
|
|
|
136
142
|
/**
|
|
137
|
-
*
|
|
143
|
+
* Dispatch events of the given type. All event types in this class have the
|
|
144
|
+
* same parameters: region and seeking.
|
|
138
145
|
*
|
|
139
|
-
* @param {
|
|
140
|
-
*
|
|
141
|
-
* @param {
|
|
142
|
-
*
|
|
143
|
-
* @param {shaka.media.RegionObserver.EventListener} onSkip
|
|
144
|
-
* The callback for when we move from before to after a region or from
|
|
145
|
-
* after to before a region.
|
|
146
|
+
* @param {string} eventType
|
|
147
|
+
* @param {shaka.extern.TimelineRegionInfo} region
|
|
148
|
+
* @param {boolean} seeking
|
|
149
|
+
* @private
|
|
146
150
|
*/
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
+
onEvent_(eventType, region, seeking) {
|
|
152
|
+
const event = new shaka.util.FakeEvent(eventType, new Map([
|
|
153
|
+
['region', region],
|
|
154
|
+
['seeking', seeking],
|
|
155
|
+
]));
|
|
156
|
+
this.dispatchEvent(event);
|
|
151
157
|
}
|
|
152
158
|
|
|
153
159
|
/**
|
|
@@ -6,26 +6,30 @@
|
|
|
6
6
|
|
|
7
7
|
goog.provide('shaka.media.RegionTimeline');
|
|
8
8
|
|
|
9
|
+
goog.require('shaka.util.FakeEvent');
|
|
10
|
+
goog.require('shaka.util.FakeEventTarget');
|
|
9
11
|
goog.require('shaka.util.IReleasable');
|
|
10
12
|
goog.require('shaka.util.Timer');
|
|
11
13
|
|
|
12
14
|
|
|
13
15
|
/**
|
|
14
16
|
* The region timeline is a set of unique timeline region info entries. When
|
|
15
|
-
* a new entry is added, the
|
|
17
|
+
* a new entry is added, the 'regionadd' event will be fired. When an entry is
|
|
18
|
+
* deleted, the 'regionremove' event will be fired.
|
|
16
19
|
*
|
|
17
20
|
* @implements {shaka.util.IReleasable}
|
|
18
21
|
* @final
|
|
19
22
|
*/
|
|
20
|
-
shaka.media.RegionTimeline = class {
|
|
23
|
+
shaka.media.RegionTimeline = class extends shaka.util.FakeEventTarget {
|
|
21
24
|
/**
|
|
22
25
|
* @param {!function():{start: number, end: number}} getSeekRange
|
|
23
26
|
*/
|
|
24
27
|
constructor(getSeekRange) {
|
|
25
|
-
|
|
26
|
-
|
|
28
|
+
super();
|
|
29
|
+
|
|
27
30
|
/** @private {!Set.<shaka.extern.TimelineRegionInfo>} */
|
|
28
31
|
this.regions_ = new Set();
|
|
32
|
+
|
|
29
33
|
/** @private {!function():{start: number, end: number}} */
|
|
30
34
|
this.getSeekRange_ = getSeekRange;
|
|
31
35
|
|
|
@@ -44,22 +48,9 @@ shaka.media.RegionTimeline = class {
|
|
|
44
48
|
|
|
45
49
|
/** @override */
|
|
46
50
|
release() {
|
|
47
|
-
// Prevent us from holding onto any external references via the callback.
|
|
48
|
-
this.onAddRegion_ = (region) => {};
|
|
49
51
|
this.regions_.clear();
|
|
50
52
|
this.filterTimer_.stop();
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Set the callbacks for events. This will override any previous calls to
|
|
55
|
-
* |setListeners|.
|
|
56
|
-
*
|
|
57
|
-
* @param {function(shaka.extern.TimelineRegionInfo)} onAddRegion
|
|
58
|
-
* Set the callback for when we add a new region. This callback will only
|
|
59
|
-
* be called when a region is unique (we reject duplicate regions).
|
|
60
|
-
*/
|
|
61
|
-
setListeners(onAddRegion) {
|
|
62
|
-
this.onAddRegion_ = onAddRegion;
|
|
53
|
+
super.release();
|
|
63
54
|
}
|
|
64
55
|
|
|
65
56
|
/**
|
|
@@ -72,7 +63,10 @@ shaka.media.RegionTimeline = class {
|
|
|
72
63
|
// instead of making the parser track it.
|
|
73
64
|
if (similarRegion == null) {
|
|
74
65
|
this.regions_.add(region);
|
|
75
|
-
|
|
66
|
+
const event = new shaka.util.FakeEvent('regionadd', new Map([
|
|
67
|
+
['region', region],
|
|
68
|
+
]));
|
|
69
|
+
this.dispatchEvent(event);
|
|
76
70
|
}
|
|
77
71
|
}
|
|
78
72
|
|
|
@@ -89,6 +83,10 @@ shaka.media.RegionTimeline = class {
|
|
|
89
83
|
// reson to store or process them.
|
|
90
84
|
if (region.endTime < seekRange.start) {
|
|
91
85
|
this.regions_.delete(region);
|
|
86
|
+
const event = new shaka.util.FakeEvent('regionremove', new Map([
|
|
87
|
+
['region', region],
|
|
88
|
+
]));
|
|
89
|
+
this.dispatchEvent(event);
|
|
92
90
|
}
|
|
93
91
|
}
|
|
94
92
|
}
|
|
@@ -347,7 +347,8 @@ shaka.media.SegmentIndex = class {
|
|
|
347
347
|
lastReference.appendWindowStart,
|
|
348
348
|
lastReference.appendWindowEnd,
|
|
349
349
|
lastReference.partialReferences,
|
|
350
|
-
lastReference.tilesLayout
|
|
350
|
+
lastReference.tilesLayout,
|
|
351
|
+
lastReference.tileDuration);
|
|
351
352
|
}
|
|
352
353
|
|
|
353
354
|
|
|
@@ -155,11 +155,15 @@ shaka.media.SegmentReference = class {
|
|
|
155
155
|
* The value is a grid-item-dimension consisting of two positive decimal
|
|
156
156
|
* integers in the format: column-x-row ('4x3'). It describes the
|
|
157
157
|
* arrangement of Images in a Grid. The minimum valid LAYOUT is '1x1'.
|
|
158
|
+
* @param {?number=} tileDuration
|
|
159
|
+
* The explicit duration of an individual tile within the tiles grid.
|
|
160
|
+
* If not provided, the duration should be automatically calculated based on
|
|
161
|
+
* the duration of the reference.
|
|
158
162
|
*/
|
|
159
163
|
constructor(
|
|
160
164
|
startTime, endTime, uris, startByte, endByte, initSegmentReference,
|
|
161
165
|
timestampOffset, appendWindowStart, appendWindowEnd,
|
|
162
|
-
partialReferences = [], tilesLayout = '') {
|
|
166
|
+
partialReferences = [], tilesLayout = '', tileDuration = null) {
|
|
163
167
|
// A preload hinted Partial Segment has the same startTime and endTime.
|
|
164
168
|
goog.asserts.assert(startTime <= endTime,
|
|
165
169
|
'startTime must be less than or equal to endTime');
|
|
@@ -206,6 +210,9 @@ shaka.media.SegmentReference = class {
|
|
|
206
210
|
|
|
207
211
|
/** @type {?string} */
|
|
208
212
|
this.tilesLayout = tilesLayout;
|
|
213
|
+
|
|
214
|
+
/** @type {?number} */
|
|
215
|
+
this.tileDuration = tileDuration;
|
|
209
216
|
}
|
|
210
217
|
|
|
211
218
|
/**
|
|
@@ -290,6 +297,17 @@ shaka.media.SegmentReference = class {
|
|
|
290
297
|
getTilesLayout() {
|
|
291
298
|
return this.tilesLayout;
|
|
292
299
|
}
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* Returns the segment's explicit tile duration.
|
|
303
|
+
* Only defined in image segments.
|
|
304
|
+
*
|
|
305
|
+
* @return {?number}
|
|
306
|
+
* @export
|
|
307
|
+
*/
|
|
308
|
+
getTileDuration() {
|
|
309
|
+
return this.tileDuration;
|
|
310
|
+
}
|
|
293
311
|
};
|
|
294
312
|
|
|
295
313
|
|
|
@@ -628,7 +628,7 @@ shaka.media.StreamingEngine = class {
|
|
|
628
628
|
|
|
629
629
|
// Don't clear the buffer unless something is buffered. This extra
|
|
630
630
|
// check prevents extra, useless calls to clear the buffer.
|
|
631
|
-
if (somethingBuffered) {
|
|
631
|
+
if (somethingBuffered || mediaState.performingUpdate) {
|
|
632
632
|
this.forceClearBuffer_(mediaState);
|
|
633
633
|
streamCleared = true;
|
|
634
634
|
}
|
|
@@ -674,7 +674,7 @@ shaka.media.StreamingEngine = class {
|
|
|
674
674
|
|
|
675
675
|
if (mediaState.waitingToClearBuffer) {
|
|
676
676
|
// May not be performing an update, but an update will still happen.
|
|
677
|
-
// See: https://github.com/
|
|
677
|
+
// See: https://github.com/shaka-project/shaka-player/issues/334
|
|
678
678
|
shaka.log.debug(logPrefix, 'clear: already waiting');
|
|
679
679
|
return;
|
|
680
680
|
}
|
|
@@ -920,9 +920,9 @@ shaka.media.StreamingEngine = class {
|
|
|
920
920
|
// buffering forever at the end.
|
|
921
921
|
// We should only do this if the duration needs to shrink.
|
|
922
922
|
// Growing it by less than 1ms can actually cause buffering on
|
|
923
|
-
// replay, as in https://github.com/
|
|
923
|
+
// replay, as in https://github.com/shaka-project/shaka-player/issues/979
|
|
924
924
|
// On some platforms, this can spuriously be 0, so ignore this case.
|
|
925
|
-
// https://github.com/
|
|
925
|
+
// https://github.com/shaka-project/shaka-player/issues/1967,
|
|
926
926
|
const duration = this.playerInterface_.mediaSourceEngine.getDuration();
|
|
927
927
|
if (duration != 0 &&
|
|
928
928
|
duration < this.manifest_.presentationTimeline.getDuration()) {
|
|
@@ -988,7 +988,10 @@ shaka.media.StreamingEngine = class {
|
|
|
988
988
|
unscaledBufferingGoal * this.bufferingGoalScale_;
|
|
989
989
|
|
|
990
990
|
// Check if we've buffered to the end of the presentation.
|
|
991
|
-
|
|
991
|
+
const timeUntilEnd =
|
|
992
|
+
this.manifest_.presentationTimeline.getDuration() - timeNeeded;
|
|
993
|
+
const oneMicrosecond = 1e-6;
|
|
994
|
+
if (timeUntilEnd < oneMicrosecond) {
|
|
992
995
|
// We shouldn't rebuffer if the playhead is close to the end of the
|
|
993
996
|
// presentation.
|
|
994
997
|
shaka.log.debug(logPrefix, 'buffered to end of presentation');
|
|
@@ -1656,7 +1659,7 @@ shaka.media.StreamingEngine = class {
|
|
|
1656
1659
|
// See DASH sec. 5.10.3.3.1
|
|
1657
1660
|
// If a DASH client detects an event message box with a scheme that is not
|
|
1658
1661
|
// defined in MPD, the client is expected to ignore it.
|
|
1659
|
-
if (emsgSchemeIdUris.includes(schemeId) ||
|
|
1662
|
+
if ((emsgSchemeIdUris && emsgSchemeIdUris.includes(schemeId)) ||
|
|
1660
1663
|
this.config_.dispatchAllEmsgBoxes) {
|
|
1661
1664
|
// See DASH sec. 5.10.4.1
|
|
1662
1665
|
// A special scheme in DASH used to signal manifest updates.
|
|
@@ -1715,7 +1718,7 @@ shaka.media.StreamingEngine = class {
|
|
|
1715
1718
|
const bufferedBehind = presentationTime - startTime;
|
|
1716
1719
|
|
|
1717
1720
|
const overflow = bufferedBehind - bufferBehind;
|
|
1718
|
-
// See: https://github.com/
|
|
1721
|
+
// See: https://github.com/shaka-project/shaka-player/issues/2982
|
|
1719
1722
|
if (overflow <= 0.01) {
|
|
1720
1723
|
shaka.log.v2(logPrefix,
|
|
1721
1724
|
'buffer behind okay:',
|
|
@@ -2076,7 +2079,7 @@ shaka.media.StreamingEngine.MediaState_;
|
|
|
2076
2079
|
* of the Period.
|
|
2077
2080
|
*
|
|
2078
2081
|
* NOTE: This was increased as part of the solution to
|
|
2079
|
-
* https://github.com/
|
|
2082
|
+
* https://github.com/shaka-project/shaka-player/issues/1281
|
|
2080
2083
|
*
|
|
2081
2084
|
* @const {number}
|
|
2082
2085
|
* @private
|
|
@@ -2090,7 +2093,7 @@ shaka.media.StreamingEngine.APPEND_WINDOW_START_FUDGE_ = 0.1;
|
|
|
2090
2093
|
* the Period. This rounding error could then create an artificial gap and a
|
|
2091
2094
|
* stutter when the gap-jumping logic takes over.
|
|
2092
2095
|
*
|
|
2093
|
-
* https://github.com/
|
|
2096
|
+
* https://github.com/shaka-project/shaka-player/issues/1597
|
|
2094
2097
|
*
|
|
2095
2098
|
* @const {number}
|
|
2096
2099
|
* @private
|
|
@@ -6,8 +6,6 @@
|
|
|
6
6
|
|
|
7
7
|
goog.provide('shaka.media.TimeRangesUtils');
|
|
8
8
|
|
|
9
|
-
goog.require('shaka.util.Iterables');
|
|
10
|
-
|
|
11
9
|
|
|
12
10
|
/**
|
|
13
11
|
* @summary A set of utility functions for dealing with TimeRanges objects.
|
|
@@ -157,7 +155,7 @@ shaka.media.TimeRangesUtils = class {
|
|
|
157
155
|
return [];
|
|
158
156
|
}
|
|
159
157
|
const ret = [];
|
|
160
|
-
for (
|
|
158
|
+
for (let i = 0; i < b.length; i++) {
|
|
161
159
|
ret.push({start: b.start(i), end: b.end(i)});
|
|
162
160
|
}
|
|
163
161
|
return ret;
|
|
@@ -141,7 +141,7 @@ shaka.media.VideoWrapper = class {
|
|
|
141
141
|
// TODO: Need further investigation why it happens. Before and after
|
|
142
142
|
// setting the current time, video.readyState is 1, video.paused is true,
|
|
143
143
|
// and video.buffered's TimeRanges length is 0.
|
|
144
|
-
// See: https://github.com/
|
|
144
|
+
// See: https://github.com/shaka-project/shaka-player/issues/1298
|
|
145
145
|
this.mover_.moveTo(
|
|
146
146
|
this.video_.currentTime == 0 ?
|
|
147
147
|
startTime :
|
|
@@ -232,6 +232,10 @@ shaka.net.NetworkingEngine = class extends shaka.util.FakeEventTarget {
|
|
|
232
232
|
this.destroyed_ = true;
|
|
233
233
|
this.requestFilters_.clear();
|
|
234
234
|
this.responseFilters_.clear();
|
|
235
|
+
|
|
236
|
+
// FakeEventTarget implements IReleasable
|
|
237
|
+
super.release();
|
|
238
|
+
|
|
235
239
|
return this.operationManager_.destroy();
|
|
236
240
|
}
|
|
237
241
|
|
|
@@ -427,7 +431,7 @@ shaka.net.NetworkingEngine = class extends shaka.util.FakeEventTarget {
|
|
|
427
431
|
}
|
|
428
432
|
|
|
429
433
|
// Schemes are meant to be case-insensitive.
|
|
430
|
-
// See https://github.com/
|
|
434
|
+
// See https://github.com/shaka-project/shaka-player/issues/2173
|
|
431
435
|
// and https://tools.ietf.org/html/rfc3986#section-3.1
|
|
432
436
|
scheme = scheme.toLowerCase();
|
|
433
437
|
|
package/lib/offline/storage.js
CHANGED
|
@@ -681,16 +681,15 @@ shaka.offline.Storage = class {
|
|
|
681
681
|
* @private
|
|
682
682
|
*/
|
|
683
683
|
async filterManifest_(manifest, drmEngine, config) {
|
|
684
|
-
const StreamUtils = shaka.util.StreamUtils;
|
|
685
|
-
|
|
686
684
|
// Filter the manifest based on the restrictions given in the player
|
|
687
685
|
// configuration.
|
|
688
686
|
const maxHwRes = {width: Infinity, height: Infinity};
|
|
689
|
-
StreamUtils.filterByRestrictions(
|
|
687
|
+
shaka.util.StreamUtils.filterByRestrictions(
|
|
688
|
+
manifest, config.restrictions, maxHwRes);
|
|
690
689
|
|
|
691
690
|
// Filter the manifest based on what we know MediaCapabilities will be able
|
|
692
691
|
// to play later (no point storing something we can't play).
|
|
693
|
-
StreamUtils.filterManifestByMediaCapabilities(
|
|
692
|
+
await shaka.util.StreamUtils.filterManifestByMediaCapabilities(
|
|
694
693
|
manifest, config.offline.usePersistentLicense);
|
|
695
694
|
|
|
696
695
|
// Gather all tracks.
|
|
@@ -702,24 +701,24 @@ shaka.offline.Storage = class {
|
|
|
702
701
|
const preferredVideoCodecs = config.preferredVideoCodecs;
|
|
703
702
|
const preferredAudioCodecs = config.preferredAudioCodecs;
|
|
704
703
|
|
|
705
|
-
StreamUtils.chooseCodecsAndFilterManifest(
|
|
704
|
+
shaka.util.StreamUtils.chooseCodecsAndFilterManifest(
|
|
706
705
|
manifest, preferredVideoCodecs, preferredAudioCodecs,
|
|
707
706
|
preferredAudioChannelCount, preferredDecodingAttributes);
|
|
708
707
|
|
|
709
708
|
for (const variant of manifest.variants) {
|
|
710
709
|
goog.asserts.assert(
|
|
711
|
-
StreamUtils.isPlayable(variant),
|
|
710
|
+
shaka.util.StreamUtils.isPlayable(variant),
|
|
712
711
|
'We should have already filtered by "is playable"');
|
|
713
712
|
|
|
714
|
-
allTracks.push(StreamUtils.variantToTrack(variant));
|
|
713
|
+
allTracks.push(shaka.util.StreamUtils.variantToTrack(variant));
|
|
715
714
|
}
|
|
716
715
|
|
|
717
716
|
for (const text of manifest.textStreams) {
|
|
718
|
-
allTracks.push(StreamUtils.textStreamToTrack(text));
|
|
717
|
+
allTracks.push(shaka.util.StreamUtils.textStreamToTrack(text));
|
|
719
718
|
}
|
|
720
719
|
|
|
721
720
|
for (const image of manifest.imageStreams) {
|
|
722
|
-
allTracks.push(StreamUtils.imageStreamToTrack(image));
|
|
721
|
+
allTracks.push(shaka.util.StreamUtils.imageStreamToTrack(image));
|
|
723
722
|
}
|
|
724
723
|
|
|
725
724
|
// Let the application choose which tracks to store.
|
|
@@ -805,10 +804,10 @@ shaka.offline.Storage = class {
|
|
|
805
804
|
makeManifestDB_(drmEngine, manifest, uri, metadata, config, downloader) {
|
|
806
805
|
const pendingContent = shaka.offline.StoredContentUtils.fromManifest(
|
|
807
806
|
uri, manifest, /* size= */ 0, metadata);
|
|
808
|
-
// In https://github.com/
|
|
809
|
-
// callback would be removed by the compiler if we reference the
|
|
810
|
-
// the onProgress closure below. Reading it into a local
|
|
811
|
-
// seems to work around this apparent compiler bug.
|
|
807
|
+
// In https://github.com/shaka-project/shaka-player/issues/2652, we found
|
|
808
|
+
// that this callback would be removed by the compiler if we reference the
|
|
809
|
+
// config in the onProgress closure below. Reading it into a local
|
|
810
|
+
// variable first seems to work around this apparent compiler bug.
|
|
812
811
|
const progressCallback = config.offline.progressCallback;
|
|
813
812
|
|
|
814
813
|
const onProgress = (progress, size) => {
|