Wordpress/wp-includes/js/mediaelement/mediaelement-and-player.min.js

86 lines
65 KiB
JavaScript
Raw Normal View History

/*!
* MediaElement.js
* HTML5 <video> and <audio> shim and player
* http://mediaelementjs.com/
*
* Creates a JavaScript object that mimics HTML5 MediaElement API
* for browsers that don't understand HTML5 or can't play the provided codec
* Can play MP4 (H.264), Ogg, WebM, FLV, WMV, WMA, ACC, and MP3
*
* Copyright 2010-2012, John Dyer (http://j.hn)
* Dual licensed under the MIT or GPL Version 2 licenses.
*
*/
var mejs=mejs||{};mejs.version="2.10.1";mejs.meIndex=0;mejs.plugins={silverlight:[{version:[3,0],types:["video/mp4","video/m4v","video/mov","video/wmv","audio/wma","audio/m4a","audio/mp3","audio/wav","audio/mpeg"]}],flash:[{version:[9,0,124],types:["video/mp4","video/m4v","video/mov","video/flv","video/rtmp","video/x-flv","audio/flv","audio/x-flv","audio/mp3","audio/m4a","audio/mpeg","video/youtube","video/x-youtube"]}],youtube:[{version:null,types:["video/youtube","video/x-youtube"]}],vimeo:[{version:null,types:["video/vimeo","video/x-vimeo"]}]};mejs.Utility={encodeUrl:function(a){return encodeURIComponent(a)},escapeHTML:function(a){return a.toString().split("&").join("&amp;").split("<").join("&lt;").split('"').join("&quot;")},absolutizeUrl:function(a){var b=document.createElement("div");b.innerHTML='<a href="'+this.escapeHTML(a)+'">x</a>';return b.firstChild.href},getScriptPath:function(h){var e=0,c,k="",a="",f,b=document.getElementsByTagName("script"),g=b.length,d=h.length;for(;e<g;e++){f=b[e].src;for(c=0;c<d;c++){a=h[c];if(f.indexOf(a)>-1){k=f.substring(0,f.indexOf(a));break}}if(k!==""){break}}return k},secondsToTimeCode:function(c,g,a,b){if(typeof a=="undefined"){a=false}else{if(typeof b=="undefined"){b=25}}var f=Math.floor(c/3600)%24,d=Math.floor(c/60)%60,h=Math.floor(c%60),e=Math.floor(((c%1)*b).toFixed(3)),j=((g||f>0)?(f<10?"0"+f:f)+":":"")+(d<10?"0"+d:d)+":"+(h<10?"0"+h:h)+((a)?":"+(e<10?"0"+e:e):"");return j},timeCodeToSeconds:function(c,k,d,e){if(typeof d=="undefined"){d=false}else{if(typeof e=="undefined"){e=25}}var f=c.split(":"),a=parseInt(f[0],10),b=parseInt(f[1],10),h=parseInt(f[2],10),j=0,g=0;if(d){j=parseInt(f[3])/e}g=(a*3600)+(b*60)+h+j;return g},convertSMPTEtoSeconds:function(a){if(typeof a!="string"){return false}a=a.replace(",",".");var d=0,b=(a.indexOf(".")!=-1)?a.split(".")[1].length:0,e=1;a=a.split(":").reverse();for(var c=0;c<a.length;c++){e=1;if(c>0){e=Math.pow(60,c)}d+=Number(a[c])*e}return Number(d.toFixed(b))},removeSwf:function(b){var a=document.getElementById(b);if(a&&a.nodeName=="OBJECT"){if(mejs.MediaFeatures.isIE){a.style.display="none";(function(){if(a.readyState==4){mejs.Utility.removeObjectInIE(b)}else{setTimeout(arguments.callee,10)}})()}else{a.parentNode.removeChild(a)}}},removeObjectInIE:function(c){var b=document.getElementById(c);if(b){for(var a in b){if(typeof b[a]=="function"){b[a]=null}}b.parentNode.removeChild(b)}}};mejs.PluginDetector={hasPluginVersion:function(c,a){var b=this.plugins[c];a[1]=a[1]||0;a[2]=a[2]||0;return(b[0]>a[0]||(b[0]==a[0]&&b[1]>a[1])||(b[0]==a[0]&&b[1]==a[1]&&b[2]>=a[2]))?true:false},nav:window.navigator,ua:window.navigator.userAgent.toLowerCase(),plugins:[],addPlugin:function(d,c,e,a,b){this.plugins[d]=this.detectPlugin(c,e,a,b)},detectPlugin:function(g,b,c,k){var h=[0,0,0],j,d,a;if(typeof(this.nav.plugins)!="undefined"&&typeof this.nav.plugins[g]=="object"){j=this.nav.plugins[g].description;if(j&&!(typeof this.nav.mimeTypes!="undefined"&&this.nav.mimeTypes[b]&&!this.nav.mimeTypes[b].enabledPlugin)){h=j.replace(g,"").replace(/^\s+/,"").replace(/\sr/gi,".").split(".");for(d=0;d<h.length;d++){h[d]=parseInt(h[d].match(/\d+/),10)}}}else{if(typeof(window.ActiveXObject)!="undefined"){try{a=new ActiveXObject(c);if(a){h=k(a)}}catch(f){}}}return h}};mejs.PluginDetector.addPlugin("flash","Shockwave Flash","application/x-shockwave-flash","ShockwaveFlash.ShockwaveFlash",function(b){var a=[],c=b.GetVariable("$version");if(c){c=c.split(" ")[1].split(",");a=[parseInt(c[0],10),parseInt(c[1],10),parseInt(c[2],10)]}return a});mejs.PluginDetector.addPlugin("silverlight","Silverlight Plug-In","application/x-silverlight-2","AgControl.AgControl",function(b){var a=[0,0,0,0],c=function(f,d,e,g){while(f.isVersionSupported(d[0]+"."+d[1]+"."+d[2]+"."+d[3])){d[e]+=g}d[e]-=g};c(b,a,0,1);c(b,a,1,1);c(b,a,2,10000);c(b,a,2,1000);c(b,a,2,100);c(b,a,2,10);c(b,a,2,1);c(b,a,3,1);return a});mejs.MediaFeatures={init:function(){var e=this,h=document,g=mejs.PluginDetector.nav,c=mejs.PluginDetector.ua.toLowerCase(),b,a,f=["source","track","audio","video"];e.isiPad=(c.match(/ipad/i)!==null);e
/*!
* Adds Internationalization and localization to objects.
*
* What is the concept beyond i18n?
* http://en.wikipedia.org/wiki/Internationalization_and_localization
*
*
* This file both i18n methods and locale which is used to translate
* strings into other languages.
*
* Default translations are not available, you have to add them
* through locale objects which are named exactly as the langcode
* they stand for. The default language is always english (en).
*
*
* Wrapper built to be able to attach the i18n object to
* other objects without changing more than one line.
*
*
* LICENSE:
*
* The i18n file uses methods from the Drupal project (drupal.js):
* - i18n.methods.t() (modified)
* - i18n.methods.checkPlain() (full copy)
* - i18n.methods.formatString() (full copy)
*
* The Drupal project is (like mediaelementjs) licensed under GPLv2.
* - http://drupal.org/licensing/faq/#q1
* - https://github.com/johndyer/mediaelement
* - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
*
* @author
* Tim Latz (latz.tim@gmail.com)
*
* @see
* me-i18n-locale.js
*
* @params
* - $ - zepto || jQuery ..
* - context - document, iframe ..
* - exports - CommonJS, window ..
*
*/
(function(d,b,a,e){var c={locale:{strings:{}},methods:{}};c.locale.getLanguage=function(){return{language:navigator.language}};c.locale.INIT_LANGUAGE=c.locale.getLanguage();c.methods.checkPlain=function(j){var h,g,f={"&":"&amp;",'"':"&quot;","<":"&lt;",">":"&gt;"};j=String(j);for(h in f){if(f.hasOwnProperty(h)){g=new RegExp(h,"g");j=j.replace(g,f[h])}}return j};c.methods.formatString=function(h,f){for(var g in f){switch(g.charAt(0)){case"@":f[g]=c.methods.checkPlain(f[g]);break;case"!":break;case"%":default:f[g]='<em class="placeholder">'+c.methods.checkPlain(f[g])+"</em>";break}h=h.replace(g,f[g])}return h};c.methods.t=function(h,g,f){if(c.locale.strings&&c.locale.strings[f.context]&&c.locale.strings[f.context][h]){h=c.locale.strings[f.context][h]}if(g){h=c.methods.formatString(h,g)}return h};c.t=function(j,g,f){if(typeof j==="string"&&j.length>0){var h=c.locale.getLanguage();f=f||{context:h.language};return c.methods.t(j,g,f)}else{throw {name:"InvalidArgumentException",message:"First argument is either not a string or empty."}}};a.i18n=c}(jQuery,document,mejs));
/*!
* This is a i18n.locale language object.
*
*<de> German translation by Tim Latz, latz.tim@gmail.com
*
* @author
* Tim Latz (latz.tim@gmail.com)
*
* @see
* me-i18n.js
*
* @params
* - exports - CommonJS, window ..
*/
(function(a,b){a.de={Fullscreen:"Vollbild","Go Fullscreen":"Vollbild an","Turn off Fullscreen":"Vollbild aus",Close:"Schließen"}}(mejs.i18n.locale.strings));
/*!
* MediaElementPlayer
* http://mediaelementjs.com/
*
* Creates a controller bar for HTML5 <video> add <audio> tags
* using jQuery and MediaElement.js (HTML5 Flash/Silverlight wrapper)
*
* Copyright 2010-2012, John Dyer (http://j.hn/)
* Dual licensed under the MIT or GPL Version 2 licenses.
*
*/
if(typeof jQuery!="undefined"){mejs.$=jQuery}else{if(typeof ender!="undefined"){mejs.$=ender}}(function(a){mejs.MepDefaults={poster:"",defaultVideoWidth:480,defaultVideoHeight:270,videoWidth:-1,videoHeight:-1,defaultAudioWidth:400,defaultAudioHeight:30,defaultSeekBackwardInterval:function(b){return(b.duration*0.05)},defaultSeekForwardInterval:function(b){return(b.duration*0.05)},audioWidth:-1,audioHeight:-1,startVolume:0.8,loop:false,enableAutosize:true,alwaysShowHours:false,showTimecodeFrameCount:false,framesPerSecond:25,autosizeProgress:true,alwaysShowControls:false,iPadUseNativeControls:false,iPhoneUseNativeControls:false,AndroidUseNativeControls:false,features:["playpause","current","progress","duration","tracks","volume","fullscreen"],isVideo:true,enableKeyboard:true,pauseOtherPlayers:true,keyActions:[{keys:[32,179],action:function(b,c){if(c.paused||c.ended){c.play()}else{c.pause()}}},{keys:[38],action:function(b,d){var c=Math.min(d.volume+0.1,1);d.setVolume(c)}},{keys:[40],action:function(b,d){var c=Math.max(d.volume-0.1,0);d.setVolume(c)}},{keys:[37,227],action:function(b,d){if(!isNaN(d.duration)&&d.duration>0){if(b.isVideo){b.showControls();b.startControlsTimer()}var c=Math.max(d.currentTime-b.options.defaultSeekBackwardInterval(d),0);d.setCurrentTime(c)}}},{keys:[39,228],action:function(b,d){if(!isNaN(d.duration)&&d.duration>0){if(b.isVideo){b.showControls();b.startControlsTimer()}var c=Math.min(d.currentTime+b.options.defaultSeekForwardInterval(d),d.duration);d.setCurrentTime(c)}}},{keys:[70],action:function(b,c){if(typeof b.enterFullScreen!="undefined"){if(b.isFullScreen){b.exitFullScreen()}else{b.enterFullScreen()}}}}]};mejs.mepIndex=0;mejs.players=[];mejs.MediaElementPlayer=function(c,d){if(!(this instanceof mejs.MediaElementPlayer)){return new mejs.MediaElementPlayer(c,d)}var b=this;b.$media=b.$node=a(c);b.node=b.media=b.$media[0];if(typeof b.node.player!="undefined"){return b.node.player}else{b.node.player=b}if(typeof d=="undefined"){d=b.$node.data("mejsoptions")}b.options=a.extend({},mejs.MepDefaults,d);mejs.players.push(b);b.init();return b};mejs.MediaElementPlayer.prototype={hasFocus:false,controlsAreVisible:true,init:function(){var d=this,e=mejs.MediaFeatures,h=a.extend(true,{},d.options,{success:function(k,j){d.meReady(k,j)},error:function(j){d.handleError(j)}}),c=d.media.tagName.toLowerCase();d.isDynamic=(c!=="audio"&&c!=="video");if(d.isDynamic){d.isVideo=d.options.isVideo}else{d.isVideo=(c!=="audio"&&d.options.isVideo)}if((e.isiPad&&d.options.iPadUseNativeControls)||(e.isiPhone&&d.options.iPhoneUseNativeControls)){d.$media.attr("controls","controls");if(e.isiPad&&d.media.getAttribute("autoplay")!==null){d.media.load();d.media.play()}}else{if(e.isAndroid&&d.AndroidUseNativeControls){}else{d.$media.removeAttr("controls");d.id="mep_"+mejs.mepIndex++;d.container=a('<div id="'+d.id+'" class="mejs-container '+(mejs.MediaFeatures.svg?"svg":"no-svg")+'"><div class="mejs-inner"><div class="mejs-mediaelement"></div><div class="mejs-layers"></div><div class="mejs-controls"></div><div class="mejs-clear"></div></div></div>').addClass(d.$media[0].className).insertBefore(d.$media);d.container.addClass((e.isAndroid?"mejs-android ":"")+(e.isiOS?"mejs-ios ":"")+(e.isiPad?"mejs-ipad ":"")+(e.isiPhone?"mejs-iphone ":"")+(d.isVideo?"mejs-video ":"mejs-audio "));if(e.isiOS){var g=d.$media.clone();d.container.find(".mejs-mediaelement").append(g);d.$media.remove();d.$node=d.$media=g;d.node=d.media=g[0]}else{d.container.find(".mejs-mediaelement").append(d.$media)}d.controls=d.container.find(".mejs-controls");d.layers=d.container.find(".mejs-layers");var f=(d.isVideo?"video":"audio"),b=f.substring(0,1).toUpperCase()+f.substring(1);if(d.options[f+"Width"]>0||d.options[f+"Width"].toString().indexOf("%")>-1){d.width=d.options[f+"Width"]}else{if(d.media.style.width!==""&&d.media.style.width!==null){d.width=d.media.style.width}else{if(d.media.getAttribute("width")!==null){d.width=d.$media.attr("width")}else{d.width=d.options["default"+b+"Width"]}}}if(d.options[f+"Height"]>0||d.options[f+"Height"].toString().indexOf("%")>-1){d.h