big-play-button.js 3.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. 'use strict';
  2. exports.__esModule = true;
  3. var _button = require('./button.js');
  4. var _button2 = _interopRequireDefault(_button);
  5. var _component = require('./component.js');
  6. var _component2 = _interopRequireDefault(_component);
  7. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  8. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  10. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /**
  11. * @file big-play-button.js
  12. */
  13. /**
  14. * The initial play button that shows before the video has played. The hiding of the
  15. * `BigPlayButton` get done via CSS and `Player` states.
  16. *
  17. * @extends Button
  18. */
  19. var BigPlayButton = function (_Button) {
  20. _inherits(BigPlayButton, _Button);
  21. function BigPlayButton() {
  22. _classCallCheck(this, BigPlayButton);
  23. return _possibleConstructorReturn(this, _Button.apply(this, arguments));
  24. }
  25. /**
  26. * Builds the default DOM `className`.
  27. *
  28. * @return {string}
  29. * The DOM `className` for this object. Always returns 'vjs-big-play-button'.
  30. */
  31. BigPlayButton.prototype.buildCSSClass = function buildCSSClass() {
  32. return 'vjs-big-play-button';
  33. };
  34. /**
  35. * This gets called when a `BigPlayButton` "clicked". See {@link ClickableComponent}
  36. * for more detailed information on what a click can be.
  37. *
  38. * @param {EventTarget~Event} event
  39. * The `keydown`, `tap`, or `click` event that caused this function to be
  40. * called.
  41. *
  42. * @listens tap
  43. * @listens click
  44. */
  45. BigPlayButton.prototype.handleClick = function handleClick(event) {
  46. this.player_.play();
  47. var cb = this.player_.getChild('controlBar');
  48. var playToggle = cb && cb.getChild('playToggle');
  49. if (!playToggle) {
  50. this.player_.focus();
  51. return;
  52. }
  53. this.setTimeout(function () {
  54. playToggle.focus();
  55. }, 1);
  56. };
  57. return BigPlayButton;
  58. }(_button2['default']);
  59. /**
  60. * The text that should display over the `BigPlayButton`s controls. Added to for localization.
  61. *
  62. * @type {string}
  63. * @private
  64. */
  65. BigPlayButton.prototype.controlText_ = 'Play Video';
  66. _component2['default'].registerComponent('BigPlayButton', BigPlayButton);
  67. exports['default'] = BigPlayButton;