/*! * Projekktor II - HTML5 Media Player, Projekktor Core Version: V1.2.38 r332 * http://www.projekktor.com * Copyright 2010, 2011, Sascha Kluger, Spinning Airwhale Media, http://www.spinningairwhale.com * GNU General Public License * http://www.projekktor.com/license/ */ jQuery(function($){var projekktors=[];if(!!document.createElement("video").canPlayType){(function(){if(! /*@cc_on!@*/ 0){return}var e="audio,video,track,source".split(",");for(var i=0;i0){return(instances.length==1)?instances[0]:new Iterator(instances)}}if(instances.length===0){var cfg=arguments[1]||{},callback=arguments[2]||{},count=0,playerA;if(typeof arg=="string"){$.each($(arg),function(){playerA=new PPlayer($(this),cfg,callback);projekktors.push(playerA);count++});return(count>1)?new Iterator(projekktors):playerA}else{if(arg){projekktors.push(new PPlayer(arg,cfg,callback));return new Iterator(projekktors)}}}return null;function PPlayer(srcNode,cfg,onReady){this.config=new projekktorConfig("1.2.38");this.env={muted:false,playerDom:null,mediaContainer:null,agent:"standard",mouseIsOver:false,loading:false,className:"",onReady:onReady};this.media=[];this._plugins=[];this._pluginCache={};this._queue=[];this._cuePoints={};this.listeners=[];this.playerModel={};this._isReady=false;this._maxElapsed=0;this._currentItem=null;this._playlistServer="";this._id="";this._reelUpdate=function(obj){var ref=this,itemIdx=null,data=obj||[{}],files=data.playlist||data;this.env.loading=true;this.media=[];try{for(var props in data.config){if(typeof data.config[props].indexOf("objectfunction")>-1){continue}this.config[props]=eval(data.config[props])}if(data.config!=null){$p.utils.log("Updated config var: "+props+" to "+this.config[props]);this._promote("configModified");delete (data.config)}}catch(e){}$.each(files,function(){itemIdx=ref._addItem(ref._prepareMedia({file:this,config:this.config||{},errorCode:this.errorCode||0}));$.each(this.cuepoints||[],function(){this.item=itemIdx;ref.setCuePoint(this)})});if(itemIdx===null){this._addItem(this._prepareMedia({file:"",config:{},errorCode:97}))}this.env.loading=false;this._promote("scheduled",this.getItemCount());this._syncPlugins(function(){ref.setActiveItem(0)})};this._addItem=function(data,idx,replace){var resultIdx=0;if(this.media.length===1&&this.media[0].mediaModel=="NA"){this._detachplayerModel();this.media=[]}if(idx===undefined||idx<0||idx>this.media.length-1){this.media.push(data);resultIdx=this.media.length-1}else{this.media.splice(idx,(replace===true)?1:0,data);resultIdx=idx}if(this.env.loading===false){this._promote("scheduleModified",this.getItemCount())}return resultIdx};this._removeItem=function(idx){var resultIdx=0;if(this.media.length===1){if(this.media[0].mediaModel=="NA"){return 0}else{this.media[0]=this._prepareMedia({file:""});return 0}}if(idx===undefined||idx<0||idx>this.media.length-1){this.media.pop();resultIdx=this.media.length}else{this.media.splice(idx,1);resultIdx=idx}if(this.env.loading===false){this._promote("scheduleModified",this.getItemCount())}return resultIdx};this._prepareMedia=function(data){var ref=this,mediaFiles=[],qualities=[],extTypes={},typesModels={},modelSets=[],result={},extRegEx=[];for(var i in $p.mmap){if($p.mmap.hasOwnProperty(i)){platforms=(typeof $p.mmap[i].platform=="object")?$p.mmap[i].platform:[$p.mmap[i].platform];$.each(platforms,function(_na,platform){if(!ref._canPlay($p.mmap[i].type,platform,data.config.streamType)){return true}$p.mmap[i].level=$.inArray(platform,ref.config._platforms);$p.mmap[i].level=($p.mmap[i].level<0)?100:$p.mmap[i].level;extRegEx.push("."+$p.mmap[i].ext);if(!extTypes[$p.mmap[i].ext]){extTypes[$p.mmap[i].ext]=[]}extTypes[$p.mmap[i].ext].push($p.mmap[i]);if($p.mmap[i].streamType==null||data.config.streamType==null||$.inArray(data.config.streamType,$p.mmap[i].streamType)>-1||$p.mmap[i].streamType=="*"){if(!typesModels[$p.mmap[i].type]){typesModels[$p.mmap[i].type]=[]}typesModels[$p.mmap[i].type].push($p.mmap[i])}return true})}}extRegEx="^.*.("+extRegEx.join("|")+")$";if(typeof data.file=="string"){data.file=[{src:data.file}];if(typeof data.type=="string"){data.file=[{src:data.file,type:data.type}]}}if($.isEmptyObject(data)||data.file===false||data.file===null){data.file=[{src:null}]}for(var index in data.file){if(data.file.hasOwnProperty(index)){if(index=="config"){continue }if(typeof data.file[index]=="string"){data.file[index]={src:data.file[index]}}if(data.file[index].src==null){continue}if(data.file[index].type!=null&&data.file[index].type!==""){try{var codecMatch=data.file[index].type.split(" ").join("").split(/[\;]codecs=.([a-zA-Z0-9\,]*)[\'|\"]/i);if(codecMatch[1]!=null){data.file[index].codec=codecMatch[1]}data.file[index].type=codecMatch[0]}catch(e){}}else{data.file[index].type=this._getTypeFromFileExtension(data.file[index].src)}var possibleTypes=$.merge(typesModels[data.file[index].type]||[],typesModels[data.file[index].type.replace(/x-/,"")]||[]);if(possibleTypes.length>0){possibleTypes.sort(function(a,b){return a.level-b.level});modelSets.push(possibleTypes[0])}}}if(modelSets.length===0){modelSets=typesModels["none/none"]}else{modelSets.sort(function(a,b){return a.level-b.level});var bestMatch=modelSets[0].level;modelSets=$.grep(modelSets,function(value){return value.level==bestMatch})}var types=[];$.each(modelSets||[],function(){types.push(this.type)});var modelSet=(modelSets&&modelSets.length>0)?modelSets[0]:{type:"none/none",model:"NA",errorCode:11};types=$p.utils.unique(types);for(var index in data.file){if(data.file[index].type==null){continue}if(($.inArray(data.file[index].type.replace(/x-/,""),types)<0)&&modelSet.type!="none/none"){continue}data.file[index].src=(!$.isEmptyObject(data.config)&&(data.config.streamType=="http"||data.config.streamType==null))?$p.utils.toAbsoluteURL(data.file[index].src):data.file[index].src;if(data.file[index].quality==null){data.file[index].quality="default"}qualities.push(data.file[index].quality);mediaFiles.push(data.file[index])}if(mediaFiles.length==0){mediaFiles.push({src:null,quality:"default"})}var _setQual=[];$.each(this.getConfig("playbackQualities"),function(){_setQual.push(this.key||"default")});result={ID:data.config.id||$p.utils.randomId(8),cat:data.config.cat||"clip",file:mediaFiles,platform:modelSet.platform,platforms:platforms,qualities:$p.utils.intersect($p.utils.unique(_setQual),$p.utils.unique(qualities)),mediaModel:modelSet.model||"NA",errorCode:modelSet.errorCode||data.errorCode||7,config:data.config||{}};return result};this._modelUpdateListener=function(type,value){var ref=this;if(!this.playerModel.init){return}if(type!="time"&&type!="progress"){$p.utils.log("Update: '"+type,this.playerModel.getSrc(),this.playerModel.getModelName(),value)}switch(type){case"state":this._promote("state",value);var classes=$.map(this.getDC().attr("class").split(" "),function(item){return item.indexOf(ref.getConfig("ns")+"state")===-1?item:""});classes.push(this.getConfig("ns")+"state"+value.toLowerCase());this.getDC().attr("class",classes.join(" "));switch(value){case"AWAKENING":var modelRef=this.playerModel;this._syncPlugins(function(){if(modelRef.getState("AWAKENING")){modelRef.displayItem(true)}});break;case"ERROR":this._addGUIListeners();break;case"STOPPED":this._promote("stopped",{});break;case"PAUSED":if(this.getConfig("disablePause")===true){this.playerModel.applyCommand("play",0)}break;case"COMPLETED":if(this._currentItem+1>=this.media.length&&!this.getConfig("loop")){if(this.getConfig("leaveFullscreen")){this.setFullscreen(false)}this._promote("done",{})}this.setActiveItem("next");break}break;case"modelReady":this._maxElapsed=0;this._promote("item",ref._currentItem);break;case"displayReady":this._promote("displayReady",true);modelRef=this.playerModel;this._syncPlugins(function(){ref._promote("ready");ref._addGUIListeners();if(!modelRef.getState("IDLE")){modelRef.start()}});break;case"qualityChange":this.setConfig({playbackQuality:value});this._promote("qualityChange",value);break;case"volume":this.setConfig({volume:value});this._promote("volume",value);if(value<=0){this.env.muted=true;this._promote("mute",value)}else{if(this.env.muted===true){this.env.muted=false;this._promote("unmute",value)}}break;case"playlist":this.setFile(value.file,value.type);break;case"config":this.setConfig(value);break;case"time":if(this._maxElapsed25&&pct<50){evt="firstquartile";pct=50}if(pct>50&&pct<75){evt="midpoint";pct=75}if(pct>75&&pct<100){evt="thirdquartile";pct=100}if(evt!==false){this._promote(evt,value)}this._maxElapsed=(this.getDuration()*pct/100)}this._promote(type,value);break;case"fullscreen":if(value===true){this.getDC().addClass("fullscreen");this._enterFullViewport()}else{this.getDC().removeClass("fullscreen");this._exitFullViewport()}this._promote(type,value);break;case"error":this._promote(type,value);if(this.getConfig("skipTestcard")&&this.getItemCount()>1){this.setActiveItem("next")}else{this.playerModel.applyCommand("error",value);this._addGUIListeners()}break;default:this._promote(type,value);break}};this._syncPlugins=function(callback){var ref=this;this.env.loading=true;(function(){try{if(ref._plugins.length>0){for(var i=0;i0||plugins.length==0){return}for(var i=0;i1){if(this._pluginCache[propName]==null){this._pluginCache[propName]=[]}this._pluginCache[propName].push(pluginObj)}}this._plugins.push(pluginObj)}};this.removePlugins=function(rmvPl){if(this._plugins.length==0){return}var pluginsToRemove=rmvPl||$.merge($.merge([],this.config._plugins),this.config._addplugins),pluginsRegistered=this._plugins.length;for(var j=0;j0){for(var i=0;i0){for(var i=0;i0){for(var i=0;i0){if(($(document.elementFromPoint(evt.touches[0].clientX,evt.touches[0].clientY)).attr("id")||"").indexOf(this.getDC().attr("id"))>-1){if(this.env.mouseIsOver==false){this._promote("mouseenter",{})}this.env.mouseIsOver=true;this._promote("mousemove",{});evt.stopPropagation()}else{if(this.env.mouseIsOver){this._promote("mouseleave",{}); this.env.mouseIsOver=false}}}}};this._playerFocusListener=function(evt){var type=evt.type.toLowerCase();switch(type){case"mousedown":if(this.env.mouseIsOver==false){break}if("|TEXTAREA|INPUT".indexOf("|"+evt.target.tagName.toUpperCase())>-1){return}if(evt.which==3){if($(evt.target).hasClass("context")){break}$(document).bind("contextmenu",function(evt){$(document).unbind("contextmenu");return false})}break;case"mousemove":if(this.env.mouseX!=evt.clientX&&this.env.mouseY!=evt.clientY){this.env.mouseIsOver=true}if(this.env.clientX==evt.clientX&&this.env.clientY==evt.clientY){return}this.env.clientX=evt.clientX;this.env.clientY=evt.clientY;break;case"focus":case"mouseenter":this.env.mouseIsOver=true;break;case"blur":case"mouseleave":this.env.mouseIsOver=false;break}this._promote(type,evt)};this._keyListener=function(evt){if(!this.env.mouseIsOver){return}if("|TEXTAREA|INPUT".indexOf("|"+evt.target.tagName.toUpperCase())>-1){return}var ref=this,set=(this.getConfig("keys").length>0)?this.getConfig("keys"):[{27:function(player){if(player.getInFullscreen()){player.setFullscreen(false)}else{player.setStop()}},32:function(player,evt){player.setPlayPause();evt.preventDefault()},70:function(player){player.setFullscreen()},39:function(player,evt){player.setPlayhead("+5");evt.preventDefault()},37:function(player,evt){player.setPlayhead("-5");evt.preventDefault()},38:function(player,evt){player.setVolume("+0.05");evt.preventDefault()},40:function(player,evt){player.setVolume("-0.05");evt.preventDefault()},68:function(player){player.setDebug()},67:function(player){$p.utils.log("Config Dump",player.config)},80:function(player){$p.utils.log("Schedule Dump",player.media)},84:function(player){$p.utils.log("Cuepoints Dump",player.getCuePoints())}}];this._promote("key",evt);$.each(set||[],function(){try{this[evt.keyCode](ref,evt)}catch(e){}try{this["*"](ref)}catch(e){}})};this._enterFullViewport=function(forcePlayer){var win=this.getIframeParent()||$(window),target=this.getIframe()||this.getDC(),overflow=$(win[0].document.body).css("overflow");if(forcePlayer){win=$(window);target=this.getDC()}target.data("fsdata",{scrollTop:win.scrollTop()||0,scrollLeft:win.scrollLeft()||0,targetStyle:target.attr("style")||"",targetWidth:target.width(),targetHeight:target.height(),bodyOverflow:(overflow=="visible")?"auto":overflow,bodyOverflowX:$(win[0].document.body).css("overflow-x"),bodyOverflowY:$(win[0].document.body).css("overflow-y"),iframeWidth:target.attr("width")||0,iframeHeight:target.attr("height")||0}).css({position:"fixed",display:"block",top:0,left:0,width:"100%",height:"100%",zIndex:99999,margin:0,padding:0});win.scrollTop(0).scrollLeft(0);$(win[0].document.body).css({overflow:"hidden",overflowX:"hidden",overflowY:"hidden"})};this._exitFullViewport=function(forcePlayer){var win=this.getIframeParent()||$(window),target=this.getIframe()||this.getDC(),fsData=target.data("fsdata")||null;if(forcePlayer){win=$(window);target=this.getDC()}if(fsData!=null){win.scrollTop(fsData.scrollTop).scrollLeft(fsData.scrollLeft);$(win[0].document.body).css("overflow",fsData.bodyOverflow);$(win[0].document.body).css("overflow-x",fsData.bodyOverflowX);$(win[0].document.body).css("overflow-y",fsData.bodyOverflowY);if(fsData.iframeWidth>0&&!forcePlayer){target.attr("width",fsData.iframeWidth+"px").attr("height",fsData.iframeHeight+"px")}else{target.width(fsData.targetWidth).height(fsData.targetHeight)}target.attr("style",(fsData.targetStyle==null)?"":fsData.targetStyle).data("fsdata",null)}};this.pluginAPI=function(){var args=Array.prototype.slice.call(arguments)||null,dest=args.shift(),func=args.shift();if(dest!=null&&func!=null){for(var j=0;j-1){try{if(this.media[idx]["config"][name]){result=$.extend(true,{},this.config[name],this.media[idx]["config"][name])}}catch(e){}}if(result==null){return null}if(typeof result=="object"&&result.length===null){result=$.extend(true,{},result||{})}else{if(typeof result=="object"){result=$.extend(true,[],result||[])}}if(typeof result=="string"){switch(result){case"true":result=true;break;case"false":result=false;break;case"NaN":case"undefined":case"null":result=null;break}}return result};this.getDC=function(){return this.env.playerDom};this.getState=function(compare){var result="IDLE"; try{result=this.playerModel.getState()}catch(e){}if(compare!=null){return(result==compare.toUpperCase())}return result};this.getLoadProgress=function(){try{return this.playerModel.getLoadProgress()}catch(e){return 0}};this.getKbPerSec=function(){try{return this.playerModel.getKbPerSec()}catch(e){return 0}};this.getItemCount=function(){return(this.media.length==1&&this.media[0].mediaModel=="na")?0:this.media.length};this.getItemId=function(idx){return this.media[idx||this._currentItem].ID||null};this.getItemIdx=function(){return this._currentItem};this.getPlaylist=function(){return this.getItem("*")};this.getItem=function(){if(this.media.length==1&&this.media[0].mediaModel=="na"){return{}}switch(arguments[0]||"current"){case"next":return $.extend(true,{},this.media[this._currentItem+1]||{});case"prev":return $.extend(true,{},this.media[this._currentItem-1]||{});case"current":return $.extend(true,{},this.media[this._currentItem]||{});case"*":return $.extend(true,{},this.media||{});default:return $.extend(true,{},this.media[arguments[0]||this._currentItem]||{})}};this.getVolume=function(){return(this.getConfig("fixedVolume")===true)?this.config.volume:this.getConfig("volume")};this.getTrackId=function(){if(this.getConfig("trackId")){return this.config.trackId}if(this._playlistServer!=null){return"pl"+this._currentItem}return null};this.getLoadPlaybackProgress=function(){try{return this.playerModel.getLoadPlaybackProgress()}catch(e){return 0}};this.getSource=function(){try{return this.playerModel.getSource()[0].src}catch(e){return false}};this.getDuration=function(){try{return this.playerModel.getDuration()}catch(e){return 0}};this.getPosition=function(){try{return this.playerModel.getPosition()||0}catch(e){return 0}};this.getMaxPosition=function(){try{return this.playerModel.getMaxPosition()||0}catch(e){return 0}};this.getFrame=function(){try{return this.playerModel.getFrame()}catch(e){return 0}};this.getTimeLeft=function(){try{return this.playerModel.getDuration()-this.playerModel.getPosition()}catch(e){return this.media[this._currentItem].duration}};this.getInFullscreen=function(){return this.getNativeFullscreenSupport().isFullScreen()};this.getMediaContainer=function(){if(this.env.mediaContainer==null){this.env.mediaContainer=$("#"+this.getMediaId())}if(this.env.mediaContainer.length==0){if(this.env.playerDom.find("."+this.getNS()+"display").length>0){this.env.mediaContainer=$(document.createElement("div")).attr({id:this.getId()+"_media"}).css({overflow:"hidden",height:"100%",width:"100%",top:0,left:0,padding:0,margin:0,display:"block"}).appendTo(this.env.playerDom.find("."+this.getNS()+"display"))}else{this.env.mediaContainer=$(document.createElement("div")).attr({id:this.getMediaId()}).css({width:"1px",height:"1px"}).appendTo($(document.body))}}return this.env.mediaContainer};this.getMediaId=function(){return this.getId()+"_media"};this.getMediaType=function(){try{return this._getTypeFromFileExtension(this.playerModel.getSrc())||"na/na"}catch(e){return"na/na"}};this.getUsesFlash=function(){return(this.playerModel.modelId.indexOf("FLASH")>-1)};this.getModel=function(){try{return this.media[this._currentItem].mediaModel.toUpperCase()}catch(e){return"NA"}};this.getIframeParent=this.getIframeWindow=function(){try{var result=parent.location.host||false;return(result===false)?false:$(parent.window)}catch(e){return false}};this.getIframe=function(){try{var result=window.$(frameElement)||[];return(result.length==0)?false:result}catch(e){return false}};this.getIframeAllowFullscreen=function(){var result=null;try{result=window.frameElement.attributes.allowFullscreen||window.frameElement.attributes.mozallowFullscreen||window.frameElement.attributes.webkitallowFullscreen||null}catch(e){result=true}return(result!=null)?true:false};this.getPlaybackQuality=function(){var result="default";try{result=this.playerModel.getPlaybackQuality()}catch(e){}if(result=="default"){result=this.getConfig("playbackQuality")}if(result=="default"||$.inArray(result,this.getPlaybackQualities())==-1){result=this.getAppropriateQuality()}if($.inArray(result,this.getPlaybackQualities())==-1){result="default"}return result};this.getPlaybackQualities=function(){try{return $.extend(true,[],this.media[this._currentItem].qualities||[])}catch(e){}return[]};this.getIsMobileClient=function(what){var uagent=navigator.userAgent.toLowerCase();var mobileAgents=["android","windows ce","blackberry","palm","mobile"];for(var i=0;i-1){return(what)?(mobileAgents[i].toUpperCase()==what.toUpperCase()):true}}return false};this.getCanPlay=function(type,platform,streamType){return this._canPlay(type,platform,streamType)};this.getCanPlayNatively=function(type){return this._canPlay(type,"native")};this._canPlay=function(tp,platform,streamType){var ref=this,checkIn=[],checkFor=[],st=streamType||"http",pltfrm=(typeof platform=="object")?platform:[platform],type=(tp)?tp.replace(/x-/,""):undefined,tm=ref._testMediaSupport(); $.each(pltfrm,function(nothing,plt){$.each($.extend(tm[st],tm["*"]||[])||[],function(thisPlatform,val){if(plt!=null){if(thisPlatform!=plt){return true}}checkIn=$.merge(checkIn,this);return true})});if(checkIn.length==0){return false}switch(typeof type){case"undefined":return checkIn.length>0;case"string":if(type=="*"){return checkIn}checkFor.push(type);break;case"array":checkFor=type;break}for(var i in checkFor){if(typeof checkFor[i]!=="string"){break}if($.inArray(checkFor[i],checkIn)>-1){return true}}return false};this.getPlatform=function(){return this.media[this._currentItem].platform||"error"};this.getPlatforms=function(){var ref=this,platforms=this._testMediaSupport(true),cfg=this.getConfig("platforms"),tmp=[],result=[];try{for(var i in this.media[this._currentItem].file){if(this.media[this._currentItem].file.hasOwnProperty(i)){for(var j in platforms){if(this._canPlay(this.media[this._currentItem].file[i].type.replace(/x-/,""),platforms[j].toLowerCase(),this.getConfig("streamType"))){if($.inArray(platforms[j].toLowerCase(),result)==-1){result.push(platforms[j].toLowerCase())}}}}}}catch(e){}result.sort(function(a,b){return $.inArray(a,cfg)-$.inArray(b,cfg)});return result};this.getNativeFullscreenSupport=function(){var ref=this,fullScreenApi={supportsFullScreen:"semi",isFullScreen:function(){try{return ref.getDC().hasClass("fullscreen")}catch(e){return false}},requestFullScreen:function(){ref.playerModel.applyCommand("fullscreen",true)},cancelFullScreen:function(){ref.playerModel.applyCommand("fullscreen",false)},prefix:"",ref:this},browserPrefixes="webkit moz o ms khtml".split(" ");if(typeof document.cancelFullScreen!="undefined"){fullScreenApi.supportsFullScreen=true}else{for(var i=0,il=browserPrefixes.length;ihei&&temp.minHeight<=hei){return true}if((temp.minHeight||0)>this.minHeight){return true}if(typeof this.minWidth=="number"){if(this.minWidth===0&&this.minHeight>hei){return true}if(this.minWidth>wid){return true}temp=this}else{if(typeof this.minWidth=="object"){var ref=this;$.each(this.minWidth,function(){if((this.ratio||100)>ratio){return true}if(this.minWidth>wid){return true}temp=ref;return true})}}return true});return temp.key||"default"};this.getFromUrl=function(url,dest,callback,customParser,dataType){var data=null,ref=this,aSync=!this.getIsMobileClient();if(dest==ref&&callback=="_reelUpdate"){this._promote("scheduleLoading",1+this.getItemCount())}if(callback.substr(0,1)!="_"){window[callback]=function(data){try{delete window[callback]}catch(e){}dest[callback](data)}}else{if(dataType.indexOf("jsonp")>-1){this["_jsonp"+callback]=function(data){dest[callback](data)}}}if(dataType){if($.parseJSON==undefined&&dataType.indexOf("json")>-1){this._raiseError("Projekktor requires at least jQuery 1.4.2 in order to handle JSON playlists.");return this}dataType=(dataType.indexOf("/")>-1)?dataType.split("/")[1]:dataType}var ajaxConf={url:url,complete:function(xhr,status){if(dataType==undefined){try{if(xhr.getResponseHeader("Content-Type").indexOf("xml")>-1){dataType="xml"}if(xhr.getResponseHeader("Content-Type").indexOf("json")>-1){dataType="json"}if(xhr.getResponseHeader("Content-Type").indexOf("html")>-1){dataType="html"}}catch(e){}}data=$p.utils.cleanResponse(xhr.responseText,dataType);try{data=customParser(data,xhr.responseText,dest)}catch(e){}if(status!="error"&&dataType!="jsonp"){try{dest[callback](data)}catch(e){}}},error:function(data){if(dest[callback]&&dataType!="jsonp"){dest[callback](false)}},cache:true,async:aSync,dataType:dataType,jsonpCallback:(callback.substr(0,1)!="_")?false:"projekktor('"+this.getId()+"')._jsonp"+callback,jsonp:(callback.substr(0,1)!="_")?false:"callback"};ajaxConf.xhrFields={withCredentials:true};ajaxConf.beforeSend=function(xhr){xhr.withCredentials=true};$.support.cors=true;$.ajax(ajaxConf);return this};this.setActiveItem=function(mixedData){var newItem=0,lastItem=this._currentItem,ref=this,ap=false;if(typeof mixedData=="string"){switch(mixedData){case"same":newItem=this._currentItem;break;case"previous":newItem=this._currentItem-1;break;case"next":newItem=this._currentItem+1;break}}else{if(typeof mixedData=="number"){newItem=parseInt(mixedData)}else{newItem=0}}if(newItem!=this._currentItem){if(this.getConfig("disallowSkip")==true&&(!this.getState("COMPLETED")&&!this.getState("IDLE"))){return this}}this._detachplayerModel();this.env.loading=false;if(newItem===0&&(lastItem==null||lastItem==newItem)&&(this.config._autoplay===true||"DESTROYING|AWAKENING".indexOf(this.getState())>-1)){ap=true}else{if(this.getItemCount()>1&&newItem!=lastItem&&lastItem!=null&&this.config._continuous===true&&newItem=this.getItemCount()||newItem<0){ap=this.config._loop;newItem=0}this._currentItem=newItem;var wasFullscreen=this.getDC().hasClass("fullscreen");this.getDC().attr("class",this.env.className);if(wasFullscreen){this.getDC().addClass("fullscreen")}var newModel=this.media[this._currentItem].mediaModel.toUpperCase();if(!$p.models[newModel]){newModel="NA";this.media[this._currentItem].mediaModel=newModel;this.media[this._currentItem].errorCode=8}else{if(this.getConfig("className",null)!=null){this.getDC().addClass(this.getNS()+this.getConfig("className"))}this.getDC().addClass(this.getNS()+(this.getConfig("streamType")||"http"));if(!$p.utils.cssTransitions()){this.getDC().addClass("notransitions")}if(this.getIsMobileClient()){this.getDC().addClass("mobile")}}this.playerModel=new playerModel();$.extend(this.playerModel,$p.models[newModel].prototype);this._promote("syncing","display");this._enqueue(function(){try{ref._applyCuePoints()}catch(e){}});this.playerModel._init({media:$.extend(true,{},this.media[this._currentItem]),model:newModel,pp:this,environment:$.extend(true,{},this.env),autoplay:ap,quality:this.getPlaybackQuality(),fullscreen:this.getInFullscreen()});return this};this.setPlay=function(){var ref=this;if(this.getConfig("thereCanBeOnlyOne")){projekktor("*").each(function(){if(this.getId()!==ref.getId()){this.setStop()}})}this._enqueue("play",false);return this};this.setPause=function(){this._enqueue("pause",false);return this};this.setStop=function(toZero){var ref=this;if(this.getState("IDLE")){return this}if(toZero){this._enqueue(function(){ref._currentItem=0;ref.setActiveItem(0)})}else{this._enqueue("stop",false)}return this};this.setPlayPause=function(){if(!this.getState("PLAYING")){this.setPlay()}else{this.setPause()}return this};this.setVolume=function(vol,fadeDelay){var initalVolume=this.getVolume(); if(this.getConfig("fixedVolume")==true){return this}switch(typeof vol){case"string":var dir=vol.substr(0,1);vol=parseFloat(vol.substr(1));switch(dir){case"+":vol=this.getVolume()+vol;break;case"-":vol=this.getVolume()-vol;break;default:vol=this.getVolume()}case"number":vol=parseFloat(vol);vol=(vol>1)?1:vol;vol=(vol<0)?0:vol;break;default:return this}if(vol>initalVolume&&fadeDelay){if(vol-initalVolume>0.03){for(var i=initalVolume;i<=vol;i=i+0.03){this._enqueue("volume",i,fadeDelay)}this._enqueue("volume",vol,fadeDelay);return this}}else{if(vol0.03){for(var i=initalVolume;i>=vol;i=i-0.03){this._enqueue("volume",i,fadeDelay)}this._enqueue("volume",vol,fadeDelay);return this}}}this._enqueue("volume",vol);return this};this.setPlayhead=this.setSeek=function(position){if(this.getConfig("disallowSkip")==true){return this}if(typeof position=="string"){var dir=position.substr(0,1);position=parseFloat(position.substr(1));if(dir=="+"){position=this.getPosition()+position}else{if(dir=="-"){position=this.getPosition()-position}else{position=this.getPosition()}}}if(typeof position=="number"){this._enqueue("seek",Math.round(position*100)/100)}return this};this.setFrame=function(frame){if(this.getConfig("fps")==null){return this}if(this.getConfig("disallowSkip")==true){return this}if(typeof frame=="string"){var dir=frame.substr(0,1);frame=parseFloat(frame.substr(1));if(dir=="+"){frame=this.getFrame()+frame}else{if(dir=="-"){frame=this.getFrame()-frame}else{frame=this.getFrame()}}}if(typeof frame=="number"){this._enqueue("frame",frame)}return this};this.setPlayerPoster=function(url){var ref=this;this._enqueue(function(){ref.setConfig({poster:url},0)});this._enqueue(function(){ref.playerModel.setPosterLive()});return this};this.setConfig=function(){var ref=this,args=arguments;this._enqueue(function(){ref._setConfig(args[0]||null,args[1]||null)});return this};this._setConfig=function(){if(!arguments.length){return result}var confObj=arguments[0],dest="*",value=false;if(typeof confObj!="object"){return this}if(arguments[1]=="string"||arguments[1]=="number"){dest=arguments[1]}else{dest=this._currentItem}for(var i in confObj){if(this.config["_"+i]!=null){continue}try{value=eval(confObj[i])}catch(e){value=confObj[i]}if(dest=="*"){$.each(this.media,function(){if(this.config==null){this.config={}}this.config[i]=value});continue}if(this.media[dest]==undefined){return this}if(this.media[dest]["config"]==null){this.media[dest]["config"]={}}this.media[dest]["config"][i]=value}return this};this.setFullscreen=function(goFull){var nativeFullscreen=this.getNativeFullscreenSupport(),ref=this;goFull=(goFull==null)?!nativeFullscreen.isFullScreen():goFull;if(goFull===true){nativeFullscreen.requestFullScreen()}else{nativeFullscreen.cancelFullScreen()}return this};this.setSize=function(data){var target=this.getIframe()||this.getDC(),fsdata=target.data("fsdata")||null,w=(data&&data.width!=null)?data.width:(this.getConfig("width")!=null)?this.getConfig("width"):false,h=(data&&data.height!=null)?data.height:(this.getConfig("height")==null&&this.getConfig("ratio"))?Math.round((w||this.getDC().width())/this.getConfig("ratio")):(this.getConfig("height")!=null)?this.getConfig("height"):false;if(this.getInFullscreen()&&fsdata!=null){fsdata.targetWidth=w;fsdata.targetHeight=h;target.data("fsdata",fsdata)}else{if(w){target.css({width:w+"px"})}if(h){target.css({height:h+"px"})}}try{this.playerModel.applyCommand("resize")}catch(e){}};this.setLoop=function(value){this.config._loop=value||!this.config._loop};this.setDebug=function(value){$p.utils.logging=value||!$p.utils.logging;if($p.utils.logging){$p.utils.log("DEBUG MODE for player #"+this.getId())}};this.addListener=function(evt,callback){var ref=this;this._enqueue(function(){ref._addListener(evt,callback)});return this};this._addListener=function(event,callback){var evt=(event.indexOf(".")>-1)?event.split("."):[event,"default"];this.listeners.push({event:evt[0],ns:evt[1],callback:callback});return this};this.removeListener=function(event,callback){var len=this.listeners.length,evt=(event.indexOf(".")>-1)?event.split("."):[event,"*"];for(var i=0;i-1||result[0].file.type.indexOf("/json")>-1){$p.utils.log("Loading external data from "+result[0].file.src+" supposed to be "+result[0].file.type);this._playlistServer=result[0].file.src;this.getFromUrl(result[0].file.src,this,"_reelUpdate",this.getConfig("reelParser"),result[0].file.type);return this}$p.utils.log("Applying incoming single file:"+result[0].file.src,result);this._reelUpdate(result);return this};this.setPlaybackQuality=function(quality){var qual=quality||this.getAppropriateQuality();if($.inArray(qual,this.media[this._currentItem].qualities||[])>-1){this.playerModel.applyCommand("quality",qual);this.setConfig({playbackQuality:qual})}return this};this.openUrl=function(cfg){cfg=cfg||{url:"",target:"",pause:false};if(cfg.url==""){return this}if(cfg.pause===true){this.setPause()}window.open(cfg.url,cfg.target).focus();return this};this.selfDestruct=this.destroy=function(){var ref=this;this._enqueue(function(){ref._destroy()});return this},this._destroy=function(){var ref=this;$(this).unbind();this.removePlugins();this.playerModel.destroy();this._removeGUIListeners();$.each(projekktors,function(idx){try{if(this.getId()==ref.getId()||this.getId()==ref.getId()||this.getParent()==ref.getId()){projekktors.splice(idx,1);return}}catch(e){}});this.env.playerDom.replaceWith(this.env.srcNode);this._promote("destroyed");this.removeListener("*");return this};this.reset=function(){var ref=this;this.setFullscreen(false);this._clearqueue();this._enqueue(function(){ref._reset()});return this},this._reset=function(){var cleanConfig={},ref=this;this.setFullscreen(false);$(this).unbind();$((this.getIframe())?parent.window.document:document).unbind(".projekktor");$(window).unbind(".projekktor"+this.getId());this.playerModel.destroy();this.playerModel={};this.removePlugins();this._removeGUIListeners();this.env.mediaContainer=null;this._currentItem=null;for(var i in this.config){cleanConfig[(i.substr(0,1)=="_")?i.substr(1):i]=this.config[i]}if(typeof this.env.onReady==="function"){this._enqueue(ref.env.onReady(ref))}this._init(this.env.playerDom,cleanConfig);return this},this.setCuePoint=function(obj,opt){var item=(obj.item!==undefined)?obj.item:this.getItemIdx(),options=$.extend(true,{offset:0},opt),ref=this,cuePoint={id:obj.id||$p.utils.randomId(8),group:obj.group||$p.utils.randomId(8),item:item,on:($p.utils.toSeconds(obj.on)||0)+options.offset,off:($p.utils.toSeconds(obj.off)||$p.utils.toSeconds(obj.on)||0)+options.offset,value:obj.value||null,callback:obj.callback||function(){},precision:(obj.precision==null)?1:obj.precision,title:(obj.title==null)?"":obj.title,_listeners:[],_unlocked:false,_active:false,_lastTime:0,isAvailable:function(){return this._unlocked},_stateListener:function(state,player){if("STOPPED|COMPLETED|DESTROYING".indexOf(state)>-1){if(this._active){try{this.callback(false,this,player)}catch(e){}}this._active=false;this._lastTime=-1}},_timeListener:function(time,player){if(player.getItemIdx()!==this.item&&this.item!="*"){return}var timeIdx=(this.precision==0)?Math.round(time):$p.utils.roundNumber(time,this.precision),ref=this;if(this._unlocked===false){var approxMaxTimeLoaded=player.getDuration()*player.getLoadProgress()/100;if(this.on<=approxMaxTimeLoaded||this.on<=timeIdx){$.each(this._listeners.unlock||[],function(){this(ref,player)});this._unlocked=true}else{return}}if(this._lastTime==timeIdx){return}var nat=(timeIdx-this._lastTime<=1&&timeIdx-this._lastTime>0);if(((timeIdx>=this.on&&timeIdx<=this.off)||(timeIdx>=this.on&&this.on==this.off&&timeIdx<=this.on+1))&&this._active!==true){this._active=true;$p.utils.log("Cue Point: [ON "+this.on+"] at "+timeIdx,this);try{this.callback({id:this.id,enabled:true,value:this.value,seeked:!nat,player:player})}catch(e){}}else{if((timeIdxthis.off)&&this.off!=this.on&&this._active==true){this._active=false;$p.utils.log("Cue Point: [OFF] at "+this.off,this);try{this.callback({id:this.id,enabled:false,value:this.value,seeked:!nat,player:player})}catch(e){}}}if(this.off==this.on&&this._active&&new Number(timeIdx-this.on).toPrecision(this.precision)>=1){this._active=false}this._lastTime=timeIdx},addListener:function(event,func){if(this._listeners[event]==null){this._listeners[event]=[]}this._listeners[event].push(func||function(){})}};if(obj.unlockCallback!=null){cuePoint.addListener("unlock",obj.unlockCallback)}if(this._cuePoints[item]==null){this._cuePoints[item]=[]}this._cuePoints[item].push(cuePoint);if(!this.getState("IDLE")){this._promote("cuepointAdded")}return this},this.setGotoCuePoint=function(idx,itemIdx){var cuePoints=this.getCuePoints(itemIdx); this.setPlayhead(cuePoints[idx].on);return this},this.getCuePoints=function(idx){return this._cuePoints[idx||this.getItemIdx()]||this._cuePoints||{}},this.getCuePointById=function(id,idx){var result=false,cuePoints=this.getCuePoints(idx);for(var j=0;j0){setTimeout(function(){ref.playerModel.applyCommand(msg.command,msg.params)},msg.delay)}else{ref.playerModel.applyCommand(msg.command,msg.params)}}else{msg.command(ref)}}}catch(e){$p.utils.log("ERROR:",e)}if(ref._queue.length==0){if(ref._isReady===false){ref._isReady=true}ref._processing=false;return}arguments.callee();return}setTimeout(arguments.callee,100)})()};this._getTypeFromFileExtension=function(url){var fileExt="",extRegEx=[],extTypes={},extRegEx=[],plt=null,on=true;for(var i in $p.mmap){if($p.mmap.hasOwnProperty(i)){plt=$p.mmap[i].platform;if(typeof plt!="object"){plt=[plt]}on=true;for(var j=0;j-1){return true}var reqPlatformVersion=($p.models[$p.mmap[i]["model"].toUpperCase()].prototype[(platform.toLowerCase())+"Version"]||"1").toString();try{if($p.utils.versionCompare($p.platforms[platform.toUpperCase()]($p.mmap[i]["type"]),reqPlatformVersion)){if(ref.getConfig("enable"+platform.toUpperCase()+"Platform")!=false&&$.inArray(platform.toLowerCase(),ref.getConfig("platforms"))>-1){result[st][platform].push($p.mmap[i]["type"]);if($.inArray(platform.toUpperCase(),resultPlatforms)==-1){resultPlatforms.push(platform.toUpperCase())}}return true}}catch(e){$p.utils.log("ERROR","platform "+platform+" not defined")}return true});return true})}}$p._compTableCache=result;$p._platformTableCache=resultPlatforms;return(getPlatforms)?$p._platformTableCache:$p._compTableCache};this._readMediaTag=function(domNode){var result={},htmlTag="",attr=[],ref=this;if("VIDEOAUDIO".indexOf(domNode[0].tagName.toUpperCase())==-1){return false}if(!this.getConfig("ignoreAttributes")){result={autoplay:((domNode.attr("autoplay")!==undefined||domNode.prop("autoplay")!==undefined)&&domNode.prop("autoplay")!==false)?true:false,controls:((domNode.attr("controls")!==undefined||domNode.prop("controls")!==undefined)&&domNode.prop("controls")!==false)?true:false,loop:((domNode.attr("autoplay")!==undefined||domNode.prop("loop")!==undefined)&&domNode.prop("loop")!==false)?true:false,title:(domNode.attr("title")!==undefined&&domNode.attr("title")!==false)?domNode.attr("title"):"",poster:(domNode.attr("poster")!==undefined&&domNode.attr("poster")!==false)?domNode.attr("poster"):"",width:(domNode.attr("width")!==undefined&&domNode.attr("width")!==false)?domNode.attr("width"):null,height:(domNode.attr("height")!==undefined&&domNode.attr("height")!==false)?domNode.attr("height"):null} }htmlTag=$($("
").html($(domNode).clone())).html();attr=["autoplay","controls","loop"];for(var i=0;i").get(0).canPlayType){var childNode=domNode;do{childNode=childNode.next("source,track");if(childNode.attr("src")){switch(childNode.get(0).tagName.toUpperCase()){case"SOURCE":result.playlist[0].push({src:childNode.attr("src"),type:childNode.attr("type")||this._getTypeFromFileExtension(childNode.attr("src")),quality:childNode.attr("data-quality")||""});break;case"TRACK":if($(this).attr("src")){result.playlist[0]["config"]["tracks"].push({src:childNode.attr("src"),kind:childNode.attr("kind")||"subtitle",lang:childNode.attr("srclang")||null,label:childNode.attr("label")||null})}break}}}while(childNode.attr("src"))}if(result.playlist[0].length==0){domNode.children("source,track").each(function(){if($(this).attr("src")){switch($(this).get(0).tagName.toUpperCase()){case"SOURCE":result.playlist[0].push({src:$(this).attr("src"),type:$(this).attr("type")||ref._getTypeFromFileExtension($(this).attr("src")),quality:$(this).attr("data-quality")||""});break;case"TRACK":result.playlist[0]["config"]["tracks"].push({src:$(this).attr("src"),kind:$(this).attr("kind")||"subtitle",lang:$(this).attr("srclang")||null,label:$(this).attr("label")||null});break}}})}return result};this._raiseError=function(txt){this.env.playerDom.html(txt).css({color:"#fdfdfd",backgroundColor:"#333",lineHeight:this.config.height+"px",textAlign:"center",display:"block"});this._promote("error")};this._init=function(customNode,customCfg){var theNode=customNode||srcNode,theCfg=customCfg||cfg,cfgByTag=this._readMediaTag(theNode);this.env.srcNode=theNode.wrap("
").parent().html();theNode.unwrap();this.env.className=theNode.attr("class")||"";this._id=theNode[0].id||$p.utils.randomId(8);if(cfgByTag!==false){this.env.playerDom=$("
").attr({"class":theNode[0].className,style:theNode.attr("style")});theNode.replaceWith(this.env.playerDom);theNode.empty().removeAttr("type").removeAttr("src");try{theNode.get(0).pause();theNode.get(0).load()}catch(e){}$("
").append(theNode).get(0).innerHTML="";theNode=null}else{this.env.playerDom=theNode}theCfg=$.extend(true,{},cfgByTag,theCfg);for(var i in theCfg){if(this.config["_"+i]!=null){this.config["_"+i]=theCfg[i]}else{if(i.indexOf("plugin_")>-1){this.config[i]=$.extend(this.config[i],theCfg[i])}else{this.config[i]=theCfg[i]}}}$p.utils.logging=this.config._debug;this.setSize();if(this.getIsMobileClient()){this.config._autoplay=false;this.config.fixedVolume=true}this.env.playerDom.attr("id",this._id);if(this.config._theme){switch(typeof this.config._theme){case"string":break;case"object":this._applyTheme(this.config._theme)}}else{this._start(false)}return this};this._start=function(data){var ref=this,files=[];this._registerPlugins();if(this.config._iframe===true){if(this.getIframeParent()){this.getIframeParent().ready(function(){ref._enterFullViewport(true)})}else{ref._enterFullViewport(true)}}if(this.getIframeParent()===false){this.config._isCrossDomain=true}if(!this.getIframeAllowFullscreen()){this.config.enableFullscreen=false}if(typeof onReady==="function"){this._enqueue(function(){onReady(ref)})}for(var i in this.config._playlist[0]){if(this.config._playlist[0][i].type){if(this.config._playlist[0][i].type.indexOf("/json")>-1||this.config._playlist[0][i].type.indexOf("/xml")>-1){this.setFile(this.config._playlist[0][i].src,this.config._playlist[0][i].type);return this}}}this.setFile(this.config._playlist);return this};this._applyTheme=function(data){var ref=this;if(data===false){this._raiseError("The Projekktor theme-set specified could not be loaded.");return false}if(typeof data.css=="string"){$("head").append('")}if(typeof data.html=="string"){this.env.playerDom.html($p.utils.parseTemplate(data.html,{p:this.getNS()}))}this.env.playerDom.addClass(data.id).addClass(data.variation);this.env.className=this.env.className&&this.env.className.length!==0?this.env.className+" "+data.id:data.id;if(data.variation&&data.variation.length!==0){this.env.className+=" "+data.variation}if(typeof data.config=="object"){for(var i in data.config){if(this.config["_"+i]!=null){this.config["_"+i]=data.config[i]}else{if(i.indexOf("plugin_")>-1){this.config[i]=$.extend(true,{},this.config[i],data.config[i])}else{this.config[i]=data.config[i]}}}if(typeof data.config.plugins=="object"){for(var i=0;i"+data.config.plugins.join(", ")+""); return false}}}}if(data.onReady){this._enqueue(function(player){eval(data.onReady)})}return this._start()};return this._init()}};$p.mmap=[];$p.models={};$p.newModel=function(obj,ext){if(typeof obj!="object"){return result}if(!obj.modelId){return result}var result=false,extend=($p.models[ext]&&ext!=undefined)?$p.models[ext].prototype:{};if($p.models[obj.modelId]){return result}$p.models[obj.modelId]=function(){};$p.models[obj.modelId].prototype=$.extend({},extend,obj);if(obj.setiLove){obj.setiLove()}$p.mmap=$.grep($p.mmap,function(iLove){var doesNotExist=iLove.model!=((obj.replace)?obj.replace.toLowerCase():""),isNotOverwritten=iLove.replaces!=obj.modelId;return doesNotExist&&isNotOverwritten});for(var i=0;i-1){b.push(d[f])}}catch(g){}try{if(a.inArray(d[f],c)>-1){b.push(d[f])}}catch(g){}});return b},roundNumber:function(b,c){if(b<=0||isNaN(b)){return 0}return Math.round(b*Math.pow(10,c))/Math.pow(10,c)},randomId:function(f){var e="abcdefghiklmnopqrstuvwxyz",b="";for(var d=0;d3){d=d.slice(0,3)}for(i=0;i';m="";if(!document.all||window.opera){n=m}if(j===null){return n}j.get(0).innerHTML=n;if(l!==false){j.append(a("
").attr("id",d.id+"_cc").css({width:(c)?"1px":"100%",height:(c)?"1px":"100%",backgroundColor:($p.utils.ieVersion()<9)?"#000":"transparent",filter:"alpha(opacity = 0.1)",position:"absolute",top:0,left:0}))}return a("#"+d.id)},ieVersion:function(){var b=3,d=document.createElement("div"),c=d.getElementsByTagName("i");while(d.innerHTML="",c[0]){}return b>4?b:undefined},parseTemplate:function(c,e,d){if(e===undefined||e.length==0||typeof e!="object"){return c}for(var b in e){c=c.replace(new RegExp("%{"+b+"}","gi"),((d===true)?window.encodeURIComponent(e[b]):e[b]))}c=c.replace(/%{(.*?)}/gi,"");return c},stretch:function(f,g,n,l,d,h){if(g==null){return false}if((g instanceof a)==false){g=a(g)}if(!g.data("od")){g.data("od",{width:g.width(),height:g.height()})}var e=(d!==undefined)?d:g.data("od").width,b=(h!==undefined)?h:g.data("od").height,j=(n/e),m=(l/b),c=n,k=l;switch(f){case"none":c=e;k=b;break;case"fill":if(j>m){c=e*j;k=b*j}else{if(jm){c=e*m;k=b*m}else{if(jc[0]){return true}if(d[0]c[1]){return true}if(d[1]c[2]){return true}if(d[2]0)){for(var b=0;b-1||b.indexOf("ipad")>-1)&&d>-1){return(b.substr(d+3,3).replace("_",".")).toString()}return"0"},NATIVE:function(c){try{var b=a((c.indexOf("video")>-1)?"