/* * Media Element * HTML5 and Shim * http://mediaelementjs.com/ * * Creates a JavaScript object that mimics HTML5 media object * for browsers that don't understand HTML5 or can't play the provided codec * Can also play MP4 (H.264), Ogg, WebM, FLV, WMV, WMA, ACC, and MP3 * * Copyright 2010, John Dyer * Dual licensed under the MIT or GPL Version 2 licenses. * * Version: 1.1.0 */ var html5=html5||{};html5.meIndex=0;html5.plugins={silverlight:[{version:[3,0],types:["video/mp4","video/m4v","video/mov","video/wmv","audio/wma","audio/mp4","audio/m4a","audio/mp3"]}],flash:[{version:[9,0,124],types:["video/mp4","video/m4v","video/mov","video/flv","audio/flv","audio/mp3","audio/m4a","audio/mp3"]}]};html5.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(h,b,c,l){var j=[0,0,0],k,f,a;if(typeof(this.nav.plugins)!="undefined"&&typeof this.nav.plugins[h]=="object"){k=this.nav.plugins[h].description;if(k&&!(typeof this.nav.mimeTypes!="undefined"&&this.nav.mimeTypes[b]&&!this.nav.mimeTypes[b].enabledPlugin)){j=k.replace(h,"").replace(/^\s+/,"").replace(/\sr/gi,".").split(".");for(f=0;fx';return b.firstChild.href},getScriptPath:function(b){var f=0,e,g="",d="",c,a=document.getElementsByTagName("script");for(;f-1){g=c.substring(0,c.indexOf(d));break}}if(g!==""){break}}return g},secondsToTimeCode:function(b){b=Math.round(b);var a=Math.floor(b/60);a=(a>=10)?a:"0"+a;b=Math.floor(b%60);b=(b>=10)?b:"0"+b;return a+":"+b}};html5.HtmlMediaElement={pluginType:"native",setCurrentTime:function(a){this.currentTime=a},setMuted:function(a){this.muted=a},setVolume:function(a){this.volume=a},setSrc:function(a){if(typeof a=="string"){this.src=a}else{var b,c;for(b=0;b':'Download file';c.parentNode.insertBefore(a,c);c.style.display="none";b.error(c)},createPlugin:function(i,m,b,f,h,j,g){var d=1,k=1,e="me_"+f+"_"+(html5.meIndex++),l=new html5.PluginMediaElement(e,f),c=document.createElement("div"),a;if(b){d=(m.videoWidth>0)?m.videoWidth:(i.getAttribute("width")!==null)?i.getAttribute("width"):m.defaultVideoWidth;k=(m.videoHeight>0)?m.videoHeight:(i.getAttribute("height")!==null)?i.getAttribute("height"):m.defaultVideoHeight}else{if(m.enablePluginDebug){d=320;k=240}}l.success=m.success;html5.MediaPluginBridge.registerPluginElement(e,l,i);c.className="me-plugin";i.parentNode.insertBefore(c,i);a=["id="+e,"poster="+j,"autoplay="+g,"width="+d,"height="+k];if(h!==null){a.push("file="+h)}if(m.enablePluginDebug){a.push("debug=true")}switch(f){case"silverlight":c.innerHTML='';break;case"flash":if(html5.MediaFeatures.isIE){c.outerHTML=''}else{c.innerHTML=''}break}i.style.display="none"},updateNative:function(c,b){for(var a in html5.HtmlMediaElement){c[a]=html5.HtmlMediaElement[a]}b.success(c,c)}};window.html5=html5;window.MediaElement=html5.MediaElement; /* * Media Element jQuery plugin * http://mediaelementjs.com/ * * Creates a controller bar for HTML5 add tags * using jQuery and MediaElement.js * * Copyright 2010, John Dyer * Dual licensed under the MIT or GPL Version 2 licenses. * * Version: 1.1.0 */ (function(a){html5.MepDefaults={defaultVideoWidth:480,defaultVideoHeight:270,videoWidth:-1,videoHeight:-1,audioWidth:300,audioHeight:30,messages:{start:"Click to Start",loading:"Loading",paused:"Paused",error:"Error",ended:"Ended"},controls:{playpause:true,timerail:true,duration:true,volume:true,captions:true,fullscreen:true},loop:false,startLanguage:"",translations:[]};html5.mepIndex=0;html5.MediaElementPlayer=function(d,e){var b=this,c=html5.MediaFeatures;b.$media=a(d);b.options=a.extend(true,{},html5.MepDefaults,e);b.isVideo=(b.$media[0].tagName.toLowerCase()=="video");if(c.isiPad||c.isiPhone){b.$media.attr("controls","controls");b.$media.removeAttr("poster");if(c.isiPad&&b.$media[0].getAttribute("autoplay")!==null){b.$media[0].load();b.$media[0].play()}return}else{if(c.isAndroid&&b.isVideo){b.$media.attr("controls","controls");return}else{b.$media.removeAttr("controls")}}b.createPlayer()};html5.MediaElementPlayer.prototype={createPlayer:function(){var b=this,c=a.extend(true,{},b.options,{success:function(d,e){b.setupPlayer(d,e)},error:function(d){b.handleError(d)}});b.id="mep_"+html5.mepIndex++;b.$media.before(a(' | None'));b.container=a("#"+this.id);b.container.addClass(b.$media[0].className).find(".mep-mediaelement").append(b.$media);if(b.isVideo){b.width=(b.options.videoWidth>0)?b.options.videoWidth:(b.$media[0].getAttribute("width")!==null)?b.$media.attr("width"):b.options.defaultVideoWidth;b.height=(b.options.videoHeight>0)?b.options.videoHeight:(b.$media[0].getAttribute("height")!==null)?b.$media.attr("height"):b.options.defaultVideoHeight}else{b.width=b.options.audioWidth;b.height=b.options.audioHeight}b.buildPoster();b.buildOverlay();b.buildCaptionsDisplay();b.setPlayerSize(b.width,b.height);b.buildControls();c.pluginWidth=b.height;c.pluginHeight=b.width;html5.MediaElement(b.$media[0],c)},setupPlayer:function(b,d){var c=this;c.mediaElement=b;c.domNode=d;c.buildControlBar();c.buildPlayPause();c.buildTimeRail();c.buildVolumeControls();c.buildCaptionsControls();c.buildFullscreen();c.mediaElement.addEventListener("click",function(f){if(c.mediaElement.paused){c.mediaElement.play()}},true);c.mediaElement.addEventListener("playing",function(f){c.poster.hide();c.playpause.removeClass("mep-play").addClass("mep-pause");c.hideMessage()},true);c.mediaElement.addEventListener("pause",function(f){c.playpause.removeClass("mep-pause").addClass("mep-play");c.showMessage(c.options.messages.paused)},true);c.mediaElement.addEventListener("ended",function(f){c.mediaElement.setCurrentTime(0);c.mediaElement.pause();c.setTimePosition();if(c.options.loop){c.mediaElement.play()}else{c.poster.show();c.playpause.removeClass("mep-pause").addClass("mep-play");c.showMessage(c.options.messages.ended)}},true);c.mediaElement.addEventListener("loadedmetadata",function(f){if(c.isVideo&&c.options.videoHeight<=0&&c.$media[0].getAttribute("height")===null&&!isNaN(f.target.videoHeight)){c.setPlayerSize(f.target.videoWidth,f.target.videoHeight);c.setRailSize();c.mediaElement.setVideoSize(f.target.videoWidth,f.target.videoHeight)}},true);setTimeout(function(){c.setRailSize()},50);if(c.options.success){c.options.success(c.mediaElement,c.domNode)}this.loadTracks()},buildCaptionsDisplay:function(){var b=this;b.captionsDisplay=b.container.find(".mep-captions-layer").hide();b.captionsText=b.container.find(".mep-captions-text")},buildCaptionsControls:function(){var c=this,d,b;c.captions.delegate("input[type=radio]","click",function(){d=this.value;if(d=="none"){c.selectedTrack=null}else{for(b=0;b0&&c.options.translations.length>0){for(b=0;b0){c.loadNextSubtitle()}else{c.captions.remove();c.setRailSize()}},addTrackButton:function(d){var c=this,b=html5.language.codes[d]||d;c.captions.find("ul").append(a(''+b+""));c.captions.find(".mep-captions-selector").height(c.captions.find(".mep-captions-selector ul").height())},loadNextSubtitle:function(){var b=this;b.trackToLoad++;if(b.trackToLoad=b.entries.times[c].start&&d.mediaElement.currentTime<=b.entries.times[c].stop){d.captionsText.html(b.entries.text[c]);d.captionsDisplay.show();return}}d.captionsDisplay.hide()}else{d.captionsDisplay.hide()}},buildPoster:function(){var b=this;b.poster=b.container.find(".mep-poster");b.posterImg=b.poster.find("img");b.posterUrl=b.$media.attr("poster");b.posterUrl=(b.posterUrl===null||b.posterUrl==undefined)?"":b.posterUrl;if(b.posterUrl!==""){b.posterImg.attr("src",b.posterUrl)}else{b.poster.hide()}},buildOverlay:function(){var b=this;b.overlay=b.container.find(".mep-overlay");b.overlayMessage=b.container.find(".mep-overlay-message");if(b.$media[0].getAttribute("autoplay")!==null){b.showMessage(b.options.messages.loading)}else{b.showMessage(b.options.messages.start)}b.overlay.bind("click",function(c){if(b.mediaElement.paused){b.mediaElement.play()}},true)},showMessage:function(b){if(this.isVideo){this.overlayMessage.html(b);this.overlay.css("visibility","visible")}},hideMessage:function(){this.overlay.css("visibility","hidden")},buildControls:function(){var b=this;b.controls=b.container.find(".mep-controls");b.isControlsVisible=true;b.playpause=b.controls.find(".mep-playpause-button");b.fullscreen=b.controls.find(".mep-fullscreen-button");if(!b.isVideo){b.fullscreen.remove()}b.time=b.controls.find(".mep-time");b.currentTime=b.controls.find(".mep-currenttime").html("00:00");b.duration=b.controls.find(".mep-duration").html("00:00");b.captions=b.controls.find(".mep-captions-button");b.mute=b.controls.find(".mep-volume-button");b.volumeSlider=b.controls.find(".mep-volume-slider");b.volumeRail=b.controls.find(".mep-volume-rail");b.volumeHandle=b.controls.find(".mep-volume-handle");b.timeRail=b.controls.find(".mep-time-rail");b.timeCurrent=b.timeRail.find(".mep-time-current").width(0);b.timeLoaded=b.timeRail.find(".mep-time-loaded").width(0);b.timeTotal=b.timeRail.find(".mep-time-total");b.timeHandle=b.controls.find(".mep-time-handle");b.controls.show();b.setRailSize();if(!b.options.controls.playpause){b.playpause.remove()}if(!b.options.controls.timerail){b.timeRail.remove()}if(!b.options.controls.duration){b.time.remove()}if(!b.options.controls.volume){b.mute.remove()}if(!b.options.controls.fullscreen){b.fullscreen.remove()}},buildControlBar:function(){var b=this;if(b.isVideo){b.container.bind("mouseenter",function(){b.controls.css("visibility","visible");b.controls.fadeIn(200);b.captionsDisplay.css("padding-bottom",b.controls.height()+5);b.setRailSize();b.isControlsVisible=true}).bind("mouseleave",function(){b.controls.fadeOut(200,function(){a(this).css("visibility","hidden");a(this).css("display","block");b.captionsDisplay.css("padding-bottom",10)});b.isControlsVisible=false})}},buildPlayPause:function(){var b=this;b.playpause.bind("click",function(){if(b.playpause.hasClass("mep-play")){b.mediaElement.play();b.playpause.removeClass("mep-play").addClass("mep-pause")}else{b.mediaElement.pause();b.playpause.removeClass("mep-pause").addClass("mep-play")}})},buildTimeRail:function(){var b=this;b.timeRail.delegate("span","click",function(h){var c=h.pageX,i=b.timeTotal.offset(),f=b.timeTotal.outerWidth(),d=((c-i.left)/f),g=d*b.mediaElement.duration;b.mediaElement.setCurrentTime(g)});b.mediaElement.addEventListener("timeupdate",function(c){b.displayCaptions();b.setTimePosition();b.setTimeLoaded(c.target)},true);b.mediaElement.addEventListener("progress",function(c){b.setTimeLoaded(c.target)},true)},setTimePosition:function(){var b=this,d,c;if(b.mediaElement.currentTime&&b.mediaElement.duration){b.currentTime.html(html5.Utility.secondsToTimeCode(b.mediaElement.currentTime));if(b.mediaElement.duration){b.duration.html(html5.Utility.secondsToTimeCode(b.mediaElement.duration))}d=b.timeTotal.width()*b.mediaElement.currentTime/b.mediaElement.duration;c=d-(b.timeHandle.width()/2);b.timeCurrent.width(d);b.timeHandle.css("left",c)}},setTimeLoaded:function(d){var b=this,c=null;if(d&&d.bytesTotal!=undefined&&d.bytesTotal>0&&d.bufferedBytes!=undefined){c=d.bufferedBytes/d.bytesTotal}else{if(d&&d.buffered&&d.buffered.length>0&&d.buffered.end&&d.duration){c=d.buffered.end(0)/d.duration}}if(c!==null){b.timeLoaded.width(b.timeTotal.width()*c)}},setRailSize:function(){var b=this,c=b.playpause.outerWidth(true)+b.time.outerWidth(true)+b.mute.outerWidth(true)+b.captions.outerWidth(true)+((b.isVideo)?b.fullscreen.outerWidth(true):0),d=b.controls.width()-c-(b.timeRail.outerWidth(true)-b.timeRail.outerWidth(false));b.timeRail.width(d);b.timeTotal.width(d-(b.timeTotal.outerWidth(true)-b.timeTotal.width()))},setPlayerSize:function(d,b){var c=this;c.width=parseInt(d,10);c.height=parseInt(b,10);c.container.width(c.width).height(c.height);c.captionsDisplay.width(c.width);c.overlay.width(c.width).height(c.height);c.posterImg.height(c.height).width(c.width)},handleError:function(c){var b=this;b.$media.hide();b.overlay.hide();b.controls.hide();b.poster.hide()},buildFullscreen:function(){var b=this;b.isFullScreen=false;b.normalHeight=0;b.normalWidth=0;b.fullscreen.bind("click",function(){b.setFullScreen(!b.isFullScreen)})},setFullScreen:function(b){var c=this;switch(c.mediaElement.pluginType){case"flash":c.mediaElement.setFullscreen(b);break;case"silverlight":c.mediaElement.setFullscreen(b);break;case"native":if(html5.MediaFeatures.hasNativeFullScreen){if(b){c.mediaElement.webkitEnterFullScreen()}else{c.mediaElement.webkitExitFullScreen()}}else{if(b){c.normalHeight=c.$media.height();c.normalWidth=c.$media.width();c.container.addClass("mep-container-fullscreen").width("100%").height("100%").css("z-index",1000);c.$media.width("100%").height("100%");c.overlay.width("100%").height("100%");c.posterImg.width("100%").height("auto");c.fullscreen.removeClass("mep-fullscreen").addClass("mep-unfullscreen");c.setRailSize();c.escB=function(d){c.escListener(d)};c.resB=function(d){c.resizeListener(d)};a(document).bind("keydown",c.escB);a(window).bind("resize",c.resB)}else{c.container.removeClass("mep-container-fullscreen").width(c.normalWidth).height(c.normalHeight).css("z-index",1);c.$media.width(c.normalWidth).height(c.normalHeight);c.posterImg.width(c.normalWidth).height(c.normalHeight);c.fullscreen.removeClass("mep-unfullscreen").addClass("mep-fullscreen");c.setRailSize();a(document).unbind("keydown",c.escB);a(window).unbind("resize",c.resB)}}}c.isFullScreen=b},escListener:function(b){if(b.keyCode==27){this.setFullScreen(false)}},resizeListener:function(b){this.setRailSize()},buildVolumeControls:function(){var b=this;b.vmmB=function(c){b.volumeMove(c)};b.vrmB=function(c){b.removeMouseMove(c)};b.volumeSlider.bind("mousedown",function(c){b.volumeMove(c);a(document).bind("mousemove",b.vmmB).bind("mouseup",b.vrmB)});b.mute.find("span").bind("click",function(){if(b.mediaElement.muted){b.mediaElement.setMuted(false);b.mute.removeClass("mep-unmute").addClass("mep-mute");b.positionVolumeHandle(1)}else{b.mediaElement.setMuted(true);b.mute.removeClass("mep-mute").addClass("mep-unmute");b.positionVolumeHandle(0)}})},volumeMove:function(g){var c=this,b=c.volumeRail.height(),f=g.pageY-c.volumeRail.offset().top,d=(b-f)/b;if(f<0){f=0}else{if(f>b){f=b}}c.volumeHandle.css("top",f-(c.volumeHandle.height()/2));if(d==0){c.mediaElement.setMuted(true);c.mute.removeClass("mep-mute").addClass("mep-unmute")}else{c.mediaElement.setMuted(false);c.mute.removeClass("mep-unmute").addClass("mep-mute")}c.mediaElement.setVolume(d)},positionVolumeHandle:function(c){var b=this;b.volumeHandle.css("top",b.volumeRail.height()-(b.volumeRail.height()*c)-(b.volumeHandle.height()/2))},removeMouseMove:function(){var b=this;a(document).unbind("mousemove",b.vmmB).unbind("mouseup",b.vrmB)}};html5.language={codes:{af:"Afrikaans",sq:"Albanian",ar:"Arabic",be:"Belarusian",bg:"Bulgarian",ca:"Catalan",zh:"Chinese","zh-cn":"Chinese (Simplified)","zh-tw":"Chinese (Traditional)",hr:"Croatian",cs:"Czech",da:"Danish",nl:"Dutch",en:"English",et:"Estonian",tl:"Filipino",fi:"Finnish",fr:"French",gl:"Galician",de:"German",el:"Greek",ht:"Haitian (Creole)",iw:"Hebrew",hi:"Hindi",hu:"Hungarian",is:"Icelandic",id:"Indonesian",ga:"Irish",it:"Italian",ja:"Japanese",ko:"Korean",lv:"Latvian",lt:"Lithuanian",mk:"Macedonian",ms:"Malay",mt:"Maltese",no:"Norwegian",fa:"Persian",pl:"Polish",pt:"Portuguese","pt-pt":"Portuguese (Portugal)",ro:"Romanian",ru:"Russian",sr:"Serbian",sk:"Slovak",sl:"Slovenian",es:"Spanish",sw:"Swahili",sv:"Swedish",tl:"Tagalog",th:"Thai",tr:"Turkish",uk:"Ukrainian",vi:"Vietnamese",cy:"Welsh",yi:"Yiddish"}};html5.SrtParser={timecodeToSeconds:function(b){var c=b.split(":");return c[0]*60*60+c[1]*60+parseFloat(c[2].replace(",","."))},parse:function(e){var g=/^[0-9]+$/,h=/^([0-9]{2}:[0-9]{2}:[0-9]{2}(,[0-9]{1,3})?) --\> ([0-9]{2}:[0-9]{2}:[0-9]{2}(,[0-9]{3})?)(.*)$/,f=0,d=e.split(/\r?\n/),c={text:[],times:[]},b,j;for(;f"),b={text:[],times:[]},c,e;if(g.length>1000){g=g.substring(0,1000)}google.language.translate(g,j,f,function(i){c=i.translation.split("");for(e=0;e