shaka-player 3.2.2 → 3.2.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/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 +1598 -1525
- 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 +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 +93 -28
- 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 +2 -2
- 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 +225 -219
- package/dist/locales.js +31 -31
- 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 -227
- package/dist/shaka-player.compiled.debug.d.ts +247 -227
- package/dist/shaka-player.compiled.debug.externs.js +43 -16
- package/dist/shaka-player.compiled.debug.js +384 -388
- package/dist/shaka-player.compiled.debug.map +4 -4
- package/dist/shaka-player.compiled.externs.js +43 -16
- package/dist/shaka-player.compiled.js +818 -817
- 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 +45 -27
- package/dist/shaka-player.ui.debug.js +389 -394
- package/dist/shaka-player.ui.debug.map +4 -4
- package/dist/shaka-player.ui.externs.js +45 -27
- package/dist/shaka-player.ui.js +964 -965
- package/dist/shaka-player.ui.map +4 -4
- package/docs/design/REDESIGN.md +33 -33
- 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/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 +43 -31
- 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/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 +77 -36
- 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/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/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 +8 -9
- 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/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 +37 -18
- 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/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 -25
- package/test/player_external.js +2 -10
- package/test/player_integration.js +62 -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 +495 -237
- 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/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/ui/controls.js +3 -0
- package/ui/less/ad_controls.less +4 -4
- package/ui/less/buttons.less +5 -9
- package/ui/less/containers.less +5 -7
- package/ui/less/overflow_menu.less +4 -4
- package/ui/less/range_elements.less +5 -0
- 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
|
@@ -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
|
|
|
@@ -140,11 +140,15 @@ shaka.media.SegmentReference = class {
|
|
|
140
140
|
* The value is a grid-item-dimension consisting of two positive decimal
|
|
141
141
|
* integers in the format: column-x-row ('4x3'). It describes the
|
|
142
142
|
* arrangement of Images in a Grid. The minimum valid LAYOUT is '1x1'.
|
|
143
|
+
* @param {?number=} tileDuration
|
|
144
|
+
* The explicit duration of an individual tile within the tiles grid.
|
|
145
|
+
* If not provided, the duration should be automatically calculated based on
|
|
146
|
+
* the duration of the reference.
|
|
143
147
|
*/
|
|
144
148
|
constructor(
|
|
145
149
|
startTime, endTime, uris, startByte, endByte, initSegmentReference,
|
|
146
150
|
timestampOffset, appendWindowStart, appendWindowEnd,
|
|
147
|
-
partialReferences = [], tilesLayout = '') {
|
|
151
|
+
partialReferences = [], tilesLayout = '', tileDuration = null) {
|
|
148
152
|
// A preload hinted Partial Segment has the same startTime and endTime.
|
|
149
153
|
goog.asserts.assert(startTime <= endTime,
|
|
150
154
|
'startTime must be less than or equal to endTime');
|
|
@@ -191,6 +195,9 @@ shaka.media.SegmentReference = class {
|
|
|
191
195
|
|
|
192
196
|
/** @type {?string} */
|
|
193
197
|
this.tilesLayout = tilesLayout;
|
|
198
|
+
|
|
199
|
+
/** @type {?number} */
|
|
200
|
+
this.tileDuration = tileDuration;
|
|
194
201
|
}
|
|
195
202
|
|
|
196
203
|
/**
|
|
@@ -275,6 +282,17 @@ shaka.media.SegmentReference = class {
|
|
|
275
282
|
getTilesLayout() {
|
|
276
283
|
return this.tilesLayout;
|
|
277
284
|
}
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Returns the segment's explicit tile duration.
|
|
288
|
+
* Only defined in image segments.
|
|
289
|
+
*
|
|
290
|
+
* @return {?number}
|
|
291
|
+
* @export
|
|
292
|
+
*/
|
|
293
|
+
getTileDuration() {
|
|
294
|
+
return this.tileDuration;
|
|
295
|
+
}
|
|
278
296
|
};
|
|
279
297
|
|
|
280
298
|
|
|
@@ -623,7 +623,7 @@ shaka.media.StreamingEngine = class {
|
|
|
623
623
|
|
|
624
624
|
// Don't clear the buffer unless something is buffered. This extra
|
|
625
625
|
// check prevents extra, useless calls to clear the buffer.
|
|
626
|
-
if (somethingBuffered) {
|
|
626
|
+
if (somethingBuffered || mediaState.performingUpdate) {
|
|
627
627
|
this.forceClearBuffer_(mediaState);
|
|
628
628
|
streamCleared = true;
|
|
629
629
|
}
|
|
@@ -669,7 +669,7 @@ shaka.media.StreamingEngine = class {
|
|
|
669
669
|
|
|
670
670
|
if (mediaState.waitingToClearBuffer) {
|
|
671
671
|
// May not be performing an update, but an update will still happen.
|
|
672
|
-
// See: https://github.com/
|
|
672
|
+
// See: https://github.com/shaka-project/shaka-player/issues/334
|
|
673
673
|
shaka.log.debug(logPrefix, 'clear: already waiting');
|
|
674
674
|
return;
|
|
675
675
|
}
|
|
@@ -909,9 +909,9 @@ shaka.media.StreamingEngine = class {
|
|
|
909
909
|
// buffering forever at the end.
|
|
910
910
|
// We should only do this if the duration needs to shrink.
|
|
911
911
|
// Growing it by less than 1ms can actually cause buffering on
|
|
912
|
-
// replay, as in https://github.com/
|
|
912
|
+
// replay, as in https://github.com/shaka-project/shaka-player/issues/979
|
|
913
913
|
// On some platforms, this can spuriously be 0, so ignore this case.
|
|
914
|
-
// https://github.com/
|
|
914
|
+
// https://github.com/shaka-project/shaka-player/issues/1967,
|
|
915
915
|
const duration = this.playerInterface_.mediaSourceEngine.getDuration();
|
|
916
916
|
if (duration != 0 &&
|
|
917
917
|
duration < this.manifest_.presentationTimeline.getDuration()) {
|
|
@@ -977,7 +977,10 @@ shaka.media.StreamingEngine = class {
|
|
|
977
977
|
unscaledBufferingGoal * this.bufferingGoalScale_;
|
|
978
978
|
|
|
979
979
|
// Check if we've buffered to the end of the presentation.
|
|
980
|
-
|
|
980
|
+
const timeUntilEnd =
|
|
981
|
+
this.manifest_.presentationTimeline.getDuration() - timeNeeded;
|
|
982
|
+
const oneMicrosecond = 1e-6;
|
|
983
|
+
if (timeUntilEnd < oneMicrosecond) {
|
|
981
984
|
// We shouldn't rebuffer if the playhead is close to the end of the
|
|
982
985
|
// presentation.
|
|
983
986
|
shaka.log.debug(logPrefix, 'buffered to end of presentation');
|
|
@@ -1641,7 +1644,7 @@ shaka.media.StreamingEngine = class {
|
|
|
1641
1644
|
// See DASH sec. 5.10.3.3.1
|
|
1642
1645
|
// If a DASH client detects an event message box with a scheme that is not
|
|
1643
1646
|
// defined in MPD, the client is expected to ignore it.
|
|
1644
|
-
if (emsgSchemeIdUris.includes(schemeId)) {
|
|
1647
|
+
if (emsgSchemeIdUris && emsgSchemeIdUris.includes(schemeId)) {
|
|
1645
1648
|
// See DASH sec. 5.10.4.1
|
|
1646
1649
|
// A special scheme in DASH used to signal manifest updates.
|
|
1647
1650
|
if (schemeId == 'urn:mpeg:dash:event:2012') {
|
|
@@ -1699,7 +1702,7 @@ shaka.media.StreamingEngine = class {
|
|
|
1699
1702
|
const bufferedBehind = presentationTime - startTime;
|
|
1700
1703
|
|
|
1701
1704
|
const overflow = bufferedBehind - bufferBehind;
|
|
1702
|
-
// See: https://github.com/
|
|
1705
|
+
// See: https://github.com/shaka-project/shaka-player/issues/2982
|
|
1703
1706
|
if (overflow <= 0.01) {
|
|
1704
1707
|
shaka.log.v2(logPrefix,
|
|
1705
1708
|
'buffer behind okay:',
|
|
@@ -2038,7 +2041,7 @@ shaka.media.StreamingEngine.MediaState_;
|
|
|
2038
2041
|
* of the Period.
|
|
2039
2042
|
*
|
|
2040
2043
|
* NOTE: This was increased as part of the solution to
|
|
2041
|
-
* https://github.com/
|
|
2044
|
+
* https://github.com/shaka-project/shaka-player/issues/1281
|
|
2042
2045
|
*
|
|
2043
2046
|
* @const {number}
|
|
2044
2047
|
* @private
|
|
@@ -2052,7 +2055,7 @@ shaka.media.StreamingEngine.APPEND_WINDOW_START_FUDGE_ = 0.1;
|
|
|
2052
2055
|
* the Period. This rounding error could then create an artificial gap and a
|
|
2053
2056
|
* stutter when the gap-jumping logic takes over.
|
|
2054
2057
|
*
|
|
2055
|
-
* https://github.com/
|
|
2058
|
+
* https://github.com/shaka-project/shaka-player/issues/1597
|
|
2056
2059
|
*
|
|
2057
2060
|
* @const {number}
|
|
2058
2061
|
* @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 :
|
|
@@ -222,6 +222,10 @@ shaka.net.NetworkingEngine = class extends shaka.util.FakeEventTarget {
|
|
|
222
222
|
this.destroyed_ = true;
|
|
223
223
|
this.requestFilters_.clear();
|
|
224
224
|
this.responseFilters_.clear();
|
|
225
|
+
|
|
226
|
+
// FakeEventTarget implements IReleasable
|
|
227
|
+
super.release();
|
|
228
|
+
|
|
225
229
|
return this.operationManager_.destroy();
|
|
226
230
|
}
|
|
227
231
|
|
|
@@ -417,7 +421,7 @@ shaka.net.NetworkingEngine = class extends shaka.util.FakeEventTarget {
|
|
|
417
421
|
}
|
|
418
422
|
|
|
419
423
|
// Schemes are meant to be case-insensitive.
|
|
420
|
-
// See https://github.com/
|
|
424
|
+
// See https://github.com/shaka-project/shaka-player/issues/2173
|
|
421
425
|
// and https://tools.ietf.org/html/rfc3986#section-3.1
|
|
422
426
|
scheme = scheme.toLowerCase();
|
|
423
427
|
|
package/lib/offline/storage.js
CHANGED
|
@@ -477,16 +477,15 @@ shaka.offline.Storage = class {
|
|
|
477
477
|
* @private
|
|
478
478
|
*/
|
|
479
479
|
async filterManifest_(manifest, drmEngine, config) {
|
|
480
|
-
const StreamUtils = shaka.util.StreamUtils;
|
|
481
|
-
|
|
482
480
|
// Filter the manifest based on the restrictions given in the player
|
|
483
481
|
// configuration.
|
|
484
482
|
const maxHwRes = {width: Infinity, height: Infinity};
|
|
485
|
-
StreamUtils.filterByRestrictions(
|
|
483
|
+
shaka.util.StreamUtils.filterByRestrictions(
|
|
484
|
+
manifest, config.restrictions, maxHwRes);
|
|
486
485
|
|
|
487
486
|
// Filter the manifest based on what we know MediaCapabilities will be able
|
|
488
487
|
// to play later (no point storing something we can't play).
|
|
489
|
-
StreamUtils.filterManifestByMediaCapabilities(
|
|
488
|
+
await shaka.util.StreamUtils.filterManifestByMediaCapabilities(
|
|
490
489
|
manifest, config.offline.usePersistentLicense);
|
|
491
490
|
|
|
492
491
|
// Gather all tracks.
|
|
@@ -498,24 +497,24 @@ shaka.offline.Storage = class {
|
|
|
498
497
|
const preferredVideoCodecs = config.preferredVideoCodecs;
|
|
499
498
|
const preferredAudioCodecs = config.preferredAudioCodecs;
|
|
500
499
|
|
|
501
|
-
StreamUtils.chooseCodecsAndFilterManifest(
|
|
500
|
+
shaka.util.StreamUtils.chooseCodecsAndFilterManifest(
|
|
502
501
|
manifest, preferredVideoCodecs, preferredAudioCodecs,
|
|
503
502
|
preferredAudioChannelCount, preferredDecodingAttributes);
|
|
504
503
|
|
|
505
504
|
for (const variant of manifest.variants) {
|
|
506
505
|
goog.asserts.assert(
|
|
507
|
-
StreamUtils.isPlayable(variant),
|
|
506
|
+
shaka.util.StreamUtils.isPlayable(variant),
|
|
508
507
|
'We should have already filtered by "is playable"');
|
|
509
508
|
|
|
510
|
-
allTracks.push(StreamUtils.variantToTrack(variant));
|
|
509
|
+
allTracks.push(shaka.util.StreamUtils.variantToTrack(variant));
|
|
511
510
|
}
|
|
512
511
|
|
|
513
512
|
for (const text of manifest.textStreams) {
|
|
514
|
-
allTracks.push(StreamUtils.textStreamToTrack(text));
|
|
513
|
+
allTracks.push(shaka.util.StreamUtils.textStreamToTrack(text));
|
|
515
514
|
}
|
|
516
515
|
|
|
517
516
|
for (const image of manifest.imageStreams) {
|
|
518
|
-
allTracks.push(StreamUtils.imageStreamToTrack(image));
|
|
517
|
+
allTracks.push(shaka.util.StreamUtils.imageStreamToTrack(image));
|
|
519
518
|
}
|
|
520
519
|
|
|
521
520
|
// Let the application choose which tracks to store.
|
|
@@ -599,10 +598,10 @@ shaka.offline.Storage = class {
|
|
|
599
598
|
storage, drmEngine, manifest, uri, metadata, config, downloader) {
|
|
600
599
|
const pendingContent = shaka.offline.StoredContentUtils.fromManifest(
|
|
601
600
|
uri, manifest, /* size= */ 0, metadata);
|
|
602
|
-
// In https://github.com/
|
|
603
|
-
// callback would be removed by the compiler if we reference the
|
|
604
|
-
// the onProgress closure below. Reading it into a local
|
|
605
|
-
// seems to work around this apparent compiler bug.
|
|
601
|
+
// In https://github.com/shaka-project/shaka-player/issues/2652, we found
|
|
602
|
+
// that this callback would be removed by the compiler if we reference the
|
|
603
|
+
// config in the onProgress closure below. Reading it into a local
|
|
604
|
+
// variable first seems to work around this apparent compiler bug.
|
|
606
605
|
const progressCallback = config.offline.progressCallback;
|
|
607
606
|
|
|
608
607
|
const onProgress = (progress, size) => {
|