shaka-player 2.5.4 → 2.5.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 +13 -0
- package/CHANGELOG.md +56 -0
- package/build/build.py +4 -1
- package/build/check.py +17 -0
- package/build/compiler.py +40 -0
- package/build/types/core +1 -0
- package/build/types/ui +4 -1
- package/demo/asset_card.js +41 -11
- package/demo/cast_receiver/receiver_app.css +19 -13
- package/demo/close_button.js +0 -6
- package/demo/common/asset.js +6 -1
- package/demo/common/assets.js +72 -14
- package/demo/demo.less +105 -16
- package/demo/index.html +8 -5
- package/demo/load.js +5 -7
- package/demo/main.js +81 -16
- package/dist/.csslintstamp +0 -0
- package/dist/controls.css +1 -1
- package/dist/controls.css.map +1 -1
- package/dist/demo.compiled.debug.js +46 -39
- package/dist/demo.compiled.debug.map +3 -3
- package/dist/demo.compiled.js +46 -39
- package/dist/demo.compiled.map +3 -3
- package/dist/demo.css +1 -1
- package/dist/demo.css.map +1 -1
- package/dist/deps.js +11 -7
- package/dist/receiver.compiled.debug.js +10 -6
- package/dist/receiver.compiled.debug.map +3 -3
- package/dist/receiver.compiled.js +10 -6
- package/dist/receiver.compiled.map +3 -3
- package/dist/shaka-player.compiled.debug.externs.js +123 -92
- package/dist/shaka-player.compiled.debug.js +113 -105
- package/dist/shaka-player.compiled.debug.map +4 -4
- package/dist/shaka-player.compiled.externs.js +123 -92
- package/dist/shaka-player.compiled.js +551 -548
- package/dist/shaka-player.compiled.map +4 -4
- package/dist/shaka-player.ui.debug.externs.js +170 -101
- package/dist/shaka-player.ui.debug.js +187 -188
- package/dist/shaka-player.ui.debug.map +4 -4
- package/dist/shaka-player.ui.externs.js +170 -101
- package/dist/shaka-player.ui.js +651 -651
- package/dist/shaka-player.ui.map +3 -3
- package/docs/tutorials/drm-config.md +1 -0
- package/docs/tutorials/fairplay.md +77 -0
- package/docs/tutorials/index.json +1 -0
- package/docs/tutorials/ui-customization.md +3 -0
- package/docs/tutorials/ui.md +3 -1
- package/externs/mediasession.js +16 -1
- package/externs/shaka/net.js +5 -1
- package/externs/shaka/player.js +136 -90
- package/externs/webkitmediakeys.js +4 -0
- package/lib/dash/content_protection.js +33 -1
- package/lib/dash/dash_parser.js +12 -4
- package/lib/hls/hls_parser.js +20 -4
- package/lib/media/drm_engine.js +29 -2
- package/lib/media/media_source_engine.js +7 -3
- package/lib/media/playhead.js +8 -3
- package/lib/media/streaming_engine.js +24 -8
- package/lib/media/video_wrapper.js +8 -3
- package/lib/net/networking_engine.js +1 -0
- package/lib/player.js +3 -2
- package/lib/polyfill/patchedmediakeys_apple.js +2 -72
- package/lib/util/error.js +12 -0
- package/lib/util/fairplay_utils.js +122 -0
- package/lib/util/player_configuration.js +5 -0
- package/lib/util/pssh.js +41 -0
- package/package.json +4 -3
- package/shaka-player.uncompiled.js +5 -1
- package/test/dash/dash_parser_content_protection_unit.js +35 -1
- package/test/dash/dash_parser_manifest_unit.js +31 -0
- package/test/hls/hls_live_unit.js +7 -1
- package/test/hls/hls_parser_unit.js +50 -0
- package/test/media/media_source_engine_integration.js +12 -0
- package/test/media/playhead_unit.js +2 -0
- package/test/player_external.js +3 -2
- package/test/player_integration.js +75 -0
- package/test/test/externs/jasmine.js +6 -0
- package/test/test/util/test_scheme.js +32 -1
- package/test/test/util/ui_utils.js +41 -0
- package/test/ui/ui_unit.js +129 -3
- package/ui/audio_language_selection.js +17 -96
- package/ui/big_play_button.js +61 -0
- package/ui/controls.js +111 -86
- package/ui/controls.less +3 -5
- package/ui/externs/ui.js +14 -2
- package/ui/fullscreen_button.js +2 -52
- package/ui/less/buttons.less +8 -8
- package/ui/less/containers.less +21 -21
- package/ui/less/general.less +11 -0
- package/ui/less/other_elements.less +2 -1
- package/ui/less/overflow_menu.less +11 -10
- package/ui/less/range_elements.less +6 -0
- package/ui/less/spinner.less +2 -0
- package/ui/pip_button.js +1 -1
- package/ui/{play_pause_button.js → play_button.js} +17 -47
- package/ui/resolution_selection.js +41 -104
- package/ui/seek_bar.js +15 -17
- package/ui/settings_menu.js +113 -0
- package/ui/small_play_button.js +73 -0
- package/ui/text_displayer.js +2 -2
- package/ui/text_selection.js +39 -105
- package/ui/ui.js +12 -0
package/test/ui/ui_unit.js
CHANGED
|
@@ -181,6 +181,27 @@ describe('UI', function() {
|
|
|
181
181
|
videoContainer.appendChild(video);
|
|
182
182
|
});
|
|
183
183
|
|
|
184
|
+
it('goes into fullscreen on double click', async () => {
|
|
185
|
+
const config = {
|
|
186
|
+
controlPanelElements: [
|
|
187
|
+
'overflow_menu',
|
|
188
|
+
],
|
|
189
|
+
overflowMenuButtons: [
|
|
190
|
+
'quality',
|
|
191
|
+
],
|
|
192
|
+
};
|
|
193
|
+
const ui = createUIThroughAPI(videoContainer, video, config);
|
|
194
|
+
const controls = ui.getControls();
|
|
195
|
+
|
|
196
|
+
const spy = spyOn(controls, 'toggleFullScreen');
|
|
197
|
+
|
|
198
|
+
const controlsContainer =
|
|
199
|
+
videoContainer.querySelector('.shaka-controls-container');
|
|
200
|
+
shaka.test.UiUtils.simulateEvent(controlsContainer, 'dblclick');
|
|
201
|
+
await shaka.test.Util.delay(0.1);
|
|
202
|
+
expect(spy).toHaveBeenCalledTimes(1);
|
|
203
|
+
});
|
|
204
|
+
|
|
184
205
|
describe('all the controls', function() {
|
|
185
206
|
/** @type {!HTMLElement} */
|
|
186
207
|
let controlsContainer;
|
|
@@ -344,6 +365,8 @@ describe('UI', function() {
|
|
|
344
365
|
describe('resolutions menu', function() {
|
|
345
366
|
/** @type {!HTMLElement} */
|
|
346
367
|
let resolutionsMenu;
|
|
368
|
+
/** @type {shaka.ui.Controls} */
|
|
369
|
+
let controls;
|
|
347
370
|
|
|
348
371
|
beforeEach(function() {
|
|
349
372
|
let config = {
|
|
@@ -354,7 +377,9 @@ describe('UI', function() {
|
|
|
354
377
|
'quality',
|
|
355
378
|
],
|
|
356
379
|
};
|
|
357
|
-
createUIThroughAPI(videoContainer, video, config);
|
|
380
|
+
const ui = createUIThroughAPI(videoContainer, video, config);
|
|
381
|
+
controls = ui.getControls();
|
|
382
|
+
player = controls.getLocalPlayer();
|
|
358
383
|
|
|
359
384
|
let resolutionsMenus =
|
|
360
385
|
videoContainer.getElementsByClassName('shaka-resolutions');
|
|
@@ -406,8 +431,107 @@ describe('UI', function() {
|
|
|
406
431
|
jasmine.any(Object), true);
|
|
407
432
|
});
|
|
408
433
|
|
|
409
|
-
|
|
410
|
-
|
|
434
|
+
it('displays resolutions based on current stream', async () => {
|
|
435
|
+
/* eslint-disable indent */
|
|
436
|
+
// A manifest with different resolutions at different
|
|
437
|
+
// languages/channel-counts to test the current resolution list is
|
|
438
|
+
// filtered.
|
|
439
|
+
const manifest = new shaka.test.ManifestGenerator()
|
|
440
|
+
.addPeriod(0)
|
|
441
|
+
.addVariant(0)
|
|
442
|
+
.primary()
|
|
443
|
+
.language('en')
|
|
444
|
+
.addVideo(1).size(320, 240)
|
|
445
|
+
.addAudio(3).channelsCount(2)
|
|
446
|
+
.addVariant(4)
|
|
447
|
+
.language('en')
|
|
448
|
+
.addVideo(5).size(640, 480)
|
|
449
|
+
.addAudio(6).channelsCount(2)
|
|
450
|
+
.addVariant(7) // Duplicate with 4
|
|
451
|
+
.language('en')
|
|
452
|
+
.addVideo(8).size(640, 480)
|
|
453
|
+
.addAudio(9).channelsCount(2)
|
|
454
|
+
.addVariant(10)
|
|
455
|
+
.language('en')
|
|
456
|
+
.addVideo(11).size(1280, 720)
|
|
457
|
+
.addAudio(12).channelsCount(1)
|
|
458
|
+
.addVariant(13)
|
|
459
|
+
.language('es')
|
|
460
|
+
.addVideo(14).size(960, 540)
|
|
461
|
+
.addAudio(15).channelsCount(2)
|
|
462
|
+
.addVariant(16)
|
|
463
|
+
.language('fr')
|
|
464
|
+
.addVideo(17).size(256, 144)
|
|
465
|
+
.addAudio(18).channelsCount(2)
|
|
466
|
+
.build();
|
|
467
|
+
/* eslint-enable indent */
|
|
468
|
+
const getResolutions = () => {
|
|
469
|
+
const resolutionButtons = videoContainer.querySelectorAll(
|
|
470
|
+
'button.explicit-resolution > span');
|
|
471
|
+
return Array.from(resolutionButtons)
|
|
472
|
+
.map((btn) => btn.innerText)
|
|
473
|
+
.sort();
|
|
474
|
+
};
|
|
475
|
+
|
|
476
|
+
await player.load(
|
|
477
|
+
/* uri= */ 'fake', /* startTime= */ 0, function() {
|
|
478
|
+
return new shaka.test.FakeManifestParser(manifest);
|
|
479
|
+
});
|
|
480
|
+
player.configure('abr.enabled', false);
|
|
481
|
+
|
|
482
|
+
const tracks = player.getVariantTracks();
|
|
483
|
+
const en2 =
|
|
484
|
+
tracks.find((t) => t.language == 'en' && t.channelsCount == 2);
|
|
485
|
+
const en1 =
|
|
486
|
+
tracks.find((t) => t.language == 'en' && t.channelsCount == 1);
|
|
487
|
+
const es = tracks.find((t) => t.language == 'es');
|
|
488
|
+
|
|
489
|
+
// There are 3 variants with English 2-channel, but one is a duplicate
|
|
490
|
+
// and shouldn't appear in the list.
|
|
491
|
+
goog.asserts.assert(en2, 'Unable to find tracks');
|
|
492
|
+
player.selectVariantTrack(en2, true);
|
|
493
|
+
await updateResolutionMenu();
|
|
494
|
+
expect(getResolutions()).toEqual(['240p', '480p']);
|
|
495
|
+
|
|
496
|
+
// There is 1 variant with English 1-channel.
|
|
497
|
+
goog.asserts.assert(en1, 'Unable to find tracks');
|
|
498
|
+
player.selectVariantTrack(en1, true);
|
|
499
|
+
await updateResolutionMenu();
|
|
500
|
+
expect(getResolutions()).toEqual(['720p']);
|
|
501
|
+
|
|
502
|
+
// There is 1 variant with Spanish 2-channel.
|
|
503
|
+
goog.asserts.assert(es, 'Unable to find tracks');
|
|
504
|
+
player.selectVariantTrack(es, true);
|
|
505
|
+
await updateResolutionMenu();
|
|
506
|
+
expect(getResolutions()).toEqual(['540p']);
|
|
507
|
+
});
|
|
508
|
+
|
|
509
|
+
/**
|
|
510
|
+
* Use internals to update the resolution menu. Our fake manifest can
|
|
511
|
+
* cause problems with startup where the Player will get stuck using
|
|
512
|
+
* "deferred" switches, so we won't get events and the resolution menu
|
|
513
|
+
* won't update.
|
|
514
|
+
*
|
|
515
|
+
* @suppress {accessControls}
|
|
516
|
+
*/
|
|
517
|
+
async function updateResolutionMenu() {
|
|
518
|
+
await shaka.test.Util.delay(0.1);
|
|
519
|
+
// TODO(#2089): We should be able to stop once we find one, but since
|
|
520
|
+
// there are multiple ResolutionMenu objects, we need to update all of
|
|
521
|
+
// them.
|
|
522
|
+
let found = false;
|
|
523
|
+
for (const elem of controls.elements_) {
|
|
524
|
+
if (elem instanceof shaka.ui.OverflowMenu) {
|
|
525
|
+
for (const child of elem.children_) {
|
|
526
|
+
if (child instanceof shaka.ui.ResolutionSelection) {
|
|
527
|
+
child.updateResolutionSelection_();
|
|
528
|
+
found = true;
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
goog.asserts.assert(found, 'Unable to find resolution menu');
|
|
534
|
+
}
|
|
411
535
|
});
|
|
412
536
|
|
|
413
537
|
// TODO: integration test to test audio language menu.
|
|
@@ -541,6 +665,7 @@ describe('UI', function() {
|
|
|
541
665
|
* @param {!HTMLElement} videoContainer
|
|
542
666
|
* @param {!HTMLMediaElement} video
|
|
543
667
|
* @param {!Object=} config
|
|
668
|
+
* @return {!shaka.ui.Overlay}
|
|
544
669
|
*/
|
|
545
670
|
function createUIThroughAPI(videoContainer, video, config) {
|
|
546
671
|
player = new shaka.Player(video);
|
|
@@ -548,6 +673,7 @@ describe('UI', function() {
|
|
|
548
673
|
config = config || {};
|
|
549
674
|
const ui = new shaka.ui.Overlay(player, videoContainer, video);
|
|
550
675
|
ui.configure(config);
|
|
676
|
+
return ui;
|
|
551
677
|
}
|
|
552
678
|
|
|
553
679
|
/**
|
|
@@ -18,31 +18,28 @@
|
|
|
18
18
|
|
|
19
19
|
goog.provide('shaka.ui.AudioLanguageSelection');
|
|
20
20
|
|
|
21
|
-
goog.require('shaka.ui.Element');
|
|
22
21
|
goog.require('shaka.ui.Enums');
|
|
23
22
|
goog.require('shaka.ui.LanguageUtils');
|
|
24
23
|
goog.require('shaka.ui.Locales');
|
|
25
24
|
goog.require('shaka.ui.Localization');
|
|
26
25
|
goog.require('shaka.ui.OverflowMenu');
|
|
27
|
-
goog.require('shaka.
|
|
28
|
-
|
|
26
|
+
goog.require('shaka.ui.SettingsMenu');
|
|
29
27
|
|
|
30
28
|
/**
|
|
31
|
-
* @extends {shaka.ui.
|
|
29
|
+
* @extends {shaka.ui.SettingsMenu}
|
|
32
30
|
* @final
|
|
33
31
|
* @export
|
|
34
32
|
*/
|
|
35
|
-
shaka.ui.AudioLanguageSelection = class extends shaka.ui.
|
|
33
|
+
shaka.ui.AudioLanguageSelection = class extends shaka.ui.SettingsMenu {
|
|
36
34
|
/**
|
|
37
35
|
* @param {!HTMLElement} parent
|
|
38
36
|
* @param {!shaka.ui.Controls} controls
|
|
39
37
|
*/
|
|
40
38
|
constructor(parent, controls) {
|
|
41
|
-
super(parent, controls);
|
|
42
|
-
|
|
43
|
-
this.addLanguagesButton_();
|
|
39
|
+
super(parent, controls, shaka.ui.Enums.MaterialDesignIcons.LANGUAGE);
|
|
44
40
|
|
|
45
|
-
this.
|
|
41
|
+
this.button.classList.add('shaka-language-button');
|
|
42
|
+
this.menu.classList.add('shaka-audio-languages');
|
|
46
43
|
|
|
47
44
|
this.eventManager.listen(
|
|
48
45
|
this.localization, shaka.ui.Localization.LOCALE_UPDATED, () => {
|
|
@@ -63,10 +60,6 @@ shaka.ui.AudioLanguageSelection = class extends shaka.ui.Element {
|
|
|
63
60
|
this.updateAudioLanguages_();
|
|
64
61
|
});
|
|
65
62
|
|
|
66
|
-
this.eventManager.listen(this.languagesButton_, 'click', () => {
|
|
67
|
-
this.onLanguagesClick_();
|
|
68
|
-
});
|
|
69
|
-
|
|
70
63
|
// Set up all the strings in the user's preferred language.
|
|
71
64
|
this.updateLocalizedStrings_();
|
|
72
65
|
|
|
@@ -74,89 +67,17 @@ shaka.ui.AudioLanguageSelection = class extends shaka.ui.Element {
|
|
|
74
67
|
}
|
|
75
68
|
|
|
76
69
|
|
|
77
|
-
/**
|
|
78
|
-
* @private
|
|
79
|
-
*/
|
|
80
|
-
addAudioLangMenu_() {
|
|
81
|
-
/** @private {!HTMLElement} */
|
|
82
|
-
this.audioLangMenu_ = shaka.util.Dom.createHTMLElement('div');
|
|
83
|
-
this.audioLangMenu_.classList.add('shaka-audio-languages');
|
|
84
|
-
this.audioLangMenu_.classList.add('shaka-no-propagation');
|
|
85
|
-
this.audioLangMenu_.classList.add('shaka-show-controls-on-mouse-over');
|
|
86
|
-
this.audioLangMenu_.classList.add('shaka-settings-menu');
|
|
87
|
-
|
|
88
|
-
/** @private {!HTMLElement} */
|
|
89
|
-
this.backFromLanguageButton_ = shaka.util.Dom.createHTMLElement('button');
|
|
90
|
-
this.backFromLanguageButton_.classList.add('shaka-back-to-overflow-button');
|
|
91
|
-
this.audioLangMenu_.appendChild(this.backFromLanguageButton_);
|
|
92
|
-
|
|
93
|
-
const backIcon = shaka.util.Dom.createHTMLElement('i');
|
|
94
|
-
backIcon.classList.add('material-icons');
|
|
95
|
-
backIcon.textContent = shaka.ui.Enums.MaterialDesignIcons.BACK;
|
|
96
|
-
this.backFromLanguageButton_.appendChild(backIcon);
|
|
97
|
-
|
|
98
|
-
/** @private {!HTMLElement} */
|
|
99
|
-
this.backFromLanguageSpan_ = shaka.util.Dom.createHTMLElement('span');
|
|
100
|
-
this.backFromLanguageButton_.appendChild(this.backFromLanguageSpan_);
|
|
101
|
-
|
|
102
|
-
const controlsContainer = this.controls.getControlsContainer();
|
|
103
|
-
controlsContainer.appendChild(this.audioLangMenu_);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* @private
|
|
109
|
-
*/
|
|
110
|
-
addLanguagesButton_() {
|
|
111
|
-
/** @private {!HTMLElement} */
|
|
112
|
-
this.languagesButton_ = shaka.util.Dom.createHTMLElement('button');
|
|
113
|
-
this.languagesButton_.classList.add('shaka-language-button');
|
|
114
|
-
|
|
115
|
-
const icon = shaka.util.Dom.createHTMLElement('i');
|
|
116
|
-
icon.classList.add('material-icons');
|
|
117
|
-
icon.textContent = shaka.ui.Enums.MaterialDesignIcons.LANGUAGE;
|
|
118
|
-
this.languagesButton_.appendChild(icon);
|
|
119
|
-
|
|
120
|
-
const label = shaka.util.Dom.createHTMLElement('label');
|
|
121
|
-
label.classList.add('shaka-overflow-button-label');
|
|
122
|
-
|
|
123
|
-
/** @private {!HTMLElement} */
|
|
124
|
-
this.languageNameSpan_ = shaka.util.Dom.createHTMLElement('span');
|
|
125
|
-
this.languageNameSpan_.classList.add('languageSpan');
|
|
126
|
-
label.appendChild(this.languageNameSpan_);
|
|
127
|
-
|
|
128
|
-
/** @private {!HTMLElement} */
|
|
129
|
-
this.currentAudioLanguage_ = shaka.util.Dom.createHTMLElement('span');
|
|
130
|
-
this.currentAudioLanguage_.classList.add('shaka-current-selection-span');
|
|
131
|
-
const language = this.player.getConfiguration().preferredAudioLanguage;
|
|
132
|
-
this.currentAudioLanguage_.textContent =
|
|
133
|
-
shaka.ui.LanguageUtils.getLanguageName(language, this.localization);
|
|
134
|
-
label.appendChild(this.currentAudioLanguage_);
|
|
135
|
-
|
|
136
|
-
this.languagesButton_.appendChild(label);
|
|
137
|
-
|
|
138
|
-
this.parent.appendChild(this.languagesButton_);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
/** @private */
|
|
142
|
-
onLanguagesClick_() {
|
|
143
|
-
this.controls.dispatchEvent(new shaka.util.FakeEvent('submenuopen'));
|
|
144
|
-
shaka.ui.Utils.setDisplay(this.audioLangMenu_, true);
|
|
145
|
-
// Focus on the currently selected language button.
|
|
146
|
-
shaka.ui.Utils.focusOnTheChosenItem(this.audioLangMenu_);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
70
|
/** @private */
|
|
150
71
|
updateAudioLanguages_() {
|
|
151
72
|
const tracks = this.player.getVariantTracks();
|
|
152
73
|
const languages = this.player.getAudioLanguages();
|
|
153
74
|
|
|
154
|
-
shaka.ui.LanguageUtils.updateLanguages(tracks, this.
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
shaka.ui.Utils.focusOnTheChosenItem(this.
|
|
75
|
+
shaka.ui.LanguageUtils.updateLanguages(tracks, this.menu,
|
|
76
|
+
languages,
|
|
77
|
+
(lang) => this.onAudioLanguageSelected_(lang), /* updateChosen */ true,
|
|
78
|
+
this.currentSelection,
|
|
79
|
+
this.localization);
|
|
80
|
+
shaka.ui.Utils.focusOnTheChosenItem(this.menu);
|
|
160
81
|
|
|
161
82
|
// TODO: document this event
|
|
162
83
|
this.controls.dispatchEvent(
|
|
@@ -166,7 +87,7 @@ shaka.ui.AudioLanguageSelection = class extends shaka.ui.Element {
|
|
|
166
87
|
/** @private */
|
|
167
88
|
onTracksChanged_() {
|
|
168
89
|
const hasVariants = this.player.getVariantTracks().length > 0;
|
|
169
|
-
shaka.ui.Utils.setDisplay(this.
|
|
90
|
+
shaka.ui.Utils.setDisplay(this.button, hasVariants);
|
|
170
91
|
this.updateAudioLanguages_();
|
|
171
92
|
}
|
|
172
93
|
|
|
@@ -185,13 +106,13 @@ shaka.ui.AudioLanguageSelection = class extends shaka.ui.Element {
|
|
|
185
106
|
updateLocalizedStrings_() {
|
|
186
107
|
const LocIds = shaka.ui.Locales.Ids;
|
|
187
108
|
|
|
188
|
-
this.
|
|
109
|
+
this.backButton.setAttribute(shaka.ui.Constants.ARIA_LABEL,
|
|
189
110
|
this.localization.resolve(LocIds.BACK));
|
|
190
|
-
this.
|
|
111
|
+
this.button.setAttribute(shaka.ui.Constants.ARIA_LABEL,
|
|
191
112
|
this.localization.resolve(LocIds.LANGUAGE));
|
|
192
|
-
this.
|
|
113
|
+
this.nameSpan.textContent =
|
|
193
114
|
this.localization.resolve(LocIds.LANGUAGE);
|
|
194
|
-
this.
|
|
115
|
+
this.backSpan.textContent =
|
|
195
116
|
this.localization.resolve(LocIds.LANGUAGE);
|
|
196
117
|
}
|
|
197
118
|
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2016 Google Inc.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
goog.provide('shaka.ui.BigPlayButton');
|
|
20
|
+
|
|
21
|
+
goog.require('shaka.ui.PlayButton');
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @extends {shaka.ui.PlayButton}
|
|
26
|
+
* @final
|
|
27
|
+
* @export
|
|
28
|
+
*/
|
|
29
|
+
shaka.ui.BigPlayButton = class extends shaka.ui.PlayButton {
|
|
30
|
+
/**
|
|
31
|
+
* @param {!HTMLElement} parent
|
|
32
|
+
* @param {!shaka.ui.Controls} controls
|
|
33
|
+
*/
|
|
34
|
+
constructor(parent, controls) {
|
|
35
|
+
super(parent, controls);
|
|
36
|
+
|
|
37
|
+
this.button.classList.add('shaka-play-button');
|
|
38
|
+
this.button.classList.add('shaka-no-propagation');
|
|
39
|
+
|
|
40
|
+
this.updateIcon_();
|
|
41
|
+
this.updateAriaLabel();
|
|
42
|
+
|
|
43
|
+
this.eventManager.listen(this.video, 'play', () => {
|
|
44
|
+
this.updateIcon_();
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
this.eventManager.listen(this.video, 'pause', () => {
|
|
48
|
+
this.updateIcon_();
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
/** @private */
|
|
54
|
+
updateIcon_() {
|
|
55
|
+
if (this.isPaused()) {
|
|
56
|
+
this.button.setAttribute('icon', 'play');
|
|
57
|
+
} else {
|
|
58
|
+
this.button.setAttribute('icon', 'pause');
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
};
|