shaka-player 3.1.5 → 3.2.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/CHANGELOG.md +129 -6
- package/README.md +4 -4
- package/build/types/polyfill +1 -0
- package/demo/common/asset.js +9 -7
- package/demo/common/assets.js +10 -1
- package/demo/common/message_ids.js +2 -1
- package/demo/config.js +5 -2
- package/demo/index.html +1 -1
- package/demo/locales/en.json +2 -1
- package/demo/locales/source.json +8 -4
- package/demo/main.js +2 -1
- package/dist/demo.compiled.debug.js +14 -14
- package/dist/demo.compiled.debug.map +2 -2
- package/dist/demo.compiled.js +14 -14
- package/dist/demo.compiled.map +2 -2
- package/dist/deps.js +21 -20
- package/dist/locales.js +30 -30
- package/dist/receiver.compiled.debug.js +8 -8
- package/dist/receiver.compiled.debug.map +2 -2
- package/dist/receiver.compiled.js +8 -8
- package/dist/receiver.compiled.map +2 -2
- package/dist/shaka-player.compiled.d.ts +63 -10
- package/dist/shaka-player.compiled.debug.d.ts +63 -10
- package/dist/shaka-player.compiled.debug.externs.js +786 -716
- package/dist/shaka-player.compiled.debug.js +563 -534
- package/dist/shaka-player.compiled.debug.map +4 -4
- package/dist/shaka-player.compiled.externs.js +786 -716
- package/dist/shaka-player.compiled.js +820 -809
- package/dist/shaka-player.compiled.map +4 -4
- package/dist/shaka-player.ui.d.ts +63 -10
- package/dist/shaka-player.ui.debug.d.ts +63 -10
- package/dist/shaka-player.ui.debug.externs.js +542 -472
- package/dist/shaka-player.ui.debug.js +594 -566
- package/dist/shaka-player.ui.debug.map +4 -4
- package/dist/shaka-player.ui.externs.js +542 -472
- package/dist/shaka-player.ui.js +938 -927
- package/dist/shaka-player.ui.map +4 -4
- package/docs/tutorials/ui.md +5 -5
- package/externs/aria.js +6 -0
- package/externs/shaka/ads.js +24 -1
- package/externs/shaka/manifest.js +6 -1
- package/externs/shaka/offline.js +5 -0
- package/externs/shaka/player.js +61 -9
- package/externs/shaka/text.js +10 -10
- package/externs/texttrack.js +3 -0
- package/lib/ads/ad_manager.js +16 -15
- package/lib/ads/client_side_ad_manager.js +6 -2
- package/lib/ads/server_side_ad_manager.js +19 -2
- package/lib/cast/cast_proxy.js +8 -0
- package/lib/cast/cast_utils.js +6 -1
- package/lib/cea/cea608_data_channel.js +56 -56
- package/lib/cea/cea608_memory.js +33 -33
- package/lib/cea/cea708_service.js +43 -43
- package/lib/cea/cea708_window.js +38 -38
- package/lib/cea/cea_decoder.js +13 -14
- package/lib/cea/cea_utils.js +23 -23
- package/lib/cea/dtvcc_packet_builder.js +7 -7
- package/lib/cea/i_caption_decoder.js +2 -3
- package/lib/cea/i_cea_parser.js +2 -2
- package/lib/cea/mp4_cea_parser.js +6 -6
- package/lib/dash/dash_parser.js +5 -0
- package/lib/hls/hls_parser.js +159 -12
- package/lib/media/closed_caption_parser.js +1 -2
- package/lib/media/drm_engine.js +162 -192
- package/lib/media/segment_index.js +4 -1
- package/lib/media/segment_reference.js +37 -2
- package/lib/media/streaming_engine.js +6 -6
- package/lib/net/networking_engine.js +1 -0
- package/lib/offline/download_manager.js +1 -2
- package/lib/offline/indexeddb/v1_storage_cell.js +1 -0
- package/lib/offline/indexeddb/v2_storage_cell.js +1 -0
- package/lib/offline/manifest_converter.js +3 -1
- package/lib/offline/storage.js +12 -14
- package/lib/player.js +426 -149
- package/lib/polyfill/aria.js +82 -0
- package/lib/routing/walker.js +2 -3
- package/lib/text/srt_text_parser.js +4 -4
- package/lib/text/text_engine.js +2 -2
- package/lib/text/vtt_text_parser.js +2 -2
- package/lib/text/web_vtt_generator.js +55 -12
- package/lib/util/error.js +6 -0
- package/lib/util/manifest_parser_utils.js +1 -0
- package/lib/util/mp4_box_parsers.js +20 -20
- package/lib/util/multi_map.js +8 -0
- package/lib/util/player_configuration.js +13 -1
- package/lib/util/stream_utils.js +168 -88
- package/lib/util/xml_utils.js +31 -12
- package/package.json +1 -1
- package/roadmap.md +24 -22
- package/shaka-player.uncompiled.js +1 -0
- package/test/cast/cast_utils_unit.js +1 -0
- package/test/cea/cea608_memory_unit.js +1 -1
- package/test/cea/cea708_service_unit.js +8 -8
- package/test/cea/cea708_window_unit.js +6 -6
- package/test/cea/cea_decoder_unit.js +1 -1
- package/test/cea/dtvcc_packet_builder_unit.js +2 -2
- package/test/dash/dash_parser_manifest_unit.js +43 -1
- package/test/hls/hls_parser_unit.js +250 -0
- package/test/media/drm_engine_integration.js +86 -12
- package/test/media/drm_engine_unit.js +310 -450
- package/test/offline/manifest_convert_unit.js +2 -0
- package/test/offline/storage_integration.js +9 -19
- package/test/player_integration.js +85 -0
- package/test/player_src_equals_integration.js +85 -0
- package/test/player_unit.js +25 -37
- package/test/test/assets/chapters.srt +11 -0
- package/test/test/assets/chapters.vtt +10 -0
- package/test/test/assets/chapters2.vtt +10 -0
- package/test/test/util/cea_utils.js +12 -12
- package/test/test/util/fake_ad_manager.js +7 -0
- package/test/test/util/manifest_generator.js +2 -0
- package/test/test/util/manifest_parser_util.js +3 -1
- package/test/text/web_vtt_generator_unit.js +81 -7
- package/test/util/stream_utils_unit.js +118 -10
- package/ui/airplay_button.js +1 -1
- package/ui/audio_language_selection.js +2 -5
- package/ui/cast_button.js +4 -6
- package/ui/constants.js +0 -3
- package/ui/fast_forward_button.js +2 -3
- package/ui/fullscreen_button.js +1 -3
- package/ui/language_utils.js +1 -1
- package/ui/loop_button.js +1 -3
- package/ui/mute_button.js +1 -3
- package/ui/overflow_menu.js +2 -3
- package/ui/pip_button.js +5 -7
- package/ui/playback_rate_selection.js +3 -6
- package/ui/presentation_time.js +1 -3
- package/ui/resolution_selection.js +4 -7
- package/ui/rewind_button.js +2 -3
- package/ui/seek_bar.js +2 -4
- package/ui/spacer.js +1 -1
- package/ui/text_selection.js +8 -11
- package/ui/ui_utils.js +1 -1
- package/ui/volume_bar.js +1 -3
|
@@ -658,8 +658,7 @@ describe('StreamUtils', () => {
|
|
|
658
658
|
});
|
|
659
659
|
|
|
660
660
|
await shaka.util.StreamUtils.filterManifest(
|
|
661
|
-
fakeDrmEngine, /* currentVariant= */ null, manifest
|
|
662
|
-
/* useMediaCapabilities= */ true);
|
|
661
|
+
fakeDrmEngine, /* currentVariant= */ null, manifest);
|
|
663
662
|
|
|
664
663
|
// Covers a regression in which we would remove streams with codecs.
|
|
665
664
|
// The last two streams should be removed because their full MIME types
|
|
@@ -686,8 +685,7 @@ describe('StreamUtils', () => {
|
|
|
686
685
|
});
|
|
687
686
|
|
|
688
687
|
await shaka.util.StreamUtils.filterManifest(
|
|
689
|
-
fakeDrmEngine, /* currentVariant= */ null, manifest
|
|
690
|
-
/* useMediaCapabilities= */ true);
|
|
688
|
+
fakeDrmEngine, /* currentVariant= */ null, manifest);
|
|
691
689
|
expect(manifest.variants.length).toBe(1);
|
|
692
690
|
});
|
|
693
691
|
|
|
@@ -704,8 +702,7 @@ describe('StreamUtils', () => {
|
|
|
704
702
|
});
|
|
705
703
|
|
|
706
704
|
await shaka.util.StreamUtils.filterManifest(
|
|
707
|
-
fakeDrmEngine, /* currentVariant= */ null, manifest
|
|
708
|
-
/* useMediaCapabilities= */ true);
|
|
705
|
+
fakeDrmEngine, /* currentVariant= */ null, manifest);
|
|
709
706
|
|
|
710
707
|
expect(manifest.variants.length).toBe(1);
|
|
711
708
|
});
|
|
@@ -720,6 +717,7 @@ describe('StreamUtils', () => {
|
|
|
720
717
|
variant.bandwidth = 5058558;
|
|
721
718
|
variant.addAudio(1, (stream) => {
|
|
722
719
|
stream.bandwidth = 129998;
|
|
720
|
+
stream.codecs = 'opus';
|
|
723
721
|
});
|
|
724
722
|
variant.addVideo(2, (stream) => {
|
|
725
723
|
stream.bandwidth = 4928560;
|
|
@@ -734,6 +732,7 @@ describe('StreamUtils', () => {
|
|
|
734
732
|
variant.bandwidth = 4911000;
|
|
735
733
|
variant.addAudio(4, (stream) => {
|
|
736
734
|
stream.bandwidth = 129998;
|
|
735
|
+
stream.codecs = 'vorbis';
|
|
737
736
|
});
|
|
738
737
|
variant.addVideo(5, (stream) => {
|
|
739
738
|
stream.bandwidth = 4781002;
|
|
@@ -748,6 +747,7 @@ describe('StreamUtils', () => {
|
|
|
748
747
|
variant.bandwidth = 10850316;
|
|
749
748
|
variant.addAudio(7, (stream) => {
|
|
750
749
|
stream.bandwidth = 129998;
|
|
750
|
+
stream.codecs = 'opus';
|
|
751
751
|
});
|
|
752
752
|
variant.addVideo(8, (stream) => {
|
|
753
753
|
stream.bandwidth = 10784324;
|
|
@@ -757,6 +757,62 @@ describe('StreamUtils', () => {
|
|
|
757
757
|
});
|
|
758
758
|
};
|
|
759
759
|
|
|
760
|
+
it('chooses preferred audio and video codecs', () => {
|
|
761
|
+
manifest = shaka.test.ManifestGenerator.generate((manifest) => {
|
|
762
|
+
addVariant1080Avc1(manifest);
|
|
763
|
+
addVariant1080Vp9(manifest);
|
|
764
|
+
addVariant2160Vp9(manifest);
|
|
765
|
+
});
|
|
766
|
+
const variants =
|
|
767
|
+
shaka.util.StreamUtils.choosePreferredCodecs(manifest.variants,
|
|
768
|
+
/* preferredVideoCodecs= */['vp09'],
|
|
769
|
+
/* preferredAudioCodecs= */['opus']);
|
|
770
|
+
|
|
771
|
+
expect(variants.length).toBe(1);
|
|
772
|
+
expect(variants[0].video.codecs).toBe(vp09Codecs);
|
|
773
|
+
expect(variants[0].audio.codecs).toBe('opus');
|
|
774
|
+
});
|
|
775
|
+
|
|
776
|
+
it('chooses preferred video codecs', () => {
|
|
777
|
+
// If no preferred audio codecs is specified or can be found, choose the
|
|
778
|
+
// variants with preferred video codecs.
|
|
779
|
+
manifest = shaka.test.ManifestGenerator.generate((manifest) => {
|
|
780
|
+
addVariant1080Avc1(manifest);
|
|
781
|
+
addVariant1080Vp9(manifest);
|
|
782
|
+
addVariant2160Vp9(manifest);
|
|
783
|
+
});
|
|
784
|
+
const variants =
|
|
785
|
+
shaka.util.StreamUtils.choosePreferredCodecs(manifest.variants,
|
|
786
|
+
/* preferredVideoCodecs= */['vp09'],
|
|
787
|
+
/* preferredAudioCodecs= */[]);
|
|
788
|
+
|
|
789
|
+
expect(variants.length).toBe(2);
|
|
790
|
+
expect(variants[0].video.codecs).toBe(vp09Codecs);
|
|
791
|
+
expect(variants[0].audio.codecs).toBe('vorbis');
|
|
792
|
+
expect(variants[1].video.codecs).toBe(vp09Codecs);
|
|
793
|
+
expect(variants[1].audio.codecs).toBe('opus');
|
|
794
|
+
});
|
|
795
|
+
|
|
796
|
+
it('chooses preferred audio codecs', () => {
|
|
797
|
+
// If no preferred video codecs is specified or can be found, choose the
|
|
798
|
+
// variants with preferred audio codecs.
|
|
799
|
+
manifest = shaka.test.ManifestGenerator.generate((manifest) => {
|
|
800
|
+
addVariant1080Avc1(manifest);
|
|
801
|
+
addVariant1080Vp9(manifest);
|
|
802
|
+
addVariant2160Vp9(manifest);
|
|
803
|
+
});
|
|
804
|
+
const variants =
|
|
805
|
+
shaka.util.StreamUtils.choosePreferredCodecs(manifest.variants,
|
|
806
|
+
/* preferredVideoCodecs= */['foo'],
|
|
807
|
+
/* preferredAudioCodecs= */['opus']);
|
|
808
|
+
|
|
809
|
+
expect(variants.length).toBe(2);
|
|
810
|
+
expect(variants[0].video.codecs).toBe(avc1Codecs);
|
|
811
|
+
expect(variants[0].audio.codecs).toBe('opus');
|
|
812
|
+
expect(variants[1].video.codecs).toBe(vp09Codecs);
|
|
813
|
+
expect(variants[1].audio.codecs).toBe('opus');
|
|
814
|
+
});
|
|
815
|
+
|
|
760
816
|
it('chooses variants with different sizes (density) by codecs', () => {
|
|
761
817
|
manifest = shaka.test.ManifestGenerator.generate((manifest) => {
|
|
762
818
|
addVariant1080Avc1(manifest);
|
|
@@ -764,11 +820,14 @@ describe('StreamUtils', () => {
|
|
|
764
820
|
addVariant2160Vp9(manifest);
|
|
765
821
|
});
|
|
766
822
|
|
|
767
|
-
shaka.util.StreamUtils.chooseCodecsAndFilterManifest(manifest,
|
|
823
|
+
shaka.util.StreamUtils.chooseCodecsAndFilterManifest(manifest,
|
|
824
|
+
/* preferredVideoCodecs= */[],
|
|
825
|
+
/* preferredAudioCodecs= */[],
|
|
826
|
+
/* preferredAudioChannelCount= */2,
|
|
827
|
+
/* preferredDecodingAttributes= */[]);
|
|
768
828
|
|
|
769
|
-
expect(manifest.variants.length).toBe(
|
|
829
|
+
expect(manifest.variants.length).toBe(1);
|
|
770
830
|
expect(manifest.variants[0].video.codecs).toBe(vp09Codecs);
|
|
771
|
-
expect(manifest.variants[1].video.codecs).toBe(vp09Codecs);
|
|
772
831
|
});
|
|
773
832
|
|
|
774
833
|
it('chooses variants with same sizes (density) by codecs', () => {
|
|
@@ -777,10 +836,59 @@ describe('StreamUtils', () => {
|
|
|
777
836
|
addVariant1080Vp9(manifest);
|
|
778
837
|
});
|
|
779
838
|
|
|
780
|
-
shaka.util.StreamUtils.chooseCodecsAndFilterManifest(manifest,
|
|
839
|
+
shaka.util.StreamUtils.chooseCodecsAndFilterManifest(manifest,
|
|
840
|
+
/* preferredVideoCodecs= */[],
|
|
841
|
+
/* preferredAudioCodecs= */[],
|
|
842
|
+
/* preferredAudioChannelCount= */2,
|
|
843
|
+
/* preferredDecodingAttributes= */[]);
|
|
781
844
|
|
|
782
845
|
expect(manifest.variants.length).toBe(1);
|
|
783
846
|
expect(manifest.variants[0].video.codecs).toBe(vp09Codecs);
|
|
784
847
|
});
|
|
848
|
+
|
|
849
|
+
it('chooses variants by decoding attributes', async () => {
|
|
850
|
+
manifest = shaka.test.ManifestGenerator.generate((manifest) => {
|
|
851
|
+
manifest.addVariant(0, (variant) => {
|
|
852
|
+
variant.bandwidth = 4058558;
|
|
853
|
+
variant.addVideo(1, (stream) => {
|
|
854
|
+
stream.mime('video', 'notsmooth');
|
|
855
|
+
});
|
|
856
|
+
});
|
|
857
|
+
manifest.addVariant(1, (variant) => {
|
|
858
|
+
variant.bandwidth = 4781002;
|
|
859
|
+
variant.addVideo(2, (stream) => {
|
|
860
|
+
stream.mime('video', 'smooth');
|
|
861
|
+
});
|
|
862
|
+
});
|
|
863
|
+
manifest.addVariant(3, (variant) => {
|
|
864
|
+
variant.addVideo(4, (stream) => {
|
|
865
|
+
variant.bandwidth = 5058558;
|
|
866
|
+
stream.mime('video', 'smooth-2');
|
|
867
|
+
});
|
|
868
|
+
});
|
|
869
|
+
});
|
|
870
|
+
navigator.mediaCapabilities.decodingInfo =
|
|
871
|
+
shaka.test.Util.spyFunc(decodingInfoSpy);
|
|
872
|
+
decodingInfoSpy.and.callFake((config) => {
|
|
873
|
+
const res = config.video.contentType.includes('notsmooth') ?
|
|
874
|
+
{supported: true, smooth: false} :
|
|
875
|
+
{supported: true, smooth: true};
|
|
876
|
+
return Promise.resolve(res);
|
|
877
|
+
});
|
|
878
|
+
|
|
879
|
+
await StreamUtils.getDecodingInfosForVariants(manifest.variants,
|
|
880
|
+
/* usePersistentLicenses= */false, /* srcEquals= */ false);
|
|
881
|
+
|
|
882
|
+
shaka.util.StreamUtils.chooseCodecsAndFilterManifest(manifest,
|
|
883
|
+
/* preferredVideoCodecs= */[],
|
|
884
|
+
/* preferredAudioCodecs= */[],
|
|
885
|
+
/* preferredAudioChannelCount= */2,
|
|
886
|
+
/* preferredDecodingAttributes= */
|
|
887
|
+
[shaka.util.StreamUtils.DecodingAttributes.SMOOTH]);
|
|
888
|
+
// 2 video codecs are smooth. Choose the one with the lowest bandwidth.
|
|
889
|
+
expect(manifest.variants.length).toBe(1);
|
|
890
|
+
expect(manifest.variants[0].id).toBe(1);
|
|
891
|
+
expect(manifest.variants[0].video.id).toBe(2);
|
|
892
|
+
});
|
|
785
893
|
});
|
|
786
894
|
});
|
package/ui/airplay_button.js
CHANGED
|
@@ -36,7 +36,7 @@ shaka.ui.AirPlayButton = class extends shaka.ui.Element {
|
|
|
36
36
|
/** @private {!HTMLButtonElement} */
|
|
37
37
|
this.airplayButton_ = shaka.util.Dom.createButton();
|
|
38
38
|
this.airplayButton_.classList.add('shaka-airplay-button');
|
|
39
|
-
this.airplayButton_.
|
|
39
|
+
this.airplayButton_.ariaPressed = 'false';
|
|
40
40
|
|
|
41
41
|
/** @private {!HTMLElement} */
|
|
42
42
|
this.airplayIcon_ = shaka.util.Dom.createHTMLElement('i');
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
|
|
8
8
|
goog.provide('shaka.ui.AudioLanguageSelection');
|
|
9
9
|
|
|
10
|
-
goog.require('shaka.ui.Constants');
|
|
11
10
|
goog.require('shaka.ui.Enums');
|
|
12
11
|
goog.require('shaka.ui.LanguageUtils');
|
|
13
12
|
goog.require('shaka.ui.Locales');
|
|
@@ -96,10 +95,8 @@ shaka.ui.AudioLanguageSelection = class extends shaka.ui.SettingsMenu {
|
|
|
96
95
|
updateLocalizedStrings_() {
|
|
97
96
|
const LocIds = shaka.ui.Locales.Ids;
|
|
98
97
|
|
|
99
|
-
this.backButton.
|
|
100
|
-
|
|
101
|
-
this.button.setAttribute(shaka.ui.Constants.ARIA_LABEL,
|
|
102
|
-
this.localization.resolve(LocIds.LANGUAGE));
|
|
98
|
+
this.backButton.ariaLabel = this.localization.resolve(LocIds.BACK);
|
|
99
|
+
this.button.ariaLabel = this.localization.resolve(LocIds.LANGUAGE);
|
|
103
100
|
this.nameSpan.textContent =
|
|
104
101
|
this.localization.resolve(LocIds.LANGUAGE);
|
|
105
102
|
this.backSpan.textContent =
|
package/ui/cast_button.js
CHANGED
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
goog.provide('shaka.ui.CastButton');
|
|
9
9
|
|
|
10
10
|
goog.require('shaka.cast.CastProxy');
|
|
11
|
-
goog.require('shaka.ui.Constants');
|
|
12
11
|
goog.require('shaka.ui.Controls');
|
|
13
12
|
goog.require('shaka.ui.Element');
|
|
14
13
|
goog.require('shaka.ui.Enums');
|
|
@@ -42,7 +41,7 @@ shaka.ui.CastButton = class extends shaka.ui.Element {
|
|
|
42
41
|
/** @private {!HTMLButtonElement} */
|
|
43
42
|
this.castButton_ = shaka.util.Dom.createButton();
|
|
44
43
|
this.castButton_.classList.add('shaka-cast-button');
|
|
45
|
-
this.castButton_.
|
|
44
|
+
this.castButton_.ariaPressed = 'false';
|
|
46
45
|
|
|
47
46
|
/** @private {!HTMLElement} */
|
|
48
47
|
this.castIcon_ = shaka.util.Dom.createHTMLElement('i');
|
|
@@ -125,9 +124,9 @@ shaka.ui.CastButton = class extends shaka.ui.Element {
|
|
|
125
124
|
// Aria-pressed set to true when casting, set to false otherwise.
|
|
126
125
|
if (canCast) {
|
|
127
126
|
if (isCasting) {
|
|
128
|
-
this.castButton_.
|
|
127
|
+
this.castButton_.ariaPressed = 'true';
|
|
129
128
|
} else {
|
|
130
|
-
this.castButton_.
|
|
129
|
+
this.castButton_.ariaPressed = 'false';
|
|
131
130
|
}
|
|
132
131
|
}
|
|
133
132
|
|
|
@@ -155,8 +154,7 @@ shaka.ui.CastButton = class extends shaka.ui.Element {
|
|
|
155
154
|
updateLocalizedStrings_() {
|
|
156
155
|
const LocIds = shaka.ui.Locales.Ids;
|
|
157
156
|
|
|
158
|
-
this.castButton_.
|
|
159
|
-
this.localization.resolve(LocIds.CAST));
|
|
157
|
+
this.castButton_.ariaLabel = this.localization.resolve(LocIds.CAST);
|
|
160
158
|
this.castNameSpan_.textContent =
|
|
161
159
|
this.localization.resolve(LocIds.CAST);
|
|
162
160
|
|
package/ui/constants.js
CHANGED
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
|
|
8
8
|
goog.provide('shaka.ui.FastForwardButton');
|
|
9
9
|
|
|
10
|
-
goog.require('shaka.ui.Constants');
|
|
11
10
|
goog.require('shaka.ui.Controls');
|
|
12
11
|
goog.require('shaka.ui.Element');
|
|
13
12
|
goog.require('shaka.ui.Enums');
|
|
@@ -57,8 +56,8 @@ shaka.ui.FastForwardButton = class extends shaka.ui.Element {
|
|
|
57
56
|
* @private
|
|
58
57
|
*/
|
|
59
58
|
updateAriaLabel_() {
|
|
60
|
-
this.button_.
|
|
61
|
-
this.localization.resolve(shaka.ui.Locales.Ids.FAST_FORWARD)
|
|
59
|
+
this.button_.ariaLabel =
|
|
60
|
+
this.localization.resolve(shaka.ui.Locales.Ids.FAST_FORWARD);
|
|
62
61
|
}
|
|
63
62
|
|
|
64
63
|
/**
|
package/ui/fullscreen_button.js
CHANGED
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
|
|
8
8
|
goog.provide('shaka.ui.FullscreenButton');
|
|
9
9
|
|
|
10
|
-
goog.require('shaka.ui.Constants');
|
|
11
10
|
goog.require('shaka.ui.Controls');
|
|
12
11
|
goog.require('shaka.ui.Element');
|
|
13
12
|
goog.require('shaka.ui.Enums');
|
|
@@ -71,8 +70,7 @@ shaka.ui.FullscreenButton = class extends shaka.ui.Element {
|
|
|
71
70
|
const label = document.fullscreenElement ?
|
|
72
71
|
LocIds.EXIT_FULL_SCREEN : LocIds.FULL_SCREEN;
|
|
73
72
|
|
|
74
|
-
this.button_.
|
|
75
|
-
this.localization.resolve(label));
|
|
73
|
+
this.button_.ariaLabel = this.localization.resolve(label);
|
|
76
74
|
}
|
|
77
75
|
|
|
78
76
|
/**
|
package/ui/language_utils.js
CHANGED
|
@@ -138,7 +138,7 @@ shaka.ui.LanguageUtils = class {
|
|
|
138
138
|
if (updateChosen && (combinationName == selectedCombination)) {
|
|
139
139
|
button.appendChild(shaka.ui.Utils.checkmarkIcon());
|
|
140
140
|
span.classList.add('shaka-chosen-item');
|
|
141
|
-
button.
|
|
141
|
+
button.ariaSelected = 'true';
|
|
142
142
|
currentSelectionElement.textContent = span.textContent;
|
|
143
143
|
}
|
|
144
144
|
langMenu.appendChild(button);
|
package/ui/loop_button.js
CHANGED
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
|
|
8
8
|
goog.provide('shaka.ui.LoopButton');
|
|
9
9
|
|
|
10
|
-
goog.require('shaka.ui.Constants');
|
|
11
10
|
goog.require('shaka.ui.Controls');
|
|
12
11
|
goog.require('shaka.ui.Element');
|
|
13
12
|
goog.require('shaka.ui.Enums');
|
|
@@ -151,8 +150,7 @@ shaka.ui.LoopButton = class extends shaka.ui.Element {
|
|
|
151
150
|
const ariaText = this.video.loop ?
|
|
152
151
|
LocIds.EXIT_LOOP_MODE : LocIds.ENTER_LOOP_MODE;
|
|
153
152
|
|
|
154
|
-
this.button_.
|
|
155
|
-
this.localization.resolve(ariaText));
|
|
153
|
+
this.button_.ariaLabel = this.localization.resolve(ariaText);
|
|
156
154
|
}
|
|
157
155
|
};
|
|
158
156
|
|
package/ui/mute_button.js
CHANGED
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
goog.provide('shaka.ui.MuteButton');
|
|
9
9
|
|
|
10
10
|
goog.require('shaka.ads.AdManager');
|
|
11
|
-
goog.require('shaka.ui.Constants');
|
|
12
11
|
goog.require('shaka.ui.Controls');
|
|
13
12
|
goog.require('shaka.ui.Element');
|
|
14
13
|
goog.require('shaka.ui.Enums');
|
|
@@ -97,8 +96,7 @@ shaka.ui.MuteButton = class extends shaka.ui.Element {
|
|
|
97
96
|
label = this.video.muted ? LocIds.UNMUTE : LocIds.MUTE;
|
|
98
97
|
}
|
|
99
98
|
|
|
100
|
-
this.button_.
|
|
101
|
-
this.localization.resolve(label));
|
|
99
|
+
this.button_.ariaLabel = this.localization.resolve(label);
|
|
102
100
|
}
|
|
103
101
|
|
|
104
102
|
/**
|
package/ui/overflow_menu.js
CHANGED
|
@@ -10,7 +10,6 @@ goog.provide('shaka.ui.OverflowMenu');
|
|
|
10
10
|
goog.require('goog.asserts');
|
|
11
11
|
goog.require('shaka.ads.AdManager');
|
|
12
12
|
goog.require('shaka.log');
|
|
13
|
-
goog.require('shaka.ui.Constants');
|
|
14
13
|
goog.require('shaka.ui.Controls');
|
|
15
14
|
goog.require('shaka.ui.Element');
|
|
16
15
|
goog.require('shaka.ui.Enums');
|
|
@@ -217,8 +216,8 @@ shaka.ui.OverflowMenu = class extends shaka.ui.Element {
|
|
|
217
216
|
*/
|
|
218
217
|
updateAriaLabel_() {
|
|
219
218
|
const LocIds = shaka.ui.Locales.Ids;
|
|
220
|
-
this.overflowMenuButton_.
|
|
221
|
-
this.localization.resolve(LocIds.MORE_SETTINGS)
|
|
219
|
+
this.overflowMenuButton_.ariaLabel =
|
|
220
|
+
this.localization.resolve(LocIds.MORE_SETTINGS);
|
|
222
221
|
}
|
|
223
222
|
};
|
|
224
223
|
|
package/ui/pip_button.js
CHANGED
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
|
|
8
8
|
goog.provide('shaka.ui.PipButton');
|
|
9
9
|
|
|
10
|
-
goog.require('shaka.ui.Constants');
|
|
11
10
|
goog.require('shaka.ui.Controls');
|
|
12
11
|
goog.require('shaka.ui.Element');
|
|
13
12
|
goog.require('shaka.ui.Enums');
|
|
@@ -141,8 +140,8 @@ shaka.ui.PipButton = class extends shaka.ui.Element {
|
|
|
141
140
|
onEnterPictureInPicture_() {
|
|
142
141
|
const LocIds = shaka.ui.Locales.Ids;
|
|
143
142
|
this.pipIcon_.textContent = shaka.ui.Enums.MaterialDesignIcons.EXIT_PIP;
|
|
144
|
-
this.pipButton_.
|
|
145
|
-
this.localization.resolve(LocIds.EXIT_PICTURE_IN_PICTURE)
|
|
143
|
+
this.pipButton_.ariaLabel =
|
|
144
|
+
this.localization.resolve(LocIds.EXIT_PICTURE_IN_PICTURE);
|
|
146
145
|
this.currentPipState_.textContent =
|
|
147
146
|
this.localization.resolve(LocIds.ON);
|
|
148
147
|
}
|
|
@@ -152,8 +151,8 @@ shaka.ui.PipButton = class extends shaka.ui.Element {
|
|
|
152
151
|
onLeavePictureInPicture_() {
|
|
153
152
|
const LocIds = shaka.ui.Locales.Ids;
|
|
154
153
|
this.pipIcon_.textContent = shaka.ui.Enums.MaterialDesignIcons.PIP;
|
|
155
|
-
this.pipButton_.
|
|
156
|
-
this.localization.resolve(LocIds.ENTER_PICTURE_IN_PICTURE)
|
|
154
|
+
this.pipButton_.ariaLabel =
|
|
155
|
+
this.localization.resolve(LocIds.ENTER_PICTURE_IN_PICTURE);
|
|
157
156
|
this.currentPipState_.textContent =
|
|
158
157
|
this.localization.resolve(LocIds.OFF);
|
|
159
158
|
}
|
|
@@ -171,8 +170,7 @@ shaka.ui.PipButton = class extends shaka.ui.Element {
|
|
|
171
170
|
const ariaLabel = document.pictureInPictureElement ?
|
|
172
171
|
LocIds.EXIT_PICTURE_IN_PICTURE :
|
|
173
172
|
LocIds.ENTER_PICTURE_IN_PICTURE;
|
|
174
|
-
this.pipButton_.
|
|
175
|
-
this.localization.resolve(ariaLabel));
|
|
173
|
+
this.pipButton_.ariaLabel = this.localization.resolve(ariaLabel);
|
|
176
174
|
|
|
177
175
|
const currentPipState = document.pictureInPictureElement ?
|
|
178
176
|
LocIds.ON : LocIds.OFF;
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
|
|
8
8
|
goog.provide('shaka.ui.PlaybackRateSelection');
|
|
9
9
|
|
|
10
|
-
goog.require('shaka.ui.Constants');
|
|
11
10
|
goog.require('shaka.ui.Enums');
|
|
12
11
|
goog.require('shaka.ui.Locales');
|
|
13
12
|
goog.require('shaka.ui.Localization');
|
|
@@ -70,10 +69,8 @@ shaka.ui.PlaybackRateSelection = class extends shaka.ui.SettingsMenu {
|
|
|
70
69
|
updateLocalizedStrings_() {
|
|
71
70
|
const LocIds = shaka.ui.Locales.Ids;
|
|
72
71
|
|
|
73
|
-
this.backButton.
|
|
74
|
-
|
|
75
|
-
this.button.setAttribute(shaka.ui.Constants.ARIA_LABEL,
|
|
76
|
-
this.localization.resolve(LocIds.PLAYBACK_RATE));
|
|
72
|
+
this.backButton.ariaLabel = this.localization.resolve(LocIds.BACK);
|
|
73
|
+
this.button.ariaLabel = this.localization.resolve(LocIds.PLAYBACK_RATE);
|
|
77
74
|
this.nameSpan.textContent = this.localization.resolve(LocIds.PLAYBACK_RATE);
|
|
78
75
|
this.backSpan.textContent = this.localization.resolve(LocIds.PLAYBACK_RATE);
|
|
79
76
|
}
|
|
@@ -105,7 +102,7 @@ shaka.ui.PlaybackRateSelection = class extends shaka.ui.SettingsMenu {
|
|
|
105
102
|
if (span) {
|
|
106
103
|
const button = span.parentElement;
|
|
107
104
|
button.appendChild(shaka.ui.Utils.checkmarkIcon());
|
|
108
|
-
button.
|
|
105
|
+
button.ariaSelected = 'true';
|
|
109
106
|
span.classList.add('shaka-chosen-item');
|
|
110
107
|
}
|
|
111
108
|
|
package/ui/presentation_time.js
CHANGED
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
|
|
8
8
|
goog.provide('shaka.ui.PresentationTimeTracker');
|
|
9
9
|
|
|
10
|
-
goog.require('shaka.ui.Constants');
|
|
11
10
|
goog.require('shaka.ui.Controls');
|
|
12
11
|
goog.require('shaka.ui.Element');
|
|
13
12
|
goog.require('shaka.ui.Locales');
|
|
@@ -108,8 +107,7 @@ shaka.ui.PresentationTimeTracker = class extends shaka.ui.Element {
|
|
|
108
107
|
onTracksChanged_() {
|
|
109
108
|
if (this.player.isLive()) {
|
|
110
109
|
const ariaLabel = shaka.ui.Locales.Ids.SKIP_TO_LIVE;
|
|
111
|
-
this.currentTime_.
|
|
112
|
-
this.localization.resolve(ariaLabel));
|
|
110
|
+
this.currentTime_.ariaLabel = this.localization.resolve(ariaLabel);
|
|
113
111
|
}
|
|
114
112
|
}
|
|
115
113
|
};
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
goog.provide('shaka.ui.ResolutionSelection');
|
|
9
9
|
|
|
10
10
|
goog.require('goog.asserts');
|
|
11
|
-
goog.require('shaka.ui.Constants');
|
|
12
11
|
goog.require('shaka.ui.Enums');
|
|
13
12
|
goog.require('shaka.ui.Locales');
|
|
14
13
|
goog.require('shaka.ui.Localization');
|
|
@@ -137,7 +136,7 @@ shaka.ui.ResolutionSelection = class extends shaka.ui.SettingsMenu {
|
|
|
137
136
|
|
|
138
137
|
if (!abrEnabled && track == selectedTrack) {
|
|
139
138
|
// If abr is disabled, mark the selected track's resolution.
|
|
140
|
-
button.
|
|
139
|
+
button.ariaSelected = 'true';
|
|
141
140
|
button.appendChild(shaka.ui.Utils.checkmarkIcon());
|
|
142
141
|
span.classList.add('shaka-chosen-item');
|
|
143
142
|
this.currentSelection.textContent = span.textContent;
|
|
@@ -163,7 +162,7 @@ shaka.ui.ResolutionSelection = class extends shaka.ui.SettingsMenu {
|
|
|
163
162
|
|
|
164
163
|
// If abr is enabled reflect it by marking 'Auto' as selected.
|
|
165
164
|
if (abrEnabled) {
|
|
166
|
-
autoButton.
|
|
165
|
+
autoButton.ariaSelected = 'true';
|
|
167
166
|
autoButton.appendChild(shaka.ui.Utils.checkmarkIcon());
|
|
168
167
|
|
|
169
168
|
this.abrOnSpan_.classList.add('shaka-chosen-item');
|
|
@@ -198,10 +197,8 @@ shaka.ui.ResolutionSelection = class extends shaka.ui.SettingsMenu {
|
|
|
198
197
|
updateLocalizedStrings_() {
|
|
199
198
|
const LocIds = shaka.ui.Locales.Ids;
|
|
200
199
|
|
|
201
|
-
this.button.
|
|
202
|
-
|
|
203
|
-
this.backButton.setAttribute(shaka.ui.Constants.ARIA_LABEL,
|
|
204
|
-
this.localization.resolve(LocIds.RESOLUTION));
|
|
200
|
+
this.button.ariaLabel = this.localization.resolve(LocIds.RESOLUTION);
|
|
201
|
+
this.backButton.ariaLabel = this.localization.resolve(LocIds.RESOLUTION);
|
|
205
202
|
this.backSpan.textContent =
|
|
206
203
|
this.localization.resolve(LocIds.RESOLUTION);
|
|
207
204
|
this.nameSpan.textContent =
|
package/ui/rewind_button.js
CHANGED
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
|
|
8
8
|
goog.provide('shaka.ui.RewindButton');
|
|
9
9
|
|
|
10
|
-
goog.require('shaka.ui.Constants');
|
|
11
10
|
goog.require('shaka.ui.Controls');
|
|
12
11
|
goog.require('shaka.ui.Element');
|
|
13
12
|
goog.require('shaka.ui.Enums');
|
|
@@ -57,8 +56,8 @@ shaka.ui.RewindButton = class extends shaka.ui.Element {
|
|
|
57
56
|
* @private
|
|
58
57
|
*/
|
|
59
58
|
updateAriaLabel_() {
|
|
60
|
-
this.button_.
|
|
61
|
-
this.localization.resolve(shaka.ui.Locales.Ids.REWIND)
|
|
59
|
+
this.button_.ariaLabel =
|
|
60
|
+
this.localization.resolve(shaka.ui.Locales.Ids.REWIND);
|
|
62
61
|
}
|
|
63
62
|
|
|
64
63
|
/**
|
package/ui/seek_bar.js
CHANGED
|
@@ -15,7 +15,6 @@ goog.require('shaka.ui.RangeElement');
|
|
|
15
15
|
goog.require('shaka.ui.Utils');
|
|
16
16
|
goog.require('shaka.util.Dom');
|
|
17
17
|
goog.require('shaka.util.Timer');
|
|
18
|
-
goog.requireType('shaka.ads.CuePoint');
|
|
19
18
|
goog.requireType('shaka.ui.Controls');
|
|
20
19
|
|
|
21
20
|
|
|
@@ -83,7 +82,7 @@ shaka.ui.SeekBar = class extends shaka.ui.RangeElement {
|
|
|
83
82
|
*/
|
|
84
83
|
this.wasPlaying_ = false;
|
|
85
84
|
|
|
86
|
-
/** @private {!Array.<!shaka.
|
|
85
|
+
/** @private {!Array.<!shaka.extern.AdCuePoint>} */
|
|
87
86
|
this.adCuePoints_ = [];
|
|
88
87
|
|
|
89
88
|
this.eventManager.listen(this.localization,
|
|
@@ -372,8 +371,7 @@ shaka.ui.SeekBar = class extends shaka.ui.RangeElement {
|
|
|
372
371
|
|
|
373
372
|
/** @private */
|
|
374
373
|
updateAriaLabel_() {
|
|
375
|
-
this.bar.
|
|
376
|
-
this.localization.resolve(shaka.ui.Locales.Ids.SEEK));
|
|
374
|
+
this.bar.ariaLabel = this.localization.resolve(shaka.ui.Locales.Ids.SEEK);
|
|
377
375
|
}
|
|
378
376
|
};
|
|
379
377
|
|
package/ui/spacer.js
CHANGED
|
@@ -29,7 +29,7 @@ shaka.ui.Spacer = class extends shaka.ui.Element {
|
|
|
29
29
|
const div = shaka.util.Dom.createHTMLElement('div');
|
|
30
30
|
div.classList.add('shaka-spacer');
|
|
31
31
|
// Make screen readers ignore the spacer
|
|
32
|
-
div.
|
|
32
|
+
div.ariaHidden = 'true';
|
|
33
33
|
this.parent.appendChild(div);
|
|
34
34
|
}
|
|
35
35
|
};
|
package/ui/text_selection.js
CHANGED
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
|
|
8
8
|
goog.provide('shaka.ui.TextSelection');
|
|
9
9
|
|
|
10
|
-
goog.require('shaka.ui.Constants');
|
|
11
10
|
goog.require('shaka.ui.Enums');
|
|
12
11
|
goog.require('shaka.ui.LanguageUtils');
|
|
13
12
|
goog.require('shaka.ui.Locales');
|
|
@@ -38,9 +37,9 @@ shaka.ui.TextSelection = class extends shaka.ui.SettingsMenu {
|
|
|
38
37
|
this.menu.classList.add('shaka-text-languages');
|
|
39
38
|
|
|
40
39
|
if (this.player && this.player.isTextTrackVisible()) {
|
|
41
|
-
this.button.
|
|
40
|
+
this.button.ariaPressed = 'true';
|
|
42
41
|
} else {
|
|
43
|
-
this.button.
|
|
42
|
+
this.button.ariaPressed = 'false';
|
|
44
43
|
}
|
|
45
44
|
|
|
46
45
|
this.addOffOption_();
|
|
@@ -93,7 +92,7 @@ shaka.ui.TextSelection = class extends shaka.ui.SettingsMenu {
|
|
|
93
92
|
*/
|
|
94
93
|
addOffOption_() {
|
|
95
94
|
const off = shaka.util.Dom.createButton();
|
|
96
|
-
off.
|
|
95
|
+
off.ariaSelected = 'true';
|
|
97
96
|
this.menu.appendChild(off);
|
|
98
97
|
|
|
99
98
|
off.appendChild(shaka.ui.Utils.checkmarkIcon());
|
|
@@ -111,11 +110,11 @@ shaka.ui.TextSelection = class extends shaka.ui.SettingsMenu {
|
|
|
111
110
|
if (this.player.isTextTrackVisible()) {
|
|
112
111
|
this.icon.classList.add('shaka-captions-on');
|
|
113
112
|
this.icon.classList.remove('shaka-captions-off');
|
|
114
|
-
this.button.
|
|
113
|
+
this.button.ariaPressed = 'true';
|
|
115
114
|
} else {
|
|
116
115
|
this.icon.classList.add('shaka-captions-off');
|
|
117
116
|
this.icon.classList.remove('shaka-captions-on');
|
|
118
|
-
this.button.
|
|
117
|
+
this.button.ariaPressed = 'false';
|
|
119
118
|
}
|
|
120
119
|
|
|
121
120
|
this.controls.dispatchEvent(
|
|
@@ -149,7 +148,7 @@ shaka.ui.TextSelection = class extends shaka.ui.SettingsMenu {
|
|
|
149
148
|
this.menu.appendChild(offButton);
|
|
150
149
|
|
|
151
150
|
if (!this.player.isTextTrackVisible()) {
|
|
152
|
-
offButton.
|
|
151
|
+
offButton.ariaSelected = 'true';
|
|
153
152
|
offButton.appendChild(shaka.ui.Utils.checkmarkIcon());
|
|
154
153
|
this.captionsOffSpan_.classList.add('shaka-chosen-item');
|
|
155
154
|
this.currentSelection.textContent =
|
|
@@ -185,10 +184,8 @@ shaka.ui.TextSelection = class extends shaka.ui.SettingsMenu {
|
|
|
185
184
|
updateLocalizedStrings_() {
|
|
186
185
|
const LocIds = shaka.ui.Locales.Ids;
|
|
187
186
|
|
|
188
|
-
this.button.
|
|
189
|
-
|
|
190
|
-
this.backButton.setAttribute(shaka.ui.Constants.ARIA_LABEL,
|
|
191
|
-
this.localization.resolve(LocIds.BACK));
|
|
187
|
+
this.button.ariaLabel = this.localization.resolve(LocIds.CAPTIONS);
|
|
188
|
+
this.backButton.ariaLabel = this.localization.resolve(LocIds.BACK);
|
|
192
189
|
this.nameSpan.textContent =
|
|
193
190
|
this.localization.resolve(LocIds.CAPTIONS);
|
|
194
191
|
this.backSpan.textContent =
|
package/ui/ui_utils.js
CHANGED
|
@@ -70,7 +70,7 @@ shaka.ui.Utils = class {
|
|
|
70
70
|
icon.classList.add('shaka-chosen-item');
|
|
71
71
|
icon.textContent = shaka.ui.Enums.MaterialDesignIcons.CHECKMARK;
|
|
72
72
|
// Screen reader should ignore icon text.
|
|
73
|
-
icon.
|
|
73
|
+
icon.ariaHidden = 'true';
|
|
74
74
|
return icon;
|
|
75
75
|
}
|
|
76
76
|
|
package/ui/volume_bar.js
CHANGED
|
@@ -9,7 +9,6 @@ goog.provide('shaka.ui.VolumeBar');
|
|
|
9
9
|
|
|
10
10
|
goog.require('goog.asserts');
|
|
11
11
|
goog.require('shaka.ads.AdManager');
|
|
12
|
-
goog.require('shaka.ui.Constants');
|
|
13
12
|
goog.require('shaka.ui.Controls');
|
|
14
13
|
goog.require('shaka.ui.Locales');
|
|
15
14
|
goog.require('shaka.ui.Localization');
|
|
@@ -121,8 +120,7 @@ shaka.ui.VolumeBar = class extends shaka.ui.RangeElement {
|
|
|
121
120
|
|
|
122
121
|
/** @private */
|
|
123
122
|
updateAriaLabel_() {
|
|
124
|
-
this.bar.
|
|
125
|
-
this.localization.resolve(shaka.ui.Locales.Ids.VOLUME));
|
|
123
|
+
this.bar.ariaLabel = this.localization.resolve(shaka.ui.Locales.Ids.VOLUME);
|
|
126
124
|
}
|
|
127
125
|
};
|
|
128
126
|
|