shaka-player 3.0.11 → 3.0.15

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.
Files changed (142) hide show
  1. package/AUTHORS +5 -0
  2. package/CHANGELOG.md +132 -0
  3. package/CONTRIBUTORS +5 -0
  4. package/README.md +3 -0
  5. package/build/apps.py +2 -2
  6. package/build/check.py +2 -2
  7. package/build/conformance.textproto +0 -9
  8. package/build/generateExterns.js +1 -1
  9. package/build/shakaBuildHelpers.py +6 -5
  10. package/build/subprocessWindowsPatch.py +103 -0
  11. package/demo/common/assets.js +1 -1
  12. package/demo/common/message_ids.js +1 -0
  13. package/demo/config.js +2 -1
  14. package/demo/demo.less +4 -0
  15. package/demo/demo_utils.js +1 -0
  16. package/demo/input_container.js +2 -1
  17. package/demo/locales/en.json +1 -0
  18. package/demo/locales/source.json +4 -0
  19. package/dist/controls.css +2 -2
  20. package/dist/controls.css.map +1 -1
  21. package/dist/demo.compiled.debug.js +63 -60
  22. package/dist/demo.compiled.debug.map +3 -3
  23. package/dist/demo.compiled.js +63 -60
  24. package/dist/demo.compiled.map +3 -3
  25. package/dist/demo.css +1 -1
  26. package/dist/demo.css.map +1 -1
  27. package/dist/deps.js +9 -9
  28. package/dist/locales.js +35 -33
  29. package/dist/receiver.compiled.debug.js +59 -56
  30. package/dist/receiver.compiled.debug.map +3 -3
  31. package/dist/receiver.compiled.js +59 -56
  32. package/dist/receiver.compiled.map +3 -3
  33. package/dist/shaka-player.compiled.d.ts +131 -5
  34. package/dist/shaka-player.compiled.debug.d.ts +131 -5
  35. package/dist/shaka-player.compiled.debug.externs.js +142 -8
  36. package/dist/shaka-player.compiled.debug.js +330 -312
  37. package/dist/shaka-player.compiled.debug.map +4 -4
  38. package/dist/shaka-player.compiled.externs.js +142 -8
  39. package/dist/shaka-player.compiled.js +707 -702
  40. package/dist/shaka-player.compiled.map +4 -4
  41. package/dist/shaka-player.ui.d.ts +131 -5
  42. package/dist/shaka-player.ui.debug.d.ts +131 -5
  43. package/dist/shaka-player.ui.debug.externs.js +144 -10
  44. package/dist/shaka-player.ui.debug.js +354 -333
  45. package/dist/shaka-player.ui.debug.map +4 -4
  46. package/dist/shaka-player.ui.externs.js +144 -10
  47. package/dist/shaka-player.ui.js +860 -855
  48. package/dist/shaka-player.ui.map +4 -4
  49. package/docs/tutorials/fairplay.md +1 -1
  50. package/docs/tutorials/faq.md +25 -0
  51. package/externs/aria.js +18 -0
  52. package/externs/ima.js +4 -0
  53. package/externs/shaka/ads.js +2 -0
  54. package/karma.conf.js +1 -0
  55. package/lib/ads/ad_manager.js +29 -11
  56. package/lib/ads/client_side_ad_manager.js +76 -86
  57. package/lib/ads/server_side_ad_manager.js +26 -11
  58. package/lib/cast/cast_proxy.js +3 -2
  59. package/lib/cast/cast_receiver.js +6 -2
  60. package/lib/cast/cast_sender.js +2 -2
  61. package/lib/dash/dash_parser.js +63 -1
  62. package/lib/dash/segment_list.js +1 -1
  63. package/lib/dash/segment_template.js +41 -14
  64. package/lib/hls/hls_parser.js +41 -11
  65. package/lib/media/content_workarounds.js +18 -0
  66. package/lib/media/drm_engine.js +8 -0
  67. package/lib/media/gap_jumping_controller.js +8 -4
  68. package/lib/media/media_source_engine.js +7 -0
  69. package/lib/media/playhead.js +1 -1
  70. package/lib/media/presentation_timeline.js +3 -2
  71. package/lib/media/segment_index.js +41 -11
  72. package/lib/media/streaming_engine.js +34 -21
  73. package/lib/net/networking_engine.js +2 -1
  74. package/lib/offline/download_manager.js +1 -2
  75. package/lib/player.js +99 -44
  76. package/lib/polyfill/encryption_scheme.js +2 -0
  77. package/lib/polyfill/fullscreen.js +2 -0
  78. package/lib/polyfill/mathround.js +2 -0
  79. package/lib/polyfill/mediasource.js +2 -0
  80. package/lib/polyfill/patchedmediakeys_apple.js +6 -4
  81. package/lib/polyfill/patchedmediakeys_ms.js +6 -4
  82. package/lib/polyfill/patchedmediakeys_nop.js +2 -0
  83. package/lib/polyfill/patchedmediakeys_webkit.js +6 -4
  84. package/lib/polyfill/pip_webkit.js +2 -0
  85. package/lib/polyfill/video_play_promise.js +2 -0
  86. package/lib/polyfill/videoplaybackquality.js +2 -0
  87. package/lib/polyfill/vttcue.js +2 -0
  88. package/lib/text/mp4_ttml_parser.js +3 -0
  89. package/lib/text/ttml_text_parser.js +5 -0
  90. package/lib/text/ui_text_displayer.js +37 -3
  91. package/lib/util/error.js +1 -4
  92. package/lib/util/fake_event.js +53 -7
  93. package/lib/util/mime_utils.js +33 -0
  94. package/lib/util/periods.js +25 -3
  95. package/lib/util/stream_utils.js +11 -0
  96. package/package.json +3 -3
  97. package/test/cast/cast_proxy_unit.js +12 -6
  98. package/test/cast/cast_receiver_integration.js +1 -1
  99. package/test/cast/cast_utils_unit.js +1 -1
  100. package/test/dash/dash_parser_manifest_unit.js +73 -0
  101. package/test/demo/demo_unit.js +0 -1
  102. package/test/hls/hls_parser_unit.js +45 -1
  103. package/test/media/drm_engine_unit.js +56 -0
  104. package/test/media/playhead_unit.js +27 -1
  105. package/test/media/presentation_timeline_unit.js +19 -0
  106. package/test/media/segment_index_unit.js +79 -6
  107. package/test/media/streaming_engine_unit.js +3 -3
  108. package/test/player_integration.js +38 -0
  109. package/test/player_unit.js +19 -1
  110. package/test/test/assets/3675/chunk-stream0-00001.m4s +0 -0
  111. package/test/test/assets/3675/chunk-stream0-00002.m4s +0 -0
  112. package/test/test/assets/3675/chunk-stream0-00003.m4s +0 -0
  113. package/test/test/assets/3675/chunk-stream0-00004.m4s +0 -0
  114. package/test/test/assets/3675/chunk-stream0-00005.m4s +0 -0
  115. package/test/test/assets/3675/chunk-stream0-00006.m4s +0 -0
  116. package/test/test/assets/3675/chunk-stream0-00007.m4s +0 -0
  117. package/test/test/assets/3675/dash_0.mpd +30 -0
  118. package/test/test/assets/3675/dash_1.mpd +30 -0
  119. package/test/test/assets/3675/dash_2.mpd +30 -0
  120. package/test/test/assets/3675/dash_3.mpd +30 -0
  121. package/test/test/assets/3675/dash_4.mpd +30 -0
  122. package/test/test/assets/3675/dash_5.mpd +26 -0
  123. package/test/test/assets/3675/init-stream0.m4s +0 -0
  124. package/test/test/util/fake_ad_manager.js +4 -1
  125. package/test/test/util/fake_media_source_engine.js +4 -0
  126. package/test/test/util/simple_fakes.js +5 -3
  127. package/test/test/util/waiter.js +36 -2
  128. package/test/text/ttml_text_parser_unit.js +9 -0
  129. package/test/text/ui_text_displayer_unit.js +19 -3
  130. package/test/ui/localization_unit.js +15 -14
  131. package/test/ui/ui_unit.js +4 -0
  132. package/ui/big_play_button.js +10 -0
  133. package/ui/cast_button.js +2 -3
  134. package/ui/controls.js +9 -7
  135. package/ui/less/containers.less +3 -0
  136. package/ui/locales/en.json +1 -0
  137. package/ui/locales/ru.json +6 -6
  138. package/ui/locales/source.json +4 -0
  139. package/ui/localization.js +28 -51
  140. package/ui/pip_button.js +2 -3
  141. package/ui/play_button.js +10 -10
  142. package/ui/small_play_button.js +12 -0
@@ -198,7 +198,7 @@ describe('Localization', () => {
198
198
  localization.changeLocale([ELVISH_WOODLAND]);
199
199
 
200
200
  expect(events.length).toBe(1);
201
- expect(events[0].locales).toEqual([ELVISH_WOODLAND]);
201
+ expect(events[0]['locales']).toEqual([ELVISH_WOODLAND]);
202
202
  });
203
203
 
204
204
 
@@ -214,23 +214,23 @@ describe('Localization', () => {
214
214
  localization.changeLocale([ELVISH_WOODLAND, DWARFISH_NORTH]);
215
215
 
216
216
  expect(events.length).toBe(1);
217
- expect(events[0].locales).toEqual([ELVISH_WOODLAND, DWARFISH_NORTH]);
217
+ expect(events[0]['locales']).toEqual([ELVISH_WOODLAND, DWARFISH_NORTH]);
218
218
 
219
219
  // We should see an event telling us that dwarfish is still missing.
220
220
  localization.insert(ELVISH_WOODLAND, new Map());
221
221
  localization.changeLocale([ELVISH_WOODLAND, DWARFISH_NORTH]);
222
222
 
223
223
  expect(events.length).toBe(2);
224
- expect(events[0].locales).toEqual([ELVISH_WOODLAND, DWARFISH_NORTH]);
225
- expect(events[1].locales).toEqual([DWARFISH_NORTH]);
224
+ expect(events[0]['locales']).toEqual([ELVISH_WOODLAND, DWARFISH_NORTH]);
225
+ expect(events[1]['locales']).toEqual([DWARFISH_NORTH]);
226
226
 
227
227
  // There should be no more events now that we added the last language.
228
228
  localization.insert(DWARFISH_NORTH, new Map());
229
229
  localization.changeLocale([ELVISH_WOODLAND, DWARFISH_NORTH]);
230
230
 
231
231
  expect(events.length).toBe(2);
232
- expect(events[0].locales).toEqual([ELVISH_WOODLAND, DWARFISH_NORTH]);
233
- expect(events[1].locales).toEqual([DWARFISH_NORTH]);
232
+ expect(events[0]['locales']).toEqual([ELVISH_WOODLAND, DWARFISH_NORTH]);
233
+ expect(events[1]['locales']).toEqual([DWARFISH_NORTH]);
234
234
  });
235
235
  });
236
236
 
@@ -373,8 +373,8 @@ describe('Localization', () => {
373
373
  // it was in the fallback (HALFLING) but not our preferred language
374
374
  // (EVLISH).
375
375
  expect(events.length).toBe(1);
376
- expect(events[0].locales).toEqual([ELVISH_WOODLAND]);
377
- expect(events[0].missing).toEqual(['hello']);
376
+ expect(events[0]['locales']).toEqual([ELVISH_WOODLAND]);
377
+ expect(events[0]['missing']).toEqual(['hello']);
378
378
  });
379
379
 
380
380
  it('fires when key/value is missing from preferred but found in base',
@@ -400,8 +400,8 @@ describe('Localization', () => {
400
400
  // because it was in the base (ELVISH) but not our preferred language
401
401
  // (EVLISH_WOODLAND).
402
402
  expect(events.length).toBe(1);
403
- expect(events[0].locales).toEqual([ELVISH_WOODLAND]);
404
- expect(events[0].missing).toEqual(['Best Wishes']);
403
+ expect(events[0]['locales']).toEqual([ELVISH_WOODLAND]);
404
+ expect(events[0]['missing']).toEqual(['Best Wishes']);
405
405
  });
406
406
 
407
407
  it('fires when key/value is missing from preferred but found in sibling',
@@ -427,8 +427,8 @@ describe('Localization', () => {
427
427
  // understand" because it was in a sibling locale (HALFLING_SHIRE)
428
428
  // but not our preferred language (HALFLING_COMMON).
429
429
  expect(events.length).toBe(1);
430
- expect(events[0].locales).toEqual([HALFLING_COMMON]);
431
- expect(events[0].missing).toEqual(['Do you understand']);
430
+ expect(events[0]['locales']).toEqual([HALFLING_COMMON]);
431
+ expect(events[0]['missing']).toEqual(['Do you understand']);
432
432
  });
433
433
 
434
434
  it('fires when key/value is missing from some preferred languages',
@@ -454,8 +454,9 @@ describe('Localization', () => {
454
454
 
455
455
  // There should have no missing localization events.
456
456
  expect(events.length).toBe(1);
457
- expect(events[0].locales).toEqual([ELVISH_WOODLAND, DWARFISH_NORTH]);
458
- expect(events[0].missing).toEqual(['may your forge burn bright']);
457
+ expect(events[0]['locales']).toEqual(
458
+ [ELVISH_WOODLAND, DWARFISH_NORTH]);
459
+ expect(events[0]['missing']).toEqual(['may your forge burn bright']);
459
460
  });
460
461
  });
461
462
 
@@ -196,6 +196,10 @@ describe('UI', () => {
196
196
  });
197
197
 
198
198
  it('goes into fullscreen on double click', async () => {
199
+ if (!document.fullscreenEnabled) {
200
+ pending('This test requires fullscreen support, which is unavailable.');
201
+ }
202
+
199
203
  const config = {
200
204
  controlPanelElements: [
201
205
  'overflow_menu',
@@ -7,6 +7,7 @@
7
7
 
8
8
  goog.provide('shaka.ui.BigPlayButton');
9
9
 
10
+ goog.require('shaka.ui.Locales');
10
11
  goog.require('shaka.ui.PlayButton');
11
12
  goog.requireType('shaka.ui.Controls');
12
13
 
@@ -40,4 +41,13 @@ shaka.ui.BigPlayButton = class extends shaka.ui.PlayButton {
40
41
  this.button.setAttribute('icon', 'pause');
41
42
  }
42
43
  }
44
+
45
+
46
+ /** @override */
47
+ updateAriaLabel() {
48
+ const LocIds = shaka.ui.Locales.Ids;
49
+ const label = this.isPaused() ? LocIds.PLAY : LocIds.PAUSE;
50
+
51
+ this.button.ariaLabel = this.localization.resolve(label);
52
+ }
43
53
  };
package/ui/cast_button.js CHANGED
@@ -100,9 +100,8 @@ shaka.ui.CastButton = class extends shaka.ui.Element {
100
100
  } catch (error) {
101
101
  this.castButton_.disabled = false;
102
102
  if (error.code != shaka.util.Error.Code.CAST_CANCELED_BY_USER) {
103
- this.controls.dispatchEvent(new shaka.util.FakeEvent('error', {
104
- detail: error,
105
- }));
103
+ this.controls.dispatchEvent(new shaka.util.FakeEvent(
104
+ 'error', (new Map()).set('detail', error)));
106
105
  }
107
106
  }
108
107
  }
package/ui/controls.js CHANGED
@@ -197,6 +197,10 @@ shaka.ui.Controls = class extends shaka.util.FakeEventTarget {
197
197
  * @export
198
198
  */
199
199
  async destroy() {
200
+ if (document.pictureInPictureElement == this.localVideo_) {
201
+ await document.exitPictureInPicture();
202
+ }
203
+
200
204
  if (this.eventManager_) {
201
205
  this.eventManager_.release();
202
206
  this.eventManager_ = null;
@@ -547,9 +551,8 @@ shaka.ui.Controls = class extends shaka.util.FakeEventTarget {
547
551
  }
548
552
  await this.videoContainer_.requestFullscreen({navigationUI: 'hide'});
549
553
  } catch (error) {
550
- this.dispatchEvent(new shaka.util.FakeEvent('error', {
551
- detail: error,
552
- }));
554
+ this.dispatchEvent(new shaka.util.FakeEvent(
555
+ 'error', (new Map()).set('detail', error)));
553
556
  }
554
557
  }
555
558
  }
@@ -673,7 +676,7 @@ shaka.ui.Controls = class extends shaka.util.FakeEventTarget {
673
676
  });
674
677
 
675
678
  this.eventManager_.listen(this.controlsContainer_, 'dblclick', () => {
676
- if (this.config_.doubleClickForFullscreen) {
679
+ if (this.config_.doubleClickForFullscreen && document.fullscreenEnabled) {
677
680
  this.toggleFullScreen();
678
681
  }
679
682
  });
@@ -1128,9 +1131,8 @@ shaka.ui.Controls = class extends shaka.util.FakeEventTarget {
1128
1131
  /** @private */
1129
1132
  onCastStatusChange_() {
1130
1133
  const isCasting = this.castProxy_.isCasting();
1131
- this.dispatchEvent(new shaka.util.FakeEvent('caststatuschanged', {
1132
- newStatus: isCasting,
1133
- }));
1134
+ this.dispatchEvent(new shaka.util.FakeEvent(
1135
+ 'caststatuschanged', (new Map()).set('newStatus', isCasting)));
1134
1136
 
1135
1137
  if (isCasting) {
1136
1138
  this.controlsContainer_.setAttribute('casting', 'true');
@@ -157,6 +157,9 @@
157
157
  /* 32px tall controls. */
158
158
  height: 32px;
159
159
 
160
+ /* Consistent alignment of buttons. */
161
+ line-height: 0.5;
162
+
160
163
  /* Consistent margins (external) and padding (internal) between controls. */
161
164
  .bottom-panels-elements-margin();
162
165
 
@@ -26,6 +26,7 @@
26
26
  "PICTURE_IN_PICTURE": "Picture-in-Picture",
27
27
  "PLAY": "Play",
28
28
  "PLAYBACK_RATE": "Playback speed",
29
+ "REPLAY": "Replay",
29
30
  "RESOLUTION": "Resolution",
30
31
  "REWIND": "Rewind",
31
32
  "SEEK": "Seek",
@@ -1,10 +1,10 @@
1
1
  {
2
- "AD_DURATION": "Продолжительность объявления",
3
- "AD_PROGRESS": "Объявление [AD_ON] из [NUM_ADS]",
4
- "AD_TIME": "Объявление: [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": "Воспроизвести",
@@ -109,6 +109,10 @@
109
109
  "message": "Playback speed",
110
110
  "description": "Label for a button used to navigate to a submenu to choose the playback speed in the video player."
111
111
  },
112
+ "REPLAY": {
113
+ "description": "Label for a button used to replay the video in a video player.",
114
+ "message": "Replay"
115
+ },
112
116
  "RESOLUTION": {
113
117
  "description": "Label for a button used to open a submenu to choose a video resolution in the video player.",
114
118
  "meaning": "Visual quality",
@@ -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
- eMissing));
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
- /** @type {shaka.ui.Localization.LocaleChangedEvent} */
148
- const eFound = {
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
- eFound));
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
- /** @type {shaka.ui.Localization.UnknownLocalizationEvent} */
257
- const e = {
258
- // Make a copy to avoid leaking references.
259
- 'locales': Array.from(this.currentLocales_),
260
- 'missing': id,
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
- /** @type {shaka.ui.Localization.MissingLocalizationsEvent} */
385
- const e = {
386
- // Make a copy of the preferred locales to avoid leaking references.
387
- 'locales': Array.from(preferredLocales),
388
- // Because most people like arrays more than sets, convert the set to
389
- // an array.
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
- e));
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
- * @typedef {{
482
- * 'locales': !Array.<string>
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
- * @typedef {{
493
- * 'locales': !Array.<string>,
494
- * 'missing': string
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
- * @typedef {{
507
- * 'locales': !Array.<string>,
508
- * 'missing': !Array.<string>
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
- * @typedef {{
521
- * 'locales': !Array.<string>
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/pip_button.js CHANGED
@@ -129,9 +129,8 @@ shaka.ui.PipButton = class extends shaka.ui.Element {
129
129
  await document.exitPictureInPicture();
130
130
  }
131
131
  } catch (error) {
132
- this.controls.dispatchEvent(new shaka.util.FakeEvent('error', {
133
- detail: error,
134
- }));
132
+ this.controls.dispatchEvent(new shaka.util.FakeEvent(
133
+ 'error', (new Map()).set('detail', error)));
135
134
  }
136
135
  }
137
136
 
package/ui/play_button.js CHANGED
@@ -8,9 +8,7 @@
8
8
  goog.provide('shaka.ui.PlayButton');
9
9
 
10
10
  goog.require('shaka.ads.AdManager');
11
- goog.require('shaka.ui.Constants');
12
11
  goog.require('shaka.ui.Element');
13
- goog.require('shaka.ui.Locales');
14
12
  goog.require('shaka.ui.Localization');
15
13
  goog.require('shaka.util.Dom');
16
14
  goog.requireType('shaka.ui.Controls');
@@ -54,6 +52,11 @@ shaka.ui.PlayButton = class extends shaka.ui.Element {
54
52
  this.updateIcon();
55
53
  });
56
54
 
55
+ this.eventManager.listen(this.video, 'seeking', () => {
56
+ this.updateAriaLabel();
57
+ this.updateIcon();
58
+ });
59
+
57
60
  this.eventManager.listen(this.adManager, AdManager.AD_PAUSED, () => {
58
61
  this.updateAriaLabel();
59
62
  this.updateIcon();
@@ -96,14 +99,11 @@ shaka.ui.PlayButton = class extends shaka.ui.Element {
96
99
  return this.controls.presentationIsPaused();
97
100
  }
98
101
 
99
- /** @protected */
100
- updateAriaLabel() {
101
- const LocIds = shaka.ui.Locales.Ids;
102
- const label = this.isPaused() ? LocIds.PLAY : LocIds.PAUSE;
103
-
104
- this.button.setAttribute(shaka.ui.Constants.ARIA_LABEL,
105
- this.localization.resolve(label));
106
- }
102
+ /**
103
+ * Called when the button's aria label needs to change.
104
+ * To be overridden by subclasses.
105
+ */
106
+ updateAriaLabel() {}
107
107
 
108
108
  /**
109
109
  * Called when the button's icon needs to change.
@@ -9,6 +9,7 @@ goog.provide('shaka.ui.SmallPlayButton');
9
9
 
10
10
  goog.require('shaka.ui.Controls');
11
11
  goog.require('shaka.ui.Enums');
12
+ goog.require('shaka.ui.Locales');
12
13
  goog.require('shaka.ui.PlayButton');
13
14
 
14
15
 
@@ -42,6 +43,17 @@ shaka.ui.SmallPlayButton = class extends shaka.ui.PlayButton {
42
43
  this.button.textContent = this.isPaused() ? Icons.PLAY : Icons.PAUSE;
43
44
  }
44
45
  }
46
+
47
+ /** @override */
48
+ updateAriaLabel() {
49
+ const LocIds = shaka.ui.Locales.Ids;
50
+ if (this.video.ended) {
51
+ this.button.ariaLabel = this.localization.resolve(LocIds.REPLAY);
52
+ } else {
53
+ const label = this.isPaused() ? LocIds.PLAY : LocIds.PAUSE;
54
+ this.button.ariaLabel = this.localization.resolve(label);
55
+ }
56
+ }
45
57
  };
46
58
 
47
59