UNPKG

playable

Version:

Video player based on HTML5Video

88 lines 3.77 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = require("tslib"); var constants_1 = require("../../../constants"); var interaction_indicator_view_1 = (0, tslib_1.__importDefault)(require("./interaction-indicator.view")); var InteractionIndicator = /** @class */ (function () { function InteractionIndicator(_a) { var eventEmitter = _a.eventEmitter, engine = _a.engine, config = _a.config, rootContainer = _a.rootContainer; this._eventEmitter = eventEmitter; this._engine = engine; this._initUI(); this._bindEvents(); rootContainer.appendComponentElement(this.getElement()); if (config.hideMainUI) { this.hide(); } } InteractionIndicator.prototype.getElement = function () { return this.view.getElement(); }; InteractionIndicator.prototype._initUI = function () { this.view = new interaction_indicator_view_1.default(); }; InteractionIndicator.prototype._bindEvents = function () { this._unbindEvents = this._eventEmitter.bindEvents([ [ constants_1.UIEvent.TOGGLE_PLAYBACK_WITH_KEYBOARD, this._showPlaybackChangeIndicator, ], [constants_1.UIEvent.GO_BACKWARD_WITH_KEYBOARD, this.showRewind], [constants_1.UIEvent.GO_FORWARD_WITH_KEYBOARD, this.showForward], [constants_1.UIEvent.INCREASE_VOLUME_WITH_KEYBOARD, this.showIncreaseVolume], [constants_1.UIEvent.DECREASE_VOLUME_WITH_KEYBOARD, this.showDecreaseVolume], [constants_1.UIEvent.MUTE_WITH_KEYBOARD, this.showMute], [constants_1.UIEvent.UNMUTE_WITH_KEYBOARD, this.showIncreaseVolume], ], this); }; InteractionIndicator.prototype.showPause = function () { this.view.activatePauseIcon(); }; InteractionIndicator.prototype.showPlay = function () { this.view.activatePlayIcon(); }; InteractionIndicator.prototype.showRewind = function () { this.view.activateRewindIcon(); }; InteractionIndicator.prototype.showForward = function () { this.view.activateForwardIcon(); }; InteractionIndicator.prototype.showMute = function () { this.view.activateMuteVolumeIcon(); }; InteractionIndicator.prototype.showIncreaseVolume = function () { this.view.activateIncreaseVolumeIcon(); }; InteractionIndicator.prototype.showDecreaseVolume = function () { this.view.activateDecreaseVolumeIcon(); }; InteractionIndicator.prototype.hideIcons = function () { this.view.deactivateIcon(); this._eventEmitter.emitAsync(constants_1.UIEvent.HIDE_INTERACTION_INDICATOR); }; InteractionIndicator.prototype.show = function () { this.view.show(); }; InteractionIndicator.prototype.hide = function () { this.view.hide(); }; InteractionIndicator.prototype._showPlaybackChangeIndicator = function () { var state = this._engine.getCurrentState(); if (state === constants_1.EngineState.PLAY_REQUESTED || state === constants_1.EngineState.PLAYING) { this.view.activatePauseIcon(); } else { this.view.activatePlayIcon(); } }; InteractionIndicator.prototype.destroy = function () { this._unbindEvents(); this.view.destroy(); }; InteractionIndicator.moduleName = 'interactionIndicator'; InteractionIndicator.View = interaction_indicator_view_1.default; InteractionIndicator.dependencies = ['engine', 'eventEmitter', 'config', 'rootContainer']; return InteractionIndicator; }()); exports.default = InteractionIndicator; //# sourceMappingURL=interaction-indicator.js.map