shaka-player 3.1.3 → 3.2.2
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/AUTHORS +3 -0
- package/CHANGELOG.md +175 -3
- package/CONTRIBUTORS +3 -0
- package/README.md +4 -4
- package/build/generateExterns.js +1 -1
- package/build/types/polyfill +1 -0
- package/demo/common/asset.js +9 -7
- package/demo/common/assets.js +11 -2
- 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/controls.css +2 -2
- package/dist/controls.css.map +1 -1
- package/dist/demo.compiled.debug.js +15 -15
- package/dist/demo.compiled.debug.map +2 -2
- package/dist/demo.compiled.js +15 -15
- package/dist/demo.compiled.map +2 -2
- package/dist/deps.js +22 -21
- package/dist/locales.js +36 -36
- package/dist/receiver.compiled.debug.js +9 -9
- package/dist/receiver.compiled.debug.map +2 -2
- package/dist/receiver.compiled.js +9 -9
- package/dist/receiver.compiled.map +2 -2
- package/dist/shaka-player.compiled.d.ts +58 -10
- package/dist/shaka-player.compiled.debug.d.ts +58 -10
- package/dist/shaka-player.compiled.debug.externs.js +777 -717
- package/dist/shaka-player.compiled.debug.js +639 -607
- package/dist/shaka-player.compiled.debug.map +4 -4
- package/dist/shaka-player.compiled.externs.js +777 -717
- package/dist/shaka-player.compiled.js +826 -819
- package/dist/shaka-player.compiled.map +4 -4
- package/dist/shaka-player.ui.d.ts +58 -10
- package/dist/shaka-player.ui.debug.d.ts +58 -10
- package/dist/shaka-player.ui.debug.externs.js +529 -469
- package/dist/shaka-player.ui.debug.js +676 -645
- package/dist/shaka-player.ui.debug.map +4 -4
- package/dist/shaka-player.ui.externs.js +529 -469
- package/dist/shaka-player.ui.js +963 -955
- package/dist/shaka-player.ui.map +4 -4
- package/docs/tutorials/fairplay.md +1 -1
- 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 +53 -9
- package/externs/shaka/text.js +10 -10
- package/externs/texttrack.js +3 -0
- package/karma.conf.js +1 -0
- package/lib/ads/ad_manager.js +16 -15
- package/lib/ads/client_side_ad_manager.js +52 -88
- package/lib/ads/server_side_ad_manager.js +26 -12
- package/lib/cast/cast_proxy.js +11 -2
- package/lib/cast/cast_receiver.js +2 -1
- package/lib/cast/cast_sender.js +2 -2
- 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 +98 -2
- package/lib/dash/segment_list.js +1 -1
- package/lib/dash/segment_template.js +1 -1
- package/lib/hls/hls_parser.js +159 -29
- package/lib/media/closed_caption_parser.js +1 -2
- package/lib/media/drm_engine.js +169 -192
- package/lib/media/gap_jumping_controller.js +4 -2
- package/lib/media/media_source_engine.js +1 -2
- package/lib/media/segment_index.js +3 -1
- package/lib/media/segment_reference.js +19 -2
- package/lib/media/streaming_engine.js +8 -7
- package/lib/net/networking_engine.js +3 -1
- 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 +437 -167
- package/lib/polyfill/aria.js +82 -0
- package/lib/polyfill/media_capabilities.js +7 -1
- package/lib/polyfill/mediasource.js +6 -0
- package/lib/polyfill/orientation.js +1 -1
- package/lib/polyfill/patchedmediakeys_apple.js +4 -4
- package/lib/polyfill/patchedmediakeys_ms.js +4 -4
- package/lib/polyfill/patchedmediakeys_webkit.js +4 -4
- package/lib/routing/walker.js +2 -3
- package/lib/text/mp4_ttml_parser.js +3 -0
- package/lib/text/srt_text_parser.js +4 -4
- package/lib/text/text_engine.js +16 -4
- package/lib/text/ttml_text_parser.js +5 -0
- package/lib/text/ui_text_displayer.js +85 -37
- 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/fake_event.js +53 -7
- 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/periods.js +4 -1
- package/lib/util/platform.js +13 -1
- package/lib/util/player_configuration.js +13 -1
- package/lib/util/stream_utils.js +153 -85
- 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_proxy_unit.js +12 -6
- package/test/cast/cast_utils_unit.js +2 -1
- 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 +230 -2
- package/test/hls/hls_parser_unit.js +255 -1
- package/test/media/closed_caption_parser_unit.js +6 -1
- package/test/media/drm_engine_integration.js +86 -12
- package/test/media/drm_engine_unit.js +353 -450
- package/test/offline/manifest_convert_unit.js +2 -0
- package/test/offline/storage_integration.js +9 -19
- package/test/player_integration.js +90 -0
- package/test/player_src_equals_integration.js +52 -0
- package/test/player_unit.js +11 -33
- package/test/test/assets/3675/chunk-stream0-00001.m4s +0 -0
- package/test/test/assets/3675/chunk-stream0-00002.m4s +0 -0
- package/test/test/assets/3675/chunk-stream0-00003.m4s +0 -0
- package/test/test/assets/3675/chunk-stream0-00004.m4s +0 -0
- package/test/test/assets/3675/chunk-stream0-00005.m4s +0 -0
- package/test/test/assets/3675/chunk-stream0-00006.m4s +0 -0
- package/test/test/assets/3675/chunk-stream0-00007.m4s +0 -0
- package/test/test/assets/3675/dash_0.mpd +30 -0
- package/test/test/assets/3675/dash_1.mpd +30 -0
- package/test/test/assets/3675/dash_2.mpd +30 -0
- package/test/test/assets/3675/dash_3.mpd +30 -0
- package/test/test/assets/3675/dash_4.mpd +30 -0
- package/test/test/assets/3675/dash_5.mpd +26 -0
- package/test/test/assets/3675/init-stream0.m4s +0 -0
- package/test/test/assets/chapters.srt +11 -0
- package/test/test/assets/chapters.vtt +10 -0
- package/test/test/util/cea_utils.js +12 -12
- package/test/test/util/fake_ad_manager.js +8 -1
- package/test/test/util/manifest_generator.js +2 -0
- package/test/test/util/manifest_parser_util.js +3 -1
- package/test/text/ttml_text_parser_unit.js +9 -0
- package/test/text/ui_text_displayer_unit.js +29 -17
- package/test/text/web_vtt_generator_unit.js +81 -7
- package/test/ui/localization_unit.js +15 -14
- package/test/ui/text_displayer_layout_unit.js +13 -1
- package/test/util/stream_utils_unit.js +153 -10
- package/ui/airplay_button.js +1 -1
- package/ui/audio_language_selection.js +2 -5
- package/ui/cast_button.js +6 -9
- package/ui/constants.js +0 -3
- package/ui/controls.js +4 -6
- package/ui/fast_forward_button.js +2 -3
- package/ui/fullscreen_button.js +1 -3
- package/ui/language_utils.js +1 -1
- package/ui/less/containers.less +3 -7
- package/ui/locales/ru.json +6 -6
- package/ui/localization.js +28 -51
- 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 +7 -10
- 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
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');
|
|
@@ -102,9 +101,8 @@ shaka.ui.CastButton = class extends shaka.ui.Element {
|
|
|
102
101
|
} catch (error) {
|
|
103
102
|
this.castButton_.disabled = false;
|
|
104
103
|
if (error.code != shaka.util.Error.Code.CAST_CANCELED_BY_USER) {
|
|
105
|
-
this.controls.dispatchEvent(new shaka.util.FakeEvent(
|
|
106
|
-
|
|
107
|
-
}));
|
|
104
|
+
this.controls.dispatchEvent(new shaka.util.FakeEvent(
|
|
105
|
+
'error', (new Map()).set('detail', error)));
|
|
108
106
|
}
|
|
109
107
|
}
|
|
110
108
|
}
|
|
@@ -126,9 +124,9 @@ shaka.ui.CastButton = class extends shaka.ui.Element {
|
|
|
126
124
|
// Aria-pressed set to true when casting, set to false otherwise.
|
|
127
125
|
if (canCast) {
|
|
128
126
|
if (isCasting) {
|
|
129
|
-
this.castButton_.
|
|
127
|
+
this.castButton_.ariaPressed = 'true';
|
|
130
128
|
} else {
|
|
131
|
-
this.castButton_.
|
|
129
|
+
this.castButton_.ariaPressed = 'false';
|
|
132
130
|
}
|
|
133
131
|
}
|
|
134
132
|
|
|
@@ -156,8 +154,7 @@ shaka.ui.CastButton = class extends shaka.ui.Element {
|
|
|
156
154
|
updateLocalizedStrings_() {
|
|
157
155
|
const LocIds = shaka.ui.Locales.Ids;
|
|
158
156
|
|
|
159
|
-
this.castButton_.
|
|
160
|
-
this.localization.resolve(LocIds.CAST));
|
|
157
|
+
this.castButton_.ariaLabel = this.localization.resolve(LocIds.CAST);
|
|
161
158
|
this.castNameSpan_.textContent =
|
|
162
159
|
this.localization.resolve(LocIds.CAST);
|
|
163
160
|
|
package/ui/constants.js
CHANGED
package/ui/controls.js
CHANGED
|
@@ -573,9 +573,8 @@ shaka.ui.Controls = class extends shaka.util.FakeEventTarget {
|
|
|
573
573
|
}
|
|
574
574
|
}
|
|
575
575
|
} catch (error) {
|
|
576
|
-
this.dispatchEvent(new shaka.util.FakeEvent(
|
|
577
|
-
|
|
578
|
-
}));
|
|
576
|
+
this.dispatchEvent(new shaka.util.FakeEvent(
|
|
577
|
+
'error', (new Map()).set('detail', error)));
|
|
579
578
|
}
|
|
580
579
|
}
|
|
581
580
|
}
|
|
@@ -1162,9 +1161,8 @@ shaka.ui.Controls = class extends shaka.util.FakeEventTarget {
|
|
|
1162
1161
|
/** @private */
|
|
1163
1162
|
onCastStatusChange_() {
|
|
1164
1163
|
const isCasting = this.castProxy_.isCasting();
|
|
1165
|
-
this.dispatchEvent(new shaka.util.FakeEvent(
|
|
1166
|
-
|
|
1167
|
-
}));
|
|
1164
|
+
this.dispatchEvent(new shaka.util.FakeEvent(
|
|
1165
|
+
'caststatuschanged', (new Map()).set('newStatus', isCasting)));
|
|
1168
1166
|
|
|
1169
1167
|
if (isCasting) {
|
|
1170
1168
|
this.controlsContainer_.setAttribute('casting', 'true');
|
|
@@ -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/less/containers.less
CHANGED
|
@@ -229,13 +229,9 @@
|
|
|
229
229
|
transition-delay: 500ms;
|
|
230
230
|
|
|
231
231
|
/* These are defaults which are overridden by JS or cue styles. */
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
line-height: 1.4; // relative to font size.
|
|
236
|
-
background-color: rgba(0, 0, 0, 0.8);
|
|
237
|
-
color: rgb(255, 255, 255);
|
|
238
|
-
}
|
|
232
|
+
font-size: 20px;
|
|
233
|
+
line-height: 1.4; // relative to font size.
|
|
234
|
+
color: rgb(255, 255, 255);
|
|
239
235
|
|
|
240
236
|
span.shaka-text-wrapper {
|
|
241
237
|
display: inline;
|
package/ui/locales/ru.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
-
"AD_DURATION": "Продолжительность
|
|
3
|
-
"AD_PROGRESS": "
|
|
4
|
-
"AD_TIME": "
|
|
2
|
+
"AD_DURATION": "Продолжительность рекламы",
|
|
3
|
+
"AD_PROGRESS": "Реклама [AD_ON] из [NUM_ADS]",
|
|
4
|
+
"AD_TIME": "Реклама: [AD_TIME]",
|
|
5
5
|
"AUTO_QUALITY": "Авто",
|
|
6
6
|
"BACK": "Назад",
|
|
7
|
-
"CAPTIONS": "
|
|
7
|
+
"CAPTIONS": "Субтитры",
|
|
8
8
|
"CAST": "Транслировать...",
|
|
9
9
|
"ENTER_LOOP_MODE": "Зациклить текущее видео",
|
|
10
10
|
"ENTER_PICTURE_IN_PICTURE": "Перейти в режим \"Картинка в картинке\"",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"MULTIPLE_LANGUAGES": "Несколько языков",
|
|
21
21
|
"MUTE": "Отключить звук",
|
|
22
22
|
"NOT_APPLICABLE": "Неприменимо",
|
|
23
|
-
"OFF": "
|
|
24
|
-
"ON": "
|
|
23
|
+
"OFF": "Выкл.",
|
|
24
|
+
"ON": "Вкл.",
|
|
25
25
|
"PAUSE": "Пауза",
|
|
26
26
|
"PICTURE_IN_PICTURE": "Картинка в картинке",
|
|
27
27
|
"PLAY": "Воспроизвести",
|
package/ui/localization.js
CHANGED
|
@@ -130,28 +130,20 @@ shaka.ui.Localization = class {
|
|
|
130
130
|
(locale) => !this.localizations_.has(locale));
|
|
131
131
|
|
|
132
132
|
if (missing.length) {
|
|
133
|
-
/** @type {shaka.ui.Localization.UnknownLocalesEvent} */
|
|
134
|
-
const eMissing = {
|
|
135
|
-
'locales': missing,
|
|
136
|
-
};
|
|
137
|
-
|
|
138
133
|
this.events_.dispatchEvent(new shaka.util.FakeEvent(
|
|
139
134
|
Class.UNKNOWN_LOCALES,
|
|
140
|
-
|
|
135
|
+
(new Map()).set('locales', missing)));
|
|
141
136
|
}
|
|
142
137
|
|
|
143
138
|
const found = shaka.util.Iterables.filter(
|
|
144
139
|
this.currentLocales_,
|
|
145
140
|
(locale) => this.localizations_.has(locale));
|
|
146
141
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
'locales': found.length ? found : [this.fallbackLocale_],
|
|
150
|
-
};
|
|
151
|
-
|
|
142
|
+
const data = (new Map()).set(
|
|
143
|
+
'locales', found.length ? found : [this.fallbackLocale_]);
|
|
152
144
|
this.events_.dispatchEvent(new shaka.util.FakeEvent(
|
|
153
145
|
Class.LOCALE_CHANGED,
|
|
154
|
-
|
|
146
|
+
data));
|
|
155
147
|
}
|
|
156
148
|
|
|
157
149
|
/**
|
|
@@ -253,14 +245,11 @@ shaka.ui.Localization = class {
|
|
|
253
245
|
// number of locales. Since we don't know which ones we actually checked,
|
|
254
246
|
// just tell them the preferred locale.
|
|
255
247
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
};
|
|
262
|
-
|
|
263
|
-
this.events_.dispatchEvent(new FakeEvent(Class.UNKNOWN_LOCALIZATION, e));
|
|
248
|
+
const data = new Map()
|
|
249
|
+
// Make a copy to avoid leaking references.
|
|
250
|
+
.set('locales', Array.from(this.currentLocales_))
|
|
251
|
+
.set('missing', id);
|
|
252
|
+
this.events_.dispatchEvent(new FakeEvent(Class.UNKNOWN_LOCALIZATION, data));
|
|
264
253
|
|
|
265
254
|
return '';
|
|
266
255
|
}
|
|
@@ -381,18 +370,16 @@ shaka.ui.Localization = class {
|
|
|
381
370
|
}
|
|
382
371
|
|
|
383
372
|
if (missing.size > 0) {
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
'missing': Array.from(missing),
|
|
391
|
-
};
|
|
373
|
+
const data = new Map()
|
|
374
|
+
// Make a copy of the preferred locales to avoid leaking references.
|
|
375
|
+
.set('locales', Array.from(preferredLocales))
|
|
376
|
+
// Because more people like arrays more than sets, convert the set to
|
|
377
|
+
// an array.
|
|
378
|
+
.set('missing', Array.from(missing));
|
|
392
379
|
|
|
393
380
|
this.events_.dispatchEvent(new shaka.util.FakeEvent(
|
|
394
381
|
shaka.ui.Localization.MISSING_LOCALIZATIONS,
|
|
395
|
-
|
|
382
|
+
data));
|
|
396
383
|
}
|
|
397
384
|
}
|
|
398
385
|
|
|
@@ -478,52 +465,42 @@ shaka.ui.Localization.LOCALE_CHANGED = 'locale-changed';
|
|
|
478
465
|
shaka.ui.Localization.LOCALE_UPDATED = 'locale-updated';
|
|
479
466
|
|
|
480
467
|
/**
|
|
481
|
-
* @
|
|
482
|
-
*
|
|
483
|
-
*
|
|
484
|
-
*
|
|
468
|
+
* @event shaka.ui.Localization.UnknownLocalesEvent
|
|
469
|
+
* @property {string} type
|
|
470
|
+
* 'unknown-locales'
|
|
485
471
|
* @property {!Array.<string>} locales
|
|
486
472
|
* The locales that the user wanted but could not be found.
|
|
487
473
|
* @exportDoc
|
|
488
474
|
*/
|
|
489
|
-
shaka.ui.Localization.UnknownLocalesEvent;
|
|
490
475
|
|
|
491
476
|
/**
|
|
492
|
-
* @
|
|
493
|
-
*
|
|
494
|
-
* '
|
|
495
|
-
* }}
|
|
496
|
-
*
|
|
477
|
+
* @event shaka.ui.Localization.MissingLocalizationsEvent
|
|
478
|
+
* @property {string} type
|
|
479
|
+
* 'unknown-localization'
|
|
497
480
|
* @property {!Array.<string>} locales
|
|
498
481
|
* The locales that the user wanted.
|
|
499
482
|
* @property {string} missing
|
|
500
483
|
* The id of the unknown entry.
|
|
501
484
|
* @exportDoc
|
|
502
485
|
*/
|
|
503
|
-
shaka.ui.Localization.UnknownLocalizationEvent;
|
|
504
486
|
|
|
505
487
|
/**
|
|
506
|
-
* @
|
|
507
|
-
*
|
|
508
|
-
* 'missing'
|
|
509
|
-
* }}
|
|
510
|
-
*
|
|
488
|
+
* @event shaka.ui.Localization.MissingLocalizationsEvent
|
|
489
|
+
* @property {string} type
|
|
490
|
+
* 'missing-localizations'
|
|
511
491
|
* @property {string} locale
|
|
512
492
|
* The locale that the user wanted.
|
|
513
493
|
* @property {!Array.<string>} missing
|
|
514
494
|
* The ids of the missing entries.
|
|
515
495
|
* @exportDoc
|
|
516
496
|
*/
|
|
517
|
-
shaka.ui.Localization.MissingLocalizationsEvent;
|
|
518
497
|
|
|
519
498
|
/**
|
|
520
|
-
* @
|
|
521
|
-
*
|
|
522
|
-
*
|
|
523
|
-
*
|
|
499
|
+
* @event shaka.ui.Localization.LocaleChangedEvent
|
|
500
|
+
* @property {string} type
|
|
501
|
+
* 'locale-changed'
|
|
524
502
|
* @property {!Array.<string>} locales
|
|
525
503
|
* The new set of locales that user wanted,
|
|
526
504
|
* and that were successfully found.
|
|
527
505
|
* @exportDoc
|
|
528
506
|
*/
|
|
529
|
-
shaka.ui.Localization.LocaleChangedEvent;
|
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');
|
|
@@ -131,9 +130,8 @@ shaka.ui.PipButton = class extends shaka.ui.Element {
|
|
|
131
130
|
await document.exitPictureInPicture();
|
|
132
131
|
}
|
|
133
132
|
} catch (error) {
|
|
134
|
-
this.controls.dispatchEvent(new shaka.util.FakeEvent(
|
|
135
|
-
|
|
136
|
-
}));
|
|
133
|
+
this.controls.dispatchEvent(new shaka.util.FakeEvent(
|
|
134
|
+
'error', (new Map()).set('detail', error)));
|
|
137
135
|
}
|
|
138
136
|
}
|
|
139
137
|
|
|
@@ -142,8 +140,8 @@ shaka.ui.PipButton = class extends shaka.ui.Element {
|
|
|
142
140
|
onEnterPictureInPicture_() {
|
|
143
141
|
const LocIds = shaka.ui.Locales.Ids;
|
|
144
142
|
this.pipIcon_.textContent = shaka.ui.Enums.MaterialDesignIcons.EXIT_PIP;
|
|
145
|
-
this.pipButton_.
|
|
146
|
-
this.localization.resolve(LocIds.EXIT_PICTURE_IN_PICTURE)
|
|
143
|
+
this.pipButton_.ariaLabel =
|
|
144
|
+
this.localization.resolve(LocIds.EXIT_PICTURE_IN_PICTURE);
|
|
147
145
|
this.currentPipState_.textContent =
|
|
148
146
|
this.localization.resolve(LocIds.ON);
|
|
149
147
|
}
|
|
@@ -153,8 +151,8 @@ shaka.ui.PipButton = class extends shaka.ui.Element {
|
|
|
153
151
|
onLeavePictureInPicture_() {
|
|
154
152
|
const LocIds = shaka.ui.Locales.Ids;
|
|
155
153
|
this.pipIcon_.textContent = shaka.ui.Enums.MaterialDesignIcons.PIP;
|
|
156
|
-
this.pipButton_.
|
|
157
|
-
this.localization.resolve(LocIds.ENTER_PICTURE_IN_PICTURE)
|
|
154
|
+
this.pipButton_.ariaLabel =
|
|
155
|
+
this.localization.resolve(LocIds.ENTER_PICTURE_IN_PICTURE);
|
|
158
156
|
this.currentPipState_.textContent =
|
|
159
157
|
this.localization.resolve(LocIds.OFF);
|
|
160
158
|
}
|
|
@@ -172,8 +170,7 @@ shaka.ui.PipButton = class extends shaka.ui.Element {
|
|
|
172
170
|
const ariaLabel = document.pictureInPictureElement ?
|
|
173
171
|
LocIds.EXIT_PICTURE_IN_PICTURE :
|
|
174
172
|
LocIds.ENTER_PICTURE_IN_PICTURE;
|
|
175
|
-
this.pipButton_.
|
|
176
|
-
this.localization.resolve(ariaLabel));
|
|
173
|
+
this.pipButton_.ariaLabel = this.localization.resolve(ariaLabel);
|
|
177
174
|
|
|
178
175
|
const currentPipState = document.pictureInPictureElement ?
|
|
179
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_();
|
|
@@ -92,7 +91,7 @@ shaka.ui.TextSelection = class extends shaka.ui.SettingsMenu {
|
|
|
92
91
|
*/
|
|
93
92
|
addOffOption_() {
|
|
94
93
|
const off = shaka.util.Dom.createButton();
|
|
95
|
-
off.
|
|
94
|
+
off.ariaSelected = 'true';
|
|
96
95
|
this.menu.appendChild(off);
|
|
97
96
|
|
|
98
97
|
off.appendChild(shaka.ui.Utils.checkmarkIcon());
|
|
@@ -110,11 +109,11 @@ shaka.ui.TextSelection = class extends shaka.ui.SettingsMenu {
|
|
|
110
109
|
if (this.player.isTextTrackVisible()) {
|
|
111
110
|
this.icon.classList.add('shaka-captions-on');
|
|
112
111
|
this.icon.classList.remove('shaka-captions-off');
|
|
113
|
-
this.button.
|
|
112
|
+
this.button.ariaPressed = 'true';
|
|
114
113
|
} else {
|
|
115
114
|
this.icon.classList.add('shaka-captions-off');
|
|
116
115
|
this.icon.classList.remove('shaka-captions-on');
|
|
117
|
-
this.button.
|
|
116
|
+
this.button.ariaPressed = 'false';
|
|
118
117
|
}
|
|
119
118
|
|
|
120
119
|
this.controls.dispatchEvent(
|
|
@@ -148,7 +147,7 @@ shaka.ui.TextSelection = class extends shaka.ui.SettingsMenu {
|
|
|
148
147
|
this.menu.appendChild(offButton);
|
|
149
148
|
|
|
150
149
|
if (!this.player.isTextTrackVisible()) {
|
|
151
|
-
offButton.
|
|
150
|
+
offButton.ariaSelected = 'true';
|
|
152
151
|
offButton.appendChild(shaka.ui.Utils.checkmarkIcon());
|
|
153
152
|
this.captionsOffSpan_.classList.add('shaka-chosen-item');
|
|
154
153
|
this.currentSelection.textContent =
|
|
@@ -184,10 +183,8 @@ shaka.ui.TextSelection = class extends shaka.ui.SettingsMenu {
|
|
|
184
183
|
updateLocalizedStrings_() {
|
|
185
184
|
const LocIds = shaka.ui.Locales.Ids;
|
|
186
185
|
|
|
187
|
-
this.button.
|
|
188
|
-
|
|
189
|
-
this.backButton.setAttribute(shaka.ui.Constants.ARIA_LABEL,
|
|
190
|
-
this.localization.resolve(LocIds.BACK));
|
|
186
|
+
this.button.ariaLabel = this.localization.resolve(LocIds.CAPTIONS);
|
|
187
|
+
this.backButton.ariaLabel = this.localization.resolve(LocIds.BACK);
|
|
191
188
|
this.nameSpan.textContent =
|
|
192
189
|
this.localization.resolve(LocIds.CAPTIONS);
|
|
193
190
|
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
|
|