diff options
author | MaZderMind | 2018-01-24 23:51:18 +0100 |
---|---|---|
committer | MaZderMind | 2018-01-24 23:51:18 +0100 |
commit | 7f066f2e9c382fe8c12a2a607c4576e1ee38f87c (patch) | |
tree | f36dc1e17fcded998f35562976b47ec47b3d7609 /assets/clapprio/audio-selector.min.js | |
parent | ceaad129176e3ff5dd47b884c024569f474eec5b (diff) | |
parent | f36367abd9b1537b3b01463347d01b186844fbef (diff) |
Merge branch '34c3-cherries'
Diffstat (limited to '')
-rw-r--r-- | assets/clapprio/audio-selector.min.js | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/assets/clapprio/audio-selector.min.js b/assets/clapprio/audio-selector.min.js index 6330076..5e76e5e 100644 --- a/assets/clapprio/audio-selector.min.js +++ b/assets/clapprio/audio-selector.min.js @@ -1,20 +1,20 @@ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("Clappr")):"function"==typeof define&&define.amd?define(["Clappr"],e):"object"==typeof exports?exports.AudioSelector=e(require("Clappr")):t.AudioSelector=e(t.Clappr)}(this,function(t){return function(t){function e(o){if(i[o])return i[o].exports;var n=i[o]={exports:{},id:o,loaded:!1};return t[o].call(n.exports,n,n.exports,e),n.loaded=!0,n.exports}var i={};return e.m=t,e.c=i,e.p="<%=baseUrl%>/",e(0)}([/*!******************!*\ +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("Clappr")):"function"==typeof define&&define.amd?define(["Clappr"],t):"object"==typeof exports?exports.AudioSelector=t(require("Clappr")):e.AudioSelector=t(e.Clappr)}(this,function(e){return function(e){function t(o){if(n[o])return n[o].exports;var i=n[o]={exports:{},id:o,loaded:!1};return e[o].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="<%=baseUrl%>/",t(0)}([/*!******************!*\ !*** ./index.js ***! \******************/ -function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=i(/*! ./src/main.js */1),t.exports=e.default},/*!*********************!*\ +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(t,e,i){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var a=function(){function t(t,e){for(var i=0;i<e.length;i++){var o=e[i];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,i,o){return i&&t(e.prototype,i),o&&t(e,o),e}}(),s=function(t,e,i){for(var o=!0;o;){var n=t,r=e,a=i;o=!1,null===n&&(n=Function.prototype);var s=Object.getOwnPropertyDescriptor(n,r);if(void 0!==s){if("value"in s)return s.value;var l=s.get;if(void 0===l)return;return l.call(a)}var c=Object.getPrototypeOf(n);if(null===c)return;t=c,e=r,i=a,o=!0,s=c=void 0}},l=i(/*! Clappr */2),c=i(/*! ./public/audio-selector.html */3),u=o(c),d=i(/*! ./public/style.scss */4),h=o(d),f=function(t){function e(){n(this,e),s(Object.getPrototypeOf(e.prototype),"constructor",this).apply(this,arguments)}return r(e,t),a(e,[{key:"bindEvents",value:function(){this.listenTo(this.core,l.Events.CORE_READY,this.bindPlaybackEvents),this.listenTo(this.core.mediaControl,l.Events.MEDIACONTROL_CONTAINERCHANGED,this.reload),this.listenTo(this.core.mediaControl,l.Events.MEDIACONTROL_RENDERED,this.render),this.listenTo(this.core.mediaControl,l.Events.MEDIACONTROL_HIDE,this.hideSelectLevelMenu)}},{key:"unBindEvents",value:function(){this.stopListening(this.core,l.Events.CORE_READY),this.stopListening(this.core.mediaControl,l.Events.MEDIACONTROL_CONTAINERCHANGED),this.stopListening(this.core.mediaControl,l.Events.MEDIACONTROL_RENDERED),this.stopListening(this.core.mediaControl,l.Events.MEDIACONTROL_HIDE),this.stopListening(this.core.getCurrentPlayback(),l.Events.PLAYBACK_BITRATE),this.stopListening(this.core.getCurrentPlayback(),l.Events.PLAYBACK_LEVELS_AVAILABLE),this.stopListening(this.core.getCurrentPlayback(),l.Events.PLAYBACK_LEVEL_SWITCH_START),this.stopListening(this.core.getCurrentPlayback(),l.Events.PLAYBACK_LEVEL_SWITCH_END)}},{key:"bindPlaybackEvents",value:function(){var t=this.core.getCurrentPlayback();this.listenTo(t,l.Events.PLAYBACK_BITRATE,this._handleAdaptation),this.listenTo(t,l.Events.PLAYBACK_LEVELS_AVAILABLE,this.fillLevels),this.listenTo(t,l.Events.PLAYBACK_LEVEL_SWITCH_START,this.startLevelSwitch),this.listenTo(t,l.Events.PLAYBACK_LEVEL_SWITCH_END,this.stopLevelSwitch)}},{key:"reload",value:function(){this.unBindEvents(),this.bindEvents(),this.bindPlaybackEvents()}},{key:"shouldRender",value:function(){if(!this.core.getCurrentContainer())return!1;var t=this.core.getCurrentPlayback();if(!t)return!1;var e=!!(this.tracks&&this.tracks.length>1);return e}},{key:"render",value:function(){if(this.shouldRender()){var t=l.Styler.getStyleFor(h.default,{baseUrl:this.core.options.baseUrl});this.$el.html(this.template({tracks:this.tracks,title:this._getTitle()})),this.$el.append(t),this.core.mediaControl.$(".media-control-right-panel").append(this.el),this._highlightCurrentElement()}return this}},{key:"_setAudioTrack",value:function(t){var e=player.core.getCurrentPlayback();this._startTrackSwitch(),this.nextId=t,e.selectTrack(this._getAudioTrack(t)),this.didSwitch||(e.selectTrack(this._getAudioTrack(t)),this.didSwitch=!0)}},{key:"_getAudioTrack",value:function(t){for(var e=0;e<this.tracks.length;e++){var i=this.tracks[e];if(i.id==t)return i}return null}},{key:"_getActiveTrack",value:function(t){for(var e=0;e<t.length;e++)if(t[e].active)return t[e];return null}},{key:"fillLevels",value:function(){var t=player.core.getCurrentPlayback();this.tracks=t.audioTracks,void 0===this.trackId&&(this.trackId=this._getActiveTrack(this.tracks).id),this._setLabels(),this.render()}},{key:"_setLabels",value:function(){this.tracks.forEach(function(t){t.label=t.language})}},{key:"handleTrackSelect",value:function(t){t.preventDefault(),t.stopPropagation();var e=parseInt(t.target.dataset.audioSelectorSelect,10);return this.trackId!=e&&(this._setAudioTrack(e),this._toggleContextMenu(),!1)}},{key:"handleAudioSelectorClick",value:function(t){this._toggleContextMenu()}},{key:"_toggleContextMenu",value:function(){this.$(".audio_selector ul").toggle()}},{key:"hideSelectLevelMenu",value:function(){this.$(".audio_selector ul").hide()}},{key:"_getButtonElement",value:function(){return this.$(".audio_selector button")}},{key:"_getTrackElement",value:function(){var t=arguments.length<=0||void 0===arguments[0]?null:arguments[0];return t?this.$('.audio_selector a[data-audio-selector-select="'+t+'"]'):this.$(".audio_selector a")}},{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:"_updateText",value:function(t){var e=this._getAudioTrack(t);this._getButtonElement().text(e.label)}},{key:"_handleAdaptation",value:function(){if(this.nextId){this.fillLevels();var t=this._getActiveTrack(this.tracks);t.id==this.nextId&&(this.trackId=this.nextId,this.nextId=null,this._stopTrackSwitch(),this._highlightCurrentElement())}}},{key:"_highlightCurrentElement",value:function(){this.trackId&&(this._getTrackElement().removeClass("current"),this._getTrackElement(this.trackId).addClass("current"),this._updateText(this.trackId))}},{key:"name",get:function(){return"audio_selector"}},{key:"template",get:function(){return(0,l.template)(u.default)}},{key:"attributes",get:function(){return{class:this.name,"data-audio-selector":""}}},{key:"events",get:function(){return{"click [data-audio-selector-select]":"handleTrackSelect","click [data-audio-selector-button]":"handleAudioSelectorClick"}}}],[{key:"version",get:function(){return VERSION}}]),e}(l.UICorePlugin);e.default=f,t.exports=e.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(e,i){e.exports=t},/*!****************************************!*\ +function(t,n){t.exports=e},/*!****************************************!*\ !*** ./src/public/audio-selector.html ***! \****************************************/ -function(t,e){t.exports='<button data-audio-selector-button>\n Auto\n</button>\n<ul>\n <% if (title) { %>\n <li data-title><%= title %></li>\n <% }; %>\n <% for (var i = 0; i < tracks.length; i++) { %>\n <li><a href="#" data-audio-selector-select="<%= tracks[i].id %>"><%= tracks[i].label %></a></li>\n <% }; %>\n</ul>\n'},/*!*******************************!*\ +function(e,t){e.exports='<button data-audio-selector-button>\n Language\n</button>\n<ul>\n <% if (title) { %>\n <li data-title><%= title %></li>\n <% }; %>\n <% for (var i = 0; i < languages.length; i++) { %>\n <li><a href="#" data-audio-selector-lang="<%= languages[i] %>"><%= languages[i] %></a></li>\n <% }; %>\n</ul>\n'},/*!*******************************!*\ !*** ./src/public/style.scss ***! \*******************************/ -function(t,e,i){e=t.exports=i(/*! ./../../~/css-loader/lib/css-base.js */5)(),e.push([t.id,".audio_selector[data-audio-selector]{float:right;margin-top:7px;position:relative}.audio_selector[data-audio-selector] button{background-color:transparent;color:#fff;font-family:Roboto,Open Sans,Arial,sans-serif;-webkit-font-smoothing:antialiased;border:none;font-size:12px}.audio_selector[data-audio-selector] button:hover{color:#c9c9c9}.audio_selector[data-audio-selector] button.changing{-webkit-animation:pulse .5s infinite alternate}.audio_selector[data-audio-selector]>ul{list-style-type:none;position:absolute;bottom:25px;border:1px solid #000;display:none;background-color:#e6e6e6}.audio_selector[data-audio-selector] li{font-size:12px}.audio_selector[data-audio-selector] li[data-title]{background-color:#c3c2c2;padding:5px}.audio_selector[data-audio-selector] li a{color:#444;padding:2px 12px;display:block;text-decoration:none}.audio_selector[data-audio-selector] li a:hover{background-color:#555;color:#fff}.audio_selector[data-audio-selector] li a:hover a{color:#fff;text-decoration:none}.audio_selector[data-audio-selector] li.current a{color:red}@-webkit-keyframes pulse{0%{color:#fff}50%{color:#ff0101}to{color:#b80000}}",""])},/*!**************************************!*\ +function(e,t,n){t=e.exports=n(/*! ./../../~/css-loader/lib/css-base.js */5)(),t.push([e.id,".audio_selector[data-audio-selector]{float:right;margin-top:7px;position:relative}.audio_selector[data-audio-selector] button{background-color:transparent;color:#fff;font-family:Roboto,Open Sans,Arial,sans-serif;-webkit-font-smoothing:antialiased;border:none;font-size:12px}.audio_selector[data-audio-selector] button:hover{color:#c9c9c9}.audio_selector[data-audio-selector] button.changing{-webkit-animation:pulse .5s infinite alternate}.audio_selector[data-audio-selector]>ul{list-style-type:none;position:absolute;bottom:25px;border:1px solid #000;display:none;background-color:#e6e6e6}.audio_selector[data-audio-selector] li{font-size:12px}.audio_selector[data-audio-selector] li[data-title]{background-color:#c3c2c2;padding:5px}.audio_selector[data-audio-selector] li a{color:#444;padding:2px 12px;display:block;text-decoration:none}.audio_selector[data-audio-selector] li a:hover{background-color:#555;color:#fff}.audio_selector[data-audio-selector] li a:hover a{color:#fff;text-decoration:none}.audio_selector[data-audio-selector] li.current a{color:red}@-webkit-keyframes pulse{0%{color:#fff}50%{color:#ff0101}to{color:#b80000}}",""])},/*!**************************************!*\ !*** ./~/css-loader/lib/css-base.js ***! \**************************************/ -function(t,e){"use strict";t.exports=function(){var t=[];return t.toString=function(){for(var t=[],e=0;e<this.length;e++){var i=this[e];i[2]?t.push("@media "+i[2]+"{"+i[1]+"}"):t.push(i[1])}return t.join("")},t.i=function(e,i){"string"==typeof e&&(e=[[null,e,""]]);for(var o={},n=0;n<this.length;n++){var r=this[n][0];"number"==typeof r&&(o[r]=!0)}for(n=0;n<e.length;n++){var a=e[n];"number"==typeof a[0]&&o[a[0]]||(i&&!a[2]?a[2]=i:i&&(a[2]="("+a[2]+") and ("+i+")"),t.push(a))}},t}}])}); +function(e,t){"use strict";e.exports=function(){var e=[];return e.toString=function(){for(var e=[],t=0;t<this.length;t++){var n=this[t];n[2]?e.push("@media "+n[2]+"{"+n[1]+"}"):e.push(n[1])}return e.join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var o={},i=0;i<this.length;i++){var a=this[i][0];"number"==typeof a&&(o[a]=!0)}for(i=0;i<t.length;i++){var r=t[i];"number"==typeof r[0]&&o[r[0]]||(n&&!r[2]?r[2]=n:n&&(r[2]="("+r[2]+") and ("+n+")"),e.push(r))}},e}}])}); //# sourceMappingURL=audio-selector.min.js.map
\ No newline at end of file |