From fb993840a3e016d7b3ceabdf4b65750cce9ac221 Mon Sep 17 00:00:00 2001 From: Heckyel Date: Sat, 28 Jan 2017 19:00:18 -0500 Subject: Optimization of code --- languages/librevideojs-html5-player-es_ES.po | 2 +- languages/librevideojs-html5-player-ja.po | 2 +- languages/librevideojs-html5-player-pt_PT.po | 2 +- languages/librevideojs-html5-player.pot | 2 +- librevideojs-html5-player.php | 11 +- librevideojs/js/cliplibrejs-playlists.js | 160 --------------------- librevideojs/js/cliplibrejs-playlists.min.js | 28 ---- librevideojs/js/cliplibrejs.dev.min.js | 29 ---- .../selector/video-quality-selector.min.css | 1 - .../selector/video-quality-selector.min.js | 28 ---- 10 files changed, 9 insertions(+), 256 deletions(-) delete mode 100644 librevideojs/js/cliplibrejs-playlists.js delete mode 100644 librevideojs/js/cliplibrejs-playlists.min.js delete mode 100644 librevideojs/js/cliplibrejs.dev.min.js delete mode 100644 librevideojs/selector/video-quality-selector.min.css delete mode 100644 librevideojs/selector/video-quality-selector.min.js diff --git a/languages/librevideojs-html5-player-es_ES.po b/languages/librevideojs-html5-player-es_ES.po index 4add14c..6c422de 100644 --- a/languages/librevideojs-html5-player-es_ES.po +++ b/languages/librevideojs-html5-player-es_ES.po @@ -36,6 +36,6 @@ msgstr "" "Para obtener documentación detallada, por favor visite la página de plugin here." -#: librevideojs-html5-player.php:128 +#: librevideojs-html5-player.php:129 msgid "you need to specify the src of the video file" msgstr "es necesario especificar el src del archivo de vídeo" diff --git a/languages/librevideojs-html5-player-ja.po b/languages/librevideojs-html5-player-ja.po index e594353..4585372 100644 --- a/languages/librevideojs-html5-player-ja.po +++ b/languages/librevideojs-html5-player-ja.po @@ -36,6 +36,6 @@ msgid "" msgstr "" "詳細なドキュメントについては、プラグインのホームページをご覧ください。ここに." -#: librevideojs-html5-player.php:128 +#: librevideojs-html5-player.php:129 msgid "you need to specify the src of the video file" msgstr "あなたはビデオファイルのsrcを指定する必要があります" diff --git a/languages/librevideojs-html5-player-pt_PT.po b/languages/librevideojs-html5-player-pt_PT.po index 2e5fb4a..1442f88 100644 --- a/languages/librevideojs-html5-player-pt_PT.po +++ b/languages/librevideojs-html5-player-pt_PT.po @@ -37,6 +37,6 @@ msgstr "" "Para documentação detalhada, visite a homepage do plugin aqui." -#: librevideojs-html5-player.php:128 +#: librevideojs-html5-player.php:129 msgid "you need to specify the src of the video file" msgstr "Você precisa especificar o src do arquivo de vídeo" diff --git a/languages/librevideojs-html5-player.pot b/languages/librevideojs-html5-player.pot index 82b1919..c11979e 100644 --- a/languages/librevideojs-html5-player.pot +++ b/languages/librevideojs-html5-player.pot @@ -32,6 +32,6 @@ msgid "" "\"_blank\" href=\"%s\">here." msgstr "" -#: librevideojs-html5-player.php:128 +#: librevideojs-html5-player.php:129 msgid "you need to specify the src of the video file" msgstr "" diff --git a/librevideojs-html5-player.php b/librevideojs-html5-player.php index 1d39b60..55d5de1 100644 --- a/librevideojs-html5-player.php +++ b/librevideojs-html5-player.php @@ -94,9 +94,9 @@ function librevideojs_html5_player_enqueue_scripts() { wp_enqueue_style('librevideojs-material-style'); wp_register_style('librevideojs-style', $plugin_url . '/librevideojs-html5-player.css'); wp_enqueue_style('librevideojs-style'); - wp_register_script('librevideojs-selector', $plugin_url . '/librevideojs/selector/video-quality-selector.min.js', true); + wp_register_script('librevideojs-selector', $plugin_url . '/librevideojs/selector/video-quality-selector.js', true); wp_enqueue_script('librevideojs-selector'); - wp_register_style('librevideojs-selector', $plugin_url . '/librevideojs/selector/video-quality-selector.min.css'); + wp_register_style('librevideojs-selector', $plugin_url . '/librevideojs/selector/video-quality-selector.css'); wp_enqueue_style('librevideojs-selector'); } } @@ -123,7 +123,6 @@ function librevideojs_html5_video_embed_handler($atts, $content=null) { 'poster' => '', 'skin' => '', 'class' => '', - ), $atts)); if(empty($url)){ @@ -186,7 +185,7 @@ function librevideojs_html5_video_embed_handler($atts, $content=null) { $track = ""; } - // Calidades + // Qualities if(!is_null( $content = '' )){ $calidades = do_shortcode($content); } @@ -237,7 +236,7 @@ EOT; return $output; } -/*Trayendo los subtitulos mediante [track]*/ +/*Adding subtitles using... [track]*/ function track_shortcode($atts, $content=null){ extract(shortcode_atts(array( 'kind' => '', @@ -276,7 +275,7 @@ function track_shortcode($atts, $content=null){ } add_shortcode('track', 'track_shortcode'); -/*Trayendo las calidades*/ +/*Adding qualities*/ function calidades_shortcode($atts, $content=null){ extract(shortcode_atts(array( 'lvjs_calidad' => '', diff --git a/librevideojs/js/cliplibrejs-playlists.js b/librevideojs/js/cliplibrejs-playlists.js deleted file mode 100644 index bbee6c5..0000000 --- a/librevideojs/js/cliplibrejs-playlists.js +++ /dev/null @@ -1,160 +0,0 @@ -/*! - * - * @source: cliplibrejs-playlist.js - * - * @licstart The following is the entire license notice for the - * JavaScript code in this page. - * - * Copyleft 2016 Heckyel - Cybersy - * - * The JavaScript code in this page is free software: you can - * redistribute it and/or modify it under the terms of the GNU - * General Public License (GNU GPL) as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) - * any later version. The code is distributed WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU GPL for more details. - * - * As additional permission under GNU GPL version 3 section 7, you - * may distribute non-source (e.g., minimized or compacted) forms of - * that code without the copy of the GNU GPL normally required by - * section 4, provided you include this license notice and a URL - * through which recipients can access the Corresponding Source. - * - * @licend The above is the entire license notice - * for the JavaScript code in this page. - * - */ -function playList(options,arg){ - var player = this; - player.pl = player.pl || {}; - var index = parseInt(options,10); - - player.pl._guessVideoType = function(video){ - var videoTypes = { - 'webm' : 'video/webm', - 'ogv' : 'video/ogg', - 'mp4' : 'video/mp4', - }; - var extension = video.split('.').pop(); - - return videoTypes[extension] || ''; - }; - - player.pl.init = function(videos, options) { - options = options || {}; - player.pl.videos = []; - player.pl.current = 0; - player.on('ended', player.pl._videoEnd); - - if (options.getVideoSource) { - player.pl.getVideoSource = options.getVideoSource; - } - - player.pl._addVideos(videos); - }; - - player.pl._updatePoster = function(posterURL) { - player.poster(posterURL); - player.removeChild(player.posterImage); - player.posterImage = player.addChild("posterImage"); - }; - - player.pl._addVideos = function(videos){ - for (var i = 0, length = videos.length; i < length; i++){ - var aux = []; - for (var j = 0, len = videos[i].src.length; j < len; j++){ - aux.push({ - type : player.pl._guessVideoType(videos[i].src[j]), - src : videos[i].src[j] - }); - } - videos[i].src = aux; - player.pl.videos.push(videos[i]); - } - }; - - player.pl._nextPrev = function(func){ - var comparison, addendum; - - if (func === 'next'){ - comparison = player.pl.videos.length -1; - addendum = 1; - } - else { - comparison = 0; - addendum = -1; - } - - if (player.pl.current !== comparison){ - var newIndex = player.pl.current + addendum; - player.pl._setVideo(newIndex); - player.trigger(func, [player.pl.videos[newIndex]]); - } - }; - - player.pl._setVideo = function(index){ - if (index < player.pl.videos.length){ - player.pl.current = index; - player.pl.currentVideo = player.pl.videos[index]; - - if (!player.paused()){ - player.pl._resumeVideo(); - } - - if (player.pl.getVideoSource) { - player.pl.getVideoSource(player.pl.videos[index], function(src, poster) { - player.pl._setVideoSource(src, poster); - }); - } else { - player.pl._setVideoSource(player.pl.videos[index].src, player.pl.videos[index].poster); - } - } - }; - - player.pl._setVideoSource = function(src, poster) { - player.src(src); - player.pl._updatePoster(poster); - }; - - player.pl._resumeVideo = function(){ - player.one('loadstart',function(){ - player.play(); - }); - }; - - player.pl._videoEnd = function(){ - if (player.pl.current === player.pl.videos.length -1){ - player.trigger('lastVideoEnded'); - } - else { - player.pl._resumeVideo(); - player.next(); - } - }; - - if (options instanceof Array){ - player.pl.init(options, arg); - player.pl._setVideo(0); - return player; - } - else if (index === index){ // NaN - player.pl._setVideo(index); - return player; - } - else if (typeof options === 'string' && typeof player.pl[options] !== 'undefined'){ - player.pl[options].apply(player); - return player; - } -} - -cliplibrejs.Player.prototype.next = function(){ - this.pl._nextPrev('next'); - return this; -}; -cliplibrejs.Player.prototype.prev = function(){ - this.pl._nextPrev('prev'); - return this; -}; - -cliplibrejs.plugin('playList', playList); diff --git a/librevideojs/js/cliplibrejs-playlists.min.js b/librevideojs/js/cliplibrejs-playlists.min.js deleted file mode 100644 index 37f8e75..0000000 --- a/librevideojs/js/cliplibrejs-playlists.min.js +++ /dev/null @@ -1,28 +0,0 @@ -/*! - * - * @source: cliplibrejs-playlist.js - * - * @licstart The following is the entire license notice for the - * JavaScript code in this page. - * - * Copyleft 2016 Heckyel - Cybersy - * - * The JavaScript code in this page is free software: you can - * redistribute it and/or modify it under the terms of the GNU - * General Public License (GNU GPL) as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) - * any later version. The code is distributed WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU GPL for more details. - * - * As additional permission under GNU GPL version 3 section 7, you - * may distribute non-source (e.g., minimized or compacted) forms of - * that code without the copy of the GNU GPL normally required by - * section 4, provided you include this license notice and a URL - * through which recipients can access the Corresponding Source. - * - * @licend The above is the entire license notice - * for the JavaScript code in this page. - * - */ -function playList(c,a){var d=this;d.pl=d.pl||{};var b=parseInt(c,10);d.pl._guessVideoType=function(e){var f={webm:"video/webm",ogv:"video/ogg",mp4:"video/mp4",};var g=e.split(".").pop();return f[g]||""};d.pl.init=function(f,e){e=e||{};d.pl.videos=[];d.pl.current=0;d.on("ended",d.pl._videoEnd);if(e.getVideoSource){d.pl.getVideoSource=e.getVideoSource}d.pl._addVideos(f)};d.pl._updatePoster=function(e){d.poster(e);d.removeChild(d.posterImage);d.posterImage=d.addChild("posterImage")};d.pl._addVideos=function(k){for(var h=0,l=k.length;h=0;b--){if(d[b]===a){d.splice(b,1)}}c.className=d.join(" ")};librevjs.TEST_VID=librevjs.createEl("video");librevjs.USER_AGENT=navigator.userAgent;librevjs.IS_IPHONE=(/iPhone/i).test(librevjs.USER_AGENT);librevjs.IS_IPAD=(/iPad/i).test(librevjs.USER_AGENT);librevjs.IS_IPOD=(/iPod/i).test(librevjs.USER_AGENT);librevjs.IS_IOS=librevjs.IS_IPHONE||librevjs.IS_IPAD||librevjs.IS_IPOD;librevjs.IOS_VERSION=(function(){var a=librevjs.USER_AGENT.match(/OS (\d+)_/i);if(a&&a[1]){return a[1]}})();librevjs.IS_ANDROID=(/Android/i).test(librevjs.USER_AGENT);librevjs.ANDROID_VERSION=(function(){var b=librevjs.USER_AGENT.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i),a,c;if(!b){return null}a=b[1]&&parseFloat(b[1]);c=b[2]&&parseFloat(b[2]);if(a&&c){return parseFloat(b[1]+"."+b[2])}else{if(a){return a}else{return null}}})();librevjs.IS_OLD_ANDROID=librevjs.IS_ANDROID&&(/webkit/i).test(librevjs.USER_AGENT)&&librevjs.ANDROID_VERSION<2.3;librevjs.IS_FIREFOX=(/Firefox/i).test(librevjs.USER_AGENT);librevjs.IS_CHROME=(/Chrome/i).test(librevjs.USER_AGENT);librevjs.TOUCH_ENABLED=("ontouchstart" in window);librevjs.getAttributeValues=function(a){var g,b,d,f,c;g={};b=",autoplay,controls,loop,muted,default,";if(a&&a.attributes&&a.attributes.length>0){d=a.attributes;for(var e=d.length-1;e>=0;e--){f=d[e].name;c=d[e].value;if(typeof a[f]==="boolean"||b.indexOf(","+f+",")!==-1){c=(c!==null)?true:false}g[f]=c}}return g};librevjs.getComputedDimension=function(a,b){var c="";if(document.defaultView&&document.defaultView.getComputedStyle){c=document.defaultView.getComputedStyle(a,"").getPropertyValue(b)}else{if(a.currentStyle){c=a["client"+b.substr(0,1).toUpperCase()+b.substr(1)]+"px"}}return c};librevjs.insertFirst=function(b,a){if(a.firstChild){a.insertBefore(b,a.firstChild)}else{a.appendChild(b)}};librevjs.support={};librevjs.el=function(a){if(a.indexOf("#")===0){a=a.slice(1)}return document.getElementById(a)};librevjs.formatTime=function(g,b){b=b||g;var e=Math.floor(g%60),a=Math.floor(g/60%60),d=Math.floor(g/3600),f=Math.floor(b/60%60),c=Math.floor(b/3600);if(isNaN(g)||g===Infinity){d=a=e="-"}d=(d>0||c>0)?d+":":"";a=(((d||f>=10)&&a<10)?"0"+a:a)+":";e=(e<10)?"0"+e:e;return d+a+e};librevjs.blockTextSelection=function(){document.body.focus();document.onselectstart=function(){return false}};librevjs.unblockTextSelection=function(){document.onselectstart=function(){return true}};librevjs.trim=function(a){return(a+"").replace(/^\s+|\s+$/g,"")};librevjs.round=function(a,b){if(!b){b=0}return Math.round(a*Math.pow(10,b))/Math.pow(10,b)};librevjs.createTimeRange=function(b,a){return{length:1,start:function(){return b},end:function(){return a}}};librevjs.get=function(a,g,d){var b,c;if(typeof XMLHttpRequest==="undefined"){window.XMLHttpRequest=function(){try{return new window.ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(k){}try{return new window.ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(j){}try{return new window.ActiveXObject("Msxml2.XMLHTTP")}catch(h){}throw new Error("This browser does not support XMLHttpRequest.")}}c=new XMLHttpRequest();try{c.open("GET",a)}catch(f){d(f)}b=(a.indexOf("file:")===0||(window.location.href.indexOf("file:")===0&&a.indexOf("http")===-1));c.onreadystatechange=function(){if(c.readyState===4){if(c.status===200||b&&c.status===0){g(c.responseText)}else{if(d){d()}}}};try{c.send()}catch(f){if(d){d(f)}}};librevjs.setLocalStorage=function(b,c){try{var a=window.localStorage||false;if(!a){return}a[b]=c}catch(d){if(d.code==22||d.code==1014){librevjs.log("LocalStorage Full (LibreVideoJS)",d)}else{if(d.code==18){librevjs.log("LocalStorage not allowed (LibreVideoJS)",d)}else{librevjs.log("LocalStorage Error (LibreVideoJS)",d)}}}};librevjs.getAbsoluteURL=function(a){if(!a.match(/^https?:\/\//)){a=librevjs.createEl("div",{innerHTML:'x'}).firstChild.href}return a};librevjs.log=function(){librevjs.log.history=librevjs.log.history||[];librevjs.log.history.push(arguments);if(window.console){window.console.log(Array.prototype.slice.call(arguments))}};librevjs.findPosition=function(c){var g,b,h,j,e,d,f,a,k;if(c.getBoundingClientRect&&c.parentNode){g=c.getBoundingClientRect()}if(!g){return{left:0,top:0}}b=document.documentElement;h=document.body;j=b.clientLeft||h.clientLeft||0;e=window.pageXOffset||h.scrollLeft;d=g.left+e-j;f=b.clientTop||h.clientTop||0;a=window.pageYOffset||h.scrollTop;k=g.top+a-f;return{left:d,top:k}};librevjs.Component=librevjs.CoreObject.extend({init:function(b,a,c){this.player_=b;this.options_=librevjs.obj.copy(this.options_);a=this.options(a);this.id_=a.id||((a.el&&a.el["id"])?a.el["id"]:b.id()+"_component_"+librevjs.guid++);this.name_=a.name||null;this.el_=a.el||this.createEl();this.children_=[];this.childIndex_={};this.childNameIndex_={};this.initChildren();this.ready(c)}});librevjs.Component.prototype.dispose=function(){this.trigger("dispose");if(this.children_){for(var a=this.children_.length-1;a>=0;a--){if(this.children_[a].dispose){this.children_[a].dispose()}}}this.children_=null;this.childIndex_=null;this.childNameIndex_=null;this.off();if(this.el_.parentNode){this.el_.parentNode.removeChild(this.el_)}librevjs.removeData(this.el_);this.el_=null};librevjs.Component.prototype.player_;librevjs.Component.prototype.player=function(){return this.player_};librevjs.Component.prototype.options_;librevjs.Component.prototype.options=function(a){if(a===undefined){return this.options_}return this.options_=librevjs.obj.deepMerge(this.options_,a)};librevjs.Component.prototype.el_;librevjs.Component.prototype.createEl=function(b,a){return librevjs.createEl(b,a)};librevjs.Component.prototype.el=function(){return this.el_};librevjs.Component.prototype.contentEl_;librevjs.Component.prototype.contentEl=function(){return this.contentEl_||this.el_};librevjs.Component.prototype.id_;librevjs.Component.prototype.id=function(){return this.id_};librevjs.Component.prototype.name_;librevjs.Component.prototype.name=function(){return this.name_};librevjs.Component.prototype.children_;librevjs.Component.prototype.children=function(){return this.children_};librevjs.Component.prototype.childIndex_;librevjs.Component.prototype.getChildById=function(a){return this.childIndex_[a]};librevjs.Component.prototype.childNameIndex_;librevjs.Component.prototype.getChild=function(a){return this.childNameIndex_[a]};librevjs.Component.prototype.addChild=function(f,d){var c,e,a,b;if(typeof f==="string"){a=f;d=d||{};e=d.componentClass||librevjs.capitalize(a);d.name=a;c=new window.cliplibrejs[e](this.player_||this,d)}else{c=f}this.children_.push(c);if(typeof c.id==="function"){this.childIndex_[c.id()]=c}a=a||(c.name&&c.name());if(a){this.childNameIndex_[a]=c}if(typeof c.el==="function"&&c.el()){this.contentEl().appendChild(c.el())}return c};librevjs.Component.prototype.removeChild=function(b){if(typeof b==="string"){b=this.getChild(b)}if(!b||!this.children_){return}var a=false;for(var c=this.children_.length-1;c>=0;c--){if(this.children_[c]===b){a=true;this.children_.splice(c,1);break}}if(!a){return}this.childIndex_[b.id]=null;this.childNameIndex_[b.name]=null;var d=b.el();if(d&&d.parentNode===this.contentEl()){this.contentEl().removeChild(b.el())}};librevjs.Component.prototype.initChildren=function(){var b=this.options_;if(b&&b.children){var a=this;librevjs.obj.each(b.children,function(d,e){if(e===false){return}var c=function(){a[d]=a.addChild(d,e)};if(e.loadEvent){}else{c()}})}};librevjs.Component.prototype.buildCSSClass=function(){return""};librevjs.Component.prototype.on=function(b,a){librevjs.on(this.el_,b,librevjs.bind(this,a));return this};librevjs.Component.prototype.off=function(b,a){librevjs.off(this.el_,b,a);return this};librevjs.Component.prototype.one=function(b,a){librevjs.one(this.el_,b,librevjs.bind(this,a));return this};librevjs.Component.prototype.trigger=function(a,b){librevjs.trigger(this.el_,a,b);return this};librevjs.Component.prototype.isReady_;librevjs.Component.prototype.isReadyOnInitFinish_=true;librevjs.Component.prototype.readyQueue_;librevjs.Component.prototype.ready=function(a){if(a){if(this.isReady_){a.call(this)}else{if(this.readyQueue_===undefined){this.readyQueue_=[]}this.readyQueue_.push(a)}}return this};librevjs.Component.prototype.triggerReady=function(){this.isReady_=true;var c=this.readyQueue_;if(c&&c.length>0){for(var b=0,a=c.length;b'+(this.buttonText||"Need Text")+"",role:"button","aria-live":"polite",tabIndex:0},a);return librevjs.Component.prototype.createEl.call(this,b,a)};librevjs.Button.prototype.buildCSSClass=function(){return"librevjs-control "+librevjs.Component.prototype.buildCSSClass.call(this)};librevjs.Button.prototype.onClick=function(){};librevjs.Button.prototype.onFocus=function(){librevjs.on(document,"keyup",librevjs.bind(this,this.onKeyPress))};librevjs.Button.prototype.onKeyPress=function(a){if(a.which==32||a.which==13){a.preventDefault();this.onClick()}};librevjs.Button.prototype.onBlur=function(){librevjs.off(document,"keyup",librevjs.bind(this,this.onKeyPress))};librevjs.Slider=librevjs.Component.extend({init:function(b,a){librevjs.Component.call(this,b,a);this.bar=this.getChild(this.options_.barName);this.handle=this.getChild(this.options_.handleName);b.on(this.playerEvent,librevjs.bind(this,this.update));this.on("mousedown",this.onMouseDown);this.on("touchstart",this.onMouseDown);this.on("focus",this.onFocus);this.on("blur",this.onBlur);this.on("click",this.onClick);this.player_.on("controlsvisible",librevjs.bind(this,this.update));b.ready(librevjs.bind(this,this.update));this.boundEvents={}}});librevjs.Slider.prototype.createEl=function(b,a){a=a||{};a.className=a.className+" librevjs-slider";a=librevjs.obj.merge({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100,tabIndex:0},a);return librevjs.Component.prototype.createEl.call(this,b,a)};librevjs.Slider.prototype.onMouseDown=function(a){a.preventDefault();librevjs.blockTextSelection();this.boundEvents.move=librevjs.bind(this,this.onMouseMove);this.boundEvents.end=librevjs.bind(this,this.onMouseUp);librevjs.on(document,"mousemove",this.boundEvents.move);librevjs.on(document,"mouseup",this.boundEvents.end);librevjs.on(document,"touchmove",this.boundEvents.move);librevjs.on(document,"touchend",this.boundEvents.end);this.onMouseMove(a)};librevjs.Slider.prototype.onMouseUp=function(){librevjs.unblockTextSelection();librevjs.off(document,"mousemove",this.boundEvents.move,false);librevjs.off(document,"mouseup",this.boundEvents.end,false);librevjs.off(document,"touchmove",this.boundEvents.move,false);librevjs.off(document,"touchend",this.boundEvents.end,false);this.update()};librevjs.Slider.prototype.update=function(){if(!this.el_){return}var b,a=this.getPercent(),f=this.handle,g=this.bar;if(isNaN(a)){a=0}b=a;if(f){var d=this.el_,e=d.offsetWidth,j=f.el().offsetWidth,k=(j)?j/e:0,c=1-k,h=a*c;b=h+(k/2);f.el().style.left=librevjs.round(h*100,2)+"%"}g.el().style.width=librevjs.round(b*100,2)+"%"};librevjs.Slider.prototype.calculateDistance=function(b){var d,g,m,l,a,j,h,f,e;d=this.el_;g=librevjs.findPosition(d);a=j=d.offsetWidth;h=this.handle;if(this.options_.vertical){l=g.top;if(b.changedTouches){e=b.changedTouches[0].pageY}else{e=b.pageY}if(h){var k=h.el().offsetHeight;l=l+(k/2);j=j-k}return Math.max(0,Math.min(1,((l-e)+j)/j))}else{m=g.left;if(b.changedTouches){f=b.changedTouches[0].pageX}else{f=b.pageX}if(h){var c=h.el().offsetWidth;m=m+(c/2);a=a-c}return Math.max(0,Math.min(1,(f-m)/a))}};librevjs.Slider.prototype.onFocus=function(){librevjs.on(document,"keyup",librevjs.bind(this,this.onKeyPress))};librevjs.Slider.prototype.onKeyPress=function(a){if(a.which==37){a.preventDefault();this.stepBack()}else{if(a.which==39){a.preventDefault();this.stepForward()}}};librevjs.Slider.prototype.onBlur=function(){librevjs.off(document,"keyup",librevjs.bind(this,this.onKeyPress))};librevjs.Slider.prototype.onClick=function(a){a.stopImmediatePropagation();a.preventDefault()};librevjs.SliderHandle=librevjs.Component.extend();librevjs.SliderHandle.prototype.defaultValue=0;librevjs.SliderHandle.prototype.createEl=function(b,a){a=a||{};a.className=a.className+" librevjs-slider-handle";a=librevjs.obj.merge({innerHTML:''+this.defaultValue+""},a);return librevjs.Component.prototype.createEl.call(this,"div",a)};librevjs.Menu=librevjs.Component.extend();librevjs.Menu.prototype.addItem=function(a){this.addChild(a);a.on("click",librevjs.bind(this,function(){this.unlockShowing()}))};librevjs.Menu.prototype.createEl=function(){var b=this.options().contentElType||"ul";this.contentEl_=librevjs.createEl(b,{className:"librevjs-menu-content"});var a=librevjs.Component.prototype.createEl.call(this,"div",{append:this.contentEl_,className:"librevjs-menu"});a.appendChild(this.contentEl_);librevjs.on(a,"click",function(c){c.preventDefault();c.stopImmediatePropagation()});return a};librevjs.MenuItem=librevjs.Button.extend({init:function(b,a){librevjs.Button.call(this,b,a);this.selected(a.selected)}});librevjs.MenuItem.prototype.createEl=function(b,a){return librevjs.Button.prototype.createEl.call(this,"li",librevjs.obj.merge({className:"librevjs-menu-item",innerHTML:this.options_.label},a))};librevjs.MenuItem.prototype.onClick=function(){this.selected(true)};librevjs.MenuItem.prototype.selected=function(a){if(a){this.addClass("librevjs-selected");this.el_.setAttribute("aria-selected",true)}else{this.removeClass("librevjs-selected");this.el_.setAttribute("aria-selected",false)}};librevjs.MenuButton=librevjs.Button.extend({init:function(b,a){librevjs.Button.call(this,b,a);this.menu=this.createMenu();this.addChild(this.menu);if(this.items&&this.items.length===0){this.hide()}this.on("keyup",this.onKeyPress);this.el_.setAttribute("aria-haspopup",true);this.el_.setAttribute("role","button")}});librevjs.MenuButton.prototype.buttonPressed_=false;librevjs.MenuButton.prototype.createMenu=function(){var b=new librevjs.Menu(this.player_);if(this.options().title){b.el().appendChild(librevjs.createEl("li",{className:"librevjs-menu-title",innerHTML:librevjs.capitalize(this.kind_),tabindex:-1}))}this.items=this["createItems"]();if(this.items){for(var a=0;a0){this.items[0].el().focus()}};librevjs.MenuButton.prototype.unpressButton=function(){this.buttonPressed_=false;this.menu.unlockShowing();this.el_.setAttribute("aria-pressed",false)};librevjs.Player=librevjs.Component.extend({init:function(a,b,c){this.tag=a;b=librevjs.obj.merge(this.getTagSettings(a),b);this.cache_={};this.poster_=b.poster;this.controls_=b.controls;a.controls=false;librevjs.Component.call(this,this,b,c);if(this.controls()){this.addClass("librevjs-controls-enabled")}else{this.addClass("librevjs-controls-disabled")}this.one("play",function(g){var d={type:"firstplay",target:this.el_};var f=librevjs.trigger(this.el_,d);if(!f){g.preventDefault();g.stopPropagation();g.stopImmediatePropagation()}});this.on("ended",this.onEnded);this.on("play",this.onPlay);this.on("firstplay",this.onFirstPlay);this.on("pause",this.onPause);this.on("progress",this.onProgress);this.on("durationchange",this.onDurationChange);this.on("error",this.onError);this.on("fullscreenchange",this.onFullscreenChange);librevjs.players[this.id_]=this;if(b.plugins){librevjs.obj.each(b.plugins,function(d,e){this[d](e)},this)}this.listenForUserActivity()}});librevjs.Player.prototype.options_=librevjs.options;librevjs.Player.prototype.dispose=function(){this.trigger("dispose");this.off("dispose");librevjs.players[this.id_]=null;if(this.tag&&this.tag.player){this.tag.player=null}if(this.el_&&this.el_.player){this.el_.player=null}this.stopTrackingProgress();this.stopTrackingCurrentTime();if(this.tech){this.tech.dispose()}librevjs.Component.prototype.dispose.call(this)};librevjs.Player.prototype.getTagSettings=function(a){var d={sources:[],tracks:[]};librevjs.obj.merge(d,librevjs.getAttributeValues(a));if(a.hasChildNodes()){var f,g,b,e,c;f=a.childNodes;for(e=0,c=f.length;e0){c.startTime=this.cache_.currentTime}this.cache_.src=b.src}this.tech=new window.cliplibrejs[d](this,c);this.tech.ready(a)};librevjs.Player.prototype.unloadTech=function(){this.isReady_=false;this.tech.dispose();if(this.manualProgress){this.manualProgressOff()}if(this.manualTimeUpdates){this.manualTimeUpdatesOff()}this.tech=false};librevjs.Player.prototype.manualProgressOn=function(){this.manualProgress=true;this.trackProgress();this.tech.one("progress",function(){this.features.progressEvents=true;this.player_.manualProgressOff()})};librevjs.Player.prototype.manualProgressOff=function(){this.manualProgress=false;this.stopTrackingProgress()};librevjs.Player.prototype.trackProgress=function(){this.progressInterval=setInterval(librevjs.bind(this,function(){if(this.cache_.bufferEnd=0&&c.end(a)!==b){b=c.end(a);this.cache_.bufferEnd=b}return librevjs.createTimeRange(d,b)};librevjs.Player.prototype.bufferedPercent=function(){return(this.duration())?this.buffered().end(0)/this.duration():0};librevjs.Player.prototype.volume=function(a){var b;if(a!==undefined){b=Math.max(0,Math.min(1,parseFloat(a)));this.cache_.volume=b;this.techCall("setVolume",b);librevjs.setLocalStorage("volume",b);return this}b=parseFloat(this.techGet("volume"));return(isNaN(b))?1:b};librevjs.Player.prototype.muted=function(a){if(a!==undefined){this.techCall("setMuted",a);return this}return this.techGet("muted")||false};librevjs.Player.prototype.supportsFullScreen=function(){return this.techGet("supportsFullScreen")||false};librevjs.Player.prototype.requestFullScreen=function(){var a=librevjs.support.requestFullScreen;this.isFullScreen=true;if(a){librevjs.on(document,a.eventName,librevjs.bind(this,function(b){this.isFullScreen=document[a.isFullScreen];if(this.isFullScreen===false){librevjs.off(document,a.eventName,arguments.callee)}this.trigger("fullscreenchange")}));this.el_[a.requestFn]()}else{if(this.tech.supportsFullScreen()){this.techCall("enterFullScreen")}else{this.enterFullWindow();this.trigger("fullscreenchange")}}return this};librevjs.Player.prototype.cancelFullScreen=function(){var a=librevjs.support.requestFullScreen;this.isFullScreen=false;if(a){document[a.cancelFn]()}else{if(this.tech.supportsFullScreen()){this.techCall("exitFullScreen")}else{this.exitFullWindow();this.trigger("fullscreenchange")}}return this};librevjs.Player.prototype.enterFullWindow=function(){this.isFullWindow=true;this.docOrigOverflow=document.documentElement.style.overflow;librevjs.on(document,"keydown",librevjs.bind(this,this.fullWindowOnEscKey));document.documentElement.style.overflow="hidden";librevjs.addClass(document.body,"librevjs-full-window");this.trigger("enterFullWindow")};librevjs.Player.prototype.fullWindowOnEscKey=function(a){if(a.keyCode===27){if(this.isFullScreen===true){this.cancelFullScreen()}else{this.exitFullWindow()}}};librevjs.Player.prototype.exitFullWindow=function(){this.isFullWindow=false;librevjs.off(document,"keydown",this.fullWindowOnEscKey);document.documentElement.style.overflow=this.docOrigOverflow;librevjs.removeClass(document.body,"librevjs-full-window");this.trigger("exitFullWindow")};librevjs.Player.prototype.selectSource=function(g){for(var h=0,f=this.options_.techOrder;hCurrent Time 0:00',"aria-live":"off"});a.appendChild(librevjs.createEl("div").appendChild(this.content));return a};librevjs.CurrentTimeDisplay.prototype.updateContent=function(){var a=(this.player_.scrubbing)?this.player_.getCache().currentTime:this.player_.currentTime();this.content.innerHTML='Current Time '+librevjs.formatTime(a,this.player_.duration())};librevjs.DurationDisplay=librevjs.Component.extend({init:function(b,a){librevjs.Component.call(this,b,a);b.on("timeupdate",librevjs.bind(this,this.updateContent))}});librevjs.DurationDisplay.prototype.createEl=function(){var a=librevjs.Component.prototype.createEl.call(this,"div",{className:"librevjs-duration librevjs-time-controls librevjs-control"});this.content=librevjs.createEl("div",{className:"librevjs-duration-display",innerHTML:'Duration Time 0:00',"aria-live":"off"});a.appendChild(librevjs.createEl("div").appendChild(this.content));return a};librevjs.DurationDisplay.prototype.updateContent=function(){var a=this.player_.duration();if(a){this.content.innerHTML='Duration Time '+librevjs.formatTime(a)}};librevjs.TimeDivider=librevjs.Component.extend({init:function(b,a){librevjs.Component.call(this,b,a)}});librevjs.TimeDivider.prototype.createEl=function(){return librevjs.Component.prototype.createEl.call(this,"div",{className:"librevjs-time-divider",innerHTML:"
/
"})};librevjs.RemainingTimeDisplay=librevjs.Component.extend({init:function(b,a){librevjs.Component.call(this,b,a);b.on("timeupdate",librevjs.bind(this,this.updateContent))}});librevjs.RemainingTimeDisplay.prototype.createEl=function(){var a=librevjs.Component.prototype.createEl.call(this,"div",{className:"librevjs-remaining-time librevjs-time-controls librevjs-control"});this.content=librevjs.createEl("div",{className:"librevjs-remaining-time-display",innerHTML:'Remaining Time -0:00',"aria-live":"off"});a.appendChild(librevjs.createEl("div").appendChild(this.content));return a};librevjs.RemainingTimeDisplay.prototype.updateContent=function(){if(this.player_.duration()){this.content.innerHTML='Remaining Time -'+librevjs.formatTime(this.player_.remainingTime())}};librevjs.FullscreenToggle=librevjs.Button.extend({init:function(b,a){librevjs.Button.call(this,b,a)}});librevjs.FullscreenToggle.prototype.buttonText="Fullscreen";librevjs.FullscreenToggle.prototype.buildCSSClass=function(){return"librevjs-fullscreen-control "+librevjs.Button.prototype.buildCSSClass.call(this)};librevjs.FullscreenToggle.prototype.onClick=function(){if(!this.player_.isFullScreen){this.player_.requestFullScreen();this.el_.children[0].children[0].innerHTML="Non-Fullscreen"}else{this.player_.cancelFullScreen();this.el_.children[0].children[0].innerHTML="Fullscreen"}};librevjs.ProgressControl=librevjs.Component.extend({init:function(b,a){librevjs.Component.call(this,b,a)}});librevjs.ProgressControl.prototype.options_={children:{seekBar:{}}};librevjs.ProgressControl.prototype.createEl=function(){return librevjs.Component.prototype.createEl.call(this,"div",{className:"librevjs-progress-control librevjs-control"})};librevjs.SeekBar=librevjs.Slider.extend({init:function(b,a){librevjs.Slider.call(this,b,a);b.on("timeupdate",librevjs.bind(this,this.updateARIAAttributes));b.ready(librevjs.bind(this,this.updateARIAAttributes))}});librevjs.SeekBar.prototype.options_={children:{loadProgressBar:{},playProgressBar:{},seekHandle:{}},barName:"playProgressBar",handleName:"seekHandle"};librevjs.SeekBar.prototype.playerEvent="timeupdate";librevjs.SeekBar.prototype.createEl=function(){return librevjs.Slider.prototype.createEl.call(this,"div",{className:"librevjs-progress-holder","aria-label":"video progress bar"})};librevjs.SeekBar.prototype.updateARIAAttributes=function(){var a=(this.player_.scrubbing)?this.player_.getCache().currentTime:this.player_.currentTime();this.el_.setAttribute("aria-valuenow",librevjs.round(this.getPercent()*100,2));this.el_.setAttribute("aria-valuetext",librevjs.formatTime(a,this.player_.duration()))};librevjs.SeekBar.prototype.getPercent=function(){var b;if(this.player_.techName==="Flash"&&this.player_.seeking()){var a=this.player_.getCache();if(a.lastSetCurrentTime){b=a.lastSetCurrentTime}else{b=this.player_.currentTime()}}else{b=this.player_.currentTime()}return b/this.player_.duration()};librevjs.SeekBar.prototype.onMouseDown=function(a){librevjs.Slider.prototype.onMouseDown.call(this,a);this.player_.scrubbing=true;this.videoWasPlaying=!this.player_.paused();this.player_.pause()};librevjs.SeekBar.prototype.onMouseMove=function(b){var a=this.calculateDistance(b)*this.player_.duration();if(a==this.player_.duration()){a=a-0.1}this.player_.currentTime(a)};librevjs.SeekBar.prototype.onMouseUp=function(a){librevjs.Slider.prototype.onMouseUp.call(this,a);this.player_.scrubbing=false;if(this.videoWasPlaying){this.player_.play()}};librevjs.SeekBar.prototype.stepForward=function(){this.player_.currentTime(this.player_.currentTime()+5)};librevjs.SeekBar.prototype.stepBack=function(){this.player_.currentTime(this.player_.currentTime()-5)};librevjs.LoadProgressBar=librevjs.Component.extend({init:function(b,a){librevjs.Component.call(this,b,a);b.on("progress",librevjs.bind(this,this.update))}});librevjs.LoadProgressBar.prototype.createEl=function(){return librevjs.Component.prototype.createEl.call(this,"div",{className:"librevjs-load-progress",innerHTML:'Loaded: 0%'})};librevjs.LoadProgressBar.prototype.update=function(){if(this.el_.style){this.el_.style.width=librevjs.round(this.player_.bufferedPercent()*100,2)+"%"}};librevjs.PlayProgressBar=librevjs.Component.extend({init:function(b,a){librevjs.Component.call(this,b,a)}});librevjs.PlayProgressBar.prototype.createEl=function(){return librevjs.Component.prototype.createEl.call(this,"div",{className:"librevjs-play-progress",innerHTML:'Progress: 0%'})};librevjs.SeekHandle=librevjs.SliderHandle.extend();librevjs.SeekHandle.prototype.defaultValue="00:00";librevjs.SeekHandle.prototype.createEl=function(){return librevjs.SliderHandle.prototype.createEl.call(this,"div",{className:"librevjs-seek-handle"})};librevjs.VolumeControl=librevjs.Component.extend({init:function(b,a){librevjs.Component.call(this,b,a);if(b.tech&&b.tech.features&&b.tech.features.volumeControl===false){this.addClass("librevjs-hidden")}b.on("loadstart",librevjs.bind(this,function(){if(b.tech.features&&b.tech.features.volumeControl===false){this.addClass("librevjs-hidden")}else{this.removeClass("librevjs-hidden")}}))}});librevjs.VolumeControl.prototype.options_={children:{volumeBar:{}}};librevjs.VolumeControl.prototype.createEl=function(){return librevjs.Component.prototype.createEl.call(this,"div",{className:"librevjs-volume-control librevjs-control"})};librevjs.VolumeBar=librevjs.Slider.extend({init:function(b,a){librevjs.Slider.call(this,b,a);b.on("volumechange",librevjs.bind(this,this.updateARIAAttributes));b.ready(librevjs.bind(this,this.updateARIAAttributes));setTimeout(librevjs.bind(this,this.update),0)}});librevjs.VolumeBar.prototype.updateARIAAttributes=function(){this.el_.setAttribute("aria-valuenow",librevjs.round(this.player_.volume()*100,2));this.el_.setAttribute("aria-valuetext",librevjs.round(this.player_.volume()*100,2)+"%")};librevjs.VolumeBar.prototype.options_={children:{volumeLevel:{},volumeHandle:{}},barName:"volumeLevel",handleName:"volumeHandle"};librevjs.VolumeBar.prototype.playerEvent="volumechange";librevjs.VolumeBar.prototype.createEl=function(){return librevjs.Slider.prototype.createEl.call(this,"div",{className:"librevjs-volume-bar","aria-label":"volume level"})};librevjs.VolumeBar.prototype.onMouseMove=function(a){this.player_.volume(this.calculateDistance(a))};librevjs.VolumeBar.prototype.getPercent=function(){if(this.player_.muted()){return 0}else{return this.player_.volume()}};librevjs.VolumeBar.prototype.stepForward=function(){this.player_.volume(this.player_.volume()+0.1)};librevjs.VolumeBar.prototype.stepBack=function(){this.player_.volume(this.player_.volume()-0.1)};librevjs.VolumeLevel=librevjs.Component.extend({init:function(b,a){librevjs.Component.call(this,b,a)}});librevjs.VolumeLevel.prototype.createEl=function(){return librevjs.Component.prototype.createEl.call(this,"div",{className:"librevjs-volume-level",innerHTML:''})};librevjs.VolumeHandle=librevjs.SliderHandle.extend();librevjs.VolumeHandle.prototype.defaultValue="00:00";librevjs.VolumeHandle.prototype.createEl=function(){return librevjs.SliderHandle.prototype.createEl.call(this,"div",{className:"librevjs-volume-handle"})};librevjs.MuteToggle=librevjs.Button.extend({init:function(b,a){librevjs.Button.call(this,b,a);b.on("volumechange",librevjs.bind(this,this.update));if(b.tech&&b.tech.features&&b.tech.features.volumeControl===false){this.addClass("librevjs-hidden")}b.on("loadstart",librevjs.bind(this,function(){if(b.tech.features&&b.tech.features.volumeControl===false){this.addClass("librevjs-hidden")}else{this.removeClass("librevjs-hidden")}}))}});librevjs.MuteToggle.prototype.createEl=function(){return librevjs.Button.prototype.createEl.call(this,"div",{className:"librevjs-mute-control librevjs-control",innerHTML:'
Mute
'})};librevjs.MuteToggle.prototype.onClick=function(){this.player_.muted(this.player_.muted()?false:true)};librevjs.MuteToggle.prototype.update=function(){var b=this.player_.volume(),c=3;if(b===0||this.player_.muted()){c=0}else{if(b<0.33){c=1}else{if(b<0.67){c=2}}}if(this.player_.muted()){if(this.el_.children[0].children[0].innerHTML!="Unmute"){this.el_.children[0].children[0].innerHTML="Unmute"}}else{if(this.el_.children[0].children[0].innerHTML!="Mute"){this.el_.children[0].children[0].innerHTML="Mute"}}for(var a=0;a<4;a++){librevjs.removeClass(this.el_,"librevjs-vol-"+a)}librevjs.addClass(this.el_,"librevjs-vol-"+c)};librevjs.VolumeMenuButton=librevjs.MenuButton.extend({init:function(b,a){librevjs.MenuButton.call(this,b,a);b.on("volumechange",librevjs.bind(this,this.update));if(b.tech&&b.tech.features&&b.tech.features.volumeControl===false){this.addClass("librevjs-hidden")}b.on("loadstart",librevjs.bind(this,function(){if(b.tech.features&&b.tech.features.volumeControl===false){this.addClass("librevjs-hidden")}else{this.removeClass("librevjs-hidden")}}));this.addClass("librevjs-menu-button")}});librevjs.VolumeMenuButton.prototype.createMenu=function(){var b=new librevjs.Menu(this.player_,{contentElType:"div"});var a=new librevjs.VolumeBar(this.player_,librevjs.obj.merge({vertical:true},this.options_.volumeBar));b.addChild(a);return b};librevjs.VolumeMenuButton.prototype.onClick=function(){librevjs.MuteToggle.prototype.onClick.call(this);librevjs.MenuButton.prototype.onClick.call(this)};librevjs.VolumeMenuButton.prototype.createEl=function(){return librevjs.Button.prototype.createEl.call(this,"div",{className:"librevjs-volume-menu-button librevjs-menu-button librevjs-control",innerHTML:'
Mute
'})};librevjs.VolumeMenuButton.prototype.update=librevjs.MuteToggle.prototype.update;librevjs.PosterImage=librevjs.Button.extend({init:function(b,a){librevjs.Button.call(this,b,a);if(!b.poster()||!b.controls()){this.hide()}b.on("play",librevjs.bind(this,this.hide))}});librevjs.PosterImage.prototype.createEl=function(){var a=librevjs.createEl("div",{className:"librevjs-poster",tabIndex:-1}),b=this.player_.poster();if(b){if("backgroundSize" in a.style){a.style.backgroundImage='url("'+b+'")'}else{a.appendChild(librevjs.createEl("img",{src:b}))}}return a};librevjs.PosterImage.prototype.onClick=function(){if(this.player().controls()){this.player_.play()}};librevjs.LoadingSpinner=librevjs.Component.extend({init:function(b,a){librevjs.Component.call(this,b,a);b.on("canplay",librevjs.bind(this,this.hide));b.on("canplaythrough",librevjs.bind(this,this.hide));b.on("playing",librevjs.bind(this,this.hide));b.on("seeked",librevjs.bind(this,this.hide));b.on("seeking",librevjs.bind(this,this.show));b.on("seeked",librevjs.bind(this,this.hide));b.on("error",librevjs.bind(this,this.show));b.on("waiting",librevjs.bind(this,this.show))}});librevjs.LoadingSpinner.prototype.createEl=function(){return librevjs.Component.prototype.createEl.call(this,"div",{className:"librevjs-loading-spinner"})};librevjs.BigPlayButton=librevjs.Button.extend();librevjs.BigPlayButton.prototype.createEl=function(){return librevjs.Button.prototype.createEl.call(this,"div",{className:"librevjs-big-play-button",innerHTML:"","aria-label":"play video"})};librevjs.BigPlayButton.prototype.onClick=function(){this.player_.play()};librevjs.MediaTechController=librevjs.Component.extend({init:function(b,a,c){librevjs.Component.call(this,b,a,c);this.initControlsListeners()}});librevjs.MediaTechController.prototype.initControlsListeners=function(){var c,b,a,d;b=this;c=this.player();var a=function(){if(c.controls()&&!c.usingNativeControls()){b.addControlsListeners()}};d=librevjs.bind(b,b.removeControlsListeners);this.ready(a);c.on("controlsenabled",a);c.on("controlsdisabled",d)};librevjs.MediaTechController.prototype.addControlsListeners=function(){var a,b;this.on("mousedown",this.onClick);this.on("touchstart",function(c){c.preventDefault();c.stopPropagation();b=this.player_.userActive()});a=function(c){c.stopPropagation();if(b){this.player_.reportUserActivity()}};this.on("touchmove",a);this.on("touchleave",a);this.on("touchcancel",a);this.on("touchend",a);this.emitTapEvents();this.on("tap",this.onTap)};librevjs.MediaTechController.prototype.removeControlsListeners=function(){this.off("tap");this.off("touchstart");this.off("touchmove");this.off("touchleave");this.off("touchcancel");this.off("touchend");this.off("click");this.off("mousedown")};librevjs.MediaTechController.prototype.onClick=function(a){if(a.button!==0){return}if(this.player().controls()){if(this.player().paused()){this.player().play()}else{this.player().pause()}}};librevjs.MediaTechController.prototype.onTap=function(){this.player().userActive(!this.player().userActive())};librevjs.MediaTechController.prototype.features={volumeControl:true,fullscreenResize:false,progressEvents:false,timeupdateEvents:false};librevjs.media={};librevjs.media.ApiMethods="play,pause,paused,currentTime,setCurrentTime,duration,buffered,volume,setVolume,muted,setMuted,width,height,supportsFullScreen,enterFullScreen,src,load,currentSrc,preload,setPreload,autoplay,setAutoplay,loop,setLoop,error,networkState,readyState,seeking,initialTime,startOffsetTime,played,seekable,ended,videoTracks,audioTracks,videoWidth,videoHeight,textTracks,defaultPlaybackRate,playbackRate,mediaGroup,controller,controls,defaultMuted".split(",");function createMethod(a){return function(){throw new Error('The "'+a+"\" method is not available on the playback technology's API")}}for(var i=librevjs.media.ApiMethods.length-1;i>=0;i--){var methodName=librevjs.media.ApiMethods[i];librevjs.MediaTechController.prototype[librevjs.media.ApiMethods[i]]=createMethod(methodName)}librevjs.Html5=librevjs.MediaTechController.extend({init:function(b,a,c){this.features.volumeControl=librevjs.Html5.canControlVolume();this.features.movingMediaElementInDOM=!librevjs.IS_IOS;this.features.fullscreenResize=true;librevjs.MediaTechController.call(this,b,a,c);var d=a.source;if(d&&this.el_.currentSrc===d.src&&this.el_.networkState>0){b.trigger("loadstart")}else{if(d){this.el_.src=d.src}}if(librevjs.TOUCH_ENABLED&&b.options()["nativeControlsForTouch"]===true){this.useNativeControls()}b.ready(function(){if(this.tag&&this.options_.autoplay&&this.paused()){delete this.tag.poster;this.play()}});this.setupTriggers();this.triggerReady()}});librevjs.Html5.prototype.dispose=function(){librevjs.MediaTechController.prototype.dispose.call(this)};librevjs.Html5.prototype.createEl=function(){var d=this.player_,e=d.tag,f,g;if(!e||this.features.movingMediaElementInDOM===false){if(e){g=e.cloneNode(false);librevjs.Html5.disposeMediaElement(e);e=g;d.tag=null}else{e=librevjs.createEl("video",{id:d.id()+"_html5_api",className:"librevjs-tech"})}e.player=d;librevjs.insertFirst(e,d.el())}var b=["autoplay","preload","loop","muted"];for(var c=b.length-1;c>=0;c--){var a=b[c];if(d.options_[a]!==null){e[a]=d.options_[a]}}return e};librevjs.Html5.prototype.setupTriggers=function(){for(var a=librevjs.Html5.Events.length-1;a>=0;a--){librevjs.on(this.el_,librevjs.Html5.Events[a],librevjs.bind(this.player_,this.eventHandler))}};librevjs.Html5.prototype.eventHandler=function(a){this.trigger(a);a.stopPropagation()};librevjs.Html5.prototype.useNativeControls=function(){var a,b,e,d,c;a=this;b=this.player();a.setControls(b.controls());e=function(){a.setControls(true)};d=function(){a.setControls(false)};b.on("controlsenabled",e);b.on("controlsdisabled",d);c=function(){b.off("controlsenabled",e);b.off("controlsdisabled",d)};a.on("dispose",c);b.on("usingcustomcontrols",c);b.usingNativeControls(true)};librevjs.Html5.prototype.play=function(){this.el_.play()};librevjs.Html5.prototype.pause=function(){this.el_.pause()};librevjs.Html5.prototype.paused=function(){return this.el_.paused};librevjs.Html5.prototype.currentTime=function(){return this.el_.currentTime};librevjs.Html5.prototype.setCurrentTime=function(b){try{this.el_.currentTime=b}catch(a){librevjs.log(a,"Video is not ready. (LibreVideo.js)")}};librevjs.Html5.prototype.duration=function(){return this.el_.duration||0};librevjs.Html5.prototype.buffered=function(){return this.el_.buffered};librevjs.Html5.prototype.volume=function(){return this.el_.volume};librevjs.Html5.prototype.setVolume=function(a){this.el_.volume=a};librevjs.Html5.prototype.muted=function(){return this.el_.muted};librevjs.Html5.prototype.setMuted=function(a){this.el_.muted=a};librevjs.Html5.prototype.width=function(){return this.el_.offsetWidth};librevjs.Html5.prototype.height=function(){return this.el_.offsetHeight};librevjs.Html5.prototype.supportsFullScreen=function(){if(typeof this.el_.webkitEnterFullScreen=="function"){if(/Android/.test(librevjs.USER_AGENT)||!/Chrome|Mac OS X 10.5/.test(librevjs.USER_AGENT)){return true}}return false};librevjs.Html5.prototype.enterFullScreen=function(){var a=this.el_;if(a.paused&&a.networkState<=a.HAVE_METADATA){this.el_.play();setTimeout(function(){a.pause();a.webkitEnterFullScreen()},0)}else{a.webkitEnterFullScreen()}};librevjs.Html5.prototype.exitFullScreen=function(){this.el_.webkitExitFullScreen()};librevjs.Html5.prototype.src=function(a){this.el_.src=a};librevjs.Html5.prototype.load=function(){this.el_.load()};librevjs.Html5.prototype.currentSrc=function(){return this.el_.currentSrc};librevjs.Html5.prototype.preload=function(){return this.el_.preload};librevjs.Html5.prototype.setPreload=function(a){this.el_.preload=a};librevjs.Html5.prototype.autoplay=function(){return this.el_.autoplay};librevjs.Html5.prototype.setAutoplay=function(a){this.el_.autoplay=a};librevjs.Html5.prototype.controls=function(){return this.el_.controls};librevjs.Html5.prototype.setControls=function(a){this.el_.controls=!!a};librevjs.Html5.prototype.loop=function(){return this.el_.loop};librevjs.Html5.prototype.setLoop=function(a){this.el_.loop=a};librevjs.Html5.prototype.error=function(){return this.el_.error};librevjs.Html5.prototype.seeking=function(){return this.el_.seeking};librevjs.Html5.prototype.ended=function(){return this.el_.ended};librevjs.Html5.prototype.defaultMuted=function(){return this.el_.defaultMuted};librevjs.Html5.isSupported=function(){return !!librevjs.TEST_VID.canPlayType};librevjs.Html5.canPlaySource=function(a){try{return !!librevjs.TEST_VID.canPlayType(a.type)}catch(b){return""}};librevjs.Html5.canControlVolume=function(){var a=librevjs.TEST_VID.volume;librevjs.TEST_VID.volume=(a/2)+0.1;return a!==librevjs.TEST_VID.volume};librevjs.Html5.Events="loadstart,suspend,abort,error,emptied,stalled,loadedmetadata,loadeddata,canplay,canplaythrough,playing,waiting,seeking,seeked,ended,durationchange,timeupdate,progress,play,pause,ratechange,volumechange".split(",");librevjs.Html5.disposeMediaElement=function(a){if(!a){return}a.player=null;if(a.parentNode){a.parentNode.removeChild(a)}while(a.hasChildNodes()){a.removeChild(a.firstChild)}a.removeAttribute("src");if(typeof a.load==="function"){a.load()}};if(librevjs.IS_OLD_ANDROID){document.createElement("video").constructor.prototype.canPlayType=function(a){return(a&&a.toLowerCase().indexOf("video/mp4")!=-1)?"maybe":""}}librevjs.Flash=librevjs.MediaTechController.extend({init:function(m,n,k){librevjs.MediaTechController.call(this,m,n,k);var a=n.source,h=n.parentEl,l=this.el_=librevjs.createEl("div",{id:m.id()+"_temp_flash"}),b=m.id()+"_flash_api",c=m.options_,j=librevjs.obj.merge({readyFunction:"cliplibrejs.Flash.onReady",eventProxyFunction:"cliplibrejs.Flash.onEvent",errorEventProxyFunction:"cliplibrejs.Flash.onError",autoplay:c.autoplay,preload:c.preload,loop:c.loop,muted:c.muted},n.flashVars),d=librevjs.obj.merge({wmode:"opaque",bgcolor:"#000000"},n.params),f=librevjs.obj.merge({id:b,name:b,"class":"librevjs-tech"},n.attributes);if(a){if(a.type&&librevjs.Flash.isStreamingType(a.type)){var e=librevjs.Flash.streamToParts(a.src);j.rtmpConnection=encodeURIComponent(e.connection);j.rtmpStream=encodeURIComponent(e.stream)}else{j.src=encodeURIComponent(librevjs.getAbsoluteURL(a.src))}}librevjs.insertFirst(l,h);if(n.startTime){this.ready(function(){this.load();this.play();this.currentTime(n.startTime)})}if(n.iFrameMode===true&&!librevjs.IS_FIREFOX){var g=librevjs.createEl("iframe",{id:b+"_iframe",name:b+"_iframe",className:"librevjs-tech",scrolling:"no",marginWidth:0,marginHeight:0,frameBorder:0});j.readyFunction="ready";j.eventProxyFunction="events";j.errorEventProxyFunction="errors";librevjs.on(g,"load",librevjs.bind(this,function(){var p,o=g.contentWindow;p=g.contentDocument?g.contentDocument:g.contentWindow.document;p.write(librevjs.Flash.getEmbedCode(n.swf,j,d,f));o.player=this.player_;o.ready=librevjs.bind(this.player_,function(r){var t=p.getElementById(r),s=this,q=s.tech;q.el_=t;librevjs.Flash.checkReady(q)});o.events=librevjs.bind(this.player_,function(r,q){var s=this;if(s&&s.techName==="flash"){s.trigger(q)}});o.errors=librevjs.bind(this.player_,function(r,q){librevjs.log("Flash Error",q)})}));l.parentNode.replaceChild(g,l)}else{librevjs.Flash.embed(n.swf,l,j,d,f)}}});librevjs.Flash.prototype.dispose=function(){librevjs.MediaTechController.prototype.dispose.call(this)};librevjs.Flash.prototype.play=function(){this.el_.librevjs_play()};librevjs.Flash.prototype.pause=function(){this.el_.librevjs_pause()};librevjs.Flash.prototype.src=function(b){if(librevjs.Flash.isStreamingSrc(b)){b=librevjs.Flash.streamToParts(b);this.setRtmpConnection(b.connection);this.setRtmpStream(b.stream)}else{b=librevjs.getAbsoluteURL(b);this.el_.librevjs_src(b)}if(this.player_.autoplay()){var a=this;setTimeout(function(){a.play()},0)}};librevjs.Flash.prototype.currentSrc=function(){var c=this.el_.librevjs_getProperty("currentSrc");if(c==null){var a=this.rtmpConnection(),b=this.rtmpStream();if(a&&b){c=librevjs.Flash.streamFromParts(a,b)}}return c};librevjs.Flash.prototype.load=function(){this.el_.librevjs_load()};librevjs.Flash.prototype.poster=function(){this.el_.librevjs_getProperty("poster")};librevjs.Flash.prototype.buffered=function(){return librevjs.createTimeRange(0,this.el_.librevjs_getProperty("buffered"))};librevjs.Flash.prototype.supportsFullScreen=function(){return false};librevjs.Flash.prototype.enterFullScreen=function(){return false};var api=librevjs.Flash.prototype,readWrite="rtmpConnection,rtmpStream,preload,currentTime,defaultPlaybackRate,playbackRate,autoplay,loop,mediaGroup,controller,controls,volume,muted,defaultMuted".split(","),readOnly="error,currentSrc,networkState,readyState,seeking,initialTime,duration,startOffsetTime,paused,played,seekable,ended,videoTracks,audioTracks,videoWidth,videoHeight,textTracks".split(",");var createSetter=function(a){var b=a.charAt(0).toUpperCase()+a.slice(1);api["set"+b]=function(c){return this.el_.librevjs_setProperty(a,c)}};var createGetter=function(a){api[a]=function(){return this.el_.librevjs_getProperty(a)}};(function(){var a;for(a=0;a0){a.disable()}}}e=(g)?g.kind():((f)?f:false);if(e){this.trigger(e+"trackchange")}return this};librevjs.TextTrack=librevjs.Component.extend({init:function(b,a){librevjs.Component.call(this,b,a);this.id_=a.id||("librevjs_"+a.kind+"_"+a.language+"_"+librevjs.guid++);this.src_=a.src;this.dflt_=a["default"]||a.dflt;this.title_=a.title;this.language_=a.srclang;this.label_=a.label;this.cues_=[];this.activeCues_=[];this.readyState_=0;this.mode_=0;this.player_.on("fullscreenchange",librevjs.bind(this,this.adjustFontSize))}});librevjs.TextTrack.prototype.kind_;librevjs.TextTrack.prototype.kind=function(){return this.kind_};librevjs.TextTrack.prototype.src_;librevjs.TextTrack.prototype.src=function(){return this.src_};librevjs.TextTrack.prototype.dflt_;librevjs.TextTrack.prototype.dflt=function(){return this.dflt_};librevjs.TextTrack.prototype.title_;librevjs.TextTrack.prototype.title=function(){return this.title_};librevjs.TextTrack.prototype.language_;librevjs.TextTrack.prototype.language=function(){return this.language_};librevjs.TextTrack.prototype.label_;librevjs.TextTrack.prototype.label=function(){return this.label_};librevjs.TextTrack.prototype.cues_;librevjs.TextTrack.prototype.cues=function(){return this.cues_};librevjs.TextTrack.prototype.activeCues_;librevjs.TextTrack.prototype.activeCues=function(){return this.activeCues_};librevjs.TextTrack.prototype.readyState_;librevjs.TextTrack.prototype.readyState=function(){return this.readyState_};librevjs.TextTrack.prototype.mode_;librevjs.TextTrack.prototype.mode=function(){return this.mode_};librevjs.TextTrack.prototype.adjustFontSize=function(){if(this.player_.isFullScreen){this.el_.style.fontSize=screen.width/this.player_.width()*2.5*100+"%"}else{this.el_.style.fontSize=""}};librevjs.TextTrack.prototype.createEl=function(){return librevjs.Component.prototype.createEl.call(this,"div",{className:"librevjs-"+this.kind_+" librevjs-text-track"})};librevjs.TextTrack.prototype.show=function(){this.activate();this.mode_=2;librevjs.Component.prototype.show.call(this)};librevjs.TextTrack.prototype.hide=function(){this.activate();this.mode_=1;librevjs.Component.prototype.hide.call(this)};librevjs.TextTrack.prototype.disable=function(){if(this.mode_==2){this.hide()}this.deactivate();this.mode_=0};librevjs.TextTrack.prototype.activate=function(){if(this.readyState_===0){this.load()}if(this.mode_===0){this.player_.on("timeupdate",librevjs.bind(this,this.update,this.id_));this.player_.on("ended",librevjs.bind(this,this.reset,this.id_));if(this.kind_==="captions"||this.kind_==="subtitles"){this.player_.getChild("textTrackDisplay").addChild(this)}}};librevjs.TextTrack.prototype.deactivate=function(){this.player_.off("timeupdate",librevjs.bind(this,this.update,this.id_));this.player_.off("ended",librevjs.bind(this,this.reset,this.id_));this.reset();this.player_.getChild("textTrackDisplay").removeChild(this)};librevjs.TextTrack.prototype.load=function(){if(this.readyState_===0){this.readyState_=1;librevjs.get(this.src_,librevjs.bind(this,this.parseCues),librevjs.bind(this,this.onError))}};librevjs.TextTrack.prototype.onError=function(a){this.error=a;this.readyState_=3;this.trigger("error")};librevjs.TextTrack.prototype.parseCues=function(b){var f,c,g,h=b.split("\n"),k="",a;for(var e=1,d=h.length;e")==-1){a=k;k=librevjs.trim(h[++e])}else{a=this.cues_.length}f={id:a,index:this.cues_.length};c=k.split(" --> ");f.startTime=this.parseCueTime(c[0]);f.endTime=this.parseCueTime(c[1]);g=[];while(h[++e]&&(k=librevjs.trim(h[e]))){g.push(k)}f.text=g.join("
");this.cues_.push(f)}}this.readyState_=2;this.trigger("loaded")};librevjs.TextTrack.prototype.parseCueTime=function(b){var g=b.split(":"),f=0,c,e,a,h,d;if(g.length==3){c=g[0];e=g[1];a=g[2]}else{c=0;e=g[0];a=g[1]}a=a.split(/\s+/);h=a.splice(0,1)[0];h=h.split(/\.|,/);d=parseFloat(h[1]);h=h[0];f+=parseFloat(c)*3600;f+=parseFloat(e)*60;f+=parseFloat(h);if(d){f+=d/1000}return f};librevjs.TextTrack.prototype.update=function(){if(this.cues_.length>0){var b=this.player_.currentTime();if(this.prevChange===undefined||b=this.nextChange||this.nextChange===undefined){c=(this.firstActiveIndex!==undefined)?this.firstActiveIndex:0}else{g=true;c=(this.lastActiveIndex!==undefined)?this.lastActiveIndex:f.length-1}while(true){d=f[c];if(d.endTime<=b){j=Math.max(j,d.endTime);if(d.active){d.active=false}}else{if(b'+b[c].text+""}this.el_.innerHTML=d};librevjs.TextTrack.prototype.reset=function(){this.nextChange=0;this.prevChange=this.player_.duration();this.firstActiveIndex=0;this.lastActiveIndex=0};librevjs.CaptionsTrack=librevjs.TextTrack.extend();librevjs.CaptionsTrack.prototype.kind_="captions";librevjs.SubtitlesTrack=librevjs.TextTrack.extend();librevjs.SubtitlesTrack.prototype.kind_="subtitles";librevjs.ChaptersTrack=librevjs.TextTrack.extend();librevjs.ChaptersTrack.prototype.kind_="chapters";librevjs.TextTrackDisplay=librevjs.Component.extend({init:function(b,a,c){librevjs.Component.call(this,b,a,c);if(b.options_.tracks&&b.options_.tracks.length>0){this.player_.addTextTracks(b.options_.tracks)}}});librevjs.TextTrackDisplay.prototype.createEl=function(){return librevjs.Component.prototype.createEl.call(this,"div",{className:"librevjs-text-track-display"})};librevjs.TextTrackMenuItem=librevjs.MenuItem.extend({init:function(c,b){var a=this.track=b.track;b.label=a.label();b.selected=a.dflt();librevjs.MenuItem.call(this,c,b);this.player_.on(a.kind()+"trackchange",librevjs.bind(this,this.update));if(a.dflt()){this.player_.showTextTrack(this.track.id_,this.track.kind())}}});librevjs.TextTrackMenuItem.prototype.onClick=function(){librevjs.MenuItem.prototype.onClick.call(this);this.player_.showTextTrack(this.track.id_,this.track.kind())};librevjs.TextTrackMenuItem.prototype.update=function(){this.selected(this.track.mode()==2)};librevjs.OffTextTrackMenuItem=librevjs.TextTrackMenuItem.extend({init:function(b,a){a.track={kind:function(){return a.kind},player:b,label:function(){return a.kind+" off"},dflt:function(){return false},mode:function(){return false}};librevjs.TextTrackMenuItem.call(this,b,a);this.selected(true)}});librevjs.OffTextTrackMenuItem.prototype.onClick=function(){librevjs.TextTrackMenuItem.prototype.onClick.call(this);this.player_.showTextTrack(this.track.id_,this.track.kind())};librevjs.OffTextTrackMenuItem.prototype.update=function(){var c=this.player_.textTracks(),d=0,b=c.length,a,e=true;for(;d0){this.show()}return a};librevjs.ChaptersTrackMenuItem=librevjs.MenuItem.extend({init:function(d,c){var b=this.track=c.track,a=this.cue=c.cue,e=d.currentTime();c.label=a.text;c.selected=(a.startTime<=e&&e0){for(var e=0,b=c.length;e0){e--;if("librevjs-current-res"==f[e].className){f[e].innerHTML=a.res_label(this.resolution);break}}d.trigger("changeRes")};b.ResolutionTitleMenuItem=b.MenuItem.extend({init:function(d,c){b.MenuItem.call(this,d,c);this.off("click")}});b.ResolutionSelector=b.MenuButton.extend({init:function(d,c){d.availableRes=c.available_res;b.MenuButton.call(this,d,c)}});b.ResolutionSelector.prototype.createItems=function(){var d=this.player(),c=[],e;c.push(new b.ResolutionTitleMenuItem(d,{el:b.Component.prototype.createEl("li",{className:"librevjs-menu-title librevjs-res-menu-title",innerHTML:"Calidad"})}));for(e in d.availableRes){if("length"==e){continue}c.push(new b.ResolutionMenuItem(d,{res:e}))}c.sort(function(g,f){if(typeof g.resolution=="undefined"){return -1}else{return parseInt(f.resolution)-parseInt(g.resolution)}});return c};b.plugin("resolutionSelector",function(s){if(!this.el().firstChild.canPlayType){return}var r=this,c=r.options().sources,l=c.length,k,p,g=a.extend({default_res:"",force_types:false},s||{}),m={length:0},h,d,e=(g.default_res&&typeof g.default_res=="string")?g.default_res.split(","):[],q="cliplibrejs.resolutionSelector",f=q+".res",o=(typeof(Cookies)==="function")?Cookies:a.buildCookiesDummy();while(l>0){l--;if(!c[l]["data-res"]){continue}h=c[l]["data-res"];if(typeof m[h]!=="object"){m[h]=[];m.length++}m[h].push(c[l])}if(g.force_types){for(h in m){if("length"==h){continue}l=g.force_types.length;while(l>0){l--;k=m[h].length;found_types=0;while(k>0){k--;if(g.force_types[l]===m[h][k].type){found_types++}}if(found_types'+(h||"Quality")+"",role:"button","aria-live":"polite",tabIndex:0}),available_res:m});this.on("changeRes",function(){o.set(f,r.getCurrentRes())});this.one("loadedmetadata",function(){var i=o.get(f);if(i){r.src(r.availableRes[i]);r.currentRes=i;r.trigger("changeRes")}});r.controlBar.resolutionSelector=r.controlBar.addChild(d)})})(cliplibrejs); \ No newline at end of file -- cgit v1.2.3