-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
Copy pathbig_play_button.js
53 lines (41 loc) · 1.07 KB
/
big_play_button.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*! @license
* Shaka Player
* Copyright 2016 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
goog.provide('shaka.ui.BigPlayButton');
goog.require('shaka.ui.Locales');
goog.require('shaka.ui.PlayButton');
goog.requireType('shaka.ui.Controls');
/**
* @extends {shaka.ui.PlayButton}
* @final
* @export
*/
shaka.ui.BigPlayButton = class extends shaka.ui.PlayButton {
/**
* @param {!HTMLElement} parent
* @param {!shaka.ui.Controls} controls
*/
constructor(parent, controls) {
super(parent, controls);
this.button.classList.add('shaka-play-button');
this.button.classList.add('shaka-no-propagation');
this.updateIcon();
this.updateAriaLabel();
}
/** @override */
updateIcon() {
if (this.isPaused()) {
this.button.setAttribute('icon', 'play');
} else {
this.button.setAttribute('icon', 'pause');
}
}
/** @override */
updateAriaLabel() {
const LocIds = shaka.ui.Locales.Ids;
const label = this.isPaused() ? LocIds.PLAY : LocIds.PAUSE;
this.button.ariaLabel = this.localization.resolve(label);
}
};