diff options
author | Florian Larysch | 2017-08-07 23:10:01 +0200 |
---|---|---|
committer | Florian Larysch | 2017-08-07 23:10:01 +0200 |
commit | 9b6272bf85d4611ae30971bf92c74c6c16584ab8 (patch) | |
tree | 7b396dc5921428ff82acefef682676ddc53ff72d /assets/clapprio | |
parent | bf49ec2731ee67fafda0e6aa059ca952516b9059 (diff) |
relive: make playback rate adjustable
Diffstat (limited to '')
-rw-r--r-- | assets/clapprio/clappr-playback-rate-plugin.js | 108 | ||||
-rw-r--r-- | assets/clapprio/clappr-playback-rate-plugin.min.js | 17 | ||||
-rw-r--r-- | assets/clapprio/clappr-playback-rate-plugin.min.js.map | 1 |
3 files changed, 126 insertions, 0 deletions
diff --git a/assets/clapprio/clappr-playback-rate-plugin.js b/assets/clapprio/clappr-playback-rate-plugin.js new file mode 100644 index 0000000..12aa80c --- /dev/null +++ b/assets/clapprio/clappr-playback-rate-plugin.js @@ -0,0 +1,108 @@ +(function webpackUniversalModuleDefinition(root, factory) { + if(typeof exports === 'object' && typeof module === 'object') + module.exports = factory(require("Clappr")); + else if(typeof define === 'function' && define.amd) + define(["Clappr"], factory); + else if(typeof exports === 'object') + exports["PlaybackRatePlugin"] = factory(require("Clappr")); + else + root["PlaybackRatePlugin"] = factory(root["Clappr"]); +})(this, function(__WEBPACK_EXTERNAL_MODULE_1__) { +return /******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; + +/******/ // The require function +/******/ function __webpack_require__(moduleId) { + +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) +/******/ return installedModules[moduleId].exports; + +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ exports: {}, +/******/ id: moduleId, +/******/ loaded: false +/******/ }; + +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); + +/******/ // Flag the module as loaded +/******/ module.loaded = true; + +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } + + +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; + +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; + +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = "<%=baseUrl%>/"; + +/******/ // Load entry module and return exports +/******/ return __webpack_require__(0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var _createClass=(function(){function defineProperties(target,props){for(var i=0;i < props.length;i++) {var descriptor=props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if('value' in descriptor)descriptor.writable = true;Object.defineProperty(target,descriptor.key,descriptor);}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor;};})();var _get=function get(_x,_x2,_x3){var _again=true;_function: while(_again) {var object=_x,property=_x2,receiver=_x3;_again = false;if(object === null)object = Function.prototype;var desc=Object.getOwnPropertyDescriptor(object,property);if(desc === undefined){var parent=Object.getPrototypeOf(object);if(parent === null){return undefined;}else {_x = parent;_x2 = property;_x3 = receiver;_again = true;desc = parent = undefined;continue _function;}}else if('value' in desc){return desc.value;}else {var getter=desc.get;if(getter === undefined){return undefined;}return getter.call(receiver);}}};function _interopRequireDefault(obj){return obj && obj.__esModule?obj:{'default':obj};}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError('Cannot call a class as a function');}}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;}var _clappr=__webpack_require__(1);var _publicPlaybackRateSelectorHtml=__webpack_require__(2);var _publicPlaybackRateSelectorHtml2=_interopRequireDefault(_publicPlaybackRateSelectorHtml);var _publicStyleScss=__webpack_require__(3);var _publicStyleScss2=_interopRequireDefault(_publicStyleScss);var DEFAULT_PLAYBACK_RATES=[{value:'0.5',label:'0.5x'},{value:'0.75',label:'0.75x'},{value:'1.0',label:'Normal'},{value:'1.5',label:'1.5x'},{value:'2.0',label:'2x'}];var DEFAULT_PLAYBACK_RATE='1.0';var PlaybackRatePlugin=(function(_UICorePlugin){_inherits(PlaybackRatePlugin,_UICorePlugin);function PlaybackRatePlugin(){_classCallCheck(this,PlaybackRatePlugin);_get(Object.getPrototypeOf(PlaybackRatePlugin.prototype),'constructor',this).apply(this,arguments);}_createClass(PlaybackRatePlugin,[{key:'bindEvents',value:function bindEvents(){this.listenTo(this.core.mediaControl,_clappr.Events.MEDIACONTROL_CONTAINERCHANGED,this.reload);this.listenTo(this.core.mediaControl,_clappr.Events.MEDIACONTROL_RENDERED,this.render);this.listenTo(this.core.mediaControl,_clappr.Events.MEDIACONTROL_HIDE,this.hideContextMenu);this.listenTo(this.core.mediaControl,PlaybackRatePlugin.MEDIACONTROL_PLAYBACKRATE,this.updatePlaybackRate);}},{key:'unBindEvents',value:function unBindEvents(){this.stopListening(this.core.mediaControl,_clappr.Events.MEDIACONTROL_CONTAINERCHANGED);this.stopListening(this.core.mediaControl,_clappr.Events.MEDIACONTROL_RENDERED);this.stopListening(this.core.mediaControl,_clappr.Events.MEDIACONTROL_HIDE);}},{key:'reload',value:function reload(){this.unBindEvents();this.bindEvents();}},{key:'shouldRender',value:function shouldRender(){if(!this.core.getCurrentContainer()){return false;}var currentPlayback=this.core.getCurrentPlayback();if(currentPlayback.tagName != 'video' && currentPlayback.tagName != 'audio'){ //console.warn('PlaybackRatePlugin#shouldRender: Cannot affect rate for playback', currentPlayback); + return false;}return true;}},{key:'render',value:function render(){ //console.log('PlaybackRatePlugin#render()'); + var cfg=this.core.options.playbackRateConfig || {};if(!this.playbackRates){this.playbackRates = cfg.options || DEFAULT_PLAYBACK_RATES;}if(!this.selectedRate){this.selectedRate = cfg.defaultValue || DEFAULT_PLAYBACK_RATE;}if(this.shouldRender()){var t=(0,_clappr.template)(_publicPlaybackRateSelectorHtml2['default']);var html=t({playbackRates:this.playbackRates,title:this.getTitle()});this.$el.html(html);var style=_clappr.Styler.getStyleFor(_publicStyleScss2['default'],{baseUrl:this.core.options.baseUrl});this.$el.append(style);this.core.mediaControl.$('.media-control-right-panel').append(this.el);this.updateText();}return this;}},{key:'onRateSelect',value:function onRateSelect(event){ //console.log('onRateSelect', event.target); + var rate=event.target.dataset.playbackRateSelect;this.setSelectedRate(rate);this.toggleContextMenu();event.stopPropagation();return false;}},{key:'onShowMenu',value:function onShowMenu(event){this.toggleContextMenu();}},{key:'toggleContextMenu',value:function toggleContextMenu(){this.$('.playback_rate ul').toggle();}},{key:'hideContextMenu',value:function hideContextMenu(){this.$('.playback_rate ul').hide();}},{key:'updatePlaybackRate',value:function updatePlaybackRate(rate){this.setSelectedRate(rate);}},{key:'setSelectedRate',value:function setSelectedRate(rate){ // Set <video playbackRate="..." + this.core.$el.find('video').get(0).playbackRate = rate;this.selectedRate = rate;this.updateText();}},{key:'setActiveListItem',value:function setActiveListItem(rateValue){this.$('a').removeClass('active');this.$('a[data-playback-rate-select="' + rateValue + '"]').addClass('active');}},{key:'buttonElement',value:function buttonElement(){return this.$('.playback_rate button');}},{key:'getTitle',value:function getTitle(){var _this=this;var title=this.selectedRate;this.playbackRates.forEach(function(r){if(r.value == _this.selectedRate){title = r.label;}});return title;}},{key:'updateText',value:function updateText(){this.buttonElement().text(this.getTitle());this.setActiveListItem(this.selectedRate);}},{key:'name',get:function get(){return 'playback_rate';}},{key:'template',get:function get(){return (0,_clappr.template)(_publicPlaybackRateSelectorHtml2['default']);}},{key:'attributes',get:function get(){return {'class':this.name,'data-playback-rate-select':''};}},{key:'events',get:function get(){return {'click [data-playback-rate-select]':'onRateSelect','click [data-playback-rate-button]':'onShowMenu'};}}]);return PlaybackRatePlugin;})(_clappr.UICorePlugin);exports['default'] = PlaybackRatePlugin;PlaybackRatePlugin.type = 'core';PlaybackRatePlugin.MEDIACONTROL_PLAYBACKRATE = 'playbackRate';module.exports = exports['default']; + +/***/ }, +/* 1 */ +/***/ function(module, exports) { + + module.exports = __WEBPACK_EXTERNAL_MODULE_1__; + +/***/ }, +/* 2 */ +/***/ function(module, exports) { + + module.exports = "<button data-playback-rate-button>\n <%= title %>\n</button>\n<ul>\n <% for (var i = 0; i < playbackRates.length; i++) { %>\n <li><a href=\"#\" data-playback-rate-select=\"<%= playbackRates[i].value %>\"><%= playbackRates[i].label %></a></li>\n <% }; %>\n</ul>\n"; + +/***/ }, +/* 3 */ +/***/ function(module, exports, __webpack_require__) { + + exports = module.exports = __webpack_require__(4)(); + // imports + + + // module + exports.push([module.id, ".playback_rate[data-playback-rate-select] {\n float: right;\n margin-top: 5px;\n position: relative; }\n .playback_rate[data-playback-rate-select] button {\n background-color: transparent;\n color: #fff;\n font-family: Roboto,\"Open Sans\",Arial,sans-serif;\n -webkit-font-smoothing: antialiased;\n border: none;\n font-size: 10px;\n cursor: pointer; }\n .playback_rate[data-playback-rate-select] button:hover {\n color: #c9c9c9; }\n .playback_rate[data-playback-rate-select] button.changing {\n -webkit-animation: pulse 0.5s infinite alternate; }\n .playback_rate[data-playback-rate-select] > ul {\n display: none;\n list-style-type: none;\n position: absolute;\n bottom: 25px;\n border: 1px solid black;\n border-radius: 4px;\n background-color: rgba(0, 0, 0, 0.7); }\n .playback_rate[data-playback-rate-select] li {\n position: relative;\n font-size: 10px; }\n .playback_rate[data-playback-rate-select] li[data-title] {\n padding: 5px; }\n .playback_rate[data-playback-rate-select] li a {\n color: #aaa;\n padding: 2px 10px 2px 15px;\n display: block;\n text-decoration: none; }\n .playback_rate[data-playback-rate-select] li a.active {\n background-color: black;\n font-weight: bold;\n color: #fff; }\n .playback_rate[data-playback-rate-select] li a.active:before {\n content: '\\2713';\n position: absolute;\n top: 2px;\n left: 4px; }\n .playback_rate[data-playback-rate-select] li a:hover {\n color: #fff;\n text-decoration: none; }\n\n@-webkit-keyframes pulse {\n 0% {\n color: #fff; }\n 50% {\n color: #ff0101; }\n 100% {\n color: #B80000; } }\n", ""]); + + // exports + + +/***/ }, +/* 4 */ +/***/ function(module, exports) { + + /*
+ MIT License http://www.opensource.org/licenses/mit-license.php
+ Author Tobias Koppers @sokra
+ */ // css base code, injected by the css-loader + "use strict";module.exports = function(){var list=[]; // return the list of modules as css string + list.toString = function toString(){var result=[];for(var i=0;i < this.length;i++) {var item=this[i];if(item[2]){result.push("@media " + item[2] + "{" + item[1] + "}");}else {result.push(item[1]);}}return result.join("");}; // import a list of modules into the list + list.i = function(modules,mediaQuery){if(typeof modules === "string")modules = [[null,modules,""]];var alreadyImportedModules={};for(var i=0;i < this.length;i++) {var id=this[i][0];if(typeof id === "number")alreadyImportedModules[id] = true;}for(i = 0;i < modules.length;i++) {var item=modules[i]; // skip already imported module + // this implementation is not 100% perfect for weird media query combinations + // when a module is imported multiple times with different media queries. + // I hope this will never occur (Hey this way we have smaller bundles) + if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]){if(mediaQuery && !item[2]){item[2] = mediaQuery;}else if(mediaQuery){item[2] = "(" + item[2] + ") and (" + mediaQuery + ")";}list.push(item);}}};return list;}; + +/***/ } +/******/ ]) +}); +;
\ No newline at end of file diff --git a/assets/clapprio/clappr-playback-rate-plugin.min.js b/assets/clapprio/clappr-playback-rate-plugin.min.js new file mode 100644 index 0000000..fbb8a93 --- /dev/null +++ b/assets/clapprio/clappr-playback-rate-plugin.min.js @@ -0,0 +1,17 @@ +!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.PlaybackRatePlugin=e(require("Clappr")):t.PlaybackRatePlugin=e(t.Clappr)}(this,function(t){return function(t){function e(n){if(a[n])return a[n].exports;var o=a[n]={exports:{},id:n,loaded:!1};return t[n].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var a={};return e.m=t,e.c=a,e.p="<%=baseUrl%>/",e(0)}([/*!*********************!*\ + !*** ./src/main.js ***! + \*********************/ +function(t,e,a){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(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 i=function(){function t(t,e){for(var a=0;a<e.length;a++){var n=e[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,a,n){return a&&t(e.prototype,a),n&&t(e,n),e}}(),l=function(t,e,a){for(var n=!0;n;){var o=t,r=e,i=a;n=!1,null===o&&(o=Function.prototype);var l=Object.getOwnPropertyDescriptor(o,r);if(void 0!==l){if("value"in l)return l.value;var s=l.get;if(void 0===s)return;return s.call(i)}var c=Object.getPrototypeOf(o);if(null===c)return;t=c,e=r,a=i,n=!0,l=c=void 0}},s=a(1),c=a(2),u=n(c),p=a(3),f=n(p),b=[{value:"0.5",label:"0.5x"},{value:"0.75",label:"0.75x"},{value:"1.0",label:"Normal"},{value:"1.5",label:"1.5x"},{value:"2.0",label:"2x"}],d="1.0",y=function(t){function e(){o(this,e),l(Object.getPrototypeOf(e.prototype),"constructor",this).apply(this,arguments)}return r(e,t),i(e,[{key:"bindEvents",value:function(){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.hideContextMenu),this.listenTo(this.core.mediaControl,e.MEDIACONTROL_PLAYBACKRATE,this.updatePlaybackRate)}},{key:"unBindEvents",value:function(){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)}},{key:"reload",value:function(){this.unBindEvents(),this.bindEvents()}},{key:"shouldRender",value:function(){if(!this.core.getCurrentContainer())return!1;var t=this.core.getCurrentPlayback();return"video"!=t.tagName&&"audio"!=t.tagName?!1:!0}},{key:"render",value:function(){var t=this.core.options.playbackRateConfig||{};if(this.playbackRates||(this.playbackRates=t.options||b),this.selectedRate||(this.selectedRate=t.defaultValue||d),this.shouldRender()){var e=(0,s.template)(u["default"]),a=e({playbackRates:this.playbackRates,title:this.getTitle()});this.$el.html(a);var n=s.Styler.getStyleFor(f["default"],{baseUrl:this.core.options.baseUrl});this.$el.append(n),this.core.mediaControl.$(".media-control-right-panel").append(this.el),this.updateText()}return this}},{key:"onRateSelect",value:function(t){var e=t.target.dataset.playbackRateSelect;return this.setSelectedRate(e),this.toggleContextMenu(),t.stopPropagation(),!1}},{key:"onShowMenu",value:function(t){this.toggleContextMenu()}},{key:"toggleContextMenu",value:function(){this.$(".playback_rate ul").toggle()}},{key:"hideContextMenu",value:function(){this.$(".playback_rate ul").hide()}},{key:"updatePlaybackRate",value:function(t){this.setSelectedRate(t)}},{key:"setSelectedRate",value:function(t){this.core.$el.find("video").get(0).playbackRate=t,this.selectedRate=t,this.updateText()}},{key:"setActiveListItem",value:function(t){this.$("a").removeClass("active"),this.$('a[data-playback-rate-select="'+t+'"]').addClass("active")}},{key:"buttonElement",value:function(){return this.$(".playback_rate button")}},{key:"getTitle",value:function(){var t=this,e=this.selectedRate;return this.playbackRates.forEach(function(a){a.value==t.selectedRate&&(e=a.label)}),e}},{key:"updateText",value:function(){this.buttonElement().text(this.getTitle()),this.setActiveListItem(this.selectedRate)}},{key:"name",get:function(){return"playback_rate"}},{key:"template",get:function(){return(0,s.template)(u["default"])}},{key:"attributes",get:function(){return{"class":this.name,"data-playback-rate-select":""}}},{key:"events",get:function(){return{"click [data-playback-rate-select]":"onRateSelect","click [data-playback-rate-button]":"onShowMenu"}}}]),e}(s.UICorePlugin);e["default"]=y,y.type="core",y.MEDIACONTROL_PLAYBACKRATE="playbackRate",t.exports=e["default"]},/*!*************************!*\ + !*** external "Clappr" ***! + \*************************/ +function(e,a){e.exports=t},/*!************************************************!*\ + !*** ./src/public/playback-rate-selector.html ***! + \************************************************/ +function(t,e){t.exports='<button data-playback-rate-button>\n <%= title %>\n</button>\n<ul>\n <% for (var i = 0; i < playbackRates.length; i++) { %>\n <li><a href="#" data-playback-rate-select="<%= playbackRates[i].value %>"><%= playbackRates[i].label %></a></li>\n <% }; %>\n</ul>\n'},/*!*******************************!*\ + !*** ./src/public/style.scss ***! + \*******************************/ +function(t,e,a){e=t.exports=a(4)(),e.push([t.id,".playback_rate[data-playback-rate-select]{float:right;margin-top:5px;position:relative}.playback_rate[data-playback-rate-select] button{background-color:transparent;color:#fff;font-family:Roboto,Open Sans,Arial,sans-serif;-webkit-font-smoothing:antialiased;border:none;font-size:10px;cursor:pointer}.playback_rate[data-playback-rate-select] button:hover{color:#c9c9c9}.playback_rate[data-playback-rate-select] button.changing{-webkit-animation:pulse .5s infinite alternate}.playback_rate[data-playback-rate-select]>ul{display:none;list-style-type:none;position:absolute;bottom:25px;border:1px solid #000;border-radius:4px;background-color:rgba(0,0,0,.7)}.playback_rate[data-playback-rate-select] li{position:relative;font-size:10px}.playback_rate[data-playback-rate-select] li[data-title]{padding:5px}.playback_rate[data-playback-rate-select] li a{color:#aaa;padding:2px 10px 2px 15px;display:block;text-decoration:none}.playback_rate[data-playback-rate-select] li a.active{background-color:#000;font-weight:700;color:#fff}.playback_rate[data-playback-rate-select] li a.active:before{content:'\\2713';position:absolute;top:2px;left:4px}.playback_rate[data-playback-rate-select] li a:hover{color:#fff;text-decoration:none}@-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 a=this[e];a[2]?t.push("@media "+a[2]+"{"+a[1]+"}"):t.push(a[1])}return t.join("")},t.i=function(e,a){"string"==typeof e&&(e=[[null,e,""]]);for(var n={},o=0;o<this.length;o++){var r=this[o][0];"number"==typeof r&&(n[r]=!0)}for(o=0;o<e.length;o++){var i=e[o];"number"==typeof i[0]&&n[i[0]]||(a&&!i[2]?i[2]=a:a&&(i[2]="("+i[2]+") and ("+a+")"),t.push(i))}},t}}])}); +//# sourceMappingURL=clappr-playback-rate-plugin.min.js.map
\ No newline at end of file diff --git a/assets/clapprio/clappr-playback-rate-plugin.min.js.map b/assets/clapprio/clappr-playback-rate-plugin.min.js.map new file mode 100644 index 0000000..7251266 --- /dev/null +++ b/assets/clapprio/clappr-playback-rate-plugin.min.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///clappr-playback-rate-plugin.min.js","webpack:///webpack/bootstrap 9b75d8829f070623baa9","webpack:///./src/main.js","webpack:///external \"Clappr\"","webpack:///./src/public/playback-rate-selector.html","webpack:///./src/public/style.scss","webpack:///./~/css-loader/lib/css-base.js"],"names":["root","factory","exports","module","require","define","amd","this","__WEBPACK_EXTERNAL_MODULE_1__","modules","__webpack_require__","moduleId","installedModules","id","loaded","call","m","c","p","_interopRequireDefault","obj","__esModule","default","_classCallCheck","instance","Constructor","TypeError","_inherits","subClass","superClass","prototype","Object","create","constructor","value","enumerable","writable","configurable","setPrototypeOf","__proto__","defineProperty","_createClass","defineProperties","target","props","i","length","descriptor","key","protoProps","staticProps","_get","_x","_x2","_x3","_again","object","property","receiver","Function","desc","getOwnPropertyDescriptor","undefined","getter","get","parent","getPrototypeOf","_clappr","_publicPlaybackRateSelectorHtml","_publicPlaybackRateSelectorHtml2","_publicStyleScss","_publicStyleScss2","DEFAULT_PLAYBACK_RATES","label","DEFAULT_PLAYBACK_RATE","PlaybackRatePlugin","_UICorePlugin","apply","arguments","listenTo","core","mediaControl","Events","MEDIACONTROL_CONTAINERCHANGED","reload","MEDIACONTROL_RENDERED","render","MEDIACONTROL_HIDE","hideContextMenu","MEDIACONTROL_PLAYBACKRATE","updatePlaybackRate","stopListening","unBindEvents","bindEvents","getCurrentContainer","currentPlayback","getCurrentPlayback","tagName","cfg","options","playbackRateConfig","playbackRates","selectedRate","defaultValue","shouldRender","t","template","html","title","getTitle","$el","style","Styler","getStyleFor","baseUrl","append","$","el","updateText","event","rate","dataset","playbackRateSelect","setSelectedRate","toggleContextMenu","stopPropagation","toggle","hide","find","playbackRate","rateValue","removeClass","addClass","_this","forEach","r","buttonElement","text","setActiveListItem","class","name","data-playback-rate-select","click [data-playback-rate-select]","click [data-playback-rate-button]","UICorePlugin","type","push","list","toString","result","item","join","mediaQuery","alreadyImportedModules"],"mappings":"CAAA,SAAAA,EAAAC,GACA,gBAAAC,UAAA,gBAAAC,QACAA,OAAAD,QAAAD,EAAAG,QAAA,WACA,kBAAAC,gBAAAC,IACAD,QAAA,UAAAJ,GACA,gBAAAC,SACAA,QAAA,mBAAAD,EAAAG,QAAA,WAEAJ,EAAA,mBAAAC,EAAAD,EAAA,SACCO,KAAA,SAAAC,GACD,MCAgB,UAAUC,GCN1B,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAT,OAGA,IAAAC,GAAAS,EAAAD,IACAT,WACAW,GAAAF,EACAG,QAAA,EAUA,OANAL,GAAAE,GAAAI,KAAAZ,EAAAD,QAAAC,IAAAD,QAAAQ,GAGAP,EAAAW,QAAA,EAGAX,EAAAD,QAvBA,GAAAU,KAqCA,OATAF,GAAAM,EAAAP,EAGAC,EAAAO,EAAAL,EAGAF,EAAAQ,EAAA,gBAGAR,EAAA;;;ADmBM,SAASP,EAAQD,EAASQ,GAE/B,YAAmqC,SAASS,GAAuBC,GAAK,MAAOA,IAAOA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Ef,IAAI,GADAC,MACIxG,EAAI,EAAGA,EAAItC,KAAKuC,OAAQD,IAAK,CACpC,GAAIyG,GAAO/I,KAAKsC,EACbyG,GAAK,GACPD,EAAOH,KAAK,UAAYI,EAAK,GAAK,IAAMA,EAAK,GAAK,KAElDD,EAAOH,KAAKI,EAAK,IAGnB,MAAOD,GAAOE,KAAK,KAIpBJ,EAAKtG,EAAI,SAASpC,EAAS+I,GACJ,gBAAZ/I,KACTA,IAAY,KAAMA,EAAS,KAE5B,KAAI,GADAgJ,MACI5G,EAAI,EAAGA,EAAItC,KAAKuC,OAAQD,IAAK,CACpC,GAAIhC,GAAKN,KAAKsC,GAAG,EACA,iBAAPhC,KACT4I,EAAuB5I,IAAM,GAE/B,IAAIgC,EAAI,EAAGA,EAAIpC,EAAQqC,OAAQD,IAAK,CACnC,GAAIyG,GAAO7I,EAAQoC,EAKG,iBAAZyG,GAAK,IAAoBG,EAAuBH,EAAK,MAC3DE,IAAeF,EAAK,GACtBA,EAAK,GAAKE,EACDA,IACTF,EAAK,GAAK,IAAMA,EAAK,GAAK,UAAYE,EAAa,KAEpDL,EAAKD,KAAKI,MAINH","file":"clappr-playback-rate-plugin.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"Clappr\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"Clappr\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"PlaybackRatePlugin\"] = factory(require(\"Clappr\"));\n\telse\n\t\troot[\"PlaybackRatePlugin\"] = factory(root[\"Clappr\"]);\n})(this, function(__WEBPACK_EXTERNAL_MODULE_1__) {\nreturn \n\n\n/** WEBPACK FOOTER **\n ** webpack/universalModuleDefinition\n **/","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"Clappr\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"Clappr\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"PlaybackRatePlugin\"] = factory(require(\"Clappr\"));\n\telse\n\t\troot[\"PlaybackRatePlugin\"] = factory(root[\"Clappr\"]);\n})(this, function(__WEBPACK_EXTERNAL_MODULE_1__) {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"<%=baseUrl%>/\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/*!*********************!*\\\n !*** ./src/main.js ***!\n \\*********************/\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';Object.defineProperty(exports,'__esModule',{value:true});var _createClass=(function(){function defineProperties(target,props){for(var i=0;i < props.length;i++) {var descriptor=props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if('value' in descriptor)descriptor.writable = true;Object.defineProperty(target,descriptor.key,descriptor);}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor;};})();var _get=function get(_x,_x2,_x3){var _again=true;_function: while(_again) {var object=_x,property=_x2,receiver=_x3;_again = false;if(object === null)object = Function.prototype;var desc=Object.getOwnPropertyDescriptor(object,property);if(desc === undefined){var parent=Object.getPrototypeOf(object);if(parent === null){return undefined;}else {_x = parent;_x2 = property;_x3 = receiver;_again = true;desc = parent = undefined;continue _function;}}else if('value' in desc){return desc.value;}else {var getter=desc.get;if(getter === undefined){return undefined;}return getter.call(receiver);}}};function _interopRequireDefault(obj){return obj && obj.__esModule?obj:{'default':obj};}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError('Cannot call a class as a function');}}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;}var _clappr=__webpack_require__(/*! clappr */ 1);var _publicPlaybackRateSelectorHtml=__webpack_require__(/*! ./public/playback-rate-selector.html */ 2);var _publicPlaybackRateSelectorHtml2=_interopRequireDefault(_publicPlaybackRateSelectorHtml);var _publicStyleScss=__webpack_require__(/*! ./public/style.scss */ 3);var _publicStyleScss2=_interopRequireDefault(_publicStyleScss);var DEFAULT_PLAYBACK_RATES=[{value:'0.5',label:'0.5x'},{value:'0.75',label:'0.75x'},{value:'1.0',label:'Normal'},{value:'1.5',label:'1.5x'},{value:'2.0',label:'2x'}];var DEFAULT_PLAYBACK_RATE='1.0';var PlaybackRatePlugin=(function(_UICorePlugin){_inherits(PlaybackRatePlugin,_UICorePlugin);function PlaybackRatePlugin(){_classCallCheck(this,PlaybackRatePlugin);_get(Object.getPrototypeOf(PlaybackRatePlugin.prototype),'constructor',this).apply(this,arguments);}_createClass(PlaybackRatePlugin,[{key:'bindEvents',value:function bindEvents(){this.listenTo(this.core.mediaControl,_clappr.Events.MEDIACONTROL_CONTAINERCHANGED,this.reload);this.listenTo(this.core.mediaControl,_clappr.Events.MEDIACONTROL_RENDERED,this.render);this.listenTo(this.core.mediaControl,_clappr.Events.MEDIACONTROL_HIDE,this.hideContextMenu);this.listenTo(this.core.mediaControl,PlaybackRatePlugin.MEDIACONTROL_PLAYBACKRATE,this.updatePlaybackRate);}},{key:'unBindEvents',value:function unBindEvents(){this.stopListening(this.core.mediaControl,_clappr.Events.MEDIACONTROL_CONTAINERCHANGED);this.stopListening(this.core.mediaControl,_clappr.Events.MEDIACONTROL_RENDERED);this.stopListening(this.core.mediaControl,_clappr.Events.MEDIACONTROL_HIDE);}},{key:'reload',value:function reload(){this.unBindEvents();this.bindEvents();}},{key:'shouldRender',value:function shouldRender(){if(!this.core.getCurrentContainer()){return false;}var currentPlayback=this.core.getCurrentPlayback();if(currentPlayback.tagName != 'video' && currentPlayback.tagName != 'audio'){ //console.warn('PlaybackRatePlugin#shouldRender: Cannot affect rate for playback', currentPlayback);\n\treturn false;}return true;}},{key:'render',value:function render(){ //console.log('PlaybackRatePlugin#render()');\n\tvar cfg=this.core.options.playbackRateConfig || {};if(!this.playbackRates){this.playbackRates = cfg.options || DEFAULT_PLAYBACK_RATES;}if(!this.selectedRate){this.selectedRate = cfg.defaultValue || DEFAULT_PLAYBACK_RATE;}if(this.shouldRender()){var t=(0,_clappr.template)(_publicPlaybackRateSelectorHtml2['default']);var html=t({playbackRates:this.playbackRates,title:this.getTitle()});this.$el.html(html);var style=_clappr.Styler.getStyleFor(_publicStyleScss2['default'],{baseUrl:this.core.options.baseUrl});this.$el.append(style);this.core.mediaControl.$('.media-control-right-panel').append(this.el);this.updateText();}return this;}},{key:'onRateSelect',value:function onRateSelect(event){ //console.log('onRateSelect', event.target);\n\tvar rate=event.target.dataset.playbackRateSelect;this.setSelectedRate(rate);this.toggleContextMenu();event.stopPropagation();return false;}},{key:'onShowMenu',value:function onShowMenu(event){this.toggleContextMenu();}},{key:'toggleContextMenu',value:function toggleContextMenu(){this.$('.playback_rate ul').toggle();}},{key:'hideContextMenu',value:function hideContextMenu(){this.$('.playback_rate ul').hide();}},{key:'updatePlaybackRate',value:function updatePlaybackRate(rate){this.setSelectedRate(rate);}},{key:'setSelectedRate',value:function setSelectedRate(rate){ // Set <video playbackRate=\"...\"\n\tthis.core.$el.find('video').get(0).playbackRate = rate;this.selectedRate = rate;this.updateText();}},{key:'setActiveListItem',value:function setActiveListItem(rateValue){this.$('a').removeClass('active');this.$('a[data-playback-rate-select=\"' + rateValue + '\"]').addClass('active');}},{key:'buttonElement',value:function buttonElement(){return this.$('.playback_rate button');}},{key:'getTitle',value:function getTitle(){var _this=this;var title=this.selectedRate;this.playbackRates.forEach(function(r){if(r.value == _this.selectedRate){title = r.label;}});return title;}},{key:'updateText',value:function updateText(){this.buttonElement().text(this.getTitle());this.setActiveListItem(this.selectedRate);}},{key:'name',get:function get(){return 'playback_rate';}},{key:'template',get:function get(){return (0,_clappr.template)(_publicPlaybackRateSelectorHtml2['default']);}},{key:'attributes',get:function get(){return {'class':this.name,'data-playback-rate-select':''};}},{key:'events',get:function get(){return {'click [data-playback-rate-select]':'onRateSelect','click [data-playback-rate-button]':'onShowMenu'};}}]);return PlaybackRatePlugin;})(_clappr.UICorePlugin);exports['default'] = PlaybackRatePlugin;PlaybackRatePlugin.type = 'core';PlaybackRatePlugin.MEDIACONTROL_PLAYBACKRATE = 'playbackRate';module.exports = exports['default'];\n\n/***/ },\n/* 1 */\n/*!*************************!*\\\n !*** external \"Clappr\" ***!\n \\*************************/\n/***/ function(module, exports) {\n\n\tmodule.exports = __WEBPACK_EXTERNAL_MODULE_1__;\n\n/***/ },\n/* 2 */\n/*!************************************************!*\\\n !*** ./src/public/playback-rate-selector.html ***!\n \\************************************************/\n/***/ function(module, exports) {\n\n\tmodule.exports = \"<button data-playback-rate-button>\\n <%= title %>\\n</button>\\n<ul>\\n <% for (var i = 0; i < playbackRates.length; i++) { %>\\n <li><a href=\\\"#\\\" data-playback-rate-select=\\\"<%= playbackRates[i].value %>\\\"><%= playbackRates[i].label %></a></li>\\n <% }; %>\\n</ul>\\n\";\n\n/***/ },\n/* 3 */\n/*!*******************************!*\\\n !*** ./src/public/style.scss ***!\n \\*******************************/\n/***/ function(module, exports, __webpack_require__) {\n\n\texports = module.exports = __webpack_require__(/*! ./../../~/css-loader/lib/css-base.js */ 4)();\n\t// imports\n\t\n\t\n\t// module\n\texports.push([module.id, \".playback_rate[data-playback-rate-select]{float:right;margin-top:5px;position:relative}.playback_rate[data-playback-rate-select] button{background-color:transparent;color:#fff;font-family:Roboto,Open Sans,Arial,sans-serif;-webkit-font-smoothing:antialiased;border:none;font-size:10px;cursor:pointer}.playback_rate[data-playback-rate-select] button:hover{color:#c9c9c9}.playback_rate[data-playback-rate-select] button.changing{-webkit-animation:pulse .5s infinite alternate}.playback_rate[data-playback-rate-select]>ul{display:none;list-style-type:none;position:absolute;bottom:25px;border:1px solid #000;border-radius:4px;background-color:rgba(0,0,0,.7)}.playback_rate[data-playback-rate-select] li{position:relative;font-size:10px}.playback_rate[data-playback-rate-select] li[data-title]{padding:5px}.playback_rate[data-playback-rate-select] li a{color:#aaa;padding:2px 10px 2px 15px;display:block;text-decoration:none}.playback_rate[data-playback-rate-select] li a.active{background-color:#000;font-weight:700;color:#fff}.playback_rate[data-playback-rate-select] li a.active:before{content:'\\\\2713';position:absolute;top:2px;left:4px}.playback_rate[data-playback-rate-select] li a:hover{color:#fff;text-decoration:none}@-webkit-keyframes pulse{0%{color:#fff}50%{color:#ff0101}to{color:#b80000}}\", \"\"]);\n\t\n\t// exports\n\n\n/***/ },\n/* 4 */\n/*!**************************************!*\\\n !*** ./~/css-loader/lib/css-base.js ***!\n \\**************************************/\n/***/ function(module, exports) {\n\n\t/*\r\n\t\tMIT License http://www.opensource.org/licenses/mit-license.php\r\n\t\tAuthor Tobias Koppers @sokra\r\n\t*/ // css base code, injected by the css-loader\n\t\"use strict\";module.exports = function(){var list=[]; // return the list of modules as css string\n\tlist.toString = function toString(){var result=[];for(var i=0;i < this.length;i++) {var item=this[i];if(item[2]){result.push(\"@media \" + item[2] + \"{\" + item[1] + \"}\");}else {result.push(item[1]);}}return result.join(\"\");}; // import a list of modules into the list\n\tlist.i = function(modules,mediaQuery){if(typeof modules === \"string\")modules = [[null,modules,\"\"]];var alreadyImportedModules={};for(var i=0;i < this.length;i++) {var id=this[i][0];if(typeof id === \"number\")alreadyImportedModules[id] = true;}for(i = 0;i < modules.length;i++) {var item=modules[i]; // skip already imported module\n\t// this implementation is not 100% perfect for weird media query combinations\n\t// when a module is imported multiple times with different media queries.\n\t// I hope this will never occur (Hey this way we have smaller bundles)\n\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]){if(mediaQuery && !item[2]){item[2] = mediaQuery;}else if(mediaQuery){item[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";}list.push(item);}}};return list;};\n\n/***/ }\n/******/ ])\n});\n;\n\n\n/** WEBPACK FOOTER **\n ** clappr-playback-rate-plugin.min.js\n **/"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"<%=baseUrl%>/\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap 9b75d8829f070623baa9\n **/","import {Events, Styler, UICorePlugin, template} from 'clappr'\nimport pluginHtml from './public/playback-rate-selector.html'\nimport pluginStyle from './public/style.scss'\n\n\nconst DEFAULT_PLAYBACK_RATES = [\n {value: '0.5', label: '0.5x'},\n {value: '0.75', label: '0.75x'},\n {value: '1.0', label: 'Normal'},\n {value: '1.5', label: '1.5x'},\n {value: '2.0', label: '2x'}\n];\n\nconst DEFAULT_PLAYBACK_RATE = '1.0';\n\n\nexport default class PlaybackRatePlugin extends UICorePlugin {\n\n get name() { return 'playback_rate'; }\n get template() { return template(pluginHtml); }\n\n get attributes() {\n return {\n 'class': this.name,\n 'data-playback-rate-select': ''\n }\n }\n\n get events() {\n return {\n 'click [data-playback-rate-select]': 'onRateSelect',\n 'click [data-playback-rate-button]': 'onShowMenu'\n }\n }\n\n bindEvents() {\n this.listenTo(this.core.mediaControl, Events.MEDIACONTROL_CONTAINERCHANGED, this.reload);\n this.listenTo(this.core.mediaControl, Events.MEDIACONTROL_RENDERED, this.render);\n this.listenTo(this.core.mediaControl, Events.MEDIACONTROL_HIDE, this.hideContextMenu);\n this.listenTo(this.core.mediaControl, PlaybackRatePlugin.MEDIACONTROL_PLAYBACKRATE, this.updatePlaybackRate);\n }\n\n unBindEvents() {\n this.stopListening(this.core.mediaControl, Events.MEDIACONTROL_CONTAINERCHANGED);\n this.stopListening(this.core.mediaControl, Events.MEDIACONTROL_RENDERED);\n this.stopListening(this.core.mediaControl, Events.MEDIACONTROL_HIDE);\n }\n\n reload() {\n this.unBindEvents();\n this.bindEvents();\n }\n\n shouldRender() {\n if (!this.core.getCurrentContainer()) {\n return false;\n }\n\n var currentPlayback = this.core.getCurrentPlayback();\n if (currentPlayback.tagName != 'video' && currentPlayback.tagName != 'audio') {\n //console.warn('PlaybackRatePlugin#shouldRender: Cannot affect rate for playback', currentPlayback);\n return false;\n }\n\n return true;\n }\n\n render() {\n //console.log('PlaybackRatePlugin#render()');\n const cfg = this.core.options.playbackRateConfig || {};\n\n if (!this.playbackRates) {\n this.playbackRates = cfg.options || DEFAULT_PLAYBACK_RATES;\n }\n\n if (!this.selectedRate) {\n this.selectedRate = cfg.defaultValue || DEFAULT_PLAYBACK_RATE;\n }\n\n if (this.shouldRender()) {\n var t = template(pluginHtml);\n var html = t({playbackRates: this.playbackRates, title: this.getTitle()});\n this.$el.html(html);\n\n var style = Styler.getStyleFor(pluginStyle, {baseUrl: this.core.options.baseUrl});\n this.$el.append(style);\n\n this.core.mediaControl.$('.media-control-right-panel').append(this.el);\n this.updateText();\n }\n\n return this;\n }\n\n onRateSelect(event) {\n //console.log('onRateSelect', event.target);\n let rate = event.target.dataset.playbackRateSelect;\n this.setSelectedRate(rate);\n this.toggleContextMenu();\n event.stopPropagation();\n return false;\n }\n\n onShowMenu(event) {\n this.toggleContextMenu();\n }\n\n toggleContextMenu() {\n this.$('.playback_rate ul').toggle();\n }\n\n hideContextMenu() {\n this.$('.playback_rate ul').hide();\n }\n\n updatePlaybackRate(rate) {\n this.setSelectedRate(rate);\n }\n\n setSelectedRate(rate) {\n // Set <video playbackRate=\"...\"\n this.core.$el.find('video').get(0).playbackRate = rate;\n this.selectedRate = rate;\n this.updateText();\n }\n\n setActiveListItem(rateValue) {\n this.$(`a`).removeClass('active');\n this.$(`a[data-playback-rate-select=\"${rateValue}\"]`).addClass('active');\n }\n\n buttonElement() {\n return this.$('.playback_rate button');\n }\n\n getTitle() {\n let title = this.selectedRate;\n this.playbackRates.forEach((r) => {\n if (r.value == this.selectedRate) {\n title = r.label;\n }\n });\n return title;\n }\n\n updateText() {\n this.buttonElement().text(this.getTitle());\n this.setActiveListItem(this.selectedRate);\n }\n}\n\nPlaybackRatePlugin.type = 'core';\nPlaybackRatePlugin.MEDIACONTROL_PLAYBACKRATE = 'playbackRate';\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/main.js\n **/","module.exports = __WEBPACK_EXTERNAL_MODULE_1__;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"Clappr\"\n ** module id = 1\n ** module chunks = 0\n **/","module.exports = \"<button data-playback-rate-button>\\n <%= title %>\\n</button>\\n<ul>\\n <% for (var i = 0; i < playbackRates.length; i++) { %>\\n <li><a href=\\\"#\\\" data-playback-rate-select=\\\"<%= playbackRates[i].value %>\\\"><%= playbackRates[i].label %></a></li>\\n <% }; %>\\n</ul>\\n\";\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/public/playback-rate-selector.html\n ** module id = 2\n ** module chunks = 0\n **/","exports = module.exports = require(\"./../../node_modules/css-loader/lib/css-base.js\")();\n// imports\n\n\n// module\nexports.push([module.id, \".playback_rate[data-playback-rate-select]{float:right;margin-top:5px;position:relative}.playback_rate[data-playback-rate-select] button{background-color:transparent;color:#fff;font-family:Roboto,Open Sans,Arial,sans-serif;-webkit-font-smoothing:antialiased;border:none;font-size:10px;cursor:pointer}.playback_rate[data-playback-rate-select] button:hover{color:#c9c9c9}.playback_rate[data-playback-rate-select] button.changing{-webkit-animation:pulse .5s infinite alternate}.playback_rate[data-playback-rate-select]>ul{display:none;list-style-type:none;position:absolute;bottom:25px;border:1px solid #000;border-radius:4px;background-color:rgba(0,0,0,.7)}.playback_rate[data-playback-rate-select] li{position:relative;font-size:10px}.playback_rate[data-playback-rate-select] li[data-title]{padding:5px}.playback_rate[data-playback-rate-select] li a{color:#aaa;padding:2px 10px 2px 15px;display:block;text-decoration:none}.playback_rate[data-playback-rate-select] li a.active{background-color:#000;font-weight:700;color:#fff}.playback_rate[data-playback-rate-select] li a.active:before{content:'\\\\2713';position:absolute;top:2px;left:4px}.playback_rate[data-playback-rate-select] li a:hover{color:#fff;text-decoration:none}@-webkit-keyframes pulse{0%{color:#fff}50%{color:#ff0101}to{color:#b80000}}\", \"\"]);\n\n// exports\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/public/style.scss\n ** module id = 3\n ** module chunks = 0\n **/","/*\r\n\tMIT License http://www.opensource.org/licenses/mit-license.php\r\n\tAuthor Tobias Koppers @sokra\r\n*/\r\n// css base code, injected by the css-loader\r\nmodule.exports = function() {\r\n\tvar list = [];\r\n\r\n\t// return the list of modules as css string\r\n\tlist.toString = function toString() {\r\n\t\tvar result = [];\r\n\t\tfor(var i = 0; i < this.length; i++) {\r\n\t\t\tvar item = this[i];\r\n\t\t\tif(item[2]) {\r\n\t\t\t\tresult.push(\"@media \" + item[2] + \"{\" + item[1] + \"}\");\r\n\t\t\t} else {\r\n\t\t\t\tresult.push(item[1]);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn result.join(\"\");\r\n\t};\r\n\r\n\t// import a list of modules into the list\r\n\tlist.i = function(modules, mediaQuery) {\r\n\t\tif(typeof modules === \"string\")\r\n\t\t\tmodules = [[null, modules, \"\"]];\r\n\t\tvar alreadyImportedModules = {};\r\n\t\tfor(var i = 0; i < this.length; i++) {\r\n\t\t\tvar id = this[i][0];\r\n\t\t\tif(typeof id === \"number\")\r\n\t\t\t\talreadyImportedModules[id] = true;\r\n\t\t}\r\n\t\tfor(i = 0; i < modules.length; i++) {\r\n\t\t\tvar item = modules[i];\r\n\t\t\t// skip already imported module\r\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\r\n\t\t\t// when a module is imported multiple times with different media queries.\r\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\r\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\r\n\t\t\t\tif(mediaQuery && !item[2]) {\r\n\t\t\t\t\titem[2] = mediaQuery;\r\n\t\t\t\t} else if(mediaQuery) {\r\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\r\n\t\t\t\t}\r\n\t\t\t\tlist.push(item);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\treturn list;\r\n};\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./~/css-loader/lib/css-base.js\n **/"],"sourceRoot":""}
\ No newline at end of file |