3 exports.__esModule = true;
5 var _component = require('../component');
7 var _component2 = _interopRequireDefault(_component);
9 var _dom = require('../utils/dom.js');
11 var Dom = _interopRequireWildcard(_dom);
13 function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
15 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
17 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
19 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; }
21 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; } /**
22 * @file live-display.js
26 // TODO - Future make it click to snap to live
29 * Displays the live indicator when duration is Infinity.
33 var LiveDisplay = function (_Component) {
34 _inherits(LiveDisplay, _Component);
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 function LiveDisplay(player, options) {
46 _classCallCheck(this, LiveDisplay);
48 var _this = _possibleConstructorReturn(this, _Component.call(this, player, options));
50 _this.updateShowing();
51 _this.on(_this.player(), 'durationchange', _this.updateShowing);
56 * Create the `Component`'s DOM element
59 * The element that was created.
63 LiveDisplay.prototype.createEl = function createEl() {
64 var el = _Component.prototype.createEl.call(this, 'div', {
65 className: 'vjs-live-control vjs-control'
68 this.contentEl_ = Dom.createEl('div', {
69 className: 'vjs-live-display',
70 innerHTML: '<span class="vjs-control-text">' + this.localize('Stream Type') + '</span>' + this.localize('LIVE')
75 el.appendChild(this.contentEl_);
80 * Check the duration to see if the LiveDisplay should be showing or not. Then show/hide
83 * @param {EventTarget~Event} [event]
84 * The {@link Player#durationchange} event that caused this function to run.
86 * @listens Player#durationchange
90 LiveDisplay.prototype.updateShowing = function updateShowing(event) {
91 if (this.player().duration() === Infinity) {
99 }(_component2['default']);
101 _component2['default'].registerComponent('LiveDisplay', LiveDisplay);
102 exports['default'] = LiveDisplay;