aboutsummaryrefslogtreecommitdiff
path: root/assets/clapprio
diff options
context:
space:
mode:
authorAnton Schubert2017-12-23 21:59:23 +0100
committerMaZderMind2018-01-24 23:33:55 +0100
commit317f94d5e3c80f5b342208bad5192a0139a398ea (patch)
tree9b3a55beafb90131bb812f86f7ed87b870ef636c /assets/clapprio
parent80f79007a7ddcfe51b441ff601bdc65e4fa2d40e (diff)
update adaptive player plugins for better hls
Diffstat (limited to '')
-rw-r--r--assets/clapprio/audio-selector.min.js2
-rw-r--r--assets/clapprio/level-selector.min.js2
2 files changed, 2 insertions, 2 deletions
diff --git a/assets/clapprio/audio-selector.min.js b/assets/clapprio/audio-selector.min.js
index 9870f85..5e76e5e 100644
--- a/assets/clapprio/audio-selector.min.js
+++ b/assets/clapprio/audio-selector.min.js
@@ -4,7 +4,7 @@
function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=n(/*! ./src/main.js */1),e.exports=t.default},/*!*********************!*\
!*** ./src/main.js ***!
\*********************/
-function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),l=function(e,t,n){for(var o=!0;o;){var i=e,a=t,r=n;o=!1,null===i&&(i=Function.prototype);var l=Object.getOwnPropertyDescriptor(i,a);if(void 0!==l){if("value"in l)return l.value;var s=l.get;if(void 0===s)return;return s.call(r)}var u=Object.getPrototypeOf(i);if(null===u)return;e=u,t=a,n=r,o=!0,l=u=void 0}},s=n(/*! Clappr */2),u=n(/*! ./public/audio-selector.html */3),c=o(u),d=n(/*! ./public/style.scss */4),h=o(d),g=function(e){function t(){i(this,t),l(Object.getPrototypeOf(t.prototype),"constructor",this).apply(this,arguments)}return a(t,e),r(t,[{key:"bindEvents",value:function(){this.listenTo(this.core,s.Events.CORE_READY,this.bindPlaybackEvents),this.listenTo(this.core.mediaControl,s.Events.MEDIACONTROL_CONTAINERCHANGED,this.reload),this.listenTo(this.core.mediaControl,s.Events.MEDIACONTROL_RENDERED,this.render),this.listenTo(this.core.mediaControl,s.Events.MEDIACONTROL_HIDE,this._hideSelectLevelMenu)}},{key:"unBindEvents",value:function(){this.stopListening(this.core,s.Events.CORE_READY),this.stopListening(this.core.mediaControl,s.Events.MEDIACONTROL_CONTAINERCHANGED),this.stopListening(this.core.mediaControl,s.Events.MEDIACONTROL_RENDERED),this.stopListening(this.core.mediaControl,s.Events.MEDIACONTROL_HIDE),this.stopListening(this.core.getCurrentPlayback(),s.Events.PLAYBACK_BITRATE),this.stopListening(this.core.getCurrentPlayback(),s.Events.PLAYBACK_LEVELS_AVAILABLE),this.stopListening(this.core.getCurrentPlayback(),s.Events.PLAYBACK_LEVEL_SWITCH_START),this.stopListening(this.core.getCurrentPlayback(),s.Events.PLAYBACK_LEVEL_SWITCH_END)}},{key:"bindPlaybackEvents",value:function(){var e=this.core.getCurrentPlayback();this.listenTo(e,s.Events.PLAYBACK_LEVELS_AVAILABLE,this.fillLevels),this.listenTo(e,s.Events.PLAYBACK_LEVEL_SWITCH_START,this.startLevelSwitch),this.listenTo(e,s.Events.PLAYBACK_LEVEL_SWITCH_END,this.stopLevelSwitch),this.listenTo(e,s.Events.PLAYBACK_BITRATE,this.handleAdaptation)}},{key:"reload",value:function(){this.unBindEvents(),this.bindEvents(),this.bindPlaybackEvents()}},{key:"shouldRender",value:function(){if(!this.core.getCurrentContainer())return!1;var e=this.core.getCurrentPlayback();if(!e)return!1;var t=!!(this.languages&&this.languages.length>1);return t}},{key:"render",value:function(){if(this.shouldRender()){var e=s.Styler.getStyleFor(h.default,{baseUrl:this.core.options.baseUrl});this.$el.html(this.template({title:this._getTitle(),languages:this.languages})),this.$el.append(e),this.core.mediaControl.$(".media-control-right-panel").append(this.el),this._highlightCurrentElement()}return this}},{key:"_setLanguage",value:function(e){var t=this.core.getCurrentPlayback();this._startTrackSwitch(),t.selectAudioLanguage(e)}},{key:"_getAudioTrack",value:function(e){for(var t=0;t<this.languages.length;t++){var n=this.languages[t];if(n.id==e)return n}return null}},{key:"fillLevels",value:function(){var e=this.core.getCurrentPlayback();this.languages=e.audioLanguages,this.activeLanguage=this.languages[0],this.render()}},{key:"handleLanguageSelect",value:function(e){e.preventDefault(),e.stopPropagation();var t=e.target.dataset.audioSelectorLang;return this.activeLanguage!=t&&(this._setLanguage(t),this._toggleContextMenu(),!1)}},{key:"handleAdaptation",value:function(e){this.fillLevels(),this.activeLanguage=e.language,this._stopTrackSwitch(),this._highlightCurrentElement()}},{key:"handleAudioSelectorClick",value:function(e){this._toggleContextMenu()}},{key:"_toggleContextMenu",value:function(){this.$(".audio_selector ul").toggle()}},{key:"_hideSelectLevelMenu",value:function(){this.$(".audio_selector ul").hide()}},{key:"_getLanguageElement",value:function(){var e=arguments.length<=0||void 0===arguments[0]?null:arguments[0];return e?this.$('.audio_selector a[data-audio-selector-lang="'+e+'"]'):this.$(".audio_selector a")}},{key:"_getButtonElement",value:function(){return this.$(".audio_selector button")}},{key:"_getTitle",value:function(){return(this.core.options.levelSelectorConfig||{}).title}},{key:"_startTrackSwitch",value:function(){this._getButtonElement().addClass("changing")}},{key:"_stopTrackSwitch",value:function(){this._getButtonElement().removeClass("changing")}},{key:"_highlightCurrentElement",value:function(){this.activeLanguage&&(this._getLanguageElement().removeClass("current"),this._getLanguageElement(this.activeLanguage).addClass("current"),this._getButtonElement().text(this.activeLanguage))}},{key:"name",get:function(){return"audio_selector"}},{key:"template",get:function(){return(0,s.template)(c.default)}},{key:"attributes",get:function(){return{class:this.name,"data-audio-selector":""}}},{key:"events",get:function(){return{"click [data-audio-selector-lang]":"handleLanguageSelect","click [data-audio-selector-button]":"handleAudioSelectorClick"}}}],[{key:"version",get:function(){return VERSION}}]),t}(s.UICorePlugin);t.default=g,e.exports=t.default},/*!*************************!*\
+function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),l=function(e,t,n){for(var o=!0;o;){var i=e,a=t,r=n;o=!1,null===i&&(i=Function.prototype);var l=Object.getOwnPropertyDescriptor(i,a);if(void 0!==l){if("value"in l)return l.value;var s=l.get;if(void 0===s)return;return s.call(r)}var u=Object.getPrototypeOf(i);if(null===u)return;e=u,t=a,n=r,o=!0,l=u=void 0}},s=n(/*! Clappr */2),u=n(/*! ./public/audio-selector.html */3),c=o(u),d=n(/*! ./public/style.scss */4),h=o(d),g=function(e){function t(){i(this,t),l(Object.getPrototypeOf(t.prototype),"constructor",this).apply(this,arguments)}return a(t,e),r(t,[{key:"bindEvents",value:function(){this.listenTo(this.core,s.Events.CORE_READY,this.bindPlaybackEvents),this.listenTo(this.core.mediaControl,s.Events.MEDIACONTROL_CONTAINERCHANGED,this.reload),this.listenTo(this.core.mediaControl,s.Events.MEDIACONTROL_RENDERED,this.render),this.listenTo(this.core.mediaControl,s.Events.MEDIACONTROL_HIDE,this._hideSelectLevelMenu)}},{key:"unBindEvents",value:function(){this.stopListening(this.core,s.Events.CORE_READY),this.stopListening(this.core.mediaControl,s.Events.MEDIACONTROL_CONTAINERCHANGED),this.stopListening(this.core.mediaControl,s.Events.MEDIACONTROL_RENDERED),this.stopListening(this.core.mediaControl,s.Events.MEDIACONTROL_HIDE),this.stopListening(this.core.getCurrentPlayback(),s.Events.PLAYBACK_BITRATE),this.stopListening(this.core.getCurrentPlayback(),s.Events.PLAYBACK_LEVELS_AVAILABLE),this.stopListening(this.core.getCurrentPlayback(),s.Events.PLAYBACK_LEVEL_SWITCH_START),this.stopListening(this.core.getCurrentPlayback(),s.Events.PLAYBACK_LEVEL_SWITCH_END)}},{key:"bindPlaybackEvents",value:function(){var e=this.core.getCurrentPlayback();this.listenTo(e,s.Events.PLAYBACK_LEVELS_AVAILABLE,this.fillLevels),this.listenTo(e,s.Events.PLAYBACK_LEVEL_SWITCH_START,this.startLevelSwitch),this.listenTo(e,s.Events.PLAYBACK_LEVEL_SWITCH_END,this.stopLevelSwitch),this.listenTo(e,s.Events.PLAYBACK_BITRATE,this.handleAdaptation)}},{key:"reload",value:function(){this.unBindEvents(),this.bindEvents(),this.bindPlaybackEvents()}},{key:"shouldRender",value:function(){if(!this.core.getCurrentContainer())return!1;var e=this.core.getCurrentPlayback();if(!e)return!1;var t=!!(this.languages&&this.languages.length>1);return t}},{key:"render",value:function(){if(this.shouldRender()){var e=s.Styler.getStyleFor(h.default,{baseUrl:this.core.options.baseUrl});this.$el.html(this.template({title:this._getTitle(),languages:this.languages})),this.$el.append(e),this.core.mediaControl.$(".media-control-right-panel").append(this.el),this._highlightCurrentElement()}return this}},{key:"_setLanguage",value:function(e){var t=this.core.getCurrentPlayback();this._startTrackSwitch(),t.selectAudioLanguage(e)}},{key:"_getAudioTrack",value:function(e){for(var t=0;t<this.languages.length;t++){var n=this.languages[t];if(n.id==e)return n}return null}},{key:"fillLevels",value:function(){var e=this.core.getCurrentPlayback();this.languages=e.audioLanguages,this.render()}},{key:"handleLanguageSelect",value:function(e){e.preventDefault(),e.stopPropagation();var t=e.target.dataset.audioSelectorLang;return this.activeLanguage!=t&&(this._setLanguage(t),this._toggleContextMenu(),!1)}},{key:"handleAdaptation",value:function(e){this.fillLevels(),this.activeLanguage=e.language,this._stopTrackSwitch(),this._highlightCurrentElement()}},{key:"handleAudioSelectorClick",value:function(e){this._toggleContextMenu()}},{key:"_toggleContextMenu",value:function(){this.$(".audio_selector ul").toggle()}},{key:"_hideSelectLevelMenu",value:function(){this.$(".audio_selector ul").hide()}},{key:"_getLanguageElement",value:function(){var e=arguments.length<=0||void 0===arguments[0]?null:arguments[0];return e?this.$('.audio_selector a[data-audio-selector-lang="'+e+'"]'):this.$(".audio_selector a")}},{key:"_getButtonElement",value:function(){return this.$(".audio_selector button")}},{key:"_getTitle",value:function(){return(this.core.options.levelSelectorConfig||{}).title}},{key:"_startTrackSwitch",value:function(){this._getButtonElement().addClass("changing")}},{key:"_stopTrackSwitch",value:function(){this._getButtonElement().removeClass("changing")}},{key:"_highlightCurrentElement",value:function(){this.activeLanguage&&(this._getLanguageElement().removeClass("current"),this._getLanguageElement(this.activeLanguage).addClass("current"),this._getButtonElement().text(this.activeLanguage))}},{key:"name",get:function(){return"audio_selector"}},{key:"template",get:function(){return(0,s.template)(c.default)}},{key:"attributes",get:function(){return{class:this.name,"data-audio-selector":""}}},{key:"events",get:function(){return{"click [data-audio-selector-lang]":"handleLanguageSelect","click [data-audio-selector-button]":"handleAudioSelectorClick"}}}],[{key:"version",get:function(){return VERSION}}]),t}(s.UICorePlugin);t.default=g,e.exports=t.default},/*!*************************!*\
!*** external "Clappr" ***!
\*************************/
function(t,n){t.exports=e},/*!****************************************!*\
diff --git a/assets/clapprio/level-selector.min.js b/assets/clapprio/level-selector.min.js
index e4310dd..f2583a6 100644
--- a/assets/clapprio/level-selector.min.js
+++ b/assets/clapprio/level-selector.min.js
@@ -4,7 +4,7 @@
function(e,t,l){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=l(/*! ./src/main.js */1),e.exports=t.default},/*!*********************!*\
!*** ./src/main.js ***!
\*********************/
-function(e,t,l){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var l=0;l<t.length;l++){var n=t[l];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,l,n){return l&&e(t.prototype,l),n&&e(t,n),t}}(),s=function(e,t,l){for(var n=!0;n;){var o=e,r=t,i=l;n=!1,null===o&&(o=Function.prototype);var s=Object.getOwnPropertyDescriptor(o,r);if(void 0!==s){if("value"in s)return s.value;var a=s.get;if(void 0===a)return;return a.call(i)}var c=Object.getPrototypeOf(o);if(null===c)return;e=c,t=r,l=i,n=!0,s=c=void 0}},a=l(/*! Clappr */2),c=l(/*! ./public/level-selector.html */3),u=n(c),v=l(/*! ./public/style.scss */4),h=n(v),f=-1,d=function(e){function t(){o(this,t),s(Object.getPrototypeOf(t.prototype),"constructor",this).apply(this,arguments)}return r(t,e),i(t,[{key:"bindEvents",value:function(){this.listenTo(this.core,a.Events.CORE_READY,this.bindPlaybackEvents),this.listenTo(this.core.mediaControl,a.Events.MEDIACONTROL_CONTAINERCHANGED,this.reload),this.listenTo(this.core.mediaControl,a.Events.MEDIACONTROL_RENDERED,this.render),this.listenTo(this.core.mediaControl,a.Events.MEDIACONTROL_HIDE,this.hideSelectLevelMenu)}},{key:"unBindEvents",value:function(){this.stopListening(this.core,a.Events.CORE_READY),this.stopListening(this.core.mediaControl,a.Events.MEDIACONTROL_CONTAINERCHANGED),this.stopListening(this.core.mediaControl,a.Events.MEDIACONTROL_RENDERED),this.stopListening(this.core.mediaControl,a.Events.MEDIACONTROL_HIDE),this.stopListening(this.core.getCurrentPlayback(),a.Events.PLAYBACK_LEVELS_AVAILABLE),this.stopListening(this.core.getCurrentPlayback(),a.Events.PLAYBACK_BITRATE)}},{key:"bindPlaybackEvents",value:function(){var e=this.core.getCurrentPlayback();this.listenTo(e,a.Events.PLAYBACK_LEVELS_AVAILABLE,this.fillLevels),this.listenTo(e,a.Events.PLAYBACK_BITRATE,this.handleAdaptation);var t=e.levels&&e.levels.length>0;t&&this.fillLevels(e.levels)}},{key:"reload",value:function(){this.unBindEvents(),this.bindEvents(),this.bindPlaybackEvents()}},{key:"shouldRender",value:function(){if(!this.core.getCurrentContainer())return!1;var e=this.core.getCurrentPlayback();if(!e)return!1;var t=void 0!==e.currentLevel,l=!!(this.levels&&this.levels.length>1);return t&&l}},{key:"render",value:function(){if(this.shouldRender()){var e=a.Styler.getStyleFor(h.default,{baseUrl:this.core.options.baseUrl});this.$el.html(this.template({levels:this.levels,title:this.getTitle()})),this.$el.append(e),this.core.mediaControl.$(".media-control-right-panel").append(this.el),this.highlightCurrentLevel()}return this}},{key:"fillLevels",value:function(e){var t=arguments.length<=1||void 0===arguments[1]?f:arguments[1];void 0===this.selectedLevelId&&(this.selectedLevelId=t),this.levels=e,this.configureLevelsLabels(),this.render()}},{key:"configureLevelsLabels",value:function(){if(this.levels.forEach(function(e){e.label=e.height+"p"}),void 0!==this.core.options.levelSelectorConfig){var e=this.core.options.levelSelectorConfig.labelCallback;if(e&&"function"!=typeof e)throw new TypeError("labelCallback must be a function");var t=this.core.options.levelSelectorConfig.labels,l=t?this.core.options.levelSelectorConfig.labels:{};if(e||t){var n,o;for(var r in this.levels)n=this.levels[r],o=l[n.id],e?n.label=e(n,o):o&&(n.label=o)}}}},{key:"findLevelBy",value:function(e){var t;return this.levels.forEach(function(l){l.id===e&&(t=l)}),t}},{key:"onLevelSelect",value:function(e){return this.selectedLevelId=parseInt(e.target.dataset.levelSelectorSelect,10),this.core.getCurrentPlayback().currentLevel!=this.selectedLevelId&&(this.core.getCurrentPlayback().currentLevel=this.selectedLevelId,this.toggleContextMenu(),e.stopPropagation(),!1)}},{key:"onShowLevelSelectMenu",value:function(e){this.toggleContextMenu()}},{key:"hideSelectLevelMenu",value:function(){this.$(".level_selector ul").hide()}},{key:"toggleContextMenu",value:function(){this.$(".level_selector ul").toggle()}},{key:"buttonElement",value:function(){return this.$(".level_selector button")}},{key:"levelElement",value:function(e){return this.$(".level_selector ul a"+(isNaN(e)?"":'[data-level-selector-select="'+e+'"]')).parent()}},{key:"getTitle",value:function(){return(this.core.options.levelSelectorConfig||{}).title}},{key:"updateText",value:function(e){e===f?this.buttonElement().text(this.currentLevel?"AUTO ("+this.currentLevel.label+")":"AUTO"):this.buttonElement().text(this.findLevelBy(e).label)}},{key:"handleAdaptation",value:function(e){var t=this.findLevelBy(e.level);this.currentLevel=t?t:null,this.highlightCurrentLevel()}},{key:"highlightCurrentLevel",value:function(){var e=this;this.updateText(this.selectedLevelId),this.levelElement().removeClass("current"),this.currentLevel&&this.levelElement(this.currentLevel.id).addClass("current");var t=this.currentLevel&&this.currentLevel.language;t&&(this.levelElement().removeClass("hidden"),this.levels.forEach(function(l){l.language!=t&&e.levelElement(l.id).addClass("hidden")}))}},{key:"name",get:function(){return"level_selector"}},{key:"template",get:function(){return(0,a.template)(u.default)}},{key:"attributes",get:function(){return{class:this.name,"data-level-selector":""}}},{key:"events",get:function(){return{"click [data-level-selector-select]":"onLevelSelect","click [data-level-selector-button]":"onShowLevelSelectMenu"}}}],[{key:"version",get:function(){return VERSION}}]),t}(a.UICorePlugin);t.default=d,e.exports=t.default},/*!*************************!*\
+function(e,t,l){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var l=0;l<t.length;l++){var n=t[l];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,l,n){return l&&e(t.prototype,l),n&&e(t,n),t}}(),s=function(e,t,l){for(var n=!0;n;){var o=e,r=t,i=l;n=!1,null===o&&(o=Function.prototype);var s=Object.getOwnPropertyDescriptor(o,r);if(void 0!==s){if("value"in s)return s.value;var a=s.get;if(void 0===a)return;return a.call(i)}var c=Object.getPrototypeOf(o);if(null===c)return;e=c,t=r,l=i,n=!0,s=c=void 0}},a=l(/*! Clappr */2),c=l(/*! ./public/level-selector.html */3),u=n(c),v=l(/*! ./public/style.scss */4),h=n(v),f=-1,d=function(e){function t(){o(this,t),s(Object.getPrototypeOf(t.prototype),"constructor",this).apply(this,arguments)}return r(t,e),i(t,[{key:"bindEvents",value:function(){this.listenTo(this.core,a.Events.CORE_READY,this.bindPlaybackEvents),this.listenTo(this.core.mediaControl,a.Events.MEDIACONTROL_CONTAINERCHANGED,this.reload),this.listenTo(this.core.mediaControl,a.Events.MEDIACONTROL_RENDERED,this.render),this.listenTo(this.core.mediaControl,a.Events.MEDIACONTROL_HIDE,this.hideSelectLevelMenu)}},{key:"unBindEvents",value:function(){this.stopListening(this.core,a.Events.CORE_READY),this.stopListening(this.core.mediaControl,a.Events.MEDIACONTROL_CONTAINERCHANGED),this.stopListening(this.core.mediaControl,a.Events.MEDIACONTROL_RENDERED),this.stopListening(this.core.mediaControl,a.Events.MEDIACONTROL_HIDE),this.stopListening(this.core.getCurrentPlayback(),a.Events.PLAYBACK_LEVELS_AVAILABLE),this.stopListening(this.core.getCurrentPlayback(),a.Events.PLAYBACK_BITRATE)}},{key:"bindPlaybackEvents",value:function(){var e=this.core.getCurrentPlayback();this.listenTo(e,a.Events.PLAYBACK_LEVELS_AVAILABLE,this.fillLevels),this.listenTo(e,a.Events.PLAYBACK_BITRATE,this.handleAdaptation);var t=e.levels&&e.levels.length>0;t&&this.fillLevels(e.levels)}},{key:"reload",value:function(){this.unBindEvents(),this.bindEvents(),this.bindPlaybackEvents()}},{key:"shouldRender",value:function(){if(!this.core.getCurrentContainer())return!1;var e=this.core.getCurrentPlayback();if(!e)return!1;var t=void 0!==e.currentLevel,l=!!(this.levels&&this.levels.length>1);return t&&l}},{key:"render",value:function(){if(this.shouldRender()){var e=a.Styler.getStyleFor(h.default,{baseUrl:this.core.options.baseUrl});this.$el.html(this.template({levels:this.levels,title:this.getTitle()})),this.$el.append(e),this.core.mediaControl.$(".media-control-right-panel").append(this.el),this.highlightCurrentLevel()}return this}},{key:"fillLevels",value:function(e){var t=arguments.length<=1||void 0===arguments[1]?f:arguments[1];void 0===this.selectedLevelId&&(this.selectedLevelId=t),this.levels=e,this.configureLevelsLabels(),this.render()}},{key:"configureLevelsLabels",value:function(){if(this.levels.forEach(function(e){e.label=(e.height?e.height:e.level.height)+"p"}),void 0!==this.core.options.levelSelectorConfig){var e=this.core.options.levelSelectorConfig.labelCallback;if(e&&"function"!=typeof e)throw new TypeError("labelCallback must be a function");var t=this.core.options.levelSelectorConfig.labels,l=t?this.core.options.levelSelectorConfig.labels:{};if(e||t){var n,o;for(var r in this.levels)n=this.levels[r],o=l[n.id],e?n.label=e(n,o):o&&(n.label=o)}}}},{key:"findLevelBy",value:function(e){var t;return this.levels.forEach(function(l){l.id===e&&(t=l)}),t}},{key:"onLevelSelect",value:function(e){return this.selectedLevelId=parseInt(e.target.dataset.levelSelectorSelect,10),this.core.getCurrentPlayback().currentLevel!=this.selectedLevelId&&(this.core.getCurrentPlayback().currentLevel=this.selectedLevelId,this.toggleContextMenu(),e.stopPropagation(),!1)}},{key:"onShowLevelSelectMenu",value:function(e){this.toggleContextMenu()}},{key:"hideSelectLevelMenu",value:function(){this.$(".level_selector ul").hide()}},{key:"toggleContextMenu",value:function(){this.$(".level_selector ul").toggle()}},{key:"buttonElement",value:function(){return this.$(".level_selector button")}},{key:"levelElement",value:function(e){return this.$(".level_selector ul a"+(isNaN(e)?"":'[data-level-selector-select="'+e+'"]')).parent()}},{key:"getTitle",value:function(){return(this.core.options.levelSelectorConfig||{}).title}},{key:"updateText",value:function(e){e===f?this.buttonElement().text(this.currentLevel?"AUTO ("+this.currentLevel.label+")":"AUTO"):this.buttonElement().text(this.findLevelBy(e).label)}},{key:"handleAdaptation",value:function(e){var t=this.findLevelBy(e.level);this.currentLevel=t?t:null,this.highlightCurrentLevel()}},{key:"highlightCurrentLevel",value:function(){var e=this;this.updateText(this.selectedLevelId),this.levelElement().removeClass("current"),this.currentLevel&&this.levelElement(this.currentLevel.id).addClass("current");var t=this.currentLevel&&this.currentLevel.language;t&&(this.levelElement().removeClass("hidden"),this.levels.forEach(function(l){l.language!=t&&e.levelElement(l.id).addClass("hidden")}))}},{key:"name",get:function(){return"level_selector"}},{key:"template",get:function(){return(0,a.template)(u.default)}},{key:"attributes",get:function(){return{class:this.name,"data-level-selector":""}}},{key:"events",get:function(){return{"click [data-level-selector-select]":"onLevelSelect","click [data-level-selector-button]":"onShowLevelSelectMenu"}}}],[{key:"version",get:function(){return VERSION}}]),t}(a.UICorePlugin);t.default=d,e.exports=t.default},/*!*************************!*\
!*** external "Clappr" ***!
\*************************/
function(t,l){t.exports=e},/*!****************************************!*\