3 exports.__esModule = true;
5 var _textTrackButton = require('./text-track-button.js');
7 var _textTrackButton2 = _interopRequireDefault(_textTrackButton);
9 var _component = require('../../component.js');
11 var _component2 = _interopRequireDefault(_component);
13 var _captionSettingsMenuItem = require('./caption-settings-menu-item.js');
15 var _captionSettingsMenuItem2 = _interopRequireDefault(_captionSettingsMenuItem);
17 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
19 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
21 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; }
23 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; } /**
24 * @file captions-button.js
29 * The button component for toggling and selecting captions
31 * @extends TextTrackButton
33 var CaptionsButton = function (_TextTrackButton) {
34 _inherits(CaptionsButton, _TextTrackButton);
37 * Creates an instance of this class.
39 * @param {Player} player
40 * The `Player` that this class should be attached to.
42 * @param {Object} [options]
43 * The key/value store of player options.
45 * @param {Component~ReadyCallback} [ready]
46 * The function to call when this component is ready.
48 function CaptionsButton(player, options, ready) {
49 _classCallCheck(this, CaptionsButton);
51 var _this = _possibleConstructorReturn(this, _TextTrackButton.call(this, player, options, ready));
53 _this.el_.setAttribute('aria-label', 'Captions Menu');
58 * Builds the default DOM `className`.
61 * The DOM `className` for this object.
65 CaptionsButton.prototype.buildCSSClass = function buildCSSClass() {
66 return 'vjs-captions-button ' + _TextTrackButton.prototype.buildCSSClass.call(this);
70 * Create caption menu items
72 * @return {CaptionSettingsMenuItem[]}
73 * The array of current menu items.
77 CaptionsButton.prototype.createItems = function createItems() {
80 if (!(this.player().tech_ && this.player().tech_.featuresNativeTextTracks)) {
81 items.push(new _captionSettingsMenuItem2['default'](this.player_, { kind: this.kind_ }));
83 this.hideThreshold_ += 1;
86 return _TextTrackButton.prototype.createItems.call(this, items);
89 return CaptionsButton;
90 }(_textTrackButton2['default']);
93 * `kind` of TextTrack to look for to associate it with this menu.
100 CaptionsButton.prototype.kind_ = 'captions';
103 * The text that should display over the `CaptionsButton`s controls. Added for localization.
108 CaptionsButton.prototype.controlText_ = 'Captions';
110 _component2['default'].registerComponent('CaptionsButton', CaptionsButton);
111 exports['default'] = CaptionsButton;