Source: ui/big_play_button.js

  1. /*! @license
  2. * Shaka Player
  3. * Copyright 2016 Google LLC
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. goog.provide('shaka.ui.BigPlayButton');
  7. goog.require('shaka.ui.Locales');
  8. goog.require('shaka.ui.PlayButton');
  9. goog.requireType('shaka.ui.Controls');
  10. /**
  11. * @extends {shaka.ui.PlayButton}
  12. * @final
  13. * @export
  14. */
  15. shaka.ui.BigPlayButton = class extends shaka.ui.PlayButton {
  16. /**
  17. * @param {!HTMLElement} parent
  18. * @param {!shaka.ui.Controls} controls
  19. */
  20. constructor(parent, controls) {
  21. super(parent, controls);
  22. this.button.classList.add('shaka-play-button');
  23. this.button.classList.add('shaka-no-propagation');
  24. this.updateIcon();
  25. this.updateAriaLabel();
  26. }
  27. /** @override */
  28. updateIcon() {
  29. if (this.isPaused()) {
  30. this.button.setAttribute('icon', 'play');
  31. } else {
  32. this.button.setAttribute('icon', 'pause');
  33. }
  34. }
  35. /** @override */
  36. updateAriaLabel() {
  37. const LocIds = shaka.ui.Locales.Ids;
  38. const label = this.isPaused() ? LocIds.PLAY : LocIds.PAUSE;
  39. this.button.ariaLabel = this.localization.resolve(label);
  40. }
  41. };