des centaines d'astuces pour vous faciliter le quotidien


video

20/02/2013 10:57

/*! * Projekktor II - HTML5 Media Player, Projekktor Core Version: V1.2.17 r181 * https://www.projekktor.com * Copyright 2010, 2011, Sascha Kluger, Spinning Airwhale Media, https://www.spinningairwhale.com * GNU General Public License * https://www.projekktor.com/license/ */ jQuery(function($){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]||{};var callback=arguments[2]||{};if(typeof arg=="string"){var count=0,playerA;$.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.17");this.env={muted:false,inFullscreen:false,playerDom:null,mediaContainer:null,agent:"standard",mouseIsOver:false,loading:false,autoSize:false,className:"",onReady:onReady};this.media=[];this._plugins=[];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){this.env.loading=true;var ref=this,data=obj||[{}];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){}var files=data.playlist||data;for(var item in files){if(typeof files[item]=="function"||typeof files[item]==null){continue}if(files[item]){var itemIdx=this._addItem(this._prepareMedia({file:files[item],config:files[item].config||{},errorCode:files[item].errorCode}))}$.each(files[item].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={},priority=[],modelSets=[],result={},extRegEx=[];for(var i in $p.mmap){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]=new Array()}extTypes[$p.mmap[i].ext].push($p.mmap[i]);if(!typesModels[$p.mmap[i].type]){typesModels[$p.mmap[i].type]=new Array()}typesModels[$p.mmap[i].type].push($p.mmap[i])})}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(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]!==undefined){data.file[index].codec=codecMatch[1];data.file[index].type=codecMatch[0].replace(/x-/,"")}}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])}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,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);switch(value){case"IDLE":break;case"AWAKENING":var modelRef=this.playerModel;this._syncPlugins(function(){if(modelRef.getState("AWAKENING")){modelRef.displayItem(true)}});break;case"BUFFERING":case"PLAYING":break;case"ERROR":this._addGUIListeners();this._promote("error",{});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")){this.setFullscreen(false);this._promote("done",{})}this.setActiveItem("next");break}break;case"buffer":this._promote("buffer",value);break;case"modelReady":this._maxElapsed=0;this._promote("item",ref._currentItem);break;case"displayReady":this._promote("displayReady",true);var 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"FFreinit":break;case"seek":this._promote("seek",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"scaled":if(this.env.autoSize===true){this.env.playerDom.css({height:value.realHeight+"px",width:value.realWidth+"px"});this._promote("resize",value);this.env.autoSize=false;break}this._promote("scaled",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)}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){return}if(plugins.length==0){return}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}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.removePlugin();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.removePlugin();this._removeGUIListeners();this.env.mediaContainer=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)?0: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){}}else{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.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){}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=[];for(var i in $p.mmap){extRegEx.push("\\."+$p.mmap[i].ext);extTypes[$p.mmap[i].ext]=$p.mmap[i]}extRegEx="^.*.("+extRegEx.join("|")+")";try{fileExt=url.match(new RegExp(extRegEx))[1];fileExt=(!fileExt)?"NaN":fileExt.replace(".","")}catch(e){fileExt="NaN"}return extTypes[fileExt].type};this._testMediaSupport=function(){var result={},streamType="",ref=this;for(var i=0;i<$p.mmap.length;i++){platforms=(typeof $p.mmap[i]["platform"]=="object")?$p.mmap[i]["platform"]:[$p.mmap[i]["platform"]];$.each(platforms,function(_na,platform){if(platform==null){return true}var platform=platform.toUpperCase();streamType=$p.mmap[i]["streamType"]||["http"];$.each(streamType,function(key,st){if(result[st]==null){result[st]={}}if(result[st][platform]==null){result[st][platform]=[]}if($.inArray($p.mmap[i]["type"],result[st][platform])>-1){return true}var version=$p.models[$p.mmap[i]["model"].toUpperCase()].prototype[(platform.toLowerCase())+"Version"]||1;try{if($p.platforms[platform.toUpperCase()]($p.mmap[i]["type"])>=version){if(ref.getConfig("enable"+platform.toUpperCase()+"Platform")!=false){result[st][platform].push($p.mmap[i]["type"])}return true}}catch(e){$p.utils.log("ERROR","platform "+platform+" not defined")}})})}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._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"):false,height:(domNode.attr("height")!==undefined&&domNode.attr("height")!==false)?domNode.attr("height"):false}}htmlTag=$($("

 

").html($(domNode).clone())).html();attr=["autoplay","controls","loop"];for(var i=0;i

 
").parent().html();theNode.unwrap();this.env.className=theNode.attr("class")||"";this._currentItem=null;this._id=theNode[0].id||$p.utils.randomId(8);if(cfgBySource!==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="";delete (theNode);theNode=null}else{cfgBySource={width:theNode.attr("width")||theNode.css("width")||theNode.width(),height:theNode.attr("height")||theNode.css("height")||theNode.height()};this.env.playerDom=theNode}theCfg=$.extend(true,{},cfgBySource,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;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._applyDimensions();this._registerPlugins();if(this.config._iframe===true){if(this.getIframeWindow()){this.getIframeWindow().ready(function(){ref._enterFullViewport(true,false)})}else{ref._enterFullViewport(true,false)}}if(this.getIframeWindow()===false){this.config._isCrossDomain=true}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-1){b.push(f[g])}}catch(h){}try{if(a.inArray(f[g],c)>-1){b.push(f[g])}}catch(h){}});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(h){var g="abcdefghiklmnopqrstuvwxyz",b="";for(var f=0;f").attr({id:this.pp.getMediaId()+"_html",poster:(this.pp.getIsMobileClient("ANDROID"))?this.getPoster():$p.utils.imageDummy(),loop:false,autoplay:false,"x-webkit-airplay":"allow"}).prop({controls:false,volume:this.getVolume()}).css({width:"100%",height:"100%",position:"absolute",top:0,left:0}))}this.mediaElement=a("#"+this.pp.getMediaId()+"_html");this.applySrc()},applySrc:function(){var f=this,c=f.getState("PLAYING"),b=f.getState("AWAKENING");this.removeListener("error");this.removeListener("play");this.removeListener("loadstart");this.removeListener("canplay");this.mediaElement.find("source").remove();a.each(this.getSource(),function(){a("").appendTo(f.mediaElement).attr({src:this.src,type:this.type})});var e=function(){f.mediaElement.unbind("loadstart.projekktorqs"+f.pp.getId());f.mediaElement.unbind("loadeddata.projekktorqs"+f.pp.getId());f.mediaElement.unbind("canplay.projekktorqs"+f.pp.getId());f.addListeners("error");f.addListeners("play");f.addListeners("loadstart");f.addListeners("canplay");f.mediaElement=a("#"+f.pp.getMediaId()+"_html");if(b){f.displayReady();return}if(f.getState("SEEKING")){if(f._isPlaying){f.setPlay()}f.seekedListener();return}if(!f.isPseudoStream){f.setSeek(f.media.position||0)}if(f._isPlaying){f.setPlay()}};this.mediaElement.bind("loadstart.projekktorqs"+this.pp.getId(),e);this.mediaElement.bind("loadeddata.projekktorqs"+this.pp.getId(),e);this.mediaElement.bind("canplay.projekktorqs"+this.pp.getId(),e);this.mediaElement.get(0).load();e();var d=navigator.userAgent;if(d.indexOf("Android")>=0){if(parseFloat(d.slice(d.indexOf("Android")+8))<3){e()}}},detachMedia:function(){try{this.mediaElement[0].pause();this.mediaElement.find("source").remove();this.mediaElement.load()}catch(b){}},addListeners:function(e,c){if(this.mediaElement==null){return}var f=(c!=null)?".projekktor"+c+this.pp.getId():".projekktor"+this.pp.getId(),d=this,b=(e==null)?"*":e;a.each(this._eventMap,function(g,h){if((g==b||b=="*")&&h!=null){d.mediaElement.bind(g+f,function(i){d[h](this,i)})}})},removeListener:function(b,c){if(this.mediaElement==null){return}var e=(c!=null)?".projekktor"+c+this.pp.getId():".projekktor"+this.pp.getId(),d=this;a.each(this._eventMap,function(f,g){if(f==b){d.mediaElement.unbind(f+e)}})},_ended:function(){var d=this.mediaElement[0].duration,b=(Math.round(this.media.position)===Math.round(d)),c=((d-this.media.maxpos)<2)&&(this.media.position===0)||false;if(b||c||this.isPseudoStream){this.endedListener(this)}else{this.pauseListener(this)}},playingListener:function(c){var b=this;(function(){try{if(b.mediaElement[0].currentSrc!=""&&b.mediaElement[0].networkState==b.mediaElement[0].NETWORK_NO_SOURCE&&b.getDuration()==0){b.setTestcard(80);return}if(b.getDuration()==0){setTimeout(arguments.callee,500);return}if(b.mediaElement[0].seekable&&b.mediaElement[0].seekable.length>0){b.allowRandomSeek=true}}catch(d){}})();this._setState("playing")},errorListener:function(d,b){try{switch(event.target.error.code){case event.target.error.MEDIA_ERR_ABORTED:this.setTestcard(1);break;case event.target.error.MEDIA_ERR_NETWORK:this.setTestcard(2);break;case event.target.error.MEDIA_ERR_DECODE:this.setTestcard(3);break;case event.target.error.MEDIA_ERR_SRC_NOT_SUPPORTED:this.setTestcard(4);break;default:this.setTestcard(5);break}}catch(c){}},canplayListener:function(c){var b=this;if(this.pp.getConfig("streamType")=="pseudo"){a.each(this.media.file,function(){if(this.src.indexOf(b.mediaElement[0].currentSrc)>-1){if(this.type=="video/mp4"){b.isPseudoStream=true;b.allowRandomSeek=true;b.media.loadProgress=100;return false}}})}this._setBufferState("full")},setPlay:function(){try{this.mediaElement[0].play()}catch(b){}},setPause:function(){try{this.mediaElement[0].pause()}catch(b){}},setVolume:function(b){this._volume=b;try{this.mediaElement.prop("volume",b)}catch(c){return false}return b},setSeek:function(c){if(this.isPseudoStream){this.media.position=0; this.media.offset=c;this.timeListener();this.applySrc();return}var b=this;(function(){try{b.mediaElement[0].currentTime=c;b.timeListener({position:c})}catch(d){if(b.mediaElement!=null){setTimeout(arguments.callee,100)}}})()},setFullscreen:function(b){if(this.element=="audio"){return}this._scaleVideo()},setResize:function(){if(this.element=="audio"){return}this._scaleVideo(false)}});$p.newModel({modelId:"AUDIO",iLove:[{ext:"ogg",type:"audio/ogg",platform:"native",streamType:["http"]},{ext:"oga",type:"audio/ogg",platform:"native",streamType:["http"]},{ext:"mp3",type:"audio/mp3",platform:["ios","android","native"],streamType:["http"]},{ext:"mp3",type:"audio/mpeg",platform:["ios","android","native"],streamType:["http"]}],imageElement:{},applyMedia:function(c){var b=this;$p.utils.blockSelection(c);this.imageElement=this.applyImage(this.pp.getConfig("cover")||this.pp.getConfig("poster"),c);this.imageElement.css({border:"0px"});var d=a("#"+this.pp.getMediaId()+"_audio_container");if(d.length==0){d=a("
").css({width:"1px",height:"1px",marginBottom:"-1px"}).attr("id",this.pp.getMediaId()+"_audio_container").prependTo(this.pp.getDC())}d.html("").append(a("

 

—————

Précédent