Version 1
[yaffs-website] / node_modules / video.js / es5 / big-play-button.js
1 'use strict';
2
3 exports.__esModule = true;
4
5 var _button = require('./button.js');
6
7 var _button2 = _interopRequireDefault(_button);
8
9 var _component = require('./component.js');
10
11 var _component2 = _interopRequireDefault(_component);
12
13 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
14
15 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
16
17 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; }
18
19 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; } /**
20                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 * @file big-play-button.js
21                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 */
22
23
24 /**
25  * The initial play button that shows before the video has played. The hiding of the
26  * `BigPlayButton` get done via CSS and `Player` states.
27  *
28  * @extends Button
29  */
30 var BigPlayButton = function (_Button) {
31   _inherits(BigPlayButton, _Button);
32
33   function BigPlayButton() {
34     _classCallCheck(this, BigPlayButton);
35
36     return _possibleConstructorReturn(this, _Button.apply(this, arguments));
37   }
38
39   /**
40    * Builds the default DOM `className`.
41    *
42    * @return {string}
43    *         The DOM `className` for this object. Always returns 'vjs-big-play-button'.
44    */
45   BigPlayButton.prototype.buildCSSClass = function buildCSSClass() {
46     return 'vjs-big-play-button';
47   };
48
49   /**
50    * This gets called when a `BigPlayButton` "clicked". See {@link ClickableComponent}
51    * for more detailed information on what a click can be.
52    *
53    * @param {EventTarget~Event} event
54    *        The `keydown`, `tap`, or `click` event that caused this function to be
55    *        called.
56    *
57    * @listens tap
58    * @listens click
59    */
60
61
62   BigPlayButton.prototype.handleClick = function handleClick(event) {
63     this.player_.play();
64
65     var cb = this.player_.getChild('controlBar');
66     var playToggle = cb && cb.getChild('playToggle');
67
68     if (!playToggle) {
69       this.player_.focus();
70       return;
71     }
72
73     this.setTimeout(function () {
74       playToggle.focus();
75     }, 1);
76   };
77
78   return BigPlayButton;
79 }(_button2['default']);
80
81 /**
82  * The text that should display over the `BigPlayButton`s controls. Added to for localization.
83  *
84  * @type {string}
85  * @private
86  */
87
88
89 BigPlayButton.prototype.controlText_ = 'Play Video';
90
91 _component2['default'].registerComponent('BigPlayButton', BigPlayButton);
92 exports['default'] = BigPlayButton;