diff --git a/Gruntfile.js b/Gruntfile.js index 628fa9dd..810aeb8b 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -48,7 +48,7 @@ module.exports = function(grunt) { }, build: { files: { - 'bin/osmplayer.js': ['minplayer/bin/minplayer.min.js', iscrollPath].concat(files) + 'bin/osmplayer.js': ['minplayer/bin/minplayer.js', iscrollPath].concat(files) } } }, diff --git a/bin/osmplayer.compressed.js b/bin/osmplayer.compressed.js index 548dfc9f..674e2e58 100644 --- a/bin/osmplayer.compressed.js +++ b/bin/osmplayer.compressed.js @@ -1,4 +1,4 @@ -function checkPlayType(a,b){if("function"==typeof a.canPlayType){if("object"==typeof b){for(var c=b.length,d="";c--&&!(d=checkPlayType(a,b[c])););return d}var e=a.canPlayType(b);if("no"!==e&&""!==e)return b}return""}var minplayer=minplayer||{};!function(a){!function(){"use strict";var a="undefined"!=typeof module&&module.exports,b="undefined"!=typeof Element&&"ALLOW_KEYBOARD_INPUT"in Element,c=function(){for(var a,b,c=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],d=0,e=c.length,f={};e>d;d++)if(a=c[d],a&&a[1]in document){for(d=0,b=a.length;b>d;d++)f[c[0][d]]=a[d];return f}return!1}(),d={request:function(a){var d=c.requestFullscreen;a=a||document.documentElement,/5\.1[\.\d]* Safari/.test(navigator.userAgent)?a[d]():a[d](b&&Element.ALLOW_KEYBOARD_INPUT)},exit:function(){document[c.exitFullscreen]()},toggle:function(a){this.isFullscreen?this.exit():this.request(a)},onchange:function(){},onerror:function(){},raw:c};return c?(Object.defineProperties(d,{isFullscreen:{get:function(){return!!document[c.fullscreenElement]}},element:{enumerable:!0,get:function(){return document[c.fullscreenElement]}},enabled:{enumerable:!0,get:function(){return!!document[c.fullscreenEnabled]}}}),document.addEventListener(c.fullscreenchange,function(a){d.onchange.call(d,a)}),document.addEventListener(c.fullscreenerror,function(a){d.onerror.call(d,a)}),void(a?module.exports=d:window.screenfull=d)):void(a?module.exports=!1:window.screenfull=!1)}(),a.screenfull=screenfull}(minplayer);var minplayer=minplayer||{};if(minplayer.compatibility=function(){var a=null;a=document.createElement("video"),this.videoOGG=checkPlayType(a,"video/ogg"),this.videoH264=checkPlayType(a,["video/mp4","video/h264"]),this.videoWEBM=checkPlayType(a,["video/x-webm","video/webm","application/octet-stream"]),this.videoMPEGURL=checkPlayType(a,"application/vnd.apple.mpegurl"),a=document.createElement("audio"),this.audioOGG=checkPlayType(a,"audio/ogg"),this.audioMP3=checkPlayType(a,"audio/mpeg"),this.audioMP4=checkPlayType(a,"audio/mp4")},minplayer.playTypes||(minplayer.playTypes=new minplayer.compatibility,minplayer.isAndroid=/android/gi.test(navigator.appVersion),minplayer.isIDevice=/iphone|ipad/gi.test(navigator.appVersion),minplayer.isPlaybook=/playbook/gi.test(navigator.appVersion),minplayer.isTouchPad=/hp-tablet/gi.test(navigator.appVersion),minplayer.hasTouch="ontouchstart"in window&&!minplayer.isTouchPad),!minplayer.urlVars){minplayer.urlVars={};var regEx=/[?&]+([^=&]+)=([^&]*)/gi;window.location.href.replace(regEx,function(a,b,c){minplayer.urlVars[b]=c})}var minplayer=minplayer||{};minplayer.async=function(){this.value=null,this.queue=[]},minplayer.async.prototype.get=function(a){null!==this.value?a(this.value):this.queue.push(a)},minplayer.async.prototype.set=function(a){this.value=a;var b=this.queue.length;if(b){for(;b--;)this.queue[b](a);this.queue=[]}};var minplayer=minplayer||{};minplayer.flags=function(){this.flag=0,this.ids={},this.numFlags=0},minplayer.flags.prototype.setFlag=function(a,b){this.ids.hasOwnProperty(a)||(this.ids[a]=this.numFlags,this.numFlags++),b?this.flag|=1<c;c++)minplayer.queue.hasOwnProperty(c)&&(b=minplayer.queue[c],d=!b.id&&!b.plugin,d|=b.plugin===a.name,d&=!b.id||b.id===this.options.id,d&&!b.addedto.hasOwnProperty(a.options.id)&&(b.addedto[a.options.id]=!0,d=minplayer.bind.call(b.context,b.event,this.options.id,a.name,b.callback,!0)));minplayer.lock=!1},minplayer.eventTypes={},minplayer.plugin.prototype.isEvent=function(a,b){var c=a+"__"+b;return"undefined"!=typeof minplayer.eventTypes[c]?minplayer.eventTypes[c]:(new RegExp("^(.*:)?"+b+"$","gi"),minplayer.eventTypes[c]=null!==a.match(b),minplayer.eventTypes[c])},minplayer.plugin.prototype.trigger=function(a,b,c){if(!this.active)return this;c||(this.triggered[a]=b);var d=0,e={},f=null;for(var g in this.queue)if(this.isEvent(g,a)){f=this.queue[g];for(d in f)f.hasOwnProperty(d)&&(e=f[d],e.callback({target:this,data:e.data},b))}return this},minplayer.plugin.prototype.ubind=function(a,b,c){return this.unbind(a),this.bind(a,b,c)},minplayer.plugin.prototype.bind=function(a,b,c){if(!this.active)return this;if("function"==typeof b&&(c=b,b=null),a&&c){this.queue[a]=this.queue[a]||[],this.queue[a].push({callback:c,data:b});for(var d in this.triggered)this.triggered.hasOwnProperty(d)&&this.isEvent(a,d)&&c({target:this,data:b},this.triggered[d]);return this}},minplayer.plugin.prototype.unbind=function(a){return this.lock&&setTimeout(function(b){return function(){b.unbind(a)}}(this),10),this.lock=!0,a?this.queue.hasOwnProperty(a)&&this.queue[a].length>0&&(this.queue[a].length=0):this.queue={},this.lock=!1,this},minplayer.addQueue=function(a,b,c,d,e){minplayer.lock?setTimeout(function(){minplayer.addQueue(a,c,b,d,e)},10):minplayer.queue.push({context:a,id:c,event:b,plugin:d,callback:e,addedto:{}})},minplayer.bind=function(a,b,c,d,e){if(!d)return!1;var f=minplayer.plugins,g=null,h=null,i=[],j=function(a,b){if(f.hasOwnProperty(a)&&f[a].hasOwnProperty(b))for(var c=f[a][b].length;c--;)i.push(f[a][b][c])};if(b&&c)j(b,c);else if(!b&&c)for(h in f)j(h,c);else if(b&&!c&&f[b])for(g in f[b])j(b,g);else if(!b&&!c)for(h in f)for(g in f[h])j(h,g);for(var k=i.length;k--;)i[k].bind(a,function(a){return function(b){d.call(a,b.target)}}(this));return e||minplayer.addQueue(this,a,b,c,d),i.length>0},minplayer.get=function(a,b,c){var d=typeof a,e=typeof b,f=typeof c;if("function"===d?(c=a,b=a=null):"function"===e?(c=b,b=a,a=null):"undefined"===e&&"undefined"===f&&(b=a,c=a=null),c="function"==typeof c?c:null)return void minplayer.bind.call(this,"ready",a,b,c);var g=minplayer.plugins,h=null;if(!(a||b||c))return g;if(a&&!b&&!c)return g[a];if(a&&b&&!c)return g[a][b];if(!a&&b&&!c){var i=[];for(h in g)if(g.hasOwnProperty(h)&&g[h].hasOwnProperty(b))for(var j=g[h][b].length;j--;)i.push(g[h][b][j]);return i}},minplayer.display=function(a,b,c,d){minplayer.plugin.call(this,a,b,c,d)},minplayer.display.prototype=new minplayer.plugin,minplayer.display.prototype.constructor=minplayer.display,minplayer.display.prototype.getDisplay=function(a){return a},minplayer.display.prototype.initialize=function(){this.display||(this.display=this.getDisplay(this.context,this.options)),this.display&&(this.options.pluginName="display",this.elements=this.getElements(),minplayer.plugin.prototype.initialize.call(this))},minplayer.display.prototype.construct=function(){if(minplayer.plugin.prototype.construct.call(this),this.autoHide=!1,this.onResize){var a=0;jQuery(window).resize(function(b){return function(){clearTimeout(a),a=setTimeout(function(){b.onResize()},200)}}(this))}},minplayer.display.prototype.onResize=!1,minplayer.display.prototype.hide=function(a){a=a||this.display,a&&(a.forceHide=!0,a.unbind().hide())},minplayer.display.prototype.fullScreenElement=function(){return this.display},minplayer.click=function(a,b){var c=!1;return a=jQuery(a),a.bind("touchstart click",function(a){c||(c=!0,setTimeout(function(){c=!1},100),b.call(this,a))}),a},minplayer.display.prototype.onFocus=function(a){this.hasFocus=this.focus=a,this.autoHide&&this.showThenHide(this.autoHide.element,this.autoHide.timeout,this.autoHide.cb)},minplayer.display.prototype.showThenHide=function(a,b,c){var d=typeof a;"undefined"===d?(c=null,a=this.display):"number"===d?(c=b,b=a,a=this.display):"function"===d&&(c=a,a=this.display),a&&(b=b||5e3,this.autoHide={element:a,timeout:b,cb:c},a.forceHide||("undefined"!=typeof a.showMe?a.showMe&&a.showMe(c):(a.show(),c&&c(!0))),a.hoverState||(jQuery(a).bind("mouseenter",function(){a.hoverState=!0}),jQuery(a).bind("mouseleave",function(){a.hoverState=!1})),clearTimeout(this.showTimer),this.showTimer=setTimeout(function(d){return function e(){a.hoverState?d.showTimer=setTimeout(e,b):"undefined"!=typeof a.hideMe?a.hideMe&&a.hideMe(c):a.hide("slow",function(){c&&c(!1)})}}(this),b))},minplayer.display.prototype.fullscreen=function(a){var b=this.isFullScreen(),c=this.fullScreenElement();b&&!a?(c.removeClass("fullscreen"),minplayer.screenfull&&minplayer.screenfull.exit(),this.trigger("fullscreen",!1)):!b&&a&&(c.addClass("fullscreen"),minplayer.screenfull&&(minplayer.screenfull.request(c[0]),minplayer.screenfull.onchange=function(a){return function(){minplayer.screenfull.isFullscreen||a.fullscreen(!1)}}(this)),this.trigger("fullscreen",!0))},minplayer.display.prototype.toggleFullScreen=function(){this.fullscreen(!this.isFullScreen())},minplayer.display.prototype.isFullScreen=function(){return this.fullScreenElement().hasClass("fullscreen")},minplayer.display.prototype.getScaledRect=function(a,b){var c={};return c.x=b.x?b.x:0,c.y=b.y?b.y:0,c.width=b.width?b.width:0,c.height=b.height?b.height:0,a&&(b.width/b.height>a?(c.height=b.height,c.width=Math.floor(b.height*a)):(c.height=Math.floor(b.width/a),c.width=b.width),c.x=Math.floor((b.width-c.width)/2),c.y=Math.floor((b.height-c.height)/2)),c},minplayer.display.prototype.getElements=function(){return{}},jQuery.fn.minplayer||(jQuery.fn.minplayer=function(a){return jQuery(this).each(function(){a=a||{},a.id=a.id||jQuery(this).attr("id")||Math.random(),minplayer.plugins[a.id]||(a.template=a.template||"default",minplayer[a.template]?new minplayer[a.template](jQuery(this),a):new minplayer(jQuery(this),a))})}),minplayer=jQuery.extend(function(a,b){minplayer.display.call(this,"player",a,b)},minplayer),minplayer.prototype=new minplayer.display,minplayer.prototype.constructor=minplayer,minplayer.prototype.defaultOptions=function(a){a.id="player",a.build=!1,a.wmode="transparent",a.preload=!0,a.autoplay=!1,a.autoload=!0,a.loop=!1,a.width="100%",a.height="350px",a.debug=!1,a.volume=80,a.files=null,a.file="",a.preview="",a.attributes={},a.plugins={},a.logo="",a.link="",a.duration=0,jQuery.each(this.context[0].attributes,function(b,c){a[c.name]=c.value}),minplayer.display.prototype.defaultOptions.call(this,a)},minplayer.prototype.construct=function(){minplayer.display.prototype.construct.call(this);var a=null;for(var b in this.options.plugins)a=this.options.plugins[b],minplayer[a]&&(a=minplayer[a],a[this.options.template]&&a[this.options.template].init?a[this.options.template].init(this):a.init&&a.init(this));if(this.options.pluginName="player",this.controller=this.create("controller"),this.playLoader=this.create("playLoader"),this.options.logo&&this.elements.logo){var c="";this.options.link&&(c+=''),c+='',this.options.link&&(c+=""),this.logo=this.elements.logo.append(c)}this.currentPlayer="html5",this.addKeyEvents(),this.addEvents(),this.load(this.getFiles()),this.ready()},minplayer.prototype.setFocus=function(a){minplayer.get.call(this,this.options.id,null,function(b){b.onFocus(a)}),this.trigger("playerFocus",a)},minplayer.prototype.bindTo=function(a){a.ubind(this.uuid+":error",function(a){return function(b,c){"html5"===a.currentPlayer?(minplayer.player="minplayer",a.options.file.player="minplayer",a.loadPlayer()):a.showError(c)}}(this)),a.ubind(this.uuid+":fullscreen",function(a){return function(){a.resize()}}(this))},minplayer.prototype.addEvents=function(){var a=!1;this.display.bind("mouseenter",function(b){return function(){a=!0,b.setFocus(!0)}}(this)),this.display.bind("mouseleave",function(b){return function(){a=!1,b.setFocus(!1)}}(this));var b=!1;this.display.bind("mousemove",function(c){return function(){b||(b=setTimeout(function(){b=!1,a&&c.setFocus(!0)},300))}}(this)),minplayer.get.call(this,this.options.id,null,function(a){return function(b){a.bindTo(b)}}(this))},minplayer.prototype.showError=function(a){"object"!=typeof a&&(a=a||"",this.elements.error&&(this.elements.error.text(a),a?(this.elements.error.show(),setTimeout(function(a){return function(){a.elements.error.hide("slow")}}(this),5e3)):this.elements.error.hide()))},minplayer.prototype.addKeyEvents=function(){jQuery(document).bind("keydown",function(a){return function(b){switch(b.keyCode){case 113:case 27:a.isFullScreen()&&a.fullscreen(!1)}}}(this))},minplayer.prototype.getFiles=function(){if(this.options.files)return this.options.files;if(this.options.file)return this.options.file;var a=[],b=null;return this.elements.media&&(b=this.elements.media.attr("src"),b&&a.push({path:b}),jQuery("source",this.elements.media).each(function(){a.push({path:jQuery(this).attr("src"),mimetype:jQuery(this).attr("type"),codecs:jQuery(this).attr("codecs")})})),a},minplayer.getMediaFile=function(a){if(!a)return null;if("string"==typeof a||a.path||a.id)return new minplayer.file(a);var b=0,c=null,d=null;for(var e in a)a.hasOwnProperty(e)&&(d=new minplayer.file(a[e]),d.player&&d.priority>b&&(b=d.priority,c=d));return c},minplayer.prototype.loadPlayer=function(){if(!this.options.file||0===this.elements.display.length)return!1;if(!this.options.file.player)return!1;this.showError();var a=this.options.file.player.toString();if(!this.media||a!==this.currentPlayer){if(this.currentPlayer=a,!this.elements.display)return void this.showError("No media display found.");var b={};return this.media&&(b=this.media.queue,this.media.destroy()),pClass=minplayer.players[this.options.file.player],this.options.mediaelement=this.elements.media,this.media=new pClass(this.elements.display,this.options,b),this.media.load(this.options.file),this.display.addClass("minplayer-player-"+this.media.mediaFile.player),!0}return this.media?(this.media.options=this.options,this.display.removeClass("minplayer-player-"+this.media.mediaFile.player),this.media.load(this.options.file),this.display.addClass("minplayer-player-"+this.media.mediaFile.player),!1):void 0},minplayer.prototype.load=function(a){return this.options.files=a||this.options.files,this.options.file=minplayer.getMediaFile(this.options.files),this.loadPlayer()?(this.bindTo(this.media),this.options.file.mimetype&&!this.options.file.player?(this.showError("Cannot play media: "+this.options.file.mimetype),!1):!0):!1},minplayer.prototype.resize=function(){this.get(function(a){a.onResize&&a.onResize()})};var minplayer=minplayer||{};minplayer.image=function(a,b){this.loaded=!1,this.loader=null,this.ratio=0,this.img=null,minplayer.display.call(this,"image",a,b)},minplayer.image.prototype=new minplayer.display,minplayer.image.prototype.constructor=minplayer.image,minplayer.image.prototype.construct=function(){minplayer.display.prototype.construct.call(this),this.options.pluginName="image",this.display.css("overflow","hidden"),this.loader=new Image,this.loader.onload=function(a){return function(){a.loaded=!0,a.ratio=a.loader.width/a.loader.height,a.resize(),a.trigger("loaded")}}(this),this.ready()},minplayer.image.prototype.load=function(a){this.clear(function(){this.display.empty(),this.img=jQuery(document.createElement("img")).attr({src:""}).hide(),this.display.append(this.img),this.loader.src=a,this.img.attr("src",a)})},minplayer.image.prototype.clear=function(a){this.loaded=!1,this.img?this.img.fadeOut(150,function(b){return function(){b.img.attr("src",""),b.loader.src="",jQuery(this).remove(),a&&a.call(b)}}(this)):a&&a.call(this)},minplayer.image.prototype.resize=function(a,b){if(a=a||this.display.parent().width(),b=b||this.display.parent().height(),a&&b&&this.loaded){var c=this.getScaledRect(this.ratio,{width:a,height:b});this.img&&this.img.attr("src",this.loader.src).css({marginLeft:c.x,marginTop:c.y,width:c.width,height:c.height}),this.img.fadeIn(150)}},minplayer.image.prototype.onResize=function(){this.resize()};var minplayer=minplayer||{};minplayer.file=function(a){return a?(a="string"==typeof a?{path:a}:a,a.hasOwnProperty("isMinPlayerFile")?a:(this.isMinPlayerFile=!0,this.duration=a.duration||0,this.bytesTotal=a.bytesTotal||0,this.quality=a.quality||0,this.stream=a.stream||"",this.path=a.path||"",this.codecs=a.codecs||"",this.extension=a.extension||this.getFileExtension(),this.mimetype=a.mimetype||a.filemime||this.getMimeType(),this.type=a.type||this.getType(),this.type||(this.mimetype=this.getMimeType(),this.type=this.getType()),this.player=minplayer.player||a.player||this.getBestPlayer(),this.priority=a.priority||this.getPriority(),this.id=a.id||this.getId(),void(this.path||(this.path=this.id)))):null},minplayer.player="",minplayer.file.prototype.getBestPlayer=function(){var a=null,b=0;return jQuery.each(minplayer.players,function(c){return function(d,e){var f=e.getPriority(c);e.canPlay(c)&&f>b&&(a=d,b=f)}}(this)),a},minplayer.file.prototype.getPriority=function(){var a=1;switch(this.player&&(a=minplayer.players[this.player].getPriority(this)),this.mimetype){case"video/x-webm":case"video/webm":case"application/octet-stream":case"application/vnd.apple.mpegurl":return 10*a;case"video/mp4":case"audio/mp4":case"audio/mpeg":return 9*a;case"video/ogg":case"audio/ogg":case"video/quicktime":return 8*a;default:return 5*a}},minplayer.file.prototype.getFileExtension=function(){return this.path.substring(this.path.lastIndexOf(".")+1).toLowerCase()},minplayer.file.prototype.getMimeType=function(){switch(this.extension){case"mp4":case"m4v":case"flv":case"f4v":return"video/mp4";case"m3u8":return"application/vnd.apple.mpegurl";case"webm":return"video/webm";case"ogg":case"ogv":return"video/ogg";case"3g2":return"video/3gpp2";case"3gpp":case"3gp":return"video/3gpp";case"mov":return"video/quicktime";case"swf":return"application/x-shockwave-flash";case"oga":return"audio/ogg";case"mp3":return"audio/mpeg";case"m4a":case"f4a":return"audio/mp4";case"aac":return"audio/aac";case"wav":return"audio/vnd.wave";case"wma":return"audio/x-ms-wma";default:return"unknown"}},minplayer.file.prototype.getType=function(){var a=this.mimetype.match(/([^\/]+)(\/)/);if(a=a&&a.length>1?a[1]:"","video"===a)return"video";if("audio"===a)return"audio";switch(this.mimetype){case"application/octet-stream":case"application/x-shockwave-flash":case"application/vnd.apple.mpegurl":return"video"}return""},minplayer.file.prototype.getId=function(){var a=minplayer.players[this.player];return a&&a.getMediaId?a.getMediaId(this):""};var minplayer=minplayer||{};minplayer.playLoader=function(a,b){this.clear(),minplayer.display.call(this,"playLoader",a,b)},minplayer.playLoader.prototype=new minplayer.display,minplayer.playLoader.prototype.constructor=minplayer.playLoader,minplayer.playLoader.prototype.construct=function(){minplayer.display.prototype.construct.call(this),this.options.pluginName="playLoader",this.initializePlayLoader(),this.ready()},minplayer.playLoader.prototype.initializePlayLoader=function(){this.get("media",function(a){if(a.hasPlayLoader(this.options.preview))this.enabled=!1,this.hide(this.elements.busy),this.hide(this.elements.bigPlay),this.hide(this.elements.preview),this.hide();else{this.enabled=!0,this.options.preview||(this.options.preview=a.poster);var b=!0;this.preview&&this.preview.loader&&(b=this.preview.loader.src!==this.options.preview),b&&(a.elements.media.attr("poster",""),this.loadPreview()),this.elements.bigPlay&&minplayer.click(this.elements.bigPlay.unbind(),function(b){b.preventDefault(),jQuery(this).hide(),a.play()}),a.ubind(this.uuid+":loadstart",function(a){return function(){a.busy.setFlag("media",!0),a.bigPlay.setFlag("media",!0),a.previewFlag.setFlag("media",!0),a.checkVisibility()}}(this)),a.ubind(this.uuid+":waiting",function(a){return function(b,c,d){d||(a.busy.setFlag("media",!0),a.checkVisibility())}}(this)),a.ubind(this.uuid+":loadeddata",function(a){return function(b,c,d){d||(a.busy.setFlag("media",!1),a.checkVisibility())}}(this)),a.ubind(this.uuid+":playing",function(b){return function(c,d,e){e||(b.busy.setFlag("media",!1),b.bigPlay.setFlag("media",!1),"audio"!==a.mediaFile.type&&b.previewFlag.setFlag("media",!1),b.checkVisibility())}}(this)),a.ubind(this.uuid+":pause",function(a){return function(b,c,d){d||(a.busy.setFlag("media",!1),a.bigPlay.setFlag("media",!0),a.checkVisibility())}}(this))}})},minplayer.playLoader.prototype.clear=function(a){this.busy=new minplayer.flags,this.bigPlay=new minplayer.flags,this.previewFlag=new minplayer.flags,this.enabled=!0,this.preview?this.preview.clear(function(b){return function(){b.preview=null,a&&a()}}(this)):(this.preview=null,a&&a())},minplayer.playLoader.prototype.loadPreview=function(a){if(a=a||this.options.preview,this.options.preview=a,this.enabled&&0!==this.display.length){if(this.elements.preview){if(this.options.preview)return this.elements.preview.addClass("has-preview").show(),this.preview=new minplayer.image(this.elements.preview,this.options),this.preview.load(this.options.preview),!0;this.elements.preview.hide()}return!1}},minplayer.playLoader.prototype.checkVisibility=function(){this.enabled&&(this.busy.flag?this.elements.busy.show():this.elements.busy.hide(),this.bigPlay.flag?this.elements.bigPlay.show():this.elements.bigPlay.hide(),this.previewFlag.flag?this.elements.preview.show():this.elements.preview.hide(),(this.bigPlay.flag||this.busy.flag||this.previewFlag.flag)&&this.display.show(),this.bigPlay.flag||this.busy.flag||this.previewFlag.flag||this.display.hide())};var minplayer=minplayer||{};minplayer.players=minplayer.players||{},minplayer.players.base=function(a,b,c){minplayer.display.call(this,"media",a,b,c)},minplayer.players.base.prototype=new minplayer.display,minplayer.players.base.prototype.constructor=minplayer.players.base,minplayer.players.base.prototype.getElements=function(){var a=minplayer.display.prototype.getElements.call(this);return jQuery.extend(a,{media:this.options.mediaelement})},minplayer.players.base.prototype.defaultOptions=function(a){a.range={min:0,max:0},minplayer.display.prototype.defaultOptions.call(this,a)},minplayer.players.base.getPriority=function(){return 0},minplayer.players.base.getMediaId=function(){return""},minplayer.players.base.canPlay=function(){return!1},minplayer.players.base.prototype.construct=function(){minplayer.display.prototype.construct.call(this),this.elements.media&&(this.poster=this.elements.media.attr("poster")),this.options.pluginName="basePlayer",this.readyQueue=[],this.loadedQueue=[],this.mediaFile=this.options.file,this.clear(),this.setupPlayer()},minplayer.players.base.prototype.setupPlayer=function(){this.playerFound()||this.addPlayer(),this.player=this.getPlayer(),minplayer.click(this.display,function(a){return function(){a.playing?a.pause():a.play()}}(this)),jQuery(document).bind("keydown",function(a){return function(b){if(a.hasFocus)switch(b.preventDefault(),b.keyCode){case 32:case 179:a.playing?a.pause():a.play();break;case 38:a.setVolumeRelative(.1);break;case 40:a.setVolumeRelative(-.1);break;case 37:case 227:a.seekRelative(-.05);break;case 39:case 228:a.seekRelative(.05)}}}(this))},minplayer.players.base.prototype.addPlayer=function(){this.elements.media&&this.elements.media.remove(),this.elements.media=jQuery(this.createPlayer()),this.display.html(this.elements.media)},minplayer.players.base.prototype.destroy=function(){minplayer.plugin.prototype.destroy.call(this),this.clear()},minplayer.players.base.prototype.clear=function(){this.playerReady=!1,this.reset(),this.player&&(jQuery(this.player).remove(),this.player=null)},minplayer.players.base.prototype.reset=function(){this.realDuration=0,this.duration=new minplayer.async,this.currentTime=new minplayer.async,this.bytesLoaded=new minplayer.async,this.bytesTotal=new minplayer.async,this.bytesStart=new minplayer.async,this.volume=new minplayer.async,this.hasFocus=!1,this.playing=!1,this.loading=!1,this.loaded=!1,this.trigger("pause",null,!0),this.trigger("waiting",null,!0),this.trigger("progress",{loaded:0,total:0,start:0},!0),this.trigger("timeupdate",{currentTime:0,duration:0},!0)},minplayer.players.base.prototype.onReady=function(){if(!this.playerReady)if(this.setStartStop(),this.playerReady=!0,this.setVolume(this.options.volume/100),this.loading=!0,this.poll("progress",function(a){return function(){return a.loading&&a.getBytesLoaded(function(b){a.getBytesTotal(function(c){if(b||c){var d=0;a.getBytesStart(function(a){d=a}),a.trigger("progress",{loaded:b,total:c,start:d}),b>=c&&(a.loading=!1)}})}),a.loading}}(this),1e3),this.ready(),this.isReady()){for(var a in this.readyQueue)this.readyQueue[a].call(this);this.readyQueue.length=0,this.readyQueue=[],this.loaded||this.trigger("loadstart")}else this.readyQueue.length=0,this.readyQueue=[]},minplayer.players.base.prototype.parseTime=function(a){var b=0,c=0,d=0;return a?("string"!=typeof a&&(a=String(a)),b=a.match(/([0-9]+)s/i),b&&(b=parseInt(b[1],10)),c=a.match(/([0-9]+)m/i),c&&(b+=60*parseInt(c[1],10)),d=a.match(/([0-9]+)h/i),d&&(b+=3600*parseInt(d[1],10)),b||(b=a),Number(b)):0},minplayer.players.base.prototype.setStartStop=function(){return this.startTime?this.startTime:(this.startTime=0,this.offsetTime=this.parseTime(this.options.range.min),minplayer.urlVars&&(this.startTime=this.parseTime(minplayer.urlVars.seek)),this.startTime||(this.startTime=this.offsetTime),this.stopTime=this.options.range.max?this.parseTime(this.options.range.max):0,this.mediaRange=this.stopTime-this.offsetTime,this.mediaRange<0&&(this.mediaRange=0),this.startTime)},minplayer.players.base.prototype.onPlaying=function(){if(!this.playing){var a=this;this.getDuration(function(b){a.startTime&&a.startTime-1&&1>a?(c/d+parseFloat(a))*d:c+parseFloat(a),b.seek(e)}})}}(this))},minplayer.players.base.prototype.seek=function(a,b,c){this.whenLoaded(function(){a=Number(a),c||(a+=this.offsetTime),this._seek(a),b&&b.call(this)})},minplayer.players.base.prototype._seek=function(){},minplayer.players.base.prototype.setVolumeRelative=function(a){this.getVolume(function(b){return function(c){c+=parseFloat(a),c=0>c?0:c,c=c>1?1:c,b.setVolume(c)}}(this))},minplayer.players.base.prototype.setVolume=function(a,b){this.trigger("volumeupdate",a),this.whenLoaded(b)},minplayer.players.base.prototype.getValue=function(a,b,c){this.whenLoaded(function(){var d=this;this[a](function(a){null!==a?c.call(d,a):d[b].get(c)})})},minplayer.players.base.prototype.getVolume=function(a){this.getValue("_getVolume","volume",a)},minplayer.players.base.prototype._getVolume=function(a){a(null)},minplayer.players.base.prototype.getCurrentTime=function(a){var b=this;this.getValue("_getCurrentTime","currentTime",function(c){b.setStartStop(),b.stopTime&&c>b.stopTime&&b.stop(function(){b.onComplete()}),c-=b.offsetTime,a(c)})},minplayer.players.base.prototype._getCurrentTime=function(a){a(null)},minplayer.players.base.prototype.getDuration=function(a){if(this.options.duration)a(this.options.duration);else{var b=this;this.getValue("_getDuration","duration",function(c){b.setStartStop(),b.realDuration=c,a(b.mediaRange?b.mediaRange:c) -})}},minplayer.players.base.prototype._getDuration=function(a){a(null)},minplayer.players.base.prototype.getBytesStart=function(a){this.getValue("_getBytesStart","bytesStart",a)},minplayer.players.base.prototype._getBytesStart=function(a){a(null)},minplayer.players.base.prototype.getBytesLoaded=function(a){this.getValue("_getBytesLoaded","bytesLoaded",a)},minplayer.players.base.prototype._getBytesLoaded=function(a){a(null)},minplayer.players.base.prototype.getBytesTotal=function(a){this.getValue("_getBytesTotal","bytesTotal",a)},minplayer.players.base.prototype._getBytesTotal=function(a){a(null)};var minplayer=minplayer||{};minplayer.players=minplayer.players||{},minplayer.players.dailymotion=function(a,b,c){this.quality="default",minplayer.players.base.call(this,a,b,c)},minplayer.players.dailymotion.prototype=new minplayer.players.base,minplayer.players.dailymotion.prototype.constructor=minplayer.players.dailymotion,minplayer.players.dailymotion.prototype.construct=function(){minplayer.players.base.prototype.construct.call(this),this.options.pluginName="dailymotion"},minplayer.players.dailymotion.getPriority=function(){return 10},minplayer.players.dailymotion.canPlay=function(a){if("video/dailymotion"===a.mimetype)return!0;var b=/^http(s)?\:\/\/(www\.)?(dailymotion\.com)/i;return 0===a.path.search(b)},minplayer.players.dailymotion.getMediaId=function(a){var b="^http[s]?\\:\\/\\/(www\\.)?";b+="(dailymotion\\.com\\/video/)",b+="([a-z0-9\\-]+)",b+="_*";var c=RegExp(b,"i");return 0===a.path.search(c)?a.path.match(c)[3]:a.path},minplayer.players.dailymotion.getImage=function(a,b,c){c("http://www.dailymotion.com/thumbnail/video/"+a.id)},minplayer.players.dailymotion.parseNode=function(){return{title:node.title,description:node.description,mediafiles:{image:{thumbnail:{path:node.thumbnail_small_url},image:{path:node.thumbnail_url}},media:{media:{player:"dailymotion",id:node.id}}}}},minplayer.players.dailymotion.getNode=function(a,b){var c="https://api.dailymotion.com/video/"+a.id;c+="?fields=title,id,description,thumbnail_small_url,thumbnail_url",jQuery.get(c,function(a){b(minplayer.players.dailymotion.parseNode(a.data))},"jsonp")},minplayer.players.dailymotion.prototype.onReady=function(){minplayer.players.base.prototype.onReady.call(this),this.options.autoplay||this.pause(),this.onLoaded()},minplayer.players.dailymotion.prototype.playerFound=function(){return this.display.find(this.mediaFile.type).length>0},minplayer.players.dailymotion.prototype.onQualityChange=function(a){this.quality=a.data},minplayer.players.dailymotion.prototype.hasPlayLoader=function(a){return minplayer.hasTouch||!a},minplayer.players.dailymotion.prototype.hasController=function(){return minplayer.isIDevice},minplayer.players.dailymotion.prototype.createPlayer=function(){minplayer.players.base.prototype.createPlayer.call(this);var a=document.location.protocol;if(a+="//api.dmcdn.net/all.js",0===jQuery('script[src="'+a+'"]').length){var b=document.createElement("script");b.src=a;var c=document.getElementsByTagName("script")[0];c.parentNode.insertBefore(b,c)}return this.playerId=this.options.id+"-player",this.poll(this.options.id+"_dailymotion",function(a){return function(){var b=jQuery("#"+a.playerId).length>0;if(b=b&&"DM"in window,b=b&&"function"==typeof DM.player){jQuery("#"+a.playerId).addClass("dailymotion-player");var c={};c={id:a.playerId,api:minplayer.isIDevice?0:1,wmode:"opaque",controls:minplayer.isAndroid?1:0,related:0,info:0,logo:0},a.player=new DM.player(a.playerId,{video:a.mediaFile.id,height:"100%",width:"100%",frameborder:0,params:c}),a.player.addEventListener("apiready",function(){a.onReady(a)}),a.player.addEventListener("ended",function(){a.onComplete(a)}),a.player.addEventListener("playing",function(){a.onPlaying(a)}),a.player.addEventListener("progress",function(){a.onWaiting(a)}),a.player.addEventListener("pause",function(){a.onPaused(a)}),a.player.addEventListener("error",function(){a.onError(a)})}return!b}}(this),200),jQuery(document.createElement("div")).attr({id:this.playerId})},minplayer.players.dailymotion.prototype.load=function(a,b){minplayer.players.base.prototype.load.call(this,a,function(){this.player.load(a.id),b&&b.call(this)})},minplayer.players.dailymotion.prototype.play=function(a){minplayer.players.base.prototype.play.call(this,function(){this.onWaiting(),this.player.play(),a&&a.call(this)})},minplayer.players.dailymotion.prototype.pause=function(a){minplayer.players.base.prototype.pause.call(this,function(){this.loaded&&(this.player.pause(),a&&a.call(this))})},minplayer.players.dailymotion.prototype.stop=function(a){minplayer.players.base.prototype.stop.call(this,function(){this.player.pause(),a&&a.call(this)})},minplayer.players.dailymotion.prototype._seek=function(a){this.onWaiting(),this.player.seek(a)},minplayer.players.dailymotion.prototype.setVolume=function(a,b){minplayer.players.base.prototype.setVolume.call(this,a,function(){this.loaded&&(this.player.setVolume(a),void 0!==b&&b.call(this))})},minplayer.players.dailymotion.prototype._getVolume=function(a){a(this.player.volume)},minplayer.players.dailymotion.prototype._getDuration=function(a){a(this.player.duration)},minplayer.players.dailymotion.prototype._getCurrentTime=function(a){a(this.player.currentTime)};var minplayer=minplayer||{};minplayer.players=minplayer.players||{},minplayer.players.html5=function(a,b,c){minplayer.players.base.call(this,a,b,c)},minplayer.players.html5.prototype=new minplayer.players.base,minplayer.players.html5.prototype.constructor=minplayer.players.html5,minplayer.players.html5.getPriority=function(){return 10},minplayer.players.html5.canPlay=function(a){switch(a.mimetype){case"video/ogg":return!!minplayer.playTypes.videoOGG;case"video/mp4":case"video/x-mp4":case"video/m4v":case"video/x-m4v":return!!minplayer.playTypes.videoH264;case"application/vnd.apple.mpegurl":return!!minplayer.playTypes.videoMPEGURL;case"video/x-webm":case"video/webm":case"application/octet-stream":return!!minplayer.playTypes.videoWEBM;case"audio/ogg":return!!minplayer.playTypes.audioOGG;case"audio/mpeg":return!!minplayer.playTypes.audioMP3;case"audio/mp4":return!!minplayer.playTypes.audioMP4;default:return!1}},minplayer.players.html5.prototype.construct=function(){minplayer.players.base.prototype.construct.call(this),this.options.pluginName="html5",this.hasEnded=!1,this.addPlayerEvents()},minplayer.players.html5.prototype.addPlayerEvent=function(a,b){this.player&&this.player.addEventListener(a,function(c){var d=a+"Event";return c[d]&&c.player.removeEventListener(a,c[d],!1),c[d]=function(a){b.call(c,a)},c[d]}(this),!1)},minplayer.players.html5.prototype.addPlayerEvents=function(){if(this.player){this.addPlayerEvent("abort",function(){this.trigger("abort")}),this.addPlayerEvent("loadstart",function(){this.onReady(),this.options.autoload||this.onLoaded()}),this.addPlayerEvent("loadeddata",function(){this.onLoaded()}),this.addPlayerEvent("loadedmetadata",function(){this.onLoaded()}),this.addPlayerEvent("canplaythrough",function(){this.onLoaded()}),this.addPlayerEvent("ended",function(){this.hasEnded=!0,this.onComplete()}),this.addPlayerEvent("pause",function(){this.onPaused()}),this.addPlayerEvent("play",function(){this.onPlaying()}),this.addPlayerEvent("playing",function(){this.onPlaying()});var a=!1;return this.addPlayerEvent("error",function(){this.hasEnded||a||!this.player||(a=!0,this.trigger("error","An error occured - "+this.player.error.code))}),this.addPlayerEvent("waiting",function(){this.onWaiting()}),this.addPlayerEvent("durationchange",function(){if(this.player){this.duration.set(this.player.duration);var a=this;this.getDuration(function(b){a.trigger("durationchange",{duration:b})})}}),this.addPlayerEvent("progress",function(a){this.bytesTotal.set(a.total),this.bytesLoaded.set(a.loaded)}),!0}return!1},minplayer.players.html5.prototype.onReady=function(){minplayer.players.base.prototype.onReady.call(this),minplayer.isAndroid&&this.onLoaded(),minplayer.isIDevice&&setTimeout(function(a){return function(){a.pause(),a.onLoaded()}}(this),1)},minplayer.players.html5.prototype.playerFound=function(){return this.display.find(this.mediaFile.type).length>0},minplayer.players.html5.prototype.createPlayer=function(){minplayer.players.base.prototype.createPlayer.call(this);var a=jQuery(document.createElement(this.mediaFile.type)).attr(this.options.attributes).append(jQuery(document.createElement("source")).attr({src:this.mediaFile.path}));a.eq(0)[0].setAttribute("width","100%"),a.eq(0)[0].setAttribute("height","100%");var b=this.options.autoload?"metadata":"none";return b=minplayer.isIDevice?"metadata":b,a.eq(0)[0].setAttribute("preload",b),this.options.autoload||a.eq(0)[0].setAttribute("autobuffer",!1),a},minplayer.players.html5.prototype.getPlayer=function(){return this.elements.media.eq(0)[0]},minplayer.players.html5.prototype.load=function(a,b){minplayer.players.base.prototype.load.call(this,a,function(){this.hasEnded=!1;var c=this.elements.media.attr("src");c||(c=jQuery("source",this.elements.media).eq(0).attr("src")),c!==a.path&&(this.addPlayer(),this.player=this.getPlayer(),this.addPlayerEvents(),this.player.src=a.path,b&&b.call(this))})},minplayer.players.html5.prototype.play=function(a){minplayer.players.base.prototype.play.call(this,function(){this.player.play(),a&&a.call(this)})},minplayer.players.html5.prototype.pause=function(a){minplayer.players.base.prototype.pause.call(this,function(){this.player.pause(),a&&a.call(this)})},minplayer.players.html5.prototype.stop=function(a){minplayer.players.base.prototype.stop.call(this,function(){this.player.pause(),a&&a.call(this)})},minplayer.players.html5.prototype.clear=function(){minplayer.players.base.prototype.clear.call(this),this.player&&(this.player.src="")},minplayer.players.html5.prototype._seek=function(a){this.player.currentTime=a},minplayer.players.html5.prototype.setVolume=function(a,b){minplayer.players.base.prototype.setVolume.call(this,a,function(){this.player.volume=a,b&&b.call(this)})},minplayer.players.html5.prototype._getVolume=function(a){a(this.player.volume)},minplayer.players.html5.prototype._getDuration=function(a){a(this.player.duration)},minplayer.players.html5.prototype._getCurrentTime=function(a){a(this.player.currentTime)},minplayer.players.html5.prototype._getBytesLoaded=function(a){var b=0;this.bytesLoaded.value?b=this.bytesLoaded.value:this.player.buffered&&this.player.buffered.length>0&&this.player.buffered.end&&this.player.duration?b=this.player.buffered.end(0):void 0!==this.player.bytesTotal&&this.player.bytesTotal>0&&void 0!==this.player.bufferedBytes&&(b=this.player.bufferedBytes),a(b)},minplayer.players.html5.prototype._getBytesTotal=function(a){var b=0;this.bytesTotal.value?b=this.bytesTotal.value:this.player.buffered&&this.player.buffered.length>0&&this.player.buffered.end&&this.player.duration?b=this.player.duration:void 0!==this.player.bytesTotal&&this.player.bytesTotal>0&&void 0!==this.player.bufferedBytes&&(b=this.player.bytesTotal),a(b)};var minplayer=minplayer||{};minplayer.players=minplayer.players||{},minplayer.players.flash=function(a,b,c){minplayer.players.base.call(this,a,b,c)},minplayer.players.flash.prototype=new minplayer.players.base,minplayer.players.flash.prototype.constructor=minplayer.players.flash,minplayer.players.flash.prototype.construct=function(){minplayer.players.base.prototype.construct.call(this),this.options.pluginName="flash"},minplayer.players.flash.getPriority=function(){return 0},minplayer.players.flash.canPlay=function(){return!1},minplayer.players.flash.prototype.getFlash=function(a){var b=document.createElement("script");b.src="//ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js";var c=document.getElementsByTagName("script")[0];return c.parentNode.insertBefore(b,c),setTimeout(function(b){return function c(){"undefined"!=typeof swfobject?swfobject.embedSWF(a.swf,a.id,a.width,a.height,"9.0.0",!1,a.flashvars,{allowscriptaccess:"always",allowfullscreen:"true",wmode:a.wmode,quality:"high"},{id:a.id,name:a.id,playerType:"flash"},function(a){b.player=a.ref}):setTimeout(c,200)}}(this),200),'
'},minplayer.players.flash.prototype.playerFound=function(){return this.display.find('object[playerType="flash"]').length>0};var minplayer=minplayer||{};minplayer.players=minplayer.players||{},minplayer.players.minplayer=function(a,b,c){minplayer.players.flash.call(this,a,b,c)},minplayer.players.minplayer.prototype=new minplayer.players.flash,minplayer.players.minplayer.prototype.constructor=minplayer.players.minplayer,minplayer.players.minplayer.prototype.construct=function(){minplayer.players.flash.prototype.construct.call(this),this.options.pluginName="minplayer"},window.onFlashPlayerReady=function(a){for(var b=minplayer.get(a,"media"),c=b.length;c--;)b[c].onReady()},window.onFlashPlayerUpdate=function(a,b){for(var c=minplayer.get(a,"media"),d=c.length;d--;)c[d].onMediaUpdate(b)},window.onFlashPlayerDebug=function(a){console&&console.log&&console.log(a)},minplayer.players.minplayer.getPriority=function(a){return a.stream?100:1},minplayer.players.minplayer.canPlay=function(a){if(a.stream)return!0;var b=jQuery.inArray(a.mimetype,["video/x-webm","video/webm","application/octet-stream"])>=0;return!b&&("video"===a.type||"audio"===a.type)},minplayer.players.minplayer.prototype.createPlayer=function(){this.options.swfplayer||(this.options.swfplayer="http://mediafront.org/assets/osmplayer/minplayer",this.options.swfplayer+="/flash/minplayer.swf"),minplayer.players.flash.prototype.createPlayer.call(this);var a={id:this.options.id,debug:this.options.debug,config:"nocontrols",file:this.mediaFile.path,autostart:this.options.autoplay,autoload:this.options.autoload};return this.mediaFile.stream&&(a.stream=this.mediaFile.stream),this.getFlash({swf:this.options.swfplayer,id:this.options.id+"_player",width:"100%",height:"100%",flashvars:a,wmode:this.options.wmode})},minplayer.players.minplayer.prototype.onMediaUpdate=function(a){switch(a){case"mediaMeta":this.onLoaded();break;case"mediaConnected":this.onLoaded(),this.onPaused();break;case"mediaPlaying":this.onPlaying();break;case"mediaPaused":this.onPaused();break;case"mediaComplete":this.onComplete()}},minplayer.players.minplayer.prototype.load=function(a,b){minplayer.players.flash.prototype.load.call(this,a,function(){this.loaded?this.stop(function(){this.player.loadMedia(a.path,a.stream),b&&b.call(this)}):(this.player.loadMedia(a.path,a.stream),b&&b.call(this))})},minplayer.players.minplayer.prototype.play=function(a){minplayer.players.flash.prototype.play.call(this,function(){this.player.playMedia(),a&&a.call(this)})},minplayer.players.minplayer.prototype.pause=function(a){minplayer.players.flash.prototype.pause.call(this,function(){this.player.pauseMedia(),a&&a.call(this)})},minplayer.players.minplayer.prototype.stop=function(a){minplayer.players.flash.prototype.stop.call(this,function(){this.player.stopMedia(),a&&a.call(this)})},minplayer.players.minplayer.prototype._seek=function(a){this.player.seekMedia(a)},minplayer.players.minplayer.prototype.setVolume=function(a,b){minplayer.players.flash.prototype.setVolume.call(this,a,function(){this.player.setVolume(a),b&&b.call(this)})},minplayer.players.minplayer.prototype._getVolume=function(a){a(this.player.getVolume())},minplayer.players.minplayer.prototype._getDuration=function(a){var b=this,c=0,d=function(){c=b.player.getDuration(),c?a(c):setTimeout(d,1e3)};d()},minplayer.players.minplayer.prototype._getCurrentTime=function(a){a(this.player.getCurrentTime())},minplayer.players.minplayer.prototype._getBytesLoaded=function(a){a(this.player.getMediaBytesLoaded())},minplayer.players.minplayer.prototype._getBytesTotal=function(a){a(this.player.getMediaBytesTotal())};var minplayer=minplayer||{};minplayer.players=minplayer.players||{},minplayer.players.youtube=function(a,b,c){this.quality="default",minplayer.players.base.call(this,a,b,c)},minplayer.players.youtube.prototype=new minplayer.players.base,minplayer.players.youtube.prototype.constructor=minplayer.players.youtube,minplayer.players.youtube.prototype.construct=function(){minplayer.players.base.prototype.construct.call(this),this.options.pluginName="youtube"},minplayer.players.youtube.getPriority=function(){return 10},minplayer.players.youtube.canPlay=function(a){if("video/youtube"===a.mimetype)return!0;var b=/^http(s)?\:\/\/(www\.)?(youtube\.com|youtu\.be)/i;return 0===a.path.search(b)},minplayer.players.youtube.getMediaId=function(a){var b="^http[s]?\\:\\/\\/(www\\.)?";b+="(youtube\\.com\\/watch\\?v=|youtu\\.be\\/)",b+="([a-zA-Z0-9_\\-]+)";var c=RegExp(b,"i");return 0===a.path.search(c)?a.path.match(c)[3]:a.path},minplayer.players.youtube.getImage=function(a,b,c){b="thumbnail"===b?"1":"0",c("https://img.youtube.com/vi/"+a.id+"/"+b+".jpg")},minplayer.players.youtube.parseNode=function(a){var b="undefined"!=typeof a.video?a.video:a;return{title:b.title,description:b.description,mediafiles:{image:{thumbnail:{path:b.thumbnail.sqDefault},image:{path:b.thumbnail.hqDefault}},media:{media:{player:"youtube",id:b.id}}}}},minplayer.players.youtube.getNode=function(a,b){var c="https://gdata.youtube.com/feeds/api/videos/"+a.id;c+="?v=2&alt=jsonc",jQuery.get(c,function(a){b(minplayer.players.youtube.parseNode(a.data))})},minplayer.players.youtube.prototype.setPlayerState=function(a){switch(a){case YT.PlayerState.CUED:break;case YT.PlayerState.BUFFERING:this.onWaiting();break;case YT.PlayerState.UNSTARTED:case YT.PlayerState.PAUSED:this.onPaused();break;case YT.PlayerState.PLAYING:this.onPlaying();break;case YT.PlayerState.ENDED:this.onComplete()}},minplayer.players.youtube.prototype.onReady=function(){minplayer.players.base.prototype.onReady.call(this),this.options.autoplay||this.pause(),this.onLoaded()},minplayer.players.youtube.prototype.playerFound=function(){var a="iframe#"+this.options.id+"-player.youtube-player",b=this.display.find(a);return b.length>0},minplayer.players.youtube.prototype.onPlayerStateChange=function(a){this.setPlayerState(a.data)},minplayer.players.youtube.prototype.onQualityChange=function(a){this.quality=a.data},minplayer.players.youtube.prototype.hasPlayLoader=function(a){return minplayer.hasTouch||!a},minplayer.players.youtube.prototype.hasController=function(){return minplayer.isIDevice},minplayer.players.youtube.prototype.createPlayer=function(){minplayer.players.base.prototype.createPlayer.call(this);var a="https://www.youtube.com/iframe_api";if(0===jQuery('script[src="'+a+'"]').length){var b=document.createElement("script");b.src=a;var c=document.getElementsByTagName("script")[0];c.parentNode.insertBefore(b,c)}return this.playerId=this.options.id+"-player",this.poll(this.options.id+"_youtube",function(a){return function(){var b=jQuery("#"+a.playerId).length>0;if(b=b&&"YT"in window,b=b&&"function"==typeof YT.Player){jQuery("#"+a.playerId).addClass("youtube-player");var c=location.protocol;c+="//"+location.hostname,c+=location.port&&":"+location.port;var d={};minplayer.isIDevice?d.origin=c:d={enablejsapi:minplayer.isIDevice?0:1,origin:c,wmode:"opaque",controls:minplayer.isAndroid?1:0,rel:0,showinfo:0},a.player=new YT.Player(a.playerId,{height:"100%",width:"100%",frameborder:0,videoId:a.mediaFile.id,playerVars:d,events:{onReady:function(b){a.onReady(b)},onStateChange:function(b){a.onPlayerStateChange(b)},onPlaybackQualityChange:function(b){a.onQualityChange(b)},onError:function(b){a.onError(b)}}})}return!b}}(this),200),jQuery(document.createElement("div")).attr({id:this.playerId})},minplayer.players.youtube.prototype.load=function(a,b){minplayer.players.base.prototype.load.call(this,a,function(){this.player.loadVideoById(a.id,0,this.quality),b&&b.call(this)})},minplayer.players.youtube.prototype.play=function(a){minplayer.players.base.prototype.play.call(this,function(){this.onWaiting(),this.player.playVideo(),a&&a.call(this)})},minplayer.players.youtube.prototype.pause=function(a){minplayer.players.base.prototype.pause.call(this,function(){this.player.pauseVideo(),a&&a.call(this)})},minplayer.players.youtube.prototype.stop=function(a){minplayer.players.base.prototype.stop.call(this,function(){this.player.stopVideo(),a&&a.call(this)})},minplayer.players.youtube.prototype._seek=function(a){this.onWaiting(),this.player.seekTo(a,!0)},minplayer.players.youtube.prototype.setVolume=function(a,b){minplayer.players.base.prototype.setVolume.call(this,a,function(){this.player.setVolume(100*a),b&&b.call(this)})},minplayer.players.youtube.prototype._getVolume=function(a){a(this.player.getVolume())},minplayer.players.youtube.prototype._getDuration=function(a){a(this.player.getDuration())},minplayer.players.youtube.prototype._getCurrentTime=function(a){a(this.player.getCurrentTime())},minplayer.players.youtube.prototype._getBytesStart=function(a){a(this.player.getVideoStartBytes())},minplayer.players.youtube.prototype._getBytesLoaded=function(a){a(this.player.getVideoBytesLoaded())},minplayer.players.youtube.prototype._getBytesTotal=function(a){a(this.player.getVideoBytesTotal())};var minplayer=minplayer||{};minplayer.players=minplayer.players||{},minplayer.players.vimeo=function(a,b,c){minplayer.players.base.call(this,a,b,c)},minplayer.players.vimeo.prototype=new minplayer.players.base,minplayer.players.vimeo.prototype.constructor=minplayer.players.vimeo,minplayer.players.vimeo.prototype.construct=function(){minplayer.players.base.prototype.construct.call(this),this.options.pluginName="vimeo"},minplayer.players.vimeo.getPriority=function(){return 10},minplayer.players.vimeo.canPlay=function(a){return"video/vimeo"===a.mimetype?!0:0===a.path.search(/^http(s)?\:\/\/(www\.)?vimeo\.com/i)},minplayer.players.vimeo.prototype.hasPlayLoader=function(){return minplayer.hasTouch},minplayer.players.vimeo.prototype.hasController=function(){return minplayer.hasTouch},minplayer.players.vimeo.getMediaId=function(a){var b=/^http[s]?\:\/\/(www\.)?vimeo\.com\/(\?v\=)?([0-9]+)/i;return 0===a.path.search(b)?a.path.match(b)[3]:a.path},minplayer.players.vimeo.parseNode=function(a){return{title:a.title,description:a.description,mediafiles:{image:{thumbnail:{path:a.thumbnail_small},image:{path:a.thumbnail_large}},media:{media:{player:"vimeo",id:a.id}}}}},minplayer.players.vimeo.nodes={},minplayer.players.vimeo.getNode=function(a,b){minplayer.players.vimeo.nodes.hasOwnProperty(a.id)?b(minplayer.players.vimeo.nodes[a.id]):jQuery.ajax({url:"https://vimeo.com/api/v2/video/"+a.id+".json",dataType:"jsonp",success:function(c){var d=minplayer.players.vimeo.parseNode(c[0]);minplayer.players.vimeo.nodes[a.id]=d,b(d)}})},minplayer.players.vimeo.getImage=function(a,b,c){minplayer.players.vimeo.getNode(a,function(a){c(a.mediafiles.image.image)})},minplayer.players.vimeo.prototype.reset=function(){minplayer.players.base.prototype.reset.call(this)},minplayer.players.vimeo.prototype.createPlayer=function(){minplayer.players.base.prototype.createPlayer.call(this);var a="http://a.vimeocdn.com/js/froogaloop2.min.js";if(0===jQuery('script[src="'+a+'"]').length){var b=document.createElement("script");b.src=a;var c=document.getElementsByTagName("script")[0];c.parentNode.insertBefore(b,c)}var d=document.createElement("iframe");d.setAttribute("id",this.options.id+"-player"),d.setAttribute("type","text/html"),d.setAttribute("width","100%"),d.setAttribute("height","100%"),d.setAttribute("frameborder","0"),jQuery(d).addClass("vimeo-player");var e="https://player.vimeo.com/video/";return e+=this.mediaFile.id+"?",e+=jQuery.param({wmode:"opaque",api:1,player_id:this.options.id+"-player",title:0,byline:0,portrait:0,loop:this.options.loop}),d.setAttribute("src",e),this.poll(this.options.id+"_vimeo",function(a){return function(){if(window.Froogaloop){a.player=window.Froogaloop(d);var b=0;a.player.addEvent("ready",function(){clearTimeout(b),a.onReady(),a.onError("")}),b=setTimeout(function(){a.onReady()},3e3)}return!window.Froogaloop}}(this),200),this.trigger("loadstart"),d},minplayer.players.vimeo.prototype.onReady=function(){this.player.addEvent("loadProgress",function(a){return function(b){a.duration.set(parseFloat(b.duration)),a.bytesLoaded.set(b.bytesLoaded),a.bytesTotal.set(b.bytesTotal)}}(this)),this.player.addEvent("playProgress",function(a){return function(b){a.duration.set(parseFloat(b.duration)),a.currentTime.set(parseFloat(b.seconds))}}(this)),this.player.addEvent("play",function(a){return function(){a.onPlaying()}}(this)),this.player.addEvent("pause",function(a){return function(){a.onPaused()}}(this)),this.player.addEvent("finish",function(a){return function(){a.onComplete()}}(this)),minplayer.players.base.prototype.onReady.call(this),this.onLoaded(),this.options.autoplay&&this.play()},minplayer.players.vimeo.prototype.clear=function(){this.player&&this.player.api("unload"),minplayer.players.base.prototype.clear.call(this)},minplayer.players.vimeo.prototype.load=function(a,b){minplayer.players.base.prototype.load.call(this,a,function(){this.construct(),b&&b.call(this)})},minplayer.players.vimeo.prototype.play=function(a){minplayer.players.base.prototype.play.call(this,function(){this.player.api("play"),a&&a.call(this)})},minplayer.players.vimeo.prototype.pause=function(a){minplayer.players.base.prototype.pause.call(this,function(){this.player.api("pause"),a&&a.call(this)})},minplayer.players.vimeo.prototype.stop=function(a){minplayer.players.base.prototype.stop.call(this,function(){this.player.api("unload"),a&&a.call(this)})},minplayer.players.vimeo.prototype._seek=function(a){this.player.api("seekTo",a)},minplayer.players.vimeo.prototype.setVolume=function(a,b){minplayer.players.base.prototype.setVolume.call(this,a,function(){this.volume.set(a),this.player.api("setVolume",a),b&&b.call(this)})},minplayer.players.vimeo.prototype._getVolume=function(a){this.player.api("getVolume",function(b){a(b)})},minplayer.players.vimeo.prototype._getDuration=function(a){this.player.api("getDuration",function(b){a(b)})};var minplayer=minplayer||{};minplayer.players=minplayer.players||{},minplayer.players.limelight=function(a,b){minplayer.players.flash.call(this,a,b)},minplayer.players.limelight.prototype=new minplayer.players.flash,minplayer.players.limelight.prototype.constructor=minplayer.players.limelight,minplayer.players.limelight.prototype.construct=function(){minplayer.players.flash.prototype.construct.call(this),this.options.pluginName="limelight"},minplayer.players.limelight.getPriority=function(){return 10},minplayer.players.limelight.canPlay=function(a){if("video/limelight"===a.mimetype)return!0;var b=/.*limelight\.com.*/i;return 0===a.path.search(b)},minplayer.players.limelight.getMediaId=function(a){var b=/.*limelight\.com.*mediaId=([a-zA-Z0-9]+)/i;return 0===a.path.search(b)?a.path.match(b)[1]:a.path},minplayer.players.limelight.prototype.register=function(){window.delvePlayerCallback=function(a,b,c){var d=a.replace("-player","");jQuery.each(minplayer.get(d,"media"),function(a,d){d.onMediaUpdate(b,c)})}},minplayer.players.limelight.prototype.onMediaUpdate=function(a,b){switch(a){case"onPlayerLoad":this.onReady();break;case"onMediaLoad":if(this.complete)return this.pause(),void this.onPaused();this.shouldSeek=this.startTime>0,this.onLoaded();break;case"onMediaComplete":this.complete=!0,this.onComplete();break;case"onPlayheadUpdate":!b.positionInMilliseconds||this.playing||this.complete||this.onPlaying(),this.complete=!1,this.shouldSeek&&this.seekValue?(this.shouldSeek=!1,this.seek(this.seekValue)):(this.duration.set(b.durationInMilliseconds/1e3),this.currentTime.set(b.positionInMilliseconds/1e3));break;case"onError":this.onError();break;case"onPlayStateChanged":b.isPlaying?this.onPlaying():b.isBusy?this.onWaiting():this.onPaused()}},minplayer.players.limelight.prototype.createPlayer=function(){minplayer.players.flash.prototype.createPlayer.call(this);var a=document.createElement("script");a.src="https://assets.delvenetworks.com/player/embed.js";var b=document.getElementsByTagName("script")[0];b.parentNode.insertBefore(a,b),this.register();var c={deepLink:"true",autoplay:this.options.autoplay?"true":"false",startQuality:"HD"},d=null,e=this.options.channel;e||(d=/.*limelight\.com.*channelId=([a-zA-Z0-9]+)/i,0===this.mediaFile.path.search(d)&&(e=this.mediaFile.path.match(d)[1])),e&&"media"===this.mediaFile.queueType&&(c.adConfigurationChannelId=e);var f=this.options.playerForm;f||(d=/.*limelight\.com.*playerForm=([a-zA-Z0-9]+)/i,0===this.mediaFile.path.search(d)&&(f=this.mediaFile.path.match(d)[1])),f&&(c.playerForm=f),c.mediaId=this.mediaFile.id;var g=this.options.id+"-player";return setTimeout(function h(){window.hasOwnProperty("LimelightPlayerUtil")?window.LimelightPlayerUtil.initEmbed(g):setTimeout(h,1e3)},1e3),this.getFlash({swf:document.location.protocol+"//assets.delvenetworks.com/player/loader.swf",id:g,width:this.options.width,height:"100%",flashvars:c,wmode:this.options.wmode})},minplayer.players.limelight.prototype.play=function(a){minplayer.players.flash.prototype.play.call(this,function(){this.player.doPlay(),a&&a.call(this)})},minplayer.players.limelight.prototype.pause=function(a){minplayer.players.flash.prototype.pause.call(this,function(){this.player.doPause(),a&&a.call(this)})},minplayer.players.limelight.prototype.stop=function(a){minplayer.players.flash.prototype.stop.call(this,function(){this.player.doPause(),a&&a.call(this)})},minplayer.players.limelight.prototype._seek=function(a){this.seekValue=a,this.player.doSeekToSecond(a)},minplayer.players.limelight.prototype.setVolume=function(a,b){minplayer.players.flash.prototype.setVolume.call(this,a,function(){this.player.doSetVolume(a),b&&b.call(this)})},minplayer.players.limelight.prototype._getVolume=function(a){a(this.player.doGetVolume())},minplayer.players.limelight.prototype.search=function(a){this.whenReady(function(){this.player.doSearch(a)})};var minplayer=minplayer||{};minplayer.players=minplayer.players||{},minplayer.players.kaltura=function(a,b){minplayer.players.base.call(this,a,b)},minplayer.players.kaltura.prototype=new minplayer.players.base,minplayer.players.kaltura.prototype.constructor=minplayer.players.kaltura,minplayer.players.kaltura.prototype.construct=function(){minplayer.players.base.prototype.construct.call(this),this.options.pluginName="kaltura",this.adPlaying=!1},minplayer.players.kaltura.prototype.defaultOptions=function(a){a.entryId=0,a.uiConfId=0,a.partnerId=0,minplayer.players.base.prototype.defaultOptions.call(this,a)},minplayer.players.kaltura.getPriority=function(){return 10},minplayer.players.kaltura.canPlay=function(a){if("video/kaltura"===a.mimetype)return!0;var b=/.*kaltura\.com.*/i;return 0===a.path.search(b)},minplayer.players.kaltura.prototype.adStart=function(){this.adPlaying=!0,this.onPlaying()},minplayer.players.kaltura.prototype.adEnd=function(){this.adPlaying=!1},minplayer.players.kaltura.prototype.playerStateChange=function(a){if(!this.adPlaying)switch(a){case"ready":this.onLoaded();break;case"loading":case"buffering":this.onWaiting();break;case"playing":this.onPlaying();break;case"paused":this.onPaused()}},minplayer.players.kaltura.prototype.mediaReady=function(){this.onLoaded()},minplayer.players.kaltura.prototype.playerPlayEnd=function(){this.onComplete()},minplayer.players.kaltura.prototype.playUpdate=function(a){this.currentTime.set(a)},minplayer.players.kaltura.prototype.durationChange=function(a){this.duration.set(a.newValue)},minplayer.players.kaltura.prototype.getInstance=function(){if(this.instanceName)return this.instanceName;var a=this.uuid.split("__"),b="minplayer.plugins."+a[0];return b+="."+a[1],b+="["+(a[2]-1)+"]",this.instanceName=b,b},minplayer.players.kaltura.prototype.registerEvents=function(){this.player.addJsListener("adStart",this.getInstance()+".adStart"),this.player.addJsListener("adEnd",this.getInstance()+".adEnd"),this.player.addJsListener("playerStateChange",this.getInstance()+".playerStateChange"),this.player.addJsListener("durationChange",this.getInstance()+".durationChange"),this.player.addJsListener("mediaReady",this.getInstance()+".mediaReady"),this.player.addJsListener("playerUpdatePlayhead",this.getInstance()+".playUpdate"),this.player.addJsListener("playerPlayEnd",this.getInstance()+".playerPlayEnd") +function checkPlayType(a,b){if("function"==typeof a.canPlayType){if("object"==typeof b){for(var c=b.length,d="";c--&&!(d=checkPlayType(a,b[c])););return d}var e=a.canPlayType(b);if("no"!==e&&""!==e)return b}return""}var minplayer=minplayer||{};!function(a){!function(){"use strict";var a="undefined"!=typeof module&&module.exports,b="undefined"!=typeof Element&&"ALLOW_KEYBOARD_INPUT"in Element,c=function(){for(var a,b,c=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],d=0,e=c.length,f={};e>d;d++)if(a=c[d],a&&a[1]in document){for(d=0,b=a.length;b>d;d++)f[c[0][d]]=a[d];return f}return!1}(),d={request:function(a){var d=c.requestFullscreen;a=a||document.documentElement,/5\.1[\.\d]* Safari/.test(navigator.userAgent)?a[d]():a[d](b&&Element.ALLOW_KEYBOARD_INPUT)},exit:function(){document[c.exitFullscreen]()},toggle:function(a){this.isFullscreen?this.exit():this.request(a)},onchange:function(){},onerror:function(){},raw:c};return c?(Object.defineProperties(d,{isFullscreen:{get:function(){return!!document[c.fullscreenElement]}},element:{enumerable:!0,get:function(){return document[c.fullscreenElement]}},enabled:{enumerable:!0,get:function(){return!!document[c.fullscreenEnabled]}}}),document.addEventListener(c.fullscreenchange,function(a){d.onchange.call(d,a)}),document.addEventListener(c.fullscreenerror,function(a){d.onerror.call(d,a)}),void(a?module.exports=d:window.screenfull=d)):void(a?module.exports=!1:window.screenfull=!1)}(),a.screenfull=screenfull}(minplayer);var minplayer=minplayer||{};if(minplayer.compatibility=function(){var a=null;a=document.createElement("video"),this.videoOGG=checkPlayType(a,"video/ogg"),this.videoH264=checkPlayType(a,["video/mp4","video/h264"]),this.videoWEBM=checkPlayType(a,["video/x-webm","video/webm","application/octet-stream"]),this.videoMPEGURL=checkPlayType(a,"application/vnd.apple.mpegurl"),a=document.createElement("audio"),this.audioOGG=checkPlayType(a,"audio/ogg"),this.audioMP3=checkPlayType(a,"audio/mpeg"),this.audioMP4=checkPlayType(a,"audio/mp4")},minplayer.playTypes||(minplayer.playTypes=new minplayer.compatibility,minplayer.isAndroid=/android/gi.test(navigator.appVersion),minplayer.isIDevice=/iphone|ipad/gi.test(navigator.appVersion),minplayer.isPlaybook=/playbook/gi.test(navigator.appVersion),minplayer.isTouchPad=/hp-tablet/gi.test(navigator.appVersion),minplayer.hasTouch="ontouchstart"in window&&!minplayer.isTouchPad),!minplayer.urlVars){minplayer.urlVars={};var regEx=/[?&]+([^=&]+)=([^&]*)/gi;window.location.href.replace(regEx,function(a,b,c){minplayer.urlVars[b]=c})}var minplayer=minplayer||{};minplayer.async=function(){this.value=null,this.queue=[]},minplayer.async.prototype.get=function(a){null!==this.value?a(this.value):this.queue.push(a)},minplayer.async.prototype.set=function(a){this.value=a;var b=this.queue.length;if(b){for(;b--;)this.queue[b](a);this.queue=[]}};var minplayer=minplayer||{};minplayer.flags=function(){this.flag=0,this.ids={},this.numFlags=0},minplayer.flags.prototype.setFlag=function(a,b){this.ids.hasOwnProperty(a)||(this.ids[a]=this.numFlags,this.numFlags++),b?this.flag|=1<c;c++)minplayer.queue.hasOwnProperty(c)&&(b=minplayer.queue[c],d=!b.id&&!b.plugin,d|=b.plugin===a.name,d&=!b.id||b.id===this.options.id,d&&!b.addedto.hasOwnProperty(a.options.id)&&(b.addedto[a.options.id]=!0,d=minplayer.bind.call(b.context,b.event,this.options.id,a.name,b.callback,!0)));minplayer.lock=!1},minplayer.eventTypes={},minplayer.plugin.prototype.isEvent=function(a,b){var c=a+"__"+b;if("undefined"!=typeof minplayer.eventTypes[c])return minplayer.eventTypes[c];new RegExp("^(.*:)?"+b+"$","gi");return minplayer.eventTypes[c]=null!==a.match(b),minplayer.eventTypes[c]},minplayer.plugin.prototype.trigger=function(a,b,c){if(!this.active)return this;c||(this.triggered[a]=b);var d=0,e={},f=null;for(var g in this.queue)if(this.isEvent(g,a)){f=this.queue[g];for(d in f)f.hasOwnProperty(d)&&(e=f[d],e.callback({target:this,data:e.data},b))}return this},minplayer.plugin.prototype.ubind=function(a,b,c){return this.unbind(a),this.bind(a,b,c)},minplayer.plugin.prototype.bind=function(a,b,c){if(!this.active)return this;if("function"==typeof b&&(c=b,b=null),a&&c){this.queue[a]=this.queue[a]||[],this.queue[a].push({callback:c,data:b});for(var d in this.triggered)this.triggered.hasOwnProperty(d)&&this.isEvent(a,d)&&c({target:this,data:b},this.triggered[d]);return this}},minplayer.plugin.prototype.unbind=function(a){return this.lock&&setTimeout(function(b){return function(){b.unbind(a)}}(this),10),this.lock=!0,a?this.queue.hasOwnProperty(a)&&this.queue[a].length>0&&(this.queue[a].length=0):this.queue={},this.lock=!1,this},minplayer.addQueue=function(a,b,c,d,e){minplayer.lock?setTimeout(function(){minplayer.addQueue(a,c,b,d,e)},10):minplayer.queue.push({context:a,id:c,event:b,plugin:d,callback:e,addedto:{}})},minplayer.bind=function(a,b,c,d,e){if(!d)return!1;var f=minplayer.plugins,g=null,h=null,i=[],j=function(a,b){if(f.hasOwnProperty(a)&&f[a].hasOwnProperty(b))for(var c=f[a][b].length;c--;)i.push(f[a][b][c])};if(b&&c)j(b,c);else if(!b&&c)for(h in f)j(h,c);else if(b&&!c&&f[b])for(g in f[b])j(b,g);else if(!b&&!c)for(h in f)for(g in f[h])j(h,g);for(var k=i.length;k--;)i[k].bind(a,function(a){return function(b){d.call(a,b.target)}}(this));return e||minplayer.addQueue(this,a,b,c,d),i.length>0},minplayer.get=function(a,b,c){var d=typeof a,e=typeof b,f=typeof c;if("function"===d?(c=a,b=a=null):"function"===e?(c=b,b=a,a=null):"undefined"===e&&"undefined"===f&&(b=a,c=a=null),c="function"==typeof c?c:null)return void minplayer.bind.call(this,"ready",a,b,c);var g=minplayer.plugins,h=null;if(!(a||b||c))return g;if(a&&!b&&!c)return g[a];if(a&&b&&!c)return g[a][b];if(!a&&b&&!c){var i=[];for(h in g)if(g.hasOwnProperty(h)&&g[h].hasOwnProperty(b))for(var j=g[h][b].length;j--;)i.push(g[h][b][j]);return i}},minplayer.display=function(a,b,c,d){minplayer.plugin.call(this,a,b,c,d)},minplayer.display.prototype=new minplayer.plugin,minplayer.display.prototype.constructor=minplayer.display,minplayer.display.prototype.getDisplay=function(a){return a},minplayer.display.prototype.initialize=function(){this.display||(this.display=this.getDisplay(this.context,this.options)),this.display&&(this.options.pluginName="display",this.elements=this.getElements(),minplayer.plugin.prototype.initialize.call(this))},minplayer.display.prototype.construct=function(){if(minplayer.plugin.prototype.construct.call(this),this.autoHide=!1,this.onResize){var a=0;jQuery(window).resize(function(b){return function(){clearTimeout(a),a=setTimeout(function(){b.onResize()},200)}}(this))}},minplayer.display.prototype.onResize=!1,minplayer.display.prototype.hide=function(a){a=a||this.display,a&&(a.forceHide=!0,a.unbind().hide())},minplayer.display.prototype.fullScreenElement=function(){return this.display},minplayer.click=function(a,b){var c=!1;return a=jQuery(a),a.bind("touchstart click",function(a){c||(c=!0,setTimeout(function(){c=!1},100),b.call(this,a))}),a},minplayer.display.prototype.onFocus=function(a){this.hasFocus=this.focus=a,this.autoHide&&this.showThenHide(this.autoHide.element,this.autoHide.timeout,this.autoHide.cb)},minplayer.display.prototype.showThenHide=function(a,b,c){var d=typeof a;"undefined"===d?(c=null,a=this.display):"number"===d?(c=b,b=a,a=this.display):"function"===d&&(c=a,a=this.display),a&&(b=b||5e3,this.autoHide={element:a,timeout:b,cb:c},a.forceHide||("undefined"!=typeof a.showMe?a.showMe&&a.showMe(c):(a.show(),c&&c(!0))),a.hoverState||(jQuery(a).bind("mouseenter",function(){a.hoverState=!0}),jQuery(a).bind("mouseleave",function(){a.hoverState=!1})),clearTimeout(this.showTimer),this.showTimer=setTimeout(function(d){return function e(){a.hoverState?d.showTimer=setTimeout(e,b):"undefined"!=typeof a.hideMe?a.hideMe&&a.hideMe(c):a.hide("slow",function(){c&&c(!1)})}}(this),b))},minplayer.display.prototype.fullscreen=function(a){var b=this.isFullScreen(),c=this.fullScreenElement();b&&!a?(c.removeClass("fullscreen"),minplayer.screenfull&&minplayer.screenfull.exit(),this.trigger("fullscreen",!1)):!b&&a&&(c.addClass("fullscreen"),minplayer.screenfull&&(minplayer.screenfull.request(c[0]),minplayer.screenfull.onchange=function(a){return function(){minplayer.screenfull.isFullscreen||a.fullscreen(!1)}}(this)),this.trigger("fullscreen",!0))},minplayer.display.prototype.toggleFullScreen=function(){this.fullscreen(!this.isFullScreen())},minplayer.display.prototype.isFullScreen=function(){return this.fullScreenElement().hasClass("fullscreen")},minplayer.display.prototype.getScaledRect=function(a,b){var c={};return c.x=b.x?b.x:0,c.y=b.y?b.y:0,c.width=b.width?b.width:0,c.height=b.height?b.height:0,a&&(b.width/b.height>a?(c.height=b.height,c.width=Math.floor(b.height*a)):(c.height=Math.floor(b.width/a),c.width=b.width),c.x=Math.floor((b.width-c.width)/2),c.y=Math.floor((b.height-c.height)/2)),c},minplayer.display.prototype.getElements=function(){return{}},jQuery.fn.minplayer||(jQuery.fn.minplayer=function(a){return jQuery(this).each(function(){a=a||{},a.id=a.id||jQuery(this).attr("id")||Math.random(),minplayer.plugins[a.id]||(a.template=a.template||"default",minplayer[a.template]?new minplayer[a.template](jQuery(this),a):new minplayer(jQuery(this),a))})}),minplayer=jQuery.extend(function(a,b){minplayer.display.call(this,"player",a,b)},minplayer),minplayer.prototype=new minplayer.display,minplayer.prototype.constructor=minplayer,minplayer.prototype.defaultOptions=function(a){a.id="player",a.build=!1,a.wmode="transparent",a.preload=!0,a.autoplay=!1,a.autoload=!0,a.loop=!1,a.width="100%",a.height="350px",a.debug=!1,a.volume=80,a.files=null,a.file="",a.preview="",a.attributes={},a.plugins={},a.logo="",a.link="",a.duration=0,jQuery.each(this.context[0].attributes,function(b,c){a[c.name]=c.value}),minplayer.display.prototype.defaultOptions.call(this,a)},minplayer.prototype.construct=function(){minplayer.display.prototype.construct.call(this);var a=null;for(var b in this.options.plugins)a=this.options.plugins[b],minplayer[a]&&(a=minplayer[a],a[this.options.template]&&a[this.options.template].init?a[this.options.template].init(this):a.init&&a.init(this));if(this.options.pluginName="player",this.controller=this.create("controller"),this.playLoader=this.create("playLoader"),this.options.logo&&this.elements.logo){var c="";this.options.link&&(c+=''),c+='',this.options.link&&(c+=""),this.logo=this.elements.logo.append(c)}this.currentPlayer="html5",this.addKeyEvents(),this.addEvents(),this.load(this.getFiles()),this.ready()},minplayer.prototype.setFocus=function(a){minplayer.get.call(this,this.options.id,null,function(b){b.onFocus(a)}),this.trigger("playerFocus",a)},minplayer.prototype.bindTo=function(a){a.ubind(this.uuid+":error",function(a){return function(b,c){"html5"===a.currentPlayer?(minplayer.player="minplayer",a.options.file.player="minplayer",a.loadPlayer()):a.showError(c)}}(this)),a.ubind(this.uuid+":fullscreen",function(a){return function(){a.resize()}}(this))},minplayer.prototype.addEvents=function(){var a=!1;this.display.bind("mouseenter",function(b){return function(){a=!0,b.setFocus(!0)}}(this)),this.display.bind("mouseleave",function(b){return function(){a=!1,b.setFocus(!1)}}(this));var b=!1;this.display.bind("mousemove",function(c){return function(){b||(b=setTimeout(function(){b=!1,a&&c.setFocus(!0)},300))}}(this)),minplayer.get.call(this,this.options.id,null,function(a){return function(b){a.bindTo(b)}}(this))},minplayer.prototype.showError=function(a){"object"!=typeof a&&(a=a||"",this.elements.error&&(this.elements.error.text(a),a?(this.elements.error.show(),setTimeout(function(a){return function(){a.elements.error.hide("slow")}}(this),5e3)):this.elements.error.hide()))},minplayer.prototype.addKeyEvents=function(){jQuery(document).bind("keydown",function(a){return function(b){switch(b.keyCode){case 113:case 27:a.isFullScreen()&&a.fullscreen(!1)}}}(this))},minplayer.prototype.getFiles=function(){if(this.options.files)return this.options.files;if(this.options.file)return this.options.file;var a=[],b=null;return this.elements.media&&(b=this.elements.media.attr("src"),b&&a.push({path:b}),jQuery("source",this.elements.media).each(function(){a.push({path:jQuery(this).attr("src"),mimetype:jQuery(this).attr("type"),codecs:jQuery(this).attr("codecs")})})),a},minplayer.getMediaFile=function(a){if(!a)return null;if("string"==typeof a||a.path||a.id)return new minplayer.file(a);var b=0,c=null,d=null;for(var e in a)a.hasOwnProperty(e)&&(d=new minplayer.file(a[e]),d.player&&d.priority>b&&(b=d.priority,c=d));return c},minplayer.prototype.loadPlayer=function(){if(!this.options.file||0===this.elements.display.length)return!1;if(!this.options.file.player)return!1;this.showError();var a=this.options.file.player.toString();if(!this.media||a!==this.currentPlayer){if(this.currentPlayer=a,!this.elements.display)return void this.showError("No media display found.");var b={};return this.media&&(b=this.media.queue,this.media.destroy()),pClass=minplayer.players[this.options.file.player],this.options.mediaelement=this.elements.media,this.media=new pClass(this.elements.display,this.options,b),this.media.load(this.options.file),this.display.addClass("minplayer-player-"+this.media.mediaFile.player),!0}return this.media?(this.media.options=this.options,this.display.removeClass("minplayer-player-"+this.media.mediaFile.player),this.media.load(this.options.file),this.display.addClass("minplayer-player-"+this.media.mediaFile.player),!1):void 0},minplayer.prototype.load=function(a){return this.options.files=a||this.options.files,this.options.file=minplayer.getMediaFile(this.options.files),this.loadPlayer()?(this.bindTo(this.media),this.options.file.mimetype&&!this.options.file.player?(this.showError("Cannot play media: "+this.options.file.mimetype),!1):!0):!1},minplayer.prototype.resize=function(){this.get(function(a){a.onResize&&a.onResize()})};var minplayer=minplayer||{};minplayer.image=function(a,b){this.loaded=!1,this.loader=null,this.ratio=0,this.img=null,minplayer.display.call(this,"image",a,b)},minplayer.image.prototype=new minplayer.display,minplayer.image.prototype.constructor=minplayer.image,minplayer.image.prototype.construct=function(){minplayer.display.prototype.construct.call(this),this.options.pluginName="image",this.display.css("overflow","hidden"),this.loader=new Image,this.loader.onload=function(a){return function(){a.loaded=!0,a.ratio=a.loader.width/a.loader.height,a.resize(),a.trigger("loaded")}}(this),this.ready()},minplayer.image.prototype.load=function(a){this.clear(function(){this.display.empty(),this.img=jQuery(document.createElement("img")).attr({src:""}).hide(),this.display.append(this.img),this.loader.src=a,this.img.attr("src",a)})},minplayer.image.prototype.clear=function(a){this.loaded=!1,this.img?this.img.fadeOut(150,function(b){return function(){b.img.attr("src",""),b.loader.src="",jQuery(this).remove(),a&&a.call(b)}}(this)):a&&a.call(this)},minplayer.image.prototype.resize=function(a,b){if(a=a||this.display.parent().width(),b=b||this.display.parent().height(),a&&b&&this.loaded){var c=this.getScaledRect(this.ratio,{width:a,height:b});this.img&&this.img.attr("src",this.loader.src).css({marginLeft:c.x,marginTop:c.y,width:c.width,height:c.height}),this.img.fadeIn(150)}},minplayer.image.prototype.onResize=function(){this.resize()};var minplayer=minplayer||{};minplayer.file=function(a){return a?(a="string"==typeof a?{path:a}:a,a.hasOwnProperty("isMinPlayerFile")?a:(this.isMinPlayerFile=!0,this.duration=a.duration||0,this.bytesTotal=a.bytesTotal||0,this.quality=a.quality||0,this.stream=a.stream||"",this.path=a.path||"",this.codecs=a.codecs||"",this.extension=a.extension||this.getFileExtension(),this.mimetype=a.mimetype||a.filemime||this.getMimeType(),this.type=a.type||this.getType(),this.type||(this.mimetype=this.getMimeType(),this.type=this.getType()),this.player=minplayer.player||a.player||this.getBestPlayer(),this.priority=a.priority||this.getPriority(),this.id=a.id||this.getId(),void(this.path||(this.path=this.id)))):null},minplayer.player="",minplayer.file.prototype.getBestPlayer=function(){var a=null,b=0;return jQuery.each(minplayer.players,function(c){return function(d,e){var f=e.getPriority(c);e.canPlay(c)&&f>b&&(a=d,b=f)}}(this)),a},minplayer.file.prototype.getPriority=function(){var a=1;switch(this.player&&(a=minplayer.players[this.player].getPriority(this)),this.mimetype){case"video/x-webm":case"video/webm":case"application/octet-stream":case"application/vnd.apple.mpegurl":return 10*a;case"video/mp4":case"audio/mp4":case"audio/mpeg":return 9*a;case"video/ogg":case"audio/ogg":case"video/quicktime":return 8*a;default:return 5*a}},minplayer.file.prototype.getFileExtension=function(){return this.path.substring(this.path.lastIndexOf(".")+1).toLowerCase()},minplayer.file.prototype.getMimeType=function(){switch(this.extension){case"mp4":case"m4v":case"flv":case"f4v":return"video/mp4";case"m3u8":return"application/vnd.apple.mpegurl";case"webm":return"video/webm";case"ogg":case"ogv":return"video/ogg";case"3g2":return"video/3gpp2";case"3gpp":case"3gp":return"video/3gpp";case"mov":return"video/quicktime";case"swf":return"application/x-shockwave-flash";case"oga":return"audio/ogg";case"mp3":return"audio/mpeg";case"m4a":case"f4a":return"audio/mp4";case"aac":return"audio/aac";case"wav":return"audio/vnd.wave";case"wma":return"audio/x-ms-wma";default:return"unknown"}},minplayer.file.prototype.getType=function(){var a=this.mimetype.match(/([^\/]+)(\/)/);if(a=a&&a.length>1?a[1]:"","video"===a)return"video";if("audio"===a)return"audio";switch(this.mimetype){case"application/octet-stream":case"application/x-shockwave-flash":case"application/vnd.apple.mpegurl":return"video"}return""},minplayer.file.prototype.getId=function(){var a=minplayer.players[this.player];return a&&a.getMediaId?a.getMediaId(this):""};var minplayer=minplayer||{};minplayer.playLoader=function(a,b){this.clear(),minplayer.display.call(this,"playLoader",a,b)},minplayer.playLoader.prototype=new minplayer.display,minplayer.playLoader.prototype.constructor=minplayer.playLoader,minplayer.playLoader.prototype.construct=function(){minplayer.display.prototype.construct.call(this),this.options.pluginName="playLoader",this.initializePlayLoader(),this.ready()},minplayer.playLoader.prototype.initializePlayLoader=function(){this.get("media",function(a){if(a.hasPlayLoader(this.options.preview))this.enabled=!1,this.hide(this.elements.busy),this.hide(this.elements.bigPlay),this.hide(this.elements.preview),this.hide();else{this.enabled=!0,this.options.preview||(this.options.preview=a.poster);var b=!0;this.preview&&this.preview.loader&&(b=this.preview.loader.src!==this.options.preview),b&&(a.elements.media.attr("poster",""),this.loadPreview()),this.elements.bigPlay&&minplayer.click(this.elements.bigPlay.unbind(),function(b){b.preventDefault(),jQuery(this).hide(),a.play()}),a.ubind(this.uuid+":loadstart",function(a){return function(){a.busy.setFlag("media",!0),a.bigPlay.setFlag("media",!0),a.previewFlag.setFlag("media",!0),a.checkVisibility()}}(this)),a.ubind(this.uuid+":waiting",function(a){return function(b,c,d){d||(a.busy.setFlag("media",!0),a.checkVisibility())}}(this)),a.ubind(this.uuid+":loadeddata",function(a){return function(b,c,d){d||(a.busy.setFlag("media",!1),a.checkVisibility())}}(this)),a.ubind(this.uuid+":playing",function(b){return function(c,d,e){e||(b.busy.setFlag("media",!1),b.bigPlay.setFlag("media",!1),"audio"!==a.mediaFile.type&&b.previewFlag.setFlag("media",!1),b.checkVisibility())}}(this)),a.ubind(this.uuid+":pause",function(a){return function(b,c,d){d||(a.busy.setFlag("media",!1),a.bigPlay.setFlag("media",!0),a.checkVisibility())}}(this))}})},minplayer.playLoader.prototype.clear=function(a){this.busy=new minplayer.flags,this.bigPlay=new minplayer.flags,this.previewFlag=new minplayer.flags,this.enabled=!0,this.preview?this.preview.clear(function(b){return function(){b.preview=null,a&&a()}}(this)):(this.preview=null,a&&a())},minplayer.playLoader.prototype.loadPreview=function(a){if(a=a||this.options.preview,this.options.preview=a,this.enabled&&0!==this.display.length){if(this.elements.preview){if(this.options.preview)return this.elements.preview.addClass("has-preview").show(),this.preview=new minplayer.image(this.elements.preview,this.options),this.preview.load(this.options.preview),!0;this.elements.preview.hide()}return!1}},minplayer.playLoader.prototype.checkVisibility=function(){this.enabled&&(this.busy.flag?this.elements.busy.show():this.elements.busy.hide(),this.bigPlay.flag?this.elements.bigPlay.show():this.elements.bigPlay.hide(),this.previewFlag.flag?this.elements.preview.show():this.elements.preview.hide(),(this.bigPlay.flag||this.busy.flag||this.previewFlag.flag)&&this.display.show(),this.bigPlay.flag||this.busy.flag||this.previewFlag.flag||this.display.hide())};var minplayer=minplayer||{};minplayer.players=minplayer.players||{},minplayer.players.base=function(a,b,c){minplayer.display.call(this,"media",a,b,c)},minplayer.players.base.prototype=new minplayer.display,minplayer.players.base.prototype.constructor=minplayer.players.base,minplayer.players.base.prototype.getElements=function(){var a=minplayer.display.prototype.getElements.call(this);return jQuery.extend(a,{media:this.options.mediaelement})},minplayer.players.base.prototype.defaultOptions=function(a){a.range={min:0,max:0},minplayer.display.prototype.defaultOptions.call(this,a)},minplayer.players.base.getPriority=function(){return 0},minplayer.players.base.getMediaId=function(){return""},minplayer.players.base.canPlay=function(){return!1},minplayer.players.base.prototype.construct=function(){minplayer.display.prototype.construct.call(this),this.elements.media&&(this.poster=this.elements.media.attr("poster")),this.options.pluginName="basePlayer",this.readyQueue=[],this.loadedQueue=[],this.mediaFile=this.options.file,this.clear(),this.setupPlayer()},minplayer.players.base.prototype.setupPlayer=function(){this.playerFound()||this.addPlayer(),this.player=this.getPlayer(),minplayer.click(this.display,function(a){return function(){a.playing?a.pause():a.play()}}(this)),jQuery(document).bind("keydown",function(a){return function(b){if(a.hasFocus)switch(b.preventDefault(),b.keyCode){case 32:case 179:a.playing?a.pause():a.play();break;case 38:a.setVolumeRelative(.1);break;case 40:a.setVolumeRelative(-.1);break;case 37:case 227:a.seekRelative(-.05);break;case 39:case 228:a.seekRelative(.05)}}}(this))},minplayer.players.base.prototype.addPlayer=function(){this.elements.media&&this.elements.media.remove(),this.elements.media=jQuery(this.createPlayer()),this.display.html(this.elements.media)},minplayer.players.base.prototype.destroy=function(){minplayer.plugin.prototype.destroy.call(this),this.clear()},minplayer.players.base.prototype.clear=function(){this.playerReady=!1,this.reset(),this.player&&(jQuery(this.player).remove(),this.player=null)},minplayer.players.base.prototype.reset=function(){this.realDuration=0,this.duration=new minplayer.async,this.currentTime=new minplayer.async,this.bytesLoaded=new minplayer.async,this.bytesTotal=new minplayer.async,this.bytesStart=new minplayer.async,this.volume=new minplayer.async,this.hasFocus=!1,this.playing=!1,this.loading=!1,this.loaded=!1,this.trigger("pause",null,!0),this.trigger("waiting",null,!0),this.trigger("progress",{loaded:0,total:0,start:0},!0),this.trigger("timeupdate",{currentTime:0,duration:0},!0)},minplayer.players.base.prototype.onReady=function(){if(!this.playerReady)if(this.setStartStop(),this.playerReady=!0,this.setVolume(this.options.volume/100),this.loading=!0,this.poll("progress",function(a){return function(){return a.loading&&a.getBytesLoaded(function(b){a.getBytesTotal(function(c){if(b||c){var d=0;a.getBytesStart(function(a){d=a}),a.trigger("progress",{loaded:b,total:c,start:d}),b>=c&&(a.loading=!1)}})}),a.loading}}(this),1e3),this.ready(),this.isReady()){for(var a in this.readyQueue)this.readyQueue[a].call(this);this.readyQueue.length=0,this.readyQueue=[],this.loaded||this.trigger("loadstart")}else this.readyQueue.length=0,this.readyQueue=[]},minplayer.players.base.prototype.parseTime=function(a){var b=0,c=0,d=0;return a?("string"!=typeof a&&(a=String(a)),b=a.match(/([0-9]+)s/i),b&&(b=parseInt(b[1],10)),c=a.match(/([0-9]+)m/i),c&&(b+=60*parseInt(c[1],10)),d=a.match(/([0-9]+)h/i),d&&(b+=3600*parseInt(d[1],10)),b||(b=a),Number(b)):0},minplayer.players.base.prototype.setStartStop=function(){return this.startTime?this.startTime:(this.startTime=0,this.offsetTime=this.parseTime(this.options.range.min),minplayer.urlVars&&(this.startTime=this.parseTime(minplayer.urlVars.seek)),this.startTime||(this.startTime=this.offsetTime),this.stopTime=this.options.range.max?this.parseTime(this.options.range.max):0,this.mediaRange=this.stopTime-this.offsetTime,this.mediaRange<0&&(this.mediaRange=0),this.startTime)},minplayer.players.base.prototype.onPlaying=function(){if(!this.playing){var a=this;this.getDuration(function(b){a.startTime&&a.startTime-1&&1>a?(c/d+parseFloat(a))*d:c+parseFloat(a),b.seek(e)}})}}(this))},minplayer.players.base.prototype.seek=function(a,b,c){this.whenLoaded(function(){a=Number(a),c||(a+=this.offsetTime),this._seek(a),b&&b.call(this)})},minplayer.players.base.prototype._seek=function(){},minplayer.players.base.prototype.setVolumeRelative=function(a){this.getVolume(function(b){return function(c){c+=parseFloat(a),c=0>c?0:c,c=c>1?1:c,b.setVolume(c)}}(this))},minplayer.players.base.prototype.setVolume=function(a,b){this.trigger("volumeupdate",a),this.whenLoaded(b)},minplayer.players.base.prototype.getValue=function(a,b,c){this.whenLoaded(function(){var d=this;this[a](function(a){null!==a?c.call(d,a):d[b].get(c)})})},minplayer.players.base.prototype.getVolume=function(a){this.getValue("_getVolume","volume",a)},minplayer.players.base.prototype._getVolume=function(a){a(null)},minplayer.players.base.prototype.getCurrentTime=function(a){var b=this;this.getValue("_getCurrentTime","currentTime",function(c){b.setStartStop(),b.stopTime&&c>b.stopTime&&b.stop(function(){b.onComplete()}),c-=b.offsetTime,a(c)})},minplayer.players.base.prototype._getCurrentTime=function(a){a(null)},minplayer.players.base.prototype.getDuration=function(a){if(this.options.duration)a(this.options.duration);else{var b=this;this.getValue("_getDuration","duration",function(c){b.setStartStop(),b.realDuration=c,a(b.mediaRange?b.mediaRange:c) +})}},minplayer.players.base.prototype._getDuration=function(a){a(null)},minplayer.players.base.prototype.getBytesStart=function(a){this.getValue("_getBytesStart","bytesStart",a)},minplayer.players.base.prototype._getBytesStart=function(a){a(null)},minplayer.players.base.prototype.getBytesLoaded=function(a){this.getValue("_getBytesLoaded","bytesLoaded",a)},minplayer.players.base.prototype._getBytesLoaded=function(a){a(null)},minplayer.players.base.prototype.getBytesTotal=function(a){this.getValue("_getBytesTotal","bytesTotal",a)},minplayer.players.base.prototype._getBytesTotal=function(a){a(null)};var minplayer=minplayer||{};minplayer.players=minplayer.players||{},minplayer.players.dailymotion=function(a,b,c){this.quality="default",minplayer.players.base.call(this,a,b,c)},minplayer.players.dailymotion.prototype=new minplayer.players.base,minplayer.players.dailymotion.prototype.constructor=minplayer.players.dailymotion,minplayer.players.dailymotion.prototype.construct=function(){minplayer.players.base.prototype.construct.call(this),this.options.pluginName="dailymotion"},minplayer.players.dailymotion.getPriority=function(){return 10},minplayer.players.dailymotion.canPlay=function(a){if("video/dailymotion"===a.mimetype)return!0;var b=/^http(s)?\:\/\/(www\.)?(dailymotion\.com)/i;return 0===a.path.search(b)},minplayer.players.dailymotion.getMediaId=function(a){var b="^http[s]?\\:\\/\\/(www\\.)?";b+="(dailymotion\\.com\\/video/)",b+="([a-z0-9\\-]+)",b+="_*";var c=RegExp(b,"i");return 0===a.path.search(c)?a.path.match(c)[3]:a.path},minplayer.players.dailymotion.getImage=function(a,b,c){c("http://www.dailymotion.com/thumbnail/video/"+a.id)},minplayer.players.dailymotion.parseNode=function(){return{title:node.title,description:node.description,mediafiles:{image:{thumbnail:{path:node.thumbnail_small_url},image:{path:node.thumbnail_url}},media:{media:{player:"dailymotion",id:node.id}}}}},minplayer.players.dailymotion.getNode=function(a,b){var c="https://api.dailymotion.com/video/"+a.id;c+="?fields=title,id,description,thumbnail_small_url,thumbnail_url",jQuery.get(c,function(a){b(minplayer.players.dailymotion.parseNode(a.data))},"jsonp")},minplayer.players.dailymotion.prototype.onReady=function(){minplayer.players.base.prototype.onReady.call(this),this.options.autoplay||this.pause(),this.onLoaded()},minplayer.players.dailymotion.prototype.playerFound=function(){return this.display.find(this.mediaFile.type).length>0},minplayer.players.dailymotion.prototype.onQualityChange=function(a){this.quality=a.data},minplayer.players.dailymotion.prototype.hasPlayLoader=function(a){return minplayer.hasTouch||!a},minplayer.players.dailymotion.prototype.hasController=function(){return minplayer.isIDevice},minplayer.players.dailymotion.prototype.createPlayer=function(){minplayer.players.base.prototype.createPlayer.call(this);var a=document.location.protocol;if(a+="//api.dmcdn.net/all.js",0===jQuery('script[src="'+a+'"]').length){var b=document.createElement("script");b.src=a;var c=document.getElementsByTagName("script")[0];c.parentNode.insertBefore(b,c)}return this.playerId=this.options.id+"-player",this.poll(this.options.id+"_dailymotion",function(a){return function(){var b=jQuery("#"+a.playerId).length>0;if(b=b&&"DM"in window,b=b&&"function"==typeof DM.player){jQuery("#"+a.playerId).addClass("dailymotion-player");var c={};c={id:a.playerId,api:minplayer.isIDevice?0:1,wmode:"opaque",controls:minplayer.isAndroid?1:0,related:0,info:0,logo:0},a.player=new DM.player(a.playerId,{video:a.mediaFile.id,height:"100%",width:"100%",frameborder:0,params:c}),a.player.addEventListener("apiready",function(){a.onReady(a)}),a.player.addEventListener("ended",function(){a.onComplete(a)}),a.player.addEventListener("playing",function(){a.onPlaying(a)}),a.player.addEventListener("progress",function(){a.onWaiting(a)}),a.player.addEventListener("pause",function(){a.onPaused(a)}),a.player.addEventListener("error",function(){a.onError(a)})}return!b}}(this),200),jQuery(document.createElement("div")).attr({id:this.playerId})},minplayer.players.dailymotion.prototype.load=function(a,b){minplayer.players.base.prototype.load.call(this,a,function(){this.player.load(a.id),b&&b.call(this)})},minplayer.players.dailymotion.prototype.play=function(a){minplayer.players.base.prototype.play.call(this,function(){this.onWaiting(),this.player.play(),a&&a.call(this)})},minplayer.players.dailymotion.prototype.pause=function(a){minplayer.players.base.prototype.pause.call(this,function(){this.loaded&&(this.player.pause(),a&&a.call(this))})},minplayer.players.dailymotion.prototype.stop=function(a){minplayer.players.base.prototype.stop.call(this,function(){this.player.pause(),a&&a.call(this)})},minplayer.players.dailymotion.prototype._seek=function(a){this.onWaiting(),this.player.seek(a)},minplayer.players.dailymotion.prototype.setVolume=function(a,b){minplayer.players.base.prototype.setVolume.call(this,a,function(){this.loaded&&(this.player.setVolume(a),void 0!==b&&b.call(this))})},minplayer.players.dailymotion.prototype._getVolume=function(a){a(this.player.volume)},minplayer.players.dailymotion.prototype._getDuration=function(a){a(this.player.duration)},minplayer.players.dailymotion.prototype._getCurrentTime=function(a){a(this.player.currentTime)};var minplayer=minplayer||{};minplayer.players=minplayer.players||{},minplayer.players.html5=function(a,b,c){minplayer.players.base.call(this,a,b,c)},minplayer.players.html5.prototype=new minplayer.players.base,minplayer.players.html5.prototype.constructor=minplayer.players.html5,minplayer.players.html5.getPriority=function(){return 10},minplayer.players.html5.canPlay=function(a){switch(a.mimetype){case"video/ogg":return!!minplayer.playTypes.videoOGG;case"video/mp4":case"video/x-mp4":case"video/m4v":case"video/x-m4v":return!!minplayer.playTypes.videoH264;case"application/vnd.apple.mpegurl":return!!minplayer.playTypes.videoMPEGURL;case"video/x-webm":case"video/webm":case"application/octet-stream":return!!minplayer.playTypes.videoWEBM;case"audio/ogg":return!!minplayer.playTypes.audioOGG;case"audio/mpeg":return!!minplayer.playTypes.audioMP3;case"audio/mp4":return!!minplayer.playTypes.audioMP4;default:return!1}},minplayer.players.html5.prototype.construct=function(){minplayer.players.base.prototype.construct.call(this),this.options.pluginName="html5",this.hasEnded=!1,this.addPlayerEvents()},minplayer.players.html5.prototype.addPlayerEvent=function(a,b){this.player&&this.player.addEventListener(a,function(c){var d=a+"Event";return c[d]&&c.player.removeEventListener(a,c[d],!1),c[d]=function(a){b.call(c,a)},c[d]}(this),!1)},minplayer.players.html5.prototype.addPlayerEvents=function(){if(this.player){this.addPlayerEvent("abort",function(){this.trigger("abort")}),this.addPlayerEvent("loadstart",function(){this.onReady(),this.options.autoload||this.onLoaded()}),this.addPlayerEvent("loadeddata",function(){this.onLoaded()}),this.addPlayerEvent("loadedmetadata",function(){this.onLoaded()}),this.addPlayerEvent("canplaythrough",function(){this.onLoaded()}),this.addPlayerEvent("ended",function(){this.hasEnded=!0,this.onComplete()}),this.addPlayerEvent("pause",function(){this.onPaused()}),this.addPlayerEvent("play",function(){this.onPlaying()}),this.addPlayerEvent("playing",function(){this.onPlaying()});var a=!1;return this.addPlayerEvent("error",function(){this.hasEnded||a||!this.player||(a=!0,this.trigger("error","An error occured - "+this.player.error.code))}),this.addPlayerEvent("waiting",function(){this.onWaiting()}),this.addPlayerEvent("durationchange",function(){if(this.player){this.duration.set(this.player.duration);var a=this;this.getDuration(function(b){a.trigger("durationchange",{duration:b})})}}),this.addPlayerEvent("progress",function(a){this.bytesTotal.set(a.total),this.bytesLoaded.set(a.loaded)}),!0}return!1},minplayer.players.html5.prototype.onReady=function(){minplayer.players.base.prototype.onReady.call(this),minplayer.isAndroid&&this.onLoaded(),minplayer.isIDevice&&setTimeout(function(a){return function(){a.pause(),a.onLoaded()}}(this),1)},minplayer.players.html5.prototype.playerFound=function(){return this.display.find(this.mediaFile.type).length>0},minplayer.players.html5.prototype.createPlayer=function(){minplayer.players.base.prototype.createPlayer.call(this);var a=jQuery(document.createElement(this.mediaFile.type)).attr(this.options.attributes).append(jQuery(document.createElement("source")).attr({src:this.mediaFile.path}));a.eq(0)[0].setAttribute("width","100%"),a.eq(0)[0].setAttribute("height","100%");var b=this.options.autoload?"metadata":"none";return b=minplayer.isIDevice?"metadata":b,a.eq(0)[0].setAttribute("preload",b),this.options.autoload||a.eq(0)[0].setAttribute("autobuffer",!1),a},minplayer.players.html5.prototype.getPlayer=function(){return this.elements.media.eq(0)[0]},minplayer.players.html5.prototype.load=function(a,b){minplayer.players.base.prototype.load.call(this,a,function(){this.hasEnded=!1;var c=this.elements.media.attr("src");c||(c=jQuery("source",this.elements.media).eq(0).attr("src")),c!==a.path&&(this.addPlayer(),this.player=this.getPlayer(),this.addPlayerEvents(),this.player.src=a.path,b&&b.call(this))})},minplayer.players.html5.prototype.play=function(a){minplayer.players.base.prototype.play.call(this,function(){this.player.play(),a&&a.call(this)})},minplayer.players.html5.prototype.pause=function(a){minplayer.players.base.prototype.pause.call(this,function(){this.player.pause(),a&&a.call(this)})},minplayer.players.html5.prototype.stop=function(a){minplayer.players.base.prototype.stop.call(this,function(){this.player.pause(),a&&a.call(this)})},minplayer.players.html5.prototype.clear=function(){minplayer.players.base.prototype.clear.call(this),this.player&&(this.player.src="")},minplayer.players.html5.prototype._seek=function(a){this.player.currentTime=a},minplayer.players.html5.prototype.setVolume=function(a,b){minplayer.players.base.prototype.setVolume.call(this,a,function(){this.player.volume=a,b&&b.call(this)})},minplayer.players.html5.prototype._getVolume=function(a){a(this.player.volume)},minplayer.players.html5.prototype._getDuration=function(a){a(this.player.duration)},minplayer.players.html5.prototype._getCurrentTime=function(a){a(this.player.currentTime)},minplayer.players.html5.prototype._getBytesLoaded=function(a){var b=0;this.bytesLoaded.value?b=this.bytesLoaded.value:this.player.buffered&&this.player.buffered.length>0&&this.player.buffered.end&&this.player.duration?b=this.player.buffered.end(0):void 0!==this.player.bytesTotal&&this.player.bytesTotal>0&&void 0!==this.player.bufferedBytes&&(b=this.player.bufferedBytes),a(b)},minplayer.players.html5.prototype._getBytesTotal=function(a){var b=0;this.bytesTotal.value?b=this.bytesTotal.value:this.player.buffered&&this.player.buffered.length>0&&this.player.buffered.end&&this.player.duration?b=this.player.duration:void 0!==this.player.bytesTotal&&this.player.bytesTotal>0&&void 0!==this.player.bufferedBytes&&(b=this.player.bytesTotal),a(b)};var minplayer=minplayer||{};minplayer.players=minplayer.players||{},minplayer.players.flash=function(a,b,c){minplayer.players.base.call(this,a,b,c)},minplayer.players.flash.prototype=new minplayer.players.base,minplayer.players.flash.prototype.constructor=minplayer.players.flash,minplayer.players.flash.prototype.construct=function(){minplayer.players.base.prototype.construct.call(this),this.options.pluginName="flash"},minplayer.players.flash.getPriority=function(){return 0},minplayer.players.flash.canPlay=function(){return!1},minplayer.players.flash.prototype.getFlash=function(a){var b=document.createElement("script");b.src="//ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js";var c=document.getElementsByTagName("script")[0];return c.parentNode.insertBefore(b,c),setTimeout(function(b){return function c(){"undefined"!=typeof swfobject?swfobject.embedSWF(a.swf,a.id,a.width,a.height,"9.0.0",!1,a.flashvars,{allowscriptaccess:"always",allowfullscreen:"true",wmode:a.wmode,quality:"high"},{id:a.id,name:a.id,playerType:"flash"},function(a){b.player=a.ref}):setTimeout(c,200)}}(this),200),'
'},minplayer.players.flash.prototype.playerFound=function(){return this.display.find('object[playerType="flash"]').length>0};var minplayer=minplayer||{};minplayer.players=minplayer.players||{},minplayer.players.minplayer=function(a,b,c){minplayer.players.flash.call(this,a,b,c)},minplayer.players.minplayer.prototype=new minplayer.players.flash,minplayer.players.minplayer.prototype.constructor=minplayer.players.minplayer,minplayer.players.minplayer.prototype.construct=function(){minplayer.players.flash.prototype.construct.call(this),this.options.pluginName="minplayer"},window.onFlashPlayerReady=function(a){for(var b=minplayer.get(a,"media"),c=b.length;c--;)b[c].onReady()},window.onFlashPlayerUpdate=function(a,b){for(var c=minplayer.get(a,"media"),d=c.length;d--;)c[d].onMediaUpdate(b)},window.onFlashPlayerDebug=function(a){console&&console.log&&console.log(a)},minplayer.players.minplayer.getPriority=function(a){return a.stream?100:1},minplayer.players.minplayer.canPlay=function(a){if(a.stream)return!0;var b=jQuery.inArray(a.mimetype,["video/x-webm","video/webm","application/octet-stream"])>=0;return!b&&("video"===a.type||"audio"===a.type)},minplayer.players.minplayer.prototype.createPlayer=function(){this.options.swfplayer||(this.options.swfplayer="http://mediafront.org/assets/osmplayer/minplayer",this.options.swfplayer+="/flash/minplayer.swf"),minplayer.players.flash.prototype.createPlayer.call(this);var a={id:this.options.id,debug:this.options.debug,config:"nocontrols",file:this.mediaFile.path,autostart:this.options.autoplay,autoload:this.options.autoload};return this.mediaFile.stream&&(a.stream=this.mediaFile.stream),this.getFlash({swf:this.options.swfplayer,id:this.options.id+"_player",width:"100%",height:"100%",flashvars:a,wmode:this.options.wmode})},minplayer.players.minplayer.prototype.onMediaUpdate=function(a){switch(this.onReady(),a){case"mediaMeta":this.onLoaded();break;case"mediaConnected":this.onLoaded(),this.onPaused();break;case"mediaPlaying":this.onPlaying();break;case"mediaPaused":this.onPaused();break;case"mediaComplete":this.onComplete()}},minplayer.players.minplayer.prototype.load=function(a,b){minplayer.players.flash.prototype.load.call(this,a,function(){this.loaded?this.stop(function(){this.player.loadMedia(a.path,a.stream),b&&b.call(this)}):(this.player.loadMedia(a.path,a.stream),b&&b.call(this))})},minplayer.players.minplayer.prototype.play=function(a){minplayer.players.flash.prototype.play.call(this,function(){this.player.playMedia(),a&&a.call(this)})},minplayer.players.minplayer.prototype.pause=function(a){minplayer.players.flash.prototype.pause.call(this,function(){this.player.pauseMedia(),a&&a.call(this)})},minplayer.players.minplayer.prototype.stop=function(a){minplayer.players.flash.prototype.stop.call(this,function(){this.player.stopMedia(),a&&a.call(this)})},minplayer.players.minplayer.prototype._seek=function(a){this.player.seekMedia(a)},minplayer.players.minplayer.prototype.setVolume=function(a,b){minplayer.players.flash.prototype.setVolume.call(this,a,function(){this.player.setVolume(a),b&&b.call(this)})},minplayer.players.minplayer.prototype._getVolume=function(a){a(this.player.getVolume())},minplayer.players.minplayer.prototype._getDuration=function(a){var b=this,c=0,d=function(){c=b.player.getDuration(),c?a(c):setTimeout(d,1e3)};d()},minplayer.players.minplayer.prototype._getCurrentTime=function(a){a(this.player.getCurrentTime())},minplayer.players.minplayer.prototype._getBytesLoaded=function(a){a(this.player.getMediaBytesLoaded())},minplayer.players.minplayer.prototype._getBytesTotal=function(a){a(this.player.getMediaBytesTotal())};var minplayer=minplayer||{};minplayer.players=minplayer.players||{},minplayer.players.youtube=function(a,b,c){this.quality="default",minplayer.players.base.call(this,a,b,c)},minplayer.players.youtube.prototype=new minplayer.players.base,minplayer.players.youtube.prototype.constructor=minplayer.players.youtube,minplayer.players.youtube.prototype.construct=function(){minplayer.players.base.prototype.construct.call(this),this.options.pluginName="youtube"},minplayer.players.youtube.getPriority=function(){return 10},minplayer.players.youtube.canPlay=function(a){if("video/youtube"===a.mimetype)return!0;var b=/^http(s)?\:\/\/(www\.)?(youtube\.com|youtu\.be)/i;return 0===a.path.search(b)},minplayer.players.youtube.getMediaId=function(a){var b="^http[s]?\\:\\/\\/(www\\.)?";b+="(youtube\\.com\\/watch\\?v=|youtu\\.be\\/)",b+="([a-zA-Z0-9_\\-]+)";var c=RegExp(b,"i");return 0===a.path.search(c)?a.path.match(c)[3]:a.path},minplayer.players.youtube.getImage=function(a,b,c){b="thumbnail"===b?"1":"0",c("https://img.youtube.com/vi/"+a.id+"/"+b+".jpg")},minplayer.players.youtube.parseNode=function(a){var b="undefined"!=typeof a.video?a.video:a;return{title:b.title,description:b.description,mediafiles:{image:{thumbnail:{path:b.thumbnail.sqDefault},image:{path:b.thumbnail.hqDefault}},media:{media:{player:"youtube",id:b.id}}}}},minplayer.players.youtube.getNode=function(a,b){var c="https://gdata.youtube.com/feeds/api/videos/"+a.id;c+="?v=2&alt=jsonc",jQuery.get(c,function(a){b(minplayer.players.youtube.parseNode(a.data))})},minplayer.players.youtube.prototype.setPlayerState=function(a){switch(a){case YT.PlayerState.CUED:break;case YT.PlayerState.BUFFERING:this.onWaiting();break;case YT.PlayerState.UNSTARTED:case YT.PlayerState.PAUSED:this.onPaused();break;case YT.PlayerState.PLAYING:this.onPlaying();break;case YT.PlayerState.ENDED:this.onComplete()}},minplayer.players.youtube.prototype.onReady=function(){minplayer.players.base.prototype.onReady.call(this),this.options.autoplay||this.pause(),this.onLoaded()},minplayer.players.youtube.prototype.playerFound=function(){var a="iframe#"+this.options.id+"-player.youtube-player",b=this.display.find(a);return b.length>0},minplayer.players.youtube.prototype.onPlayerStateChange=function(a){this.setPlayerState(a.data)},minplayer.players.youtube.prototype.onQualityChange=function(a){this.quality=a.data},minplayer.players.youtube.prototype.hasPlayLoader=function(a){return minplayer.hasTouch||!a},minplayer.players.youtube.prototype.hasController=function(){return minplayer.isIDevice},minplayer.players.youtube.prototype.createPlayer=function(){minplayer.players.base.prototype.createPlayer.call(this);var a="https://www.youtube.com/iframe_api";if(0===jQuery('script[src="'+a+'"]').length){var b=document.createElement("script");b.src=a;var c=document.getElementsByTagName("script")[0];c.parentNode.insertBefore(b,c)}return this.playerId=this.options.id+"-player",this.poll(this.options.id+"_youtube",function(a){return function(){var b=jQuery("#"+a.playerId).length>0;if(b=b&&"YT"in window,b=b&&"function"==typeof YT.Player){jQuery("#"+a.playerId).addClass("youtube-player");var c=location.protocol;c+="//"+location.hostname,c+=location.port&&":"+location.port;var d={};minplayer.isIDevice?d.origin=c:d={enablejsapi:minplayer.isIDevice?0:1,origin:c,wmode:"opaque",controls:minplayer.isAndroid?1:0,rel:0,showinfo:0},a.player=new YT.Player(a.playerId,{height:"100%",width:"100%",frameborder:0,videoId:a.mediaFile.id,playerVars:d,events:{onReady:function(b){a.onReady(b)},onStateChange:function(b){a.onPlayerStateChange(b)},onPlaybackQualityChange:function(b){a.onQualityChange(b)},onError:function(b){a.onError(b)}}})}return!b}}(this),200),jQuery(document.createElement("div")).attr({id:this.playerId})},minplayer.players.youtube.prototype.load=function(a,b){minplayer.players.base.prototype.load.call(this,a,function(){this.player.loadVideoById(a.id,0,this.quality),b&&b.call(this)})},minplayer.players.youtube.prototype.play=function(a){minplayer.players.base.prototype.play.call(this,function(){this.onWaiting(),this.player.playVideo(),a&&a.call(this)})},minplayer.players.youtube.prototype.pause=function(a){minplayer.players.base.prototype.pause.call(this,function(){this.player.pauseVideo(),a&&a.call(this)})},minplayer.players.youtube.prototype.stop=function(a){minplayer.players.base.prototype.stop.call(this,function(){this.player.stopVideo(),a&&a.call(this)})},minplayer.players.youtube.prototype._seek=function(a){this.onWaiting(),this.player.seekTo(a,!0)},minplayer.players.youtube.prototype.setVolume=function(a,b){minplayer.players.base.prototype.setVolume.call(this,a,function(){this.player.setVolume(100*a),b&&b.call(this)})},minplayer.players.youtube.prototype._getVolume=function(a){a(this.player.getVolume())},minplayer.players.youtube.prototype._getDuration=function(a){a(this.player.getDuration())},minplayer.players.youtube.prototype._getCurrentTime=function(a){a(this.player.getCurrentTime())},minplayer.players.youtube.prototype._getBytesStart=function(a){a(this.player.getVideoStartBytes())},minplayer.players.youtube.prototype._getBytesLoaded=function(a){a(this.player.getVideoBytesLoaded())},minplayer.players.youtube.prototype._getBytesTotal=function(a){a(this.player.getVideoBytesTotal())};var minplayer=minplayer||{};minplayer.players=minplayer.players||{},minplayer.players.vimeo=function(a,b,c){minplayer.players.base.call(this,a,b,c)},minplayer.players.vimeo.prototype=new minplayer.players.base,minplayer.players.vimeo.prototype.constructor=minplayer.players.vimeo,minplayer.players.vimeo.prototype.construct=function(){minplayer.players.base.prototype.construct.call(this),this.options.pluginName="vimeo"},minplayer.players.vimeo.getPriority=function(){return 10},minplayer.players.vimeo.canPlay=function(a){return"video/vimeo"===a.mimetype?!0:0===a.path.search(/^http(s)?\:\/\/(www\.)?vimeo\.com/i)},minplayer.players.vimeo.prototype.hasPlayLoader=function(){return minplayer.hasTouch},minplayer.players.vimeo.prototype.hasController=function(){return minplayer.hasTouch},minplayer.players.vimeo.getMediaId=function(a){var b=/^http[s]?\:\/\/(www\.)?vimeo\.com\/(\?v\=)?([0-9]+)/i;return 0===a.path.search(b)?a.path.match(b)[3]:a.path},minplayer.players.vimeo.parseNode=function(a){return{title:a.title,description:a.description,mediafiles:{image:{thumbnail:{path:a.thumbnail_small},image:{path:a.thumbnail_large}},media:{media:{player:"vimeo",id:a.id}}}}},minplayer.players.vimeo.nodes={},minplayer.players.vimeo.getNode=function(a,b){minplayer.players.vimeo.nodes.hasOwnProperty(a.id)?b(minplayer.players.vimeo.nodes[a.id]):jQuery.ajax({url:"https://vimeo.com/api/v2/video/"+a.id+".json",dataType:"jsonp",success:function(c){var d=minplayer.players.vimeo.parseNode(c[0]);minplayer.players.vimeo.nodes[a.id]=d,b(d)}})},minplayer.players.vimeo.getImage=function(a,b,c){minplayer.players.vimeo.getNode(a,function(a){c(a.mediafiles.image.image)})},minplayer.players.vimeo.prototype.reset=function(){minplayer.players.base.prototype.reset.call(this)},minplayer.players.vimeo.prototype.createPlayer=function(){minplayer.players.base.prototype.createPlayer.call(this);var a="http://a.vimeocdn.com/js/froogaloop2.min.js";if(0===jQuery('script[src="'+a+'"]').length){var b=document.createElement("script");b.src=a;var c=document.getElementsByTagName("script")[0];c.parentNode.insertBefore(b,c)}var d=document.createElement("iframe");d.setAttribute("id",this.options.id+"-player"),d.setAttribute("type","text/html"),d.setAttribute("width","100%"),d.setAttribute("height","100%"),d.setAttribute("frameborder","0"),jQuery(d).addClass("vimeo-player");var e="https://player.vimeo.com/video/";return e+=this.mediaFile.id+"?",e+=jQuery.param({wmode:"opaque",api:1,player_id:this.options.id+"-player",title:0,byline:0,portrait:0,loop:this.options.loop}),d.setAttribute("src",e),this.poll(this.options.id+"_vimeo",function(a){return function(){if(window.Froogaloop){a.player=window.Froogaloop(d);var b=0;a.player.addEvent("ready",function(){clearTimeout(b),a.onReady(),a.onError("")}),b=setTimeout(function(){a.onReady()},3e3)}return!window.Froogaloop}}(this),200),this.trigger("loadstart"),d},minplayer.players.vimeo.prototype.onReady=function(){this.player.addEvent("loadProgress",function(a){return function(b){a.duration.set(parseFloat(b.duration)),a.bytesLoaded.set(b.bytesLoaded),a.bytesTotal.set(b.bytesTotal)}}(this)),this.player.addEvent("playProgress",function(a){return function(b){a.duration.set(parseFloat(b.duration)),a.currentTime.set(parseFloat(b.seconds))}}(this)),this.player.addEvent("play",function(a){return function(){a.onPlaying()}}(this)),this.player.addEvent("pause",function(a){return function(){a.onPaused()}}(this)),this.player.addEvent("finish",function(a){return function(){a.onComplete()}}(this)),minplayer.players.base.prototype.onReady.call(this),this.onLoaded(),this.options.autoplay&&this.play()},minplayer.players.vimeo.prototype.clear=function(){this.player&&this.player.api("unload"),minplayer.players.base.prototype.clear.call(this)},minplayer.players.vimeo.prototype.load=function(a,b){minplayer.players.base.prototype.load.call(this,a,function(){this.construct(),b&&b.call(this)})},minplayer.players.vimeo.prototype.play=function(a){minplayer.players.base.prototype.play.call(this,function(){this.player.api("play"),a&&a.call(this)})},minplayer.players.vimeo.prototype.pause=function(a){minplayer.players.base.prototype.pause.call(this,function(){this.player.api("pause"),a&&a.call(this)})},minplayer.players.vimeo.prototype.stop=function(a){minplayer.players.base.prototype.stop.call(this,function(){this.player.api("unload"),a&&a.call(this)})},minplayer.players.vimeo.prototype._seek=function(a){this.player.api("seekTo",a)},minplayer.players.vimeo.prototype.setVolume=function(a,b){minplayer.players.base.prototype.setVolume.call(this,a,function(){this.volume.set(a),this.player.api("setVolume",a),b&&b.call(this)})},minplayer.players.vimeo.prototype._getVolume=function(a){this.player.api("getVolume",function(b){a(b)})},minplayer.players.vimeo.prototype._getDuration=function(a){this.player.api("getDuration",function(b){a(b)})};var minplayer=minplayer||{};minplayer.players=minplayer.players||{},minplayer.players.limelight=function(a,b){minplayer.players.flash.call(this,a,b)},minplayer.players.limelight.prototype=new minplayer.players.flash,minplayer.players.limelight.prototype.constructor=minplayer.players.limelight,minplayer.players.limelight.prototype.construct=function(){minplayer.players.flash.prototype.construct.call(this),this.options.pluginName="limelight"},minplayer.players.limelight.getPriority=function(){return 10},minplayer.players.limelight.canPlay=function(a){if("video/limelight"===a.mimetype)return!0;var b=/.*limelight\.com.*/i;return 0===a.path.search(b)},minplayer.players.limelight.getMediaId=function(a){var b=/.*limelight\.com.*mediaId=([a-zA-Z0-9]+)/i;return 0===a.path.search(b)?a.path.match(b)[1]:a.path},minplayer.players.limelight.prototype.register=function(){window.delvePlayerCallback=function(a,b,c){var d=a.replace("-player","");jQuery.each(minplayer.get(d,"media"),function(a,d){d.onMediaUpdate(b,c)})}},minplayer.players.limelight.prototype.onMediaUpdate=function(a,b){switch(a){case"onPlayerLoad":this.onReady();break;case"onMediaLoad":if(this.complete)return this.pause(),void this.onPaused();this.shouldSeek=this.startTime>0,this.onLoaded();break;case"onMediaComplete":this.complete=!0,this.onComplete();break;case"onPlayheadUpdate":!b.positionInMilliseconds||this.playing||this.complete||this.onPlaying(),this.complete=!1,this.shouldSeek&&this.seekValue?(this.shouldSeek=!1,this.seek(this.seekValue)):(this.duration.set(b.durationInMilliseconds/1e3),this.currentTime.set(b.positionInMilliseconds/1e3));break;case"onError":this.onError();break;case"onPlayStateChanged":b.isPlaying?this.onPlaying():b.isBusy?this.onWaiting():this.onPaused()}},minplayer.players.limelight.prototype.createPlayer=function(){minplayer.players.flash.prototype.createPlayer.call(this);var a=document.createElement("script");a.src="https://assets.delvenetworks.com/player/embed.js";var b=document.getElementsByTagName("script")[0];b.parentNode.insertBefore(a,b),this.register();var c={deepLink:"true",autoplay:this.options.autoplay?"true":"false",startQuality:"HD"},d=null,e=this.options.channel;e||(d=/.*limelight\.com.*channelId=([a-zA-Z0-9]+)/i,0===this.mediaFile.path.search(d)&&(e=this.mediaFile.path.match(d)[1])),e&&"media"===this.mediaFile.queueType&&(c.adConfigurationChannelId=e);var f=this.options.playerForm;f||(d=/.*limelight\.com.*playerForm=([a-zA-Z0-9]+)/i,0===this.mediaFile.path.search(d)&&(f=this.mediaFile.path.match(d)[1])),f&&(c.playerForm=f),c.mediaId=this.mediaFile.id;var g=this.options.id+"-player";return setTimeout(function h(){window.hasOwnProperty("LimelightPlayerUtil")?window.LimelightPlayerUtil.initEmbed(g):setTimeout(h,1e3)},1e3),this.getFlash({swf:document.location.protocol+"//assets.delvenetworks.com/player/loader.swf",id:g,width:this.options.width,height:"100%",flashvars:c,wmode:this.options.wmode})},minplayer.players.limelight.prototype.play=function(a){minplayer.players.flash.prototype.play.call(this,function(){this.player.doPlay(),a&&a.call(this)})},minplayer.players.limelight.prototype.pause=function(a){minplayer.players.flash.prototype.pause.call(this,function(){this.player.doPause(),a&&a.call(this)})},minplayer.players.limelight.prototype.stop=function(a){minplayer.players.flash.prototype.stop.call(this,function(){this.player.doPause(),a&&a.call(this)})},minplayer.players.limelight.prototype._seek=function(a){this.seekValue=a,this.player.doSeekToSecond(a)},minplayer.players.limelight.prototype.setVolume=function(a,b){minplayer.players.flash.prototype.setVolume.call(this,a,function(){this.player.doSetVolume(a),b&&b.call(this)})},minplayer.players.limelight.prototype._getVolume=function(a){a(this.player.doGetVolume())},minplayer.players.limelight.prototype.search=function(a){this.whenReady(function(){this.player.doSearch(a)})};var minplayer=minplayer||{};minplayer.players=minplayer.players||{},minplayer.players.kaltura=function(a,b){minplayer.players.base.call(this,a,b)},minplayer.players.kaltura.prototype=new minplayer.players.base,minplayer.players.kaltura.prototype.constructor=minplayer.players.kaltura,minplayer.players.kaltura.prototype.construct=function(){minplayer.players.base.prototype.construct.call(this),this.options.pluginName="kaltura",this.adPlaying=!1},minplayer.players.kaltura.prototype.defaultOptions=function(a){a.entryId=0,a.uiConfId=0,a.partnerId=0,minplayer.players.base.prototype.defaultOptions.call(this,a)},minplayer.players.kaltura.getPriority=function(){return 10},minplayer.players.kaltura.canPlay=function(a){if("video/kaltura"===a.mimetype)return!0;var b=/.*kaltura\.com.*/i;return 0===a.path.search(b)},minplayer.players.kaltura.prototype.adStart=function(){this.adPlaying=!0,this.onPlaying()},minplayer.players.kaltura.prototype.adEnd=function(){this.adPlaying=!1},minplayer.players.kaltura.prototype.playerStateChange=function(a){if(!this.adPlaying)switch(a){case"ready":this.onLoaded();break;case"loading":case"buffering":this.onWaiting();break;case"playing":this.onPlaying();break;case"paused":this.onPaused()}},minplayer.players.kaltura.prototype.mediaReady=function(){this.onLoaded()},minplayer.players.kaltura.prototype.playerPlayEnd=function(){this.onComplete()},minplayer.players.kaltura.prototype.playUpdate=function(a){this.currentTime.set(a)},minplayer.players.kaltura.prototype.durationChange=function(a){this.duration.set(a.newValue)},minplayer.players.kaltura.prototype.getInstance=function(){if(this.instanceName)return this.instanceName;var a=this.uuid.split("__"),b="minplayer.plugins."+a[0];return b+="."+a[1],b+="["+(a[2]-1)+"]",this.instanceName=b,b},minplayer.players.kaltura.prototype.registerEvents=function(){this.player.addJsListener("adStart",this.getInstance()+".adStart"),this.player.addJsListener("adEnd",this.getInstance()+".adEnd"),this.player.addJsListener("playerStateChange",this.getInstance()+".playerStateChange"),this.player.addJsListener("durationChange",this.getInstance()+".durationChange"),this.player.addJsListener("mediaReady",this.getInstance()+".mediaReady"),this.player.addJsListener("playerUpdatePlayhead",this.getInstance()+".playUpdate"),this.player.addJsListener("playerPlayEnd",this.getInstance()+".playerPlayEnd") },minplayer.players.kaltura.prototype.createPlayer=function(){minplayer.players.base.prototype.createPlayer.call(this);var a={},b=this;jQuery.each(["entryId","uiConfId","partnerId"],function(c,d){if(a[d]="",b.options[d])a[d]=b.options[d];else{var e=null;switch(d){case"entryId":e=/.*kaltura\.com.*entry_id\/([^\/]+)/i;break;case"uiConfId":e=/.*kaltura\.com.*uiconf_id\/([^\/]+)/i;break;case"partnerId":e=/.*kaltura\.com.*wid\/_([^\/]+)/i}e&&(a[d]=b.mediaFile.path.match(e),a[d]&&(a[d]=a[d][1]))}});var c=document.createElement("script");c.src="http://cdnapi.kaltura.com/p/",c.src+=a.partnerId,c.src+="/sp/",c.src+=a.partnerId,c.src+="00/embedIframeJs/uiconf_id/",c.src+=a.uiConfId,c.src+="/partner_id/",c.src+=a.partnerId;var d=document.getElementsByTagName("script")[0];d.parentNode.insertBefore(c,d);var e=this.options.id+"-player";return setTimeout(function f(){window.hasOwnProperty("kWidget")?kWidget.embed({targetId:e,wid:"_"+a.partnerId,uiconf_id:a.uiConfId,entry_id:a.entryId,flashvars:{autoPlay:!1},params:{wmode:"transparent"},readyCallback:function(a){b.player=jQuery("#"+a).get(0),b.registerEvents(),b.onReady()}}):setTimeout(f,1e3)},1e3),'
'},minplayer.players.kaltura.prototype.play=function(a){minplayer.players.base.prototype.play.call(this,function(){this.player.sendNotification("doPlay"),a&&a.call(this)})},minplayer.players.kaltura.prototype.pause=function(a){minplayer.players.base.prototype.pause.call(this,function(){this.player.sendNotification("doPause"),a&&a.call(this)})},minplayer.players.kaltura.prototype.stop=function(a){minplayer.players.base.prototype.stop.call(this,function(){this.player.sendNotification("doStop"),a&&a.call(this)})},minplayer.players.kaltura.prototype._seek=function(a){this.seekValue=a,this.player.sendNotification("doSeek",a)},minplayer.players.kaltura.prototype.setVolume=function(a,b){minplayer.players.base.prototype.setVolume.call(this,a,function(){this.player.sendNotification("changeVolume",a),b&&b.call(this)})};var minplayer=minplayer||{};minplayer.controller=function(a,b){minplayer.display.call(this,"controller",a,b)},minplayer.controller.prototype=new minplayer.display,minplayer.controller.prototype.constructor=minplayer.controller,minplayer.formatTime=function(a){a=a||0;var b=0,c=0,d=0,e="";return d=Math.floor(a/3600),a-=3600*d,c=Math.floor(a/60),a-=60*c,b=Math.floor(a%60),d&&(e+=String(d),e+=":"),e+=c>=10?String(c):"0"+String(c),e+=":",e+=b>=10?String(b):"0"+String(b),{time:e,units:""}},minplayer.controller.prototype.getElements=function(){var a=minplayer.display.prototype.getElements.call(this);return jQuery.extend(a,{play:null,pause:null,fullscreen:null,seek:null,progress:null,volume:null,timer:null})},minplayer.controller.prototype.defaultOptions=function(a){a.disptime=0,minplayer.display.prototype.defaultOptions.call(this,a)},minplayer.controller.prototype.construct=function(){minplayer.display.prototype.construct.call(this),this.options.pluginName="controller",this.dragging=!1,this.vol=0,this.elements.seek&&(this.seekBar=this.elements.seek.slider({range:"min",create:function(a){jQuery(".ui-slider-range",a.target).addClass("ui-state-active")}})),this.elements.volume&&(this.volumeBar=this.elements.volume.slider({animate:!0,range:"min",orientation:"vertical"})),this.get("player",function(a){this.elements.fullscreen&&minplayer.click(this.elements.fullscreen.unbind(),function(){a.toggleFullScreen()}).css({pointer:"hand"})}),this.get("media",function(a){a.hasController()?this.hide():(this.elements.pause&&(minplayer.click(this.elements.pause.unbind(),function(b){return function(c){c.preventDefault(),b.playPause(!1,a)}}(this)),a.ubind(this.uuid+":pause",function(a){return function(){a.setPlayPause(!0)}}(this))),this.elements.play&&(minplayer.click(this.elements.play.unbind(),function(b){return function(c){c.preventDefault(),b.playPause(!0,a)}}(this)),a.ubind(this.uuid+":playing",function(a){return function(){a.setPlayPause(!1)}}(this))),this.elements.duration&&(a.ubind(this.uuid+":durationchange",function(a){return function(b,c){var d=a.options.disptime||c.duration;a.setTimeString("duration",d)}}(this)),a.getDuration(function(a){return function(b){b=a.options.disptime||b,a.setTimeString("duration",b)}}(this))),this.elements.progress&&a.ubind(this.uuid+":progress",function(a){return function(b,c){var d=c.total?c.loaded/c.total*100:0;a.elements.progress.width(d+"%")}}(this)),(this.seekBar||this.elements.timer)&&a.ubind(this.uuid+":timeupdate",function(a){return function(b,c){if(!a.dragging){var d=0;c.duration&&(d=c.currentTime/c.duration*100),a.seekBar&&a.seekBar.slider("option","value",d),a.setTimeString("timer",c.currentTime)}}}(this)),this.seekBar&&this.seekBar.slider({start:function(a){return function(){a.dragging=!0}}(this),stop:function(b){return function(c,d){b.dragging=!1,a.getDuration(function(b){a.seek(d.value/100*b)})}}(this),slide:function(b){return function(c,d){a.getDuration(function(c){var e=d.value/100*c;b.dragging||a.seek(e),b.setTimeString("timer",e)})}}(this)}),this.elements.mute&&minplayer.click(this.elements.mute,function(b){return function(c){c.preventDefault();var d=b.volumeBar.slider("option","value");d>0?(b.vol=d,b.volumeBar.slider("option","value",0),a.setVolume(0)):(b.volumeBar.slider("option","value",b.vol),a.setVolume(b.vol/100))}}(this)),this.volumeBar&&(this.volumeBar.slider({slide:function(b,c){a.setVolume(c.value/100)}}),a.ubind(this.uuid+":volumeupdate",function(a){return function(b,c){a.volumeBar.slider("option","value",100*c)}}(this)),a.getVolume(function(a){return function(b){a.volumeBar.slider("option","value",100*b)}}(this))))}),this.ready()},minplayer.controller.prototype.setPlayPause=function(a){var b="";this.elements.play&&(b=a?"inherit":"none",this.elements.play.css("display",b)),this.elements.pause&&(b=a?"none":"inherit",this.elements.pause.css("display",b))},minplayer.controller.prototype.playPause=function(a,b){var c=a?"play":"pause";this.display.trigger(c),this.setPlayPause(!a),b&&b[c]()},minplayer.controller.prototype.setTimeString=function(a,b){this.elements[a]&&this.elements[a].text(minplayer.formatTime(b).time)};var osmplayer=osmplayer||{};!function(a){!function(b,c){function d(a){return""===g?a:(a=a.charAt(0).toUpperCase()+a.substr(1),g+a)}var e=Math,f=c.createElement("div").style,g=function(){for(var a,b="t,webkitT,MozT,msT,OT".split(","),c=0,d=b.length;d>c;c++)if(a=b[c]+"ransform",a in f)return b[c].substr(0,b[c].length-1);return!1}(),h=g?"-"+g.toLowerCase()+"-":"",i=d("transform"),j=d("transitionProperty"),k=d("transitionDuration"),l=d("transformOrigin"),m=d("transitionTimingFunction"),n=d("transitionDelay"),o=/android/gi.test(navigator.appVersion),p=/iphone|ipad/gi.test(navigator.appVersion),q=/hp-tablet/gi.test(navigator.appVersion),r=d("perspective")in f,s="ontouchstart"in b&&!q,t=g!==!1,u=d("transition")in f,v="onorientationchange"in b?"orientationchange":"resize",w=s?"touchstart":"mousedown",x=s?"touchmove":"mousemove",y=s?"touchend":"mouseup",z=s?"touchcancel":"mouseup",A=function(){if(g===!1)return!1;var a={"":"transitionend",webkit:"webkitTransitionEnd",Moz:"transitionend",O:"otransitionend",ms:"MSTransitionEnd"};return a[g]}(),B=function(){return b.requestAnimationFrame||b.webkitRequestAnimationFrame||b.mozRequestAnimationFrame||b.oRequestAnimationFrame||b.msRequestAnimationFrame||function(a){return setTimeout(a,1)}}(),C=function(){return b.cancelRequestAnimationFrame||b.webkitCancelAnimationFrame||b.webkitCancelRequestAnimationFrame||b.mozCancelRequestAnimationFrame||b.oCancelRequestAnimationFrame||b.msCancelRequestAnimationFrame||clearTimeout}(),D=r?" translateZ(0)":"",E=function(a,d){var e,f=this;f.wrapper="object"==typeof a?a:c.getElementById(a),f.wrapper.style.overflow="hidden",f.scroller=f.wrapper.children[0],f.options={hScroll:!0,vScroll:!0,x:0,y:0,bounce:!0,bounceLock:!1,momentum:!0,lockDirection:!0,useTransform:!0,useTransition:!1,topOffset:0,checkDOMChanges:!1,handleClick:!0,hScrollbar:!0,vScrollbar:!0,fixedScrollbar:o,hideScrollbar:p,fadeScrollbar:p&&r,scrollbarClass:"",zoom:!1,zoomMin:1,zoomMax:4,doubleTapZoom:2,wheelAction:"scroll",snap:!1,snapThreshold:1,onRefresh:null,onBeforeScrollStart:function(a){a.preventDefault()},onScrollStart:null,onBeforeScrollMove:null,onScrollMove:null,onBeforeScrollEnd:null,onScrollEnd:null,onTouchEnd:null,onDestroy:null,onZoomStart:null,onZoom:null,onZoomEnd:null};for(e in d)f.options[e]=d[e];f.x=f.options.x,f.y=f.options.y,f.options.useTransform=t&&f.options.useTransform,f.options.hScrollbar=f.options.hScroll&&f.options.hScrollbar,f.options.vScrollbar=f.options.vScroll&&f.options.vScrollbar,f.options.zoom=f.options.useTransform&&f.options.zoom,f.options.useTransition=u&&f.options.useTransition,f.options.zoom&&o&&(D=""),f.scroller.style[j]=f.options.useTransform?h+"transform":"top left",f.scroller.style[k]="0",f.scroller.style[l]="0 0",f.options.useTransition&&(f.scroller.style[m]="cubic-bezier(0.33,0.66,0.66,1)"),f.options.useTransform?f.scroller.style[i]="translate("+f.x+"px,"+f.y+"px)"+D:f.scroller.style.cssText+=";position:absolute;top:"+f.y+"px;left:"+f.x+"px",f.options.useTransition&&(f.options.fixedScrollbar=!0),f.refresh(),f._bind(v,b),f._bind(w),s||"none"!=f.options.wheelAction&&(f._bind("DOMMouseScroll"),f._bind("mousewheel")),f.options.checkDOMChanges&&(f.checkDOMTime=setInterval(function(){f._checkDOMChanges()},500))};E.prototype={enabled:!0,x:0,y:0,steps:[],scale:1,currPageX:0,currPageY:0,pagesX:[],pagesY:[],aniTime:null,wheelZoomCount:0,handleEvent:function(a){var b=this;switch(a.type){case w:if(!s&&0!==a.button)return;b._start(a);break;case x:b._move(a);break;case y:case z:b._end(a);break;case v:b._resize();break;case"DOMMouseScroll":case"mousewheel":b._wheel(a);break;case A:b._transitionEnd(a)}},_checkDOMChanges:function(){this.moved||this.zoomed||this.animating||this.scrollerW==this.scroller.offsetWidth*this.scale&&this.scrollerH==this.scroller.offsetHeight*this.scale||this.refresh()},_scrollbar:function(a){var b,d=this;return d[a+"Scrollbar"]?(d[a+"ScrollbarWrapper"]||(b=c.createElement("div"),d.options.scrollbarClass?b.className=d.options.scrollbarClass+a.toUpperCase():b.style.cssText="position:absolute;z-index:100;"+("h"==a?"height:7px;bottom:1px;left:2px;right:"+(d.vScrollbar?"7":"2")+"px":"width:7px;bottom:"+(d.hScrollbar?"7":"2")+"px;top:2px;right:1px"),b.style.cssText+=";pointer-events:none;"+h+"transition-property:opacity;"+h+"transition-duration:"+(d.options.fadeScrollbar?"350ms":"0")+";overflow:hidden;opacity:"+(d.options.hideScrollbar?"0":"1"),d.wrapper.appendChild(b),d[a+"ScrollbarWrapper"]=b,b=c.createElement("div"),d.options.scrollbarClass||(b.style.cssText="position:absolute;z-index:100;background:rgba(0,0,0,0.5);border:1px solid rgba(255,255,255,0.9);"+h+"background-clip:padding-box;"+h+"box-sizing:border-box;"+("h"==a?"height:100%":"width:100%")+";"+h+"border-radius:3px;border-radius:3px"),b.style.cssText+=";pointer-events:none;"+h+"transition-property:"+h+"transform;"+h+"transition-timing-function:cubic-bezier(0.33,0.66,0.66,1);"+h+"transition-duration:0;"+h+"transform: translate(0,0)"+D,d.options.useTransition&&(b.style.cssText+=";"+h+"transition-timing-function:cubic-bezier(0.33,0.66,0.66,1)"),d[a+"ScrollbarWrapper"].appendChild(b),d[a+"ScrollbarIndicator"]=b),"h"==a?(d.hScrollbarSize=d.hScrollbarWrapper.clientWidth,d.hScrollbarIndicatorSize=e.max(e.round(d.hScrollbarSize*d.hScrollbarSize/d.scrollerW),8),d.hScrollbarIndicator.style.width=d.hScrollbarIndicatorSize+"px",d.hScrollbarMaxScroll=d.hScrollbarSize-d.hScrollbarIndicatorSize,d.hScrollbarProp=d.hScrollbarMaxScroll/d.maxScrollX):(d.vScrollbarSize=d.vScrollbarWrapper.clientHeight,d.vScrollbarIndicatorSize=e.max(e.round(d.vScrollbarSize*d.vScrollbarSize/d.scrollerH),8),d.vScrollbarIndicator.style.height=d.vScrollbarIndicatorSize+"px",d.vScrollbarMaxScroll=d.vScrollbarSize-d.vScrollbarIndicatorSize,d.vScrollbarProp=d.vScrollbarMaxScroll/d.maxScrollY),void d._scrollbarPos(a,!0)):void(d[a+"ScrollbarWrapper"]&&(t&&(d[a+"ScrollbarIndicator"].style[i]=""),d[a+"ScrollbarWrapper"].parentNode.removeChild(d[a+"ScrollbarWrapper"]),d[a+"ScrollbarWrapper"]=null,d[a+"ScrollbarIndicator"]=null))},_resize:function(){var a=this;setTimeout(function(){a.refresh()},o?200:0)},_pos:function(a,b){this.zoomed||(a=this.hScroll?a:0,b=this.vScroll?b:0,this.options.useTransform?this.scroller.style[i]="translate("+a+"px,"+b+"px) scale("+this.scale+")"+D:(a=e.round(a),b=e.round(b),this.scroller.style.left=a+"px",this.scroller.style.top=b+"px"),this.x=a,this.y=b,this._scrollbarPos("h"),this._scrollbarPos("v"))},_scrollbarPos:function(a,b){var c,d=this,f="h"==a?d.x:d.y;d[a+"Scrollbar"]&&(f=d[a+"ScrollbarProp"]*f,0>f?(d.options.fixedScrollbar||(c=d[a+"ScrollbarIndicatorSize"]+e.round(3*f),8>c&&(c=8),d[a+"ScrollbarIndicator"].style["h"==a?"width":"height"]=c+"px"),f=0):f>d[a+"ScrollbarMaxScroll"]&&(d.options.fixedScrollbar?f=d[a+"ScrollbarMaxScroll"]:(c=d[a+"ScrollbarIndicatorSize"]-e.round(3*(f-d[a+"ScrollbarMaxScroll"])),8>c&&(c=8),d[a+"ScrollbarIndicator"].style["h"==a?"width":"height"]=c+"px",f=d[a+"ScrollbarMaxScroll"]+(d[a+"ScrollbarIndicatorSize"]-c))),d[a+"ScrollbarWrapper"].style[n]="0",d[a+"ScrollbarWrapper"].style.opacity=b&&d.options.hideScrollbar?"0":"1",d[a+"ScrollbarIndicator"].style[i]="translate("+("h"==a?f+"px,0)":"0,"+f+"px)")+D)},_start:function(a){var c,d,f,g,h,j=this,k=s?a.touches[0]:a;j.enabled&&(j.options.onBeforeScrollStart&&j.options.onBeforeScrollStart.call(j,a),(j.options.useTransition||j.options.zoom)&&j._transitionTime(0),j.moved=!1,j.animating=!1,j.zoomed=!1,j.distX=0,j.distY=0,j.absDistX=0,j.absDistY=0,j.dirX=0,j.dirY=0,j.options.zoom&&s&&a.touches.length>1&&(g=e.abs(a.touches[0].pageX-a.touches[1].pageX),h=e.abs(a.touches[0].pageY-a.touches[1].pageY),j.touchesDistStart=e.sqrt(g*g+h*h),j.originX=e.abs(a.touches[0].pageX+a.touches[1].pageX-2*j.wrapperOffsetLeft)/2-j.x,j.originY=e.abs(a.touches[0].pageY+a.touches[1].pageY-2*j.wrapperOffsetTop)/2-j.y,j.options.onZoomStart&&j.options.onZoomStart.call(j,a)),j.options.momentum&&(j.options.useTransform?(c=getComputedStyle(j.scroller,null)[i].replace(/[^0-9\-.,]/g,"").split(","),d=+(c[12]||c[4]),f=+(c[13]||c[5])):(d=+getComputedStyle(j.scroller,null).left.replace(/[^0-9-]/g,""),f=+getComputedStyle(j.scroller,null).top.replace(/[^0-9-]/g,"")),(d!=j.x||f!=j.y)&&(j.options.useTransition?j._unbind(A):C(j.aniTime),j.steps=[],j._pos(d,f),j.options.onScrollEnd&&j.options.onScrollEnd.call(j))),j.absStartX=j.x,j.absStartY=j.y,j.startX=j.x,j.startY=j.y,j.pointX=k.pageX,j.pointY=k.pageY,j.startTime=a.timeStamp||Date.now(),j.options.onScrollStart&&j.options.onScrollStart.call(j,a),j._bind(x,b),j._bind(y,b),j._bind(z,b))},_move:function(a){var b,c,d,f=this,g=s?a.touches[0]:a,h=g.pageX-f.pointX,j=g.pageY-f.pointY,k=f.x+h,l=f.y+j,m=a.timeStamp||Date.now();return f.options.onBeforeScrollMove&&f.options.onBeforeScrollMove.call(f,a),f.options.zoom&&s&&a.touches.length>1?(b=e.abs(a.touches[0].pageX-a.touches[1].pageX),c=e.abs(a.touches[0].pageY-a.touches[1].pageY),f.touchesDist=e.sqrt(b*b+c*c),f.zoomed=!0,d=1/f.touchesDistStart*f.touchesDist*this.scale,df.options.zoomMax&&(d=2*f.options.zoomMax*Math.pow(.5,f.options.zoomMax/d)),f.lastScale=d/this.scale,k=this.originX-this.originX*f.lastScale+this.x,l=this.originY-this.originY*f.lastScale+this.y,this.scroller.style[i]="translate("+k+"px,"+l+"px) scale("+d+")"+D,void(f.options.onZoom&&f.options.onZoom.call(f,a))):(f.pointX=g.pageX,f.pointY=g.pageY,(k>0||k=0||f.maxScrollX>=0?0:f.maxScrollX),(l>f.minScrollY||l=f.minScrollY||f.maxScrollY>=0?f.minScrollY:f.maxScrollY),f.distX+=h,f.distY+=j,f.absDistX=e.abs(f.distX),f.absDistY=e.abs(f.distY),void(f.absDistX<6&&f.absDistY<6||(f.options.lockDirection&&(f.absDistX>f.absDistY+5?(l=f.y,j=0):f.absDistY>f.absDistX+5&&(k=f.x,h=0)),f.moved=!0,f._pos(k,l),f.dirX=h>0?-1:0>h?1:0,f.dirY=j>0?-1:0>j?1:0,m-f.startTime>300&&(f.startTime=m,f.startX=f.x,f.startY=f.y),f.options.onScrollMove&&f.options.onScrollMove.call(f,a))))},_end:function(a){if(!s||0===a.touches.length){var d,f,g,h,j,l,m,n=this,o=s?a.changedTouches[0]:a,p={dist:0,time:0},q={dist:0,time:0},r=(a.timeStamp||Date.now())-n.startTime,t=n.x,u=n.y;if(n._unbind(x,b),n._unbind(y,b),n._unbind(z,b),n.options.onBeforeScrollEnd&&n.options.onBeforeScrollEnd.call(n,a),n.zoomed)return m=n.scale*n.lastScale,m=Math.max(n.options.zoomMin,m),m=Math.min(n.options.zoomMax,m),n.lastScale=m/n.scale,n.scale=m,n.x=n.originX-n.originX*n.lastScale+n.x,n.y=n.originY-n.originY*n.lastScale+n.y,n.scroller.style[k]="200ms",n.scroller.style[i]="translate("+n.x+"px,"+n.y+"px) scale("+n.scale+")"+D,n.zoomed=!1,n.refresh(),void(n.options.onZoomEnd&&n.options.onZoomEnd.call(n,a));if(!n.moved)return s&&(n.doubleTapTimer&&n.options.zoom?(clearTimeout(n.doubleTapTimer),n.doubleTapTimer=null,n.options.onZoomStart&&n.options.onZoomStart.call(n,a),n.zoom(n.pointX,n.pointY,1==n.scale?n.options.doubleTapZoom:1),n.options.onZoomEnd&&setTimeout(function(){n.options.onZoomEnd.call(n,a)},200)):this.options.handleClick&&(n.doubleTapTimer=setTimeout(function(){for(n.doubleTapTimer=null,d=o.target;1!=d.nodeType;)d=d.parentNode;"SELECT"!=d.tagName&&"INPUT"!=d.tagName&&"TEXTAREA"!=d.tagName&&(f=c.createEvent("MouseEvents"),f.initMouseEvent("click",!0,!0,a.view,1,o.screenX,o.screenY,o.clientX,o.clientY,a.ctrlKey,a.altKey,a.shiftKey,a.metaKey,0,null),f._fake=!0,d.dispatchEvent(f))},n.options.zoom?250:0))),n._resetPos(400),void(n.options.onTouchEnd&&n.options.onTouchEnd.call(n,a));if(300>r&&n.options.momentum&&(p=t?n._momentum(t-n.startX,r,-n.x,n.scrollerW-n.wrapperW+n.x,n.options.bounce?n.wrapperW:0):p,q=u?n._momentum(u-n.startY,r,-n.y,n.maxScrollY<0?n.scrollerH-n.wrapperH+n.y-n.minScrollY:0,n.options.bounce?n.wrapperH:0):q,t=n.x+p.dist,u=n.y+q.dist,(n.x>0&&t>0||n.xn.minScrollY&&u>n.minScrollY||n.y=0?0:b.x=b.minScrollY||b.maxScrollY>0?b.minScrollY:b.yg.options.zoomMax&&(f=g.options.zoomMax),void(f!=g.scale&&(!g.wheelZoomCount&&g.options.onZoomStart&&g.options.onZoomStart.call(g,a),g.wheelZoomCount++,g.zoom(a.pageX,a.pageY,f,400),setTimeout(function(){g.wheelZoomCount--,!g.wheelZoomCount&&g.options.onZoomEnd&&g.options.onZoomEnd.call(g,a)},400)))):(d=g.x+b,e=g.y+c,d>0?d=0:dg.minScrollY?e=g.minScrollY:e=h+a.time?(d._pos(a.x,a.y),d.animating=!1,d.options.onAnimationEnd&&d.options.onAnimationEnd.call(d),void d._startAni()):(k=(k-h)/a.time-1,b=e.sqrt(1-k*k),i=(a.x-f)*b+f,j=(a.y-g)*b+g,d._pos(i,j),void(d.animating&&(d.aniTime=B(c))))},c()}},_transitionTime:function(a){a+="ms",this.scroller.style[k]=a,this.hScrollbar&&(this.hScrollbarIndicator.style[k]=a),this.vScrollbar&&(this.vScrollbarIndicator.style[k]=a)},_momentum:function(a,b,c,d,f){var g=6e-4,h=e.abs(a)/b,i=h*h/(2*g),j=0,k=0;return a>0&&i>c?(k=f/(6/(i/h*g)),c+=k,h=h*c/i,i=c):0>a&&i>d&&(k=f/(6/(i/h*g)),d+=k,h=h*d/i,i=d),i*=0>a?-1:1,j=h/g,{dist:i,time:e.round(j)}},_offset:function(a){for(var b=-a.offsetLeft,c=-a.offsetTop;a=a.offsetParent;)b-=a.offsetLeft,c-=a.offsetTop;return a!=this.wrapper&&(b*=this.scale,c*=this.scale),{left:b,top:c}},_snap:function(a,b){var c,d,f,g,h,i,j=this;for(f=j.pagesX.length-1,c=0,d=j.pagesX.length;d>c;c++)if(a>=j.pagesX[c]){f=c;break}for(f==j.currPageX&&f>0&&j.dirX<0&&f--,a=j.pagesX[f],h=e.abs(a-j.pagesX[j.currPageX]),h=h?e.abs(j.x-a)/h*500:0,j.currPageX=f,f=j.pagesY.length-1,c=0;f>c;c++)if(b>=j.pagesY[c]){f=c;break}return f==j.currPageY&&f>0&&j.dirY<0&&f--,b=j.pagesY[f],i=e.abs(b-j.pagesY[j.currPageY]),i=i?e.abs(j.y-b)/i*500:0,j.currPageY=f,g=e.round(e.max(h,i))||200,{x:a,y:b,time:g}},_bind:function(a,b,c){(b||this.scroller).addEventListener(a,this,!!c)},_unbind:function(a,b,c){(b||this.scroller).removeEventListener(a,this,!!c)},destroy:function(){var a=this;a.scroller.style[i]="",a.hScrollbar=!1,a.vScrollbar=!1,a._scrollbar("h"),a._scrollbar("v"),a._unbind(v,b),a._unbind(w),a._unbind(x,b),a._unbind(y,b),a._unbind(z,b),a.options.hasTouch||(a._unbind("DOMMouseScroll"),a._unbind("mousewheel")),a.options.useTransition&&a._unbind(A),a.options.checkDOMChanges&&clearInterval(a.checkDOMTime),a.options.onDestroy&&a.options.onDestroy.call(a)},refresh:function(){var a,b,c,d,f=this,g=0,h=0;if(f.scalef.wrapperH),f.hScrollbar=f.hScroll&&f.options.hScrollbar,f.vScrollbar=f.vScroll&&f.options.vScrollbar&&f.scrollerH>f.wrapperH,a=f._offset(f.wrapper),f.wrapperOffsetLeft=-a.left,f.wrapperOffsetTop=-a.top,"string"==typeof f.options.snap)for(f.pagesX=[],f.pagesY=[],d=f.scroller.querySelectorAll(f.options.snap),b=0,c=d.length;c>b;b++)g=f._offset(d[b]),g.left+=f.wrapperOffsetLeft,g.top+=f.wrapperOffsetTop,f.pagesX[b]=g.left=f.maxScrollX;)f.pagesX[h]=g,g-=f.wrapperW,h++;for(f.maxScrollX%f.wrapperW&&(f.pagesX[f.pagesX.length]=f.maxScrollX-f.pagesX[f.pagesX.length-1]+f.pagesX[f.pagesX.length-1]),g=0,h=0,f.pagesY=[];g>=f.maxScrollY;)f.pagesY[h]=g,g-=f.wrapperH,h++;f.maxScrollY%f.wrapperH&&(f.pagesY[f.pagesY.length]=f.maxScrollY-f.pagesY[f.pagesY.length-1]+f.pagesY[f.pagesY.length-1])}f._scrollbar("h"),f._scrollbar("v"),f.zoomed||(f.scroller.style[k]="0",f._resetPos(400))},scrollTo:function(a,b,c,d){var e,f,g=this,h=a;for(g.stop(),h.length||(h=[{x:a,y:b,time:c,relative:d}]),e=0,f=h.length;f>e;e++)h[e].relative&&(h[e].x=g.x-h[e].x,h[e].y=g.y-h[e].y),g.steps.push({x:h[e].x,y:h[e].y,time:h[e].time||0});g._startAni()},scrollToElement:function(a,b){var c,d=this;a=a.nodeType?a:d.scroller.querySelector(a),a&&(c=d._offset(a),c.left+=d.wrapperOffsetLeft,c.top+=d.wrapperOffsetTop,c.left=c.left>0?0:c.leftd.minScrollY?d.minScrollY:c.topa?0:a>f.pagesX.length-1?f.pagesX.length-1:a,b=0>b?0:b>f.pagesY.length-1?f.pagesY.length-1:b,f.currPageX=a,f.currPageY=b,d=f.pagesX[a],e=f.pagesY[b]):(d=-f.wrapperW*a,e=-f.wrapperH*b,d0?0:e.xe.minScrollY?e.minScrollY:e.y0&&(a.playLoader.enabled=!0,a.playLoader.loadPreview(b.path),a.playLoader.previewFlag.setFlag("media",!0),a.hasMedia||(a.playLoader.busy.setFlag("media",!1),a.playLoader.bigPlay.setFlag("media",!1)),a.playLoader.checkVisibility())}}(this))}})},osmplayer.prototype.addToQueue=function(a){return a=minplayer.getMediaFile(a),a&&this.playQueue.push(a),a},osmplayer.prototype.playNext=function(){this.playQueue.length>this.playIndex?(this.load(this.playQueue[this.playIndex]),this.playIndex++):this.options.repeat?(this.playIndex=0,this.playNext()):this.playQueue.length>0?this.hasPlaylist&&this.options.autoNext?this.trigger("player_ended"):(this.options.autoplay=!1,this.playIndex=0,this.playNext()):this.media&&("undefined"!=typeof this.options.originalAutoPlay&&(this.options.autoplay=this.options.originalAutoPlay),this.media.stop(),this.options.file?this.load():this.loadNode())},osmplayer.getNode=function(a,b){if(a&&a.mediafiles&&a.mediafiles.media){var c=minplayer.getMediaFile(a.mediafiles.media.media);if(c){var d=minplayer.players[c.player];d&&"function"==typeof d.getNode&&d.getNode(c,function(a){b(a)})}}},osmplayer.getImage=function(a,b,c){var d="",e=a.image;if(e)if(e[b])d=e[b];else if(e.image)d=e.image;else for(b in e)if(e.hasOwnProperty(b)){d=e[b];break}if(d)c(new minplayer.file(d));else{var f=minplayer.getMediaFile(a.media.media);if(f){var g=minplayer.players[f.player];g&&"function"==typeof g.getImage&&g.getImage(f,b,function(a){c(new minplayer.file(a))})}}};var osmplayer=osmplayer||{};osmplayer.parser=osmplayer.parser||{},osmplayer.parser["default"]={priority:1,valid:function(){return!0},getType:function(){return"json"},getFeed:function(a,b,c){return a=a.replace(/(.*)\??(.*)/i,"$1"),a+="?start-index="+b,a+="&max-results="+c},parse:function(a){return a}};var osmplayer=osmplayer||{};osmplayer.parser=osmplayer.parser||{},osmplayer.parser.youtube={priority:10,valid:function(a){return 0===a.search(/^http(s)?\:\/\/gdata\.youtube\.com/i)},getType:function(){return"jsonp"},getFeed:function(a,b,c){return a=a.replace(/(.*)\??(.*)/i,"$1"),a+="?start-index="+(b+1),a+="&max-results="+c,a+="&v=2&alt=jsonc"},parse:function(a){a=a.data;var b={total_rows:a.totalItems,nodes:[]},c=null;for(var d in a.items)a.items.hasOwnProperty(d)&&(c=minplayer.players.youtube.parseNode(a.items[d]),b.nodes.push(c));return b}};var osmplayer=osmplayer||{};osmplayer.parser=osmplayer.parser||{},osmplayer.parser.rss={priority:8,valid:function(a){return a=a.replace(/(.*)\??(.*)/i,"$1"),null!==a.match(/\.rss$/i)},getType:function(){return"xml"},getFeed:function(a){return a},parse:function(a){var b={total_rows:0,nodes:[]};return jQuery("rss channel",a).find("item").each(function(){osmplayer.parser.rss.addRSSItem(b,jQuery(this))}),b},addRSSItem:function(a,b){a.total_rows++;var c={},d="",e="",f="",g="";d=b.find("title"),d.length&&(c.title=d.text()),e=b.find("annotation"),e.length&&(c.description=e.text()),c.mediafiles={},f=b.find("image"),f.length&&(c.mediafiles.image={image:{path:f.text()}}),g=b.find("location"),g.length&&(c.mediafiles.media={media:{path:g.text()}}),a.nodes.push(c) }};var osmplayer=osmplayer||{};osmplayer.parser=osmplayer.parser||{},osmplayer.parser.asx={priority:8,valid:function(a){return a=a.replace(/(.*)\??(.*)/i,"$1"),null!==a.match(/\.asx$/i)},getType:function(){return"xml"},getFeed:function(a){return a},parse:function(a){var b={total_rows:0,nodes:[]};return jQuery("asx entry",a).each(function(){osmplayer.parser.rss.addRSSItem(b,jQuery(this))}),b}};var osmplayer=osmplayer||{};osmplayer.parser=osmplayer.parser||{},osmplayer.parser.xsfp={priority:8,valid:function(a){return a=a.replace(/(.*)\??(.*)/i,"$1"),null!==a.match(/\.xml$/i)},getType:function(){return"xml"},getFeed:function(a){return a},parse:function(a){var b={total_rows:0,nodes:[]};return jQuery("playlist trackList track",a).each(function(){osmplayer.parser.rss.addRSSItem(b,jQuery(this))}),b}},osmplayer.playlist=function(a,b){minplayer.display.call(this,"playlist",a,b)},osmplayer.playlist.prototype=new minplayer.display,osmplayer.playlist.prototype.constructor=osmplayer.playlist,osmplayer.playlist.prototype.defaultOptions=function(a){a.vertical=!0,a.playlist="",a.pageLimit=10,a.autoNext=!0,a.shuffle=!1,a.loop=!1,a.hysteresis=40,a.scrollSpeed=20,a.scrollMode="auto",minplayer.display.prototype.defaultOptions.call(this,a)},osmplayer.playlist.prototype.construct=function(){this.nodes=[],this.page=-1,this.totalItems=0,this.currentItem=-1,this.playqueue=[],this.playqueuepos=0,this.playlist=this.options.playlist,this.scroll=null,this.orient={pos:this.options.vertical?"y":"x",pagePos:this.options.vertical?"pageY":"pageX",offset:this.options.vertical?"top":"left",wrapperSize:this.options.vertical?"wrapperH":"wrapperW",minScroll:this.options.vertical?"minScrollY":"minScrollX",maxScroll:this.options.vertical?"maxScrollY":"maxScrollX",size:this.options.vertical?"height":"width"},this.pager=this.create("pager","osmplayer"),this.pager.ubind(this.uuid+":nextPage",function(a){return function(){a.nextPage()}}(this)),this.pager.ubind(this.uuid+":prevPage",function(a){return function(){a.prevPage()}}(this)),minplayer.display.prototype.construct.call(this),this.hasPlaylist=this.next(),this.ready()},osmplayer.playlist.prototype.onAdded=function(a){this.options.autoNext&&a.get("player",function(a){return function(b){b.ubind(a.uuid+":player_ended",function(){a.hasPlaylist&&("undefined"==typeof b.options.originalAutoPlay&&(b.options.originalAutoPlay=b.options.autoplay),b.options.autoplay=!0,a.next())})}}(this))},osmplayer.playlist.prototype.scrollTo=function(a,b){this.scroll&&(this.scroll.options.hideScrollbar=!1,this.options.vertical?this.scroll.scrollTo(0,a,0,b):this.scroll.scrollTo(a,0,0,b),this.scroll.options.hideScrollbar=!0)},osmplayer.playlist.prototype.refreshScroll=function(){if(!window.addEventListener)return void setTimeout(function(a){return function(){a.refreshScroll.call(a)}}(this),200);var a=this.elements.list,b=this.elements.scroll;if(this.scroll&&(this.scroll.scrollTo(0,0),this.scroll.destroy(),this.scroll=null,this.elements.list.unbind("mousemove").unbind("mouseenter").unbind("mouseleave")),!this.options.vertical){var c=0;jQuery.each(this.elements.list.children(),function(){c+=jQuery(this).outerWidth()}),this.elements.list.width(c)}a.length>0&&b.length>0&&a[this.orient.size]()>b[this.orient.size]()&&(this.scroll=new osmplayer.iScroll(this.elements.scroll.eq(0)[0],{hScroll:!this.options.vertical,hScrollbar:!this.options.vertical,vScroll:this.options.vertical,vScrollbar:this.options.vertical,hideScrollbar:"none"!==this.options.scrollMode}),"auto"!=this.options.scrollMode||minplayer.hasTouch||this.elements.list.bind("mousemove",function(a){return function(b){b.preventDefault();var c=a.display.offset()[a.orient.offset];a.mousePos=b[a.orient.pagePos],a.mousePos-=c}}(this)).bind("mouseenter",function(a){return function(b){b.preventDefault(),a.scrolling=!0;var c=function(){if(a.scrolling){var b=a.scroll[a.orient.wrapperSize],d=b/2,e=a.mousePos-d;if(Math.abs(e)>a.options.hysteresis){var f=a.options.hysteresis;f*=e>0?-1:0,e=a.options.scrollSpeed*(e+f),e/=d;var g=a.scroll[a.orient.pos]-e,h=a.scroll[a.orient.minScroll]||0,i=a.scroll[a.orient.maxScroll];g>=h?a.scrollTo(h):i>=g?a.scrollTo(i):a.scrollTo(e,!0)}setTimeout(c,30)}};c()}}(this)).bind("mouseleave",function(a){return function(b){b.preventDefault(),a.scrolling=!1}}(this)),this.scroll.refresh(),this.scroll.scrollTo(0,0,200))},osmplayer.playlist.prototype.addNode=function(a){var b=this.nodes.length,c=this.create("teaser","osmplayer",this.elements.list);c.setNode(a),c.ubind(this.uuid+":nodeLoad",function(a){return function(){a.loadItem(b,!0)}}(this)),this.nodes.push(c)},osmplayer.playlist.prototype.set=function(a,b){if("object"!=typeof a)return void this.trigger("error","Playlist must be an object to set");if(!a.hasOwnProperty("total_rows"))return void this.trigger("error","Unknown playlist format.");if(a.total_rows&&a.nodes.length){this.totalItems=a.total_rows,this.currentItem=0,(this.page+1)*this.options.pageLimit>=this.totalItems||this.totalItems==a.nodes.length?this.pager.nextPage.hide():this.pager.nextPage.show();var c=a.nodes.length;this.elements.list.empty(),this.nodes=[];for(var d=0;c>d;d++)this.addNode(a.nodes[d]),b===d&&this.loadItem(d);this.refreshScroll(),this.trigger("playlistLoad",a)}this.elements.playlist_busy&&this.elements.playlist_busy.hide()},osmplayer.playlist.prototype.setQueue=function(){this.playqueue.push({page:this.page,item:this.currentItem}),this.playqueuepos=this.playqueue.length},osmplayer.playlist.prototype.next=function(){var a=0,b=this.page;if(this.playqueuepos>=this.playqueue.length)return this.options.shuffle?(a=Math.floor(Math.random()*this.totalItems),b=Math.floor(a/this.options.pageLimit),a%=this.options.pageLimit,this.load(b,a)):(a=this.currentItem+1,a>=this.nodes.length?this.load(b+1,0):this.loadItem(a));this.playqueuepos=this.playqueuepos+1;var c=this.playqueue[this.playqueuepos];return this.load(c.page,c.item)},osmplayer.playlist.prototype.prev=function(){this.playqueuepos=this.playqueuepos-1,this.playqueuepos=this.playqueuepos<0?0:this.playqueuepos;var a=this.playqueue[this.playqueuepos];return a?this.load(a.page,a.item):!1},osmplayer.playlist.prototype.loadItem=function(a,b){if(ac){if(!this.options.loop)return!1;a=0,b=0}if(this.elements.playlist_busy&&this.elements.playlist_busy.show(),a=a||0,a=0>a?0:a,this.setQueue(),this.page=a,0===this.page?this.pager.prevPage.hide():this.pager.prevPage.show(),"object"==typeof this.playlist)return this.set(this.playlist,b),this.playlist.endpoint&&(this.playlist=this.options.playlist=this.playlist.endpoint),!0;var d=osmplayer.parser["default"];for(var e in osmplayer.parser)osmplayer.parser.hasOwnProperty(e)&&osmplayer.parser[e].valid(this.playlist)&&osmplayer.parser[e].priority>d.priority&&(d=osmplayer.parser[e]);var f=this.page*this.options.pageLimit,g=d.getFeed(this.playlist,f,this.options.pageLimit),h={type:"GET",url:g,success:function(a){return function(c){a.set(d.parse(c),b)}}(this),error:function(a){return function(b,c){a.elements.playlist_busy&&a.elements.playlist_busy.hide(),a.trigger("error",c)}}(this)},i=d.getType();return i&&(h.dataType=i),jQuery.ajax(h),!0};var osmplayer=osmplayer||{};osmplayer.pager=function(a,b){minplayer.display.call(this,"pager",a,b)},osmplayer.pager.prototype=new minplayer.display,osmplayer.pager.prototype.constructor=osmplayer.pager,osmplayer.pager.prototype.construct=function(){minplayer.display.prototype.construct.call(this),this.elements.prevPage&&(this.prevPage=this.elements.prevPage.click(function(a){return function(b){b.preventDefault(),a.trigger("prevPage")}}(this))),this.elements.nextPage&&(this.nextPage=this.elements.nextPage.click(function(a){return function(b){b.preventDefault(),a.trigger("nextPage")}}(this)))};var osmplayer=osmplayer||{};osmplayer.teaser=function(a,b){this.preview=null,minplayer.display.call(this,"teaser",a,b)},osmplayer.teaser.prototype=new minplayer.display,osmplayer.teaser.prototype.constructor=osmplayer.teaser,osmplayer.teaser.prototype.select=function(){},osmplayer.teaser.prototype.setNode=function(a){this.node=a,this.elements.title&&(a.title?this.elements.title.text(a.title):osmplayer.getNode(a,function(a){return function(b){a.elements.title.text(b.title)}}(this))),a.mediafiles&&osmplayer.getImage(a.mediafiles,"thumbnail",function(a){return function(b){b&&a.elements.image&&(a.preview=new minplayer.image(a.elements.image),a.preview.load(b.path))}}(this)),this.display.unbind("click").click(function(a){return function(b){b.preventDefault(),a.trigger("nodeLoad",a.node)}}(this))}; \ No newline at end of file diff --git a/bin/osmplayer.js b/bin/osmplayer.js index c60d74a7..f313b70f 100644 --- a/bin/osmplayer.js +++ b/bin/osmplayer.js @@ -1,6 +1,6473 @@ -function checkPlayType(a,b){if("function"==typeof a.canPlayType){if("object"==typeof b){for(var c=b.length,d="";c--&&!(d=checkPlayType(a,b[c])););return d}var e=a.canPlayType(b);if("no"!==e&&""!==e)return b}return""}var minplayer=minplayer||{};!function(a){!function(){"use strict";var a="undefined"!=typeof module&&module.exports,b="undefined"!=typeof Element&&"ALLOW_KEYBOARD_INPUT"in Element,c=function(){for(var a,b,c=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],d=0,e=c.length,f={};e>d;d++)if(a=c[d],a&&a[1]in document){for(d=0,b=a.length;b>d;d++)f[c[0][d]]=a[d];return f}return!1}(),d={request:function(a){var d=c.requestFullscreen;a=a||document.documentElement,/5\.1[\.\d]* Safari/.test(navigator.userAgent)?a[d]():a[d](b&&Element.ALLOW_KEYBOARD_INPUT)},exit:function(){document[c.exitFullscreen]()},toggle:function(a){this.isFullscreen?this.exit():this.request(a)},onchange:function(){},onerror:function(){},raw:c};return c?(Object.defineProperties(d,{isFullscreen:{get:function(){return!!document[c.fullscreenElement]}},element:{enumerable:!0,get:function(){return document[c.fullscreenElement]}},enabled:{enumerable:!0,get:function(){return!!document[c.fullscreenEnabled]}}}),document.addEventListener(c.fullscreenchange,function(a){d.onchange.call(d,a)}),document.addEventListener(c.fullscreenerror,function(a){d.onerror.call(d,a)}),void(a?module.exports=d:window.screenfull=d)):void(a?module.exports=!1:window.screenfull=!1)}(),a.screenfull=screenfull}(minplayer);var minplayer=minplayer||{};if(minplayer.compatibility=function(){var a=null;a=document.createElement("video"),this.videoOGG=checkPlayType(a,"video/ogg"),this.videoH264=checkPlayType(a,["video/mp4","video/h264"]),this.videoWEBM=checkPlayType(a,["video/x-webm","video/webm","application/octet-stream"]),this.videoMPEGURL=checkPlayType(a,"application/vnd.apple.mpegurl"),a=document.createElement("audio"),this.audioOGG=checkPlayType(a,"audio/ogg"),this.audioMP3=checkPlayType(a,"audio/mpeg"),this.audioMP4=checkPlayType(a,"audio/mp4")},minplayer.playTypes||(minplayer.playTypes=new minplayer.compatibility,minplayer.isAndroid=/android/gi.test(navigator.appVersion),minplayer.isIDevice=/iphone|ipad/gi.test(navigator.appVersion),minplayer.isPlaybook=/playbook/gi.test(navigator.appVersion),minplayer.isTouchPad=/hp-tablet/gi.test(navigator.appVersion),minplayer.hasTouch="ontouchstart"in window&&!minplayer.isTouchPad),!minplayer.urlVars){minplayer.urlVars={};var regEx=/[?&]+([^=&]+)=([^&]*)/gi;window.location.href.replace(regEx,function(a,b,c){minplayer.urlVars[b]=c})}var minplayer=minplayer||{};minplayer.async=function(){this.value=null,this.queue=[]},minplayer.async.prototype.get=function(a){null!==this.value?a(this.value):this.queue.push(a)},minplayer.async.prototype.set=function(a){this.value=a;var b=this.queue.length;if(b){for(;b--;)this.queue[b](a);this.queue=[]}};var minplayer=minplayer||{};minplayer.flags=function(){this.flag=0,this.ids={},this.numFlags=0},minplayer.flags.prototype.setFlag=function(a,b){this.ids.hasOwnProperty(a)||(this.ids[a]=this.numFlags,this.numFlags++),b?this.flag|=1<c;c++)minplayer.queue.hasOwnProperty(c)&&(b=minplayer.queue[c],d=!b.id&&!b.plugin,d|=b.plugin===a.name,d&=!b.id||b.id===this.options.id,d&&!b.addedto.hasOwnProperty(a.options.id)&&(b.addedto[a.options.id]=!0,d=minplayer.bind.call(b.context,b.event,this.options.id,a.name,b.callback,!0)));minplayer.lock=!1},minplayer.eventTypes={},minplayer.plugin.prototype.isEvent=function(a,b){var c=a+"__"+b;if("undefined"!=typeof minplayer.eventTypes[c])return minplayer.eventTypes[c];new RegExp("^(.*:)?"+b+"$","gi");return minplayer.eventTypes[c]=null!==a.match(b),minplayer.eventTypes[c]},minplayer.plugin.prototype.trigger=function(a,b,c){if(!this.active)return this;c||(this.triggered[a]=b);var d=0,e={},f=null;for(var g in this.queue)if(this.isEvent(g,a)){f=this.queue[g];for(d in f)f.hasOwnProperty(d)&&(e=f[d],e.callback({target:this,data:e.data},b))}return this},minplayer.plugin.prototype.ubind=function(a,b,c){return this.unbind(a),this.bind(a,b,c)},minplayer.plugin.prototype.bind=function(a,b,c){if(!this.active)return this;if("function"==typeof b&&(c=b,b=null),a&&c){this.queue[a]=this.queue[a]||[],this.queue[a].push({callback:c,data:b});for(var d in this.triggered)this.triggered.hasOwnProperty(d)&&this.isEvent(a,d)&&c({target:this,data:b},this.triggered[d]);return this}},minplayer.plugin.prototype.unbind=function(a){return this.lock&&setTimeout(function(b){return function(){b.unbind(a)}}(this),10),this.lock=!0,a?this.queue.hasOwnProperty(a)&&this.queue[a].length>0&&(this.queue[a].length=0):this.queue={},this.lock=!1,this},minplayer.addQueue=function(a,b,c,d,e){minplayer.lock?setTimeout(function(){minplayer.addQueue(a,c,b,d,e)},10):minplayer.queue.push({context:a,id:c,event:b,plugin:d,callback:e,addedto:{}})},minplayer.bind=function(a,b,c,d,e){if(!d)return!1;var f=minplayer.plugins,g=null,h=null,i=[],j=function(a,b){if(f.hasOwnProperty(a)&&f[a].hasOwnProperty(b))for(var c=f[a][b].length;c--;)i.push(f[a][b][c])};if(b&&c)j(b,c);else if(!b&&c)for(h in f)j(h,c);else if(b&&!c&&f[b])for(g in f[b])j(b,g);else if(!b&&!c)for(h in f)for(g in f[h])j(h,g);for(var k=i.length;k--;)i[k].bind(a,function(a){return function(b){d.call(a,b.target)}}(this));return e||minplayer.addQueue(this,a,b,c,d),i.length>0},minplayer.get=function(a,b,c){var d=typeof a,e=typeof b,f=typeof c;if("function"===d?(c=a,b=a=null):"function"===e?(c=b,b=a,a=null):"undefined"===e&&"undefined"===f&&(b=a,c=a=null),c="function"==typeof c?c:null)return void minplayer.bind.call(this,"ready",a,b,c);var g=minplayer.plugins,h=null;if(!(a||b||c))return g;if(a&&!b&&!c)return g[a];if(a&&b&&!c)return g[a][b];if(!a&&b&&!c){var i=[];for(h in g)if(g.hasOwnProperty(h)&&g[h].hasOwnProperty(b))for(var j=g[h][b].length;j--;)i.push(g[h][b][j]);return i}},minplayer.display=function(a,b,c,d){minplayer.plugin.call(this,a,b,c,d)},minplayer.display.prototype=new minplayer.plugin,minplayer.display.prototype.constructor=minplayer.display,minplayer.display.prototype.getDisplay=function(a){return a},minplayer.display.prototype.initialize=function(){this.display||(this.display=this.getDisplay(this.context,this.options)),this.display&&(this.options.pluginName="display",this.elements=this.getElements(),minplayer.plugin.prototype.initialize.call(this))},minplayer.display.prototype.construct=function(){if(minplayer.plugin.prototype.construct.call(this),this.autoHide=!1,this.onResize){var a=0;jQuery(window).resize(function(b){return function(){clearTimeout(a),a=setTimeout(function(){b.onResize()},200)}}(this))}},minplayer.display.prototype.onResize=!1,minplayer.display.prototype.hide=function(a){a=a||this.display,a&&(a.forceHide=!0,a.unbind().hide())},minplayer.display.prototype.fullScreenElement=function(){return this.display},minplayer.click=function(a,b){var c=!1;return a=jQuery(a),a.bind("touchstart click",function(a){c||(c=!0,setTimeout(function(){c=!1},100),b.call(this,a))}),a},minplayer.display.prototype.onFocus=function(a){this.hasFocus=this.focus=a,this.autoHide&&this.showThenHide(this.autoHide.element,this.autoHide.timeout,this.autoHide.cb)},minplayer.display.prototype.showThenHide=function(a,b,c){var d=typeof a;"undefined"===d?(c=null,a=this.display):"number"===d?(c=b,b=a,a=this.display):"function"===d&&(c=a,a=this.display),a&&(b=b||5e3,this.autoHide={element:a,timeout:b,cb:c},a.forceHide||("undefined"!=typeof a.showMe?a.showMe&&a.showMe(c):(a.show(),c&&c(!0))),a.hoverState||(jQuery(a).bind("mouseenter",function(){a.hoverState=!0}),jQuery(a).bind("mouseleave",function(){a.hoverState=!1})),clearTimeout(this.showTimer),this.showTimer=setTimeout(function(d){return function e(){a.hoverState?d.showTimer=setTimeout(e,b):"undefined"!=typeof a.hideMe?a.hideMe&&a.hideMe(c):a.hide("slow",function(){c&&c(!1)})}}(this),b))},minplayer.display.prototype.fullscreen=function(a){var b=this.isFullScreen(),c=this.fullScreenElement();b&&!a?(c.removeClass("fullscreen"),minplayer.screenfull&&minplayer.screenfull.exit(),this.trigger("fullscreen",!1)):!b&&a&&(c.addClass("fullscreen"),minplayer.screenfull&&(minplayer.screenfull.request(c[0]),minplayer.screenfull.onchange=function(a){return function(){minplayer.screenfull.isFullscreen||a.fullscreen(!1)}}(this)),this.trigger("fullscreen",!0))},minplayer.display.prototype.toggleFullScreen=function(){this.fullscreen(!this.isFullScreen())},minplayer.display.prototype.isFullScreen=function(){return this.fullScreenElement().hasClass("fullscreen")},minplayer.display.prototype.getScaledRect=function(a,b){var c={};return c.x=b.x?b.x:0,c.y=b.y?b.y:0,c.width=b.width?b.width:0,c.height=b.height?b.height:0,a&&(b.width/b.height>a?(c.height=b.height,c.width=Math.floor(b.height*a)):(c.height=Math.floor(b.width/a),c.width=b.width),c.x=Math.floor((b.width-c.width)/2),c.y=Math.floor((b.height-c.height)/2)),c},minplayer.display.prototype.getElements=function(){return{}},jQuery.fn.minplayer||(jQuery.fn.minplayer=function(a){return jQuery(this).each(function(){a=a||{},a.id=a.id||jQuery(this).attr("id")||Math.random(),minplayer.plugins[a.id]||(a.template=a.template||"default",minplayer[a.template]?new minplayer[a.template](jQuery(this),a):new minplayer(jQuery(this),a))})}),minplayer=jQuery.extend(function(a,b){minplayer.display.call(this,"player",a,b)},minplayer),minplayer.prototype=new minplayer.display,minplayer.prototype.constructor=minplayer,minplayer.prototype.defaultOptions=function(a){a.id="player",a.build=!1,a.wmode="transparent",a.preload=!0,a.autoplay=!1,a.autoload=!0,a.loop=!1,a.width="100%",a.height="350px",a.debug=!1,a.volume=80,a.files=null,a.file="",a.preview="",a.attributes={},a.plugins={},a.logo="",a.link="",a.duration=0,jQuery.each(this.context[0].attributes,function(b,c){a[c.name]=c.value}),minplayer.display.prototype.defaultOptions.call(this,a)},minplayer.prototype.construct=function(){minplayer.display.prototype.construct.call(this);var a=null;for(var b in this.options.plugins)a=this.options.plugins[b],minplayer[a]&&(a=minplayer[a],a[this.options.template]&&a[this.options.template].init?a[this.options.template].init(this):a.init&&a.init(this));if(this.options.pluginName="player",this.controller=this.create("controller"),this.playLoader=this.create("playLoader"),this.options.logo&&this.elements.logo){var c="";this.options.link&&(c+=''),c+='',this.options.link&&(c+=""),this.logo=this.elements.logo.append(c)}this.currentPlayer="html5",this.addKeyEvents(),this.addEvents(),this.load(this.getFiles()),this.ready()},minplayer.prototype.setFocus=function(a){minplayer.get.call(this,this.options.id,null,function(b){b.onFocus(a)}),this.trigger("playerFocus",a)},minplayer.prototype.bindTo=function(a){a.ubind(this.uuid+":error",function(a){return function(b,c){"html5"===a.currentPlayer?(minplayer.player="minplayer",a.options.file.player="minplayer",a.loadPlayer()):a.showError(c)}}(this)),a.ubind(this.uuid+":fullscreen",function(a){return function(){a.resize()}}(this))},minplayer.prototype.addEvents=function(){var a=!1;this.display.bind("mouseenter",function(b){return function(){a=!0,b.setFocus(!0)}}(this)),this.display.bind("mouseleave",function(b){return function(){a=!1,b.setFocus(!1)}}(this));var b=!1;this.display.bind("mousemove",function(c){return function(){b||(b=setTimeout(function(){b=!1,a&&c.setFocus(!0)},300))}}(this)),minplayer.get.call(this,this.options.id,null,function(a){return function(b){a.bindTo(b)}}(this))},minplayer.prototype.showError=function(a){"object"!=typeof a&&(a=a||"",this.elements.error&&(this.elements.error.text(a),a?(this.elements.error.show(),setTimeout(function(a){return function(){a.elements.error.hide("slow")}}(this),5e3)):this.elements.error.hide()))},minplayer.prototype.addKeyEvents=function(){jQuery(document).bind("keydown",function(a){return function(b){switch(b.keyCode){case 113:case 27:a.isFullScreen()&&a.fullscreen(!1)}}}(this))},minplayer.prototype.getFiles=function(){if(this.options.files)return this.options.files;if(this.options.file)return this.options.file;var a=[],b=null;return this.elements.media&&(b=this.elements.media.attr("src"),b&&a.push({path:b}),jQuery("source",this.elements.media).each(function(){a.push({path:jQuery(this).attr("src"),mimetype:jQuery(this).attr("type"),codecs:jQuery(this).attr("codecs")})})),a},minplayer.getMediaFile=function(a){if(!a)return null;if("string"==typeof a||a.path||a.id)return new minplayer.file(a);var b=0,c=null,d=null;for(var e in a)a.hasOwnProperty(e)&&(d=new minplayer.file(a[e]),d.player&&d.priority>b&&(b=d.priority,c=d));return c},minplayer.prototype.loadPlayer=function(){if(!this.options.file||0===this.elements.display.length)return!1;if(!this.options.file.player)return!1;this.showError();var a=this.options.file.player.toString();if(!this.media||a!==this.currentPlayer){if(this.currentPlayer=a,!this.elements.display)return void this.showError("No media display found.");var b={};return this.media&&(b=this.media.queue,this.media.destroy()),pClass=minplayer.players[this.options.file.player],this.options.mediaelement=this.elements.media,this.media=new pClass(this.elements.display,this.options,b),this.media.load(this.options.file),this.display.addClass("minplayer-player-"+this.media.mediaFile.player),!0}return this.media?(this.media.options=this.options,this.display.removeClass("minplayer-player-"+this.media.mediaFile.player),this.media.load(this.options.file),this.display.addClass("minplayer-player-"+this.media.mediaFile.player),!1):void 0},minplayer.prototype.load=function(a){return this.options.files=a||this.options.files,this.options.file=minplayer.getMediaFile(this.options.files),this.loadPlayer()?(this.bindTo(this.media),this.options.file.mimetype&&!this.options.file.player?(this.showError("Cannot play media: "+this.options.file.mimetype),!1):!0):!1},minplayer.prototype.resize=function(){this.get(function(a){a.onResize&&a.onResize()})};var minplayer=minplayer||{};minplayer.image=function(a,b){this.loaded=!1,this.loader=null,this.ratio=0,this.img=null,minplayer.display.call(this,"image",a,b)},minplayer.image.prototype=new minplayer.display,minplayer.image.prototype.constructor=minplayer.image,minplayer.image.prototype.construct=function(){minplayer.display.prototype.construct.call(this),this.options.pluginName="image",this.display.css("overflow","hidden"),this.loader=new Image,this.loader.onload=function(a){return function(){a.loaded=!0,a.ratio=a.loader.width/a.loader.height,a.resize(),a.trigger("loaded")}}(this),this.ready()},minplayer.image.prototype.load=function(a){this.clear(function(){this.display.empty(),this.img=jQuery(document.createElement("img")).attr({src:""}).hide(),this.display.append(this.img),this.loader.src=a,this.img.attr("src",a)})},minplayer.image.prototype.clear=function(a){this.loaded=!1,this.img?this.img.fadeOut(150,function(b){return function(){b.img.attr("src",""),b.loader.src="",jQuery(this).remove(),a&&a.call(b)}}(this)):a&&a.call(this)},minplayer.image.prototype.resize=function(a,b){if(a=a||this.display.parent().width(),b=b||this.display.parent().height(),a&&b&&this.loaded){var c=this.getScaledRect(this.ratio,{width:a,height:b});this.img&&this.img.attr("src",this.loader.src).css({marginLeft:c.x,marginTop:c.y,width:c.width,height:c.height}),this.img.fadeIn(150)}},minplayer.image.prototype.onResize=function(){this.resize()};var minplayer=minplayer||{};minplayer.file=function(a){return a?(a="string"==typeof a?{path:a}:a,a.hasOwnProperty("isMinPlayerFile")?a:(this.isMinPlayerFile=!0,this.duration=a.duration||0,this.bytesTotal=a.bytesTotal||0,this.quality=a.quality||0,this.stream=a.stream||"",this.path=a.path||"",this.codecs=a.codecs||"",this.extension=a.extension||this.getFileExtension(),this.mimetype=a.mimetype||a.filemime||this.getMimeType(),this.type=a.type||this.getType(),this.type||(this.mimetype=this.getMimeType(),this.type=this.getType()),this.player=minplayer.player||a.player||this.getBestPlayer(),this.priority=a.priority||this.getPriority(),this.id=a.id||this.getId(),void(this.path||(this.path=this.id)))):null},minplayer.player="",minplayer.file.prototype.getBestPlayer=function(){var a=null,b=0;return jQuery.each(minplayer.players,function(c){return function(d,e){var f=e.getPriority(c);e.canPlay(c)&&f>b&&(a=d,b=f)}}(this)),a},minplayer.file.prototype.getPriority=function(){var a=1;switch(this.player&&(a=minplayer.players[this.player].getPriority(this)),this.mimetype){case"video/x-webm":case"video/webm":case"application/octet-stream":case"application/vnd.apple.mpegurl":return 10*a;case"video/mp4":case"audio/mp4":case"audio/mpeg":return 9*a;case"video/ogg":case"audio/ogg":case"video/quicktime":return 8*a;default:return 5*a}},minplayer.file.prototype.getFileExtension=function(){return this.path.substring(this.path.lastIndexOf(".")+1).toLowerCase()},minplayer.file.prototype.getMimeType=function(){switch(this.extension){case"mp4":case"m4v":case"flv":case"f4v":return"video/mp4";case"m3u8":return"application/vnd.apple.mpegurl";case"webm":return"video/webm";case"ogg":case"ogv":return"video/ogg";case"3g2":return"video/3gpp2";case"3gpp":case"3gp":return"video/3gpp";case"mov":return"video/quicktime";case"swf":return"application/x-shockwave-flash";case"oga":return"audio/ogg";case"mp3":return"audio/mpeg";case"m4a":case"f4a":return"audio/mp4";case"aac":return"audio/aac";case"wav":return"audio/vnd.wave";case"wma":return"audio/x-ms-wma";default:return"unknown"}},minplayer.file.prototype.getType=function(){var a=this.mimetype.match(/([^\/]+)(\/)/);if(a=a&&a.length>1?a[1]:"","video"===a)return"video";if("audio"===a)return"audio";switch(this.mimetype){case"application/octet-stream":case"application/x-shockwave-flash":case"application/vnd.apple.mpegurl":return"video"}return""},minplayer.file.prototype.getId=function(){var a=minplayer.players[this.player];return a&&a.getMediaId?a.getMediaId(this):""};var minplayer=minplayer||{};minplayer.playLoader=function(a,b){this.clear(),minplayer.display.call(this,"playLoader",a,b)},minplayer.playLoader.prototype=new minplayer.display,minplayer.playLoader.prototype.constructor=minplayer.playLoader,minplayer.playLoader.prototype.construct=function(){minplayer.display.prototype.construct.call(this),this.options.pluginName="playLoader",this.initializePlayLoader(),this.ready()},minplayer.playLoader.prototype.initializePlayLoader=function(){this.get("media",function(a){if(a.hasPlayLoader(this.options.preview))this.enabled=!1,this.hide(this.elements.busy),this.hide(this.elements.bigPlay),this.hide(this.elements.preview),this.hide();else{this.enabled=!0,this.options.preview||(this.options.preview=a.poster);var b=!0;this.preview&&this.preview.loader&&(b=this.preview.loader.src!==this.options.preview),b&&(a.elements.media.attr("poster",""),this.loadPreview()),this.elements.bigPlay&&minplayer.click(this.elements.bigPlay.unbind(),function(b){b.preventDefault(),jQuery(this).hide(),a.play()}),a.ubind(this.uuid+":loadstart",function(a){return function(){a.busy.setFlag("media",!0),a.bigPlay.setFlag("media",!0),a.previewFlag.setFlag("media",!0),a.checkVisibility()}}(this)),a.ubind(this.uuid+":waiting",function(a){return function(b,c,d){d||(a.busy.setFlag("media",!0),a.checkVisibility())}}(this)),a.ubind(this.uuid+":loadeddata",function(a){return function(b,c,d){d||(a.busy.setFlag("media",!1),a.checkVisibility())}}(this)),a.ubind(this.uuid+":playing",function(b){return function(c,d,e){e||(b.busy.setFlag("media",!1),b.bigPlay.setFlag("media",!1),"audio"!==a.mediaFile.type&&b.previewFlag.setFlag("media",!1),b.checkVisibility())}}(this)),a.ubind(this.uuid+":pause",function(a){return function(b,c,d){d||(a.busy.setFlag("media",!1),a.bigPlay.setFlag("media",!0),a.checkVisibility())}}(this))}})},minplayer.playLoader.prototype.clear=function(a){this.busy=new minplayer.flags,this.bigPlay=new minplayer.flags,this.previewFlag=new minplayer.flags,this.enabled=!0,this.preview?this.preview.clear(function(b){return function(){b.preview=null,a&&a()}}(this)):(this.preview=null,a&&a())},minplayer.playLoader.prototype.loadPreview=function(a){if(a=a||this.options.preview,this.options.preview=a,this.enabled&&0!==this.display.length){if(this.elements.preview){if(this.options.preview)return this.elements.preview.addClass("has-preview").show(),this.preview=new minplayer.image(this.elements.preview,this.options),this.preview.load(this.options.preview),!0;this.elements.preview.hide()}return!1}},minplayer.playLoader.prototype.checkVisibility=function(){this.enabled&&(this.busy.flag?this.elements.busy.show():this.elements.busy.hide(),this.bigPlay.flag?this.elements.bigPlay.show():this.elements.bigPlay.hide(),this.previewFlag.flag?this.elements.preview.show():this.elements.preview.hide(),(this.bigPlay.flag||this.busy.flag||this.previewFlag.flag)&&this.display.show(),this.bigPlay.flag||this.busy.flag||this.previewFlag.flag||this.display.hide())};var minplayer=minplayer||{};minplayer.players=minplayer.players||{},minplayer.players.base=function(a,b,c){minplayer.display.call(this,"media",a,b,c)},minplayer.players.base.prototype=new minplayer.display,minplayer.players.base.prototype.constructor=minplayer.players.base,minplayer.players.base.prototype.getElements=function(){var a=minplayer.display.prototype.getElements.call(this);return jQuery.extend(a,{media:this.options.mediaelement})},minplayer.players.base.prototype.defaultOptions=function(a){a.range={min:0,max:0},minplayer.display.prototype.defaultOptions.call(this,a)},minplayer.players.base.getPriority=function(){return 0},minplayer.players.base.getMediaId=function(){return""},minplayer.players.base.canPlay=function(){return!1},minplayer.players.base.prototype.construct=function(){minplayer.display.prototype.construct.call(this),this.elements.media&&(this.poster=this.elements.media.attr("poster")),this.options.pluginName="basePlayer",this.readyQueue=[],this.loadedQueue=[],this.mediaFile=this.options.file,this.clear(),this.setupPlayer()},minplayer.players.base.prototype.setupPlayer=function(){this.playerFound()||this.addPlayer(),this.player=this.getPlayer(),minplayer.click(this.display,function(a){return function(){a.playing?a.pause():a.play()}}(this)),jQuery(document).bind("keydown",function(a){return function(b){if(a.hasFocus)switch(b.preventDefault(),b.keyCode){case 32:case 179:a.playing?a.pause():a.play();break;case 38:a.setVolumeRelative(.1);break;case 40:a.setVolumeRelative(-.1);break;case 37:case 227:a.seekRelative(-.05);break;case 39:case 228:a.seekRelative(.05)}}}(this))},minplayer.players.base.prototype.addPlayer=function(){this.elements.media&&this.elements.media.remove(),this.elements.media=jQuery(this.createPlayer()),this.display.html(this.elements.media)},minplayer.players.base.prototype.destroy=function(){minplayer.plugin.prototype.destroy.call(this),this.clear()},minplayer.players.base.prototype.clear=function(){this.playerReady=!1,this.reset(),this.player&&(jQuery(this.player).remove(),this.player=null)},minplayer.players.base.prototype.reset=function(){this.realDuration=0,this.duration=new minplayer.async,this.currentTime=new minplayer.async,this.bytesLoaded=new minplayer.async,this.bytesTotal=new minplayer.async,this.bytesStart=new minplayer.async,this.volume=new minplayer.async,this.hasFocus=!1,this.playing=!1,this.loading=!1,this.loaded=!1,this.trigger("pause",null,!0),this.trigger("waiting",null,!0),this.trigger("progress",{loaded:0,total:0,start:0},!0),this.trigger("timeupdate",{currentTime:0,duration:0},!0)},minplayer.players.base.prototype.onReady=function(){if(!this.playerReady)if(this.setStartStop(),this.playerReady=!0,this.setVolume(this.options.volume/100),this.loading=!0,this.poll("progress",function(a){return function(){return a.loading&&a.getBytesLoaded(function(b){a.getBytesTotal(function(c){if(b||c){var d=0;a.getBytesStart(function(a){d=a}),a.trigger("progress",{loaded:b,total:c,start:d}),b>=c&&(a.loading=!1)}})}),a.loading}}(this),1e3),this.ready(),this.isReady()){for(var a in this.readyQueue)this.readyQueue[a].call(this);this.readyQueue.length=0,this.readyQueue=[],this.loaded||this.trigger("loadstart")}else this.readyQueue.length=0,this.readyQueue=[]},minplayer.players.base.prototype.parseTime=function(a){var b=0,c=0,d=0;return a?("string"!=typeof a&&(a=String(a)),b=a.match(/([0-9]+)s/i),b&&(b=parseInt(b[1],10)),c=a.match(/([0-9]+)m/i),c&&(b+=60*parseInt(c[1],10)),d=a.match(/([0-9]+)h/i),d&&(b+=3600*parseInt(d[1],10)),b||(b=a),Number(b)):0},minplayer.players.base.prototype.setStartStop=function(){return this.startTime?this.startTime:(this.startTime=0,this.offsetTime=this.parseTime(this.options.range.min),minplayer.urlVars&&(this.startTime=this.parseTime(minplayer.urlVars.seek)),this.startTime||(this.startTime=this.offsetTime),this.stopTime=this.options.range.max?this.parseTime(this.options.range.max):0,this.mediaRange=this.stopTime-this.offsetTime,this.mediaRange<0&&(this.mediaRange=0),this.startTime)},minplayer.players.base.prototype.onPlaying=function(){if(!this.playing){var a=this;this.getDuration(function(b){a.startTime&&a.startTime-1&&1>a?(c/d+parseFloat(a))*d:c+parseFloat(a),b.seek(e)}})}}(this))},minplayer.players.base.prototype.seek=function(a,b,c){this.whenLoaded(function(){a=Number(a),c||(a+=this.offsetTime),this._seek(a),b&&b.call(this)})},minplayer.players.base.prototype._seek=function(){},minplayer.players.base.prototype.setVolumeRelative=function(a){this.getVolume(function(b){return function(c){c+=parseFloat(a),c=0>c?0:c,c=c>1?1:c,b.setVolume(c)}}(this))},minplayer.players.base.prototype.setVolume=function(a,b){this.trigger("volumeupdate",a),this.whenLoaded(b)},minplayer.players.base.prototype.getValue=function(a,b,c){this.whenLoaded(function(){var d=this;this[a](function(a){null!==a?c.call(d,a):d[b].get(c)})})},minplayer.players.base.prototype.getVolume=function(a){this.getValue("_getVolume","volume",a)},minplayer.players.base.prototype._getVolume=function(a){a(null)},minplayer.players.base.prototype.getCurrentTime=function(a){var b=this;this.getValue("_getCurrentTime","currentTime",function(c){b.setStartStop(),b.stopTime&&c>b.stopTime&&b.stop(function(){b.onComplete()}),c-=b.offsetTime,a(c)})},minplayer.players.base.prototype._getCurrentTime=function(a){a(null)},minplayer.players.base.prototype.getDuration=function(a){if(this.options.duration)a(this.options.duration);else{var b=this;this.getValue("_getDuration","duration",function(c){b.setStartStop(),b.realDuration=c,a(b.mediaRange?b.mediaRange:c) -})}},minplayer.players.base.prototype._getDuration=function(a){a(null)},minplayer.players.base.prototype.getBytesStart=function(a){this.getValue("_getBytesStart","bytesStart",a)},minplayer.players.base.prototype._getBytesStart=function(a){a(null)},minplayer.players.base.prototype.getBytesLoaded=function(a){this.getValue("_getBytesLoaded","bytesLoaded",a)},minplayer.players.base.prototype._getBytesLoaded=function(a){a(null)},minplayer.players.base.prototype.getBytesTotal=function(a){this.getValue("_getBytesTotal","bytesTotal",a)},minplayer.players.base.prototype._getBytesTotal=function(a){a(null)};var minplayer=minplayer||{};minplayer.players=minplayer.players||{},minplayer.players.dailymotion=function(a,b,c){this.quality="default",minplayer.players.base.call(this,a,b,c)},minplayer.players.dailymotion.prototype=new minplayer.players.base,minplayer.players.dailymotion.prototype.constructor=minplayer.players.dailymotion,minplayer.players.dailymotion.prototype.construct=function(){minplayer.players.base.prototype.construct.call(this),this.options.pluginName="dailymotion"},minplayer.players.dailymotion.getPriority=function(){return 10},minplayer.players.dailymotion.canPlay=function(a){if("video/dailymotion"===a.mimetype)return!0;var b=/^http(s)?\:\/\/(www\.)?(dailymotion\.com)/i;return 0===a.path.search(b)},minplayer.players.dailymotion.getMediaId=function(a){var b="^http[s]?\\:\\/\\/(www\\.)?";b+="(dailymotion\\.com\\/video/)",b+="([a-z0-9\\-]+)",b+="_*";var c=RegExp(b,"i");return 0===a.path.search(c)?a.path.match(c)[3]:a.path},minplayer.players.dailymotion.getImage=function(a,b,c){c("http://www.dailymotion.com/thumbnail/video/"+a.id)},minplayer.players.dailymotion.parseNode=function(){return{title:node.title,description:node.description,mediafiles:{image:{thumbnail:{path:node.thumbnail_small_url},image:{path:node.thumbnail_url}},media:{media:{player:"dailymotion",id:node.id}}}}},minplayer.players.dailymotion.getNode=function(a,b){var c="https://api.dailymotion.com/video/"+a.id;c+="?fields=title,id,description,thumbnail_small_url,thumbnail_url",jQuery.get(c,function(a){b(minplayer.players.dailymotion.parseNode(a.data))},"jsonp")},minplayer.players.dailymotion.prototype.onReady=function(){minplayer.players.base.prototype.onReady.call(this),this.options.autoplay||this.pause(),this.onLoaded()},minplayer.players.dailymotion.prototype.playerFound=function(){return this.display.find(this.mediaFile.type).length>0},minplayer.players.dailymotion.prototype.onQualityChange=function(a){this.quality=a.data},minplayer.players.dailymotion.prototype.hasPlayLoader=function(a){return minplayer.hasTouch||!a},minplayer.players.dailymotion.prototype.hasController=function(){return minplayer.isIDevice},minplayer.players.dailymotion.prototype.createPlayer=function(){minplayer.players.base.prototype.createPlayer.call(this);var a=document.location.protocol;if(a+="//api.dmcdn.net/all.js",0===jQuery('script[src="'+a+'"]').length){var b=document.createElement("script");b.src=a;var c=document.getElementsByTagName("script")[0];c.parentNode.insertBefore(b,c)}return this.playerId=this.options.id+"-player",this.poll(this.options.id+"_dailymotion",function(a){return function(){var b=jQuery("#"+a.playerId).length>0;if(b=b&&"DM"in window,b=b&&"function"==typeof DM.player){jQuery("#"+a.playerId).addClass("dailymotion-player");var c={};c={id:a.playerId,api:minplayer.isIDevice?0:1,wmode:"opaque",controls:minplayer.isAndroid?1:0,related:0,info:0,logo:0},a.player=new DM.player(a.playerId,{video:a.mediaFile.id,height:"100%",width:"100%",frameborder:0,params:c}),a.player.addEventListener("apiready",function(){a.onReady(a)}),a.player.addEventListener("ended",function(){a.onComplete(a)}),a.player.addEventListener("playing",function(){a.onPlaying(a)}),a.player.addEventListener("progress",function(){a.onWaiting(a)}),a.player.addEventListener("pause",function(){a.onPaused(a)}),a.player.addEventListener("error",function(){a.onError(a)})}return!b}}(this),200),jQuery(document.createElement("div")).attr({id:this.playerId})},minplayer.players.dailymotion.prototype.load=function(a,b){minplayer.players.base.prototype.load.call(this,a,function(){this.player.load(a.id),b&&b.call(this)})},minplayer.players.dailymotion.prototype.play=function(a){minplayer.players.base.prototype.play.call(this,function(){this.onWaiting(),this.player.play(),a&&a.call(this)})},minplayer.players.dailymotion.prototype.pause=function(a){minplayer.players.base.prototype.pause.call(this,function(){this.loaded&&(this.player.pause(),a&&a.call(this))})},minplayer.players.dailymotion.prototype.stop=function(a){minplayer.players.base.prototype.stop.call(this,function(){this.player.pause(),a&&a.call(this)})},minplayer.players.dailymotion.prototype._seek=function(a){this.onWaiting(),this.player.seek(a)},minplayer.players.dailymotion.prototype.setVolume=function(a,b){minplayer.players.base.prototype.setVolume.call(this,a,function(){this.loaded&&(this.player.setVolume(a),void 0!==b&&b.call(this))})},minplayer.players.dailymotion.prototype._getVolume=function(a){a(this.player.volume)},minplayer.players.dailymotion.prototype._getDuration=function(a){a(this.player.duration)},minplayer.players.dailymotion.prototype._getCurrentTime=function(a){a(this.player.currentTime)};var minplayer=minplayer||{};minplayer.players=minplayer.players||{},minplayer.players.html5=function(a,b,c){minplayer.players.base.call(this,a,b,c)},minplayer.players.html5.prototype=new minplayer.players.base,minplayer.players.html5.prototype.constructor=minplayer.players.html5,minplayer.players.html5.getPriority=function(){return 10},minplayer.players.html5.canPlay=function(a){switch(a.mimetype){case"video/ogg":return!!minplayer.playTypes.videoOGG;case"video/mp4":case"video/x-mp4":case"video/m4v":case"video/x-m4v":return!!minplayer.playTypes.videoH264;case"application/vnd.apple.mpegurl":return!!minplayer.playTypes.videoMPEGURL;case"video/x-webm":case"video/webm":case"application/octet-stream":return!!minplayer.playTypes.videoWEBM;case"audio/ogg":return!!minplayer.playTypes.audioOGG;case"audio/mpeg":return!!minplayer.playTypes.audioMP3;case"audio/mp4":return!!minplayer.playTypes.audioMP4;default:return!1}},minplayer.players.html5.prototype.construct=function(){minplayer.players.base.prototype.construct.call(this),this.options.pluginName="html5",this.hasEnded=!1,this.addPlayerEvents()},minplayer.players.html5.prototype.addPlayerEvent=function(a,b){this.player&&this.player.addEventListener(a,function(c){var d=a+"Event";return c[d]&&c.player.removeEventListener(a,c[d],!1),c[d]=function(a){b.call(c,a)},c[d]}(this),!1)},minplayer.players.html5.prototype.addPlayerEvents=function(){if(this.player){this.addPlayerEvent("abort",function(){this.trigger("abort")}),this.addPlayerEvent("loadstart",function(){this.onReady(),this.options.autoload||this.onLoaded()}),this.addPlayerEvent("loadeddata",function(){this.onLoaded()}),this.addPlayerEvent("loadedmetadata",function(){this.onLoaded()}),this.addPlayerEvent("canplaythrough",function(){this.onLoaded()}),this.addPlayerEvent("ended",function(){this.hasEnded=!0,this.onComplete()}),this.addPlayerEvent("pause",function(){this.onPaused()}),this.addPlayerEvent("play",function(){this.onPlaying()}),this.addPlayerEvent("playing",function(){this.onPlaying()});var a=!1;return this.addPlayerEvent("error",function(){this.hasEnded||a||!this.player||(a=!0,this.trigger("error","An error occured - "+this.player.error.code))}),this.addPlayerEvent("waiting",function(){this.onWaiting()}),this.addPlayerEvent("durationchange",function(){if(this.player){this.duration.set(this.player.duration);var a=this;this.getDuration(function(b){a.trigger("durationchange",{duration:b})})}}),this.addPlayerEvent("progress",function(a){this.bytesTotal.set(a.total),this.bytesLoaded.set(a.loaded)}),!0}return!1},minplayer.players.html5.prototype.onReady=function(){minplayer.players.base.prototype.onReady.call(this),minplayer.isAndroid&&this.onLoaded(),minplayer.isIDevice&&setTimeout(function(a){return function(){a.pause(),a.onLoaded()}}(this),1)},minplayer.players.html5.prototype.playerFound=function(){return this.display.find(this.mediaFile.type).length>0},minplayer.players.html5.prototype.createPlayer=function(){minplayer.players.base.prototype.createPlayer.call(this);var a=jQuery(document.createElement(this.mediaFile.type)).attr(this.options.attributes).append(jQuery(document.createElement("source")).attr({src:this.mediaFile.path}));a.eq(0)[0].setAttribute("width","100%"),a.eq(0)[0].setAttribute("height","100%");var b=this.options.autoload?"metadata":"none";return b=minplayer.isIDevice?"metadata":b,a.eq(0)[0].setAttribute("preload",b),this.options.autoload||a.eq(0)[0].setAttribute("autobuffer",!1),a},minplayer.players.html5.prototype.getPlayer=function(){return this.elements.media.eq(0)[0]},minplayer.players.html5.prototype.load=function(a,b){minplayer.players.base.prototype.load.call(this,a,function(){this.hasEnded=!1;var c=this.elements.media.attr("src");c||(c=jQuery("source",this.elements.media).eq(0).attr("src")),c!==a.path&&(this.addPlayer(),this.player=this.getPlayer(),this.addPlayerEvents(),this.player.src=a.path,b&&b.call(this))})},minplayer.players.html5.prototype.play=function(a){minplayer.players.base.prototype.play.call(this,function(){this.player.play(),a&&a.call(this)})},minplayer.players.html5.prototype.pause=function(a){minplayer.players.base.prototype.pause.call(this,function(){this.player.pause(),a&&a.call(this)})},minplayer.players.html5.prototype.stop=function(a){minplayer.players.base.prototype.stop.call(this,function(){this.player.pause(),a&&a.call(this)})},minplayer.players.html5.prototype.clear=function(){minplayer.players.base.prototype.clear.call(this),this.player&&(this.player.src="")},minplayer.players.html5.prototype._seek=function(a){this.player.currentTime=a},minplayer.players.html5.prototype.setVolume=function(a,b){minplayer.players.base.prototype.setVolume.call(this,a,function(){this.player.volume=a,b&&b.call(this)})},minplayer.players.html5.prototype._getVolume=function(a){a(this.player.volume)},minplayer.players.html5.prototype._getDuration=function(a){a(this.player.duration)},minplayer.players.html5.prototype._getCurrentTime=function(a){a(this.player.currentTime)},minplayer.players.html5.prototype._getBytesLoaded=function(a){var b=0;this.bytesLoaded.value?b=this.bytesLoaded.value:this.player.buffered&&this.player.buffered.length>0&&this.player.buffered.end&&this.player.duration?b=this.player.buffered.end(0):void 0!==this.player.bytesTotal&&this.player.bytesTotal>0&&void 0!==this.player.bufferedBytes&&(b=this.player.bufferedBytes),a(b)},minplayer.players.html5.prototype._getBytesTotal=function(a){var b=0;this.bytesTotal.value?b=this.bytesTotal.value:this.player.buffered&&this.player.buffered.length>0&&this.player.buffered.end&&this.player.duration?b=this.player.duration:void 0!==this.player.bytesTotal&&this.player.bytesTotal>0&&void 0!==this.player.bufferedBytes&&(b=this.player.bytesTotal),a(b)};var minplayer=minplayer||{};minplayer.players=minplayer.players||{},minplayer.players.flash=function(a,b,c){minplayer.players.base.call(this,a,b,c)},minplayer.players.flash.prototype=new minplayer.players.base,minplayer.players.flash.prototype.constructor=minplayer.players.flash,minplayer.players.flash.prototype.construct=function(){minplayer.players.base.prototype.construct.call(this),this.options.pluginName="flash"},minplayer.players.flash.getPriority=function(){return 0},minplayer.players.flash.canPlay=function(){return!1},minplayer.players.flash.prototype.getFlash=function(a){var b=document.createElement("script");b.src="//ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js";var c=document.getElementsByTagName("script")[0];return c.parentNode.insertBefore(b,c),setTimeout(function(b){return function c(){"undefined"!=typeof swfobject?swfobject.embedSWF(a.swf,a.id,a.width,a.height,"9.0.0",!1,a.flashvars,{allowscriptaccess:"always",allowfullscreen:"true",wmode:a.wmode,quality:"high"},{id:a.id,name:a.id,playerType:"flash"},function(a){b.player=a.ref}):setTimeout(c,200)}}(this),200),'
'},minplayer.players.flash.prototype.playerFound=function(){return this.display.find('object[playerType="flash"]').length>0};var minplayer=minplayer||{};minplayer.players=minplayer.players||{},minplayer.players.minplayer=function(a,b,c){minplayer.players.flash.call(this,a,b,c)},minplayer.players.minplayer.prototype=new minplayer.players.flash,minplayer.players.minplayer.prototype.constructor=minplayer.players.minplayer,minplayer.players.minplayer.prototype.construct=function(){minplayer.players.flash.prototype.construct.call(this),this.options.pluginName="minplayer"},window.onFlashPlayerReady=function(a){for(var b=minplayer.get(a,"media"),c=b.length;c--;)b[c].onReady()},window.onFlashPlayerUpdate=function(a,b){for(var c=minplayer.get(a,"media"),d=c.length;d--;)c[d].onMediaUpdate(b)},window.onFlashPlayerDebug=function(a){console&&console.log&&console.log(a)},minplayer.players.minplayer.getPriority=function(a){return a.stream?100:1},minplayer.players.minplayer.canPlay=function(a){if(a.stream)return!0;var b=jQuery.inArray(a.mimetype,["video/x-webm","video/webm","application/octet-stream"])>=0;return!b&&("video"===a.type||"audio"===a.type)},minplayer.players.minplayer.prototype.createPlayer=function(){this.options.swfplayer||(this.options.swfplayer="http://mediafront.org/assets/osmplayer/minplayer",this.options.swfplayer+="/flash/minplayer.swf"),minplayer.players.flash.prototype.createPlayer.call(this);var a={id:this.options.id,debug:this.options.debug,config:"nocontrols",file:this.mediaFile.path,autostart:this.options.autoplay,autoload:this.options.autoload};return this.mediaFile.stream&&(a.stream=this.mediaFile.stream),this.getFlash({swf:this.options.swfplayer,id:this.options.id+"_player",width:"100%",height:"100%",flashvars:a,wmode:this.options.wmode})},minplayer.players.minplayer.prototype.onMediaUpdate=function(a){switch(a){case"mediaMeta":this.onLoaded();break;case"mediaConnected":this.onLoaded(),this.onPaused();break;case"mediaPlaying":this.onPlaying();break;case"mediaPaused":this.onPaused();break;case"mediaComplete":this.onComplete()}},minplayer.players.minplayer.prototype.load=function(a,b){minplayer.players.flash.prototype.load.call(this,a,function(){this.loaded?this.stop(function(){this.player.loadMedia(a.path,a.stream),b&&b.call(this)}):(this.player.loadMedia(a.path,a.stream),b&&b.call(this))})},minplayer.players.minplayer.prototype.play=function(a){minplayer.players.flash.prototype.play.call(this,function(){this.player.playMedia(),a&&a.call(this)})},minplayer.players.minplayer.prototype.pause=function(a){minplayer.players.flash.prototype.pause.call(this,function(){this.player.pauseMedia(),a&&a.call(this)})},minplayer.players.minplayer.prototype.stop=function(a){minplayer.players.flash.prototype.stop.call(this,function(){this.player.stopMedia(),a&&a.call(this)})},minplayer.players.minplayer.prototype._seek=function(a){this.player.seekMedia(a)},minplayer.players.minplayer.prototype.setVolume=function(a,b){minplayer.players.flash.prototype.setVolume.call(this,a,function(){this.player.setVolume(a),b&&b.call(this)})},minplayer.players.minplayer.prototype._getVolume=function(a){a(this.player.getVolume())},minplayer.players.minplayer.prototype._getDuration=function(a){var b=this,c=0,d=function(){c=b.player.getDuration(),c?a(c):setTimeout(d,1e3)};d()},minplayer.players.minplayer.prototype._getCurrentTime=function(a){a(this.player.getCurrentTime())},minplayer.players.minplayer.prototype._getBytesLoaded=function(a){a(this.player.getMediaBytesLoaded())},minplayer.players.minplayer.prototype._getBytesTotal=function(a){a(this.player.getMediaBytesTotal())};var minplayer=minplayer||{};minplayer.players=minplayer.players||{},minplayer.players.youtube=function(a,b,c){this.quality="default",minplayer.players.base.call(this,a,b,c)},minplayer.players.youtube.prototype=new minplayer.players.base,minplayer.players.youtube.prototype.constructor=minplayer.players.youtube,minplayer.players.youtube.prototype.construct=function(){minplayer.players.base.prototype.construct.call(this),this.options.pluginName="youtube"},minplayer.players.youtube.getPriority=function(){return 10},minplayer.players.youtube.canPlay=function(a){if("video/youtube"===a.mimetype)return!0;var b=/^http(s)?\:\/\/(www\.)?(youtube\.com|youtu\.be)/i;return 0===a.path.search(b)},minplayer.players.youtube.getMediaId=function(a){var b="^http[s]?\\:\\/\\/(www\\.)?";b+="(youtube\\.com\\/watch\\?v=|youtu\\.be\\/)",b+="([a-zA-Z0-9_\\-]+)";var c=RegExp(b,"i");return 0===a.path.search(c)?a.path.match(c)[3]:a.path},minplayer.players.youtube.getImage=function(a,b,c){b="thumbnail"===b?"1":"0",c("https://img.youtube.com/vi/"+a.id+"/"+b+".jpg")},minplayer.players.youtube.parseNode=function(a){var b="undefined"!=typeof a.video?a.video:a;return{title:b.title,description:b.description,mediafiles:{image:{thumbnail:{path:b.thumbnail.sqDefault},image:{path:b.thumbnail.hqDefault}},media:{media:{player:"youtube",id:b.id}}}}},minplayer.players.youtube.getNode=function(a,b){var c="https://gdata.youtube.com/feeds/api/videos/"+a.id;c+="?v=2&alt=jsonc",jQuery.get(c,function(a){b(minplayer.players.youtube.parseNode(a.data))})},minplayer.players.youtube.prototype.setPlayerState=function(a){switch(a){case YT.PlayerState.CUED:break;case YT.PlayerState.BUFFERING:this.onWaiting();break;case YT.PlayerState.UNSTARTED:case YT.PlayerState.PAUSED:this.onPaused();break;case YT.PlayerState.PLAYING:this.onPlaying();break;case YT.PlayerState.ENDED:this.onComplete()}},minplayer.players.youtube.prototype.onReady=function(){minplayer.players.base.prototype.onReady.call(this),this.options.autoplay||this.pause(),this.onLoaded()},minplayer.players.youtube.prototype.playerFound=function(){var a="iframe#"+this.options.id+"-player.youtube-player",b=this.display.find(a);return b.length>0},minplayer.players.youtube.prototype.onPlayerStateChange=function(a){this.setPlayerState(a.data)},minplayer.players.youtube.prototype.onQualityChange=function(a){this.quality=a.data},minplayer.players.youtube.prototype.hasPlayLoader=function(a){return minplayer.hasTouch||!a},minplayer.players.youtube.prototype.hasController=function(){return minplayer.isIDevice},minplayer.players.youtube.prototype.createPlayer=function(){minplayer.players.base.prototype.createPlayer.call(this);var a="https://www.youtube.com/iframe_api";if(0===jQuery('script[src="'+a+'"]').length){var b=document.createElement("script");b.src=a;var c=document.getElementsByTagName("script")[0];c.parentNode.insertBefore(b,c)}return this.playerId=this.options.id+"-player",this.poll(this.options.id+"_youtube",function(a){return function(){var b=jQuery("#"+a.playerId).length>0;if(b=b&&"YT"in window,b=b&&"function"==typeof YT.Player){jQuery("#"+a.playerId).addClass("youtube-player");var c=location.protocol;c+="//"+location.hostname,c+=location.port&&":"+location.port;var d={};minplayer.isIDevice?d.origin=c:d={enablejsapi:minplayer.isIDevice?0:1,origin:c,wmode:"opaque",controls:minplayer.isAndroid?1:0,rel:0,showinfo:0},a.player=new YT.Player(a.playerId,{height:"100%",width:"100%",frameborder:0,videoId:a.mediaFile.id,playerVars:d,events:{onReady:function(b){a.onReady(b)},onStateChange:function(b){a.onPlayerStateChange(b)},onPlaybackQualityChange:function(b){a.onQualityChange(b)},onError:function(b){a.onError(b)}}})}return!b}}(this),200),jQuery(document.createElement("div")).attr({id:this.playerId})},minplayer.players.youtube.prototype.load=function(a,b){minplayer.players.base.prototype.load.call(this,a,function(){this.player.loadVideoById(a.id,0,this.quality),b&&b.call(this)})},minplayer.players.youtube.prototype.play=function(a){minplayer.players.base.prototype.play.call(this,function(){this.onWaiting(),this.player.playVideo(),a&&a.call(this)})},minplayer.players.youtube.prototype.pause=function(a){minplayer.players.base.prototype.pause.call(this,function(){this.player.pauseVideo(),a&&a.call(this)})},minplayer.players.youtube.prototype.stop=function(a){minplayer.players.base.prototype.stop.call(this,function(){this.player.stopVideo(),a&&a.call(this)})},minplayer.players.youtube.prototype._seek=function(a){this.onWaiting(),this.player.seekTo(a,!0)},minplayer.players.youtube.prototype.setVolume=function(a,b){minplayer.players.base.prototype.setVolume.call(this,a,function(){this.player.setVolume(100*a),b&&b.call(this)})},minplayer.players.youtube.prototype._getVolume=function(a){a(this.player.getVolume())},minplayer.players.youtube.prototype._getDuration=function(a){a(this.player.getDuration())},minplayer.players.youtube.prototype._getCurrentTime=function(a){a(this.player.getCurrentTime())},minplayer.players.youtube.prototype._getBytesStart=function(a){a(this.player.getVideoStartBytes())},minplayer.players.youtube.prototype._getBytesLoaded=function(a){a(this.player.getVideoBytesLoaded())},minplayer.players.youtube.prototype._getBytesTotal=function(a){a(this.player.getVideoBytesTotal())};var minplayer=minplayer||{};minplayer.players=minplayer.players||{},minplayer.players.vimeo=function(a,b,c){minplayer.players.base.call(this,a,b,c)},minplayer.players.vimeo.prototype=new minplayer.players.base,minplayer.players.vimeo.prototype.constructor=minplayer.players.vimeo,minplayer.players.vimeo.prototype.construct=function(){minplayer.players.base.prototype.construct.call(this),this.options.pluginName="vimeo"},minplayer.players.vimeo.getPriority=function(){return 10},minplayer.players.vimeo.canPlay=function(a){return"video/vimeo"===a.mimetype?!0:0===a.path.search(/^http(s)?\:\/\/(www\.)?vimeo\.com/i)},minplayer.players.vimeo.prototype.hasPlayLoader=function(){return minplayer.hasTouch},minplayer.players.vimeo.prototype.hasController=function(){return minplayer.hasTouch},minplayer.players.vimeo.getMediaId=function(a){var b=/^http[s]?\:\/\/(www\.)?vimeo\.com\/(\?v\=)?([0-9]+)/i;return 0===a.path.search(b)?a.path.match(b)[3]:a.path},minplayer.players.vimeo.parseNode=function(a){return{title:a.title,description:a.description,mediafiles:{image:{thumbnail:{path:a.thumbnail_small},image:{path:a.thumbnail_large}},media:{media:{player:"vimeo",id:a.id}}}}},minplayer.players.vimeo.nodes={},minplayer.players.vimeo.getNode=function(a,b){minplayer.players.vimeo.nodes.hasOwnProperty(a.id)?b(minplayer.players.vimeo.nodes[a.id]):jQuery.ajax({url:"https://vimeo.com/api/v2/video/"+a.id+".json",dataType:"jsonp",success:function(c){var d=minplayer.players.vimeo.parseNode(c[0]);minplayer.players.vimeo.nodes[a.id]=d,b(d)}})},minplayer.players.vimeo.getImage=function(a,b,c){minplayer.players.vimeo.getNode(a,function(a){c(a.mediafiles.image.image)})},minplayer.players.vimeo.prototype.reset=function(){minplayer.players.base.prototype.reset.call(this)},minplayer.players.vimeo.prototype.createPlayer=function(){minplayer.players.base.prototype.createPlayer.call(this);var a="http://a.vimeocdn.com/js/froogaloop2.min.js";if(0===jQuery('script[src="'+a+'"]').length){var b=document.createElement("script");b.src=a;var c=document.getElementsByTagName("script")[0];c.parentNode.insertBefore(b,c)}var d=document.createElement("iframe");d.setAttribute("id",this.options.id+"-player"),d.setAttribute("type","text/html"),d.setAttribute("width","100%"),d.setAttribute("height","100%"),d.setAttribute("frameborder","0"),jQuery(d).addClass("vimeo-player");var e="https://player.vimeo.com/video/";return e+=this.mediaFile.id+"?",e+=jQuery.param({wmode:"opaque",api:1,player_id:this.options.id+"-player",title:0,byline:0,portrait:0,loop:this.options.loop}),d.setAttribute("src",e),this.poll(this.options.id+"_vimeo",function(a){return function(){if(window.Froogaloop){a.player=window.Froogaloop(d);var b=0;a.player.addEvent("ready",function(){clearTimeout(b),a.onReady(),a.onError("")}),b=setTimeout(function(){a.onReady()},3e3)}return!window.Froogaloop}}(this),200),this.trigger("loadstart"),d},minplayer.players.vimeo.prototype.onReady=function(){this.player.addEvent("loadProgress",function(a){return function(b){a.duration.set(parseFloat(b.duration)),a.bytesLoaded.set(b.bytesLoaded),a.bytesTotal.set(b.bytesTotal)}}(this)),this.player.addEvent("playProgress",function(a){return function(b){a.duration.set(parseFloat(b.duration)),a.currentTime.set(parseFloat(b.seconds))}}(this)),this.player.addEvent("play",function(a){return function(){a.onPlaying()}}(this)),this.player.addEvent("pause",function(a){return function(){a.onPaused()}}(this)),this.player.addEvent("finish",function(a){return function(){a.onComplete()}}(this)),minplayer.players.base.prototype.onReady.call(this),this.onLoaded(),this.options.autoplay&&this.play()},minplayer.players.vimeo.prototype.clear=function(){this.player&&this.player.api("unload"),minplayer.players.base.prototype.clear.call(this)},minplayer.players.vimeo.prototype.load=function(a,b){minplayer.players.base.prototype.load.call(this,a,function(){this.construct(),b&&b.call(this)})},minplayer.players.vimeo.prototype.play=function(a){minplayer.players.base.prototype.play.call(this,function(){this.player.api("play"),a&&a.call(this)})},minplayer.players.vimeo.prototype.pause=function(a){minplayer.players.base.prototype.pause.call(this,function(){this.player.api("pause"),a&&a.call(this)})},minplayer.players.vimeo.prototype.stop=function(a){minplayer.players.base.prototype.stop.call(this,function(){this.player.api("unload"),a&&a.call(this)})},minplayer.players.vimeo.prototype._seek=function(a){this.player.api("seekTo",a)},minplayer.players.vimeo.prototype.setVolume=function(a,b){minplayer.players.base.prototype.setVolume.call(this,a,function(){this.volume.set(a),this.player.api("setVolume",a),b&&b.call(this)})},minplayer.players.vimeo.prototype._getVolume=function(a){this.player.api("getVolume",function(b){a(b)})},minplayer.players.vimeo.prototype._getDuration=function(a){this.player.api("getDuration",function(b){a(b)})};var minplayer=minplayer||{};minplayer.players=minplayer.players||{},minplayer.players.limelight=function(a,b){minplayer.players.flash.call(this,a,b)},minplayer.players.limelight.prototype=new minplayer.players.flash,minplayer.players.limelight.prototype.constructor=minplayer.players.limelight,minplayer.players.limelight.prototype.construct=function(){minplayer.players.flash.prototype.construct.call(this),this.options.pluginName="limelight"},minplayer.players.limelight.getPriority=function(){return 10},minplayer.players.limelight.canPlay=function(a){if("video/limelight"===a.mimetype)return!0;var b=/.*limelight\.com.*/i;return 0===a.path.search(b)},minplayer.players.limelight.getMediaId=function(a){var b=/.*limelight\.com.*mediaId=([a-zA-Z0-9]+)/i;return 0===a.path.search(b)?a.path.match(b)[1]:a.path},minplayer.players.limelight.prototype.register=function(){window.delvePlayerCallback=function(a,b,c){var d=a.replace("-player","");jQuery.each(minplayer.get(d,"media"),function(a,d){d.onMediaUpdate(b,c)})}},minplayer.players.limelight.prototype.onMediaUpdate=function(a,b){switch(a){case"onPlayerLoad":this.onReady();break;case"onMediaLoad":if(this.complete)return this.pause(),void this.onPaused();this.shouldSeek=this.startTime>0,this.onLoaded();break;case"onMediaComplete":this.complete=!0,this.onComplete();break;case"onPlayheadUpdate":!b.positionInMilliseconds||this.playing||this.complete||this.onPlaying(),this.complete=!1,this.shouldSeek&&this.seekValue?(this.shouldSeek=!1,this.seek(this.seekValue)):(this.duration.set(b.durationInMilliseconds/1e3),this.currentTime.set(b.positionInMilliseconds/1e3));break;case"onError":this.onError();break;case"onPlayStateChanged":b.isPlaying?this.onPlaying():b.isBusy?this.onWaiting():this.onPaused()}},minplayer.players.limelight.prototype.createPlayer=function(){minplayer.players.flash.prototype.createPlayer.call(this);var a=document.createElement("script");a.src="https://assets.delvenetworks.com/player/embed.js";var b=document.getElementsByTagName("script")[0];b.parentNode.insertBefore(a,b),this.register();var c={deepLink:"true",autoplay:this.options.autoplay?"true":"false",startQuality:"HD"},d=null,e=this.options.channel;e||(d=/.*limelight\.com.*channelId=([a-zA-Z0-9]+)/i,0===this.mediaFile.path.search(d)&&(e=this.mediaFile.path.match(d)[1])),e&&"media"===this.mediaFile.queueType&&(c.adConfigurationChannelId=e);var f=this.options.playerForm;f||(d=/.*limelight\.com.*playerForm=([a-zA-Z0-9]+)/i,0===this.mediaFile.path.search(d)&&(f=this.mediaFile.path.match(d)[1])),f&&(c.playerForm=f),c.mediaId=this.mediaFile.id;var g=this.options.id+"-player";return setTimeout(function h(){window.hasOwnProperty("LimelightPlayerUtil")?window.LimelightPlayerUtil.initEmbed(g):setTimeout(h,1e3)},1e3),this.getFlash({swf:document.location.protocol+"//assets.delvenetworks.com/player/loader.swf",id:g,width:this.options.width,height:"100%",flashvars:c,wmode:this.options.wmode})},minplayer.players.limelight.prototype.play=function(a){minplayer.players.flash.prototype.play.call(this,function(){this.player.doPlay(),a&&a.call(this)})},minplayer.players.limelight.prototype.pause=function(a){minplayer.players.flash.prototype.pause.call(this,function(){this.player.doPause(),a&&a.call(this)})},minplayer.players.limelight.prototype.stop=function(a){minplayer.players.flash.prototype.stop.call(this,function(){this.player.doPause(),a&&a.call(this)})},minplayer.players.limelight.prototype._seek=function(a){this.seekValue=a,this.player.doSeekToSecond(a)},minplayer.players.limelight.prototype.setVolume=function(a,b){minplayer.players.flash.prototype.setVolume.call(this,a,function(){this.player.doSetVolume(a),b&&b.call(this)})},minplayer.players.limelight.prototype._getVolume=function(a){a(this.player.doGetVolume())},minplayer.players.limelight.prototype.search=function(a){this.whenReady(function(){this.player.doSearch(a)})};var minplayer=minplayer||{};minplayer.players=minplayer.players||{},minplayer.players.kaltura=function(a,b){minplayer.players.base.call(this,a,b)},minplayer.players.kaltura.prototype=new minplayer.players.base,minplayer.players.kaltura.prototype.constructor=minplayer.players.kaltura,minplayer.players.kaltura.prototype.construct=function(){minplayer.players.base.prototype.construct.call(this),this.options.pluginName="kaltura",this.adPlaying=!1},minplayer.players.kaltura.prototype.defaultOptions=function(a){a.entryId=0,a.uiConfId=0,a.partnerId=0,minplayer.players.base.prototype.defaultOptions.call(this,a)},minplayer.players.kaltura.getPriority=function(){return 10},minplayer.players.kaltura.canPlay=function(a){if("video/kaltura"===a.mimetype)return!0;var b=/.*kaltura\.com.*/i;return 0===a.path.search(b)},minplayer.players.kaltura.prototype.adStart=function(){this.adPlaying=!0,this.onPlaying()},minplayer.players.kaltura.prototype.adEnd=function(){this.adPlaying=!1},minplayer.players.kaltura.prototype.playerStateChange=function(a){if(!this.adPlaying)switch(a){case"ready":this.onLoaded();break;case"loading":case"buffering":this.onWaiting();break;case"playing":this.onPlaying();break;case"paused":this.onPaused()}},minplayer.players.kaltura.prototype.mediaReady=function(){this.onLoaded()},minplayer.players.kaltura.prototype.playerPlayEnd=function(){this.onComplete()},minplayer.players.kaltura.prototype.playUpdate=function(a){this.currentTime.set(a)},minplayer.players.kaltura.prototype.durationChange=function(a){this.duration.set(a.newValue)},minplayer.players.kaltura.prototype.getInstance=function(){if(this.instanceName)return this.instanceName;var a=this.uuid.split("__"),b="minplayer.plugins."+a[0];return b+="."+a[1],b+="["+(a[2]-1)+"]",this.instanceName=b,b},minplayer.players.kaltura.prototype.registerEvents=function(){this.player.addJsListener("adStart",this.getInstance()+".adStart"),this.player.addJsListener("adEnd",this.getInstance()+".adEnd"),this.player.addJsListener("playerStateChange",this.getInstance()+".playerStateChange"),this.player.addJsListener("durationChange",this.getInstance()+".durationChange"),this.player.addJsListener("mediaReady",this.getInstance()+".mediaReady"),this.player.addJsListener("playerUpdatePlayhead",this.getInstance()+".playUpdate"),this.player.addJsListener("playerPlayEnd",this.getInstance()+".playerPlayEnd") -},minplayer.players.kaltura.prototype.createPlayer=function(){minplayer.players.base.prototype.createPlayer.call(this);var a={},b=this;jQuery.each(["entryId","uiConfId","partnerId"],function(c,d){if(a[d]="",b.options[d])a[d]=b.options[d];else{var e=null;switch(d){case"entryId":e=/.*kaltura\.com.*entry_id\/([^\/]+)/i;break;case"uiConfId":e=/.*kaltura\.com.*uiconf_id\/([^\/]+)/i;break;case"partnerId":e=/.*kaltura\.com.*wid\/_([^\/]+)/i}e&&(a[d]=b.mediaFile.path.match(e),a[d]&&(a[d]=a[d][1]))}});var c=document.createElement("script");c.src="http://cdnapi.kaltura.com/p/",c.src+=a.partnerId,c.src+="/sp/",c.src+=a.partnerId,c.src+="00/embedIframeJs/uiconf_id/",c.src+=a.uiConfId,c.src+="/partner_id/",c.src+=a.partnerId;var d=document.getElementsByTagName("script")[0];d.parentNode.insertBefore(c,d);var e=this.options.id+"-player";return setTimeout(function f(){window.hasOwnProperty("kWidget")?kWidget.embed({targetId:e,wid:"_"+a.partnerId,uiconf_id:a.uiConfId,entry_id:a.entryId,flashvars:{autoPlay:!1},params:{wmode:"transparent"},readyCallback:function(a){b.player=jQuery("#"+a).get(0),b.registerEvents(),b.onReady()}}):setTimeout(f,1e3)},1e3),'
'},minplayer.players.kaltura.prototype.play=function(a){minplayer.players.base.prototype.play.call(this,function(){this.player.sendNotification("doPlay"),a&&a.call(this)})},minplayer.players.kaltura.prototype.pause=function(a){minplayer.players.base.prototype.pause.call(this,function(){this.player.sendNotification("doPause"),a&&a.call(this)})},minplayer.players.kaltura.prototype.stop=function(a){minplayer.players.base.prototype.stop.call(this,function(){this.player.sendNotification("doStop"),a&&a.call(this)})},minplayer.players.kaltura.prototype._seek=function(a){this.seekValue=a,this.player.sendNotification("doSeek",a)},minplayer.players.kaltura.prototype.setVolume=function(a,b){minplayer.players.base.prototype.setVolume.call(this,a,function(){this.player.sendNotification("changeVolume",a),b&&b.call(this)})};var minplayer=minplayer||{};minplayer.controller=function(a,b){minplayer.display.call(this,"controller",a,b)},minplayer.controller.prototype=new minplayer.display,minplayer.controller.prototype.constructor=minplayer.controller,minplayer.formatTime=function(a){a=a||0;var b=0,c=0,d=0,e="";return d=Math.floor(a/3600),a-=3600*d,c=Math.floor(a/60),a-=60*c,b=Math.floor(a%60),d&&(e+=String(d),e+=":"),e+=c>=10?String(c):"0"+String(c),e+=":",e+=b>=10?String(b):"0"+String(b),{time:e,units:""}},minplayer.controller.prototype.getElements=function(){var a=minplayer.display.prototype.getElements.call(this);return jQuery.extend(a,{play:null,pause:null,fullscreen:null,seek:null,progress:null,volume:null,timer:null})},minplayer.controller.prototype.defaultOptions=function(a){a.disptime=0,minplayer.display.prototype.defaultOptions.call(this,a)},minplayer.controller.prototype.construct=function(){minplayer.display.prototype.construct.call(this),this.options.pluginName="controller",this.dragging=!1,this.vol=0,this.elements.seek&&(this.seekBar=this.elements.seek.slider({range:"min",create:function(a){jQuery(".ui-slider-range",a.target).addClass("ui-state-active")}})),this.elements.volume&&(this.volumeBar=this.elements.volume.slider({animate:!0,range:"min",orientation:"vertical"})),this.get("player",function(a){this.elements.fullscreen&&minplayer.click(this.elements.fullscreen.unbind(),function(){a.toggleFullScreen()}).css({pointer:"hand"})}),this.get("media",function(a){a.hasController()?this.hide():(this.elements.pause&&(minplayer.click(this.elements.pause.unbind(),function(b){return function(c){c.preventDefault(),b.playPause(!1,a)}}(this)),a.ubind(this.uuid+":pause",function(a){return function(){a.setPlayPause(!0)}}(this))),this.elements.play&&(minplayer.click(this.elements.play.unbind(),function(b){return function(c){c.preventDefault(),b.playPause(!0,a)}}(this)),a.ubind(this.uuid+":playing",function(a){return function(){a.setPlayPause(!1)}}(this))),this.elements.duration&&(a.ubind(this.uuid+":durationchange",function(a){return function(b,c){var d=a.options.disptime||c.duration;a.setTimeString("duration",d)}}(this)),a.getDuration(function(a){return function(b){b=a.options.disptime||b,a.setTimeString("duration",b)}}(this))),this.elements.progress&&a.ubind(this.uuid+":progress",function(a){return function(b,c){var d=c.total?c.loaded/c.total*100:0;a.elements.progress.width(d+"%")}}(this)),(this.seekBar||this.elements.timer)&&a.ubind(this.uuid+":timeupdate",function(a){return function(b,c){if(!a.dragging){var d=0;c.duration&&(d=c.currentTime/c.duration*100),a.seekBar&&a.seekBar.slider("option","value",d),a.setTimeString("timer",c.currentTime)}}}(this)),this.seekBar&&this.seekBar.slider({start:function(a){return function(){a.dragging=!0}}(this),stop:function(b){return function(c,d){b.dragging=!1,a.getDuration(function(b){a.seek(d.value/100*b)})}}(this),slide:function(b){return function(c,d){a.getDuration(function(c){var e=d.value/100*c;b.dragging||a.seek(e),b.setTimeString("timer",e)})}}(this)}),this.elements.mute&&minplayer.click(this.elements.mute,function(b){return function(c){c.preventDefault();var d=b.volumeBar.slider("option","value");d>0?(b.vol=d,b.volumeBar.slider("option","value",0),a.setVolume(0)):(b.volumeBar.slider("option","value",b.vol),a.setVolume(b.vol/100))}}(this)),this.volumeBar&&(this.volumeBar.slider({slide:function(b,c){a.setVolume(c.value/100)}}),a.ubind(this.uuid+":volumeupdate",function(a){return function(b,c){a.volumeBar.slider("option","value",100*c)}}(this)),a.getVolume(function(a){return function(b){a.volumeBar.slider("option","value",100*b)}}(this))))}),this.ready()},minplayer.controller.prototype.setPlayPause=function(a){var b="";this.elements.play&&(b=a?"inherit":"none",this.elements.play.css("display",b)),this.elements.pause&&(b=a?"none":"inherit",this.elements.pause.css("display",b))},minplayer.controller.prototype.playPause=function(a,b){var c=a?"play":"pause";this.display.trigger(c),this.setPlayPause(!a),b&&b[c]()},minplayer.controller.prototype.setTimeString=function(a,b){this.elements[a]&&this.elements[a].text(minplayer.formatTime(b).time)};var osmplayer = osmplayer || {}; +var minplayer = minplayer || {}; +(function(exports) {/*! +* screenfull +* v1.2.0 - 2014-04-29 +* (c) Sindre Sorhus; MIT License +*/ +!function(){"use strict";var a="undefined"!=typeof module&&module.exports,b="undefined"!=typeof Element&&"ALLOW_KEYBOARD_INPUT"in Element,c=function(){for(var a,b,c=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],d=0,e=c.length,f={};e>d;d++)if(a=c[d],a&&a[1]in document){for(d=0,b=a.length;b>d;d++)f[c[0][d]]=a[d];return f}return!1}(),d={request:function(a){var d=c.requestFullscreen;a=a||document.documentElement,/5\.1[\.\d]* Safari/.test(navigator.userAgent)?a[d]():a[d](b&&Element.ALLOW_KEYBOARD_INPUT)},exit:function(){document[c.exitFullscreen]()},toggle:function(a){this.isFullscreen?this.exit():this.request(a)},onchange:function(){},onerror:function(){},raw:c};return c?(Object.defineProperties(d,{isFullscreen:{get:function(){return!!document[c.fullscreenElement]}},element:{enumerable:!0,get:function(){return document[c.fullscreenElement]}},enabled:{enumerable:!0,get:function(){return!!document[c.fullscreenEnabled]}}}),document.addEventListener(c.fullscreenchange,function(a){d.onchange.call(d,a)}),document.addEventListener(c.fullscreenerror,function(a){d.onerror.call(d,a)}),void(a?module.exports=d:window.screenfull=d)):void(a?module.exports=!1:window.screenfull=!1)}(); +exports.screenfull = screenfull; +})(minplayer);/** The minplayer namespace. */ +var minplayer = minplayer || {}; + +// Private function to check a single element's play type. +function checkPlayType(elem, playType) { + if ((typeof elem.canPlayType) === 'function') { + if (typeof playType === 'object') { + var i = playType.length; + var mimetype = ''; + while (i--) { + mimetype = checkPlayType(elem, playType[i]); + if (!!mimetype) { + break; + } + } + return mimetype; + } + else { + var canPlay = elem.canPlayType(playType); + if (('no' !== canPlay) && ('' !== canPlay)) { + return playType; + } + } + } + return ''; +} + +/** + * @constructor + * @class This class is used to define the types of media that can be played + * within the browser. + *

+ * Usage: + *


+ *   var playTypes = new minplayer.compatibility();
+ *
+ *   if (playTypes.videoOGG) {
+ *     console.log("This browser can play OGG video");
+ *   }
+ *
+ *   if (playTypes.videoH264) {
+ *     console.log("This browser can play H264 video");
+ *   }
+ *
+ *   if (playTypes.videoWEBM) {
+ *     console.log("This browser can play WebM video");
+ *   }
+ *
+ *   if (playTypes.audioOGG) {
+ *     console.log("This browser can play OGG audio");
+ *   }
+ *
+ *   if (playTypes.audioMP3) {
+ *     console.log("This browser can play MP3 audio");
+ *   }
+ *
+ *   if (playTypes.audioMP4) {
+ *     console.log("This browser can play MP4 audio");
+ *   }
+ * 
+ */ +minplayer.compatibility = function() { + var elem = null; + + // Create a video element. + elem = document.createElement('video'); + + /** Can play OGG video */ + this.videoOGG = checkPlayType(elem, 'video/ogg'); + + /** Can play H264 video */ + this.videoH264 = checkPlayType(elem, [ + 'video/mp4', + 'video/h264' + ]); + + /** Can play WEBM video */ + this.videoWEBM = checkPlayType(elem, [ + 'video/x-webm', + 'video/webm', + 'application/octet-stream' + ]); + + /** Can play MPEG URL streams. */ + this.videoMPEGURL = checkPlayType(elem, 'application/vnd.apple.mpegurl'); + + // Create an audio element. + elem = document.createElement('audio'); + + /** Can play audio OGG */ + this.audioOGG = checkPlayType(elem, 'audio/ogg'); + + /** Can play audio MP3 */ + this.audioMP3 = checkPlayType(elem, 'audio/mpeg'); + + /** Can play audio MP4 */ + this.audioMP4 = checkPlayType(elem, 'audio/mp4'); +}; + +if (!minplayer.playTypes) { + + /** The compatible playtypes for this browser. */ + minplayer.playTypes = new minplayer.compatibility(); + + /** See if we are an android device. */ + minplayer.isAndroid = (/android/gi).test(navigator.appVersion); + + /** See if we are an iOS device. */ + minplayer.isIDevice = (/iphone|ipad/gi).test(navigator.appVersion); + + /** See if we are a playbook device. */ + minplayer.isPlaybook = (/playbook/gi).test(navigator.appVersion); + + /** See if we are a touchpad device. */ + minplayer.isTouchPad = (/hp-tablet/gi).test(navigator.appVersion); + + /** Determine if we have a touchscreen. */ + minplayer.hasTouch = 'ontouchstart' in window && !minplayer.isTouchPad; +} + +// Get the URL variables. +if (!minplayer.urlVars) { + + /** The URL variables for the minplayer. */ + minplayer.urlVars = {}; + + // Get the URL variables. + var regEx = /[?&]+([^=&]+)=([^&]*)/gi; + window.location.href.replace(regEx, function(m, key, value) { + minplayer.urlVars[key] = value; + }); +} +/** The minplayer namespace. */ +var minplayer = minplayer || {}; + +/** + * @constructor + * @class This class keeps track of asynchronous get requests for certain + * variables within the player. + */ +minplayer.async = function() { + + /** The final value of this asynchronous variable. */ + this.value = null; + + /** The queue of callbacks to call when this value is determined. */ + this.queue = []; +}; + +/** + * Retrieve the value of this variable. + * + * @param {function} callback The function to call when the value is determined. + * 1 second if the value is not set. + */ +minplayer.async.prototype.get = function(callback) { + + // If the value is set, then immediately call the callback, otherwise, just + // add it to the queue when the variable is set. + if (this.value !== null) { + callback(this.value); + } + else { + + // Add this callback to the queue. + this.queue.push(callback); + } +}; + +/** + * Sets the value of an asynchronous value. + * + * @param {void} val The value to set. + */ +minplayer.async.prototype.set = function(val) { + + // Set the value. + this.value = val; + + // Get the callback queue length. + var i = this.queue.length; + + // Iterate through all the callbacks and call them. + if (i) { + while (i--) { + this.queue[i](val); + } + + // Reset the queue. + this.queue = []; + } +}; +/** The minplayer namespace. */ +var minplayer = minplayer || {}; + +/** + * @constructor + * @class This is a class used to keep track of flag states + * which is used to control the busy cursor, big play button, among other + * items in which multiple components can have an interest in hiding or + * showing a single element on the screen. + * + *

+ * Usage: + *


+ *   // Declare a flags variable.
+ *   var flags = new minplayer.flags();
+ *
+ *   // Set the flag based on two components interested in the flag.
+ *   flags.setFlag("component1", true);
+ *   flags.setFlag("component2", true);
+ *
+ *   // Print out the value of the flags. ( Prints 3 )
+ *   console.log(flags.flags);
+ *
+ *   // Now unset a single components flag.
+ *   flags.setFlag("component1", false);
+ *
+ *   // Print out the value of the flags.
+ *   console.log(flags.flags);
+ *
+ *   // Unset the other components flag.
+ *   flags.setFlag("component2", false);
+ *
+ *   // Print out the value of the flags.
+ *   console.log(flags.flags);
+ * 
+ *

+ */ +minplayer.flags = function() { + + /** The flag. */ + this.flag = 0; + + /** Id map to reference id with the flag index. */ + this.ids = {}; + + /** The number of flags. */ + this.numFlags = 0; +}; + +/** + * Sets a flag based on boolean logic operators. + * + * @param {string} id The id of the controller interested in this flag. + * @param {boolean} value The value of this flag ( true or false ). + */ +minplayer.flags.prototype.setFlag = function(id, value) { + + // Define this id if it isn't present. + if (!this.ids.hasOwnProperty(id)) { + this.ids[id] = this.numFlags; + this.numFlags++; + } + + // Use binary operations to keep track of the flag state + if (value) { + this.flag |= (1 << this.ids[id]); + } + else { + this.flag &= ~(1 << this.ids[id]); + } +}; +/** The minplayer namespace. */ +minplayer = minplayer || {}; + +/** Static array to keep track of all plugins. */ +minplayer.plugins = minplayer.plugins || {}; + +/** Static array to keep track of queues. */ +minplayer.queue = minplayer.queue || []; + +/** Mutex lock to keep multiple triggers from occuring. */ +minplayer.lock = false; + +/** + * @constructor + * @class The base class for all plugins. + * + * @param {string} name The name of this plugin. + * @param {object} context The jQuery context. + * @param {object} options This components options. + * @param {object} queue The event queue to pass events around. + */ +minplayer.plugin = function(name, context, options, queue) { + + // Make sure we have some options. + this.options = options || {}; + + /** The name of this plugin. */ + this.name = name; + + /** The ready flag. */ + this.pluginReady = false; + + /** The event queue. */ + this.queue = queue || {}; + + /** Keep track of already triggered events. */ + this.triggered = {}; + + /** Create a queue lock. */ + this.lock = false; + + /** The universally unique ID for this plugin. */ + this.uuid = 0; + + // Only call the constructor if we have a context. + if (context) { + + /** Keep track of the context. */ + this.context = jQuery(context); + + // Initialize the default options. + var defaults = {}; + + // Get the default options. + this.defaultOptions(defaults); + + /** The options for this plugin. */ + for (var param in defaults) { + if (!this.options.hasOwnProperty(param)) { + this.options[param] = defaults[param]; + } + } + + // Initialize this plugin. + this.initialize(); + } +}; + +/** + * Initialize function for the plugin. + */ +minplayer.plugin.prototype.initialize = function() { + + // Construct this plugin. + this.construct(); +}; + +/** + * Get the default options for this plugin. + * + * @param {object} options The default options for this plugin. + */ +minplayer.plugin.prototype.defaultOptions = function(options) { +}; + +/** + * The constructor which is called once the context is set. + * Any class deriving from the plugin class should place all context + * dependant functionality within this function instead of the standard + * constructor function since it is called on object derivation as well + * as object creation. + */ +minplayer.plugin.prototype.construct = function() { + + /** Say that we are active. */ + this.active = true; + + // Adds this as a plugin. + this.addPlugin(); +}; + +/** + * Destructor. + */ +minplayer.plugin.prototype.destroy = function() { + + // Unbind all events. + this.active = false; + this.unbind(); +}; + +/** + * Creates a new plugin within this context. + * + * @param {string} name The name of the plugin you wish to create. + * @param {object} base The base object for this plugin. + * @param {object} context The context which you would like to create. + * @return {object} The new plugin object. + */ +minplayer.plugin.prototype.create = function(name, base, context) { + var plugin = null; + + // Make sure we have a base object. + base = base || 'minplayer'; + if (!window[base][name]) { + base = 'minplayer'; + } + + // Make sure there is a context. + context = context || this.display; + + // See if this plugin exists within this object. + if (window[base][name]) { + + // Set the plugin. + plugin = window[base][name]; + + // See if a template version of the plugin exists. + if (plugin[this.options.template]) { + + plugin = plugin[this.options.template]; + } + + // Make sure the plugin is a function. + if (typeof plugin !== 'function') { + plugin = window.minplayer[name]; + } + + // Make sure it is a function. + if (typeof plugin === 'function') { + return new plugin(context, this.options); + } + } + + return null; +}; + +/** + * Plugins should call this method when they are ready. + */ +minplayer.plugin.prototype.ready = function() { + + // Keep this plugin from triggering multiple ready events. + if (!this.pluginReady) { + + // Set the ready flag. + this.pluginReady = true; + + // Now trigger that I am ready. + this.trigger('ready'); + + // Check the queue. + this.checkQueue(); + } +}; + +/** + * Returns if this component is valid. + * + * @return {boolean} TRUE if the plugin display is valid. + */ +minplayer.plugin.prototype.isValid = function() { + return !!this.options.id && this.active; +}; + +/** + * Allows a plugin to do something when it is added to another plugin. + * + * @param {object} plugin The plugin that this plugin was added to. + */ +minplayer.plugin.prototype.onAdded = function(plugin) { +}; + +/** + * Adds a new plugin to this player. + * + * @param {string} name The name of this plugin. + * @param {object} plugin A new plugin object, derived from media.plugin. + */ +minplayer.plugin.prototype.addPlugin = function(name, plugin) { + name = name || this.name; + plugin = plugin || this; + + // Make sure the plugin is valid. + if (plugin.isValid()) { + + // If the plugins for this instance do not exist. + if (!minplayer.plugins[this.options.id]) { + + // Initialize the plugins. + minplayer.plugins[this.options.id] = {}; + } + + if (!minplayer.plugins[this.options.id][name]) { + + // Add the plugins array. + minplayer.plugins[this.options.id][name] = []; + } + + // Add this plugin. + var instance = minplayer.plugins[this.options.id][name].push(plugin); + + // Set the uuid. + this.uuid = this.options.id + '__' + name + '__' + instance; + + // Now check the queue for this plugin. + this.checkQueue(plugin); + + // Now let the plugin do something with this plugin. + plugin.onAdded(this); + } +}; + +/** Create timers for the polling. */ +minplayer.timers = {}; + +/** + * Create a polling timer. + * + * @param {string} name The name of the timer. + * @param {function} callback The function to call when you poll. + * @param {integer} interval The interval you would like to poll. + * @return {string} The setTimeout ID. + */ +minplayer.plugin.prototype.poll = function(name, callback, interval) { + if (minplayer.timers.hasOwnProperty(name)) { + clearTimeout(minplayer.timers[name]); + } + minplayer.timers[name] = setTimeout((function(context) { + return function callLater() { + if (callback.call(context)) { + minplayer.timers[name] = setTimeout(callLater, interval); + } + }; + })(this), interval); + return minplayer.timers[name]; +}; + +/** + * Gets a plugin by name and calls callback when it is ready. + * + * @param {string} plugin The plugin of the plugin. + * @param {function} callback Called when the plugin is ready. + * @return {object} The plugin if no callback is provided. + */ +minplayer.plugin.prototype.get = function(plugin, callback) { + + // If they pass just a callback, then return all plugins when ready. + if (typeof plugin === 'function') { + callback = plugin; + plugin = null; + } + + // Return the minplayer.get equivalent. + return minplayer.get.call(this, this.options.id, plugin, callback); +}; + +/** + * Check the queue and execute it. + * + * @param {object} plugin The plugin object to check the queue against. + */ +minplayer.plugin.prototype.checkQueue = function(plugin) { + + // Initialize our variables. + var q = null, i = 0, check = false; + + // Normalize the plugin variable. + plugin = plugin || this; + + // Set the lock. + minplayer.lock = true; + + // Iterate through all the queues. + var length = minplayer.queue.length; + for (i = 0; i < length; i++) { + if (minplayer.queue.hasOwnProperty(i)) { + + // Get the queue. + q = minplayer.queue[i]; + + // Now check to see if this queue is about us. + check = !q.id && !q.plugin; + check |= (q.plugin === plugin.name); + check &= (!q.id || (q.id === this.options.id)); + + // If the check passes, and hasn't already been added... + if (check && !q.addedto.hasOwnProperty(plugin.options.id)) { + q.addedto[plugin.options.id] = true; + check = minplayer.bind.call( + q.context, + q.event, + this.options.id, + plugin.name, + q.callback, + true + ); + } + } + } + + // Release the lock. + minplayer.lock = false; +}; + +/** + * All minplayer event types. + */ +minplayer.eventTypes = {}; + +/** + * Determine if an event is of a certain type. + * + * @param {string} name The full name of the event. + * @param {string} type The type of the event. + * @return {boolean} If this named event is of type. + */ +minplayer.plugin.prototype.isEvent = function(name, type) { + // Static cache for performance. + var cacheName = name + '__' + type; + if (typeof minplayer.eventTypes[cacheName] !== 'undefined') { + return minplayer.eventTypes[cacheName]; + } + else { + var regex = new RegExp('^(.*:)?' + type + '$', 'gi'); + minplayer.eventTypes[cacheName] = (name.match(type) !== null); + return minplayer.eventTypes[cacheName]; + } +}; + +/** + * Trigger a media event. + * + * @param {string} type The event type. + * @param {object} data The event data object. + * @param {boolean} noqueue If this trigger should not be queued. + * @return {object} The plugin object. + */ +minplayer.plugin.prototype.trigger = function(type, data, noqueue) { + + // Don't trigger if this plugin is inactive. + if (!this.active) { + return this; + } + + // Only queue if they wish it to be so... + if (!noqueue) { + + // Add this to our triggered array. + this.triggered[type] = data; + } + + // Iterate through the queue. + var i = 0, queue = {}, queuetype = null; + + // Iterate through all the queue items. + for (var name in this.queue) { + + // See if this is an event we care about. + if (this.isEvent(name, type)) { + + // Set the queuetype. + queuetype = this.queue[name]; + + // Iterate through all the callbacks in this queue. + for (i in queuetype) { + + // Check to make sure the queue index exists. + if (queuetype.hasOwnProperty(i)) { + + // Setup the event object, and call the callback. + queue = queuetype[i]; + queue.callback({target: this, data: queue.data}, data); + } + } + } + } + + // Return the plugin object. + return this; +}; + +/** + * Unbind then Bind + * + * @param {string} type The event type. + * @param {object} data The data to bind with the event. + * @param {function} fn The callback function. + * @return {object} The plugin object. + */ +minplayer.plugin.prototype.ubind = function(type, data, fn) { + this.unbind(type); + return this.bind(type, data, fn); +}; + +/** + * Bind to a media event. + * + * @param {string} type The event type. + * @param {object} data The data to bind with the event. + * @param {function} fn The callback function. + * @return {object} The plugin object. + **/ +minplayer.plugin.prototype.bind = function(type, data, fn) { + + // Only bind if active. + if (!this.active) { + return this; + } + + // Allow the data to be the callback. + if (typeof data === 'function') { + fn = data; + data = null; + } + + // You must bind to a specific event and have a callback. + if (!type || !fn) { + return; + } + + // Initialize the queue for this type. + this.queue[type] = this.queue[type] || []; + + // Now add this event to the queue. + this.queue[type].push({ + callback: fn, + data: data + }); + + // Now see if this event has already been triggered. + for (var name in this.triggered) { + if (this.triggered.hasOwnProperty(name)) { + if (this.isEvent(type, name)) { + fn({target: this, data: data}, this.triggered[name]); + } + } + } + + // Return the plugin. + return this; +}; + +/** + * Unbind a media event. + * + * @param {string} type The event type. + * @return {object} The plugin object. + **/ +minplayer.plugin.prototype.unbind = function(type) { + + // If this is locked then try again after 10ms. + if (this.lock) { + setTimeout((function(plugin) { + return function() { + plugin.unbind(type); + }; + })(this), 10); + } + + // Set the lock. + this.lock = true; + + if (!type) { + this.queue = {}; + } + else if (this.queue.hasOwnProperty(type) && (this.queue[type].length > 0)) { + this.queue[type].length = 0; + } + + // Reset the lock. + this.lock = false; + + // Return the plugin. + return this; +}; + +/** + * Adds an item to the queue. + * + * @param {object} context The context which this is called within. + * @param {string} event The event to trigger on. + * @param {string} id The player ID. + * @param {string} plugin The name of the plugin. + * @param {function} callback Called when the event occurs. + */ +minplayer.addQueue = function(context, event, id, plugin, callback) { + + // See if it is locked... + if (!minplayer.lock) { + minplayer.queue.push({ + context: context, + id: id, + event: event, + plugin: plugin, + callback: callback, + addedto: {} + }); + } + else { + + // If so, then try again after 10 milliseconds. + setTimeout(function() { + minplayer.addQueue(context, id, event, plugin, callback); + }, 10); + } +}; + +/** + * Binds an event to a plugin instance, and if it doesn't exist, then caches + * it for a later time. + * + * @param {string} event The event to trigger on. + * @param {string} id The player ID. + * @param {string} plugin The name of the plugin. + * @param {function} callback Called when the event occurs. + * @param {boolean} fromCheck If this is from a checkqueue. + * @return {boolean} If the bind was successful. + * @this The object in context who called this method. + */ +minplayer.bind = function(event, id, plugin, callback, fromCheck) { + + // If no callback exists, then just return false. + if (!callback) { + return false; + } + + // Get the plugins. + var plugins = minplayer.plugins, thisPlugin = null, thisId = null; + + // Determine the selected plugins. + var selected = []; + + // Create a quick add. + var addSelected = function(id, plugin) { + if (plugins.hasOwnProperty(id) && plugins[id].hasOwnProperty(plugin)) { + var i = plugins[id][plugin].length; + while (i--) { + selected.push(plugins[id][plugin][i]); + } + } + }; + + // If they provide id && plugin + if (id && plugin) { + addSelected(id, plugin); + } + + // If they provide no id but a plugin. + else if (!id && plugin) { + for (thisId in plugins) { + addSelected(thisId, plugin); + } + } + + // If they provide an id but no plugin. + else if (id && !plugin && plugins[id]) { + for (thisPlugin in plugins[id]) { + addSelected(id, thisPlugin); + } + } + + // If they provide niether an id or a plugin. + else if (!id && !plugin) { + for (thisId in plugins) { + for (thisPlugin in plugins[thisId]) { + addSelected(thisId, thisPlugin); + } + } + } + + // Iterate through the selected plugins and bind. + /* jshint loopfunc: true */ + var i = selected.length; + while (i--) { + selected[i].bind(event, (function(context) { + return function(event) { + callback.call(context, event.target); + }; + })(this)); + } + + // Add it to the queue for post bindings... + if (!fromCheck) { + minplayer.addQueue(this, event, id, plugin, callback); + } + + // Return that this wasn't handled. + return (selected.length > 0); +}; + +/** + * The main API for minPlayer. + * + * Provided that this function takes three parameters, there are 8 different + * ways to use this api. + * + * id (0x100) - You want a specific player. + * plugin (0x010) - You want a specific plugin. + * callback (0x001) - You only want it when it is ready. + * + * 000 - You want all plugins from all players, ready or not. + * + * var plugins = minplayer.get(); + * + * 001 - You want all plugins from all players, but only when ready. + * + * minplayer.get(function(plugin) { + * // Code goes here. + * }); + * + * 010 - You want a specific plugin from all players, ready or not... + * + * var medias = minplayer.get(null, 'media'); + * + * 011 - You want a specific plugin from all players, but only when ready. + * + * minplayer.get('player', function(player) { + * // Code goes here. + * }); + * + * 100 - You want all plugins from a specific player, ready or not. + * + * var plugins = minplayer.get('player_id'); + * + * 101 - You want all plugins from a specific player, but only when ready. + * + * minplayer.get('player_id', null, function(plugin) { + * // Code goes here. + * }); + * + * 110 - You want a specific plugin from a specific player, ready or not. + * + * var plugin = minplayer.get('player_id', 'media'); + * + * 111 - You want a specific plugin from a specific player, only when ready. + * + * minplayer.get('player_id', 'media', function(media) { + * // Code goes here. + * }); + * + * @this The context in which this function was called. + * @param {string} id The ID of the widget to get the plugins from. + * @param {string} plugin The name of the plugin. + * @param {function} callback Called when the plugin is ready. + * @return {object} The plugin object if it is immediately available. + */ +minplayer.get = function(id, plugin, callback) { + + // Get the parameter types. + var idType = typeof id; + var pluginType = typeof plugin; + var callbackType = typeof callback; + + // Normalize the arguments for a better interface. + if (idType === 'function') { + callback = id; + plugin = id = null; + } + else if (pluginType === 'function') { + callback = plugin; + plugin = id; + id = null; + } + else if ((pluginType === 'undefined') && (callbackType === 'undefined')) { + plugin = id; + callback = id = null; + } + + // Make sure the callback is a callback. + callback = (typeof callback === 'function') ? callback : null; + + // If a callback was provided, then just go ahead and bind. + if (callback) { + minplayer.bind.call(this, 'ready', id, plugin, callback); + return; + } + + // Get the plugins. + var plugins = minplayer.plugins, thisId = null; + + // 0x000 + if (!id && !plugin && !callback) { + return plugins; + } + // 0x100 + else if (id && !plugin && !callback) { + return plugins[id]; + } + // 0x110 + else if (id && plugin && !callback) { + return plugins[id][plugin]; + } + // 0x010 + else if (!id && plugin && !callback) { + var plugin_types = []; + for (thisId in plugins) { + if (plugins.hasOwnProperty(thisId) && + plugins[thisId].hasOwnProperty(plugin)) { + var i = plugins[thisId][plugin].length; + while (i--) { + plugin_types.push(plugins[thisId][plugin][i]); + } + } + } + return plugin_types; + } +}; +/** + * @constructor + * @extends minplayer.plugin + * @class Base class used to provide the display and options for any component + * deriving from this class. Components who derive are expected to provide + * the elements that they define by implementing the getElements method. + * + * @param {string} name The name of this plugin. + * @param {object} context The jQuery context this component resides. + * @param {object} options The options for this component. + * @param {object} queue The event queue to pass events around. + */ +minplayer.display = function(name, context, options, queue) { + + // Derive from plugin + minplayer.plugin.call(this, name, context, options, queue); +}; + +/** Derive from minplayer.plugin. */ +minplayer.display.prototype = new minplayer.plugin(); + +/** Reset the constructor. */ +minplayer.display.prototype.constructor = minplayer.display; + +/** + * Returns the display for this component. + * + * @param {object} context The context which this display is within. + * @param {object} options The options to get the display. + * + * @return {object} The jQuery context for this display. + */ +minplayer.display.prototype.getDisplay = function(context, options) { + + // Return the context. + return context; +}; + +/** + * @see minplayer.plugin.initialize + */ +minplayer.display.prototype.initialize = function() { + + // Only set the display if it hasn't already been set. + if (!this.display) { + + // Set the display. + this.display = this.getDisplay(this.context, this.options); + } + + // Only continue loading this plugin if there is a display. + if (this.display) { + + // Set the plugin name within the options. + this.options.pluginName = 'display'; + + // Get the display elements. + this.elements = this.getElements(); + + // Call the plugin initialize method. + minplayer.plugin.prototype.initialize.call(this); + } +}; + +/** + * @see minplayer.plugin.construct + */ +minplayer.display.prototype.construct = function() { + + // Call the plugin constructor. + minplayer.plugin.prototype.construct.call(this); + + // Set if this display is in autohide. + this.autoHide = false; + + // Only do this if they allow resize for this display. + if (this.onResize) { + + // Set the resize timeout and this pointer. + var resizeTimeout = 0; + + // Add a handler to trigger a resize event. + jQuery(window).resize((function(display) { + return function() { + clearTimeout(resizeTimeout); + resizeTimeout = setTimeout(function() { + display.onResize(); + }, 200); + }; + })(this)); + } +}; + +/** + * Called when the window resizes. + */ +minplayer.display.prototype.onResize = false; + +/** + * Wrapper around hide that will always not show. + * + * @param {object} element The element you wish to hide. + */ +minplayer.display.prototype.hide = function(element) { + element = element || this.display; + if (element) { + element.forceHide = true; + element.unbind().hide(); + } +}; + +/** + * Gets the full screen element. + * + * @return {object} The display to be used for full screen support. + */ +minplayer.display.prototype.fullScreenElement = function() { + return this.display; +}; + +/** + * Fix for the click function in jQuery to be cross platform. + * + * @param {object} element The element that will be clicked. + * @param {function} fn Called when the element is clicked. + * @return {object} The element that is to be clicked. + */ +minplayer.click = function(element, fn) { + var flag = false; + element = jQuery(element); + element.bind('touchstart click', function(event) { + if (!flag) { + flag = true; + setTimeout(function() { + flag = false; + }, 100); + fn.call(this, event); + } + }); + return element; +}; + +/** + * Determines if the player is in focus or not. + * + * @param {boolean} focus If the player is in focus. + */ +minplayer.display.prototype.onFocus = function(focus) { + this.hasFocus = this.focus = focus; + + // If they have autoHide enabled, then show then hide this element. + if (this.autoHide) { + this.showThenHide( + this.autoHide.element, + this.autoHide.timeout, + this.autoHide.cb + ); + } +}; + +/** + * Called if you would like for your plugin to show then hide. + * + * @param {object} element The element you would like to hide or show. + * @param {number} timeout The timeout to hide and show. + * @param {function} cb Called when something happens. + */ +minplayer.display.prototype.showThenHide = function(element, timeout, cb) { + + // Get the element type. + var elementType = (typeof element); + + // Set some interface defaults. + if (elementType === 'undefined') { + cb = null; + element = this.display; + } + else if (elementType === 'number') { + cb = timeout; + timeout = element; + element = this.display; + } + else if (elementType === 'function') { + cb = element; + element = this.display; + } + + if (!element) { + return; + } + + // Make sure we have a timeout. + timeout = timeout || 5000; + + // Set the autohide variable. + this.autoHide = { + element: element, + timeout: timeout, + cb: cb + }; + + // Show the element. + if (!element.forceHide) { + if (typeof element.showMe !== 'undefined') { + if (element.showMe) { + element.showMe(cb); + } + } + else { + element.show(); + if (cb) { + cb(true); + } + } + } + + // Define the hover state for this element. + if (!element.hoverState) { + jQuery(element).bind('mouseenter', function() { + element.hoverState = true; + }); + jQuery(element).bind('mouseleave', function() { + element.hoverState = false; + }); + } + + // Clear the timeout and start it over again. + clearTimeout(this.showTimer); + this.showTimer = setTimeout((function(self) { + return function tryAgain() { + + // Check the hover state. + if (!element.hoverState) { + if (typeof element.hideMe !== 'undefined') { + if (element.hideMe) { + element.hideMe(cb); + } + } + else { + // Hide the element. + element.hide('slow', function() { + if (cb) { + cb(false); + } + }); + } + } + else { + + // Try again in the timeout time. + self.showTimer = setTimeout(tryAgain, timeout); + } + }; + })(this), timeout); +}; + +/** + * Make this display element go fullscreen. + * + * @param {boolean} full Tell the player to go into fullscreen or not. + */ +minplayer.display.prototype.fullscreen = function(full) { + var isFull = this.isFullScreen(); + var element = this.fullScreenElement(); + if (isFull && !full) { + element.removeClass('fullscreen'); + if (minplayer.screenfull) { + minplayer.screenfull.exit(); + } + this.trigger('fullscreen', false); + } + else if (!isFull && full) { + element.addClass('fullscreen'); + if (minplayer.screenfull) { + minplayer.screenfull.request(element[0]); + minplayer.screenfull.onchange = (function(display) { + return function(e) { + if (!minplayer.screenfull.isFullscreen) { + display.fullscreen(false); + } + }; + })(this); + } + this.trigger('fullscreen', true); + } +}; + +/** + * Toggle fullscreen. + */ +minplayer.display.prototype.toggleFullScreen = function() { + this.fullscreen(!this.isFullScreen()); +}; + +/** + * Checks to see if we are in fullscreen mode. + * + * @return {boolean} TRUE - fullscreen, FALSE - otherwise. + */ +minplayer.display.prototype.isFullScreen = function() { + return this.fullScreenElement().hasClass('fullscreen'); +}; + +/** + * Returns a scaled rectangle provided a ratio and the container rect. + * + * @param {number} ratio The width/height ratio of what is being scaled. + * @param {object} rect The bounding rectangle for scaling. + * @return {object} The Rectangle object of the scaled rectangle. + */ +minplayer.display.prototype.getScaledRect = function(ratio, rect) { + var scaledRect = {}; + scaledRect.x = rect.x ? rect.x : 0; + scaledRect.y = rect.y ? rect.y : 0; + scaledRect.width = rect.width ? rect.width : 0; + scaledRect.height = rect.height ? rect.height : 0; + if (ratio) { + if ((rect.width / rect.height) > ratio) { + scaledRect.height = rect.height; + scaledRect.width = Math.floor(rect.height * ratio); + } + else { + scaledRect.height = Math.floor(rect.width / ratio); + scaledRect.width = rect.width; + } + scaledRect.x = Math.floor((rect.width - scaledRect.width) / 2); + scaledRect.y = Math.floor((rect.height - scaledRect.height) / 2); + } + return scaledRect; +}; + +/** + * Returns all the jQuery elements that this component uses. + * + * @return {object} An object which defines all the jQuery elements that + * this component uses. + */ +minplayer.display.prototype.getElements = function() { + return {}; +}; +// Add a way to instanciate using jQuery prototype. +if (!jQuery.fn.minplayer) { + + /** + * @constructor + * + * Define a jQuery minplayer prototype. + * + * @param {object} options The options for this jQuery prototype. + * @return {Array} jQuery object. + */ + jQuery.fn.minplayer = function(options) { + return jQuery(this).each(function() { + options = options || {}; + options.id = options.id || jQuery(this).attr('id') || Math.random(); + if (!minplayer.plugins[options.id]) { + options.template = options.template || 'default'; + if (minplayer[options.template]) { + new minplayer[options.template](jQuery(this), options); + } + else { + new minplayer(jQuery(this), options); + } + } + }); + }; +} + +/** + * @constructor + * @extends minplayer.display + * @class The core media player class which governs the media player + * functionality. + * + *

Usage: + *


+ *
+ *   // Create a media player.
+ *   var player = jQuery("#player").minplayer({
+ *
+ *   });
+ *
+ * 
+ *

+ * + * @param {object} context The jQuery context. + * @param {object} options This components options. + */ +minplayer = jQuery.extend(function(context, options) { + + // Derive from display + minplayer.display.call(this, 'player', context, options); +}, minplayer); + +/** Derive from minplayer.display. */ +minplayer.prototype = new minplayer.display(); + +/** Reset the constructor. */ +minplayer.prototype.constructor = minplayer; + +/** + * Get the default options for this plugin. + * + * @param {object} options The default options for this plugin. + */ +minplayer.prototype.defaultOptions = function(options) { + + // Assign the default options. + options.id = 'player'; + options.build = false; + options.wmode = 'transparent'; + options.preload = true; + options.autoplay = false; + options.autoload = true; + options.loop = false; + options.width = '100%'; + options.height = '350px'; + options.debug = false; + options.volume = 80; + options.files = null; + options.file = ''; + options.preview = ''; + options.attributes = {}; + options.plugins = {}; + options.logo = ''; + options.link = ''; + options.duration = 0; + + // Allow them to provide arguments based off of the DOM attributes. + jQuery.each(this.context[0].attributes, function(index, attr) { + options[attr.name] = attr.value; + }); + + // Set the parent options. + minplayer.display.prototype.defaultOptions.call(this, options); +}; + +/** + * @see minplayer.plugin.construct + */ +minplayer.prototype.construct = function() { + + // Call the minplayer display constructor. + minplayer.display.prototype.construct.call(this); + + // Initialize all plugins. + var plugin = null; + for (var pluginName in this.options.plugins) { + plugin = this.options.plugins[pluginName]; + if (minplayer[plugin]) { + plugin = minplayer[plugin]; + if (plugin[this.options.template] && plugin[this.options.template].init) { + plugin[this.options.template].init(this); + } + else if (plugin.init) { + plugin.init(this); + } + } + } + + // Set the plugin name within the options. + this.options.pluginName = 'player'; + + /** The controller for this player. */ + this.controller = this.create('controller'); + + /** The play loader for this player. */ + this.playLoader = this.create('playLoader'); + + /** Add the logo for the player. */ + if (this.options.logo && this.elements.logo) { + + var code = ''; + if (this.options.link) { + code += ''; + } + code += ''; + if (this.options.link) { + code += ''; + } + this.logo = this.elements.logo.append(code); + } + + /** Variable to store the current media player. */ + this.currentPlayer = 'html5'; + + // Add key events to the window. + this.addKeyEvents(); + + // Called to add events. + this.addEvents(); + + // Now load these files. + this.load(this.getFiles()); + + // The player is ready. + this.ready(); +}; + +/** + * Set the focus for this player. + * + * @param {boolean} focus If the player is in focus or not. + */ +minplayer.prototype.setFocus = function(focus) { + + // Tell all plugins about this. + minplayer.get.call(this, this.options.id, null, function(plugin) { + plugin.onFocus(focus); + }); + + // Trigger an event that a focus event has occured. + this.trigger('playerFocus', focus); +}; + +/** + * Called when an error occurs. + * + * @param {object} plugin The plugin you wish to bind to. + */ +minplayer.prototype.bindTo = function(plugin) { + plugin.ubind(this.uuid + ':error', (function(player) { + return function(event, data) { + if (player.currentPlayer === 'html5') { + minplayer.player = 'minplayer'; + player.options.file.player = 'minplayer'; + player.loadPlayer(); + } + else { + player.showError(data); + } + }; + })(this)); + + // Bind to the fullscreen event. + plugin.ubind(this.uuid + ':fullscreen', (function(player) { + return function(event, data) { + player.resize(); + }; + })(this)); +}; + +/** + * We need to bind to events we are interested in. + */ +minplayer.prototype.addEvents = function() { + + // Keep track if we are inside the player or not. + var inside = false; + + // Set the focus when they enter the player. + this.display.bind('mouseenter', (function(player) { + return function() { + inside = true; + player.setFocus(true); + }; + })(this)); + + + this.display.bind('mouseleave', (function(player) { + return function() { + inside = false; + player.setFocus(false); + }; + })(this)); + + var moveThrottle = false; + this.display.bind('mousemove', (function(player) { + return function() { + if (!moveThrottle) { + moveThrottle = setTimeout(function() { + moveThrottle = false; + if (inside) { + player.setFocus(true); + } + }, 300); + } + }; + })(this)); + + minplayer.get.call(this, this.options.id, null, (function(player) { + return function(plugin) { + player.bindTo(plugin); + }; + })(this)); +}; + +/** + * Sets an error on the player. + * + * @param {string} error The error to display on the player. + */ +minplayer.prototype.showError = function(error) { + if (typeof error !== 'object') { + error = error || ''; + if (this.elements.error) { + + // Set the error text. + this.elements.error.text(error); + if (error) { + // Show the error message. + this.elements.error.show(); + + // Only show this error for a time interval. + setTimeout((function(player) { + return function() { + player.elements.error.hide('slow'); + }; + })(this), 5000); + } + else { + this.elements.error.hide(); + } + } + } +}; + +/** + * Adds key events to the player. + */ +minplayer.prototype.addKeyEvents = function() { + jQuery(document).bind('keydown', (function(player) { + return function(event) { + switch (event.keyCode) { + case 113: // ESC + case 27: // Q + if (player.isFullScreen()) { + player.fullscreen(false); + } + break; + } + }; + })(this)); +}; + +/** + * Returns all the media files available for this player. + * + * @return {array} All the media files for this player. + */ +minplayer.prototype.getFiles = function() { + + // If they provide the files in the options, use those first. + if (this.options.files) { + return this.options.files; + } + + if (this.options.file) { + return this.options.file; + } + + var files = []; + var mediaSrc = null; + + // Get the files involved... + if (this.elements.media) { + mediaSrc = this.elements.media.attr('src'); + if (mediaSrc) { + files.push({'path': mediaSrc}); + } + jQuery('source', this.elements.media).each(function() { + files.push({ + 'path': jQuery(this).attr('src'), + 'mimetype': jQuery(this).attr('type'), + 'codecs': jQuery(this).attr('codecs') + }); + }); + } + + return files; +}; + +/** + * Returns the full media player object. + * + * @param {array} files An array of files to chose from. + * @return {object} The best media file to play in the current browser. + */ +minplayer.getMediaFile = function(files) { + + // If there are no files then return null. + if (!files) { + return null; + } + + // If the file is already a file object then just return. + if ((typeof files === 'string') || files.path || files.id) { + return new minplayer.file(files); + } + + // Add the files and get the best player to play. + var bestPriority = 0, mFile = null, file = null; + for (var i in files) { + if (files.hasOwnProperty(i)) { + file = new minplayer.file(files[i]); + if (file.player && (file.priority > bestPriority)) { + bestPriority = file.priority; + mFile = file; + } + } + } + + // Return the best minplayer file. + return mFile; +}; + +/** + * Loads a media player based on the current file. + * + * @return {boolean} If a new player was loaded. + */ +minplayer.prototype.loadPlayer = function() { + + // Do nothing if there isn't a file or anywhere to put it. + if (!this.options.file || (this.elements.display.length === 0)) { + return false; + } + + // If no player is set, then also return false. + if (!this.options.file.player) { + return false; + } + + // Reset the error. + this.showError(); + + // Only destroy if the current player is different than the new player. + var player = this.options.file.player.toString(); + + // If there isn't media or if the players are different. + if (!this.media || (player !== this.currentPlayer)) { + + // Set the current media player. + this.currentPlayer = player; + + // Do nothing if we don't have a display. + if (!this.elements.display) { + this.showError('No media display found.'); + return; + } + + // Destroy the current media. + var queue = {}; + if (this.media) { + queue = this.media.queue; + this.media.destroy(); + } + + // Get the class name and create the new player. + pClass = minplayer.players[this.options.file.player]; + + // Create the new media player. + this.options.mediaelement = this.elements.media; + this.media = new pClass(this.elements.display, this.options, queue); + this.media.load(this.options.file); + this.display.addClass('minplayer-player-' + this.media.mediaFile.player); + return true; + } + // If the media object already exists... + else if (this.media) { + + // Now load the different media file. + this.media.options = this.options; + this.display.removeClass('minplayer-player-' + this.media.mediaFile.player); + this.media.load(this.options.file); + this.display.addClass('minplayer-player-' + this.media.mediaFile.player); + return false; + } +}; + +/** + * Load a set of files or a single file for the media player. + * + * @param {array} files An array of files to chose from to load. + */ +minplayer.prototype.load = function(files) { + + // Set the id and class. + var id = '', pClass = ''; + + // If no file was provided, then get it. + this.options.files = files || this.options.files; + this.options.file = minplayer.getMediaFile(this.options.files); + + // Now load the player. + if (this.loadPlayer()) { + + // Add the events since we now have a player. + this.bindTo(this.media); + + // If the player isn't valid, then show an error. + if (this.options.file.mimetype && !this.options.file.player) { + this.showError('Cannot play media: ' + this.options.file.mimetype); + return false; + } + + return true; + } + + return false; +}; + +/** + * Called when the player is resized. + */ +minplayer.prototype.resize = function() { + + // Call onRezie for each plugin. + this.get(function(plugin) { + if (plugin.onResize) { + plugin.onResize(); + } + }); +}; +/** The minplayer namespace. */ +var minplayer = minplayer || {}; + +/** + * @constructor + * @class A class to easily handle images. + * @param {object} context The jQuery context. + * @param {object} options This components options. + */ +minplayer.image = function(context, options) { + + // Determine if the image is loaded. + this.loaded = false; + + // The image loader. + this.loader = null; + + // The ratio of the image. + this.ratio = 0; + + // The image element. + this.img = null; + + // Derive from display + minplayer.display.call(this, 'image', context, options); +}; + +/** Derive from minplayer.display. */ +minplayer.image.prototype = new minplayer.display(); + +/** Reset the constructor. */ +minplayer.image.prototype.constructor = minplayer.image; + +/** + * @see minplayer.plugin.construct + */ +minplayer.image.prototype.construct = function() { + + // Call the media display constructor. + minplayer.display.prototype.construct.call(this); + + // Set the plugin name within the options. + this.options.pluginName = 'image'; + + // Set the container to not show any overflow... + this.display.css('overflow', 'hidden'); + + /** The loader for the image. */ + this.loader = new Image(); + + /** Register for when the image is loaded within the loader. */ + this.loader.onload = (function(image) { + return function() { + image.loaded = true; + image.ratio = (image.loader.width / image.loader.height); + image.resize(); + image.trigger('loaded'); + }; + })(this); + + // We are now ready. + this.ready(); +}; + +/** + * Loads an image. + * + * @param {string} src The source of the image to load. + */ +minplayer.image.prototype.load = function(src) { + + // First clear the previous image. + this.clear(function() { + + // Create the new image, and append to the display. + this.display.empty(); + this.img = jQuery(document.createElement('img')).attr({src: ''}).hide(); + this.display.append(this.img); + this.loader.src = src; + this.img.attr('src', src); + }); +}; + +/** + * Clears an image. + * + * @param {function} callback Called when the image is done clearing. + */ +minplayer.image.prototype.clear = function(callback) { + this.loaded = false; + if (this.img) { + this.img.fadeOut(150, (function(image) { + return function() { + image.img.attr('src', ''); + image.loader.src = ''; + jQuery(this).remove(); + if (callback) { + callback.call(image); + } + }; + })(this)); + } + else if (callback) { + callback.call(this); + } +}; + +/** + * Resize the image provided a width and height or nothing. + * + * @param {integer} width (optional) The width of the container. + * @param {integer} height (optional) The height of the container. + */ +minplayer.image.prototype.resize = function(width, height) { + width = width || this.display.parent().width(); + height = height || this.display.parent().height(); + if (width && height && this.loaded) { + + // Get the scaled rectangle. + var rect = this.getScaledRect(this.ratio, { + width: width, + height: height + }); + + // Now set this image to the new size. + if (this.img) { + this.img.attr('src', this.loader.src).css({ + marginLeft: rect.x, + marginTop: rect.y, + width: rect.width, + height: rect.height + }); + } + + // Show the container. + this.img.fadeIn(150); + } +}; + +/** + * @see minplayer.display#onResize + */ +minplayer.image.prototype.onResize = function() { + + // Resize the image to fit. + this.resize(); +}; +/** The minplayer namespace. */ +var minplayer = minplayer || {}; + +/** + * @constructor + * @class A wrapper class used to provide all the data necessary to control an + * individual file within this media player. + * + * @param {object} file A media file object with minimal required information. + */ +minplayer.file = function(file) { + + // If there isn't a file provided, then just return null. + if (!file) { + return null; + } + + file = (typeof file === 'string') ? {path: file} : file; + + // If we already are a minplayer file, then just return this file. + if (file.hasOwnProperty('isMinPlayerFile')) { + return file; + } + + this.isMinPlayerFile = true; + this.duration = file.duration || 0; + this.bytesTotal = file.bytesTotal || 0; + this.quality = file.quality || 0; + this.stream = file.stream || ''; + this.path = file.path || ''; + this.codecs = file.codecs || ''; + + // These should be provided, but just in case... + this.extension = file.extension || this.getFileExtension(); + this.mimetype = file.mimetype || file.filemime || this.getMimeType(); + this.type = file.type || this.getType(); + + // Fail safe to try and guess the mimetype and media type. + if (!this.type) { + this.mimetype = this.getMimeType(); + this.type = this.getType(); + } + + // Get the player. + this.player = minplayer.player || file.player || this.getBestPlayer(); + this.priority = file.priority || this.getPriority(); + this.id = file.id || this.getId(); + if (!this.path) { + this.path = this.id; + } +}; + +/** Used to force the player for all media. */ +minplayer.player = ''; + +/** + * Returns the best player for the job. + * + * @return {string} The best player to play the media file. + */ +minplayer.file.prototype.getBestPlayer = function() { + var bestplayer = null, bestpriority = 0; + jQuery.each(minplayer.players, (function(file) { + return function(name, player) { + var priority = player.getPriority(file); + if (player.canPlay(file) && (priority > bestpriority)) { + bestplayer = name; + bestpriority = priority; + } + }; + })(this)); + return bestplayer; +}; + +/** + * The priority of this file is determined by the priority of the best + * player multiplied by the priority of the mimetype. + * + * @return {integer} The priority of the media file. + */ +minplayer.file.prototype.getPriority = function() { + var priority = 1; + if (this.player) { + priority = minplayer.players[this.player].getPriority(this); + } + switch (this.mimetype) { + case 'video/x-webm': + case 'video/webm': + case 'application/octet-stream': + case 'application/vnd.apple.mpegurl': + return priority * 10; + case 'video/mp4': + case 'audio/mp4': + case 'audio/mpeg': + return priority * 9; + case 'video/ogg': + case 'audio/ogg': + case 'video/quicktime': + return priority * 8; + default: + return priority * 5; + } +}; + +/** + * Returns the file extension of the file path. + * + * @return {string} The file extension. + */ +minplayer.file.prototype.getFileExtension = function() { + return this.path.substring(this.path.lastIndexOf('.') + 1).toLowerCase(); +}; + +/** + * Returns the proper mimetype based off of the extension. + * + * @return {string} The mimetype of the file based off of extension. + */ +minplayer.file.prototype.getMimeType = function() { + switch (this.extension) { + case 'mp4': case 'm4v': case 'flv': case 'f4v': + return 'video/mp4'; + case 'm3u8': + return 'application/vnd.apple.mpegurl'; + case'webm': + return 'video/webm'; + case 'ogg': case 'ogv': + return 'video/ogg'; + case '3g2': + return 'video/3gpp2'; + case '3gpp': + case '3gp': + return 'video/3gpp'; + case 'mov': + return 'video/quicktime'; + case'swf': + return 'application/x-shockwave-flash'; + case 'oga': + return 'audio/ogg'; + case 'mp3': + return 'audio/mpeg'; + case 'm4a': case 'f4a': + return 'audio/mp4'; + case 'aac': + return 'audio/aac'; + case 'wav': + return 'audio/vnd.wave'; + case 'wma': + return 'audio/x-ms-wma'; + default: + return 'unknown'; + } +}; + +/** + * The type of media this is: video or audio. + * + * @return {string} "video" or "audio" based on what the type of media this + * is. + */ +minplayer.file.prototype.getType = function() { + var type = this.mimetype.match(/([^\/]+)(\/)/); + type = (type && (type.length > 1)) ? type[1] : ''; + if (type === 'video') { + return 'video'; + } + if (type === 'audio') { + return 'audio'; + } + switch (this.mimetype) { + case 'application/octet-stream': + case 'application/x-shockwave-flash': + case 'application/vnd.apple.mpegurl': + return 'video'; + } + return ''; +}; + +/** + * Returns the ID for this media file. + * + * @return {string} The id for this media file which is provided by the player. + */ +minplayer.file.prototype.getId = function() { + var player = minplayer.players[this.player]; + return (player && player.getMediaId) ? player.getMediaId(this) : ''; +}; +/** The minplayer namespace. */ +var minplayer = minplayer || {}; + +/** + * @constructor + * @extends minplayer.display + * @class The play loader base class, which is used to control the busy + * cursor, big play button, and the opaque background which shows when the + * player is paused. + * + * @param {object} context The jQuery context. + * @param {object} options This components options. + */ +minplayer.playLoader = function(context, options) { + + // Clear the variables. + this.clear(); + + // Derive from display + minplayer.display.call(this, 'playLoader', context, options); +}; + +/** Derive from minplayer.display. */ +minplayer.playLoader.prototype = new minplayer.display(); + +/** Reset the constructor. */ +minplayer.playLoader.prototype.constructor = minplayer.playLoader; + +/** + * The constructor. + */ +minplayer.playLoader.prototype.construct = function() { + + // Call the media display constructor. + minplayer.display.prototype.construct.call(this); + + // Set the plugin name within the options. + this.options.pluginName = 'playLoader'; + + // Get the media plugin. + this.initializePlayLoader(); + + // We are now ready. + this.ready(); +}; + +/** + * Initialize the playLoader. + */ +minplayer.playLoader.prototype.initializePlayLoader = function() { + + // Get the media plugin. + this.get('media', function(media) { + + // Only bind if this player does not have its own play loader. + if (!media.hasPlayLoader(this.options.preview)) { + + // Enable the playLoader. + this.enabled = true; + + // Get the poster image. + if (!this.options.preview) { + this.options.preview = media.poster; + } + + // Determine if we should load the image. + var shouldLoad = true; + if (this.preview && this.preview.loader) { + shouldLoad = (this.preview.loader.src !== this.options.preview); + } + + // Only load the image if it is different. + if (shouldLoad) { + // Reset the media's poster image. + media.elements.media.attr('poster', ''); + + // Load the preview image. + this.loadPreview(); + } + + // Trigger a play event when someone clicks on the controller. + if (this.elements.bigPlay) { + minplayer.click(this.elements.bigPlay.unbind(), function(event) { + event.preventDefault(); + jQuery(this).hide(); + media.play(); + }); + } + + // Bind to the player events to control the play loader. + media.ubind(this.uuid + ':loadstart', (function(playLoader) { + return function(event, data, reset) { + playLoader.busy.setFlag('media', true); + playLoader.bigPlay.setFlag('media', true); + playLoader.previewFlag.setFlag('media', true); + playLoader.checkVisibility(); + }; + })(this)); + media.ubind(this.uuid + ':waiting', (function(playLoader) { + return function(event, data, reset) { + if (!reset) { + playLoader.busy.setFlag('media', true); + playLoader.checkVisibility(); + } + }; + })(this)); + media.ubind(this.uuid + ':loadeddata', (function(playLoader) { + return function(event, data, reset) { + if (!reset) { + playLoader.busy.setFlag('media', false); + playLoader.checkVisibility(); + } + }; + })(this)); + media.ubind(this.uuid + ':playing', (function(playLoader) { + return function(event, data, reset) { + if (!reset) { + playLoader.busy.setFlag('media', false); + playLoader.bigPlay.setFlag('media', false); + if (media.mediaFile.type !== 'audio') { + playLoader.previewFlag.setFlag('media', false); + } + playLoader.checkVisibility(); + } + }; + })(this)); + media.ubind(this.uuid + ':pause', (function(playLoader) { + return function(event, data, reset) { + if (!reset) { + playLoader.busy.setFlag('media', false); + playLoader.bigPlay.setFlag('media', true); + playLoader.checkVisibility(); + } + }; + })(this)); + } + else { + + // Hide the display. + this.enabled = false; + this.hide(this.elements.busy); + this.hide(this.elements.bigPlay); + this.hide(this.elements.preview); + this.hide(); + } + }); +}; + +/** + * Clears the playloader. + * + * @param {function} callback Called when the playloader is finished clearing. + */ +minplayer.playLoader.prototype.clear = function(callback) { + + // Define the flags that control the busy cursor. + this.busy = new minplayer.flags(); + + // Define the flags that control the big play button. + this.bigPlay = new minplayer.flags(); + + // Define the flags the control the preview. + this.previewFlag = new minplayer.flags(); + + /** If the playLoader is enabled. */ + this.enabled = true; + + // If the preview is defined, then clear the image. + if (this.preview) { + + this.preview.clear((function(playLoader) { + return function() { + + // Reset the preview. + playLoader.preview = null; + + // If they wish to be called back after it is cleared. + if (callback) { + callback(); + } + }; + })(this)); + } + else { + + /** The preview image. */ + this.preview = null; + + // Return the callback. + if (callback) { + callback(); + } + } +}; + +/** + * Loads the preview image. + * + * @param {string} image The image you would like to load. + * @return {boolean} Returns true if an image was loaded, false otherwise. + */ +minplayer.playLoader.prototype.loadPreview = function(image) { + + // Get the image to load. + image = image || this.options.preview; + this.options.preview = image; + + // Ignore if disabled. + if (!this.enabled || (this.display.length === 0)) { + return; + } + + // If the preview element exists. + if (this.elements.preview) { + + // If there is a preview to show... + if (this.options.preview) { + + // Say that this has a preview. + this.elements.preview.addClass('has-preview').show(); + + // Create a new preview image. + this.preview = new minplayer.image(this.elements.preview, this.options); + + // Create the image. + this.preview.load(this.options.preview); + return true; + } + else { + + // Hide the preview. + this.elements.preview.hide(); + } + } + + return false; +}; + +/** + * Hide or show certain elements based on the state of the busy and big play + * button. + */ +minplayer.playLoader.prototype.checkVisibility = function() { + + // Ignore if disabled. + if (!this.enabled) { + return; + } + + // Hide or show the busy cursor based on the flags. + if (this.busy.flag) { + this.elements.busy.show(); + } + else { + this.elements.busy.hide(); + } + + // Hide or show the big play button based on the flags. + if (this.bigPlay.flag) { + this.elements.bigPlay.show(); + } + else { + this.elements.bigPlay.hide(); + } + + if (this.previewFlag.flag) { + this.elements.preview.show(); + } + else { + this.elements.preview.hide(); + } + + // Show the control either flag is set. + if (this.bigPlay.flag || this.busy.flag || this.previewFlag.flag) { + this.display.show(); + } + + // Hide the whole control if both flags are 0. + if (!this.bigPlay.flag && !this.busy.flag && !this.previewFlag.flag) { + this.display.hide(); + } +}; +/** The minplayer namespace. */ +var minplayer = minplayer || {}; + +/** All the media player implementations */ +minplayer.players = minplayer.players || {}; + +/** + * @constructor + * @extends minplayer.display + * @class The base media player class where all media players derive from. + * + * @param {object} context The jQuery context. + * @param {object} options This components options. + * @param {object} queue The event queue to pass events around. + */ +minplayer.players.base = function(context, options, queue) { + + // Derive from display + minplayer.display.call(this, 'media', context, options, queue); +}; + +/** Derive from minplayer.display. */ +minplayer.players.base.prototype = new minplayer.display(); + +/** Reset the constructor. */ +minplayer.players.base.prototype.constructor = minplayer.players.base; + +/** + * @see minplayer.display.getElements + * @this minplayer.players.base + * @return {object} The elements for this display. + */ +minplayer.players.base.prototype.getElements = function() { + var elements = minplayer.display.prototype.getElements.call(this); + return jQuery.extend(elements, { + media: this.options.mediaelement + }); +}; + + +/** + * Get the default options for this plugin. + * + * @param {object} options The default options for this plugin. + */ +minplayer.players.base.prototype.defaultOptions = function(options) { + options.range = {min: 0, max: 0}; + minplayer.display.prototype.defaultOptions.call(this, options); +}; + +/** + * Get the priority of this media player. + * + * @param {object} file A {@link minplayer.file} object. + * @return {number} The priority of this media player. + */ +minplayer.players.base.getPriority = function(file) { + return 0; +}; + +/** + * Returns the ID for the media being played. + * + * @param {object} file A {@link minplayer.file} object. + * @return {string} The ID for the provided media. + */ +minplayer.players.base.getMediaId = function(file) { + return ''; +}; + +/** + * Determine if we can play the media file. + * + * @param {object} file A {@link minplayer.file} object. + * @return {boolean} If this player can play this media type. + */ +minplayer.players.base.canPlay = function(file) { + return false; +}; + +/** + * @see minplayer.plugin.construct + * @this minplayer.players.base + */ +minplayer.players.base.prototype.construct = function() { + + // Call the media display constructor. + minplayer.display.prototype.construct.call(this); + + // Set the poster if it exists. + if (this.elements.media) { + this.poster = this.elements.media.attr('poster'); + } + + // Set the plugin name within the options. + this.options.pluginName = 'basePlayer'; + + /** The ready queue for this player. */ + this.readyQueue = []; + this.loadedQueue = []; + + /** The currently loaded media file. */ + this.mediaFile = this.options.file; + + // Clear the media player. + this.clear(); + + // Now setup the media player. + this.setupPlayer(); +}; + +/** + * Sets up a new media player. + */ +minplayer.players.base.prototype.setupPlayer = function() { + + // Get the player display object. + if (!this.playerFound()) { + + // Add the new player. + this.addPlayer(); + } + + // Get the player object... + this.player = this.getPlayer(); + + // Toggle playing if they click. + minplayer.click(this.display, (function(player) { + return function() { + if (player.playing) { + player.pause(); + } + else { + player.play(); + } + }; + })(this)); + + // Bind to key events... + jQuery(document).bind('keydown', (function(player) { + return function(event) { + if (player.hasFocus) { + event.preventDefault(); + switch (event.keyCode) { + case 32: // SPACE + case 179: // GOOGLE play/pause button. + if (player.playing) { + player.pause(); + } + else { + player.play(); + } + break; + case 38: // UP + player.setVolumeRelative(0.1); + break; + case 40: // DOWN + player.setVolumeRelative(-0.1); + break; + case 37: // LEFT + case 227: // GOOGLE TV REW + player.seekRelative(-0.05); + break; + case 39: // RIGHT + case 228: // GOOGLE TV FW + player.seekRelative(0.05); + break; + } + } + }; + })(this)); +}; + +/** + * Adds the media player. + */ +minplayer.players.base.prototype.addPlayer = function() { + + // Remove the media element if found + if (this.elements.media) { + this.elements.media.remove(); + } + + // Create a new media player element. + this.elements.media = jQuery(this.createPlayer()); + this.display.html(this.elements.media); +}; + +/** + * @see minplayer.plugin.destroy. + */ +minplayer.players.base.prototype.destroy = function() { + minplayer.plugin.prototype.destroy.call(this); + this.clear(); +}; + +/** + * Clears the media player. + */ +minplayer.players.base.prototype.clear = function() { + + // Reset the ready flag. + this.playerReady = false; + + // Reset the player. + this.reset(); + + // If the player exists, then unbind all events. + if (this.player) { + jQuery(this.player).remove(); + this.player = null; + } +}; + +/** + * Resets all variables. + */ +minplayer.players.base.prototype.reset = function() { + + // The duration of the player. + this.realDuration = 0; + this.duration = new minplayer.async(); + + // The current play time of the player. + this.currentTime = new minplayer.async(); + + // The amount of bytes loaded in the player. + this.bytesLoaded = new minplayer.async(); + + // The total amount of bytes for the media. + this.bytesTotal = new minplayer.async(); + + // The bytes that the download started with. + this.bytesStart = new minplayer.async(); + + // The current volume of the player. + this.volume = new minplayer.async(); + + // Reset focus. + this.hasFocus = false; + + // We are not playing. + this.playing = false; + + // We are not loading. + this.loading = false; + + // If we are loaded. + this.loaded = false; + + // Tell everyone else we reset. + this.trigger('pause', null, true); + this.trigger('waiting', null, true); + this.trigger('progress', {loaded: 0, total: 0, start: 0}, true); + this.trigger('timeupdate', {currentTime: 0, duration: 0}, true); +}; + +/** + * Called when the player is ready to recieve events and commands. + */ +minplayer.players.base.prototype.onReady = function() { + + // Only continue if we are not already ready. + if (this.playerReady) { + return; + } + + // Set the start and stop of the player. + this.setStartStop(); + + // Set the ready flag. + this.playerReady = true; + + // Set the volume to the default. + this.setVolume(this.options.volume / 100); + + // Setup the progress interval. + this.loading = true; + + // Create a poll to get the progress. + this.poll('progress', (function(player) { + return function() { + + // Only do this if the play interval is set. + if (player.loading) { + + // Get the bytes loaded asynchronously. + player.getBytesLoaded(function(bytesLoaded) { + + // Get the bytes total asynchronously. + player.getBytesTotal(function(bytesTotal) { + + // Trigger an event about the progress. + if (bytesLoaded || bytesTotal) { + + // Get the bytes start, but don't require it. + var bytesStart = 0; + player.getBytesStart(function(val) { + bytesStart = val; + }); + + // Trigger a progress event. + player.trigger('progress', { + loaded: bytesLoaded, + total: bytesTotal, + start: bytesStart + }); + + // Say we are not longer loading if they are equal. + if (bytesLoaded >= bytesTotal) { + player.loading = false; + } + } + }); + }); + } + + // Keep polling as long as its loading... + return player.loading; + }; + })(this), 1000); + + // We are now ready. + this.ready(); + + // Make sure the player is ready or errors will occur. + if (this.isReady()) { + + // Iterate through our ready queue. + for (var i in this.readyQueue) { + this.readyQueue[i].call(this); + } + + // Empty the ready queue. + this.readyQueue.length = 0; + this.readyQueue = []; + + if (!this.loaded) { + + // If we are still loading, then trigger that the load has started. + this.trigger('loadstart'); + } + } + else { + + // Empty the ready queue. + this.readyQueue.length = 0; + this.readyQueue = []; + } +}; + +/** + * Parses a time value into seconds. + * + * @param string time + * The time to parse to seconds. + * + * @returns {number} + * The number of seconds this time represents. + */ +minplayer.players.base.prototype.parseTime = function(time) { + var seconds = 0, minutes = 0, hours = 0; + + if (!time) { + return 0; + } + + // Convert to string if we need to. + if (typeof time != 'string') { + time = String(time); + } + + // Get the seconds. + seconds = time.match(/([0-9]+)s/i); + if (seconds) { + seconds = parseInt(seconds[1], 10); + } + + // Get the minutes. + minutes = time.match(/([0-9]+)m/i); + if (minutes) { + seconds += (parseInt(minutes[1], 10) * 60); + } + + // Get the hours. + hours = time.match(/([0-9]+)h/i); + if (hours) { + seconds += (parseInt(hours[1], 10) * 3600); + } + + // If no seconds were found, then just use the raw value. + if (!seconds) { + seconds = time; + } + + // Return the seconds from the time. + return Number(seconds); +}; + +/** + * Sets the start and stop points for the media. + * + * @return {number} The number of seconds we should seek. + */ +minplayer.players.base.prototype.setStartStop = function() { + if (this.startTime) { + return this.startTime; + } + + this.startTime = 0; + this.offsetTime = this.parseTime(this.options.range.min); + + // First check the url for the seek time. + if (minplayer.urlVars) { + this.startTime = this.parseTime(minplayer.urlVars.seek); + } + + // Then check the options range parameter. + if (!this.startTime) { + this.startTime = this.offsetTime; + } + + // Get the stop time. + this.stopTime = this.options.range.max ? this.parseTime(this.options.range.max) : 0; + + // Calculate the range. + this.mediaRange = this.stopTime - this.offsetTime; + if (this.mediaRange < 0) { + this.mediaRange = 0; + } + + // Return the start time. + return this.startTime; +}; + +/** + * Should be called when the media is playing. + */ +minplayer.players.base.prototype.onPlaying = function() { + + // See if we need to autoseek. + if (!this.playing) { + var self = this; + this.getDuration(function(duration) { + if (self.startTime && (self.startTime < duration)) { + self.seek(self.startTime, null, true); + if (self.options.autoplay) { + self.play(); + } + } + }); + } + + // Trigger an event that we are playing. + this.trigger('playing'); + + // Say that this player has focus. + this.hasFocus = true; + + // Set the playInterval to true. + this.playing = true; + this.loaded = true; + + // Create a poll to get the timeupate. + this.poll('timeupdate', (function(player) { + return function() { + + // Only do this if the play interval is set. + if (player.playing) { + + // Get the current time asyncrhonously. + player.getCurrentTime(function(currentTime) { + + // Get the duration asynchronously. + player.getDuration(function(duration) { + + // Convert these to floats. + currentTime = parseFloat(currentTime); + duration = parseFloat(duration); + + // Trigger an event about the progress. + if (currentTime || duration) { + + // Trigger an update event. + player.trigger('timeupdate', { + currentTime: currentTime, + duration: duration + }); + } + }); + }); + } + + // Keep polling as long as it is playing. + return player.playing; + }; + })(this), 500); +}; + +/** + * Should be called when the media is paused. + */ +minplayer.players.base.prototype.onPaused = function() { + + // Trigger an event that we are paused. + this.trigger('pause'); + + // Remove focus. + this.hasFocus = false; + + // Say we are not playing. + this.playing = false; +}; + +/** + * Should be called when the media is complete. + */ +minplayer.players.base.prototype.onComplete = function() { + if (this.playing) { + this.onPaused(); + } + + // Stop the intervals. + this.playing = false; + this.loading = false; + this.hasFocus = false; + this.trigger('ended'); +}; + +/** + * Should be called when the media is done loading. + */ +minplayer.players.base.prototype.onLoaded = function() { + + // See if we are loaded. + var isLoaded = this.loaded; + + // Iterate through our ready queue. + for (var i in this.loadedQueue) { + this.loadedQueue[i].call(this); + } + + // Empty the loaded queue. + this.loadedQueue.length = 0; + this.loadedQueue = []; + + // If we should autoplay, then just play now. + if (!this.loaded && this.options.autoplay) { + this.play(); + } + + // We are now loaded. + this.loaded = true; + + // Trigger this event. + this.trigger('loadeddata'); +}; + +/** + * Should be called when the player is waiting. + */ +minplayer.players.base.prototype.onWaiting = function() { + this.trigger('waiting'); +}; + +/** + * Called when an error occurs. + * + * @param {string} errorCode The error that was triggered. + */ +minplayer.players.base.prototype.onError = function(errorCode) { + this.hasFocus = false; + this.trigger('error', errorCode); +}; + +/** + * @see minplayer.players.base#isReady + * @return {boolean} Checks to see if the Flash is ready. + */ +minplayer.players.base.prototype.isReady = function() { + + // Return that the player is set and the ready flag is good. + return (this.player && this.playerReady); +}; + +/** + * Calls the callback when this player is ready. + * + * @param {function} callback Called when it is done performing this operation. + */ +minplayer.players.base.prototype.whenReady = function(callback) { + + // If the player is ready, then call the callback. + if (this.isReady()) { + callback.call(this); + } + else { + + // Add this to the ready queue. + this.readyQueue.push(callback); + } +}; + +/** + * Calls the callback when this player is loaded. + * + * @param {function} callback Called when it is done performing this operation. + */ +minplayer.players.base.prototype.whenLoaded = function(callback) { + + // If the player is loaded, then call the callback. + if (this.loaded) { + callback.call(this); + } + else { + + // Add this to the loaded queue. + this.loadedQueue.push(callback); + } +}; + +/** + * Determines if the player should show the playloader. + * + * @param {string} preview The preview image. + * @return {bool} If this player implements its own playLoader. + */ +minplayer.players.base.prototype.hasPlayLoader = function(preview) { + return false; +}; + +/** + * Determines if the player should show the controller. + * + * @return {bool} If this player implements its own controller. + */ +minplayer.players.base.prototype.hasController = function() { + return false; +}; + +/** + * Returns if the media player is already within the DOM. + * + * @return {boolean} TRUE - if the player is in the DOM, FALSE otherwise. + */ +minplayer.players.base.prototype.playerFound = function() { + return false; +}; + +/** + * Creates the media player and inserts it in the DOM. + * + * @return {object} The media player entity. + */ +minplayer.players.base.prototype.createPlayer = function() { + this.reset(); + return null; +}; + +/** + * Returns the media player object. + * + * @return {object} The media player object. + */ +minplayer.players.base.prototype.getPlayer = function() { + return this.player; +}; + +/** + * Loads a new media player. + * + * @param {object} file A {@link minplayer.file} object. + * @param {function} callback Called when it is done performing this operation. + */ +minplayer.players.base.prototype.load = function(file, callback) { + + // Store the media file for future lookup. + var isString = (typeof this.mediaFile === 'string'); + var path = isString ? this.mediaFile : this.mediaFile.path; + if (file && (file.path !== path)) { + + // If the player is not ready, then setup. + if (!this.isReady()) { + this.setupPlayer(); + } + + // Reset the media and set the media file. + this.reset(); + this.mediaFile = file; + if (callback) { + callback.call(this); + } + } + + // We still want to play the song if it isn't playing but has autoplay enabled. + else if (this.options.autoplay && !this.playing) { + this.play(); + } + else { + + // Seek to the beginning. + this.seek(0, function() { + this.pause(); + this.trigger('progress', {loaded: 0, total: 0, start: 0}, true); + this.trigger('timeupdate', {currentTime: 0, duration: 0}, true); + }); + } +}; + +/** + * Play the loaded media file. + * + * @param {function} callback Called when it is done performing this operation. + */ +minplayer.players.base.prototype.play = function(callback) { + this.options.autoload = true; + if (typeof this.options.originalAutoPlay == 'undefined') { + this.options.originalAutoPlay = this.options.autoplay; + } + this.options.autoplay = true; + this.whenLoaded(callback); +}; + +/** + * Pause the loaded media file. + * + * @param {function} callback Called when it is done performing this operation. + */ +minplayer.players.base.prototype.pause = function(callback) { + this.whenLoaded(callback); +}; + +/** + * Stop the loaded media file. + * + * @param {function} callback Called when it is done performing this operation. + */ +minplayer.players.base.prototype.stop = function(callback) { + this.playing = false; + this.loading = false; + this.hasFocus = false; + this.whenLoaded(callback); +}; + +/** + * Seeks to relative position. + * + * @param {number} pos Relative position. -1 to 1 (percent), > 1 (seconds). + */ +minplayer.players.base.prototype.seekRelative = function(pos) { + + // Get the current time asyncrhonously. + this.getCurrentTime((function(player) { + return function(currentTime) { + + // Get the duration asynchronously. + player.getDuration(function(duration) { + + // Only do this if we have a duration. + if (duration) { + + // Get the position. + var seekPos = 0; + if ((pos > -1) && (pos < 1)) { + seekPos = ((currentTime / duration) + parseFloat(pos)) * duration; + } + else { + seekPos = (currentTime + parseFloat(pos)); + } + + // Set the seek value. + player.seek(seekPos); + } + }); + }; + })(this)); +}; + +/** + * Seek the loaded media. + * + * @param {number} pos The position to seek the minplayer. 0 to 1. + * @param {function} callback Called when it is done performing this operation. + */ +minplayer.players.base.prototype.seek = function(pos, callback, noOffset) { + this.whenLoaded(function() { + pos = Number(pos); + if (!noOffset) { + pos += this.offsetTime; + } + this._seek(pos); + if (callback) { + callback.call(this); + } + }); +}; + +minplayer.players.base.prototype._seek = function(pos) {}; + +/** + * Set the volume of the loaded minplayer. + * + * @param {number} vol -1 to 1 - The relative amount to increase or decrease. + */ +minplayer.players.base.prototype.setVolumeRelative = function(vol) { + + // Get the volume + this.getVolume((function(player) { + return function(newVol) { + newVol += parseFloat(vol); + newVol = (newVol < 0) ? 0 : newVol; + newVol = (newVol > 1) ? 1 : newVol; + player.setVolume(newVol); + }; + })(this)); +}; + +/** + * Set the volume of the loaded minplayer. + * + * @param {number} vol The volume to set the media. 0 to 1. + * @param {function} callback Called when it is done performing this operation. + */ +minplayer.players.base.prototype.setVolume = function(vol, callback) { + this.trigger('volumeupdate', vol); + this.whenLoaded(callback); +}; + +/** + * Gets a value from the player. + * + * @param {string} getter The getter method on the player. + * @param {string} prop The property to use when getting. + * @param {function} callback The callback function. + */ +minplayer.players.base.prototype.getValue = function(method, prop, callback) { + this.whenLoaded(function() { + var self = this; + this[method](function(value) { + if (value !== null) { + callback.call(self, value); + } + else { + self[prop].get(callback); + } + }); + }); +}; + +/** + * Get the volume from the loaded media. + * + * @param {function} callback Called when the volume is determined. + * @return {number} The volume of the media; 0 to 1. + */ +minplayer.players.base.prototype.getVolume = function(callback) { + this.getValue('_getVolume', 'volume', callback); +}; + +/** + * Implemented by the players to get the current time. + * + * @param callback + * @private + */ +minplayer.players.base.prototype._getVolume = function(callback) { + callback(null); +}; + +/** + * Get the current time for the media being played. + * + * @param {function} callback Called when the time is determined. + * @return {number} The volume of the media; 0 to 1. + */ +minplayer.players.base.prototype.getCurrentTime = function(callback) { + var self = this; + this.getValue('_getCurrentTime', 'currentTime', function(currentTime) { + self.setStartStop(); + if (self.stopTime && (currentTime > self.stopTime)) { + self.stop(function() { + self.onComplete(); + }); + } + currentTime -= self.offsetTime; + callback(currentTime); + }); +}; + +/** + * Implemented by the players to get the current time. + * + * @param callback + * @private + */ +minplayer.players.base.prototype._getCurrentTime = function(callback) { + callback(null); +}; + +/** + * Return the duration of the loaded media. + * + * @param {function} callback Called when the duration is determined. + * @return {number} The duration of the loaded media. + */ +minplayer.players.base.prototype.getDuration = function(callback) { + if (this.options.duration) { + callback(this.options.duration); + } + else { + var self = this; + this.getValue('_getDuration', 'duration', function(duration) { + self.setStartStop(); + self.realDuration = duration; + callback(self.mediaRange ? self.mediaRange : duration); + }); + } +}; + +/** + * Implemented by the players to get the duration. + * + * @param callback + * @private + */ +minplayer.players.base.prototype._getDuration = function(callback) { + callback(null); +}; + +/** + * Return the start bytes for the loaded media. + * + * @param {function} callback Called when the start bytes is determined. + * @return {int} The bytes that were started. + */ +minplayer.players.base.prototype.getBytesStart = function(callback) { + this.getValue('_getBytesStart', 'bytesStart', callback); +}; + +/** + * Implemented by the players to get the start bytes. + * + * @param callback + * @private + */ +minplayer.players.base.prototype._getBytesStart = function(callback) { + callback(null); +}; + +/** + * Return the bytes of media loaded. + * + * @param {function} callback Called when the bytes loaded is determined. + * @return {int} The amount of bytes loaded. + */ +minplayer.players.base.prototype.getBytesLoaded = function(callback) { + this.getValue('_getBytesLoaded', 'bytesLoaded', callback); +}; + +/** + * Implemented by the players to get the loaded bytes. + * + * @param callback + * @private + */ +minplayer.players.base.prototype._getBytesLoaded = function(callback) { + callback(null); +}; + +/** + * Return the total amount of bytes. + * + * @param {function} callback Called when the bytes total is determined. + * @return {int} The total amount of bytes for this media. + */ +minplayer.players.base.prototype.getBytesTotal = function(callback) { + this.getValue('_getBytesTotal', 'bytesTotal', callback); +}; + +/** + * Implemented by the players to get the total bytes. + * + * @param callback + * @private + */ +minplayer.players.base.prototype._getBytesTotal = function(callback) { + callback(null); +}; +/*jshint maxlen:90 */ + +/** The minplayer namespace. */ +var minplayer = minplayer || {}; + +/** All the media player implementations */ +minplayer.players = minplayer.players || {}; + +/** + * @constructor + * @extends minplayer.players.base + * @class The Dailymotion media player. + * + * @param {object} context The jQuery context. + * @param {object} options This components options. + * @param {object} queue The event queue to pass events around. + */ +minplayer.players.dailymotion = function(context, options, queue) { + + /** The quality of the Dailymotion stream. */ + this.quality = 'default'; + + // Derive from players base. + minplayer.players.base.call(this, context, options, queue); +}; + +/** Derive from minplayer.players.base. */ +minplayer.players.dailymotion.prototype = new minplayer.players.base(); + +/** Reset the constructor. */ +minplayer.players.dailymotion.prototype.constructor = minplayer.players.dailymotion; + +/** + * @see minplayer.plugin.construct + * @this minplayer.players.dailymotion + */ +minplayer.players.dailymotion.prototype.construct = function() { + + // Call the players.flash constructor. + minplayer.players.base.prototype.construct.call(this); + + // Set the plugin name within the options. + this.options.pluginName = 'dailymotion'; +}; + +/** + * @see minplayer.players.base#getPriority + * @param {object} file A {@link minplayer.file} object. + * @return {number} The priority of this media player. + */ +minplayer.players.dailymotion.getPriority = function(file) { + return 10; +}; + +/** + * @see minplayer.players.base#canPlay + * + * @param {object} file A {@link minplayer.file} object. + * @return {boolean} If this player can play this media type. + */ +minplayer.players.dailymotion.canPlay = function(file) { + + // Check for the mimetype for dailymotion. + if (file.mimetype === 'video/dailymotion') { + return true; + } + + // If the path is a Dailymotion path, then return true. + var regex = /^http(s)?\:\/\/(www\.)?(dailymotion\.com)/i; + return (file.path.search(regex) === 0); +}; + +/** + * Return the ID for a provided media file. + * + * @param {object} file A {@link minplayer.file} object. + * @return {string} The ID for the provided media. + */ +minplayer.players.dailymotion.getMediaId = function(file) { + var regex = '^http[s]?\\:\\/\\/(www\\.)?'; + regex += '(dailymotion\\.com\\/video/)'; + regex += '([a-z0-9\\-]+)'; + regex += '_*'; + var reg = RegExp(regex, 'i'); + + // Locate the media id. + if (file.path.search(reg) === 0) { + return file.path.match(reg)[3]; + } + else { + return file.path; + } +}; + +/** + * Returns a preview image for this media player. + * + * @param {object} file A {@link minplayer.file} object. + * @param {string} type The type of image. + * @param {function} callback Called when the image is retrieved. + */ +minplayer.players.dailymotion.getImage = function(file, type, callback) { + callback('http://www.dailymotion.com/thumbnail/video/' + file.id); +}; + +/** + * Parse a single playlist node. + * + * @param {object} item The dailymotion item. + * @return {object} The mediafront node. + */ +minplayer.players.dailymotion.parseNode = function(item) { + return { + title: node.title, + description: node.description, + mediafiles: { + image: { + 'thumbnail': { + path: node.thumbnail_small_url + }, + 'image': { + path: node.thumbnail_url + } + }, + media: { + 'media': { + player: 'dailymotion', + id: node.id + } + } + } + }; +}; + +/** + * Returns information about this dailymotion video. + * + * @param {object} file The file to load. + * @param {function} callback Called when the node is loaded. + */ +minplayer.players.dailymotion.getNode = function(file, callback) { + + var url = 'https://api.dailymotion.com/video/' + file.id; + url += '?fields=title,id,description,thumbnail_small_url,thumbnail_url'; + jQuery.get(url, function(data) { + callback(minplayer.players.dailymotion.parseNode(data.data)); + }, 'jsonp'); +}; + +/** + * Called when an API is loaded and ready. + * + * @param {string} event The onReady event that was triggered. + */ +minplayer.players.dailymotion.prototype.onReady = function(event) { + minplayer.players.base.prototype.onReady.call(this); + if (!this.options.autoplay) { + this.pause(); + } + this.onLoaded(); +}; + +/** + * Checks to see if this player can be found. + * @return {bool} TRUE - Player is found, FALSE - otherwise. + */ +minplayer.players.dailymotion.prototype.playerFound = function() { + return (this.display.find(this.mediaFile.type).length > 0); +}; + +/** + * Called when the player quality changes. + * + * @param {string} newQuality The new quality for the change. + */ +minplayer.players.dailymotion.prototype.onQualityChange = function(newQuality) { + this.quality = newQuality.data; +}; + +/** + * Determines if the player should show the playloader. + * + * @param {string} preview The preview image. + * @return {bool} If this player implements its own playLoader. + */ +minplayer.players.dailymotion.prototype.hasPlayLoader = function(preview) { + return minplayer.hasTouch || !preview; +}; + +/** + * Determines if the player should show the controller. + * + * @return {bool} If this player implements its own playLoader. + */ +minplayer.players.dailymotion.prototype.hasController = function() { + return minplayer.isIDevice; +}; + +/** + * @see minplayer.players.base#create + * @return {object} The media player entity. + */ +minplayer.players.dailymotion.prototype.createPlayer = function() { + minplayer.players.base.prototype.createPlayer.call(this); + + // Insert the Dailymotion iframe API player. + var dailymotion_script = document.location.protocol; + dailymotion_script += '//api.dmcdn.net/all.js'; + if (jQuery('script[src="' + dailymotion_script + '"]').length === 0) { + var tag = document.createElement('script'); + tag.src = dailymotion_script; + var firstScriptTag = document.getElementsByTagName('script')[0]; + firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); + } + + // Get the player ID. + this.playerId = this.options.id + '-player'; + + // Poll until the Dailymotion API is ready. + this.poll(this.options.id + '_dailymotion', (function(player) { + return function() { + var ready = jQuery('#' + player.playerId).length > 0; + ready = ready && ('DM' in window); + ready = ready && (typeof DM.player === 'function'); + if (ready) { + // Determine the origin of this script. + jQuery('#' + player.playerId).addClass('dailymotion-player'); + + var params = {}; + params = { + id: player.playerId, + api: minplayer.isIDevice ? 0 : 1, + wmode: 'opaque', + controls: minplayer.isAndroid ? 1 : 0, + related: 0, + info: 0, + logo: 0 + }; + + + // Create the player. + player.player = new DM.player(player.playerId, { + video: player.mediaFile.id, + height: '100%', + width: '100%', + frameborder: 0, + params: params + }); + + player.player.addEventListener('apiready', function() { + player.onReady(player); + }); + player.player.addEventListener('ended', function() { + player.onComplete(player); + }); + player.player.addEventListener('playing', function() { + player.onPlaying(player); + }); + player.player.addEventListener('progress', function() { + player.onWaiting(player); + }); + player.player.addEventListener('pause', function() { + player.onPaused(player); + }); + player.player.addEventListener('error', function() { + player.onError(player); + }); + } + return !ready; + }; + })(this), 200); + + // Return the player. + return jQuery(document.createElement('div')).attr({ + id: this.playerId + }); +}; + +/** + * @see minplayer.players.base#load + */ +minplayer.players.dailymotion.prototype.load = function(file, callback) { + minplayer.players.base.prototype.load.call(this, file, function() { + this.player.load(file.id); + if (callback) { + callback.call(this); + } + }); +}; + +/** + * @see minplayer.players.base#play + */ +minplayer.players.dailymotion.prototype.play = function(callback) { + minplayer.players.base.prototype.play.call(this, function() { + this.onWaiting(); + this.player.play(); + if (callback) { + callback.call(this); + } + }); +}; + +/** + * @see minplayer.players.base#pause + */ +minplayer.players.dailymotion.prototype.pause = function(callback) { + minplayer.players.base.prototype.pause.call(this, function() { + if (this.loaded) { + this.player.pause(); + if (callback) { + callback.call(this); + } + } + }); +}; + +/** + * @see minplayer.players.base#stop + */ +minplayer.players.dailymotion.prototype.stop = function(callback) { + minplayer.players.base.prototype.stop.call(this, function() { + this.player.pause(); + if (callback) { + callback.call(this); + } + }); +}; + +/** + * @see minplayer.players.base#_seek + */ +minplayer.players.dailymotion.prototype._seek = function(pos) { + this.onWaiting(); + this.player.seek(pos); +}; + +/** + * @see minplayer.players.base#setVolume + */ +minplayer.players.dailymotion.prototype.setVolume = function(vol, callback) { + minplayer.players.base.prototype.setVolume.call(this, vol, function() { + if (this.loaded) { + this.player.setVolume(vol); + if (callback !== undefined) { + callback.call(this); + } + } + }); + +}; + +/** + * @see minplayer.players.base#_getVolume + */ +minplayer.players.dailymotion.prototype._getVolume = function(callback) { + callback(this.player.volume); +}; + +/** + * @see minplayer.players.base#_getDuration. + */ +minplayer.players.dailymotion.prototype._getDuration = function(callback) { + callback(this.player.duration); +}; + +/** + * @see minplayer.players.base#_getCurrentTime + */ +minplayer.players.dailymotion.prototype._getCurrentTime = function(callback) { + callback(this.player.currentTime); +}; +/** The minplayer namespace. */ +var minplayer = minplayer || {}; + +/** All the media player implementations */ +minplayer.players = minplayer.players || {}; + +/** + * @constructor + * @extends minplayer.display + * @class The HTML5 media player implementation. + * + * @param {object} context The jQuery context. + * @param {object} options This components options. + * @param {object} queue The event queue to pass events around. + */ +minplayer.players.html5 = function(context, options, queue) { + + // Derive players base. + minplayer.players.base.call(this, context, options, queue); +}; + +/** Derive from minplayer.players.base. */ +minplayer.players.html5.prototype = new minplayer.players.base(); + +/** Reset the constructor. */ +minplayer.players.html5.prototype.constructor = minplayer.players.html5; + +/** + * @see minplayer.players.base#getPriority + * @param {object} file A {@link minplayer.file} object. + * @return {number} The priority of this media player. + */ +minplayer.players.html5.getPriority = function(file) { + return 10; +}; + +/** + * @see minplayer.players.base#canPlay + * + * @param {object} file A {@link minplayer.file} object. + * @return {boolean} If this player can play this media type. + */ +minplayer.players.html5.canPlay = function(file) { + switch (file.mimetype) { + case 'video/ogg': + return !!minplayer.playTypes.videoOGG; + case 'video/mp4': + case 'video/x-mp4': + case 'video/m4v': + case 'video/x-m4v': + return !!minplayer.playTypes.videoH264; + case 'application/vnd.apple.mpegurl': + return !!minplayer.playTypes.videoMPEGURL; + case 'video/x-webm': + case 'video/webm': + case 'application/octet-stream': + return !!minplayer.playTypes.videoWEBM; + case 'audio/ogg': + return !!minplayer.playTypes.audioOGG; + case 'audio/mpeg': + return !!minplayer.playTypes.audioMP3; + case 'audio/mp4': + return !!minplayer.playTypes.audioMP4; + default: + return false; + } +}; + +/** + * @see minplayer.plugin.construct + */ +minplayer.players.html5.prototype.construct = function() { + + // Call base constructor. + minplayer.players.base.prototype.construct.call(this); + + // Set the plugin name within the options. + this.options.pluginName = 'html5'; + + // See when the player has ended. + this.hasEnded = false; + + // Add the player events. + this.addPlayerEvents(); +}; + +/** + * Adds a new player event. + * + * @param {string} type The type of event being fired. + * @param {function} callback Called when the event is fired. + */ +minplayer.players.html5.prototype.addPlayerEvent = function(type, callback) { + if (this.player) { + + // Add an event listener for this event type. + this.player.addEventListener(type, (function(player) { + + // Get the function name. + var func = type + 'Event'; + + // If the callback already exists, then remove it from the player. + if (player[func]) { + player.player.removeEventListener(type, player[func], false); + } + + // Create a new callback. + player[func] = function(event) { + callback.call(player, event); + }; + + // Return the callback. + return player[func]; + + })(this), false); + } +}; + +/** + * Add events. + * @return {boolean} If this action was performed. + */ +minplayer.players.html5.prototype.addPlayerEvents = function() { + + // Check if the player exists. + if (this.player) { + + this.addPlayerEvent('abort', function() { + this.trigger('abort'); + }); + this.addPlayerEvent('loadstart', function() { + this.onReady(); + if (!this.options.autoload) { + this.onLoaded(); + } + }); + this.addPlayerEvent('loadeddata', function() { + this.onLoaded(); + }); + this.addPlayerEvent('loadedmetadata', function() { + this.onLoaded(); + }); + this.addPlayerEvent('canplaythrough', function() { + this.onLoaded(); + }); + this.addPlayerEvent('ended', function() { + this.hasEnded = true; + this.onComplete(); + }); + this.addPlayerEvent('pause', function() { + this.onPaused(); + }); + this.addPlayerEvent('play', function() { + this.onPlaying(); + }); + this.addPlayerEvent('playing', function() { + this.onPlaying(); + }); + + var errorSent = false; + this.addPlayerEvent('error', function() { + if (!this.hasEnded && !errorSent && this.player) { + errorSent = true; + this.trigger('error', 'An error occured - ' + this.player.error.code); + } + }); + + this.addPlayerEvent('waiting', function() { + this.onWaiting(); + }); + this.addPlayerEvent('durationchange', function() { + if (this.player) { + this.duration.set(this.player.duration); + var self = this; + this.getDuration(function(duration) { + self.trigger('durationchange', {duration: duration}); + }); + } + }); + this.addPlayerEvent('progress', function(event) { + this.bytesTotal.set(event.total); + this.bytesLoaded.set(event.loaded); + }); + return true; + } + + return false; +}; + +/** + * @see minplayer.players.base#onReady + */ +minplayer.players.html5.prototype.onReady = function() { + minplayer.players.base.prototype.onReady.call(this); + + // Android just say we are loaded here. + if (minplayer.isAndroid) { + this.onLoaded(); + } + + // iOS devices are strange in that they don't autoload. + if (minplayer.isIDevice) { + setTimeout((function(player) { + return function() { + player.pause(); + player.onLoaded(); + }; + })(this), 1); + } +}; + +/** + * @see minplayer.players.base#playerFound + * @return {boolean} TRUE - if the player is in the DOM, FALSE otherwise. + */ +minplayer.players.html5.prototype.playerFound = function() { + return (this.display.find(this.mediaFile.type).length > 0); +}; + +/** + * @see minplayer.players.base#create + * @return {object} The media player entity. + */ +minplayer.players.html5.prototype.createPlayer = function() { + minplayer.players.base.prototype.createPlayer.call(this); + var element = jQuery(document.createElement(this.mediaFile.type)) + .attr(this.options.attributes) + .append( + jQuery(document.createElement('source')).attr({ + 'src': this.mediaFile.path + }) + ); + + // Fix the fluid width and height. + element.eq(0)[0].setAttribute('width', '100%'); + element.eq(0)[0].setAttribute('height', '100%'); + var option = this.options.autoload ? 'metadata' : 'none'; + option = minplayer.isIDevice ? 'metadata' : option; + element.eq(0)[0].setAttribute('preload', option); + + // Make sure that we trigger onReady if autoload is false. + if (!this.options.autoload) { + element.eq(0)[0].setAttribute('autobuffer', false); + } + + return element; +}; + +/** + * @see minplayer.players.base#getPlayer + * @return {object} The media player object. + */ +minplayer.players.html5.prototype.getPlayer = function() { + return this.elements.media.eq(0)[0]; +}; + +/** + * @see minplayer.players.base#load + * + * @param {object} file A {@link minplayer.file} object. + */ +minplayer.players.html5.prototype.load = function(file, callback) { + + // See if a load is even necessary. + minplayer.players.base.prototype.load.call(this, file, function() { + + // Reset the has ended flag. + this.hasEnded = false; + + // Get the current source. + var src = this.elements.media.attr('src'); + if (!src) { + src = jQuery('source', this.elements.media).eq(0).attr('src'); + } + + // Only swap out if the new file is different from the source. + if (src !== file.path) { + + // Add a new player. + this.addPlayer(); + + // Set the new player. + this.player = this.getPlayer(); + + // Add the events again. + this.addPlayerEvents(); + + // Change the source... + this.player.src = file.path; + if (callback) { + callback.call(this); + } + } + }); +}; + +/** + * @see minplayer.players.base#play + */ +minplayer.players.html5.prototype.play = function(callback) { + minplayer.players.base.prototype.play.call(this, function() { + this.player.play(); + if (callback) { + callback.call(this); + } + }); +}; + +/** + * @see minplayer.players.base#pause + */ +minplayer.players.html5.prototype.pause = function(callback) { + minplayer.players.base.prototype.pause.call(this, function() { + this.player.pause(); + if (callback) { + callback.call(this); + } + }); +}; + +/** + * @see minplayer.players.base#stop + */ +minplayer.players.html5.prototype.stop = function(callback) { + minplayer.players.base.prototype.stop.call(this, function() { + this.player.pause(); + if (callback) { + callback.call(this); + } + }); +}; + +/** + * Clears the media player. + */ +minplayer.players.html5.prototype.clear = function() { + minplayer.players.base.prototype.clear.call(this); + if (this.player) { + this.player.src = ''; + } +}; + +/** + * @see minplayer.players.base#_seek + */ +minplayer.players.html5.prototype._seek = function(pos) { + this.player.currentTime = pos; +}; + +/** + * @see minplayer.players.base#setVolume + */ +minplayer.players.html5.prototype.setVolume = function(vol, callback) { + minplayer.players.base.prototype.setVolume.call(this, vol, function() { + this.player.volume = vol; + if (callback) { + callback.call(this); + } + }); +}; + +/** + * @see minplayer.players.base#getVolume + */ +minplayer.players.html5.prototype._getVolume = function(callback) { + callback(this.player.volume); +}; + +/** + * @see minplayer.players.base#_getDuration + */ +minplayer.players.html5.prototype._getDuration = function(callback) { + callback(this.player.duration); +}; + +/** + * @see minplayer.players.base#getCurrentTime + */ +minplayer.players.html5.prototype._getCurrentTime = function(callback) { + callback(this.player.currentTime); +}; + +/** + * @see minplayer.players.base#_getBytesLoaded + */ +minplayer.players.html5.prototype._getBytesLoaded = function(callback) { + var loaded = 0; + + // Check several different possibilities. + if (this.bytesLoaded.value) { + loaded = this.bytesLoaded.value; + } + else if (this.player.buffered && + this.player.buffered.length > 0 && + this.player.buffered.end && + this.player.duration) { + loaded = this.player.buffered.end(0); + } + else if (this.player.bytesTotal !== undefined && + this.player.bytesTotal > 0 && + this.player.bufferedBytes !== undefined) { + loaded = this.player.bufferedBytes; + } + + // Return the loaded amount. + callback(loaded); +}; + +/** + * @see minplayer.players.base#_getBytesTotal + */ +minplayer.players.html5.prototype._getBytesTotal = function(callback) { + var total = 0; + + // Check several different possibilities. + if (this.bytesTotal.value) { + total = this.bytesTotal.value; + } + else if (this.player.buffered && + this.player.buffered.length > 0 && + this.player.buffered.end && + this.player.duration) { + total = this.player.duration; + } + else if (this.player.bytesTotal !== undefined && + this.player.bytesTotal > 0 && + this.player.bufferedBytes !== undefined) { + total = this.player.bytesTotal; + } + + // Return the loaded amount. + callback(total); +}; +/** The minplayer namespace. */ +var minplayer = minplayer || {}; + +/** All the media player implementations */ +minplayer.players = minplayer.players || {}; + +/** + * @constructor + * @extends minplayer.display + * @class The Flash media player class to control the flash fallback. + * + * @param {object} context The jQuery context. + * @param {object} options This components options. + * @param {object} queue The event queue to pass events around. + */ +minplayer.players.flash = function(context, options, queue) { + + // Derive from players base. + minplayer.players.base.call(this, context, options, queue); +}; + +/** Derive from minplayer.players.base. */ +minplayer.players.flash.prototype = new minplayer.players.base(); + +/** Reset the constructor. */ +minplayer.players.flash.prototype.constructor = minplayer.players.flash; + +/** + * @see minplayer.plugin.construct + * @this minplayer.players.flash + */ +minplayer.players.flash.prototype.construct = function() { + + // Call the players.base constructor. + minplayer.players.base.prototype.construct.call(this); + + // Set the plugin name within the options. + this.options.pluginName = 'flash'; +}; + +/** + * @see minplayer.players.base#getPriority + * + * @param {object} file A {@link minplayer.file} object. + * @return {number} The priority of this media player. + */ +minplayer.players.flash.getPriority = function(file) { + return 0; +}; + +/** + * @see minplayer.players.base#canPlay + * + * @param {object} file A {@link minplayer.file} object. + * @return {boolean} If this player can play this media type. + */ +minplayer.players.flash.canPlay = function(file) { + return false; +}; + +/** + * API to return the Flash player code provided params. + * + * @param {object} params The params used to populate the Flash code. + * @return {object} A Flash DOM element. + */ +minplayer.players.flash.prototype.getFlash = function(params) { + // Insert the swfobject javascript. + var tag = document.createElement('script'); + tag.src = '//ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js'; + var firstScriptTag = document.getElementsByTagName('script')[0]; + firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); + + // Create the swfobject. + setTimeout((function(player) { + return function tryAgain() { + if (typeof swfobject !== 'undefined') { + swfobject.embedSWF( + params.swf, + params.id, + params.width, + params.height, + '9.0.0', + false, + params.flashvars, + { + allowscriptaccess: 'always', + allowfullscreen: 'true', + wmode: params.wmode, + quality: 'high' + }, + { + id: params.id, + name: params.id, + playerType: 'flash' + }, + function(e) { + player.player = e.ref; + } + ); + } + else { + + // Try again after 200 ms. + setTimeout(tryAgain, 200); + } + }; + })(this), 200); + + // Return the div tag... + return '
'; +}; + +/** + * @see minplayer.players.base#playerFound + * @return {boolean} TRUE - if the player is in the DOM, FALSE otherwise. + */ +minplayer.players.flash.prototype.playerFound = function() { + return (this.display.find('object[playerType="flash"]').length > 0); +}; +/** The minplayer namespace. */ +var minplayer = minplayer || {}; + +/** All the media player implementations */ +minplayer.players = minplayer.players || {}; + +/** + * @constructor + * @extends minplayer.display + * @class The Flash media player class to control the flash fallback. + * + * @param {object} context The jQuery context. + * @param {object} options This components options. + * @param {object} queue The event queue to pass events around. + */ +minplayer.players.minplayer = function(context, options, queue) { + + // Derive from players flash. + minplayer.players.flash.call(this, context, options, queue); +}; + +/** Derive from minplayer.players.flash. */ +minplayer.players.minplayer.prototype = new minplayer.players.flash(); + +/** Reset the constructor. */ +minplayer.players.minplayer.prototype.constructor = minplayer.players.minplayer; + +/** + * @see minplayer.plugin.construct + * @this minplayer.players.minplayer + */ +minplayer.players.minplayer.prototype.construct = function() { + + // Call the players.flash constructor. + minplayer.players.flash.prototype.construct.call(this); + + // Set the plugin name within the options. + this.options.pluginName = 'minplayer'; +}; + +/** + * Called when the Flash player is ready. + * + * @param {string} id The media player ID. + */ +window.onFlashPlayerReady = function(id) { + var media = minplayer.get(id, 'media'); + var i = media.length; + while (i--) { + media[i].onReady(); + } +}; + +/** + * Called when the Flash player updates. + * + * @param {string} id The media player ID. + * @param {string} eventType The event type that was triggered. + */ +window.onFlashPlayerUpdate = function(id, eventType) { + var media = minplayer.get(id, 'media'); + var i = media.length; + while (i--) { + media[i].onMediaUpdate(eventType); + } +}; + +/** + * Used to debug from the Flash player to the browser console. + * + * @param {string} debug The debug string. + */ +window.onFlashPlayerDebug = function(debug) { + if (console && console.log) { + console.log(debug); + } +}; + +/** + * @see minplayer.players.base#getPriority + * @param {object} file A {@link minplayer.file} object. + * @return {number} The priority of this media player. + */ +minplayer.players.minplayer.getPriority = function(file) { + // Force this player if the stream is set. + return file.stream ? 100 : 1; +}; + +/** + * @see minplayer.players.base#canPlay + * + * @param {object} file A {@link minplayer.file} object. + * @return {boolean} If this player can play this media type. + */ +minplayer.players.minplayer.canPlay = function(file) { + + // If this has a stream, then the minplayer must play it. + if (file.stream) { + return true; + } + + var isWEBM = jQuery.inArray(file.mimetype, [ + 'video/x-webm', + 'video/webm', + 'application/octet-stream' + ]) >= 0; + return !isWEBM && (file.type === 'video' || file.type === 'audio'); +}; + +/** + * @see minplayer.players.base#create + * @return {object} The media player entity. + */ +minplayer.players.minplayer.prototype.createPlayer = function() { + + // Make sure we provide default swfplayer... + if (!this.options.swfplayer) { + this.options.swfplayer = 'http://mediafront.org/assets/osmplayer/minplayer'; + this.options.swfplayer += '/flash/minplayer.swf'; + } + + minplayer.players.flash.prototype.createPlayer.call(this); + + // The flash variables for this flash player. + var flashVars = { + 'id': this.options.id, + 'debug': this.options.debug, + 'config': 'nocontrols', + 'file': this.mediaFile.path, + 'autostart': this.options.autoplay, + 'autoload': this.options.autoload + }; + + // Add a stream if one is provided. + if (this.mediaFile.stream) { + flashVars.stream = this.mediaFile.stream; + } + + // Return a flash media player object. + return this.getFlash({ + swf: this.options.swfplayer, + id: this.options.id + '_player', + width: '100%', + height: '100%', + flashvars: flashVars, + wmode: this.options.wmode + }); +}; + +/** + * Called when the Flash player has an update. + * + * @param {string} eventType The event that was triggered in the player. + */ +minplayer.players.minplayer.prototype.onMediaUpdate = function(eventType) { + this.onReady(); + switch (eventType) { + case 'mediaMeta': + this.onLoaded(); + break; + case 'mediaConnected': + this.onLoaded(); + this.onPaused(); + break; + case 'mediaPlaying': + this.onPlaying(); + break; + case 'mediaPaused': + this.onPaused(); + break; + case 'mediaComplete': + this.onComplete(); + break; + } +}; + +/** + * Load the media in the minplayer. + * + * @param file + * @param callback + * @private + */ +minplayer.players.minplayer.prototype.load = function(file, callback) { + minplayer.players.flash.prototype.load.call(this, file, function() { + if (this.loaded) { + this.stop(function() { + this.player.loadMedia(file.path, file.stream); + if (callback) { + callback.call(this); + } + }); + } + else { + this.player.loadMedia(file.path, file.stream); + if (callback) { + callback.call(this); + } + } + }); +}; + +/** + * @see minplayer.players.base#play + */ +minplayer.players.minplayer.prototype.play = function(callback) { + minplayer.players.flash.prototype.play.call(this, function() { + this.player.playMedia(); + if (callback) { + callback.call(this); + } + }); +}; + +/** + * @see minplayer.players.base#pause + */ +minplayer.players.minplayer.prototype.pause = function(callback) { + minplayer.players.flash.prototype.pause.call(this, function() { + this.player.pauseMedia(); + if (callback) { + callback.call(this); + } + }); +}; + +/** + * @see minplayer.players.base#stop + */ +minplayer.players.minplayer.prototype.stop = function(callback) { + minplayer.players.flash.prototype.stop.call(this, function() { + this.player.stopMedia(); + if (callback) { + callback.call(this); + } + }); +}; + +/** + * @see minplayer.players.base#_seek + */ +minplayer.players.minplayer.prototype._seek = function(pos) { + this.player.seekMedia(pos); +}; + +/** + * @see minplayer.players.base#setVolume + */ +minplayer.players.minplayer.prototype.setVolume = function(vol, callback) { + minplayer.players.flash.prototype.setVolume.call(this, vol, function() { + this.player.setVolume(vol); + if (callback) { + callback.call(this); + } + }); +}; + +/** + * @see minplayer.players.base#getVolume + */ +minplayer.players.minplayer.prototype._getVolume = function(callback) { + callback(this.player.getVolume()); +}; + +/** + * @see minplayer.players.flash#getDuration + */ +minplayer.players.minplayer.prototype._getDuration = function(callback) { + var self = this, duration = 0; + var tryDuration = function() { + duration = self.player.getDuration(); + if (duration) { + callback(duration); + } + else { + setTimeout(tryDuration, 1000); + } + }; + tryDuration(); +}; + +/** + * @see minplayer.players.base#getCurrentTime + */ +minplayer.players.minplayer.prototype._getCurrentTime = function(callback) { + callback(this.player.getCurrentTime()); +}; + +/** + * @see minplayer.players.base#_getBytesLoaded + */ +minplayer.players.minplayer.prototype._getBytesLoaded = function(callback) { + callback(this.player.getMediaBytesLoaded()); +}; + +/** + * @see minplayer.players.base#_getBytesTotal. + */ +minplayer.players.minplayer.prototype._getBytesTotal = function(callback) { + callback(this.player.getMediaBytesTotal()); +}; +/** The minplayer namespace. */ +var minplayer = minplayer || {}; + +/** All the media player implementations */ +minplayer.players = minplayer.players || {}; + +/** + * @constructor + * @extends minplayer.players.base + * @class The YouTube media player. + * + * @param {object} context The jQuery context. + * @param {object} options This components options. + * @param {object} queue The event queue to pass events around. + */ +minplayer.players.youtube = function(context, options, queue) { + + /** The quality of the YouTube stream. */ + this.quality = 'default'; + + // Derive from players base. + minplayer.players.base.call(this, context, options, queue); +}; + +/** Derive from minplayer.players.base. */ +minplayer.players.youtube.prototype = new minplayer.players.base(); + +/** Reset the constructor. */ +minplayer.players.youtube.prototype.constructor = minplayer.players.youtube; + +/** + * @see minplayer.plugin.construct + * @this minplayer.players.youtube + */ +minplayer.players.youtube.prototype.construct = function() { + + // Call the players.flash constructor. + minplayer.players.base.prototype.construct.call(this); + + // Set the plugin name within the options. + this.options.pluginName = 'youtube'; +}; + +/** + * @see minplayer.players.base#getPriority + * + * @param {object} file A {@link minplayer.file} object. + * @return {number} The priority of this media player. + */ +minplayer.players.youtube.getPriority = function(file) { + return 10; +}; + +/** + * @see minplayer.players.base#canPlay + * + * @param {object} file A {@link minplayer.file} object. + * @return {boolean} If this player can play this media type. + */ +minplayer.players.youtube.canPlay = function(file) { + + // Check for the mimetype for youtube. + if (file.mimetype === 'video/youtube') { + return true; + } + + // If the path is a YouTube path, then return true. + var regex = /^http(s)?\:\/\/(www\.)?(youtube\.com|youtu\.be)/i; + return (file.path.search(regex) === 0); +}; + +/** + * Return the ID for a provided media file. + * + * @param {object} file A {@link minplayer.file} object. + * @return {string} The ID for the provided media. + */ +minplayer.players.youtube.getMediaId = function(file) { + var regex = '^http[s]?\\:\\/\\/(www\\.)?'; + regex += '(youtube\\.com\\/watch\\?v=|youtu\\.be\\/)'; + regex += '([a-zA-Z0-9_\\-]+)'; + var reg = RegExp(regex, 'i'); + + // Locate the media id. + if (file.path.search(reg) === 0) { + return file.path.match(reg)[3]; + } + else { + return file.path; + } +}; + +/** + * Returns a preview image for this media player. + * + * @param {object} file A {@link minplayer.file} object. + * @param {string} type The type of image. + * @param {function} callback Called when the image is retrieved. + */ +minplayer.players.youtube.getImage = function(file, type, callback) { + type = (type === 'thumbnail') ? '1' : '0'; + callback('https://img.youtube.com/vi/' + file.id + '/' + type + '.jpg'); +}; + +/** + * Parse a single playlist node. + * + * @param {object} item The youtube item. + * @return {object} The mediafront node. + */ +minplayer.players.youtube.parseNode = function(item) { + var node = (typeof item.video !== 'undefined') ? item.video : item; + return { + title: node.title, + description: node.description, + mediafiles: { + image: { + 'thumbnail': { + path: node.thumbnail.sqDefault + }, + 'image': { + path: node.thumbnail.hqDefault + } + }, + media: { + 'media': { + player: 'youtube', + id: node.id + } + } + } + }; +}; + +/** + * Returns information about this youtube video. + * + * @param {object} file The file to load. + * @param {function} callback Called when the node is loaded. + */ +minplayer.players.youtube.getNode = function(file, callback) { + var url = 'https://gdata.youtube.com/feeds/api/videos/' + file.id; + url += '?v=2&alt=jsonc'; + jQuery.get(url, function(data) { + callback(minplayer.players.youtube.parseNode(data.data)); + }); +}; + +/** + * Translates the player state for the YouTube API player. + * + * @param {number} playerState The YouTube player state. + */ +minplayer.players.youtube.prototype.setPlayerState = function(playerState) { + switch (playerState) { + case YT.PlayerState.CUED: + break; + case YT.PlayerState.BUFFERING: + this.onWaiting(); + break; + case YT.PlayerState.UNSTARTED: + case YT.PlayerState.PAUSED: + this.onPaused(); + break; + case YT.PlayerState.PLAYING: + this.onPlaying(); + break; + case YT.PlayerState.ENDED: + this.onComplete(); + break; + default: + break; + } +}; + +/** + * Called when an error occurs. + * + * @param {string} event The onReady event that was triggered. + */ +minplayer.players.youtube.prototype.onReady = function(event) { + minplayer.players.base.prototype.onReady.call(this); + if (!this.options.autoplay) { + this.pause(); + } + this.onLoaded(); +}; + +/** + * Checks to see if this player can be found. + * @return {bool} TRUE - Player is found, FALSE - otherwise. + */ +minplayer.players.youtube.prototype.playerFound = function() { + var id = 'iframe#' + this.options.id + '-player.youtube-player'; + var iframe = this.display.find(id); + return (iframe.length > 0); +}; + +/** + * Called when the player state changes. + * + * @param {object} event A JavaScript Event. + */ +minplayer.players.youtube.prototype.onPlayerStateChange = function(event) { + this.setPlayerState(event.data); +}; + +/** + * Called when the player quality changes. + * + * @param {string} newQuality The new quality for the change. + */ +minplayer.players.youtube.prototype.onQualityChange = function(newQuality) { + this.quality = newQuality.data; +}; + +/** + * Determines if the player should show the playloader. + * + * @param {string} preview The preview image. + * @return {bool} If this player implements its own playLoader. + */ +minplayer.players.youtube.prototype.hasPlayLoader = function(preview) { + return minplayer.hasTouch || !preview; +}; + +/** + * Determines if the player should show the controller. + * + * @return {bool} If this player implements its own playLoader. + */ +minplayer.players.youtube.prototype.hasController = function() { + return minplayer.isIDevice; +}; + +/** + * @see minplayer.players.base#create + * @return {object} The media player entity. + */ +minplayer.players.youtube.prototype.createPlayer = function() { + minplayer.players.base.prototype.createPlayer.call(this); + + // Insert the YouTube iframe API player. + var youtube_script = 'https://www.youtube.com/iframe_api'; + if (jQuery('script[src="' + youtube_script + '"]').length === 0) { + var tag = document.createElement('script'); + tag.src = youtube_script; + var firstScriptTag = document.getElementsByTagName('script')[0]; + firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); + } + + // Get the player ID. + this.playerId = this.options.id + '-player'; + + // Poll until the YouTube API is ready. + this.poll(this.options.id + '_youtube', (function(player) { + return function() { + var ready = jQuery('#' + player.playerId).length > 0; + ready = ready && ('YT' in window); + ready = ready && (typeof YT.Player === 'function'); + if (ready) { + // Determine the origin of this script. + jQuery('#' + player.playerId).addClass('youtube-player'); + var origin = location.protocol; + origin += '//' + location.hostname; + origin += (location.port && ':' + location.port); + + var playerVars = {}; + if (minplayer.isIDevice) { + playerVars.origin = origin; + } + else { + playerVars = { + enablejsapi: minplayer.isIDevice ? 0 : 1, + origin: origin, + wmode: 'opaque', + controls: minplayer.isAndroid ? 1 : 0, + rel: 0, + showinfo: 0 + }; + } + + // Create the player. + player.player = new YT.Player(player.playerId, { + height: '100%', + width: '100%', + frameborder: 0, + videoId: player.mediaFile.id, + playerVars: playerVars, + events: { + 'onReady': function(event) { + player.onReady(event); + }, + 'onStateChange': function(event) { + player.onPlayerStateChange(event); + }, + 'onPlaybackQualityChange': function(newQuality) { + player.onQualityChange(newQuality); + }, + 'onError': function(errorCode) { + player.onError(errorCode); + } + } + }); + } + return !ready; + }; + })(this), 200); + + // Return the player. + return jQuery(document.createElement('div')).attr({ + id: this.playerId + }); +}; + +/** + * @see minplayer.players.base#load + */ +minplayer.players.youtube.prototype.load = function(file, callback) { + minplayer.players.base.prototype.load.call(this, file, function() { + this.player.loadVideoById(file.id, 0, this.quality); + if (callback) { + callback.call(this); + } + }); +}; + +/** + * @see minplayer.players.base#play + */ +minplayer.players.youtube.prototype.play = function(callback) { + minplayer.players.base.prototype.play.call(this, function() { + this.onWaiting(); + this.player.playVideo(); + if (callback) { + callback.call(this); + } + }); +}; + +/** + * @see minplayer.players.base#pause + */ +minplayer.players.youtube.prototype.pause = function(callback) { + minplayer.players.base.prototype.pause.call(this, function() { + this.player.pauseVideo(); + if (callback) { + callback.call(this); + } + }); +}; + +/** + * @see minplayer.players.base#stop + */ +minplayer.players.youtube.prototype.stop = function(callback) { + minplayer.players.base.prototype.stop.call(this, function() { + this.player.stopVideo(); + if (callback) { + callback.call(this); + } + }); +}; + +/** + * @see minplayer.players.base#_seek + */ +minplayer.players.youtube.prototype._seek = function(pos) { + this.onWaiting(); + this.player.seekTo(pos, true); +}; + +/** + * @see minplayer.players.base#setVolume + */ +minplayer.players.youtube.prototype.setVolume = function(vol, callback) { + minplayer.players.base.prototype.setVolume.call(this, vol, function() { + this.player.setVolume(vol * 100); + if (callback) { + callback.call(this); + } + }); +}; + +/** + * @see minplayer.players.base#getVolume + */ +minplayer.players.youtube.prototype._getVolume = function(callback) { + callback(this.player.getVolume()); +}; + +/** + * @see minplayer.players.base#getDuration. + */ +minplayer.players.youtube.prototype._getDuration = function(callback) { + callback(this.player.getDuration()); +}; + +/** + * @see minplayer.players.base#getCurrentTime + */ +minplayer.players.youtube.prototype._getCurrentTime = function(callback) { + callback(this.player.getCurrentTime()); +}; + +/** + * @see minplayer.players.base#getBytesStart. + */ +minplayer.players.youtube.prototype._getBytesStart = function(callback) { + callback(this.player.getVideoStartBytes()); +}; + +/** + * @see minplayer.players.base#getBytesLoaded. + */ +minplayer.players.youtube.prototype._getBytesLoaded = function(callback) { + callback(this.player.getVideoBytesLoaded()); +}; + +/** + * @see minplayer.players.base#getBytesTotal. + */ +minplayer.players.youtube.prototype._getBytesTotal = function(callback) { + callback(this.player.getVideoBytesTotal()); +}; +/** The minplayer namespace. */ +var minplayer = minplayer || {}; + +/** All the media player implementations */ +minplayer.players = minplayer.players || {}; + +/** + * @constructor + * @extends minplayer.players.base + * @class The vimeo media player. + * + * @param {object} context The jQuery context. + * @param {object} options This components options. + * @param {object} queue The event queue to pass events around. + */ +minplayer.players.vimeo = function(context, options, queue) { + + // Derive from players base. + minplayer.players.base.call(this, context, options, queue); +}; + +/** Derive from minplayer.players.base. */ +minplayer.players.vimeo.prototype = new minplayer.players.base(); + +/** Reset the constructor. */ +minplayer.players.vimeo.prototype.constructor = minplayer.players.vimeo; + +/** + * @see minplayer.plugin.construct + * @this minplayer.players.vimeo + */ +minplayer.players.vimeo.prototype.construct = function() { + + // Call the players.flash constructor. + minplayer.players.base.prototype.construct.call(this); + + // Set the plugin name within the options. + this.options.pluginName = 'vimeo'; +}; + +/** + * @see minplayer.players.base#getPriority + * @param {object} file A {@link minplayer.file} object. + * @return {number} The priority of this media player. + */ +minplayer.players.vimeo.getPriority = function(file) { + return 10; +}; + +/** + * @see minplayer.players.base#canPlay + * + * @param {object} file A {@link minplayer.file} object. + * @return {boolean} If this player can play this media type. + */ +minplayer.players.vimeo.canPlay = function(file) { + + // Check for the mimetype for vimeo. + if (file.mimetype === 'video/vimeo') { + return true; + } + + // If the path is a vimeo path, then return true. + return (file.path.search(/^http(s)?\:\/\/(www\.)?vimeo\.com/i) === 0); +}; + +/** + * Determines if the player should show the playloader. + * + * @param {string} preview The preview image. + * @return {bool} If this player implements its own playLoader. + */ +minplayer.players.vimeo.prototype.hasPlayLoader = function(preview) { + return minplayer.hasTouch; +}; + +/** + * Determines if the player should show the playloader. + * + * @return {bool} If this player implements its own playLoader. + */ +minplayer.players.vimeo.prototype.hasController = function() { + return minplayer.hasTouch; +}; + +/** + * Return the ID for a provided media file. + * + * @param {object} file A {@link minplayer.file} object. + * @return {string} The ID for the provided media. + */ +minplayer.players.vimeo.getMediaId = function(file) { + var regex = /^http[s]?\:\/\/(www\.)?vimeo\.com\/(\?v\=)?([0-9]+)/i; + if (file.path.search(regex) === 0) { + return file.path.match(regex)[3]; + } + else { + return file.path; + } +}; + +/** + * Parse a single playlist node. + * + * @param {object} item The vimeo item. + * @return {object} The mediafront node. + */ +minplayer.players.vimeo.parseNode = function(item) { + return { + title: item.title, + description: item.description, + mediafiles: { + image: { + 'thumbnail': { + path: item.thumbnail_small + }, + 'image': { + path: item.thumbnail_large + } + }, + media: { + 'media': { + player: 'vimeo', + id: item.id + } + } + } + }; +}; + +/** Keep track of loaded nodes from vimeo. */ +minplayer.players.vimeo.nodes = {}; + +/** + * Returns information about this vimeo video. + * + * @param {object} file The file to get the node from. + * @param {function} callback Callback when the node is loaded. + */ +minplayer.players.vimeo.getNode = function(file, callback) { + if (minplayer.players.vimeo.nodes.hasOwnProperty(file.id)) { + callback(minplayer.players.vimeo.nodes[file.id]); + } + else { + jQuery.ajax({ + url: 'https://vimeo.com/api/v2/video/' + file.id + '.json', + dataType: 'jsonp', + success: function(data) { + var node = minplayer.players.vimeo.parseNode(data[0]); + minplayer.players.vimeo.nodes[file.id] = node; + callback(node); + } + }); + } +}; + +/** + * Returns a preview image for this media player. + * + * @param {object} file A {@link minplayer.file} object. + * @param {string} type The type of image. + * @param {function} callback Called when the image is retrieved. + */ +minplayer.players.vimeo.getImage = function(file, type, callback) { + minplayer.players.vimeo.getNode(file, function(node) { + callback(node.mediafiles.image.image); + }); +}; + +/** + * @see minplayer.players.base#reset + */ +minplayer.players.vimeo.prototype.reset = function() { + + // Reset the flash variables.. + minplayer.players.base.prototype.reset.call(this); +}; + +/** + * @see minplayer.players.base#create + * @return {object} The media player entity. + */ +minplayer.players.vimeo.prototype.createPlayer = function() { + minplayer.players.base.prototype.createPlayer.call(this); + + // Insert the Vimeo Froogaloop player. + var vimeo_script = 'http://a.vimeocdn.com/js/froogaloop2.min.js'; + if (jQuery('script[src="' + vimeo_script + '"]').length === 0) { + var tag = document.createElement('script'); + tag.src = vimeo_script; + var firstScriptTag = document.getElementsByTagName('script')[0]; + firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); + } + + // Create the iframe for this player. + var iframe = document.createElement('iframe'); + iframe.setAttribute('id', this.options.id + '-player'); + iframe.setAttribute('type', 'text/html'); + iframe.setAttribute('width', '100%'); + iframe.setAttribute('height', '100%'); + iframe.setAttribute('frameborder', '0'); + jQuery(iframe).addClass('vimeo-player'); + + // Get the source. + var src = 'https://player.vimeo.com/video/'; + src += this.mediaFile.id + '?'; + + // Add the parameters to the src. + src += jQuery.param({ + 'wmode': 'opaque', + 'api': 1, + 'player_id': this.options.id + '-player', + 'title': 0, + 'byline': 0, + 'portrait': 0, + 'loop': this.options.loop + }); + + // Set the source of the iframe. + iframe.setAttribute('src', src); + + // Now register this player when the froogaloop code is loaded. + this.poll(this.options.id + '_vimeo', (function(player) { + return function() { + if (window.Froogaloop) { + player.player = window.Froogaloop(iframe); + var playerTimeout = 0; + player.player.addEvent('ready', function() { + clearTimeout(playerTimeout); + player.onReady(); + player.onError(''); + }); + playerTimeout = setTimeout(function() { + player.onReady(); + }, 3000); + } + return !window.Froogaloop; + }; + })(this), 200); + + // Trigger that the load has started. + this.trigger('loadstart'); + + // Return the player. + return iframe; +}; + +/** + * @see minplayer.players.base#onReady + */ +minplayer.players.vimeo.prototype.onReady = function(player_id) { + + // Add the other listeners. + this.player.addEvent('loadProgress', (function(player) { + return function(progress) { + player.duration.set(parseFloat(progress.duration)); + player.bytesLoaded.set(progress.bytesLoaded); + player.bytesTotal.set(progress.bytesTotal); + }; + })(this)); + + this.player.addEvent('playProgress', (function(player) { + return function(progress) { + player.duration.set(parseFloat(progress.duration)); + player.currentTime.set(parseFloat(progress.seconds)); + }; + })(this)); + + this.player.addEvent('play', (function(player) { + return function() { + player.onPlaying(); + }; + })(this)); + + this.player.addEvent('pause', (function(player) { + return function() { + player.onPaused(); + }; + })(this)); + + this.player.addEvent('finish', (function(player) { + return function() { + player.onComplete(); + }; + })(this)); + + minplayer.players.base.prototype.onReady.call(this); + this.onLoaded(); + + // Make sure we autoplay if it is set. + if (this.options.autoplay) { + this.play(); + } +}; + +/** + * Clears the media player. + */ +minplayer.players.vimeo.prototype.clear = function() { + if (this.player) { + this.player.api('unload'); + } + + minplayer.players.base.prototype.clear.call(this); +}; + +/** + * @see minplayer.players.base#load + */ +minplayer.players.vimeo.prototype.load = function(file, callback) { + minplayer.players.base.prototype.load.call(this, file, function() { + this.construct(); + if (callback) { + callback.call(this); + } + }); +}; + +/** + * @see minplayer.players.base#play + */ +minplayer.players.vimeo.prototype.play = function(callback) { + minplayer.players.base.prototype.play.call(this, function() { + this.player.api('play'); + if (callback) { + callback.call(this); + } + }); +}; + +/** + * @see minplayer.players.base#pause + */ +minplayer.players.vimeo.prototype.pause = function(callback) { + minplayer.players.base.prototype.pause.call(this, function() { + this.player.api('pause'); + if (callback) { + callback.call(this); + } + }); +}; + +/** + * @see minplayer.players.base#stop + */ +minplayer.players.vimeo.prototype.stop = function(callback) { + minplayer.players.base.prototype.stop.call(this, function() { + this.player.api('unload'); + if (callback) { + callback.call(this); + } + }); +}; + +/** + * @see minplayer.players.base#_seek + */ +minplayer.players.vimeo.prototype._seek = function(pos) { + this.player.api('seekTo', pos); +}; + +/** + * @see minplayer.players.base#setVolume + */ +minplayer.players.vimeo.prototype.setVolume = function(vol, callback) { + minplayer.players.base.prototype.setVolume.call(this, vol, function() { + this.volume.set(vol); + this.player.api('setVolume', vol); + if (callback) { + callback.call(this); + } + }); +}; + +/** + * @see minplayer.players.base#getVolume + */ +minplayer.players.vimeo.prototype._getVolume = function(callback) { + this.player.api('getVolume', function(vol) { + callback(vol); + }); +}; + +/** + * @see minplayer.players.base#getDuration. + */ +minplayer.players.vimeo.prototype._getDuration = function(callback) { + this.player.api('getDuration', function(duration) { + callback(duration); + }); +}; +/** The minplayer namespace. */ +var minplayer = minplayer || {}; + +/** All the media player implementations */ +minplayer.players = minplayer.players || {}; + +/** + * @constructor + * @extends minplayer.players.base + * @class The Limelight media player. + * + * @param {object} context The jQuery context. + * @param {object} options This components options. + */ +minplayer.players.limelight = function(context, options) { + + // Derive from players base. + minplayer.players.flash.call(this, context, options); +}; + +/** Derive from minplayer.players.flash. */ +minplayer.players.limelight.prototype = new minplayer.players.flash(); + +/** Reset the constructor. */ +minplayer.players.limelight.prototype.constructor = minplayer.players.limelight; + +/** + * @see minplayer.plugin.construct + * @this minplayer.players.limelight + */ +minplayer.players.limelight.prototype.construct = function() { + + // Call the players.flash constructor. + minplayer.players.flash.prototype.construct.call(this); + + // Set the plugin name within the options. + this.options.pluginName = 'limelight'; +}; + +/** + * @see minplayer.players.base#getPriority + * @return {number} The priority of this media player. + */ +minplayer.players.limelight.getPriority = function() { + return 10; +}; + +/** + * @see minplayer.players.base#canPlay + * + * @param {object} file A {@link minplayer.file} object. + * @return {boolean} If this player can play this media type. + */ +minplayer.players.limelight.canPlay = function(file) { + + // Check for the mimetype for limelight. + if (file.mimetype === 'video/limelight') { + return true; + } + + // If the path is a limelight path, then return true. + var regex = /.*limelight\.com.*/i; + return (file.path.search(regex) === 0); +}; + +/** + * Return the ID for a provided media file. + * + * @param {object} file A {@link minplayer.file} object. + * @return {string} The ID for the provided media. + */ +minplayer.players.limelight.getMediaId = function(file) { + var regex = /.*limelight\.com.*mediaId=([a-zA-Z0-9]+)/i; + if (file.path.search(regex) === 0) { + return file.path.match(regex)[1]; + } + else { + return file.path; + } +}; + +/** + * Register this limelight player so that multiple players can be present + * on the same page without event collision. + */ +minplayer.players.limelight.prototype.register = function() { + + // Register the limelight player. + window.delvePlayerCallback = function(playerId, event, data) { + + // Get the main player ID. + var id = playerId.replace('-player', ''); + + // Dispatch this event to the correct player. + jQuery.each(minplayer.get(id, 'media'), function(key, media) { + media.onMediaUpdate(event, data); + }); + }; +}; + +/** + * The media update method. + * + * @param {string} event The event that was triggered. + * @param {object} data The event object. + */ +minplayer.players.limelight.prototype.onMediaUpdate = function(event, data) { + + // Switch on the event name. + switch (event) { + case 'onPlayerLoad': + this.onReady(); + break; + + case 'onMediaLoad': + // If this media has already completed, then pause it and return... + if (this.complete) { + this.pause(); + this.onPaused(); + return; + } + + this.shouldSeek = (this.startTime > 0); + this.onLoaded(); + break; + + case 'onMediaComplete': + this.complete = true; + this.onComplete(); + break; + + case 'onPlayheadUpdate': + + // Make sure we say this is playing. + if (data.positionInMilliseconds && !this.playing && !this.complete) { + this.onPlaying(); + } + + // Set the complete flag to false. + this.complete = false; + + // Set the duration and current time. + if (this.shouldSeek && this.seekValue) { + this.shouldSeek = false; + this.seek(this.seekValue); + } + else { + this.duration.set(data.durationInMilliseconds / 1000); + this.currentTime.set(data.positionInMilliseconds / 1000); + } + break; + + case 'onError': + this.onError(); + break; + + case 'onPlayStateChanged': + if (data.isPlaying) { + this.onPlaying(); + } + else if (data.isBusy) { + this.onWaiting(); + } + else { + this.onPaused(); + } + break; + } +}; + +/** + * @see minplayer.players.base#create + * @return {object} The media player entity. + */ +minplayer.players.limelight.prototype.createPlayer = function() { + minplayer.players.flash.prototype.createPlayer.call(this); + + // Insert the embed.js. + var tag = document.createElement('script'); + tag.src = 'https://assets.delvenetworks.com/player/embed.js'; + var firstScriptTag = document.getElementsByTagName('script')[0]; + firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); + + // Now register this player. + this.register(); + + // Get the FlashVars. + var flashVars = { + 'deepLink': 'true', + 'autoplay': this.options.autoplay ? 'true' : 'false', + 'startQuality': 'HD' + }, regex = null; + + // Get the channel for this player. + var channel = this.options.channel; + if (!channel) { + regex = /.*limelight\.com.*channelId=([a-zA-Z0-9]+)/i; + if (this.mediaFile.path.search(regex) === 0) { + channel = this.mediaFile.path.match(regex)[1]; + } + } + + // Set the channel. + if (channel && this.mediaFile.queueType === 'media') { + flashVars.adConfigurationChannelId = channel; + } + + // Get the playerForm for this player. + var playerForm = this.options.playerForm; + if (!playerForm) { + regex = /.*limelight\.com.*playerForm=([a-zA-Z0-9]+)/i; + if (this.mediaFile.path.search(regex) === 0) { + playerForm = this.mediaFile.path.match(regex)[1]; + } + } + + // Set the player form. + if (playerForm) { + flashVars.playerForm = playerForm; + } + + // Add the media Id to the flashvars. + flashVars.mediaId = this.mediaFile.id; + + // Set the player ID. + var playerId = this.options.id + '-player'; + + // Check the embed code every second. + setTimeout(function checkLimelight() { + if (window.hasOwnProperty('LimelightPlayerUtil')) { + window.LimelightPlayerUtil.initEmbed(playerId); + } + else { + setTimeout(checkLimelight, 1000); + } + }, 1000); + + // Return a flash media player object. + return this.getFlash({ + swf: document.location.protocol + '//assets.delvenetworks.com/player/loader.swf', + id: playerId, + width: this.options.width, + height: '100%', + flashvars: flashVars, + wmode: this.options.wmode + }); +}; + +/** + * @see minplayer.players.base#play + */ +minplayer.players.limelight.prototype.play = function(callback) { + minplayer.players.flash.prototype.play.call(this, function() { + this.player.doPlay(); + if (callback) { + callback.call(this); + } + }); +}; + +/** + * @see minplayer.players.base#pause + */ +minplayer.players.limelight.prototype.pause = function(callback) { + minplayer.players.flash.prototype.pause.call(this, function() { + this.player.doPause(); + if (callback) { + callback.call(this); + } + }); +}; + +/** + * @see minplayer.players.base#stop + */ +minplayer.players.limelight.prototype.stop = function(callback) { + minplayer.players.flash.prototype.stop.call(this, function() { + this.player.doPause(); + if (callback) { + callback.call(this); + } + }); +}; + +/** + * @see minplayer.players.base#_seek + */ +minplayer.players.limelight.prototype._seek = function(pos) { + this.seekValue = pos; + this.player.doSeekToSecond(pos); +}; + +/** + * @see minplayer.players.base#setVolume + */ +minplayer.players.limelight.prototype.setVolume = function(vol, callback) { + minplayer.players.flash.prototype.setVolume.call(this, vol, function() { + this.player.doSetVolume(vol); + if (callback) { + callback.call(this); + } + }); +}; + +/** + * @see minplayer.players.base#getVolume + */ +minplayer.players.limelight.prototype._getVolume = function(callback) { + callback(this.player.doGetVolume()); +}; + +/** + * Perform the Limelight Search Inside. + * + * @param {string} query The query to search for. + */ +minplayer.players.limelight.prototype.search = function(query) { + this.whenReady(function() { + this.player.doSearch(query); + }); +}; +/** The minplayer namespace. */ +var minplayer = minplayer || {}; + +/** All the media player implementations */ +minplayer.players = minplayer.players || {}; + +/** + * @constructor + * @extends minplayer.players.base + * @class The Limelight media player. + * + * @param {object} context The jQuery context. + * @param {object} options This components options. + */ +minplayer.players.kaltura = function(context, options) { + + // Derive from the base player. + minplayer.players.base.call(this, context, options); +}; + +/** Derive from minplayer.players.base. */ +minplayer.players.kaltura.prototype = new minplayer.players.base(); + +/** Reset the constructor. */ +minplayer.players.kaltura.prototype.constructor = minplayer.players.kaltura; + +/** + * @see minplayer.plugin.construct + * @this minplayer.kaltura.limelight + */ +minplayer.players.kaltura.prototype.construct = function() { + + // Call the players.base constructor. + minplayer.players.base.prototype.construct.call(this); + + // Set the plugin name within the options. + this.options.pluginName = 'kaltura'; + + // Determine if an ad is playing. + this.adPlaying = false; +}; + +/** + * Get the default options for this plugin. + * + * @param {object} options The default options for this plugin. + */ +minplayer.players.kaltura.prototype.defaultOptions = function(options) { + + // The Kaltura options for this player. + options.entryId = 0; + options.uiConfId = 0; + options.partnerId = 0; + + minplayer.players.base.prototype.defaultOptions.call(this, options); +}; + +/** + * @see minplayer.players.base#getPriority + * @return {number} The priority of this media player. + */ +minplayer.players.kaltura.getPriority = function() { + return 10; +}; + +/** + * @see minplayer.players.base#canPlay + * + * @param {object} file A {@link minplayer.file} object. + * @return {boolean} If this player can play this media type. + */ +minplayer.players.kaltura.canPlay = function(file) { + + // Check for the mimetype for kaltura. + if (file.mimetype === 'video/kaltura') { + return true; + } + + // If the path is a kaltura path, then return true. + var regex = /.*kaltura\.com.*/i; + return (file.path.search(regex) === 0); +}; + +minplayer.players.kaltura.prototype.adStart = function(data) { + this.adPlaying = true; + this.onPlaying(); +}; + +minplayer.players.kaltura.prototype.adEnd = function(data) { + this.adPlaying = false; +}; + +/** + * Keep track when the player state changes. + * + * @param {type} data + * @returns {undefined} + */ +minplayer.players.kaltura.prototype.playerStateChange = function(data) { + if (!this.adPlaying) { + switch (data) { + case 'ready': + this.onLoaded(); + break; + case 'loading': + case 'buffering': + this.onWaiting(); + break; + case 'playing': + this.onPlaying(); + break; + case 'paused': + this.onPaused(); + break; + } + } +}; + +/** + * Called when the player is ready. + * + * @returns {undefined} + */ +minplayer.players.kaltura.prototype.mediaReady = function() { + this.onLoaded(); +}; + +/** + * Called when the media ends. + * + * @param {type} data + * @returns {undefined} + */ +minplayer.players.kaltura.prototype.playerPlayEnd = function(data) { + this.onComplete(); +}; + +/** + * Called as the play updates. + * + * @param {type} data + * @returns {undefined} + */ +minplayer.players.kaltura.prototype.playUpdate = function(data) { + this.currentTime.set(data); +}; + +/** + * Called when the duration changes. + * + * @param {type} data + * @returns {undefined} + */ +minplayer.players.kaltura.prototype.durationChange = function(data) { + this.duration.set(data.newValue); +}; + +/** + * Returns the name of this player instance. + * + * @returns {String} + */ +minplayer.players.kaltura.prototype.getInstance = function() { + if (this.instanceName) { + return this.instanceName; + } + var ids = this.uuid.split('__'); + var instance = 'minplayer.plugins.' + ids[0]; + instance += '.' + ids[1]; + instance += '[' + (ids[2] - 1) + ']'; + this.instanceName = instance; + return instance; +}; + +/** + * Register for the media player events. + * + * @returns {undefined} + */ +minplayer.players.kaltura.prototype.registerEvents = function() { + this.player.addJsListener("adStart", this.getInstance() + '.adStart'); + this.player.addJsListener("adEnd", this.getInstance() + '.adEnd'); + this.player.addJsListener("playerStateChange", this.getInstance() + '.playerStateChange'); + this.player.addJsListener("durationChange", this.getInstance() + '.durationChange'); + this.player.addJsListener("mediaReady", this.getInstance() + '.mediaReady'); + this.player.addJsListener("playerUpdatePlayhead", this.getInstance() + '.playUpdate'); + this.player.addJsListener("playerPlayEnd", this.getInstance() + '.playerPlayEnd'); +}; + +/** + * @see minplayer.players.base#create + * @return {object} The media player entity. + */ +minplayer.players.kaltura.prototype.createPlayer = function() { + minplayer.players.base.prototype.createPlayer.call(this); + + // Set the items. + var settings = {}; + var self = this; + jQuery.each(['entryId', 'uiConfId', 'partnerId'], function(index, item) { + settings[item] = ''; + if (self.options[item]) { + settings[item] = self.options[item]; + } + else { + var regex = null; + switch (item) { + case 'entryId': + regex = /.*kaltura\.com.*entry_id\/([^\/]+)/i; + break; + case 'uiConfId': + regex = /.*kaltura\.com.*uiconf_id\/([^\/]+)/i; + break; + case 'partnerId': + regex = /.*kaltura\.com.*wid\/_([^\/]+)/i; + break; + } + + // Set the value for this item. + if (regex) { + settings[item] = self.mediaFile.path.match(regex); + if (settings[item]) { + settings[item] = settings[item][1]; + } + } + } + }); + + // Insert the embed javascript. + var tag = document.createElement('script'); + tag.src = 'http://cdnapi.kaltura.com/p/'; + tag.src += settings.partnerId; + tag.src += '/sp/'; + tag.src += settings.partnerId; + tag.src += '00/embedIframeJs/uiconf_id/'; + tag.src += settings.uiConfId; + tag.src += '/partner_id/'; + tag.src += settings.partnerId; + var firstScriptTag = document.getElementsByTagName('script')[0]; + firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); + + // The player Id. + var playerId = this.options.id + '-player'; + + // Check the embed code every second. + setTimeout(function checkKaltura() { + if (window.hasOwnProperty('kWidget')) { + kWidget.embed({ + 'targetId': playerId, + 'wid': '_' + settings.partnerId, + 'uiconf_id' : settings.uiConfId, + 'entry_id' : settings.entryId, + 'flashvars':{ + 'autoPlay': false + }, + 'params':{ + 'wmode': 'transparent' + }, + readyCallback: function( playerId ){ + self.player = jQuery('#' + playerId).get(0); + self.registerEvents(); + self.onReady(); + } + }); + } + else { + setTimeout(checkKaltura, 1000); + } + }, 1000); + + // Return a div tag. + return '
'; +}; + +/** + * @see minplayer.players.base#play + */ +minplayer.players.kaltura.prototype.play = function(callback) { + minplayer.players.base.prototype.play.call(this, function() { + this.player.sendNotification("doPlay"); + if (callback) { + callback.call(this); + } + }); +}; + +/** + * @see minplayer.players.base#pause + */ +minplayer.players.kaltura.prototype.pause = function(callback) { + minplayer.players.base.prototype.pause.call(this, function() { + this.player.sendNotification("doPause"); + if (callback) { + callback.call(this); + } + }); +}; + +/** + * @see minplayer.players.base#stop + */ +minplayer.players.kaltura.prototype.stop = function(callback) { + minplayer.players.base.prototype.stop.call(this, function() { + this.player.sendNotification("doStop"); + if (callback) { + callback.call(this); + } + }); +}; + +/** + * @see minplayer.players.base#seek + */ +minplayer.players.kaltura.prototype._seek = function(pos) { + this.seekValue = pos; + this.player.sendNotification("doSeek", pos); +}; + +/** + * @see minplayer.players.base#setVolume + */ +minplayer.players.kaltura.prototype.setVolume = function(vol, callback) { + minplayer.players.base.prototype.setVolume.call(this, vol, function() { + this.player.sendNotification("changeVolume", vol); + if (callback) { + callback.call(this); + } + }); +}; +/** The minplayer namespace. */ +var minplayer = minplayer || {}; + +/** + * @constructor + * @extends minplayer.display + * @class This is the base minplayer controller. Other controllers can derive + * from the base and either build on top of it or simply define the elements + * that this base controller uses. + * + * @param {object} context The jQuery context. + * @param {object} options This components options. + */ +minplayer.controller = function(context, options) { + + // Derive from display + minplayer.display.call(this, 'controller', context, options); +}; + +/** Derive from minplayer.display. */ +minplayer.controller.prototype = new minplayer.display(); + +/** Reset the constructor. */ +minplayer.controller.prototype.constructor = minplayer.controller; + +/** + * A static function that will format a time value into a string time format. + * + * @param {integer} time An integer value of time. + * @return {string} A string representation of the time. + */ +minplayer.formatTime = function(time) { + time = time || 0; + var seconds = 0, minutes = 0, hour = 0, timeString = ''; + + hour = Math.floor(time / 3600); + time -= (hour * 3600); + minutes = Math.floor(time / 60); + time -= (minutes * 60); + seconds = Math.floor(time % 60); + + if (hour) { + timeString += String(hour); + timeString += ':'; + } + + timeString += (minutes >= 10) ? String(minutes) : ('0' + String(minutes)); + timeString += ':'; + timeString += (seconds >= 10) ? String(seconds) : ('0' + String(seconds)); + return {time: timeString, units: ''}; +}; + +/** + * @see minplayer.display#getElements + * @return {object} The elements defined by this display. + */ +minplayer.controller.prototype.getElements = function() { + var elements = minplayer.display.prototype.getElements.call(this); + return jQuery.extend(elements, { + play: null, + pause: null, + fullscreen: null, + seek: null, + progress: null, + volume: null, + timer: null + }); +}; + +/** + * Get the default options for this plugin. + * + * @param {object} options The default options for this plugin. + */ +minplayer.controller.prototype.defaultOptions = function(options) { + options.disptime = 0; + minplayer.display.prototype.defaultOptions.call(this, options); +}; + +/** + * @see minplayer.plugin#construct + */ +minplayer.controller.prototype.construct = function() { + + // Call the minplayer plugin constructor. + minplayer.display.prototype.construct.call(this); + + // Set the plugin name within the options. + this.options.pluginName = 'controller'; + + // Keep track of if we are dragging... + this.dragging = false; + + // Keep track of the current volume. + this.vol = 0; + + // If they have a seek bar. + if (this.elements.seek) { + + // Create the seek bar slider control. + this.seekBar = this.elements.seek.slider({ + range: 'min', + create: function(event, ui) { + jQuery('.ui-slider-range', event.target).addClass('ui-state-active'); + } + }); + } + + // If they have a volume bar. + if (this.elements.volume) { + + // Create the volume bar slider control. + this.volumeBar = this.elements.volume.slider({ + animate: true, + range: 'min', + orientation: 'vertical' + }); + } + + // Get the player plugin. + this.get('player', function(player) { + + // If they have a fullscreen button. + if (this.elements.fullscreen) { + + // Bind to the click event. + minplayer.click(this.elements.fullscreen.unbind(), function() { + player.toggleFullScreen(); + }).css({'pointer' : 'hand'}); + } + }); + + // Get the media plugin. + this.get('media', function(media) { + + // Only bind if this player does not have its own play loader. + if (!media.hasController()) { + + // If they have a pause button + if (this.elements.pause) { + + // Bind to the click on this button. + minplayer.click(this.elements.pause.unbind(), (function(controller) { + return function(event) { + event.preventDefault(); + controller.playPause(false, media); + }; + })(this)); + + // Bind to the pause event of the media. + media.ubind(this.uuid + ':pause', (function(controller) { + return function(event) { + controller.setPlayPause(true); + }; + })(this)); + } + + // If they have a play button + if (this.elements.play) { + + // Bind to the click on this button. + minplayer.click(this.elements.play.unbind(), (function(controller) { + return function(event) { + event.preventDefault(); + controller.playPause(true, media); + }; + })(this)); + + // Bind to the play event of the media. + media.ubind(this.uuid + ':playing', (function(controller) { + return function(event) { + controller.setPlayPause(false); + }; + })(this)); + } + + // If they have a duration, then trigger on duration change. + if (this.elements.duration) { + + // Bind to the duration change event. + media.ubind(this.uuid + ':durationchange', (function(controller) { + return function(event, data) { + var duration = controller.options.disptime || data.duration; + controller.setTimeString('duration', duration); + }; + })(this)); + + // Set the timestring to the duration. + media.getDuration((function(controller) { + return function(duration) { + duration = controller.options.disptime || duration; + controller.setTimeString('duration', duration); + }; + })(this)); + } + + // If they have a progress element. + if (this.elements.progress) { + + // Bind to the progress event. + media.ubind(this.uuid + ':progress', (function(controller) { + return function(event, data) { + var percent = data.total ? (data.loaded / data.total) * 100 : 0; + controller.elements.progress.width(percent + '%'); + }; + })(this)); + } + + // If they have a seek bar or timer, bind to the timeupdate. + if (this.seekBar || this.elements.timer) { + + // Bind to the time update event. + media.ubind(this.uuid + ':timeupdate', (function(controller) { + return function(event, data) { + if (!controller.dragging) { + var value = 0; + if (data.duration) { + value = (data.currentTime / data.duration) * 100; + } + + // Update the seek bar if it exists. + if (controller.seekBar) { + controller.seekBar.slider('option', 'value', value); + } + + controller.setTimeString('timer', data.currentTime); + } + }; + })(this)); + } + + // If they have a seekBar element. + if (this.seekBar) { + + // Register the events for the control bar to control the media. + this.seekBar.slider({ + start: (function(controller) { + return function(event, ui) { + controller.dragging = true; + }; + })(this), + stop: (function(controller) { + return function(event, ui) { + controller.dragging = false; + media.getDuration(function(duration) { + media.seek((ui.value / 100) * duration); + }); + }; + })(this), + slide: (function(controller) { + return function(event, ui) { + media.getDuration(function(duration) { + var time = (ui.value / 100) * duration; + if (!controller.dragging) { + media.seek(time); + } + controller.setTimeString('timer', time); + }); + }; + })(this) + }); + } + + // Setup the mute button. + if (this.elements.mute) { + minplayer.click(this.elements.mute, (function(controller) { + return function(event) { + event.preventDefault(); + var value = controller.volumeBar.slider('option', 'value'); + if (value > 0) { + controller.vol = value; + controller.volumeBar.slider('option', 'value', 0); + media.setVolume(0); + } + else { + controller.volumeBar.slider('option', 'value', controller.vol); + media.setVolume(controller.vol / 100); + } + }; + })(this)); + } + + // Setup the volume bar. + if (this.volumeBar) { + + // Create the slider. + this.volumeBar.slider({ + slide: function(event, ui) { + media.setVolume(ui.value / 100); + } + }); + + media.ubind(this.uuid + ':volumeupdate', (function(controller) { + return function(event, vol) { + controller.volumeBar.slider('option', 'value', (vol * 100)); + }; + })(this)); + + // Set the volume to match that of the player. + media.getVolume((function(controller) { + return function(vol) { + controller.volumeBar.slider('option', 'value', (vol * 100)); + }; + })(this)); + } + } + else { + + // Hide this controller. + this.hide(); + } + }); + + // We are now ready. + this.ready(); +}; + +/** + * Sets the play and pause state of the control bar. + * + * @param {boolean} state TRUE - Show Play, FALSE - Show Pause. + */ +minplayer.controller.prototype.setPlayPause = function(state) { + var css = ''; + if (this.elements.play) { + css = state ? 'inherit' : 'none'; + this.elements.play.css('display', css); + } + if (this.elements.pause) { + css = state ? 'none' : 'inherit'; + this.elements.pause.css('display', css); + } +}; + +/** + * Plays or pauses the media. + * + * @param {bool} state true => play, false => pause. + * @param {object} media The media player object. + */ +minplayer.controller.prototype.playPause = function(state, media) { + var type = state ? 'play' : 'pause'; + this.display.trigger(type); + this.setPlayPause(!state); + if (media) { + media[type](); + } +}; + +/** + * Sets the time string on the control bar. + * + * @param {string} element The name of the element to set. + * @param {number} time The total time amount to set. + */ +minplayer.controller.prototype.setTimeString = function(element, time) { + if (this.elements[element]) { + this.elements[element].text(minplayer.formatTime(time).time); + } +}; +var osmplayer = osmplayer || {}; (function(exports) {/*! * iScroll v4.2.5 ~ Copyright (c) 2012 Matteo Spinelli, http://cubiq.org * Released under MIT license, http://cubiq.org/license diff --git a/bin/osmplayer.min.js b/bin/osmplayer.min.js index 548dfc9f..674e2e58 100644 --- a/bin/osmplayer.min.js +++ b/bin/osmplayer.min.js @@ -1,4 +1,4 @@ -function checkPlayType(a,b){if("function"==typeof a.canPlayType){if("object"==typeof b){for(var c=b.length,d="";c--&&!(d=checkPlayType(a,b[c])););return d}var e=a.canPlayType(b);if("no"!==e&&""!==e)return b}return""}var minplayer=minplayer||{};!function(a){!function(){"use strict";var a="undefined"!=typeof module&&module.exports,b="undefined"!=typeof Element&&"ALLOW_KEYBOARD_INPUT"in Element,c=function(){for(var a,b,c=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],d=0,e=c.length,f={};e>d;d++)if(a=c[d],a&&a[1]in document){for(d=0,b=a.length;b>d;d++)f[c[0][d]]=a[d];return f}return!1}(),d={request:function(a){var d=c.requestFullscreen;a=a||document.documentElement,/5\.1[\.\d]* Safari/.test(navigator.userAgent)?a[d]():a[d](b&&Element.ALLOW_KEYBOARD_INPUT)},exit:function(){document[c.exitFullscreen]()},toggle:function(a){this.isFullscreen?this.exit():this.request(a)},onchange:function(){},onerror:function(){},raw:c};return c?(Object.defineProperties(d,{isFullscreen:{get:function(){return!!document[c.fullscreenElement]}},element:{enumerable:!0,get:function(){return document[c.fullscreenElement]}},enabled:{enumerable:!0,get:function(){return!!document[c.fullscreenEnabled]}}}),document.addEventListener(c.fullscreenchange,function(a){d.onchange.call(d,a)}),document.addEventListener(c.fullscreenerror,function(a){d.onerror.call(d,a)}),void(a?module.exports=d:window.screenfull=d)):void(a?module.exports=!1:window.screenfull=!1)}(),a.screenfull=screenfull}(minplayer);var minplayer=minplayer||{};if(minplayer.compatibility=function(){var a=null;a=document.createElement("video"),this.videoOGG=checkPlayType(a,"video/ogg"),this.videoH264=checkPlayType(a,["video/mp4","video/h264"]),this.videoWEBM=checkPlayType(a,["video/x-webm","video/webm","application/octet-stream"]),this.videoMPEGURL=checkPlayType(a,"application/vnd.apple.mpegurl"),a=document.createElement("audio"),this.audioOGG=checkPlayType(a,"audio/ogg"),this.audioMP3=checkPlayType(a,"audio/mpeg"),this.audioMP4=checkPlayType(a,"audio/mp4")},minplayer.playTypes||(minplayer.playTypes=new minplayer.compatibility,minplayer.isAndroid=/android/gi.test(navigator.appVersion),minplayer.isIDevice=/iphone|ipad/gi.test(navigator.appVersion),minplayer.isPlaybook=/playbook/gi.test(navigator.appVersion),minplayer.isTouchPad=/hp-tablet/gi.test(navigator.appVersion),minplayer.hasTouch="ontouchstart"in window&&!minplayer.isTouchPad),!minplayer.urlVars){minplayer.urlVars={};var regEx=/[?&]+([^=&]+)=([^&]*)/gi;window.location.href.replace(regEx,function(a,b,c){minplayer.urlVars[b]=c})}var minplayer=minplayer||{};minplayer.async=function(){this.value=null,this.queue=[]},minplayer.async.prototype.get=function(a){null!==this.value?a(this.value):this.queue.push(a)},minplayer.async.prototype.set=function(a){this.value=a;var b=this.queue.length;if(b){for(;b--;)this.queue[b](a);this.queue=[]}};var minplayer=minplayer||{};minplayer.flags=function(){this.flag=0,this.ids={},this.numFlags=0},minplayer.flags.prototype.setFlag=function(a,b){this.ids.hasOwnProperty(a)||(this.ids[a]=this.numFlags,this.numFlags++),b?this.flag|=1<c;c++)minplayer.queue.hasOwnProperty(c)&&(b=minplayer.queue[c],d=!b.id&&!b.plugin,d|=b.plugin===a.name,d&=!b.id||b.id===this.options.id,d&&!b.addedto.hasOwnProperty(a.options.id)&&(b.addedto[a.options.id]=!0,d=minplayer.bind.call(b.context,b.event,this.options.id,a.name,b.callback,!0)));minplayer.lock=!1},minplayer.eventTypes={},minplayer.plugin.prototype.isEvent=function(a,b){var c=a+"__"+b;return"undefined"!=typeof minplayer.eventTypes[c]?minplayer.eventTypes[c]:(new RegExp("^(.*:)?"+b+"$","gi"),minplayer.eventTypes[c]=null!==a.match(b),minplayer.eventTypes[c])},minplayer.plugin.prototype.trigger=function(a,b,c){if(!this.active)return this;c||(this.triggered[a]=b);var d=0,e={},f=null;for(var g in this.queue)if(this.isEvent(g,a)){f=this.queue[g];for(d in f)f.hasOwnProperty(d)&&(e=f[d],e.callback({target:this,data:e.data},b))}return this},minplayer.plugin.prototype.ubind=function(a,b,c){return this.unbind(a),this.bind(a,b,c)},minplayer.plugin.prototype.bind=function(a,b,c){if(!this.active)return this;if("function"==typeof b&&(c=b,b=null),a&&c){this.queue[a]=this.queue[a]||[],this.queue[a].push({callback:c,data:b});for(var d in this.triggered)this.triggered.hasOwnProperty(d)&&this.isEvent(a,d)&&c({target:this,data:b},this.triggered[d]);return this}},minplayer.plugin.prototype.unbind=function(a){return this.lock&&setTimeout(function(b){return function(){b.unbind(a)}}(this),10),this.lock=!0,a?this.queue.hasOwnProperty(a)&&this.queue[a].length>0&&(this.queue[a].length=0):this.queue={},this.lock=!1,this},minplayer.addQueue=function(a,b,c,d,e){minplayer.lock?setTimeout(function(){minplayer.addQueue(a,c,b,d,e)},10):minplayer.queue.push({context:a,id:c,event:b,plugin:d,callback:e,addedto:{}})},minplayer.bind=function(a,b,c,d,e){if(!d)return!1;var f=minplayer.plugins,g=null,h=null,i=[],j=function(a,b){if(f.hasOwnProperty(a)&&f[a].hasOwnProperty(b))for(var c=f[a][b].length;c--;)i.push(f[a][b][c])};if(b&&c)j(b,c);else if(!b&&c)for(h in f)j(h,c);else if(b&&!c&&f[b])for(g in f[b])j(b,g);else if(!b&&!c)for(h in f)for(g in f[h])j(h,g);for(var k=i.length;k--;)i[k].bind(a,function(a){return function(b){d.call(a,b.target)}}(this));return e||minplayer.addQueue(this,a,b,c,d),i.length>0},minplayer.get=function(a,b,c){var d=typeof a,e=typeof b,f=typeof c;if("function"===d?(c=a,b=a=null):"function"===e?(c=b,b=a,a=null):"undefined"===e&&"undefined"===f&&(b=a,c=a=null),c="function"==typeof c?c:null)return void minplayer.bind.call(this,"ready",a,b,c);var g=minplayer.plugins,h=null;if(!(a||b||c))return g;if(a&&!b&&!c)return g[a];if(a&&b&&!c)return g[a][b];if(!a&&b&&!c){var i=[];for(h in g)if(g.hasOwnProperty(h)&&g[h].hasOwnProperty(b))for(var j=g[h][b].length;j--;)i.push(g[h][b][j]);return i}},minplayer.display=function(a,b,c,d){minplayer.plugin.call(this,a,b,c,d)},minplayer.display.prototype=new minplayer.plugin,minplayer.display.prototype.constructor=minplayer.display,minplayer.display.prototype.getDisplay=function(a){return a},minplayer.display.prototype.initialize=function(){this.display||(this.display=this.getDisplay(this.context,this.options)),this.display&&(this.options.pluginName="display",this.elements=this.getElements(),minplayer.plugin.prototype.initialize.call(this))},minplayer.display.prototype.construct=function(){if(minplayer.plugin.prototype.construct.call(this),this.autoHide=!1,this.onResize){var a=0;jQuery(window).resize(function(b){return function(){clearTimeout(a),a=setTimeout(function(){b.onResize()},200)}}(this))}},minplayer.display.prototype.onResize=!1,minplayer.display.prototype.hide=function(a){a=a||this.display,a&&(a.forceHide=!0,a.unbind().hide())},minplayer.display.prototype.fullScreenElement=function(){return this.display},minplayer.click=function(a,b){var c=!1;return a=jQuery(a),a.bind("touchstart click",function(a){c||(c=!0,setTimeout(function(){c=!1},100),b.call(this,a))}),a},minplayer.display.prototype.onFocus=function(a){this.hasFocus=this.focus=a,this.autoHide&&this.showThenHide(this.autoHide.element,this.autoHide.timeout,this.autoHide.cb)},minplayer.display.prototype.showThenHide=function(a,b,c){var d=typeof a;"undefined"===d?(c=null,a=this.display):"number"===d?(c=b,b=a,a=this.display):"function"===d&&(c=a,a=this.display),a&&(b=b||5e3,this.autoHide={element:a,timeout:b,cb:c},a.forceHide||("undefined"!=typeof a.showMe?a.showMe&&a.showMe(c):(a.show(),c&&c(!0))),a.hoverState||(jQuery(a).bind("mouseenter",function(){a.hoverState=!0}),jQuery(a).bind("mouseleave",function(){a.hoverState=!1})),clearTimeout(this.showTimer),this.showTimer=setTimeout(function(d){return function e(){a.hoverState?d.showTimer=setTimeout(e,b):"undefined"!=typeof a.hideMe?a.hideMe&&a.hideMe(c):a.hide("slow",function(){c&&c(!1)})}}(this),b))},minplayer.display.prototype.fullscreen=function(a){var b=this.isFullScreen(),c=this.fullScreenElement();b&&!a?(c.removeClass("fullscreen"),minplayer.screenfull&&minplayer.screenfull.exit(),this.trigger("fullscreen",!1)):!b&&a&&(c.addClass("fullscreen"),minplayer.screenfull&&(minplayer.screenfull.request(c[0]),minplayer.screenfull.onchange=function(a){return function(){minplayer.screenfull.isFullscreen||a.fullscreen(!1)}}(this)),this.trigger("fullscreen",!0))},minplayer.display.prototype.toggleFullScreen=function(){this.fullscreen(!this.isFullScreen())},minplayer.display.prototype.isFullScreen=function(){return this.fullScreenElement().hasClass("fullscreen")},minplayer.display.prototype.getScaledRect=function(a,b){var c={};return c.x=b.x?b.x:0,c.y=b.y?b.y:0,c.width=b.width?b.width:0,c.height=b.height?b.height:0,a&&(b.width/b.height>a?(c.height=b.height,c.width=Math.floor(b.height*a)):(c.height=Math.floor(b.width/a),c.width=b.width),c.x=Math.floor((b.width-c.width)/2),c.y=Math.floor((b.height-c.height)/2)),c},minplayer.display.prototype.getElements=function(){return{}},jQuery.fn.minplayer||(jQuery.fn.minplayer=function(a){return jQuery(this).each(function(){a=a||{},a.id=a.id||jQuery(this).attr("id")||Math.random(),minplayer.plugins[a.id]||(a.template=a.template||"default",minplayer[a.template]?new minplayer[a.template](jQuery(this),a):new minplayer(jQuery(this),a))})}),minplayer=jQuery.extend(function(a,b){minplayer.display.call(this,"player",a,b)},minplayer),minplayer.prototype=new minplayer.display,minplayer.prototype.constructor=minplayer,minplayer.prototype.defaultOptions=function(a){a.id="player",a.build=!1,a.wmode="transparent",a.preload=!0,a.autoplay=!1,a.autoload=!0,a.loop=!1,a.width="100%",a.height="350px",a.debug=!1,a.volume=80,a.files=null,a.file="",a.preview="",a.attributes={},a.plugins={},a.logo="",a.link="",a.duration=0,jQuery.each(this.context[0].attributes,function(b,c){a[c.name]=c.value}),minplayer.display.prototype.defaultOptions.call(this,a)},minplayer.prototype.construct=function(){minplayer.display.prototype.construct.call(this);var a=null;for(var b in this.options.plugins)a=this.options.plugins[b],minplayer[a]&&(a=minplayer[a],a[this.options.template]&&a[this.options.template].init?a[this.options.template].init(this):a.init&&a.init(this));if(this.options.pluginName="player",this.controller=this.create("controller"),this.playLoader=this.create("playLoader"),this.options.logo&&this.elements.logo){var c="";this.options.link&&(c+=''),c+='',this.options.link&&(c+=""),this.logo=this.elements.logo.append(c)}this.currentPlayer="html5",this.addKeyEvents(),this.addEvents(),this.load(this.getFiles()),this.ready()},minplayer.prototype.setFocus=function(a){minplayer.get.call(this,this.options.id,null,function(b){b.onFocus(a)}),this.trigger("playerFocus",a)},minplayer.prototype.bindTo=function(a){a.ubind(this.uuid+":error",function(a){return function(b,c){"html5"===a.currentPlayer?(minplayer.player="minplayer",a.options.file.player="minplayer",a.loadPlayer()):a.showError(c)}}(this)),a.ubind(this.uuid+":fullscreen",function(a){return function(){a.resize()}}(this))},minplayer.prototype.addEvents=function(){var a=!1;this.display.bind("mouseenter",function(b){return function(){a=!0,b.setFocus(!0)}}(this)),this.display.bind("mouseleave",function(b){return function(){a=!1,b.setFocus(!1)}}(this));var b=!1;this.display.bind("mousemove",function(c){return function(){b||(b=setTimeout(function(){b=!1,a&&c.setFocus(!0)},300))}}(this)),minplayer.get.call(this,this.options.id,null,function(a){return function(b){a.bindTo(b)}}(this))},minplayer.prototype.showError=function(a){"object"!=typeof a&&(a=a||"",this.elements.error&&(this.elements.error.text(a),a?(this.elements.error.show(),setTimeout(function(a){return function(){a.elements.error.hide("slow")}}(this),5e3)):this.elements.error.hide()))},minplayer.prototype.addKeyEvents=function(){jQuery(document).bind("keydown",function(a){return function(b){switch(b.keyCode){case 113:case 27:a.isFullScreen()&&a.fullscreen(!1)}}}(this))},minplayer.prototype.getFiles=function(){if(this.options.files)return this.options.files;if(this.options.file)return this.options.file;var a=[],b=null;return this.elements.media&&(b=this.elements.media.attr("src"),b&&a.push({path:b}),jQuery("source",this.elements.media).each(function(){a.push({path:jQuery(this).attr("src"),mimetype:jQuery(this).attr("type"),codecs:jQuery(this).attr("codecs")})})),a},minplayer.getMediaFile=function(a){if(!a)return null;if("string"==typeof a||a.path||a.id)return new minplayer.file(a);var b=0,c=null,d=null;for(var e in a)a.hasOwnProperty(e)&&(d=new minplayer.file(a[e]),d.player&&d.priority>b&&(b=d.priority,c=d));return c},minplayer.prototype.loadPlayer=function(){if(!this.options.file||0===this.elements.display.length)return!1;if(!this.options.file.player)return!1;this.showError();var a=this.options.file.player.toString();if(!this.media||a!==this.currentPlayer){if(this.currentPlayer=a,!this.elements.display)return void this.showError("No media display found.");var b={};return this.media&&(b=this.media.queue,this.media.destroy()),pClass=minplayer.players[this.options.file.player],this.options.mediaelement=this.elements.media,this.media=new pClass(this.elements.display,this.options,b),this.media.load(this.options.file),this.display.addClass("minplayer-player-"+this.media.mediaFile.player),!0}return this.media?(this.media.options=this.options,this.display.removeClass("minplayer-player-"+this.media.mediaFile.player),this.media.load(this.options.file),this.display.addClass("minplayer-player-"+this.media.mediaFile.player),!1):void 0},minplayer.prototype.load=function(a){return this.options.files=a||this.options.files,this.options.file=minplayer.getMediaFile(this.options.files),this.loadPlayer()?(this.bindTo(this.media),this.options.file.mimetype&&!this.options.file.player?(this.showError("Cannot play media: "+this.options.file.mimetype),!1):!0):!1},minplayer.prototype.resize=function(){this.get(function(a){a.onResize&&a.onResize()})};var minplayer=minplayer||{};minplayer.image=function(a,b){this.loaded=!1,this.loader=null,this.ratio=0,this.img=null,minplayer.display.call(this,"image",a,b)},minplayer.image.prototype=new minplayer.display,minplayer.image.prototype.constructor=minplayer.image,minplayer.image.prototype.construct=function(){minplayer.display.prototype.construct.call(this),this.options.pluginName="image",this.display.css("overflow","hidden"),this.loader=new Image,this.loader.onload=function(a){return function(){a.loaded=!0,a.ratio=a.loader.width/a.loader.height,a.resize(),a.trigger("loaded")}}(this),this.ready()},minplayer.image.prototype.load=function(a){this.clear(function(){this.display.empty(),this.img=jQuery(document.createElement("img")).attr({src:""}).hide(),this.display.append(this.img),this.loader.src=a,this.img.attr("src",a)})},minplayer.image.prototype.clear=function(a){this.loaded=!1,this.img?this.img.fadeOut(150,function(b){return function(){b.img.attr("src",""),b.loader.src="",jQuery(this).remove(),a&&a.call(b)}}(this)):a&&a.call(this)},minplayer.image.prototype.resize=function(a,b){if(a=a||this.display.parent().width(),b=b||this.display.parent().height(),a&&b&&this.loaded){var c=this.getScaledRect(this.ratio,{width:a,height:b});this.img&&this.img.attr("src",this.loader.src).css({marginLeft:c.x,marginTop:c.y,width:c.width,height:c.height}),this.img.fadeIn(150)}},minplayer.image.prototype.onResize=function(){this.resize()};var minplayer=minplayer||{};minplayer.file=function(a){return a?(a="string"==typeof a?{path:a}:a,a.hasOwnProperty("isMinPlayerFile")?a:(this.isMinPlayerFile=!0,this.duration=a.duration||0,this.bytesTotal=a.bytesTotal||0,this.quality=a.quality||0,this.stream=a.stream||"",this.path=a.path||"",this.codecs=a.codecs||"",this.extension=a.extension||this.getFileExtension(),this.mimetype=a.mimetype||a.filemime||this.getMimeType(),this.type=a.type||this.getType(),this.type||(this.mimetype=this.getMimeType(),this.type=this.getType()),this.player=minplayer.player||a.player||this.getBestPlayer(),this.priority=a.priority||this.getPriority(),this.id=a.id||this.getId(),void(this.path||(this.path=this.id)))):null},minplayer.player="",minplayer.file.prototype.getBestPlayer=function(){var a=null,b=0;return jQuery.each(minplayer.players,function(c){return function(d,e){var f=e.getPriority(c);e.canPlay(c)&&f>b&&(a=d,b=f)}}(this)),a},minplayer.file.prototype.getPriority=function(){var a=1;switch(this.player&&(a=minplayer.players[this.player].getPriority(this)),this.mimetype){case"video/x-webm":case"video/webm":case"application/octet-stream":case"application/vnd.apple.mpegurl":return 10*a;case"video/mp4":case"audio/mp4":case"audio/mpeg":return 9*a;case"video/ogg":case"audio/ogg":case"video/quicktime":return 8*a;default:return 5*a}},minplayer.file.prototype.getFileExtension=function(){return this.path.substring(this.path.lastIndexOf(".")+1).toLowerCase()},minplayer.file.prototype.getMimeType=function(){switch(this.extension){case"mp4":case"m4v":case"flv":case"f4v":return"video/mp4";case"m3u8":return"application/vnd.apple.mpegurl";case"webm":return"video/webm";case"ogg":case"ogv":return"video/ogg";case"3g2":return"video/3gpp2";case"3gpp":case"3gp":return"video/3gpp";case"mov":return"video/quicktime";case"swf":return"application/x-shockwave-flash";case"oga":return"audio/ogg";case"mp3":return"audio/mpeg";case"m4a":case"f4a":return"audio/mp4";case"aac":return"audio/aac";case"wav":return"audio/vnd.wave";case"wma":return"audio/x-ms-wma";default:return"unknown"}},minplayer.file.prototype.getType=function(){var a=this.mimetype.match(/([^\/]+)(\/)/);if(a=a&&a.length>1?a[1]:"","video"===a)return"video";if("audio"===a)return"audio";switch(this.mimetype){case"application/octet-stream":case"application/x-shockwave-flash":case"application/vnd.apple.mpegurl":return"video"}return""},minplayer.file.prototype.getId=function(){var a=minplayer.players[this.player];return a&&a.getMediaId?a.getMediaId(this):""};var minplayer=minplayer||{};minplayer.playLoader=function(a,b){this.clear(),minplayer.display.call(this,"playLoader",a,b)},minplayer.playLoader.prototype=new minplayer.display,minplayer.playLoader.prototype.constructor=minplayer.playLoader,minplayer.playLoader.prototype.construct=function(){minplayer.display.prototype.construct.call(this),this.options.pluginName="playLoader",this.initializePlayLoader(),this.ready()},minplayer.playLoader.prototype.initializePlayLoader=function(){this.get("media",function(a){if(a.hasPlayLoader(this.options.preview))this.enabled=!1,this.hide(this.elements.busy),this.hide(this.elements.bigPlay),this.hide(this.elements.preview),this.hide();else{this.enabled=!0,this.options.preview||(this.options.preview=a.poster);var b=!0;this.preview&&this.preview.loader&&(b=this.preview.loader.src!==this.options.preview),b&&(a.elements.media.attr("poster",""),this.loadPreview()),this.elements.bigPlay&&minplayer.click(this.elements.bigPlay.unbind(),function(b){b.preventDefault(),jQuery(this).hide(),a.play()}),a.ubind(this.uuid+":loadstart",function(a){return function(){a.busy.setFlag("media",!0),a.bigPlay.setFlag("media",!0),a.previewFlag.setFlag("media",!0),a.checkVisibility()}}(this)),a.ubind(this.uuid+":waiting",function(a){return function(b,c,d){d||(a.busy.setFlag("media",!0),a.checkVisibility())}}(this)),a.ubind(this.uuid+":loadeddata",function(a){return function(b,c,d){d||(a.busy.setFlag("media",!1),a.checkVisibility())}}(this)),a.ubind(this.uuid+":playing",function(b){return function(c,d,e){e||(b.busy.setFlag("media",!1),b.bigPlay.setFlag("media",!1),"audio"!==a.mediaFile.type&&b.previewFlag.setFlag("media",!1),b.checkVisibility())}}(this)),a.ubind(this.uuid+":pause",function(a){return function(b,c,d){d||(a.busy.setFlag("media",!1),a.bigPlay.setFlag("media",!0),a.checkVisibility())}}(this))}})},minplayer.playLoader.prototype.clear=function(a){this.busy=new minplayer.flags,this.bigPlay=new minplayer.flags,this.previewFlag=new minplayer.flags,this.enabled=!0,this.preview?this.preview.clear(function(b){return function(){b.preview=null,a&&a()}}(this)):(this.preview=null,a&&a())},minplayer.playLoader.prototype.loadPreview=function(a){if(a=a||this.options.preview,this.options.preview=a,this.enabled&&0!==this.display.length){if(this.elements.preview){if(this.options.preview)return this.elements.preview.addClass("has-preview").show(),this.preview=new minplayer.image(this.elements.preview,this.options),this.preview.load(this.options.preview),!0;this.elements.preview.hide()}return!1}},minplayer.playLoader.prototype.checkVisibility=function(){this.enabled&&(this.busy.flag?this.elements.busy.show():this.elements.busy.hide(),this.bigPlay.flag?this.elements.bigPlay.show():this.elements.bigPlay.hide(),this.previewFlag.flag?this.elements.preview.show():this.elements.preview.hide(),(this.bigPlay.flag||this.busy.flag||this.previewFlag.flag)&&this.display.show(),this.bigPlay.flag||this.busy.flag||this.previewFlag.flag||this.display.hide())};var minplayer=minplayer||{};minplayer.players=minplayer.players||{},minplayer.players.base=function(a,b,c){minplayer.display.call(this,"media",a,b,c)},minplayer.players.base.prototype=new minplayer.display,minplayer.players.base.prototype.constructor=minplayer.players.base,minplayer.players.base.prototype.getElements=function(){var a=minplayer.display.prototype.getElements.call(this);return jQuery.extend(a,{media:this.options.mediaelement})},minplayer.players.base.prototype.defaultOptions=function(a){a.range={min:0,max:0},minplayer.display.prototype.defaultOptions.call(this,a)},minplayer.players.base.getPriority=function(){return 0},minplayer.players.base.getMediaId=function(){return""},minplayer.players.base.canPlay=function(){return!1},minplayer.players.base.prototype.construct=function(){minplayer.display.prototype.construct.call(this),this.elements.media&&(this.poster=this.elements.media.attr("poster")),this.options.pluginName="basePlayer",this.readyQueue=[],this.loadedQueue=[],this.mediaFile=this.options.file,this.clear(),this.setupPlayer()},minplayer.players.base.prototype.setupPlayer=function(){this.playerFound()||this.addPlayer(),this.player=this.getPlayer(),minplayer.click(this.display,function(a){return function(){a.playing?a.pause():a.play()}}(this)),jQuery(document).bind("keydown",function(a){return function(b){if(a.hasFocus)switch(b.preventDefault(),b.keyCode){case 32:case 179:a.playing?a.pause():a.play();break;case 38:a.setVolumeRelative(.1);break;case 40:a.setVolumeRelative(-.1);break;case 37:case 227:a.seekRelative(-.05);break;case 39:case 228:a.seekRelative(.05)}}}(this))},minplayer.players.base.prototype.addPlayer=function(){this.elements.media&&this.elements.media.remove(),this.elements.media=jQuery(this.createPlayer()),this.display.html(this.elements.media)},minplayer.players.base.prototype.destroy=function(){minplayer.plugin.prototype.destroy.call(this),this.clear()},minplayer.players.base.prototype.clear=function(){this.playerReady=!1,this.reset(),this.player&&(jQuery(this.player).remove(),this.player=null)},minplayer.players.base.prototype.reset=function(){this.realDuration=0,this.duration=new minplayer.async,this.currentTime=new minplayer.async,this.bytesLoaded=new minplayer.async,this.bytesTotal=new minplayer.async,this.bytesStart=new minplayer.async,this.volume=new minplayer.async,this.hasFocus=!1,this.playing=!1,this.loading=!1,this.loaded=!1,this.trigger("pause",null,!0),this.trigger("waiting",null,!0),this.trigger("progress",{loaded:0,total:0,start:0},!0),this.trigger("timeupdate",{currentTime:0,duration:0},!0)},minplayer.players.base.prototype.onReady=function(){if(!this.playerReady)if(this.setStartStop(),this.playerReady=!0,this.setVolume(this.options.volume/100),this.loading=!0,this.poll("progress",function(a){return function(){return a.loading&&a.getBytesLoaded(function(b){a.getBytesTotal(function(c){if(b||c){var d=0;a.getBytesStart(function(a){d=a}),a.trigger("progress",{loaded:b,total:c,start:d}),b>=c&&(a.loading=!1)}})}),a.loading}}(this),1e3),this.ready(),this.isReady()){for(var a in this.readyQueue)this.readyQueue[a].call(this);this.readyQueue.length=0,this.readyQueue=[],this.loaded||this.trigger("loadstart")}else this.readyQueue.length=0,this.readyQueue=[]},minplayer.players.base.prototype.parseTime=function(a){var b=0,c=0,d=0;return a?("string"!=typeof a&&(a=String(a)),b=a.match(/([0-9]+)s/i),b&&(b=parseInt(b[1],10)),c=a.match(/([0-9]+)m/i),c&&(b+=60*parseInt(c[1],10)),d=a.match(/([0-9]+)h/i),d&&(b+=3600*parseInt(d[1],10)),b||(b=a),Number(b)):0},minplayer.players.base.prototype.setStartStop=function(){return this.startTime?this.startTime:(this.startTime=0,this.offsetTime=this.parseTime(this.options.range.min),minplayer.urlVars&&(this.startTime=this.parseTime(minplayer.urlVars.seek)),this.startTime||(this.startTime=this.offsetTime),this.stopTime=this.options.range.max?this.parseTime(this.options.range.max):0,this.mediaRange=this.stopTime-this.offsetTime,this.mediaRange<0&&(this.mediaRange=0),this.startTime)},minplayer.players.base.prototype.onPlaying=function(){if(!this.playing){var a=this;this.getDuration(function(b){a.startTime&&a.startTime-1&&1>a?(c/d+parseFloat(a))*d:c+parseFloat(a),b.seek(e)}})}}(this))},minplayer.players.base.prototype.seek=function(a,b,c){this.whenLoaded(function(){a=Number(a),c||(a+=this.offsetTime),this._seek(a),b&&b.call(this)})},minplayer.players.base.prototype._seek=function(){},minplayer.players.base.prototype.setVolumeRelative=function(a){this.getVolume(function(b){return function(c){c+=parseFloat(a),c=0>c?0:c,c=c>1?1:c,b.setVolume(c)}}(this))},minplayer.players.base.prototype.setVolume=function(a,b){this.trigger("volumeupdate",a),this.whenLoaded(b)},minplayer.players.base.prototype.getValue=function(a,b,c){this.whenLoaded(function(){var d=this;this[a](function(a){null!==a?c.call(d,a):d[b].get(c)})})},minplayer.players.base.prototype.getVolume=function(a){this.getValue("_getVolume","volume",a)},minplayer.players.base.prototype._getVolume=function(a){a(null)},minplayer.players.base.prototype.getCurrentTime=function(a){var b=this;this.getValue("_getCurrentTime","currentTime",function(c){b.setStartStop(),b.stopTime&&c>b.stopTime&&b.stop(function(){b.onComplete()}),c-=b.offsetTime,a(c)})},minplayer.players.base.prototype._getCurrentTime=function(a){a(null)},minplayer.players.base.prototype.getDuration=function(a){if(this.options.duration)a(this.options.duration);else{var b=this;this.getValue("_getDuration","duration",function(c){b.setStartStop(),b.realDuration=c,a(b.mediaRange?b.mediaRange:c) -})}},minplayer.players.base.prototype._getDuration=function(a){a(null)},minplayer.players.base.prototype.getBytesStart=function(a){this.getValue("_getBytesStart","bytesStart",a)},minplayer.players.base.prototype._getBytesStart=function(a){a(null)},minplayer.players.base.prototype.getBytesLoaded=function(a){this.getValue("_getBytesLoaded","bytesLoaded",a)},minplayer.players.base.prototype._getBytesLoaded=function(a){a(null)},minplayer.players.base.prototype.getBytesTotal=function(a){this.getValue("_getBytesTotal","bytesTotal",a)},minplayer.players.base.prototype._getBytesTotal=function(a){a(null)};var minplayer=minplayer||{};minplayer.players=minplayer.players||{},minplayer.players.dailymotion=function(a,b,c){this.quality="default",minplayer.players.base.call(this,a,b,c)},minplayer.players.dailymotion.prototype=new minplayer.players.base,minplayer.players.dailymotion.prototype.constructor=minplayer.players.dailymotion,minplayer.players.dailymotion.prototype.construct=function(){minplayer.players.base.prototype.construct.call(this),this.options.pluginName="dailymotion"},minplayer.players.dailymotion.getPriority=function(){return 10},minplayer.players.dailymotion.canPlay=function(a){if("video/dailymotion"===a.mimetype)return!0;var b=/^http(s)?\:\/\/(www\.)?(dailymotion\.com)/i;return 0===a.path.search(b)},minplayer.players.dailymotion.getMediaId=function(a){var b="^http[s]?\\:\\/\\/(www\\.)?";b+="(dailymotion\\.com\\/video/)",b+="([a-z0-9\\-]+)",b+="_*";var c=RegExp(b,"i");return 0===a.path.search(c)?a.path.match(c)[3]:a.path},minplayer.players.dailymotion.getImage=function(a,b,c){c("http://www.dailymotion.com/thumbnail/video/"+a.id)},minplayer.players.dailymotion.parseNode=function(){return{title:node.title,description:node.description,mediafiles:{image:{thumbnail:{path:node.thumbnail_small_url},image:{path:node.thumbnail_url}},media:{media:{player:"dailymotion",id:node.id}}}}},minplayer.players.dailymotion.getNode=function(a,b){var c="https://api.dailymotion.com/video/"+a.id;c+="?fields=title,id,description,thumbnail_small_url,thumbnail_url",jQuery.get(c,function(a){b(minplayer.players.dailymotion.parseNode(a.data))},"jsonp")},minplayer.players.dailymotion.prototype.onReady=function(){minplayer.players.base.prototype.onReady.call(this),this.options.autoplay||this.pause(),this.onLoaded()},minplayer.players.dailymotion.prototype.playerFound=function(){return this.display.find(this.mediaFile.type).length>0},minplayer.players.dailymotion.prototype.onQualityChange=function(a){this.quality=a.data},minplayer.players.dailymotion.prototype.hasPlayLoader=function(a){return minplayer.hasTouch||!a},minplayer.players.dailymotion.prototype.hasController=function(){return minplayer.isIDevice},minplayer.players.dailymotion.prototype.createPlayer=function(){minplayer.players.base.prototype.createPlayer.call(this);var a=document.location.protocol;if(a+="//api.dmcdn.net/all.js",0===jQuery('script[src="'+a+'"]').length){var b=document.createElement("script");b.src=a;var c=document.getElementsByTagName("script")[0];c.parentNode.insertBefore(b,c)}return this.playerId=this.options.id+"-player",this.poll(this.options.id+"_dailymotion",function(a){return function(){var b=jQuery("#"+a.playerId).length>0;if(b=b&&"DM"in window,b=b&&"function"==typeof DM.player){jQuery("#"+a.playerId).addClass("dailymotion-player");var c={};c={id:a.playerId,api:minplayer.isIDevice?0:1,wmode:"opaque",controls:minplayer.isAndroid?1:0,related:0,info:0,logo:0},a.player=new DM.player(a.playerId,{video:a.mediaFile.id,height:"100%",width:"100%",frameborder:0,params:c}),a.player.addEventListener("apiready",function(){a.onReady(a)}),a.player.addEventListener("ended",function(){a.onComplete(a)}),a.player.addEventListener("playing",function(){a.onPlaying(a)}),a.player.addEventListener("progress",function(){a.onWaiting(a)}),a.player.addEventListener("pause",function(){a.onPaused(a)}),a.player.addEventListener("error",function(){a.onError(a)})}return!b}}(this),200),jQuery(document.createElement("div")).attr({id:this.playerId})},minplayer.players.dailymotion.prototype.load=function(a,b){minplayer.players.base.prototype.load.call(this,a,function(){this.player.load(a.id),b&&b.call(this)})},minplayer.players.dailymotion.prototype.play=function(a){minplayer.players.base.prototype.play.call(this,function(){this.onWaiting(),this.player.play(),a&&a.call(this)})},minplayer.players.dailymotion.prototype.pause=function(a){minplayer.players.base.prototype.pause.call(this,function(){this.loaded&&(this.player.pause(),a&&a.call(this))})},minplayer.players.dailymotion.prototype.stop=function(a){minplayer.players.base.prototype.stop.call(this,function(){this.player.pause(),a&&a.call(this)})},minplayer.players.dailymotion.prototype._seek=function(a){this.onWaiting(),this.player.seek(a)},minplayer.players.dailymotion.prototype.setVolume=function(a,b){minplayer.players.base.prototype.setVolume.call(this,a,function(){this.loaded&&(this.player.setVolume(a),void 0!==b&&b.call(this))})},minplayer.players.dailymotion.prototype._getVolume=function(a){a(this.player.volume)},minplayer.players.dailymotion.prototype._getDuration=function(a){a(this.player.duration)},minplayer.players.dailymotion.prototype._getCurrentTime=function(a){a(this.player.currentTime)};var minplayer=minplayer||{};minplayer.players=minplayer.players||{},minplayer.players.html5=function(a,b,c){minplayer.players.base.call(this,a,b,c)},minplayer.players.html5.prototype=new minplayer.players.base,minplayer.players.html5.prototype.constructor=minplayer.players.html5,minplayer.players.html5.getPriority=function(){return 10},minplayer.players.html5.canPlay=function(a){switch(a.mimetype){case"video/ogg":return!!minplayer.playTypes.videoOGG;case"video/mp4":case"video/x-mp4":case"video/m4v":case"video/x-m4v":return!!minplayer.playTypes.videoH264;case"application/vnd.apple.mpegurl":return!!minplayer.playTypes.videoMPEGURL;case"video/x-webm":case"video/webm":case"application/octet-stream":return!!minplayer.playTypes.videoWEBM;case"audio/ogg":return!!minplayer.playTypes.audioOGG;case"audio/mpeg":return!!minplayer.playTypes.audioMP3;case"audio/mp4":return!!minplayer.playTypes.audioMP4;default:return!1}},minplayer.players.html5.prototype.construct=function(){minplayer.players.base.prototype.construct.call(this),this.options.pluginName="html5",this.hasEnded=!1,this.addPlayerEvents()},minplayer.players.html5.prototype.addPlayerEvent=function(a,b){this.player&&this.player.addEventListener(a,function(c){var d=a+"Event";return c[d]&&c.player.removeEventListener(a,c[d],!1),c[d]=function(a){b.call(c,a)},c[d]}(this),!1)},minplayer.players.html5.prototype.addPlayerEvents=function(){if(this.player){this.addPlayerEvent("abort",function(){this.trigger("abort")}),this.addPlayerEvent("loadstart",function(){this.onReady(),this.options.autoload||this.onLoaded()}),this.addPlayerEvent("loadeddata",function(){this.onLoaded()}),this.addPlayerEvent("loadedmetadata",function(){this.onLoaded()}),this.addPlayerEvent("canplaythrough",function(){this.onLoaded()}),this.addPlayerEvent("ended",function(){this.hasEnded=!0,this.onComplete()}),this.addPlayerEvent("pause",function(){this.onPaused()}),this.addPlayerEvent("play",function(){this.onPlaying()}),this.addPlayerEvent("playing",function(){this.onPlaying()});var a=!1;return this.addPlayerEvent("error",function(){this.hasEnded||a||!this.player||(a=!0,this.trigger("error","An error occured - "+this.player.error.code))}),this.addPlayerEvent("waiting",function(){this.onWaiting()}),this.addPlayerEvent("durationchange",function(){if(this.player){this.duration.set(this.player.duration);var a=this;this.getDuration(function(b){a.trigger("durationchange",{duration:b})})}}),this.addPlayerEvent("progress",function(a){this.bytesTotal.set(a.total),this.bytesLoaded.set(a.loaded)}),!0}return!1},minplayer.players.html5.prototype.onReady=function(){minplayer.players.base.prototype.onReady.call(this),minplayer.isAndroid&&this.onLoaded(),minplayer.isIDevice&&setTimeout(function(a){return function(){a.pause(),a.onLoaded()}}(this),1)},minplayer.players.html5.prototype.playerFound=function(){return this.display.find(this.mediaFile.type).length>0},minplayer.players.html5.prototype.createPlayer=function(){minplayer.players.base.prototype.createPlayer.call(this);var a=jQuery(document.createElement(this.mediaFile.type)).attr(this.options.attributes).append(jQuery(document.createElement("source")).attr({src:this.mediaFile.path}));a.eq(0)[0].setAttribute("width","100%"),a.eq(0)[0].setAttribute("height","100%");var b=this.options.autoload?"metadata":"none";return b=minplayer.isIDevice?"metadata":b,a.eq(0)[0].setAttribute("preload",b),this.options.autoload||a.eq(0)[0].setAttribute("autobuffer",!1),a},minplayer.players.html5.prototype.getPlayer=function(){return this.elements.media.eq(0)[0]},minplayer.players.html5.prototype.load=function(a,b){minplayer.players.base.prototype.load.call(this,a,function(){this.hasEnded=!1;var c=this.elements.media.attr("src");c||(c=jQuery("source",this.elements.media).eq(0).attr("src")),c!==a.path&&(this.addPlayer(),this.player=this.getPlayer(),this.addPlayerEvents(),this.player.src=a.path,b&&b.call(this))})},minplayer.players.html5.prototype.play=function(a){minplayer.players.base.prototype.play.call(this,function(){this.player.play(),a&&a.call(this)})},minplayer.players.html5.prototype.pause=function(a){minplayer.players.base.prototype.pause.call(this,function(){this.player.pause(),a&&a.call(this)})},minplayer.players.html5.prototype.stop=function(a){minplayer.players.base.prototype.stop.call(this,function(){this.player.pause(),a&&a.call(this)})},minplayer.players.html5.prototype.clear=function(){minplayer.players.base.prototype.clear.call(this),this.player&&(this.player.src="")},minplayer.players.html5.prototype._seek=function(a){this.player.currentTime=a},minplayer.players.html5.prototype.setVolume=function(a,b){minplayer.players.base.prototype.setVolume.call(this,a,function(){this.player.volume=a,b&&b.call(this)})},minplayer.players.html5.prototype._getVolume=function(a){a(this.player.volume)},minplayer.players.html5.prototype._getDuration=function(a){a(this.player.duration)},minplayer.players.html5.prototype._getCurrentTime=function(a){a(this.player.currentTime)},minplayer.players.html5.prototype._getBytesLoaded=function(a){var b=0;this.bytesLoaded.value?b=this.bytesLoaded.value:this.player.buffered&&this.player.buffered.length>0&&this.player.buffered.end&&this.player.duration?b=this.player.buffered.end(0):void 0!==this.player.bytesTotal&&this.player.bytesTotal>0&&void 0!==this.player.bufferedBytes&&(b=this.player.bufferedBytes),a(b)},minplayer.players.html5.prototype._getBytesTotal=function(a){var b=0;this.bytesTotal.value?b=this.bytesTotal.value:this.player.buffered&&this.player.buffered.length>0&&this.player.buffered.end&&this.player.duration?b=this.player.duration:void 0!==this.player.bytesTotal&&this.player.bytesTotal>0&&void 0!==this.player.bufferedBytes&&(b=this.player.bytesTotal),a(b)};var minplayer=minplayer||{};minplayer.players=minplayer.players||{},minplayer.players.flash=function(a,b,c){minplayer.players.base.call(this,a,b,c)},minplayer.players.flash.prototype=new minplayer.players.base,minplayer.players.flash.prototype.constructor=minplayer.players.flash,minplayer.players.flash.prototype.construct=function(){minplayer.players.base.prototype.construct.call(this),this.options.pluginName="flash"},minplayer.players.flash.getPriority=function(){return 0},minplayer.players.flash.canPlay=function(){return!1},minplayer.players.flash.prototype.getFlash=function(a){var b=document.createElement("script");b.src="//ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js";var c=document.getElementsByTagName("script")[0];return c.parentNode.insertBefore(b,c),setTimeout(function(b){return function c(){"undefined"!=typeof swfobject?swfobject.embedSWF(a.swf,a.id,a.width,a.height,"9.0.0",!1,a.flashvars,{allowscriptaccess:"always",allowfullscreen:"true",wmode:a.wmode,quality:"high"},{id:a.id,name:a.id,playerType:"flash"},function(a){b.player=a.ref}):setTimeout(c,200)}}(this),200),'
'},minplayer.players.flash.prototype.playerFound=function(){return this.display.find('object[playerType="flash"]').length>0};var minplayer=minplayer||{};minplayer.players=minplayer.players||{},minplayer.players.minplayer=function(a,b,c){minplayer.players.flash.call(this,a,b,c)},minplayer.players.minplayer.prototype=new minplayer.players.flash,minplayer.players.minplayer.prototype.constructor=minplayer.players.minplayer,minplayer.players.minplayer.prototype.construct=function(){minplayer.players.flash.prototype.construct.call(this),this.options.pluginName="minplayer"},window.onFlashPlayerReady=function(a){for(var b=minplayer.get(a,"media"),c=b.length;c--;)b[c].onReady()},window.onFlashPlayerUpdate=function(a,b){for(var c=minplayer.get(a,"media"),d=c.length;d--;)c[d].onMediaUpdate(b)},window.onFlashPlayerDebug=function(a){console&&console.log&&console.log(a)},minplayer.players.minplayer.getPriority=function(a){return a.stream?100:1},minplayer.players.minplayer.canPlay=function(a){if(a.stream)return!0;var b=jQuery.inArray(a.mimetype,["video/x-webm","video/webm","application/octet-stream"])>=0;return!b&&("video"===a.type||"audio"===a.type)},minplayer.players.minplayer.prototype.createPlayer=function(){this.options.swfplayer||(this.options.swfplayer="http://mediafront.org/assets/osmplayer/minplayer",this.options.swfplayer+="/flash/minplayer.swf"),minplayer.players.flash.prototype.createPlayer.call(this);var a={id:this.options.id,debug:this.options.debug,config:"nocontrols",file:this.mediaFile.path,autostart:this.options.autoplay,autoload:this.options.autoload};return this.mediaFile.stream&&(a.stream=this.mediaFile.stream),this.getFlash({swf:this.options.swfplayer,id:this.options.id+"_player",width:"100%",height:"100%",flashvars:a,wmode:this.options.wmode})},minplayer.players.minplayer.prototype.onMediaUpdate=function(a){switch(a){case"mediaMeta":this.onLoaded();break;case"mediaConnected":this.onLoaded(),this.onPaused();break;case"mediaPlaying":this.onPlaying();break;case"mediaPaused":this.onPaused();break;case"mediaComplete":this.onComplete()}},minplayer.players.minplayer.prototype.load=function(a,b){minplayer.players.flash.prototype.load.call(this,a,function(){this.loaded?this.stop(function(){this.player.loadMedia(a.path,a.stream),b&&b.call(this)}):(this.player.loadMedia(a.path,a.stream),b&&b.call(this))})},minplayer.players.minplayer.prototype.play=function(a){minplayer.players.flash.prototype.play.call(this,function(){this.player.playMedia(),a&&a.call(this)})},minplayer.players.minplayer.prototype.pause=function(a){minplayer.players.flash.prototype.pause.call(this,function(){this.player.pauseMedia(),a&&a.call(this)})},minplayer.players.minplayer.prototype.stop=function(a){minplayer.players.flash.prototype.stop.call(this,function(){this.player.stopMedia(),a&&a.call(this)})},minplayer.players.minplayer.prototype._seek=function(a){this.player.seekMedia(a)},minplayer.players.minplayer.prototype.setVolume=function(a,b){minplayer.players.flash.prototype.setVolume.call(this,a,function(){this.player.setVolume(a),b&&b.call(this)})},minplayer.players.minplayer.prototype._getVolume=function(a){a(this.player.getVolume())},minplayer.players.minplayer.prototype._getDuration=function(a){var b=this,c=0,d=function(){c=b.player.getDuration(),c?a(c):setTimeout(d,1e3)};d()},minplayer.players.minplayer.prototype._getCurrentTime=function(a){a(this.player.getCurrentTime())},minplayer.players.minplayer.prototype._getBytesLoaded=function(a){a(this.player.getMediaBytesLoaded())},minplayer.players.minplayer.prototype._getBytesTotal=function(a){a(this.player.getMediaBytesTotal())};var minplayer=minplayer||{};minplayer.players=minplayer.players||{},minplayer.players.youtube=function(a,b,c){this.quality="default",minplayer.players.base.call(this,a,b,c)},minplayer.players.youtube.prototype=new minplayer.players.base,minplayer.players.youtube.prototype.constructor=minplayer.players.youtube,minplayer.players.youtube.prototype.construct=function(){minplayer.players.base.prototype.construct.call(this),this.options.pluginName="youtube"},minplayer.players.youtube.getPriority=function(){return 10},minplayer.players.youtube.canPlay=function(a){if("video/youtube"===a.mimetype)return!0;var b=/^http(s)?\:\/\/(www\.)?(youtube\.com|youtu\.be)/i;return 0===a.path.search(b)},minplayer.players.youtube.getMediaId=function(a){var b="^http[s]?\\:\\/\\/(www\\.)?";b+="(youtube\\.com\\/watch\\?v=|youtu\\.be\\/)",b+="([a-zA-Z0-9_\\-]+)";var c=RegExp(b,"i");return 0===a.path.search(c)?a.path.match(c)[3]:a.path},minplayer.players.youtube.getImage=function(a,b,c){b="thumbnail"===b?"1":"0",c("https://img.youtube.com/vi/"+a.id+"/"+b+".jpg")},minplayer.players.youtube.parseNode=function(a){var b="undefined"!=typeof a.video?a.video:a;return{title:b.title,description:b.description,mediafiles:{image:{thumbnail:{path:b.thumbnail.sqDefault},image:{path:b.thumbnail.hqDefault}},media:{media:{player:"youtube",id:b.id}}}}},minplayer.players.youtube.getNode=function(a,b){var c="https://gdata.youtube.com/feeds/api/videos/"+a.id;c+="?v=2&alt=jsonc",jQuery.get(c,function(a){b(minplayer.players.youtube.parseNode(a.data))})},minplayer.players.youtube.prototype.setPlayerState=function(a){switch(a){case YT.PlayerState.CUED:break;case YT.PlayerState.BUFFERING:this.onWaiting();break;case YT.PlayerState.UNSTARTED:case YT.PlayerState.PAUSED:this.onPaused();break;case YT.PlayerState.PLAYING:this.onPlaying();break;case YT.PlayerState.ENDED:this.onComplete()}},minplayer.players.youtube.prototype.onReady=function(){minplayer.players.base.prototype.onReady.call(this),this.options.autoplay||this.pause(),this.onLoaded()},minplayer.players.youtube.prototype.playerFound=function(){var a="iframe#"+this.options.id+"-player.youtube-player",b=this.display.find(a);return b.length>0},minplayer.players.youtube.prototype.onPlayerStateChange=function(a){this.setPlayerState(a.data)},minplayer.players.youtube.prototype.onQualityChange=function(a){this.quality=a.data},minplayer.players.youtube.prototype.hasPlayLoader=function(a){return minplayer.hasTouch||!a},minplayer.players.youtube.prototype.hasController=function(){return minplayer.isIDevice},minplayer.players.youtube.prototype.createPlayer=function(){minplayer.players.base.prototype.createPlayer.call(this);var a="https://www.youtube.com/iframe_api";if(0===jQuery('script[src="'+a+'"]').length){var b=document.createElement("script");b.src=a;var c=document.getElementsByTagName("script")[0];c.parentNode.insertBefore(b,c)}return this.playerId=this.options.id+"-player",this.poll(this.options.id+"_youtube",function(a){return function(){var b=jQuery("#"+a.playerId).length>0;if(b=b&&"YT"in window,b=b&&"function"==typeof YT.Player){jQuery("#"+a.playerId).addClass("youtube-player");var c=location.protocol;c+="//"+location.hostname,c+=location.port&&":"+location.port;var d={};minplayer.isIDevice?d.origin=c:d={enablejsapi:minplayer.isIDevice?0:1,origin:c,wmode:"opaque",controls:minplayer.isAndroid?1:0,rel:0,showinfo:0},a.player=new YT.Player(a.playerId,{height:"100%",width:"100%",frameborder:0,videoId:a.mediaFile.id,playerVars:d,events:{onReady:function(b){a.onReady(b)},onStateChange:function(b){a.onPlayerStateChange(b)},onPlaybackQualityChange:function(b){a.onQualityChange(b)},onError:function(b){a.onError(b)}}})}return!b}}(this),200),jQuery(document.createElement("div")).attr({id:this.playerId})},minplayer.players.youtube.prototype.load=function(a,b){minplayer.players.base.prototype.load.call(this,a,function(){this.player.loadVideoById(a.id,0,this.quality),b&&b.call(this)})},minplayer.players.youtube.prototype.play=function(a){minplayer.players.base.prototype.play.call(this,function(){this.onWaiting(),this.player.playVideo(),a&&a.call(this)})},minplayer.players.youtube.prototype.pause=function(a){minplayer.players.base.prototype.pause.call(this,function(){this.player.pauseVideo(),a&&a.call(this)})},minplayer.players.youtube.prototype.stop=function(a){minplayer.players.base.prototype.stop.call(this,function(){this.player.stopVideo(),a&&a.call(this)})},minplayer.players.youtube.prototype._seek=function(a){this.onWaiting(),this.player.seekTo(a,!0)},minplayer.players.youtube.prototype.setVolume=function(a,b){minplayer.players.base.prototype.setVolume.call(this,a,function(){this.player.setVolume(100*a),b&&b.call(this)})},minplayer.players.youtube.prototype._getVolume=function(a){a(this.player.getVolume())},minplayer.players.youtube.prototype._getDuration=function(a){a(this.player.getDuration())},minplayer.players.youtube.prototype._getCurrentTime=function(a){a(this.player.getCurrentTime())},minplayer.players.youtube.prototype._getBytesStart=function(a){a(this.player.getVideoStartBytes())},minplayer.players.youtube.prototype._getBytesLoaded=function(a){a(this.player.getVideoBytesLoaded())},minplayer.players.youtube.prototype._getBytesTotal=function(a){a(this.player.getVideoBytesTotal())};var minplayer=minplayer||{};minplayer.players=minplayer.players||{},minplayer.players.vimeo=function(a,b,c){minplayer.players.base.call(this,a,b,c)},minplayer.players.vimeo.prototype=new minplayer.players.base,minplayer.players.vimeo.prototype.constructor=minplayer.players.vimeo,minplayer.players.vimeo.prototype.construct=function(){minplayer.players.base.prototype.construct.call(this),this.options.pluginName="vimeo"},minplayer.players.vimeo.getPriority=function(){return 10},minplayer.players.vimeo.canPlay=function(a){return"video/vimeo"===a.mimetype?!0:0===a.path.search(/^http(s)?\:\/\/(www\.)?vimeo\.com/i)},minplayer.players.vimeo.prototype.hasPlayLoader=function(){return minplayer.hasTouch},minplayer.players.vimeo.prototype.hasController=function(){return minplayer.hasTouch},minplayer.players.vimeo.getMediaId=function(a){var b=/^http[s]?\:\/\/(www\.)?vimeo\.com\/(\?v\=)?([0-9]+)/i;return 0===a.path.search(b)?a.path.match(b)[3]:a.path},minplayer.players.vimeo.parseNode=function(a){return{title:a.title,description:a.description,mediafiles:{image:{thumbnail:{path:a.thumbnail_small},image:{path:a.thumbnail_large}},media:{media:{player:"vimeo",id:a.id}}}}},minplayer.players.vimeo.nodes={},minplayer.players.vimeo.getNode=function(a,b){minplayer.players.vimeo.nodes.hasOwnProperty(a.id)?b(minplayer.players.vimeo.nodes[a.id]):jQuery.ajax({url:"https://vimeo.com/api/v2/video/"+a.id+".json",dataType:"jsonp",success:function(c){var d=minplayer.players.vimeo.parseNode(c[0]);minplayer.players.vimeo.nodes[a.id]=d,b(d)}})},minplayer.players.vimeo.getImage=function(a,b,c){minplayer.players.vimeo.getNode(a,function(a){c(a.mediafiles.image.image)})},minplayer.players.vimeo.prototype.reset=function(){minplayer.players.base.prototype.reset.call(this)},minplayer.players.vimeo.prototype.createPlayer=function(){minplayer.players.base.prototype.createPlayer.call(this);var a="http://a.vimeocdn.com/js/froogaloop2.min.js";if(0===jQuery('script[src="'+a+'"]').length){var b=document.createElement("script");b.src=a;var c=document.getElementsByTagName("script")[0];c.parentNode.insertBefore(b,c)}var d=document.createElement("iframe");d.setAttribute("id",this.options.id+"-player"),d.setAttribute("type","text/html"),d.setAttribute("width","100%"),d.setAttribute("height","100%"),d.setAttribute("frameborder","0"),jQuery(d).addClass("vimeo-player");var e="https://player.vimeo.com/video/";return e+=this.mediaFile.id+"?",e+=jQuery.param({wmode:"opaque",api:1,player_id:this.options.id+"-player",title:0,byline:0,portrait:0,loop:this.options.loop}),d.setAttribute("src",e),this.poll(this.options.id+"_vimeo",function(a){return function(){if(window.Froogaloop){a.player=window.Froogaloop(d);var b=0;a.player.addEvent("ready",function(){clearTimeout(b),a.onReady(),a.onError("")}),b=setTimeout(function(){a.onReady()},3e3)}return!window.Froogaloop}}(this),200),this.trigger("loadstart"),d},minplayer.players.vimeo.prototype.onReady=function(){this.player.addEvent("loadProgress",function(a){return function(b){a.duration.set(parseFloat(b.duration)),a.bytesLoaded.set(b.bytesLoaded),a.bytesTotal.set(b.bytesTotal)}}(this)),this.player.addEvent("playProgress",function(a){return function(b){a.duration.set(parseFloat(b.duration)),a.currentTime.set(parseFloat(b.seconds))}}(this)),this.player.addEvent("play",function(a){return function(){a.onPlaying()}}(this)),this.player.addEvent("pause",function(a){return function(){a.onPaused()}}(this)),this.player.addEvent("finish",function(a){return function(){a.onComplete()}}(this)),minplayer.players.base.prototype.onReady.call(this),this.onLoaded(),this.options.autoplay&&this.play()},minplayer.players.vimeo.prototype.clear=function(){this.player&&this.player.api("unload"),minplayer.players.base.prototype.clear.call(this)},minplayer.players.vimeo.prototype.load=function(a,b){minplayer.players.base.prototype.load.call(this,a,function(){this.construct(),b&&b.call(this)})},minplayer.players.vimeo.prototype.play=function(a){minplayer.players.base.prototype.play.call(this,function(){this.player.api("play"),a&&a.call(this)})},minplayer.players.vimeo.prototype.pause=function(a){minplayer.players.base.prototype.pause.call(this,function(){this.player.api("pause"),a&&a.call(this)})},minplayer.players.vimeo.prototype.stop=function(a){minplayer.players.base.prototype.stop.call(this,function(){this.player.api("unload"),a&&a.call(this)})},minplayer.players.vimeo.prototype._seek=function(a){this.player.api("seekTo",a)},minplayer.players.vimeo.prototype.setVolume=function(a,b){minplayer.players.base.prototype.setVolume.call(this,a,function(){this.volume.set(a),this.player.api("setVolume",a),b&&b.call(this)})},minplayer.players.vimeo.prototype._getVolume=function(a){this.player.api("getVolume",function(b){a(b)})},minplayer.players.vimeo.prototype._getDuration=function(a){this.player.api("getDuration",function(b){a(b)})};var minplayer=minplayer||{};minplayer.players=minplayer.players||{},minplayer.players.limelight=function(a,b){minplayer.players.flash.call(this,a,b)},minplayer.players.limelight.prototype=new minplayer.players.flash,minplayer.players.limelight.prototype.constructor=minplayer.players.limelight,minplayer.players.limelight.prototype.construct=function(){minplayer.players.flash.prototype.construct.call(this),this.options.pluginName="limelight"},minplayer.players.limelight.getPriority=function(){return 10},minplayer.players.limelight.canPlay=function(a){if("video/limelight"===a.mimetype)return!0;var b=/.*limelight\.com.*/i;return 0===a.path.search(b)},minplayer.players.limelight.getMediaId=function(a){var b=/.*limelight\.com.*mediaId=([a-zA-Z0-9]+)/i;return 0===a.path.search(b)?a.path.match(b)[1]:a.path},minplayer.players.limelight.prototype.register=function(){window.delvePlayerCallback=function(a,b,c){var d=a.replace("-player","");jQuery.each(minplayer.get(d,"media"),function(a,d){d.onMediaUpdate(b,c)})}},minplayer.players.limelight.prototype.onMediaUpdate=function(a,b){switch(a){case"onPlayerLoad":this.onReady();break;case"onMediaLoad":if(this.complete)return this.pause(),void this.onPaused();this.shouldSeek=this.startTime>0,this.onLoaded();break;case"onMediaComplete":this.complete=!0,this.onComplete();break;case"onPlayheadUpdate":!b.positionInMilliseconds||this.playing||this.complete||this.onPlaying(),this.complete=!1,this.shouldSeek&&this.seekValue?(this.shouldSeek=!1,this.seek(this.seekValue)):(this.duration.set(b.durationInMilliseconds/1e3),this.currentTime.set(b.positionInMilliseconds/1e3));break;case"onError":this.onError();break;case"onPlayStateChanged":b.isPlaying?this.onPlaying():b.isBusy?this.onWaiting():this.onPaused()}},minplayer.players.limelight.prototype.createPlayer=function(){minplayer.players.flash.prototype.createPlayer.call(this);var a=document.createElement("script");a.src="https://assets.delvenetworks.com/player/embed.js";var b=document.getElementsByTagName("script")[0];b.parentNode.insertBefore(a,b),this.register();var c={deepLink:"true",autoplay:this.options.autoplay?"true":"false",startQuality:"HD"},d=null,e=this.options.channel;e||(d=/.*limelight\.com.*channelId=([a-zA-Z0-9]+)/i,0===this.mediaFile.path.search(d)&&(e=this.mediaFile.path.match(d)[1])),e&&"media"===this.mediaFile.queueType&&(c.adConfigurationChannelId=e);var f=this.options.playerForm;f||(d=/.*limelight\.com.*playerForm=([a-zA-Z0-9]+)/i,0===this.mediaFile.path.search(d)&&(f=this.mediaFile.path.match(d)[1])),f&&(c.playerForm=f),c.mediaId=this.mediaFile.id;var g=this.options.id+"-player";return setTimeout(function h(){window.hasOwnProperty("LimelightPlayerUtil")?window.LimelightPlayerUtil.initEmbed(g):setTimeout(h,1e3)},1e3),this.getFlash({swf:document.location.protocol+"//assets.delvenetworks.com/player/loader.swf",id:g,width:this.options.width,height:"100%",flashvars:c,wmode:this.options.wmode})},minplayer.players.limelight.prototype.play=function(a){minplayer.players.flash.prototype.play.call(this,function(){this.player.doPlay(),a&&a.call(this)})},minplayer.players.limelight.prototype.pause=function(a){minplayer.players.flash.prototype.pause.call(this,function(){this.player.doPause(),a&&a.call(this)})},minplayer.players.limelight.prototype.stop=function(a){minplayer.players.flash.prototype.stop.call(this,function(){this.player.doPause(),a&&a.call(this)})},minplayer.players.limelight.prototype._seek=function(a){this.seekValue=a,this.player.doSeekToSecond(a)},minplayer.players.limelight.prototype.setVolume=function(a,b){minplayer.players.flash.prototype.setVolume.call(this,a,function(){this.player.doSetVolume(a),b&&b.call(this)})},minplayer.players.limelight.prototype._getVolume=function(a){a(this.player.doGetVolume())},minplayer.players.limelight.prototype.search=function(a){this.whenReady(function(){this.player.doSearch(a)})};var minplayer=minplayer||{};minplayer.players=minplayer.players||{},minplayer.players.kaltura=function(a,b){minplayer.players.base.call(this,a,b)},minplayer.players.kaltura.prototype=new minplayer.players.base,minplayer.players.kaltura.prototype.constructor=minplayer.players.kaltura,minplayer.players.kaltura.prototype.construct=function(){minplayer.players.base.prototype.construct.call(this),this.options.pluginName="kaltura",this.adPlaying=!1},minplayer.players.kaltura.prototype.defaultOptions=function(a){a.entryId=0,a.uiConfId=0,a.partnerId=0,minplayer.players.base.prototype.defaultOptions.call(this,a)},minplayer.players.kaltura.getPriority=function(){return 10},minplayer.players.kaltura.canPlay=function(a){if("video/kaltura"===a.mimetype)return!0;var b=/.*kaltura\.com.*/i;return 0===a.path.search(b)},minplayer.players.kaltura.prototype.adStart=function(){this.adPlaying=!0,this.onPlaying()},minplayer.players.kaltura.prototype.adEnd=function(){this.adPlaying=!1},minplayer.players.kaltura.prototype.playerStateChange=function(a){if(!this.adPlaying)switch(a){case"ready":this.onLoaded();break;case"loading":case"buffering":this.onWaiting();break;case"playing":this.onPlaying();break;case"paused":this.onPaused()}},minplayer.players.kaltura.prototype.mediaReady=function(){this.onLoaded()},minplayer.players.kaltura.prototype.playerPlayEnd=function(){this.onComplete()},minplayer.players.kaltura.prototype.playUpdate=function(a){this.currentTime.set(a)},minplayer.players.kaltura.prototype.durationChange=function(a){this.duration.set(a.newValue)},minplayer.players.kaltura.prototype.getInstance=function(){if(this.instanceName)return this.instanceName;var a=this.uuid.split("__"),b="minplayer.plugins."+a[0];return b+="."+a[1],b+="["+(a[2]-1)+"]",this.instanceName=b,b},minplayer.players.kaltura.prototype.registerEvents=function(){this.player.addJsListener("adStart",this.getInstance()+".adStart"),this.player.addJsListener("adEnd",this.getInstance()+".adEnd"),this.player.addJsListener("playerStateChange",this.getInstance()+".playerStateChange"),this.player.addJsListener("durationChange",this.getInstance()+".durationChange"),this.player.addJsListener("mediaReady",this.getInstance()+".mediaReady"),this.player.addJsListener("playerUpdatePlayhead",this.getInstance()+".playUpdate"),this.player.addJsListener("playerPlayEnd",this.getInstance()+".playerPlayEnd") +function checkPlayType(a,b){if("function"==typeof a.canPlayType){if("object"==typeof b){for(var c=b.length,d="";c--&&!(d=checkPlayType(a,b[c])););return d}var e=a.canPlayType(b);if("no"!==e&&""!==e)return b}return""}var minplayer=minplayer||{};!function(a){!function(){"use strict";var a="undefined"!=typeof module&&module.exports,b="undefined"!=typeof Element&&"ALLOW_KEYBOARD_INPUT"in Element,c=function(){for(var a,b,c=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],d=0,e=c.length,f={};e>d;d++)if(a=c[d],a&&a[1]in document){for(d=0,b=a.length;b>d;d++)f[c[0][d]]=a[d];return f}return!1}(),d={request:function(a){var d=c.requestFullscreen;a=a||document.documentElement,/5\.1[\.\d]* Safari/.test(navigator.userAgent)?a[d]():a[d](b&&Element.ALLOW_KEYBOARD_INPUT)},exit:function(){document[c.exitFullscreen]()},toggle:function(a){this.isFullscreen?this.exit():this.request(a)},onchange:function(){},onerror:function(){},raw:c};return c?(Object.defineProperties(d,{isFullscreen:{get:function(){return!!document[c.fullscreenElement]}},element:{enumerable:!0,get:function(){return document[c.fullscreenElement]}},enabled:{enumerable:!0,get:function(){return!!document[c.fullscreenEnabled]}}}),document.addEventListener(c.fullscreenchange,function(a){d.onchange.call(d,a)}),document.addEventListener(c.fullscreenerror,function(a){d.onerror.call(d,a)}),void(a?module.exports=d:window.screenfull=d)):void(a?module.exports=!1:window.screenfull=!1)}(),a.screenfull=screenfull}(minplayer);var minplayer=minplayer||{};if(minplayer.compatibility=function(){var a=null;a=document.createElement("video"),this.videoOGG=checkPlayType(a,"video/ogg"),this.videoH264=checkPlayType(a,["video/mp4","video/h264"]),this.videoWEBM=checkPlayType(a,["video/x-webm","video/webm","application/octet-stream"]),this.videoMPEGURL=checkPlayType(a,"application/vnd.apple.mpegurl"),a=document.createElement("audio"),this.audioOGG=checkPlayType(a,"audio/ogg"),this.audioMP3=checkPlayType(a,"audio/mpeg"),this.audioMP4=checkPlayType(a,"audio/mp4")},minplayer.playTypes||(minplayer.playTypes=new minplayer.compatibility,minplayer.isAndroid=/android/gi.test(navigator.appVersion),minplayer.isIDevice=/iphone|ipad/gi.test(navigator.appVersion),minplayer.isPlaybook=/playbook/gi.test(navigator.appVersion),minplayer.isTouchPad=/hp-tablet/gi.test(navigator.appVersion),minplayer.hasTouch="ontouchstart"in window&&!minplayer.isTouchPad),!minplayer.urlVars){minplayer.urlVars={};var regEx=/[?&]+([^=&]+)=([^&]*)/gi;window.location.href.replace(regEx,function(a,b,c){minplayer.urlVars[b]=c})}var minplayer=minplayer||{};minplayer.async=function(){this.value=null,this.queue=[]},minplayer.async.prototype.get=function(a){null!==this.value?a(this.value):this.queue.push(a)},minplayer.async.prototype.set=function(a){this.value=a;var b=this.queue.length;if(b){for(;b--;)this.queue[b](a);this.queue=[]}};var minplayer=minplayer||{};minplayer.flags=function(){this.flag=0,this.ids={},this.numFlags=0},minplayer.flags.prototype.setFlag=function(a,b){this.ids.hasOwnProperty(a)||(this.ids[a]=this.numFlags,this.numFlags++),b?this.flag|=1<c;c++)minplayer.queue.hasOwnProperty(c)&&(b=minplayer.queue[c],d=!b.id&&!b.plugin,d|=b.plugin===a.name,d&=!b.id||b.id===this.options.id,d&&!b.addedto.hasOwnProperty(a.options.id)&&(b.addedto[a.options.id]=!0,d=minplayer.bind.call(b.context,b.event,this.options.id,a.name,b.callback,!0)));minplayer.lock=!1},minplayer.eventTypes={},minplayer.plugin.prototype.isEvent=function(a,b){var c=a+"__"+b;if("undefined"!=typeof minplayer.eventTypes[c])return minplayer.eventTypes[c];new RegExp("^(.*:)?"+b+"$","gi");return minplayer.eventTypes[c]=null!==a.match(b),minplayer.eventTypes[c]},minplayer.plugin.prototype.trigger=function(a,b,c){if(!this.active)return this;c||(this.triggered[a]=b);var d=0,e={},f=null;for(var g in this.queue)if(this.isEvent(g,a)){f=this.queue[g];for(d in f)f.hasOwnProperty(d)&&(e=f[d],e.callback({target:this,data:e.data},b))}return this},minplayer.plugin.prototype.ubind=function(a,b,c){return this.unbind(a),this.bind(a,b,c)},minplayer.plugin.prototype.bind=function(a,b,c){if(!this.active)return this;if("function"==typeof b&&(c=b,b=null),a&&c){this.queue[a]=this.queue[a]||[],this.queue[a].push({callback:c,data:b});for(var d in this.triggered)this.triggered.hasOwnProperty(d)&&this.isEvent(a,d)&&c({target:this,data:b},this.triggered[d]);return this}},minplayer.plugin.prototype.unbind=function(a){return this.lock&&setTimeout(function(b){return function(){b.unbind(a)}}(this),10),this.lock=!0,a?this.queue.hasOwnProperty(a)&&this.queue[a].length>0&&(this.queue[a].length=0):this.queue={},this.lock=!1,this},minplayer.addQueue=function(a,b,c,d,e){minplayer.lock?setTimeout(function(){minplayer.addQueue(a,c,b,d,e)},10):minplayer.queue.push({context:a,id:c,event:b,plugin:d,callback:e,addedto:{}})},minplayer.bind=function(a,b,c,d,e){if(!d)return!1;var f=minplayer.plugins,g=null,h=null,i=[],j=function(a,b){if(f.hasOwnProperty(a)&&f[a].hasOwnProperty(b))for(var c=f[a][b].length;c--;)i.push(f[a][b][c])};if(b&&c)j(b,c);else if(!b&&c)for(h in f)j(h,c);else if(b&&!c&&f[b])for(g in f[b])j(b,g);else if(!b&&!c)for(h in f)for(g in f[h])j(h,g);for(var k=i.length;k--;)i[k].bind(a,function(a){return function(b){d.call(a,b.target)}}(this));return e||minplayer.addQueue(this,a,b,c,d),i.length>0},minplayer.get=function(a,b,c){var d=typeof a,e=typeof b,f=typeof c;if("function"===d?(c=a,b=a=null):"function"===e?(c=b,b=a,a=null):"undefined"===e&&"undefined"===f&&(b=a,c=a=null),c="function"==typeof c?c:null)return void minplayer.bind.call(this,"ready",a,b,c);var g=minplayer.plugins,h=null;if(!(a||b||c))return g;if(a&&!b&&!c)return g[a];if(a&&b&&!c)return g[a][b];if(!a&&b&&!c){var i=[];for(h in g)if(g.hasOwnProperty(h)&&g[h].hasOwnProperty(b))for(var j=g[h][b].length;j--;)i.push(g[h][b][j]);return i}},minplayer.display=function(a,b,c,d){minplayer.plugin.call(this,a,b,c,d)},minplayer.display.prototype=new minplayer.plugin,minplayer.display.prototype.constructor=minplayer.display,minplayer.display.prototype.getDisplay=function(a){return a},minplayer.display.prototype.initialize=function(){this.display||(this.display=this.getDisplay(this.context,this.options)),this.display&&(this.options.pluginName="display",this.elements=this.getElements(),minplayer.plugin.prototype.initialize.call(this))},minplayer.display.prototype.construct=function(){if(minplayer.plugin.prototype.construct.call(this),this.autoHide=!1,this.onResize){var a=0;jQuery(window).resize(function(b){return function(){clearTimeout(a),a=setTimeout(function(){b.onResize()},200)}}(this))}},minplayer.display.prototype.onResize=!1,minplayer.display.prototype.hide=function(a){a=a||this.display,a&&(a.forceHide=!0,a.unbind().hide())},minplayer.display.prototype.fullScreenElement=function(){return this.display},minplayer.click=function(a,b){var c=!1;return a=jQuery(a),a.bind("touchstart click",function(a){c||(c=!0,setTimeout(function(){c=!1},100),b.call(this,a))}),a},minplayer.display.prototype.onFocus=function(a){this.hasFocus=this.focus=a,this.autoHide&&this.showThenHide(this.autoHide.element,this.autoHide.timeout,this.autoHide.cb)},minplayer.display.prototype.showThenHide=function(a,b,c){var d=typeof a;"undefined"===d?(c=null,a=this.display):"number"===d?(c=b,b=a,a=this.display):"function"===d&&(c=a,a=this.display),a&&(b=b||5e3,this.autoHide={element:a,timeout:b,cb:c},a.forceHide||("undefined"!=typeof a.showMe?a.showMe&&a.showMe(c):(a.show(),c&&c(!0))),a.hoverState||(jQuery(a).bind("mouseenter",function(){a.hoverState=!0}),jQuery(a).bind("mouseleave",function(){a.hoverState=!1})),clearTimeout(this.showTimer),this.showTimer=setTimeout(function(d){return function e(){a.hoverState?d.showTimer=setTimeout(e,b):"undefined"!=typeof a.hideMe?a.hideMe&&a.hideMe(c):a.hide("slow",function(){c&&c(!1)})}}(this),b))},minplayer.display.prototype.fullscreen=function(a){var b=this.isFullScreen(),c=this.fullScreenElement();b&&!a?(c.removeClass("fullscreen"),minplayer.screenfull&&minplayer.screenfull.exit(),this.trigger("fullscreen",!1)):!b&&a&&(c.addClass("fullscreen"),minplayer.screenfull&&(minplayer.screenfull.request(c[0]),minplayer.screenfull.onchange=function(a){return function(){minplayer.screenfull.isFullscreen||a.fullscreen(!1)}}(this)),this.trigger("fullscreen",!0))},minplayer.display.prototype.toggleFullScreen=function(){this.fullscreen(!this.isFullScreen())},minplayer.display.prototype.isFullScreen=function(){return this.fullScreenElement().hasClass("fullscreen")},minplayer.display.prototype.getScaledRect=function(a,b){var c={};return c.x=b.x?b.x:0,c.y=b.y?b.y:0,c.width=b.width?b.width:0,c.height=b.height?b.height:0,a&&(b.width/b.height>a?(c.height=b.height,c.width=Math.floor(b.height*a)):(c.height=Math.floor(b.width/a),c.width=b.width),c.x=Math.floor((b.width-c.width)/2),c.y=Math.floor((b.height-c.height)/2)),c},minplayer.display.prototype.getElements=function(){return{}},jQuery.fn.minplayer||(jQuery.fn.minplayer=function(a){return jQuery(this).each(function(){a=a||{},a.id=a.id||jQuery(this).attr("id")||Math.random(),minplayer.plugins[a.id]||(a.template=a.template||"default",minplayer[a.template]?new minplayer[a.template](jQuery(this),a):new minplayer(jQuery(this),a))})}),minplayer=jQuery.extend(function(a,b){minplayer.display.call(this,"player",a,b)},minplayer),minplayer.prototype=new minplayer.display,minplayer.prototype.constructor=minplayer,minplayer.prototype.defaultOptions=function(a){a.id="player",a.build=!1,a.wmode="transparent",a.preload=!0,a.autoplay=!1,a.autoload=!0,a.loop=!1,a.width="100%",a.height="350px",a.debug=!1,a.volume=80,a.files=null,a.file="",a.preview="",a.attributes={},a.plugins={},a.logo="",a.link="",a.duration=0,jQuery.each(this.context[0].attributes,function(b,c){a[c.name]=c.value}),minplayer.display.prototype.defaultOptions.call(this,a)},minplayer.prototype.construct=function(){minplayer.display.prototype.construct.call(this);var a=null;for(var b in this.options.plugins)a=this.options.plugins[b],minplayer[a]&&(a=minplayer[a],a[this.options.template]&&a[this.options.template].init?a[this.options.template].init(this):a.init&&a.init(this));if(this.options.pluginName="player",this.controller=this.create("controller"),this.playLoader=this.create("playLoader"),this.options.logo&&this.elements.logo){var c="";this.options.link&&(c+=''),c+='',this.options.link&&(c+=""),this.logo=this.elements.logo.append(c)}this.currentPlayer="html5",this.addKeyEvents(),this.addEvents(),this.load(this.getFiles()),this.ready()},minplayer.prototype.setFocus=function(a){minplayer.get.call(this,this.options.id,null,function(b){b.onFocus(a)}),this.trigger("playerFocus",a)},minplayer.prototype.bindTo=function(a){a.ubind(this.uuid+":error",function(a){return function(b,c){"html5"===a.currentPlayer?(minplayer.player="minplayer",a.options.file.player="minplayer",a.loadPlayer()):a.showError(c)}}(this)),a.ubind(this.uuid+":fullscreen",function(a){return function(){a.resize()}}(this))},minplayer.prototype.addEvents=function(){var a=!1;this.display.bind("mouseenter",function(b){return function(){a=!0,b.setFocus(!0)}}(this)),this.display.bind("mouseleave",function(b){return function(){a=!1,b.setFocus(!1)}}(this));var b=!1;this.display.bind("mousemove",function(c){return function(){b||(b=setTimeout(function(){b=!1,a&&c.setFocus(!0)},300))}}(this)),minplayer.get.call(this,this.options.id,null,function(a){return function(b){a.bindTo(b)}}(this))},minplayer.prototype.showError=function(a){"object"!=typeof a&&(a=a||"",this.elements.error&&(this.elements.error.text(a),a?(this.elements.error.show(),setTimeout(function(a){return function(){a.elements.error.hide("slow")}}(this),5e3)):this.elements.error.hide()))},minplayer.prototype.addKeyEvents=function(){jQuery(document).bind("keydown",function(a){return function(b){switch(b.keyCode){case 113:case 27:a.isFullScreen()&&a.fullscreen(!1)}}}(this))},minplayer.prototype.getFiles=function(){if(this.options.files)return this.options.files;if(this.options.file)return this.options.file;var a=[],b=null;return this.elements.media&&(b=this.elements.media.attr("src"),b&&a.push({path:b}),jQuery("source",this.elements.media).each(function(){a.push({path:jQuery(this).attr("src"),mimetype:jQuery(this).attr("type"),codecs:jQuery(this).attr("codecs")})})),a},minplayer.getMediaFile=function(a){if(!a)return null;if("string"==typeof a||a.path||a.id)return new minplayer.file(a);var b=0,c=null,d=null;for(var e in a)a.hasOwnProperty(e)&&(d=new minplayer.file(a[e]),d.player&&d.priority>b&&(b=d.priority,c=d));return c},minplayer.prototype.loadPlayer=function(){if(!this.options.file||0===this.elements.display.length)return!1;if(!this.options.file.player)return!1;this.showError();var a=this.options.file.player.toString();if(!this.media||a!==this.currentPlayer){if(this.currentPlayer=a,!this.elements.display)return void this.showError("No media display found.");var b={};return this.media&&(b=this.media.queue,this.media.destroy()),pClass=minplayer.players[this.options.file.player],this.options.mediaelement=this.elements.media,this.media=new pClass(this.elements.display,this.options,b),this.media.load(this.options.file),this.display.addClass("minplayer-player-"+this.media.mediaFile.player),!0}return this.media?(this.media.options=this.options,this.display.removeClass("minplayer-player-"+this.media.mediaFile.player),this.media.load(this.options.file),this.display.addClass("minplayer-player-"+this.media.mediaFile.player),!1):void 0},minplayer.prototype.load=function(a){return this.options.files=a||this.options.files,this.options.file=minplayer.getMediaFile(this.options.files),this.loadPlayer()?(this.bindTo(this.media),this.options.file.mimetype&&!this.options.file.player?(this.showError("Cannot play media: "+this.options.file.mimetype),!1):!0):!1},minplayer.prototype.resize=function(){this.get(function(a){a.onResize&&a.onResize()})};var minplayer=minplayer||{};minplayer.image=function(a,b){this.loaded=!1,this.loader=null,this.ratio=0,this.img=null,minplayer.display.call(this,"image",a,b)},minplayer.image.prototype=new minplayer.display,minplayer.image.prototype.constructor=minplayer.image,minplayer.image.prototype.construct=function(){minplayer.display.prototype.construct.call(this),this.options.pluginName="image",this.display.css("overflow","hidden"),this.loader=new Image,this.loader.onload=function(a){return function(){a.loaded=!0,a.ratio=a.loader.width/a.loader.height,a.resize(),a.trigger("loaded")}}(this),this.ready()},minplayer.image.prototype.load=function(a){this.clear(function(){this.display.empty(),this.img=jQuery(document.createElement("img")).attr({src:""}).hide(),this.display.append(this.img),this.loader.src=a,this.img.attr("src",a)})},minplayer.image.prototype.clear=function(a){this.loaded=!1,this.img?this.img.fadeOut(150,function(b){return function(){b.img.attr("src",""),b.loader.src="",jQuery(this).remove(),a&&a.call(b)}}(this)):a&&a.call(this)},minplayer.image.prototype.resize=function(a,b){if(a=a||this.display.parent().width(),b=b||this.display.parent().height(),a&&b&&this.loaded){var c=this.getScaledRect(this.ratio,{width:a,height:b});this.img&&this.img.attr("src",this.loader.src).css({marginLeft:c.x,marginTop:c.y,width:c.width,height:c.height}),this.img.fadeIn(150)}},minplayer.image.prototype.onResize=function(){this.resize()};var minplayer=minplayer||{};minplayer.file=function(a){return a?(a="string"==typeof a?{path:a}:a,a.hasOwnProperty("isMinPlayerFile")?a:(this.isMinPlayerFile=!0,this.duration=a.duration||0,this.bytesTotal=a.bytesTotal||0,this.quality=a.quality||0,this.stream=a.stream||"",this.path=a.path||"",this.codecs=a.codecs||"",this.extension=a.extension||this.getFileExtension(),this.mimetype=a.mimetype||a.filemime||this.getMimeType(),this.type=a.type||this.getType(),this.type||(this.mimetype=this.getMimeType(),this.type=this.getType()),this.player=minplayer.player||a.player||this.getBestPlayer(),this.priority=a.priority||this.getPriority(),this.id=a.id||this.getId(),void(this.path||(this.path=this.id)))):null},minplayer.player="",minplayer.file.prototype.getBestPlayer=function(){var a=null,b=0;return jQuery.each(minplayer.players,function(c){return function(d,e){var f=e.getPriority(c);e.canPlay(c)&&f>b&&(a=d,b=f)}}(this)),a},minplayer.file.prototype.getPriority=function(){var a=1;switch(this.player&&(a=minplayer.players[this.player].getPriority(this)),this.mimetype){case"video/x-webm":case"video/webm":case"application/octet-stream":case"application/vnd.apple.mpegurl":return 10*a;case"video/mp4":case"audio/mp4":case"audio/mpeg":return 9*a;case"video/ogg":case"audio/ogg":case"video/quicktime":return 8*a;default:return 5*a}},minplayer.file.prototype.getFileExtension=function(){return this.path.substring(this.path.lastIndexOf(".")+1).toLowerCase()},minplayer.file.prototype.getMimeType=function(){switch(this.extension){case"mp4":case"m4v":case"flv":case"f4v":return"video/mp4";case"m3u8":return"application/vnd.apple.mpegurl";case"webm":return"video/webm";case"ogg":case"ogv":return"video/ogg";case"3g2":return"video/3gpp2";case"3gpp":case"3gp":return"video/3gpp";case"mov":return"video/quicktime";case"swf":return"application/x-shockwave-flash";case"oga":return"audio/ogg";case"mp3":return"audio/mpeg";case"m4a":case"f4a":return"audio/mp4";case"aac":return"audio/aac";case"wav":return"audio/vnd.wave";case"wma":return"audio/x-ms-wma";default:return"unknown"}},minplayer.file.prototype.getType=function(){var a=this.mimetype.match(/([^\/]+)(\/)/);if(a=a&&a.length>1?a[1]:"","video"===a)return"video";if("audio"===a)return"audio";switch(this.mimetype){case"application/octet-stream":case"application/x-shockwave-flash":case"application/vnd.apple.mpegurl":return"video"}return""},minplayer.file.prototype.getId=function(){var a=minplayer.players[this.player];return a&&a.getMediaId?a.getMediaId(this):""};var minplayer=minplayer||{};minplayer.playLoader=function(a,b){this.clear(),minplayer.display.call(this,"playLoader",a,b)},minplayer.playLoader.prototype=new minplayer.display,minplayer.playLoader.prototype.constructor=minplayer.playLoader,minplayer.playLoader.prototype.construct=function(){minplayer.display.prototype.construct.call(this),this.options.pluginName="playLoader",this.initializePlayLoader(),this.ready()},minplayer.playLoader.prototype.initializePlayLoader=function(){this.get("media",function(a){if(a.hasPlayLoader(this.options.preview))this.enabled=!1,this.hide(this.elements.busy),this.hide(this.elements.bigPlay),this.hide(this.elements.preview),this.hide();else{this.enabled=!0,this.options.preview||(this.options.preview=a.poster);var b=!0;this.preview&&this.preview.loader&&(b=this.preview.loader.src!==this.options.preview),b&&(a.elements.media.attr("poster",""),this.loadPreview()),this.elements.bigPlay&&minplayer.click(this.elements.bigPlay.unbind(),function(b){b.preventDefault(),jQuery(this).hide(),a.play()}),a.ubind(this.uuid+":loadstart",function(a){return function(){a.busy.setFlag("media",!0),a.bigPlay.setFlag("media",!0),a.previewFlag.setFlag("media",!0),a.checkVisibility()}}(this)),a.ubind(this.uuid+":waiting",function(a){return function(b,c,d){d||(a.busy.setFlag("media",!0),a.checkVisibility())}}(this)),a.ubind(this.uuid+":loadeddata",function(a){return function(b,c,d){d||(a.busy.setFlag("media",!1),a.checkVisibility())}}(this)),a.ubind(this.uuid+":playing",function(b){return function(c,d,e){e||(b.busy.setFlag("media",!1),b.bigPlay.setFlag("media",!1),"audio"!==a.mediaFile.type&&b.previewFlag.setFlag("media",!1),b.checkVisibility())}}(this)),a.ubind(this.uuid+":pause",function(a){return function(b,c,d){d||(a.busy.setFlag("media",!1),a.bigPlay.setFlag("media",!0),a.checkVisibility())}}(this))}})},minplayer.playLoader.prototype.clear=function(a){this.busy=new minplayer.flags,this.bigPlay=new minplayer.flags,this.previewFlag=new minplayer.flags,this.enabled=!0,this.preview?this.preview.clear(function(b){return function(){b.preview=null,a&&a()}}(this)):(this.preview=null,a&&a())},minplayer.playLoader.prototype.loadPreview=function(a){if(a=a||this.options.preview,this.options.preview=a,this.enabled&&0!==this.display.length){if(this.elements.preview){if(this.options.preview)return this.elements.preview.addClass("has-preview").show(),this.preview=new minplayer.image(this.elements.preview,this.options),this.preview.load(this.options.preview),!0;this.elements.preview.hide()}return!1}},minplayer.playLoader.prototype.checkVisibility=function(){this.enabled&&(this.busy.flag?this.elements.busy.show():this.elements.busy.hide(),this.bigPlay.flag?this.elements.bigPlay.show():this.elements.bigPlay.hide(),this.previewFlag.flag?this.elements.preview.show():this.elements.preview.hide(),(this.bigPlay.flag||this.busy.flag||this.previewFlag.flag)&&this.display.show(),this.bigPlay.flag||this.busy.flag||this.previewFlag.flag||this.display.hide())};var minplayer=minplayer||{};minplayer.players=minplayer.players||{},minplayer.players.base=function(a,b,c){minplayer.display.call(this,"media",a,b,c)},minplayer.players.base.prototype=new minplayer.display,minplayer.players.base.prototype.constructor=minplayer.players.base,minplayer.players.base.prototype.getElements=function(){var a=minplayer.display.prototype.getElements.call(this);return jQuery.extend(a,{media:this.options.mediaelement})},minplayer.players.base.prototype.defaultOptions=function(a){a.range={min:0,max:0},minplayer.display.prototype.defaultOptions.call(this,a)},minplayer.players.base.getPriority=function(){return 0},minplayer.players.base.getMediaId=function(){return""},minplayer.players.base.canPlay=function(){return!1},minplayer.players.base.prototype.construct=function(){minplayer.display.prototype.construct.call(this),this.elements.media&&(this.poster=this.elements.media.attr("poster")),this.options.pluginName="basePlayer",this.readyQueue=[],this.loadedQueue=[],this.mediaFile=this.options.file,this.clear(),this.setupPlayer()},minplayer.players.base.prototype.setupPlayer=function(){this.playerFound()||this.addPlayer(),this.player=this.getPlayer(),minplayer.click(this.display,function(a){return function(){a.playing?a.pause():a.play()}}(this)),jQuery(document).bind("keydown",function(a){return function(b){if(a.hasFocus)switch(b.preventDefault(),b.keyCode){case 32:case 179:a.playing?a.pause():a.play();break;case 38:a.setVolumeRelative(.1);break;case 40:a.setVolumeRelative(-.1);break;case 37:case 227:a.seekRelative(-.05);break;case 39:case 228:a.seekRelative(.05)}}}(this))},minplayer.players.base.prototype.addPlayer=function(){this.elements.media&&this.elements.media.remove(),this.elements.media=jQuery(this.createPlayer()),this.display.html(this.elements.media)},minplayer.players.base.prototype.destroy=function(){minplayer.plugin.prototype.destroy.call(this),this.clear()},minplayer.players.base.prototype.clear=function(){this.playerReady=!1,this.reset(),this.player&&(jQuery(this.player).remove(),this.player=null)},minplayer.players.base.prototype.reset=function(){this.realDuration=0,this.duration=new minplayer.async,this.currentTime=new minplayer.async,this.bytesLoaded=new minplayer.async,this.bytesTotal=new minplayer.async,this.bytesStart=new minplayer.async,this.volume=new minplayer.async,this.hasFocus=!1,this.playing=!1,this.loading=!1,this.loaded=!1,this.trigger("pause",null,!0),this.trigger("waiting",null,!0),this.trigger("progress",{loaded:0,total:0,start:0},!0),this.trigger("timeupdate",{currentTime:0,duration:0},!0)},minplayer.players.base.prototype.onReady=function(){if(!this.playerReady)if(this.setStartStop(),this.playerReady=!0,this.setVolume(this.options.volume/100),this.loading=!0,this.poll("progress",function(a){return function(){return a.loading&&a.getBytesLoaded(function(b){a.getBytesTotal(function(c){if(b||c){var d=0;a.getBytesStart(function(a){d=a}),a.trigger("progress",{loaded:b,total:c,start:d}),b>=c&&(a.loading=!1)}})}),a.loading}}(this),1e3),this.ready(),this.isReady()){for(var a in this.readyQueue)this.readyQueue[a].call(this);this.readyQueue.length=0,this.readyQueue=[],this.loaded||this.trigger("loadstart")}else this.readyQueue.length=0,this.readyQueue=[]},minplayer.players.base.prototype.parseTime=function(a){var b=0,c=0,d=0;return a?("string"!=typeof a&&(a=String(a)),b=a.match(/([0-9]+)s/i),b&&(b=parseInt(b[1],10)),c=a.match(/([0-9]+)m/i),c&&(b+=60*parseInt(c[1],10)),d=a.match(/([0-9]+)h/i),d&&(b+=3600*parseInt(d[1],10)),b||(b=a),Number(b)):0},minplayer.players.base.prototype.setStartStop=function(){return this.startTime?this.startTime:(this.startTime=0,this.offsetTime=this.parseTime(this.options.range.min),minplayer.urlVars&&(this.startTime=this.parseTime(minplayer.urlVars.seek)),this.startTime||(this.startTime=this.offsetTime),this.stopTime=this.options.range.max?this.parseTime(this.options.range.max):0,this.mediaRange=this.stopTime-this.offsetTime,this.mediaRange<0&&(this.mediaRange=0),this.startTime)},minplayer.players.base.prototype.onPlaying=function(){if(!this.playing){var a=this;this.getDuration(function(b){a.startTime&&a.startTime-1&&1>a?(c/d+parseFloat(a))*d:c+parseFloat(a),b.seek(e)}})}}(this))},minplayer.players.base.prototype.seek=function(a,b,c){this.whenLoaded(function(){a=Number(a),c||(a+=this.offsetTime),this._seek(a),b&&b.call(this)})},minplayer.players.base.prototype._seek=function(){},minplayer.players.base.prototype.setVolumeRelative=function(a){this.getVolume(function(b){return function(c){c+=parseFloat(a),c=0>c?0:c,c=c>1?1:c,b.setVolume(c)}}(this))},minplayer.players.base.prototype.setVolume=function(a,b){this.trigger("volumeupdate",a),this.whenLoaded(b)},minplayer.players.base.prototype.getValue=function(a,b,c){this.whenLoaded(function(){var d=this;this[a](function(a){null!==a?c.call(d,a):d[b].get(c)})})},minplayer.players.base.prototype.getVolume=function(a){this.getValue("_getVolume","volume",a)},minplayer.players.base.prototype._getVolume=function(a){a(null)},minplayer.players.base.prototype.getCurrentTime=function(a){var b=this;this.getValue("_getCurrentTime","currentTime",function(c){b.setStartStop(),b.stopTime&&c>b.stopTime&&b.stop(function(){b.onComplete()}),c-=b.offsetTime,a(c)})},minplayer.players.base.prototype._getCurrentTime=function(a){a(null)},minplayer.players.base.prototype.getDuration=function(a){if(this.options.duration)a(this.options.duration);else{var b=this;this.getValue("_getDuration","duration",function(c){b.setStartStop(),b.realDuration=c,a(b.mediaRange?b.mediaRange:c) +})}},minplayer.players.base.prototype._getDuration=function(a){a(null)},minplayer.players.base.prototype.getBytesStart=function(a){this.getValue("_getBytesStart","bytesStart",a)},minplayer.players.base.prototype._getBytesStart=function(a){a(null)},minplayer.players.base.prototype.getBytesLoaded=function(a){this.getValue("_getBytesLoaded","bytesLoaded",a)},minplayer.players.base.prototype._getBytesLoaded=function(a){a(null)},minplayer.players.base.prototype.getBytesTotal=function(a){this.getValue("_getBytesTotal","bytesTotal",a)},minplayer.players.base.prototype._getBytesTotal=function(a){a(null)};var minplayer=minplayer||{};minplayer.players=minplayer.players||{},minplayer.players.dailymotion=function(a,b,c){this.quality="default",minplayer.players.base.call(this,a,b,c)},minplayer.players.dailymotion.prototype=new minplayer.players.base,minplayer.players.dailymotion.prototype.constructor=minplayer.players.dailymotion,minplayer.players.dailymotion.prototype.construct=function(){minplayer.players.base.prototype.construct.call(this),this.options.pluginName="dailymotion"},minplayer.players.dailymotion.getPriority=function(){return 10},minplayer.players.dailymotion.canPlay=function(a){if("video/dailymotion"===a.mimetype)return!0;var b=/^http(s)?\:\/\/(www\.)?(dailymotion\.com)/i;return 0===a.path.search(b)},minplayer.players.dailymotion.getMediaId=function(a){var b="^http[s]?\\:\\/\\/(www\\.)?";b+="(dailymotion\\.com\\/video/)",b+="([a-z0-9\\-]+)",b+="_*";var c=RegExp(b,"i");return 0===a.path.search(c)?a.path.match(c)[3]:a.path},minplayer.players.dailymotion.getImage=function(a,b,c){c("http://www.dailymotion.com/thumbnail/video/"+a.id)},minplayer.players.dailymotion.parseNode=function(){return{title:node.title,description:node.description,mediafiles:{image:{thumbnail:{path:node.thumbnail_small_url},image:{path:node.thumbnail_url}},media:{media:{player:"dailymotion",id:node.id}}}}},minplayer.players.dailymotion.getNode=function(a,b){var c="https://api.dailymotion.com/video/"+a.id;c+="?fields=title,id,description,thumbnail_small_url,thumbnail_url",jQuery.get(c,function(a){b(minplayer.players.dailymotion.parseNode(a.data))},"jsonp")},minplayer.players.dailymotion.prototype.onReady=function(){minplayer.players.base.prototype.onReady.call(this),this.options.autoplay||this.pause(),this.onLoaded()},minplayer.players.dailymotion.prototype.playerFound=function(){return this.display.find(this.mediaFile.type).length>0},minplayer.players.dailymotion.prototype.onQualityChange=function(a){this.quality=a.data},minplayer.players.dailymotion.prototype.hasPlayLoader=function(a){return minplayer.hasTouch||!a},minplayer.players.dailymotion.prototype.hasController=function(){return minplayer.isIDevice},minplayer.players.dailymotion.prototype.createPlayer=function(){minplayer.players.base.prototype.createPlayer.call(this);var a=document.location.protocol;if(a+="//api.dmcdn.net/all.js",0===jQuery('script[src="'+a+'"]').length){var b=document.createElement("script");b.src=a;var c=document.getElementsByTagName("script")[0];c.parentNode.insertBefore(b,c)}return this.playerId=this.options.id+"-player",this.poll(this.options.id+"_dailymotion",function(a){return function(){var b=jQuery("#"+a.playerId).length>0;if(b=b&&"DM"in window,b=b&&"function"==typeof DM.player){jQuery("#"+a.playerId).addClass("dailymotion-player");var c={};c={id:a.playerId,api:minplayer.isIDevice?0:1,wmode:"opaque",controls:minplayer.isAndroid?1:0,related:0,info:0,logo:0},a.player=new DM.player(a.playerId,{video:a.mediaFile.id,height:"100%",width:"100%",frameborder:0,params:c}),a.player.addEventListener("apiready",function(){a.onReady(a)}),a.player.addEventListener("ended",function(){a.onComplete(a)}),a.player.addEventListener("playing",function(){a.onPlaying(a)}),a.player.addEventListener("progress",function(){a.onWaiting(a)}),a.player.addEventListener("pause",function(){a.onPaused(a)}),a.player.addEventListener("error",function(){a.onError(a)})}return!b}}(this),200),jQuery(document.createElement("div")).attr({id:this.playerId})},minplayer.players.dailymotion.prototype.load=function(a,b){minplayer.players.base.prototype.load.call(this,a,function(){this.player.load(a.id),b&&b.call(this)})},minplayer.players.dailymotion.prototype.play=function(a){minplayer.players.base.prototype.play.call(this,function(){this.onWaiting(),this.player.play(),a&&a.call(this)})},minplayer.players.dailymotion.prototype.pause=function(a){minplayer.players.base.prototype.pause.call(this,function(){this.loaded&&(this.player.pause(),a&&a.call(this))})},minplayer.players.dailymotion.prototype.stop=function(a){minplayer.players.base.prototype.stop.call(this,function(){this.player.pause(),a&&a.call(this)})},minplayer.players.dailymotion.prototype._seek=function(a){this.onWaiting(),this.player.seek(a)},minplayer.players.dailymotion.prototype.setVolume=function(a,b){minplayer.players.base.prototype.setVolume.call(this,a,function(){this.loaded&&(this.player.setVolume(a),void 0!==b&&b.call(this))})},minplayer.players.dailymotion.prototype._getVolume=function(a){a(this.player.volume)},minplayer.players.dailymotion.prototype._getDuration=function(a){a(this.player.duration)},minplayer.players.dailymotion.prototype._getCurrentTime=function(a){a(this.player.currentTime)};var minplayer=minplayer||{};minplayer.players=minplayer.players||{},minplayer.players.html5=function(a,b,c){minplayer.players.base.call(this,a,b,c)},minplayer.players.html5.prototype=new minplayer.players.base,minplayer.players.html5.prototype.constructor=minplayer.players.html5,minplayer.players.html5.getPriority=function(){return 10},minplayer.players.html5.canPlay=function(a){switch(a.mimetype){case"video/ogg":return!!minplayer.playTypes.videoOGG;case"video/mp4":case"video/x-mp4":case"video/m4v":case"video/x-m4v":return!!minplayer.playTypes.videoH264;case"application/vnd.apple.mpegurl":return!!minplayer.playTypes.videoMPEGURL;case"video/x-webm":case"video/webm":case"application/octet-stream":return!!minplayer.playTypes.videoWEBM;case"audio/ogg":return!!minplayer.playTypes.audioOGG;case"audio/mpeg":return!!minplayer.playTypes.audioMP3;case"audio/mp4":return!!minplayer.playTypes.audioMP4;default:return!1}},minplayer.players.html5.prototype.construct=function(){minplayer.players.base.prototype.construct.call(this),this.options.pluginName="html5",this.hasEnded=!1,this.addPlayerEvents()},minplayer.players.html5.prototype.addPlayerEvent=function(a,b){this.player&&this.player.addEventListener(a,function(c){var d=a+"Event";return c[d]&&c.player.removeEventListener(a,c[d],!1),c[d]=function(a){b.call(c,a)},c[d]}(this),!1)},minplayer.players.html5.prototype.addPlayerEvents=function(){if(this.player){this.addPlayerEvent("abort",function(){this.trigger("abort")}),this.addPlayerEvent("loadstart",function(){this.onReady(),this.options.autoload||this.onLoaded()}),this.addPlayerEvent("loadeddata",function(){this.onLoaded()}),this.addPlayerEvent("loadedmetadata",function(){this.onLoaded()}),this.addPlayerEvent("canplaythrough",function(){this.onLoaded()}),this.addPlayerEvent("ended",function(){this.hasEnded=!0,this.onComplete()}),this.addPlayerEvent("pause",function(){this.onPaused()}),this.addPlayerEvent("play",function(){this.onPlaying()}),this.addPlayerEvent("playing",function(){this.onPlaying()});var a=!1;return this.addPlayerEvent("error",function(){this.hasEnded||a||!this.player||(a=!0,this.trigger("error","An error occured - "+this.player.error.code))}),this.addPlayerEvent("waiting",function(){this.onWaiting()}),this.addPlayerEvent("durationchange",function(){if(this.player){this.duration.set(this.player.duration);var a=this;this.getDuration(function(b){a.trigger("durationchange",{duration:b})})}}),this.addPlayerEvent("progress",function(a){this.bytesTotal.set(a.total),this.bytesLoaded.set(a.loaded)}),!0}return!1},minplayer.players.html5.prototype.onReady=function(){minplayer.players.base.prototype.onReady.call(this),minplayer.isAndroid&&this.onLoaded(),minplayer.isIDevice&&setTimeout(function(a){return function(){a.pause(),a.onLoaded()}}(this),1)},minplayer.players.html5.prototype.playerFound=function(){return this.display.find(this.mediaFile.type).length>0},minplayer.players.html5.prototype.createPlayer=function(){minplayer.players.base.prototype.createPlayer.call(this);var a=jQuery(document.createElement(this.mediaFile.type)).attr(this.options.attributes).append(jQuery(document.createElement("source")).attr({src:this.mediaFile.path}));a.eq(0)[0].setAttribute("width","100%"),a.eq(0)[0].setAttribute("height","100%");var b=this.options.autoload?"metadata":"none";return b=minplayer.isIDevice?"metadata":b,a.eq(0)[0].setAttribute("preload",b),this.options.autoload||a.eq(0)[0].setAttribute("autobuffer",!1),a},minplayer.players.html5.prototype.getPlayer=function(){return this.elements.media.eq(0)[0]},minplayer.players.html5.prototype.load=function(a,b){minplayer.players.base.prototype.load.call(this,a,function(){this.hasEnded=!1;var c=this.elements.media.attr("src");c||(c=jQuery("source",this.elements.media).eq(0).attr("src")),c!==a.path&&(this.addPlayer(),this.player=this.getPlayer(),this.addPlayerEvents(),this.player.src=a.path,b&&b.call(this))})},minplayer.players.html5.prototype.play=function(a){minplayer.players.base.prototype.play.call(this,function(){this.player.play(),a&&a.call(this)})},minplayer.players.html5.prototype.pause=function(a){minplayer.players.base.prototype.pause.call(this,function(){this.player.pause(),a&&a.call(this)})},minplayer.players.html5.prototype.stop=function(a){minplayer.players.base.prototype.stop.call(this,function(){this.player.pause(),a&&a.call(this)})},minplayer.players.html5.prototype.clear=function(){minplayer.players.base.prototype.clear.call(this),this.player&&(this.player.src="")},minplayer.players.html5.prototype._seek=function(a){this.player.currentTime=a},minplayer.players.html5.prototype.setVolume=function(a,b){minplayer.players.base.prototype.setVolume.call(this,a,function(){this.player.volume=a,b&&b.call(this)})},minplayer.players.html5.prototype._getVolume=function(a){a(this.player.volume)},minplayer.players.html5.prototype._getDuration=function(a){a(this.player.duration)},minplayer.players.html5.prototype._getCurrentTime=function(a){a(this.player.currentTime)},minplayer.players.html5.prototype._getBytesLoaded=function(a){var b=0;this.bytesLoaded.value?b=this.bytesLoaded.value:this.player.buffered&&this.player.buffered.length>0&&this.player.buffered.end&&this.player.duration?b=this.player.buffered.end(0):void 0!==this.player.bytesTotal&&this.player.bytesTotal>0&&void 0!==this.player.bufferedBytes&&(b=this.player.bufferedBytes),a(b)},minplayer.players.html5.prototype._getBytesTotal=function(a){var b=0;this.bytesTotal.value?b=this.bytesTotal.value:this.player.buffered&&this.player.buffered.length>0&&this.player.buffered.end&&this.player.duration?b=this.player.duration:void 0!==this.player.bytesTotal&&this.player.bytesTotal>0&&void 0!==this.player.bufferedBytes&&(b=this.player.bytesTotal),a(b)};var minplayer=minplayer||{};minplayer.players=minplayer.players||{},minplayer.players.flash=function(a,b,c){minplayer.players.base.call(this,a,b,c)},minplayer.players.flash.prototype=new minplayer.players.base,minplayer.players.flash.prototype.constructor=minplayer.players.flash,minplayer.players.flash.prototype.construct=function(){minplayer.players.base.prototype.construct.call(this),this.options.pluginName="flash"},minplayer.players.flash.getPriority=function(){return 0},minplayer.players.flash.canPlay=function(){return!1},minplayer.players.flash.prototype.getFlash=function(a){var b=document.createElement("script");b.src="//ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js";var c=document.getElementsByTagName("script")[0];return c.parentNode.insertBefore(b,c),setTimeout(function(b){return function c(){"undefined"!=typeof swfobject?swfobject.embedSWF(a.swf,a.id,a.width,a.height,"9.0.0",!1,a.flashvars,{allowscriptaccess:"always",allowfullscreen:"true",wmode:a.wmode,quality:"high"},{id:a.id,name:a.id,playerType:"flash"},function(a){b.player=a.ref}):setTimeout(c,200)}}(this),200),'
'},minplayer.players.flash.prototype.playerFound=function(){return this.display.find('object[playerType="flash"]').length>0};var minplayer=minplayer||{};minplayer.players=minplayer.players||{},minplayer.players.minplayer=function(a,b,c){minplayer.players.flash.call(this,a,b,c)},minplayer.players.minplayer.prototype=new minplayer.players.flash,minplayer.players.minplayer.prototype.constructor=minplayer.players.minplayer,minplayer.players.minplayer.prototype.construct=function(){minplayer.players.flash.prototype.construct.call(this),this.options.pluginName="minplayer"},window.onFlashPlayerReady=function(a){for(var b=minplayer.get(a,"media"),c=b.length;c--;)b[c].onReady()},window.onFlashPlayerUpdate=function(a,b){for(var c=minplayer.get(a,"media"),d=c.length;d--;)c[d].onMediaUpdate(b)},window.onFlashPlayerDebug=function(a){console&&console.log&&console.log(a)},minplayer.players.minplayer.getPriority=function(a){return a.stream?100:1},minplayer.players.minplayer.canPlay=function(a){if(a.stream)return!0;var b=jQuery.inArray(a.mimetype,["video/x-webm","video/webm","application/octet-stream"])>=0;return!b&&("video"===a.type||"audio"===a.type)},minplayer.players.minplayer.prototype.createPlayer=function(){this.options.swfplayer||(this.options.swfplayer="http://mediafront.org/assets/osmplayer/minplayer",this.options.swfplayer+="/flash/minplayer.swf"),minplayer.players.flash.prototype.createPlayer.call(this);var a={id:this.options.id,debug:this.options.debug,config:"nocontrols",file:this.mediaFile.path,autostart:this.options.autoplay,autoload:this.options.autoload};return this.mediaFile.stream&&(a.stream=this.mediaFile.stream),this.getFlash({swf:this.options.swfplayer,id:this.options.id+"_player",width:"100%",height:"100%",flashvars:a,wmode:this.options.wmode})},minplayer.players.minplayer.prototype.onMediaUpdate=function(a){switch(this.onReady(),a){case"mediaMeta":this.onLoaded();break;case"mediaConnected":this.onLoaded(),this.onPaused();break;case"mediaPlaying":this.onPlaying();break;case"mediaPaused":this.onPaused();break;case"mediaComplete":this.onComplete()}},minplayer.players.minplayer.prototype.load=function(a,b){minplayer.players.flash.prototype.load.call(this,a,function(){this.loaded?this.stop(function(){this.player.loadMedia(a.path,a.stream),b&&b.call(this)}):(this.player.loadMedia(a.path,a.stream),b&&b.call(this))})},minplayer.players.minplayer.prototype.play=function(a){minplayer.players.flash.prototype.play.call(this,function(){this.player.playMedia(),a&&a.call(this)})},minplayer.players.minplayer.prototype.pause=function(a){minplayer.players.flash.prototype.pause.call(this,function(){this.player.pauseMedia(),a&&a.call(this)})},minplayer.players.minplayer.prototype.stop=function(a){minplayer.players.flash.prototype.stop.call(this,function(){this.player.stopMedia(),a&&a.call(this)})},minplayer.players.minplayer.prototype._seek=function(a){this.player.seekMedia(a)},minplayer.players.minplayer.prototype.setVolume=function(a,b){minplayer.players.flash.prototype.setVolume.call(this,a,function(){this.player.setVolume(a),b&&b.call(this)})},minplayer.players.minplayer.prototype._getVolume=function(a){a(this.player.getVolume())},minplayer.players.minplayer.prototype._getDuration=function(a){var b=this,c=0,d=function(){c=b.player.getDuration(),c?a(c):setTimeout(d,1e3)};d()},minplayer.players.minplayer.prototype._getCurrentTime=function(a){a(this.player.getCurrentTime())},minplayer.players.minplayer.prototype._getBytesLoaded=function(a){a(this.player.getMediaBytesLoaded())},minplayer.players.minplayer.prototype._getBytesTotal=function(a){a(this.player.getMediaBytesTotal())};var minplayer=minplayer||{};minplayer.players=minplayer.players||{},minplayer.players.youtube=function(a,b,c){this.quality="default",minplayer.players.base.call(this,a,b,c)},minplayer.players.youtube.prototype=new minplayer.players.base,minplayer.players.youtube.prototype.constructor=minplayer.players.youtube,minplayer.players.youtube.prototype.construct=function(){minplayer.players.base.prototype.construct.call(this),this.options.pluginName="youtube"},minplayer.players.youtube.getPriority=function(){return 10},minplayer.players.youtube.canPlay=function(a){if("video/youtube"===a.mimetype)return!0;var b=/^http(s)?\:\/\/(www\.)?(youtube\.com|youtu\.be)/i;return 0===a.path.search(b)},minplayer.players.youtube.getMediaId=function(a){var b="^http[s]?\\:\\/\\/(www\\.)?";b+="(youtube\\.com\\/watch\\?v=|youtu\\.be\\/)",b+="([a-zA-Z0-9_\\-]+)";var c=RegExp(b,"i");return 0===a.path.search(c)?a.path.match(c)[3]:a.path},minplayer.players.youtube.getImage=function(a,b,c){b="thumbnail"===b?"1":"0",c("https://img.youtube.com/vi/"+a.id+"/"+b+".jpg")},minplayer.players.youtube.parseNode=function(a){var b="undefined"!=typeof a.video?a.video:a;return{title:b.title,description:b.description,mediafiles:{image:{thumbnail:{path:b.thumbnail.sqDefault},image:{path:b.thumbnail.hqDefault}},media:{media:{player:"youtube",id:b.id}}}}},minplayer.players.youtube.getNode=function(a,b){var c="https://gdata.youtube.com/feeds/api/videos/"+a.id;c+="?v=2&alt=jsonc",jQuery.get(c,function(a){b(minplayer.players.youtube.parseNode(a.data))})},minplayer.players.youtube.prototype.setPlayerState=function(a){switch(a){case YT.PlayerState.CUED:break;case YT.PlayerState.BUFFERING:this.onWaiting();break;case YT.PlayerState.UNSTARTED:case YT.PlayerState.PAUSED:this.onPaused();break;case YT.PlayerState.PLAYING:this.onPlaying();break;case YT.PlayerState.ENDED:this.onComplete()}},minplayer.players.youtube.prototype.onReady=function(){minplayer.players.base.prototype.onReady.call(this),this.options.autoplay||this.pause(),this.onLoaded()},minplayer.players.youtube.prototype.playerFound=function(){var a="iframe#"+this.options.id+"-player.youtube-player",b=this.display.find(a);return b.length>0},minplayer.players.youtube.prototype.onPlayerStateChange=function(a){this.setPlayerState(a.data)},minplayer.players.youtube.prototype.onQualityChange=function(a){this.quality=a.data},minplayer.players.youtube.prototype.hasPlayLoader=function(a){return minplayer.hasTouch||!a},minplayer.players.youtube.prototype.hasController=function(){return minplayer.isIDevice},minplayer.players.youtube.prototype.createPlayer=function(){minplayer.players.base.prototype.createPlayer.call(this);var a="https://www.youtube.com/iframe_api";if(0===jQuery('script[src="'+a+'"]').length){var b=document.createElement("script");b.src=a;var c=document.getElementsByTagName("script")[0];c.parentNode.insertBefore(b,c)}return this.playerId=this.options.id+"-player",this.poll(this.options.id+"_youtube",function(a){return function(){var b=jQuery("#"+a.playerId).length>0;if(b=b&&"YT"in window,b=b&&"function"==typeof YT.Player){jQuery("#"+a.playerId).addClass("youtube-player");var c=location.protocol;c+="//"+location.hostname,c+=location.port&&":"+location.port;var d={};minplayer.isIDevice?d.origin=c:d={enablejsapi:minplayer.isIDevice?0:1,origin:c,wmode:"opaque",controls:minplayer.isAndroid?1:0,rel:0,showinfo:0},a.player=new YT.Player(a.playerId,{height:"100%",width:"100%",frameborder:0,videoId:a.mediaFile.id,playerVars:d,events:{onReady:function(b){a.onReady(b)},onStateChange:function(b){a.onPlayerStateChange(b)},onPlaybackQualityChange:function(b){a.onQualityChange(b)},onError:function(b){a.onError(b)}}})}return!b}}(this),200),jQuery(document.createElement("div")).attr({id:this.playerId})},minplayer.players.youtube.prototype.load=function(a,b){minplayer.players.base.prototype.load.call(this,a,function(){this.player.loadVideoById(a.id,0,this.quality),b&&b.call(this)})},minplayer.players.youtube.prototype.play=function(a){minplayer.players.base.prototype.play.call(this,function(){this.onWaiting(),this.player.playVideo(),a&&a.call(this)})},minplayer.players.youtube.prototype.pause=function(a){minplayer.players.base.prototype.pause.call(this,function(){this.player.pauseVideo(),a&&a.call(this)})},minplayer.players.youtube.prototype.stop=function(a){minplayer.players.base.prototype.stop.call(this,function(){this.player.stopVideo(),a&&a.call(this)})},minplayer.players.youtube.prototype._seek=function(a){this.onWaiting(),this.player.seekTo(a,!0)},minplayer.players.youtube.prototype.setVolume=function(a,b){minplayer.players.base.prototype.setVolume.call(this,a,function(){this.player.setVolume(100*a),b&&b.call(this)})},minplayer.players.youtube.prototype._getVolume=function(a){a(this.player.getVolume())},minplayer.players.youtube.prototype._getDuration=function(a){a(this.player.getDuration())},minplayer.players.youtube.prototype._getCurrentTime=function(a){a(this.player.getCurrentTime())},minplayer.players.youtube.prototype._getBytesStart=function(a){a(this.player.getVideoStartBytes())},minplayer.players.youtube.prototype._getBytesLoaded=function(a){a(this.player.getVideoBytesLoaded())},minplayer.players.youtube.prototype._getBytesTotal=function(a){a(this.player.getVideoBytesTotal())};var minplayer=minplayer||{};minplayer.players=minplayer.players||{},minplayer.players.vimeo=function(a,b,c){minplayer.players.base.call(this,a,b,c)},minplayer.players.vimeo.prototype=new minplayer.players.base,minplayer.players.vimeo.prototype.constructor=minplayer.players.vimeo,minplayer.players.vimeo.prototype.construct=function(){minplayer.players.base.prototype.construct.call(this),this.options.pluginName="vimeo"},minplayer.players.vimeo.getPriority=function(){return 10},minplayer.players.vimeo.canPlay=function(a){return"video/vimeo"===a.mimetype?!0:0===a.path.search(/^http(s)?\:\/\/(www\.)?vimeo\.com/i)},minplayer.players.vimeo.prototype.hasPlayLoader=function(){return minplayer.hasTouch},minplayer.players.vimeo.prototype.hasController=function(){return minplayer.hasTouch},minplayer.players.vimeo.getMediaId=function(a){var b=/^http[s]?\:\/\/(www\.)?vimeo\.com\/(\?v\=)?([0-9]+)/i;return 0===a.path.search(b)?a.path.match(b)[3]:a.path},minplayer.players.vimeo.parseNode=function(a){return{title:a.title,description:a.description,mediafiles:{image:{thumbnail:{path:a.thumbnail_small},image:{path:a.thumbnail_large}},media:{media:{player:"vimeo",id:a.id}}}}},minplayer.players.vimeo.nodes={},minplayer.players.vimeo.getNode=function(a,b){minplayer.players.vimeo.nodes.hasOwnProperty(a.id)?b(minplayer.players.vimeo.nodes[a.id]):jQuery.ajax({url:"https://vimeo.com/api/v2/video/"+a.id+".json",dataType:"jsonp",success:function(c){var d=minplayer.players.vimeo.parseNode(c[0]);minplayer.players.vimeo.nodes[a.id]=d,b(d)}})},minplayer.players.vimeo.getImage=function(a,b,c){minplayer.players.vimeo.getNode(a,function(a){c(a.mediafiles.image.image)})},minplayer.players.vimeo.prototype.reset=function(){minplayer.players.base.prototype.reset.call(this)},minplayer.players.vimeo.prototype.createPlayer=function(){minplayer.players.base.prototype.createPlayer.call(this);var a="http://a.vimeocdn.com/js/froogaloop2.min.js";if(0===jQuery('script[src="'+a+'"]').length){var b=document.createElement("script");b.src=a;var c=document.getElementsByTagName("script")[0];c.parentNode.insertBefore(b,c)}var d=document.createElement("iframe");d.setAttribute("id",this.options.id+"-player"),d.setAttribute("type","text/html"),d.setAttribute("width","100%"),d.setAttribute("height","100%"),d.setAttribute("frameborder","0"),jQuery(d).addClass("vimeo-player");var e="https://player.vimeo.com/video/";return e+=this.mediaFile.id+"?",e+=jQuery.param({wmode:"opaque",api:1,player_id:this.options.id+"-player",title:0,byline:0,portrait:0,loop:this.options.loop}),d.setAttribute("src",e),this.poll(this.options.id+"_vimeo",function(a){return function(){if(window.Froogaloop){a.player=window.Froogaloop(d);var b=0;a.player.addEvent("ready",function(){clearTimeout(b),a.onReady(),a.onError("")}),b=setTimeout(function(){a.onReady()},3e3)}return!window.Froogaloop}}(this),200),this.trigger("loadstart"),d},minplayer.players.vimeo.prototype.onReady=function(){this.player.addEvent("loadProgress",function(a){return function(b){a.duration.set(parseFloat(b.duration)),a.bytesLoaded.set(b.bytesLoaded),a.bytesTotal.set(b.bytesTotal)}}(this)),this.player.addEvent("playProgress",function(a){return function(b){a.duration.set(parseFloat(b.duration)),a.currentTime.set(parseFloat(b.seconds))}}(this)),this.player.addEvent("play",function(a){return function(){a.onPlaying()}}(this)),this.player.addEvent("pause",function(a){return function(){a.onPaused()}}(this)),this.player.addEvent("finish",function(a){return function(){a.onComplete()}}(this)),minplayer.players.base.prototype.onReady.call(this),this.onLoaded(),this.options.autoplay&&this.play()},minplayer.players.vimeo.prototype.clear=function(){this.player&&this.player.api("unload"),minplayer.players.base.prototype.clear.call(this)},minplayer.players.vimeo.prototype.load=function(a,b){minplayer.players.base.prototype.load.call(this,a,function(){this.construct(),b&&b.call(this)})},minplayer.players.vimeo.prototype.play=function(a){minplayer.players.base.prototype.play.call(this,function(){this.player.api("play"),a&&a.call(this)})},minplayer.players.vimeo.prototype.pause=function(a){minplayer.players.base.prototype.pause.call(this,function(){this.player.api("pause"),a&&a.call(this)})},minplayer.players.vimeo.prototype.stop=function(a){minplayer.players.base.prototype.stop.call(this,function(){this.player.api("unload"),a&&a.call(this)})},minplayer.players.vimeo.prototype._seek=function(a){this.player.api("seekTo",a)},minplayer.players.vimeo.prototype.setVolume=function(a,b){minplayer.players.base.prototype.setVolume.call(this,a,function(){this.volume.set(a),this.player.api("setVolume",a),b&&b.call(this)})},minplayer.players.vimeo.prototype._getVolume=function(a){this.player.api("getVolume",function(b){a(b)})},minplayer.players.vimeo.prototype._getDuration=function(a){this.player.api("getDuration",function(b){a(b)})};var minplayer=minplayer||{};minplayer.players=minplayer.players||{},minplayer.players.limelight=function(a,b){minplayer.players.flash.call(this,a,b)},minplayer.players.limelight.prototype=new minplayer.players.flash,minplayer.players.limelight.prototype.constructor=minplayer.players.limelight,minplayer.players.limelight.prototype.construct=function(){minplayer.players.flash.prototype.construct.call(this),this.options.pluginName="limelight"},minplayer.players.limelight.getPriority=function(){return 10},minplayer.players.limelight.canPlay=function(a){if("video/limelight"===a.mimetype)return!0;var b=/.*limelight\.com.*/i;return 0===a.path.search(b)},minplayer.players.limelight.getMediaId=function(a){var b=/.*limelight\.com.*mediaId=([a-zA-Z0-9]+)/i;return 0===a.path.search(b)?a.path.match(b)[1]:a.path},minplayer.players.limelight.prototype.register=function(){window.delvePlayerCallback=function(a,b,c){var d=a.replace("-player","");jQuery.each(minplayer.get(d,"media"),function(a,d){d.onMediaUpdate(b,c)})}},minplayer.players.limelight.prototype.onMediaUpdate=function(a,b){switch(a){case"onPlayerLoad":this.onReady();break;case"onMediaLoad":if(this.complete)return this.pause(),void this.onPaused();this.shouldSeek=this.startTime>0,this.onLoaded();break;case"onMediaComplete":this.complete=!0,this.onComplete();break;case"onPlayheadUpdate":!b.positionInMilliseconds||this.playing||this.complete||this.onPlaying(),this.complete=!1,this.shouldSeek&&this.seekValue?(this.shouldSeek=!1,this.seek(this.seekValue)):(this.duration.set(b.durationInMilliseconds/1e3),this.currentTime.set(b.positionInMilliseconds/1e3));break;case"onError":this.onError();break;case"onPlayStateChanged":b.isPlaying?this.onPlaying():b.isBusy?this.onWaiting():this.onPaused()}},minplayer.players.limelight.prototype.createPlayer=function(){minplayer.players.flash.prototype.createPlayer.call(this);var a=document.createElement("script");a.src="https://assets.delvenetworks.com/player/embed.js";var b=document.getElementsByTagName("script")[0];b.parentNode.insertBefore(a,b),this.register();var c={deepLink:"true",autoplay:this.options.autoplay?"true":"false",startQuality:"HD"},d=null,e=this.options.channel;e||(d=/.*limelight\.com.*channelId=([a-zA-Z0-9]+)/i,0===this.mediaFile.path.search(d)&&(e=this.mediaFile.path.match(d)[1])),e&&"media"===this.mediaFile.queueType&&(c.adConfigurationChannelId=e);var f=this.options.playerForm;f||(d=/.*limelight\.com.*playerForm=([a-zA-Z0-9]+)/i,0===this.mediaFile.path.search(d)&&(f=this.mediaFile.path.match(d)[1])),f&&(c.playerForm=f),c.mediaId=this.mediaFile.id;var g=this.options.id+"-player";return setTimeout(function h(){window.hasOwnProperty("LimelightPlayerUtil")?window.LimelightPlayerUtil.initEmbed(g):setTimeout(h,1e3)},1e3),this.getFlash({swf:document.location.protocol+"//assets.delvenetworks.com/player/loader.swf",id:g,width:this.options.width,height:"100%",flashvars:c,wmode:this.options.wmode})},minplayer.players.limelight.prototype.play=function(a){minplayer.players.flash.prototype.play.call(this,function(){this.player.doPlay(),a&&a.call(this)})},minplayer.players.limelight.prototype.pause=function(a){minplayer.players.flash.prototype.pause.call(this,function(){this.player.doPause(),a&&a.call(this)})},minplayer.players.limelight.prototype.stop=function(a){minplayer.players.flash.prototype.stop.call(this,function(){this.player.doPause(),a&&a.call(this)})},minplayer.players.limelight.prototype._seek=function(a){this.seekValue=a,this.player.doSeekToSecond(a)},minplayer.players.limelight.prototype.setVolume=function(a,b){minplayer.players.flash.prototype.setVolume.call(this,a,function(){this.player.doSetVolume(a),b&&b.call(this)})},minplayer.players.limelight.prototype._getVolume=function(a){a(this.player.doGetVolume())},minplayer.players.limelight.prototype.search=function(a){this.whenReady(function(){this.player.doSearch(a)})};var minplayer=minplayer||{};minplayer.players=minplayer.players||{},minplayer.players.kaltura=function(a,b){minplayer.players.base.call(this,a,b)},minplayer.players.kaltura.prototype=new minplayer.players.base,minplayer.players.kaltura.prototype.constructor=minplayer.players.kaltura,minplayer.players.kaltura.prototype.construct=function(){minplayer.players.base.prototype.construct.call(this),this.options.pluginName="kaltura",this.adPlaying=!1},minplayer.players.kaltura.prototype.defaultOptions=function(a){a.entryId=0,a.uiConfId=0,a.partnerId=0,minplayer.players.base.prototype.defaultOptions.call(this,a)},minplayer.players.kaltura.getPriority=function(){return 10},minplayer.players.kaltura.canPlay=function(a){if("video/kaltura"===a.mimetype)return!0;var b=/.*kaltura\.com.*/i;return 0===a.path.search(b)},minplayer.players.kaltura.prototype.adStart=function(){this.adPlaying=!0,this.onPlaying()},minplayer.players.kaltura.prototype.adEnd=function(){this.adPlaying=!1},minplayer.players.kaltura.prototype.playerStateChange=function(a){if(!this.adPlaying)switch(a){case"ready":this.onLoaded();break;case"loading":case"buffering":this.onWaiting();break;case"playing":this.onPlaying();break;case"paused":this.onPaused()}},minplayer.players.kaltura.prototype.mediaReady=function(){this.onLoaded()},minplayer.players.kaltura.prototype.playerPlayEnd=function(){this.onComplete()},minplayer.players.kaltura.prototype.playUpdate=function(a){this.currentTime.set(a)},minplayer.players.kaltura.prototype.durationChange=function(a){this.duration.set(a.newValue)},minplayer.players.kaltura.prototype.getInstance=function(){if(this.instanceName)return this.instanceName;var a=this.uuid.split("__"),b="minplayer.plugins."+a[0];return b+="."+a[1],b+="["+(a[2]-1)+"]",this.instanceName=b,b},minplayer.players.kaltura.prototype.registerEvents=function(){this.player.addJsListener("adStart",this.getInstance()+".adStart"),this.player.addJsListener("adEnd",this.getInstance()+".adEnd"),this.player.addJsListener("playerStateChange",this.getInstance()+".playerStateChange"),this.player.addJsListener("durationChange",this.getInstance()+".durationChange"),this.player.addJsListener("mediaReady",this.getInstance()+".mediaReady"),this.player.addJsListener("playerUpdatePlayhead",this.getInstance()+".playUpdate"),this.player.addJsListener("playerPlayEnd",this.getInstance()+".playerPlayEnd") },minplayer.players.kaltura.prototype.createPlayer=function(){minplayer.players.base.prototype.createPlayer.call(this);var a={},b=this;jQuery.each(["entryId","uiConfId","partnerId"],function(c,d){if(a[d]="",b.options[d])a[d]=b.options[d];else{var e=null;switch(d){case"entryId":e=/.*kaltura\.com.*entry_id\/([^\/]+)/i;break;case"uiConfId":e=/.*kaltura\.com.*uiconf_id\/([^\/]+)/i;break;case"partnerId":e=/.*kaltura\.com.*wid\/_([^\/]+)/i}e&&(a[d]=b.mediaFile.path.match(e),a[d]&&(a[d]=a[d][1]))}});var c=document.createElement("script");c.src="http://cdnapi.kaltura.com/p/",c.src+=a.partnerId,c.src+="/sp/",c.src+=a.partnerId,c.src+="00/embedIframeJs/uiconf_id/",c.src+=a.uiConfId,c.src+="/partner_id/",c.src+=a.partnerId;var d=document.getElementsByTagName("script")[0];d.parentNode.insertBefore(c,d);var e=this.options.id+"-player";return setTimeout(function f(){window.hasOwnProperty("kWidget")?kWidget.embed({targetId:e,wid:"_"+a.partnerId,uiconf_id:a.uiConfId,entry_id:a.entryId,flashvars:{autoPlay:!1},params:{wmode:"transparent"},readyCallback:function(a){b.player=jQuery("#"+a).get(0),b.registerEvents(),b.onReady()}}):setTimeout(f,1e3)},1e3),'
'},minplayer.players.kaltura.prototype.play=function(a){minplayer.players.base.prototype.play.call(this,function(){this.player.sendNotification("doPlay"),a&&a.call(this)})},minplayer.players.kaltura.prototype.pause=function(a){minplayer.players.base.prototype.pause.call(this,function(){this.player.sendNotification("doPause"),a&&a.call(this)})},minplayer.players.kaltura.prototype.stop=function(a){minplayer.players.base.prototype.stop.call(this,function(){this.player.sendNotification("doStop"),a&&a.call(this)})},minplayer.players.kaltura.prototype._seek=function(a){this.seekValue=a,this.player.sendNotification("doSeek",a)},minplayer.players.kaltura.prototype.setVolume=function(a,b){minplayer.players.base.prototype.setVolume.call(this,a,function(){this.player.sendNotification("changeVolume",a),b&&b.call(this)})};var minplayer=minplayer||{};minplayer.controller=function(a,b){minplayer.display.call(this,"controller",a,b)},minplayer.controller.prototype=new minplayer.display,minplayer.controller.prototype.constructor=minplayer.controller,minplayer.formatTime=function(a){a=a||0;var b=0,c=0,d=0,e="";return d=Math.floor(a/3600),a-=3600*d,c=Math.floor(a/60),a-=60*c,b=Math.floor(a%60),d&&(e+=String(d),e+=":"),e+=c>=10?String(c):"0"+String(c),e+=":",e+=b>=10?String(b):"0"+String(b),{time:e,units:""}},minplayer.controller.prototype.getElements=function(){var a=minplayer.display.prototype.getElements.call(this);return jQuery.extend(a,{play:null,pause:null,fullscreen:null,seek:null,progress:null,volume:null,timer:null})},minplayer.controller.prototype.defaultOptions=function(a){a.disptime=0,minplayer.display.prototype.defaultOptions.call(this,a)},minplayer.controller.prototype.construct=function(){minplayer.display.prototype.construct.call(this),this.options.pluginName="controller",this.dragging=!1,this.vol=0,this.elements.seek&&(this.seekBar=this.elements.seek.slider({range:"min",create:function(a){jQuery(".ui-slider-range",a.target).addClass("ui-state-active")}})),this.elements.volume&&(this.volumeBar=this.elements.volume.slider({animate:!0,range:"min",orientation:"vertical"})),this.get("player",function(a){this.elements.fullscreen&&minplayer.click(this.elements.fullscreen.unbind(),function(){a.toggleFullScreen()}).css({pointer:"hand"})}),this.get("media",function(a){a.hasController()?this.hide():(this.elements.pause&&(minplayer.click(this.elements.pause.unbind(),function(b){return function(c){c.preventDefault(),b.playPause(!1,a)}}(this)),a.ubind(this.uuid+":pause",function(a){return function(){a.setPlayPause(!0)}}(this))),this.elements.play&&(minplayer.click(this.elements.play.unbind(),function(b){return function(c){c.preventDefault(),b.playPause(!0,a)}}(this)),a.ubind(this.uuid+":playing",function(a){return function(){a.setPlayPause(!1)}}(this))),this.elements.duration&&(a.ubind(this.uuid+":durationchange",function(a){return function(b,c){var d=a.options.disptime||c.duration;a.setTimeString("duration",d)}}(this)),a.getDuration(function(a){return function(b){b=a.options.disptime||b,a.setTimeString("duration",b)}}(this))),this.elements.progress&&a.ubind(this.uuid+":progress",function(a){return function(b,c){var d=c.total?c.loaded/c.total*100:0;a.elements.progress.width(d+"%")}}(this)),(this.seekBar||this.elements.timer)&&a.ubind(this.uuid+":timeupdate",function(a){return function(b,c){if(!a.dragging){var d=0;c.duration&&(d=c.currentTime/c.duration*100),a.seekBar&&a.seekBar.slider("option","value",d),a.setTimeString("timer",c.currentTime)}}}(this)),this.seekBar&&this.seekBar.slider({start:function(a){return function(){a.dragging=!0}}(this),stop:function(b){return function(c,d){b.dragging=!1,a.getDuration(function(b){a.seek(d.value/100*b)})}}(this),slide:function(b){return function(c,d){a.getDuration(function(c){var e=d.value/100*c;b.dragging||a.seek(e),b.setTimeString("timer",e)})}}(this)}),this.elements.mute&&minplayer.click(this.elements.mute,function(b){return function(c){c.preventDefault();var d=b.volumeBar.slider("option","value");d>0?(b.vol=d,b.volumeBar.slider("option","value",0),a.setVolume(0)):(b.volumeBar.slider("option","value",b.vol),a.setVolume(b.vol/100))}}(this)),this.volumeBar&&(this.volumeBar.slider({slide:function(b,c){a.setVolume(c.value/100)}}),a.ubind(this.uuid+":volumeupdate",function(a){return function(b,c){a.volumeBar.slider("option","value",100*c)}}(this)),a.getVolume(function(a){return function(b){a.volumeBar.slider("option","value",100*b)}}(this))))}),this.ready()},minplayer.controller.prototype.setPlayPause=function(a){var b="";this.elements.play&&(b=a?"inherit":"none",this.elements.play.css("display",b)),this.elements.pause&&(b=a?"none":"inherit",this.elements.pause.css("display",b))},minplayer.controller.prototype.playPause=function(a,b){var c=a?"play":"pause";this.display.trigger(c),this.setPlayPause(!a),b&&b[c]()},minplayer.controller.prototype.setTimeString=function(a,b){this.elements[a]&&this.elements[a].text(minplayer.formatTime(b).time)};var osmplayer=osmplayer||{};!function(a){!function(b,c){function d(a){return""===g?a:(a=a.charAt(0).toUpperCase()+a.substr(1),g+a)}var e=Math,f=c.createElement("div").style,g=function(){for(var a,b="t,webkitT,MozT,msT,OT".split(","),c=0,d=b.length;d>c;c++)if(a=b[c]+"ransform",a in f)return b[c].substr(0,b[c].length-1);return!1}(),h=g?"-"+g.toLowerCase()+"-":"",i=d("transform"),j=d("transitionProperty"),k=d("transitionDuration"),l=d("transformOrigin"),m=d("transitionTimingFunction"),n=d("transitionDelay"),o=/android/gi.test(navigator.appVersion),p=/iphone|ipad/gi.test(navigator.appVersion),q=/hp-tablet/gi.test(navigator.appVersion),r=d("perspective")in f,s="ontouchstart"in b&&!q,t=g!==!1,u=d("transition")in f,v="onorientationchange"in b?"orientationchange":"resize",w=s?"touchstart":"mousedown",x=s?"touchmove":"mousemove",y=s?"touchend":"mouseup",z=s?"touchcancel":"mouseup",A=function(){if(g===!1)return!1;var a={"":"transitionend",webkit:"webkitTransitionEnd",Moz:"transitionend",O:"otransitionend",ms:"MSTransitionEnd"};return a[g]}(),B=function(){return b.requestAnimationFrame||b.webkitRequestAnimationFrame||b.mozRequestAnimationFrame||b.oRequestAnimationFrame||b.msRequestAnimationFrame||function(a){return setTimeout(a,1)}}(),C=function(){return b.cancelRequestAnimationFrame||b.webkitCancelAnimationFrame||b.webkitCancelRequestAnimationFrame||b.mozCancelRequestAnimationFrame||b.oCancelRequestAnimationFrame||b.msCancelRequestAnimationFrame||clearTimeout}(),D=r?" translateZ(0)":"",E=function(a,d){var e,f=this;f.wrapper="object"==typeof a?a:c.getElementById(a),f.wrapper.style.overflow="hidden",f.scroller=f.wrapper.children[0],f.options={hScroll:!0,vScroll:!0,x:0,y:0,bounce:!0,bounceLock:!1,momentum:!0,lockDirection:!0,useTransform:!0,useTransition:!1,topOffset:0,checkDOMChanges:!1,handleClick:!0,hScrollbar:!0,vScrollbar:!0,fixedScrollbar:o,hideScrollbar:p,fadeScrollbar:p&&r,scrollbarClass:"",zoom:!1,zoomMin:1,zoomMax:4,doubleTapZoom:2,wheelAction:"scroll",snap:!1,snapThreshold:1,onRefresh:null,onBeforeScrollStart:function(a){a.preventDefault()},onScrollStart:null,onBeforeScrollMove:null,onScrollMove:null,onBeforeScrollEnd:null,onScrollEnd:null,onTouchEnd:null,onDestroy:null,onZoomStart:null,onZoom:null,onZoomEnd:null};for(e in d)f.options[e]=d[e];f.x=f.options.x,f.y=f.options.y,f.options.useTransform=t&&f.options.useTransform,f.options.hScrollbar=f.options.hScroll&&f.options.hScrollbar,f.options.vScrollbar=f.options.vScroll&&f.options.vScrollbar,f.options.zoom=f.options.useTransform&&f.options.zoom,f.options.useTransition=u&&f.options.useTransition,f.options.zoom&&o&&(D=""),f.scroller.style[j]=f.options.useTransform?h+"transform":"top left",f.scroller.style[k]="0",f.scroller.style[l]="0 0",f.options.useTransition&&(f.scroller.style[m]="cubic-bezier(0.33,0.66,0.66,1)"),f.options.useTransform?f.scroller.style[i]="translate("+f.x+"px,"+f.y+"px)"+D:f.scroller.style.cssText+=";position:absolute;top:"+f.y+"px;left:"+f.x+"px",f.options.useTransition&&(f.options.fixedScrollbar=!0),f.refresh(),f._bind(v,b),f._bind(w),s||"none"!=f.options.wheelAction&&(f._bind("DOMMouseScroll"),f._bind("mousewheel")),f.options.checkDOMChanges&&(f.checkDOMTime=setInterval(function(){f._checkDOMChanges()},500))};E.prototype={enabled:!0,x:0,y:0,steps:[],scale:1,currPageX:0,currPageY:0,pagesX:[],pagesY:[],aniTime:null,wheelZoomCount:0,handleEvent:function(a){var b=this;switch(a.type){case w:if(!s&&0!==a.button)return;b._start(a);break;case x:b._move(a);break;case y:case z:b._end(a);break;case v:b._resize();break;case"DOMMouseScroll":case"mousewheel":b._wheel(a);break;case A:b._transitionEnd(a)}},_checkDOMChanges:function(){this.moved||this.zoomed||this.animating||this.scrollerW==this.scroller.offsetWidth*this.scale&&this.scrollerH==this.scroller.offsetHeight*this.scale||this.refresh()},_scrollbar:function(a){var b,d=this;return d[a+"Scrollbar"]?(d[a+"ScrollbarWrapper"]||(b=c.createElement("div"),d.options.scrollbarClass?b.className=d.options.scrollbarClass+a.toUpperCase():b.style.cssText="position:absolute;z-index:100;"+("h"==a?"height:7px;bottom:1px;left:2px;right:"+(d.vScrollbar?"7":"2")+"px":"width:7px;bottom:"+(d.hScrollbar?"7":"2")+"px;top:2px;right:1px"),b.style.cssText+=";pointer-events:none;"+h+"transition-property:opacity;"+h+"transition-duration:"+(d.options.fadeScrollbar?"350ms":"0")+";overflow:hidden;opacity:"+(d.options.hideScrollbar?"0":"1"),d.wrapper.appendChild(b),d[a+"ScrollbarWrapper"]=b,b=c.createElement("div"),d.options.scrollbarClass||(b.style.cssText="position:absolute;z-index:100;background:rgba(0,0,0,0.5);border:1px solid rgba(255,255,255,0.9);"+h+"background-clip:padding-box;"+h+"box-sizing:border-box;"+("h"==a?"height:100%":"width:100%")+";"+h+"border-radius:3px;border-radius:3px"),b.style.cssText+=";pointer-events:none;"+h+"transition-property:"+h+"transform;"+h+"transition-timing-function:cubic-bezier(0.33,0.66,0.66,1);"+h+"transition-duration:0;"+h+"transform: translate(0,0)"+D,d.options.useTransition&&(b.style.cssText+=";"+h+"transition-timing-function:cubic-bezier(0.33,0.66,0.66,1)"),d[a+"ScrollbarWrapper"].appendChild(b),d[a+"ScrollbarIndicator"]=b),"h"==a?(d.hScrollbarSize=d.hScrollbarWrapper.clientWidth,d.hScrollbarIndicatorSize=e.max(e.round(d.hScrollbarSize*d.hScrollbarSize/d.scrollerW),8),d.hScrollbarIndicator.style.width=d.hScrollbarIndicatorSize+"px",d.hScrollbarMaxScroll=d.hScrollbarSize-d.hScrollbarIndicatorSize,d.hScrollbarProp=d.hScrollbarMaxScroll/d.maxScrollX):(d.vScrollbarSize=d.vScrollbarWrapper.clientHeight,d.vScrollbarIndicatorSize=e.max(e.round(d.vScrollbarSize*d.vScrollbarSize/d.scrollerH),8),d.vScrollbarIndicator.style.height=d.vScrollbarIndicatorSize+"px",d.vScrollbarMaxScroll=d.vScrollbarSize-d.vScrollbarIndicatorSize,d.vScrollbarProp=d.vScrollbarMaxScroll/d.maxScrollY),void d._scrollbarPos(a,!0)):void(d[a+"ScrollbarWrapper"]&&(t&&(d[a+"ScrollbarIndicator"].style[i]=""),d[a+"ScrollbarWrapper"].parentNode.removeChild(d[a+"ScrollbarWrapper"]),d[a+"ScrollbarWrapper"]=null,d[a+"ScrollbarIndicator"]=null))},_resize:function(){var a=this;setTimeout(function(){a.refresh()},o?200:0)},_pos:function(a,b){this.zoomed||(a=this.hScroll?a:0,b=this.vScroll?b:0,this.options.useTransform?this.scroller.style[i]="translate("+a+"px,"+b+"px) scale("+this.scale+")"+D:(a=e.round(a),b=e.round(b),this.scroller.style.left=a+"px",this.scroller.style.top=b+"px"),this.x=a,this.y=b,this._scrollbarPos("h"),this._scrollbarPos("v"))},_scrollbarPos:function(a,b){var c,d=this,f="h"==a?d.x:d.y;d[a+"Scrollbar"]&&(f=d[a+"ScrollbarProp"]*f,0>f?(d.options.fixedScrollbar||(c=d[a+"ScrollbarIndicatorSize"]+e.round(3*f),8>c&&(c=8),d[a+"ScrollbarIndicator"].style["h"==a?"width":"height"]=c+"px"),f=0):f>d[a+"ScrollbarMaxScroll"]&&(d.options.fixedScrollbar?f=d[a+"ScrollbarMaxScroll"]:(c=d[a+"ScrollbarIndicatorSize"]-e.round(3*(f-d[a+"ScrollbarMaxScroll"])),8>c&&(c=8),d[a+"ScrollbarIndicator"].style["h"==a?"width":"height"]=c+"px",f=d[a+"ScrollbarMaxScroll"]+(d[a+"ScrollbarIndicatorSize"]-c))),d[a+"ScrollbarWrapper"].style[n]="0",d[a+"ScrollbarWrapper"].style.opacity=b&&d.options.hideScrollbar?"0":"1",d[a+"ScrollbarIndicator"].style[i]="translate("+("h"==a?f+"px,0)":"0,"+f+"px)")+D)},_start:function(a){var c,d,f,g,h,j=this,k=s?a.touches[0]:a;j.enabled&&(j.options.onBeforeScrollStart&&j.options.onBeforeScrollStart.call(j,a),(j.options.useTransition||j.options.zoom)&&j._transitionTime(0),j.moved=!1,j.animating=!1,j.zoomed=!1,j.distX=0,j.distY=0,j.absDistX=0,j.absDistY=0,j.dirX=0,j.dirY=0,j.options.zoom&&s&&a.touches.length>1&&(g=e.abs(a.touches[0].pageX-a.touches[1].pageX),h=e.abs(a.touches[0].pageY-a.touches[1].pageY),j.touchesDistStart=e.sqrt(g*g+h*h),j.originX=e.abs(a.touches[0].pageX+a.touches[1].pageX-2*j.wrapperOffsetLeft)/2-j.x,j.originY=e.abs(a.touches[0].pageY+a.touches[1].pageY-2*j.wrapperOffsetTop)/2-j.y,j.options.onZoomStart&&j.options.onZoomStart.call(j,a)),j.options.momentum&&(j.options.useTransform?(c=getComputedStyle(j.scroller,null)[i].replace(/[^0-9\-.,]/g,"").split(","),d=+(c[12]||c[4]),f=+(c[13]||c[5])):(d=+getComputedStyle(j.scroller,null).left.replace(/[^0-9-]/g,""),f=+getComputedStyle(j.scroller,null).top.replace(/[^0-9-]/g,"")),(d!=j.x||f!=j.y)&&(j.options.useTransition?j._unbind(A):C(j.aniTime),j.steps=[],j._pos(d,f),j.options.onScrollEnd&&j.options.onScrollEnd.call(j))),j.absStartX=j.x,j.absStartY=j.y,j.startX=j.x,j.startY=j.y,j.pointX=k.pageX,j.pointY=k.pageY,j.startTime=a.timeStamp||Date.now(),j.options.onScrollStart&&j.options.onScrollStart.call(j,a),j._bind(x,b),j._bind(y,b),j._bind(z,b))},_move:function(a){var b,c,d,f=this,g=s?a.touches[0]:a,h=g.pageX-f.pointX,j=g.pageY-f.pointY,k=f.x+h,l=f.y+j,m=a.timeStamp||Date.now();return f.options.onBeforeScrollMove&&f.options.onBeforeScrollMove.call(f,a),f.options.zoom&&s&&a.touches.length>1?(b=e.abs(a.touches[0].pageX-a.touches[1].pageX),c=e.abs(a.touches[0].pageY-a.touches[1].pageY),f.touchesDist=e.sqrt(b*b+c*c),f.zoomed=!0,d=1/f.touchesDistStart*f.touchesDist*this.scale,df.options.zoomMax&&(d=2*f.options.zoomMax*Math.pow(.5,f.options.zoomMax/d)),f.lastScale=d/this.scale,k=this.originX-this.originX*f.lastScale+this.x,l=this.originY-this.originY*f.lastScale+this.y,this.scroller.style[i]="translate("+k+"px,"+l+"px) scale("+d+")"+D,void(f.options.onZoom&&f.options.onZoom.call(f,a))):(f.pointX=g.pageX,f.pointY=g.pageY,(k>0||k=0||f.maxScrollX>=0?0:f.maxScrollX),(l>f.minScrollY||l=f.minScrollY||f.maxScrollY>=0?f.minScrollY:f.maxScrollY),f.distX+=h,f.distY+=j,f.absDistX=e.abs(f.distX),f.absDistY=e.abs(f.distY),void(f.absDistX<6&&f.absDistY<6||(f.options.lockDirection&&(f.absDistX>f.absDistY+5?(l=f.y,j=0):f.absDistY>f.absDistX+5&&(k=f.x,h=0)),f.moved=!0,f._pos(k,l),f.dirX=h>0?-1:0>h?1:0,f.dirY=j>0?-1:0>j?1:0,m-f.startTime>300&&(f.startTime=m,f.startX=f.x,f.startY=f.y),f.options.onScrollMove&&f.options.onScrollMove.call(f,a))))},_end:function(a){if(!s||0===a.touches.length){var d,f,g,h,j,l,m,n=this,o=s?a.changedTouches[0]:a,p={dist:0,time:0},q={dist:0,time:0},r=(a.timeStamp||Date.now())-n.startTime,t=n.x,u=n.y;if(n._unbind(x,b),n._unbind(y,b),n._unbind(z,b),n.options.onBeforeScrollEnd&&n.options.onBeforeScrollEnd.call(n,a),n.zoomed)return m=n.scale*n.lastScale,m=Math.max(n.options.zoomMin,m),m=Math.min(n.options.zoomMax,m),n.lastScale=m/n.scale,n.scale=m,n.x=n.originX-n.originX*n.lastScale+n.x,n.y=n.originY-n.originY*n.lastScale+n.y,n.scroller.style[k]="200ms",n.scroller.style[i]="translate("+n.x+"px,"+n.y+"px) scale("+n.scale+")"+D,n.zoomed=!1,n.refresh(),void(n.options.onZoomEnd&&n.options.onZoomEnd.call(n,a));if(!n.moved)return s&&(n.doubleTapTimer&&n.options.zoom?(clearTimeout(n.doubleTapTimer),n.doubleTapTimer=null,n.options.onZoomStart&&n.options.onZoomStart.call(n,a),n.zoom(n.pointX,n.pointY,1==n.scale?n.options.doubleTapZoom:1),n.options.onZoomEnd&&setTimeout(function(){n.options.onZoomEnd.call(n,a)},200)):this.options.handleClick&&(n.doubleTapTimer=setTimeout(function(){for(n.doubleTapTimer=null,d=o.target;1!=d.nodeType;)d=d.parentNode;"SELECT"!=d.tagName&&"INPUT"!=d.tagName&&"TEXTAREA"!=d.tagName&&(f=c.createEvent("MouseEvents"),f.initMouseEvent("click",!0,!0,a.view,1,o.screenX,o.screenY,o.clientX,o.clientY,a.ctrlKey,a.altKey,a.shiftKey,a.metaKey,0,null),f._fake=!0,d.dispatchEvent(f))},n.options.zoom?250:0))),n._resetPos(400),void(n.options.onTouchEnd&&n.options.onTouchEnd.call(n,a));if(300>r&&n.options.momentum&&(p=t?n._momentum(t-n.startX,r,-n.x,n.scrollerW-n.wrapperW+n.x,n.options.bounce?n.wrapperW:0):p,q=u?n._momentum(u-n.startY,r,-n.y,n.maxScrollY<0?n.scrollerH-n.wrapperH+n.y-n.minScrollY:0,n.options.bounce?n.wrapperH:0):q,t=n.x+p.dist,u=n.y+q.dist,(n.x>0&&t>0||n.xn.minScrollY&&u>n.minScrollY||n.y=0?0:b.x=b.minScrollY||b.maxScrollY>0?b.minScrollY:b.yg.options.zoomMax&&(f=g.options.zoomMax),void(f!=g.scale&&(!g.wheelZoomCount&&g.options.onZoomStart&&g.options.onZoomStart.call(g,a),g.wheelZoomCount++,g.zoom(a.pageX,a.pageY,f,400),setTimeout(function(){g.wheelZoomCount--,!g.wheelZoomCount&&g.options.onZoomEnd&&g.options.onZoomEnd.call(g,a)},400)))):(d=g.x+b,e=g.y+c,d>0?d=0:dg.minScrollY?e=g.minScrollY:e=h+a.time?(d._pos(a.x,a.y),d.animating=!1,d.options.onAnimationEnd&&d.options.onAnimationEnd.call(d),void d._startAni()):(k=(k-h)/a.time-1,b=e.sqrt(1-k*k),i=(a.x-f)*b+f,j=(a.y-g)*b+g,d._pos(i,j),void(d.animating&&(d.aniTime=B(c))))},c()}},_transitionTime:function(a){a+="ms",this.scroller.style[k]=a,this.hScrollbar&&(this.hScrollbarIndicator.style[k]=a),this.vScrollbar&&(this.vScrollbarIndicator.style[k]=a)},_momentum:function(a,b,c,d,f){var g=6e-4,h=e.abs(a)/b,i=h*h/(2*g),j=0,k=0;return a>0&&i>c?(k=f/(6/(i/h*g)),c+=k,h=h*c/i,i=c):0>a&&i>d&&(k=f/(6/(i/h*g)),d+=k,h=h*d/i,i=d),i*=0>a?-1:1,j=h/g,{dist:i,time:e.round(j)}},_offset:function(a){for(var b=-a.offsetLeft,c=-a.offsetTop;a=a.offsetParent;)b-=a.offsetLeft,c-=a.offsetTop;return a!=this.wrapper&&(b*=this.scale,c*=this.scale),{left:b,top:c}},_snap:function(a,b){var c,d,f,g,h,i,j=this;for(f=j.pagesX.length-1,c=0,d=j.pagesX.length;d>c;c++)if(a>=j.pagesX[c]){f=c;break}for(f==j.currPageX&&f>0&&j.dirX<0&&f--,a=j.pagesX[f],h=e.abs(a-j.pagesX[j.currPageX]),h=h?e.abs(j.x-a)/h*500:0,j.currPageX=f,f=j.pagesY.length-1,c=0;f>c;c++)if(b>=j.pagesY[c]){f=c;break}return f==j.currPageY&&f>0&&j.dirY<0&&f--,b=j.pagesY[f],i=e.abs(b-j.pagesY[j.currPageY]),i=i?e.abs(j.y-b)/i*500:0,j.currPageY=f,g=e.round(e.max(h,i))||200,{x:a,y:b,time:g}},_bind:function(a,b,c){(b||this.scroller).addEventListener(a,this,!!c)},_unbind:function(a,b,c){(b||this.scroller).removeEventListener(a,this,!!c)},destroy:function(){var a=this;a.scroller.style[i]="",a.hScrollbar=!1,a.vScrollbar=!1,a._scrollbar("h"),a._scrollbar("v"),a._unbind(v,b),a._unbind(w),a._unbind(x,b),a._unbind(y,b),a._unbind(z,b),a.options.hasTouch||(a._unbind("DOMMouseScroll"),a._unbind("mousewheel")),a.options.useTransition&&a._unbind(A),a.options.checkDOMChanges&&clearInterval(a.checkDOMTime),a.options.onDestroy&&a.options.onDestroy.call(a)},refresh:function(){var a,b,c,d,f=this,g=0,h=0;if(f.scalef.wrapperH),f.hScrollbar=f.hScroll&&f.options.hScrollbar,f.vScrollbar=f.vScroll&&f.options.vScrollbar&&f.scrollerH>f.wrapperH,a=f._offset(f.wrapper),f.wrapperOffsetLeft=-a.left,f.wrapperOffsetTop=-a.top,"string"==typeof f.options.snap)for(f.pagesX=[],f.pagesY=[],d=f.scroller.querySelectorAll(f.options.snap),b=0,c=d.length;c>b;b++)g=f._offset(d[b]),g.left+=f.wrapperOffsetLeft,g.top+=f.wrapperOffsetTop,f.pagesX[b]=g.left=f.maxScrollX;)f.pagesX[h]=g,g-=f.wrapperW,h++;for(f.maxScrollX%f.wrapperW&&(f.pagesX[f.pagesX.length]=f.maxScrollX-f.pagesX[f.pagesX.length-1]+f.pagesX[f.pagesX.length-1]),g=0,h=0,f.pagesY=[];g>=f.maxScrollY;)f.pagesY[h]=g,g-=f.wrapperH,h++;f.maxScrollY%f.wrapperH&&(f.pagesY[f.pagesY.length]=f.maxScrollY-f.pagesY[f.pagesY.length-1]+f.pagesY[f.pagesY.length-1])}f._scrollbar("h"),f._scrollbar("v"),f.zoomed||(f.scroller.style[k]="0",f._resetPos(400))},scrollTo:function(a,b,c,d){var e,f,g=this,h=a;for(g.stop(),h.length||(h=[{x:a,y:b,time:c,relative:d}]),e=0,f=h.length;f>e;e++)h[e].relative&&(h[e].x=g.x-h[e].x,h[e].y=g.y-h[e].y),g.steps.push({x:h[e].x,y:h[e].y,time:h[e].time||0});g._startAni()},scrollToElement:function(a,b){var c,d=this;a=a.nodeType?a:d.scroller.querySelector(a),a&&(c=d._offset(a),c.left+=d.wrapperOffsetLeft,c.top+=d.wrapperOffsetTop,c.left=c.left>0?0:c.leftd.minScrollY?d.minScrollY:c.topa?0:a>f.pagesX.length-1?f.pagesX.length-1:a,b=0>b?0:b>f.pagesY.length-1?f.pagesY.length-1:b,f.currPageX=a,f.currPageY=b,d=f.pagesX[a],e=f.pagesY[b]):(d=-f.wrapperW*a,e=-f.wrapperH*b,d0?0:e.xe.minScrollY?e.minScrollY:e.y0&&(a.playLoader.enabled=!0,a.playLoader.loadPreview(b.path),a.playLoader.previewFlag.setFlag("media",!0),a.hasMedia||(a.playLoader.busy.setFlag("media",!1),a.playLoader.bigPlay.setFlag("media",!1)),a.playLoader.checkVisibility())}}(this))}})},osmplayer.prototype.addToQueue=function(a){return a=minplayer.getMediaFile(a),a&&this.playQueue.push(a),a},osmplayer.prototype.playNext=function(){this.playQueue.length>this.playIndex?(this.load(this.playQueue[this.playIndex]),this.playIndex++):this.options.repeat?(this.playIndex=0,this.playNext()):this.playQueue.length>0?this.hasPlaylist&&this.options.autoNext?this.trigger("player_ended"):(this.options.autoplay=!1,this.playIndex=0,this.playNext()):this.media&&("undefined"!=typeof this.options.originalAutoPlay&&(this.options.autoplay=this.options.originalAutoPlay),this.media.stop(),this.options.file?this.load():this.loadNode())},osmplayer.getNode=function(a,b){if(a&&a.mediafiles&&a.mediafiles.media){var c=minplayer.getMediaFile(a.mediafiles.media.media);if(c){var d=minplayer.players[c.player];d&&"function"==typeof d.getNode&&d.getNode(c,function(a){b(a)})}}},osmplayer.getImage=function(a,b,c){var d="",e=a.image;if(e)if(e[b])d=e[b];else if(e.image)d=e.image;else for(b in e)if(e.hasOwnProperty(b)){d=e[b];break}if(d)c(new minplayer.file(d));else{var f=minplayer.getMediaFile(a.media.media);if(f){var g=minplayer.players[f.player];g&&"function"==typeof g.getImage&&g.getImage(f,b,function(a){c(new minplayer.file(a))})}}};var osmplayer=osmplayer||{};osmplayer.parser=osmplayer.parser||{},osmplayer.parser["default"]={priority:1,valid:function(){return!0},getType:function(){return"json"},getFeed:function(a,b,c){return a=a.replace(/(.*)\??(.*)/i,"$1"),a+="?start-index="+b,a+="&max-results="+c},parse:function(a){return a}};var osmplayer=osmplayer||{};osmplayer.parser=osmplayer.parser||{},osmplayer.parser.youtube={priority:10,valid:function(a){return 0===a.search(/^http(s)?\:\/\/gdata\.youtube\.com/i)},getType:function(){return"jsonp"},getFeed:function(a,b,c){return a=a.replace(/(.*)\??(.*)/i,"$1"),a+="?start-index="+(b+1),a+="&max-results="+c,a+="&v=2&alt=jsonc"},parse:function(a){a=a.data;var b={total_rows:a.totalItems,nodes:[]},c=null;for(var d in a.items)a.items.hasOwnProperty(d)&&(c=minplayer.players.youtube.parseNode(a.items[d]),b.nodes.push(c));return b}};var osmplayer=osmplayer||{};osmplayer.parser=osmplayer.parser||{},osmplayer.parser.rss={priority:8,valid:function(a){return a=a.replace(/(.*)\??(.*)/i,"$1"),null!==a.match(/\.rss$/i)},getType:function(){return"xml"},getFeed:function(a){return a},parse:function(a){var b={total_rows:0,nodes:[]};return jQuery("rss channel",a).find("item").each(function(){osmplayer.parser.rss.addRSSItem(b,jQuery(this))}),b},addRSSItem:function(a,b){a.total_rows++;var c={},d="",e="",f="",g="";d=b.find("title"),d.length&&(c.title=d.text()),e=b.find("annotation"),e.length&&(c.description=e.text()),c.mediafiles={},f=b.find("image"),f.length&&(c.mediafiles.image={image:{path:f.text()}}),g=b.find("location"),g.length&&(c.mediafiles.media={media:{path:g.text()}}),a.nodes.push(c) }};var osmplayer=osmplayer||{};osmplayer.parser=osmplayer.parser||{},osmplayer.parser.asx={priority:8,valid:function(a){return a=a.replace(/(.*)\??(.*)/i,"$1"),null!==a.match(/\.asx$/i)},getType:function(){return"xml"},getFeed:function(a){return a},parse:function(a){var b={total_rows:0,nodes:[]};return jQuery("asx entry",a).each(function(){osmplayer.parser.rss.addRSSItem(b,jQuery(this))}),b}};var osmplayer=osmplayer||{};osmplayer.parser=osmplayer.parser||{},osmplayer.parser.xsfp={priority:8,valid:function(a){return a=a.replace(/(.*)\??(.*)/i,"$1"),null!==a.match(/\.xml$/i)},getType:function(){return"xml"},getFeed:function(a){return a},parse:function(a){var b={total_rows:0,nodes:[]};return jQuery("playlist trackList track",a).each(function(){osmplayer.parser.rss.addRSSItem(b,jQuery(this))}),b}},osmplayer.playlist=function(a,b){minplayer.display.call(this,"playlist",a,b)},osmplayer.playlist.prototype=new minplayer.display,osmplayer.playlist.prototype.constructor=osmplayer.playlist,osmplayer.playlist.prototype.defaultOptions=function(a){a.vertical=!0,a.playlist="",a.pageLimit=10,a.autoNext=!0,a.shuffle=!1,a.loop=!1,a.hysteresis=40,a.scrollSpeed=20,a.scrollMode="auto",minplayer.display.prototype.defaultOptions.call(this,a)},osmplayer.playlist.prototype.construct=function(){this.nodes=[],this.page=-1,this.totalItems=0,this.currentItem=-1,this.playqueue=[],this.playqueuepos=0,this.playlist=this.options.playlist,this.scroll=null,this.orient={pos:this.options.vertical?"y":"x",pagePos:this.options.vertical?"pageY":"pageX",offset:this.options.vertical?"top":"left",wrapperSize:this.options.vertical?"wrapperH":"wrapperW",minScroll:this.options.vertical?"minScrollY":"minScrollX",maxScroll:this.options.vertical?"maxScrollY":"maxScrollX",size:this.options.vertical?"height":"width"},this.pager=this.create("pager","osmplayer"),this.pager.ubind(this.uuid+":nextPage",function(a){return function(){a.nextPage()}}(this)),this.pager.ubind(this.uuid+":prevPage",function(a){return function(){a.prevPage()}}(this)),minplayer.display.prototype.construct.call(this),this.hasPlaylist=this.next(),this.ready()},osmplayer.playlist.prototype.onAdded=function(a){this.options.autoNext&&a.get("player",function(a){return function(b){b.ubind(a.uuid+":player_ended",function(){a.hasPlaylist&&("undefined"==typeof b.options.originalAutoPlay&&(b.options.originalAutoPlay=b.options.autoplay),b.options.autoplay=!0,a.next())})}}(this))},osmplayer.playlist.prototype.scrollTo=function(a,b){this.scroll&&(this.scroll.options.hideScrollbar=!1,this.options.vertical?this.scroll.scrollTo(0,a,0,b):this.scroll.scrollTo(a,0,0,b),this.scroll.options.hideScrollbar=!0)},osmplayer.playlist.prototype.refreshScroll=function(){if(!window.addEventListener)return void setTimeout(function(a){return function(){a.refreshScroll.call(a)}}(this),200);var a=this.elements.list,b=this.elements.scroll;if(this.scroll&&(this.scroll.scrollTo(0,0),this.scroll.destroy(),this.scroll=null,this.elements.list.unbind("mousemove").unbind("mouseenter").unbind("mouseleave")),!this.options.vertical){var c=0;jQuery.each(this.elements.list.children(),function(){c+=jQuery(this).outerWidth()}),this.elements.list.width(c)}a.length>0&&b.length>0&&a[this.orient.size]()>b[this.orient.size]()&&(this.scroll=new osmplayer.iScroll(this.elements.scroll.eq(0)[0],{hScroll:!this.options.vertical,hScrollbar:!this.options.vertical,vScroll:this.options.vertical,vScrollbar:this.options.vertical,hideScrollbar:"none"!==this.options.scrollMode}),"auto"!=this.options.scrollMode||minplayer.hasTouch||this.elements.list.bind("mousemove",function(a){return function(b){b.preventDefault();var c=a.display.offset()[a.orient.offset];a.mousePos=b[a.orient.pagePos],a.mousePos-=c}}(this)).bind("mouseenter",function(a){return function(b){b.preventDefault(),a.scrolling=!0;var c=function(){if(a.scrolling){var b=a.scroll[a.orient.wrapperSize],d=b/2,e=a.mousePos-d;if(Math.abs(e)>a.options.hysteresis){var f=a.options.hysteresis;f*=e>0?-1:0,e=a.options.scrollSpeed*(e+f),e/=d;var g=a.scroll[a.orient.pos]-e,h=a.scroll[a.orient.minScroll]||0,i=a.scroll[a.orient.maxScroll];g>=h?a.scrollTo(h):i>=g?a.scrollTo(i):a.scrollTo(e,!0)}setTimeout(c,30)}};c()}}(this)).bind("mouseleave",function(a){return function(b){b.preventDefault(),a.scrolling=!1}}(this)),this.scroll.refresh(),this.scroll.scrollTo(0,0,200))},osmplayer.playlist.prototype.addNode=function(a){var b=this.nodes.length,c=this.create("teaser","osmplayer",this.elements.list);c.setNode(a),c.ubind(this.uuid+":nodeLoad",function(a){return function(){a.loadItem(b,!0)}}(this)),this.nodes.push(c)},osmplayer.playlist.prototype.set=function(a,b){if("object"!=typeof a)return void this.trigger("error","Playlist must be an object to set");if(!a.hasOwnProperty("total_rows"))return void this.trigger("error","Unknown playlist format.");if(a.total_rows&&a.nodes.length){this.totalItems=a.total_rows,this.currentItem=0,(this.page+1)*this.options.pageLimit>=this.totalItems||this.totalItems==a.nodes.length?this.pager.nextPage.hide():this.pager.nextPage.show();var c=a.nodes.length;this.elements.list.empty(),this.nodes=[];for(var d=0;c>d;d++)this.addNode(a.nodes[d]),b===d&&this.loadItem(d);this.refreshScroll(),this.trigger("playlistLoad",a)}this.elements.playlist_busy&&this.elements.playlist_busy.hide()},osmplayer.playlist.prototype.setQueue=function(){this.playqueue.push({page:this.page,item:this.currentItem}),this.playqueuepos=this.playqueue.length},osmplayer.playlist.prototype.next=function(){var a=0,b=this.page;if(this.playqueuepos>=this.playqueue.length)return this.options.shuffle?(a=Math.floor(Math.random()*this.totalItems),b=Math.floor(a/this.options.pageLimit),a%=this.options.pageLimit,this.load(b,a)):(a=this.currentItem+1,a>=this.nodes.length?this.load(b+1,0):this.loadItem(a));this.playqueuepos=this.playqueuepos+1;var c=this.playqueue[this.playqueuepos];return this.load(c.page,c.item)},osmplayer.playlist.prototype.prev=function(){this.playqueuepos=this.playqueuepos-1,this.playqueuepos=this.playqueuepos<0?0:this.playqueuepos;var a=this.playqueue[this.playqueuepos];return a?this.load(a.page,a.item):!1},osmplayer.playlist.prototype.loadItem=function(a,b){if(ac){if(!this.options.loop)return!1;a=0,b=0}if(this.elements.playlist_busy&&this.elements.playlist_busy.show(),a=a||0,a=0>a?0:a,this.setQueue(),this.page=a,0===this.page?this.pager.prevPage.hide():this.pager.prevPage.show(),"object"==typeof this.playlist)return this.set(this.playlist,b),this.playlist.endpoint&&(this.playlist=this.options.playlist=this.playlist.endpoint),!0;var d=osmplayer.parser["default"];for(var e in osmplayer.parser)osmplayer.parser.hasOwnProperty(e)&&osmplayer.parser[e].valid(this.playlist)&&osmplayer.parser[e].priority>d.priority&&(d=osmplayer.parser[e]);var f=this.page*this.options.pageLimit,g=d.getFeed(this.playlist,f,this.options.pageLimit),h={type:"GET",url:g,success:function(a){return function(c){a.set(d.parse(c),b)}}(this),error:function(a){return function(b,c){a.elements.playlist_busy&&a.elements.playlist_busy.hide(),a.trigger("error",c)}}(this)},i=d.getType();return i&&(h.dataType=i),jQuery.ajax(h),!0};var osmplayer=osmplayer||{};osmplayer.pager=function(a,b){minplayer.display.call(this,"pager",a,b)},osmplayer.pager.prototype=new minplayer.display,osmplayer.pager.prototype.constructor=osmplayer.pager,osmplayer.pager.prototype.construct=function(){minplayer.display.prototype.construct.call(this),this.elements.prevPage&&(this.prevPage=this.elements.prevPage.click(function(a){return function(b){b.preventDefault(),a.trigger("prevPage")}}(this))),this.elements.nextPage&&(this.nextPage=this.elements.nextPage.click(function(a){return function(b){b.preventDefault(),a.trigger("nextPage")}}(this)))};var osmplayer=osmplayer||{};osmplayer.teaser=function(a,b){this.preview=null,minplayer.display.call(this,"teaser",a,b)},osmplayer.teaser.prototype=new minplayer.display,osmplayer.teaser.prototype.constructor=osmplayer.teaser,osmplayer.teaser.prototype.select=function(){},osmplayer.teaser.prototype.setNode=function(a){this.node=a,this.elements.title&&(a.title?this.elements.title.text(a.title):osmplayer.getNode(a,function(a){return function(b){a.elements.title.text(b.title)}}(this))),a.mediafiles&&osmplayer.getImage(a.mediafiles,"thumbnail",function(a){return function(b){b&&a.elements.image&&(a.preview=new minplayer.image(a.elements.image),a.preview.load(b.path))}}(this)),this.display.unbind("click").click(function(a){return function(b){b.preventDefault(),a.trigger("nodeLoad",a.node)}}(this))}; \ No newline at end of file diff --git a/doc/classes.list.html b/doc/classes.list.html index c21818a8..a08cba20 100644 --- a/doc/classes.list.html +++ b/doc/classes.list.html @@ -167,7 +167,7 @@

Classes

Documentation generated by JSDoc 3.2.2 - on Sun May 04 2014 16:10:34 GMT-0500 (CDT) using the DocStrap template. + on Mon May 05 2014 16:23:45 GMT-0500 (CDT) using the DocStrap template. diff --git a/doc/global.html b/doc/global.html index cbcc10bb..f5fbcff7 100644 --- a/doc/global.html +++ b/doc/global.html @@ -530,7 +530,7 @@

osmplayer Documentation generated by JSDoc 3.2.2 - on Sun May 04 2014 16:10:34 GMT-0500 (CDT) using the DocStrap template. + on Mon May 05 2014 16:23:45 GMT-0500 (CDT) using the DocStrap template. diff --git a/doc/global.html#osmplayer b/doc/global.html#osmplayer index 8caeee86..ae042e84 100644 --- a/doc/global.html#osmplayer +++ b/doc/global.html#osmplayer @@ -1912,7 +1912,7 @@ Documentation generated by JSDoc 3.2.2 - on Sun May 04 2014 16:10:34 GMT-0500 (CDT) using the DocStrap template. + on Mon May 05 2014 16:23:45 GMT-0500 (CDT) using the DocStrap template. diff --git a/doc/index.html b/doc/index.html index 95eb31b4..89b33418 100644 --- a/doc/index.html +++ b/doc/index.html @@ -102,7 +102,7 @@ Documentation generated by JSDoc 3.2.2 - on Sun May 04 2014 16:10:34 GMT-0500 (CDT) using the DocStrap template. + on Mon May 05 2014 16:23:45 GMT-0500 (CDT) using the DocStrap template. diff --git a/doc/osmplayer.js.html b/doc/osmplayer.js.html index a5445a86..10ae442a 100644 --- a/doc/osmplayer.js.html +++ b/doc/osmplayer.js.html @@ -488,7 +488,7 @@

Source: osmplayer.js

Documentation generated by JSDoc 3.2.2 - on Sun May 04 2014 16:10:34 GMT-0500 (CDT) using the DocStrap template. + on Mon May 05 2014 16:23:45 GMT-0500 (CDT) using the DocStrap template. diff --git a/doc/osmplayer.pager.html b/doc/osmplayer.pager.html index ac2f9ed0..5c7671dd 100644 --- a/doc/osmplayer.pager.html +++ b/doc/osmplayer.pager.html @@ -395,7 +395,7 @@

construct Documentation generated by JSDoc 3.2.2 - on Sun May 04 2014 16:10:34 GMT-0500 (CDT) using the DocStrap template. + on Mon May 05 2014 16:23:45 GMT-0500 (CDT) using the DocStrap template. diff --git a/doc/osmplayer.pager.js.html b/doc/osmplayer.pager.js.html index eeab5576..7db27e9c 100644 --- a/doc/osmplayer.pager.js.html +++ b/doc/osmplayer.pager.js.html @@ -136,7 +136,7 @@

Source: osmplayer.pager.js

Documentation generated by JSDoc 3.2.2 - on Sun May 04 2014 16:10:34 GMT-0500 (CDT) using the DocStrap template. + on Mon May 05 2014 16:23:45 GMT-0500 (CDT) using the DocStrap template. diff --git a/doc/osmplayer.parser.asx.js.html b/doc/osmplayer.parser.asx.js.html index e253fee2..0483ebeb 100644 --- a/doc/osmplayer.parser.asx.js.html +++ b/doc/osmplayer.parser.asx.js.html @@ -129,7 +129,7 @@

Source: osmplayer.parser.asx.js

Documentation generated by JSDoc 3.2.2 - on Sun May 04 2014 16:10:34 GMT-0500 (CDT) using the DocStrap template. + on Mon May 05 2014 16:23:45 GMT-0500 (CDT) using the DocStrap template. diff --git a/doc/osmplayer.parser.default.js.html b/doc/osmplayer.parser.default.js.html index a7bfb790..ca186854 100644 --- a/doc/osmplayer.parser.default.js.html +++ b/doc/osmplayer.parser.default.js.html @@ -124,7 +124,7 @@

Source: osmplayer.parser.default.js

Documentation generated by JSDoc 3.2.2 - on Sun May 04 2014 16:10:34 GMT-0500 (CDT) using the DocStrap template. + on Mon May 05 2014 16:23:45 GMT-0500 (CDT) using the DocStrap template. diff --git a/doc/osmplayer.parser.rss.js.html b/doc/osmplayer.parser.rss.js.html index 53a7bee4..20d0fb16 100644 --- a/doc/osmplayer.parser.rss.js.html +++ b/doc/osmplayer.parser.rss.js.html @@ -173,7 +173,7 @@

Source: osmplayer.parser.rss.js

Documentation generated by JSDoc 3.2.2 - on Sun May 04 2014 16:10:34 GMT-0500 (CDT) using the DocStrap template. + on Mon May 05 2014 16:23:45 GMT-0500 (CDT) using the DocStrap template. diff --git a/doc/osmplayer.parser.xspf.js.html b/doc/osmplayer.parser.xspf.js.html index 386f5557..156e941b 100644 --- a/doc/osmplayer.parser.xspf.js.html +++ b/doc/osmplayer.parser.xspf.js.html @@ -129,7 +129,7 @@

Source: osmplayer.parser.xspf.js

Documentation generated by JSDoc 3.2.2 - on Sun May 04 2014 16:10:34 GMT-0500 (CDT) using the DocStrap template. + on Mon May 05 2014 16:23:45 GMT-0500 (CDT) using the DocStrap template. diff --git a/doc/osmplayer.parser.youtube.js.html b/doc/osmplayer.parser.youtube.js.html index d343bf52..2701a030 100644 --- a/doc/osmplayer.parser.youtube.js.html +++ b/doc/osmplayer.parser.youtube.js.html @@ -140,7 +140,7 @@

Source: osmplayer.parser.youtube.js

Documentation generated by JSDoc 3.2.2 - on Sun May 04 2014 16:10:34 GMT-0500 (CDT) using the DocStrap template. + on Mon May 05 2014 16:23:45 GMT-0500 (CDT) using the DocStrap template. diff --git a/doc/osmplayer.playlist.html b/doc/osmplayer.playlist.html index efe981dd..543b5bdd 100644 --- a/doc/osmplayer.playlist.html +++ b/doc/osmplayer.playlist.html @@ -1948,7 +1948,7 @@

setQueue Documentation generated by JSDoc 3.2.2 - on Sun May 04 2014 16:10:34 GMT-0500 (CDT) using the DocStrap template. + on Mon May 05 2014 16:23:46 GMT-0500 (CDT) using the DocStrap template. diff --git a/doc/osmplayer.playlist.js.html b/doc/osmplayer.playlist.js.html index 6ebd5f5e..4968b44b 100644 --- a/doc/osmplayer.playlist.js.html +++ b/doc/osmplayer.playlist.js.html @@ -670,7 +670,7 @@

Source: osmplayer.playlist.js

Documentation generated by JSDoc 3.2.2 - on Sun May 04 2014 16:10:34 GMT-0500 (CDT) using the DocStrap template. + on Mon May 05 2014 16:23:45 GMT-0500 (CDT) using the DocStrap template. diff --git a/doc/osmplayer.teaser.html b/doc/osmplayer.teaser.html index 07bec4c0..784529a4 100644 --- a/doc/osmplayer.teaser.html +++ b/doc/osmplayer.teaser.html @@ -613,7 +613,7 @@
Parameters:
Documentation generated by JSDoc 3.2.2 - on Sun May 04 2014 16:10:34 GMT-0500 (CDT) using the DocStrap template. + on Mon May 05 2014 16:23:46 GMT-0500 (CDT) using the DocStrap template. diff --git a/doc/osmplayer.teaser.js.html b/doc/osmplayer.teaser.js.html index 262c1a9c..808f793e 100644 --- a/doc/osmplayer.teaser.js.html +++ b/doc/osmplayer.teaser.js.html @@ -163,7 +163,7 @@

Source: osmplayer.teaser.js

Documentation generated by JSDoc 3.2.2 - on Sun May 04 2014 16:10:34 GMT-0500 (CDT) using the DocStrap template. + on Mon May 05 2014 16:23:45 GMT-0500 (CDT) using the DocStrap template. diff --git a/doc/prototype..html b/doc/prototype..html index 316a379c..e3e1ee0d 100644 --- a/doc/prototype..html +++ b/doc/prototype..html @@ -251,7 +251,7 @@
Returns:
Documentation generated by JSDoc 3.2.2 - on Sun May 04 2014 16:10:34 GMT-0500 (CDT) using the DocStrap template. + on Mon May 05 2014 16:23:45 GMT-0500 (CDT) using the DocStrap template.