8
8
goog . provide ( 'shaka.ui.LoopButton' ) ;
9
9
10
10
goog . require ( 'shaka.ui.Constants' ) ;
11
+ goog . require ( 'shaka.ui.Controls' ) ;
11
12
goog . require ( 'shaka.ui.Element' ) ;
12
13
goog . require ( 'shaka.ui.Enums' ) ;
13
14
goog . require ( 'shaka.ui.Locales' ) ;
@@ -44,6 +45,7 @@ shaka.ui.LoopButton = class extends shaka.ui.Element {
44
45
45
46
const label = shaka . util . Dom . createHTMLElement ( 'label' ) ;
46
47
label . classList . add ( 'shaka-overflow-button-label' ) ;
48
+ label . classList . add ( 'shaka-overflow-menu-only' ) ;
47
49
this . nameSpan_ = shaka . util . Dom . createHTMLElement ( 'span' ) ;
48
50
this . nameSpan_ . textContent = this . localization . resolve ( LocIds . LOOP ) ;
49
51
label . appendChild ( this . nameSpan_ ) ;
@@ -133,6 +135,7 @@ shaka.ui.LoopButton = class extends shaka.ui.Element {
133
135
*/
134
136
updateLocalizedStrings_ ( ) {
135
137
const LocIds = shaka . ui . Locales . Ids ;
138
+ const Icons = shaka . ui . Enums . MaterialDesignIcons ;
136
139
137
140
this . nameSpan_ . textContent =
138
141
this . localization . resolve ( LocIds . LOOP ) ;
@@ -141,6 +144,10 @@ shaka.ui.LoopButton = class extends shaka.ui.Element {
141
144
142
145
this . currentState_ . textContent = this . localization . resolve ( labelText ) ;
143
146
147
+ const icon = this . video . loop ? Icons . UNLOOP : Icons . LOOP ;
148
+
149
+ this . icon_ . textContent = icon ;
150
+
144
151
const ariaText = this . video . loop ?
145
152
LocIds . EXIT_LOOP_MODE : LocIds . ENTER_LOOP_MODE ;
146
153
@@ -163,3 +170,6 @@ shaka.ui.LoopButton.Factory = class {
163
170
164
171
shaka . ui . OverflowMenu . registerElement (
165
172
'loop' , new shaka . ui . LoopButton . Factory ( ) ) ;
173
+
174
+ shaka . ui . Controls . registerElement (
175
+ 'loop' , new shaka . ui . LoopButton . Factory ( ) ) ;
0 commit comments