7
0
mirror of https://github.com/marado/RNID.git synced 2024-12-23 12:25:58 +00:00
rnid/scripts/01/embedplayer.min.js

1 line
5.5 KiB
JavaScript
Raw Normal View History

function playerReady(a){$(document).trigger("ON_PLAYER_READY",[{detail:a}])}"function"!=typeof Object.create&&(Object.create=function(a){function b(){}return b.prototype=a,new b}),function(a,b,c,d){var e={get_playerembedID:function(a){var b=a.attr("id");return b===d&&(b=a.attr("class")),"plembed"+b},getDOMObjectPosition:function(a){var b={left:0,top:0,width:a.width?a.width:a.offsetWidth,height:a.height?a.height:a.offsetHeight};return b},endsWith:function(a,b){return-1!==a.indexOf(b,a.length-b.length)},get_flashvars:function(a,b){var c={swf_src:"http://canal.parlamento.pt/embed/arplayer.swf",user_id:"-1"};return a.hasOwnProperty("user_id")&&(c.user_id=a.user_id),"APPLE"===b||"ANDROID"===b?(a.hasOwnProperty("ipad_url")&&(c.ipad_url=a.ipad_url),a.hasOwnProperty("thumb")&&(c.poster=a.thumb),c):(a.hasOwnProperty("rtserver")?c.rtserver=a.rtserver:(a.hasOwnProperty("streamer")&&(c.streamer=a.streamer),a.hasOwnProperty("server_url")&&(c.streamer=a.server_url),a.hasOwnProperty("path")&&(c.file=a.path),a.hasOwnProperty("file")&&(c.file=a.file)),a.hasOwnProperty("livechannel")&&(c.livechannel=a.livechannel),a.hasOwnProperty("swf_src")&&(c.swf_src=a.swf_src),a.hasOwnProperty("autostart")?c.autostart=a.autostart:c.autostart="true",a.hasOwnProperty("sep")&&(c.sep_file=a.sep),a.hasOwnProperty("vo_streamer")&&(c.voice_over_streamer=a.vo_streamer),a.hasOwnProperty("vo_file")&&(c.voice_over_file=a.vo_file),a.hasOwnProperty("bufferlength")&&(c.bufferlength=a.bufferlength),a.hasOwnProperty("poster_frame")&&(c.image=a.poster_frame),a.hasOwnProperty("inpoint")&&(c.inpoint=a.inpoint),a.hasOwnProperty("outpoint")&&(c.outpoint=a.outpoint),c)}},f={load:function(c){if(c===d)return a.error("[load] Invalid parameters... check if the input info is valid"),this;var g=this;g.$elem=a(g);var h=a(b).data("playerType"),i=e.get_flashvars(c,h),j=f.player_id.call(g),k=g.$elem.find("#"+j);if(k&&k.remove(),"APPLE"===h)g.$elem.append('<video id="'+j+'" width="100%" height="100%" controls="true" autobuffer="true" src="'+i.ipad_url+'" poster="'+i.poster+'" type="video/mp4"><p>O seu browser n\xe3o suporta &lt;v\xeddeo&gt;. Por favor actualize-o</p></video>');else if("ANDROID"===h)g.$elem.append('<video x-webkit-airplay="allow" id="'+j+'" alt="Canal central" width="100%" height="100%" src="'+i.ipad_url+'" autoplay controls poster="'+i.poster+'"></video>');else{g.$elem.append('<div id="'+j+'"><a href="https://get.adobe.com/flashplayer" style="color:white;margin-top:30px;text-align:center;display: block;">Flash Plugin is missing</a></div>');var l={allowFullScreen:"true",allowScriptAccess:"always",wmode:"transparent",allownetworking:"all"},m={id:j,name:j,visibility:"visible"};swfobject.embedSWF(i.swf_src,j,"100%","100%","10","expressinstall.swf",i,l,m)}},onPlayerReady:function(b,d,e){try{b==e&&c.getElementById(b).sendEvent("UPDATE_SRC_JSON",JSON.stringify(d))}catch(f){a.error("[update_src] Something went wrong, when we try to update the source. MoreInfo:\n"+f)}},update_src:function(g){if(g===d)return a.error("[update_src] Invalid parameters... check if the input info is valid"),this;var h=this,i=f.player_id.call(h);if(!a("#"+i).length){var j={allowFullScreen:"true",allowScriptAccess:"always",wmode:"transparent",allownetworking:"all"},k=a(b).data("playerType"),l=e.get_flashvars(g,k),m={id:i,name:i,visibility:"visible"};return a(c).on("ON_PLAYER_READY",function(a,b){f.onPlayerReady.call(h,i,l,b.detail.id)}),h.$elem=a(h),"APPLE"===k?h.$elem.append('<video id="'+i+'" width="100%" height="100%" controls="true" autobuffer="true" src="'+l.ipad_url+'" poster="'+l.poster+'" type="video/mp4"><p>O seu browser n\xe3o suporta &lt;v\xeddeo&gt;. Por favor actualize-o</p></video>'):"ANDROID"===k?h.$elem.append('<video x-webkit-airplay="allow" id="'+i+'" alt="Canal central" width="100%" height="100%" src="'+l.ipad_url+'" autoplay controls poster="'+l.poster+'"></video>'):(h.$elem.append('<div id="'+i+'"><a href="https://get.adobe.com/flashplayer" style="color:white;margin-top:30px;text-align:center;display: block;">Flash Plugin is missing</a></div>'),swfobject.embedSWF(l.swf_src,i,"10