正在显示
16 个修改的文件
包含
1143 行增加
和
0 行删除
trunk/players/index.html
0 → 100644
| 1 | +<head> | ||
| 2 | + <title>Players</title> | ||
| 3 | + <meta http-equiv=Content-Type content="text/html;charset=utf-8"> | ||
| 4 | +</head> | ||
| 5 | +<body> | ||
| 6 | + welcome!</p> | ||
| 7 | + <hr/> | ||
| 8 | + <p><a href="rtmp">Rtmp流播放器</a></p> | ||
| 9 | + <p><a href="osmf">OSMF播放器</a></p> | ||
| 10 | + <p><a href="jwplayer5">JWPlayer5</a></p> | ||
| 11 | + <p><a href="jwplayer6">JWPlayer6</a></p> | ||
| 12 | +</body> |
trunk/players/jwplayer5/index.html
0 → 100644
| 1 | +<head> | ||
| 2 | + <title>JWPlayer5</title> | ||
| 3 | + <meta http-equiv=Content-Type content="text/html;charset=utf-8"> | ||
| 4 | + <style> | ||
| 5 | + body{margin:0; padding:0; color:#EEEEEE;} | ||
| 6 | + input.url{width:400px; height:20px;} | ||
| 7 | + input.size{width:40px; height:20px;} | ||
| 8 | + input.buffer{width:20px; height:20px;} | ||
| 9 | + input.play{width:60px; height: 25px;} | ||
| 10 | + select.type{width:50px; } | ||
| 11 | + span.size{padding-left:10px; padding-right:10px;} | ||
| 12 | + div.main{font-size:12px; padding:5px 10px 0px 5px; background-color:#333333; width: 780px;} | ||
| 13 | + div.player{padding-top:3px; padding-bottom:10px;} | ||
| 14 | + div.control{padding-bottom:10px; background-color:#333333; margin-top:5px;} | ||
| 15 | + </style> | ||
| 16 | +</head> | ||
| 17 | +<div class="main"> | ||
| 18 | + <div id="player"></div> | ||
| 19 | + <div class="control" id="control"> | ||
| 20 | + Url(RTMP/HTTP): <input id="url" type="text" class="url" value="rtmp://dev:1935/live/livestream"></input> | ||
| 21 | + <input type="button" class="play" value="Play" onclick="play()"></input> | ||
| 22 | + </div> | ||
| 23 | +</div> | ||
| 24 | +<script type="text/javascript" src="jwplayer.js" ></script> | ||
| 25 | +<script>jwplayer.key="L1P3Ig76mGOK94gZ9WAAGD+Fb1VCVhoZ/Dm0fg=="</script> | ||
| 26 | +<script type='text/javascript'> | ||
| 27 | + function play(){ | ||
| 28 | + var player = document.getElementById("player"); | ||
| 29 | + player.innerHTML = ""; | ||
| 30 | + | ||
| 31 | + var div = document.createElement("div"); | ||
| 32 | + div.id = "player_div"; | ||
| 33 | + player.appendChild(div); | ||
| 34 | + | ||
| 35 | + var url = document.getElementById("url").value; | ||
| 36 | + var provider = (url.indexOf("rtmp://") == 0) ? "rtmp":"http"; | ||
| 37 | + var conf = { | ||
| 38 | + file: url.substr(url.lastIndexOf("/") + 1), | ||
| 39 | + streamer: url.substr(0, url.lastIndexOf("/")), | ||
| 40 | + provider: 'rtmp', | ||
| 41 | + width: "720", | ||
| 42 | + height: "576", | ||
| 43 | + autostart: true, | ||
| 44 | + }; | ||
| 45 | + //console.log(conf); | ||
| 46 | + jwplayer('player_div').setup(conf); | ||
| 47 | + } | ||
| 48 | + play(); | ||
| 49 | +</script> | ||
| 50 | + |
trunk/players/jwplayer5/jwplayer.js
0 → 100644
此 diff 太大无法显示。
trunk/players/jwplayer5/player5.swf
0 → 100644
不能预览此文件类型
trunk/players/jwplayer6/index.html
0 → 100644
| 1 | +<head> | ||
| 2 | + <title>JWPlayer6</title> | ||
| 3 | + <meta http-equiv=Content-Type content="text/html;charset=utf-8"> | ||
| 4 | + <style> | ||
| 5 | + body{margin:0; padding:0; color:#EEEEEE;} | ||
| 6 | + input.url{width:400px; height:20px;} | ||
| 7 | + input.size{width:40px; height:20px;} | ||
| 8 | + input.buffer{width:20px; height:20px;} | ||
| 9 | + input.play{width:60px; height: 25px;} | ||
| 10 | + select.type{width:50px; } | ||
| 11 | + span.size{padding-left:10px; padding-right:10px;} | ||
| 12 | + div.main{font-size:12px; padding:5px 10px 0px 5px; background-color:#333333; width: 780px;} | ||
| 13 | + div.player{padding-top:3px; padding-bottom:10px;} | ||
| 14 | + div.control{padding-bottom:10px; background-color:#333333; margin-top:5px;} | ||
| 15 | + </style> | ||
| 16 | +</head> | ||
| 17 | +<div class="main"> | ||
| 18 | + <div id="player"></div> | ||
| 19 | + <div class="control" id="control"> | ||
| 20 | + Url(RTMP/HTTP): <input id="url" type="text" class="url" value="rtmp://dev:1935/live/livestream"></input> | ||
| 21 | + <input type="button" class="play" value="Play" onclick="play()"></input> | ||
| 22 | + </div> | ||
| 23 | +</div> | ||
| 24 | +<script type="text/javascript" src="jwplayer.js" ></script> | ||
| 25 | +<script>jwplayer.key="L1P3Ig76mGOK94gZ9WAAGD+Fb1VCVhoZ/Dm0fg=="</script> | ||
| 26 | +<script type='text/javascript'> | ||
| 27 | + function play(){ | ||
| 28 | + var player = document.getElementById("player"); | ||
| 29 | + player.innerHTML = ""; | ||
| 30 | + | ||
| 31 | + var div = document.createElement("div"); | ||
| 32 | + div.id = "player_div"; | ||
| 33 | + player.appendChild(div); | ||
| 34 | + | ||
| 35 | + var url = document.getElementById("url").value; | ||
| 36 | + var conf = { | ||
| 37 | + file: url, | ||
| 38 | + width: "720", | ||
| 39 | + height: "576", | ||
| 40 | + autostart: true, | ||
| 41 | + }; | ||
| 42 | + //console.log(conf); | ||
| 43 | + jwplayer('player_div').setup(conf); | ||
| 44 | + } | ||
| 45 | + play(); | ||
| 46 | +</script> | ||
| 47 | + |
trunk/players/jwplayer6/jwplayer.flash.swf
0 → 100644
不能预览此文件类型
trunk/players/jwplayer6/jwplayer.html5.js
0 → 100644
此 diff 太大无法显示。
trunk/players/jwplayer6/jwplayer.js
0 → 100644
| 1 | +if(typeof jwplayer=="undefined"){jwplayer=function(a){if(jwplayer.api){return jwplayer.api.selectPlayer(a)}};jwplayer.version="6.1.2972";jwplayer.vid=document.createElement("video");jwplayer.audio=document.createElement("audio");jwplayer.source=document.createElement("source");(function(d){var j=document,g=window,b=navigator,h="undefined",f="string",c="object";var k=d.utils=function(){};k.exists=function(m){switch(typeof(m)){case f:return(m.length>0);break;case c:return(m!==null);case h:return false}return true};k.styleDimension=function(m){return m+(m.toString().indexOf("%")>0?"":"px")};k.getAbsolutePath=function(s,r){if(!k.exists(r)){r=j.location.href}if(!k.exists(s)){return undefined}if(a(s)){return s}var t=r.substring(0,r.indexOf("://")+3);var q=r.substring(t.length,r.indexOf("/",t.length+1));var n;if(s.indexOf("/")===0){n=s.split("/")}else{var o=r.split("?")[0];o=o.substring(t.length+q.length+1,o.lastIndexOf("/"));n=o.split("/").concat(s.split("/"))}var m=[];for(var p=0;p<n.length;p++){if(!n[p]||!k.exists(n[p])||n[p]=="."){continue}else{if(n[p]==".."){m.pop()}else{m.push(n[p])}}}return t+q+"/"+m.join("/")};function a(n){if(!k.exists(n)){return}var o=n.indexOf("://");var m=n.indexOf("?");return(o>0&&(m<0||(m>o)))}k.extend=function(){var m=k.extend["arguments"];if(m.length>1){for(var o=1;o<m.length;o++){for(var n in m[o]){try{if(k.exists(m[o][n])){m[0][n]=m[o][n]}}catch(p){}}}return m[0]}return null};k.log=function(n,m){if(typeof console!=h&&typeof console.log!=h){if(m){console.log(n,m)}else{console.log(n)}}};var e=k.userAgentMatch=function(n){var m=b.userAgent.toLowerCase();return(m.match(n)!==null)};function l(m){return function(){return e(m)}}k.isIE=l(/msie/i);k.isFF=l(/firefox/i);k.isChrome=l(/chrome/i);k.isIOS=l(/iP(hone|ad|od)/i);k.isIPod=l(/iP(hone|od)/i);k.isIPad=l(/iPad/i);k.isAndroid=function(m){if(m){return e(new RegExp("android.*"+m,"i"))}else{return e(/android/i)}};k.isMobile=function(){return k.isIOS()||k.isAndroid()};k.saveCookie=function(m,n){j.cookie="jwplayer."+m+"="+n+"; path=/"};k.getCookies=function(){var p={};var o=j.cookie.split("; ");for(var n=0;n<o.length;n++){var m=o[n].split("=");if(m[0].indexOf("jwplayer.")==0){p[m[0].substring(9,m[0].length)]=m[1]}}return p};k.typeOf=function(n){var m=typeof n;if(m==="object"){if(!n){return"null"}return(n instanceof Array)?"array":m}else{return m}};k.translateEventResponse=function(o,m){var q=k.extend({},m);if(o==d.events.JWPLAYER_FULLSCREEN&&!q.fullscreen){q.fullscreen=q.message=="true"?true:false;delete q.message}else{if(typeof q.data==c){q=k.extend(q,q.data);delete q.data}else{if(typeof q.metadata==c){k.deepReplaceKeyName(q.metadata,["__dot__","__spc__","__dsh__"],["."," ","-"])}}}var n=["position","duration","offset"];for(var p in n){if(q[n[p]]){q[n[p]]=Math.round(q[n[p]]*1000)/1000}}return q};k.flashVersion=function(){if(k.isAndroid()){return 0}var m=b.plugins,n;if(m!=h){n=m["Shockwave Flash"];if(n){return parseInt(n.description.replace(/\D+(\d+)\..*/,"$1"))}}if(typeof g.ActiveXObject!=h){try{n=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");if(n){return parseInt(n.GetVariable("$version").split(" ")[1].split(",")[0])}}catch(o){}}return 0};k.getScriptPath=function(o){var m=j.getElementsByTagName("script");for(var n=0;n<m.length;n++){var p=m[n].src;if(p&&p.indexOf(o)>=0){return p.substr(0,p.indexOf(o))}}return""};k.deepReplaceKeyName=function(t,o,m){switch(d.utils.typeOf(t)){case"array":for(var q=0;q<t.length;q++){t[q]=d.utils.deepReplaceKeyName(t[q],o,m)}break;case c:for(var p in t){var s,r;if(o instanceof Array&&m instanceof Array){if(o.length!=m.length){continue}else{s=o;r=m}}else{s=[o];r=[m]}var n=p;for(var q=0;q<s.length;q++){n=n.replace(new RegExp(o[q],"g"),m[q])}t[n]=d.utils.deepReplaceKeyName(t[p],o,m);if(p!=n){delete t[p]}}break}return t};var i=k.pluginPathType={ABSOLUTE:0,RELATIVE:1,CDN:2};k.getPluginPathType=function(n){if(typeof n!=f){return}n=n.split("?")[0];var o=n.indexOf("://");if(o>0){return i.ABSOLUTE}var m=n.indexOf("/");var p=k.extension(n);if(o<0&&m<0&&(!p||!isNaN(p))){return i.CDN}return i.RELATIVE};k.getPluginName=function(m){return m.replace(/^(.*\/)?([^-]*)-?.*\.(swf|js)$/,"$2")};k.getPluginVersion=function(m){return m.replace(/[^-]*-?([^\.]*).*$/,"$1")};k.isYouTube=function(m){return(m.indexOf("youtube.com")>-1||m.indexOf("youtu.be")>-1)};k.isRtmp=function(m,n){return(m.indexOf("rtmp")==0||n=="rtmp")};k.foreach=function(o,n){for(var m in o){if(o.hasOwnProperty(m)){n(m)}}};k.isHTTPS=function(){return(g.location.href.indexOf("https")==0)}})(jwplayer);(function(o){var d="video/",i="audio/",g="image",j="mp4",c="webm",n="ogg",b="aac",k="mp3",l="vorbis",m={mp4:d+j,vorbis:i+n,ogg:d+n,webm:d+c,aac:i+j,mp3:i+"mpeg",hls:"application/vnd.apple.mpegurl"},h={mp4:m[j],f4v:m[j],m4v:m[j],mov:m[j],m4a:m[b],f4a:m[b],aac:m[b],mp3:m[k],ogv:m[n],ogg:m[l],oga:m[l],webm:m[c],m3u8:m.hls},d="video",f={flv:d,f4v:d,mov:d,m4a:d,m4v:d,mp4:d,aac:d,f4a:d,mp3:"sound",smil:"rtmp",m3u8:"hls"};var a=o.extensionmap={};for(var e in h){a[e]={html5:h[e]}}for(e in f){if(!a[e]){a[e]={}}a[e].flash=f[e]}a.types=m;a.mimeType=function(q){for(var p in m){if(m[p]==q){return p}}};a.extType=function(p){return a.mimeType(h[p])}})(jwplayer.utils);(function(b){var a=b.loaderstatus={NEW:0,LOADING:1,ERROR:2,COMPLETE:3},c=document;b.scriptloader=function(e){var f=a.NEW,h=jwplayer.events,d=new h.eventdispatcher();b.extend(this,d);this.load=function(){var k=b.scriptloader.loaders[e];if(k&&(k.getStatus()==a.NEW||k.getStatus()==a.LOADING)){k.addEventListener(h.ERROR,g);k.addEventListener(h.COMPLETE,i);return}b.scriptloader.loaders[e]=this;if(f==a.NEW){f=a.LOADING;var j=c.createElement("script");if(j.addEventListener){j.onload=i;j.onerror=g}else{if(j.readyState){j.onreadystatechange=function(){if(j.readyState=="loaded"||j.readyState=="complete"){i()}}}}c.getElementsByTagName("head")[0].appendChild(j);j.src=e}};function g(j){f=a.ERROR;d.sendEvent(h.ERROR)}function i(j){f=a.COMPLETE;d.sendEvent(h.COMPLETE)}this.getStatus=function(){return f}};b.scriptloader.loaders={}})(jwplayer.utils);(function(a){a.trim=function(b){return b.replace(/^\s*/,"").replace(/\s*$/,"")};a.pad=function(c,d,b){if(!b){b="0"}while(c.length<d){c=b+c}return c};a.xmlAttribute=function(b,c){for(var d=0;d<b.attributes.length;d++){if(b.attributes[d].name&&b.attributes[d].name.toLowerCase()==c.toLowerCase()){return b.attributes[d].value.toString()}}return""};a.extension=function(b){if(!b||b.substr(0,4)=="rtmp"){return""}b=b.substring(b.lastIndexOf("/")+1,b.length).split("?")[0].split("#")[0];if(b.lastIndexOf(".")>-1){return b.substr(b.lastIndexOf(".")+1,b.length).toLowerCase()}};a.stringToColor=function(b){b=b.replace(/(#|0x)?([0-9A-F]{3,6})$/gi,"$2");if(b.length==3){b=b.charAt(0)+b.charAt(0)+b.charAt(1)+b.charAt(1)+b.charAt(2)+b.charAt(2)}return parseInt(b,16)}})(jwplayer.utils);(function(a){var c="invalid",b="36QXq4W@GSBV^teR";a.key=function(h){var g,i,e;function f(j){if(!a.exists(j)){j=""}try{j=d(j);var l=j.split("/");g=l[0];if(!g){g="free"}else{if(a.key.valid.indexOf(g)<0){g=c}}i=l[1];if(l[2]&&parseInt(l[2])>0){e=new Date();e.setTime(String(l[2]))}}catch(k){g=c}}function d(j){return a.tea.decrypt(j,b)}this.edition=function(){if(e&&e.getTime()<(new Date()).getTime()){return c}return g};this.token=function(){return i};f(h)};a.key.valid=["free","pro"]})(jwplayer.utils);(function(b){var c=b.tea={};c.encrypt=function(h,w){if(h.length==0){return("")}var x=c.strToLongs(a.encode(h));if(x.length<=1){x[1]=0}var l=c.strToLongs(a.encode(w).slice(0,16)),i=x.length,r=x[i-1],s=x[0],u=2654435769,t,o,f=Math.floor(6+52/i),m=0;while(f-->0){m+=u;o=m>>>2&3;for(var g=0;g<i;g++){s=x[(g+1)%i];t=(r>>>5^s<<2)+(s>>>3^r<<4)^(m^s)+(l[g&3^o]^r);r=x[g]+=t}}var j=c.longsToStr(x);return d.encode(j)};c.decrypt=function(j,w){if(j.length==0){return("")}var x=c.strToLongs(d.decode(j)),l=c.strToLongs(a.encode(w).slice(0,16)),i=x.length,r=x[i-1],s=x[0],u=2654435769,t,o,f=Math.floor(6+52/i),m=f*u;while(m!=0){o=m>>>2&3;for(var h=i-1;h>=0;h--){r=x[h>0?h-1:i-1];t=(r>>>5^s<<2)+(s>>>3^r<<4)^(m^s)+(l[h&3^o]^r);s=x[h]-=t}m-=u}var g=c.longsToStr(x);g=g.replace(/\0+$/,"");return a.decode(g)};c.strToLongs=function(g){var e=new Array(Math.ceil(g.length/4));for(var f=0;f<e.length;f++){e[f]=g.charCodeAt(f*4)+(g.charCodeAt(f*4+1)<<8)+(g.charCodeAt(f*4+2)<<16)+(g.charCodeAt(f*4+3)<<24)}return e};c.longsToStr=function(f){var e=new Array(f.length);for(var g=0;g<f.length;g++){e[g]=String.fromCharCode(f[g]&255,f[g]>>>8&255,f[g]>>>16&255,f[g]>>>24&255)}return e.join("")};var d={};d.code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";d.encode=function(q,s){s=(typeof s=="undefined")?false:s;var j,g,f,u,r,n,m,k,l=[],i="",p,t,o;var h=d.code;t=s?a.encode(q):q;p=t.length%3;if(p>0){while(p++<3){i+="=";t+="\0"}}for(p=0;p<t.length;p+=3){j=t.charCodeAt(p);g=t.charCodeAt(p+1);f=t.charCodeAt(p+2);u=j<<16|g<<8|f;r=u>>18&63;n=u>>12&63;m=u>>6&63;k=u&63;l[p/3]=h.charAt(r)+h.charAt(n)+h.charAt(m)+h.charAt(k)}o=l.join("");o=o.slice(0,o.length-i.length)+i;return o};d.decode=function(p,g){g=(typeof g=="undefined")?false:g;var i,f,e,q,m,k,j,s,l=[],r,o;var h=d.code;o=g?a.decode(p):p;for(var n=0;n<o.length;n+=4){q=h.indexOf(o.charAt(n));m=h.indexOf(o.charAt(n+1));k=h.indexOf(o.charAt(n+2));j=h.indexOf(o.charAt(n+3));s=q<<18|m<<12|k<<6|j;i=s>>>16&255;f=s>>>8&255;e=s&255;l[n/4]=String.fromCharCode(i,f,e);if(j==64){l[n/4]=String.fromCharCode(i,f)}if(k==64){l[n/4]=String.fromCharCode(i)}}r=l.join("");return g?a.decode(r):r};var a={};a.encode=function(e){var f=e.replace(/[\u0080-\u07ff]/g,function(h){var g=h.charCodeAt(0);return String.fromCharCode(192|g>>6,128|g&63)});f=f.replace(/[\u0800-\uffff]/g,function(h){var g=h.charCodeAt(0);return String.fromCharCode(224|g>>12,128|g>>6&63,128|g&63)});return f};a.decode=function(f){var e=f.replace(/[\u00e0-\u00ef][\u0080-\u00bf][\u0080-\u00bf]/g,function(h){var g=((h.charCodeAt(0)&15)<<12)|((h.charCodeAt(1)&63)<<6)|(h.charCodeAt(2)&63);return String.fromCharCode(g)});e=e.replace(/[\u00c0-\u00df][\u0080-\u00bf]/g,function(h){var g=(h.charCodeAt(0)&31)<<6|h.charCodeAt(1)&63;return String.fromCharCode(g)});return e}})(jwplayer.utils);(function(a){a.events={COMPLETE:"COMPLETE",ERROR:"ERROR",API_READY:"jwplayerAPIReady",JWPLAYER_READY:"jwplayerReady",JWPLAYER_FULLSCREEN:"jwplayerFullscreen",JWPLAYER_RESIZE:"jwplayerResize",JWPLAYER_ERROR:"jwplayerError",JWPLAYER_MEDIA_BEFOREPLAY:"jwplayerMediaBeforePlay",JWPLAYER_MEDIA_BEFORECOMPLETE:"jwplayerMediaBeforeComplete",JWPLAYER_COMPONENT_SHOW:"jwplayerComponentShow",JWPLAYER_COMPONENT_HIDE:"jwplayerComponentHide",JWPLAYER_MEDIA_BUFFER:"jwplayerMediaBuffer",JWPLAYER_MEDIA_BUFFER_FULL:"jwplayerMediaBufferFull",JWPLAYER_MEDIA_ERROR:"jwplayerMediaError",JWPLAYER_MEDIA_LOADED:"jwplayerMediaLoaded",JWPLAYER_MEDIA_COMPLETE:"jwplayerMediaComplete",JWPLAYER_MEDIA_SEEK:"jwplayerMediaSeek",JWPLAYER_MEDIA_TIME:"jwplayerMediaTime",JWPLAYER_MEDIA_VOLUME:"jwplayerMediaVolume",JWPLAYER_MEDIA_META:"jwplayerMediaMeta",JWPLAYER_MEDIA_MUTE:"jwplayerMediaMute",JWPLAYER_MEDIA_LEVELS:"jwplayerMediaLevels",JWPLAYER_MEDIA_LEVEL_CHANGED:"jwplayerMediaLevelChanged",JWPLAYER_CAPTIONS_CHANGED:"jwplayerCaptionsChanged",JWPLAYER_CAPTIONS_LIST:"jwplayerCaptionsList",JWPLAYER_PLAYER_STATE:"jwplayerPlayerState",state:{BUFFERING:"BUFFERING",IDLE:"IDLE",PAUSED:"PAUSED",PLAYING:"PLAYING"},JWPLAYER_PLAYLIST_LOADED:"jwplayerPlaylistLoaded",JWPLAYER_PLAYLIST_ITEM:"jwplayerPlaylistItem",JWPLAYER_PLAYLIST_COMPLETE:"jwplayerPlaylistComplete",JWPLAYER_DISPLAY_CLICK:"jwplayerViewClick",JWPLAYER_CONTROLS:"jwplayerViewControls",JWPLAYER_INSTREAM_CLICK:"jwplayerInstreamClicked",JWPLAYER_INSTREAM_DESTROYED:"jwplayerInstreamDestroyed"}})(jwplayer);(function(a){var b=jwplayer.utils;a.eventdispatcher=function(h,c){var e=h,g=c,f,d;this.resetEventListeners=function(){f={};d=[]};this.resetEventListeners();this.addEventListener=function(i,l,k){try{if(!b.exists(f[i])){f[i]=[]}if(b.typeOf(l)=="string"){l=(new Function("return "+l))()}f[i].push({listener:l,count:k})}catch(j){b.log("error",j)}return false};this.removeEventListener=function(j,l){if(!f[j]){return}try{for(var i=0;i<f[j].length;i++){if(f[j][i].listener.toString()==l.toString()){f[j].splice(i,1);break}}}catch(k){b.log("error",k)}return false};this.addGlobalListener=function(k,j){try{if(b.typeOf(k)=="string"){k=(new Function("return "+k))()}d.push({listener:k,count:j})}catch(i){b.log("error",i)}return false};this.removeGlobalListener=function(k){if(!k){return}try{for(var i=0;i<d.length;i++){if(d[i].listener.toString()==k.toString()){d.splice(i,1);break}}}catch(j){b.log("error",j)}return false};this.sendEvent=function(k,m){if(!b.exists(m)){m={}}b.extend(m,{id:e,version:jwplayer.version,type:k});if(g){b.log(k,m)}if(b.typeOf(f[k])!="undefined"){for(var j=0;j<f[k].length;j++){try{f[k][j].listener(m)}catch(l){b.log("There was an error while handling a listener: "+l.toString(),f[k][j].listener)}if(f[k][j]){if(f[k][j].count===1){delete f[k][j]}else{if(f[k][j].count>0){f[k][j].count=f[k][j].count-1}}}}}var i;for(i=0;i<d.length;i++){try{d[i].listener(m)}catch(l){b.log("There was an error while handling a listener: "+l.toString(),d[i].listener)}if(d[i]){if(d[i].count===1){delete d[i]}else{if(d[i].count>0){d[i].count=d[i].count-1}}}}}}})(jwplayer.events);(function(a){var c={},b={};a.plugins=function(){};a.plugins.loadPlugins=function(e,d){b[e]=new a.plugins.pluginloader(new a.plugins.model(c),d);return b[e]};a.plugins.registerPlugin=function(h,g,f,e){var d=a.utils.getPluginName(h);if(!c[d]){c[d]=new a.plugins.plugin(h)}c[d].registerPlugin(h,g,f,e)}})(jwplayer);(function(a){a.plugins.model=function(b){this.addPlugin=function(c){var d=a.utils.getPluginName(c);if(!b[d]){b[d]=new a.plugins.plugin(c)}return b[d]};this.getPlugins=function(){return b}}})(jwplayer);(function(b){var a=jwplayer.utils,c=jwplayer.events,d="undefined";b.pluginmodes={FLASH:0,JAVASCRIPT:1,HYBRID:2};b.plugin=function(e){var l=a.loaderstatus.NEW,m,k,f,n;var g=new c.eventdispatcher();a.extend(this,g);function h(){switch(a.getPluginPathType(e)){case a.pluginPathType.ABSOLUTE:return e;case a.pluginPathType.RELATIVE:return a.getAbsolutePath(e,window.location.href)}}function j(o){n=setTimeout(function(){l=a.loaderstatus.COMPLETE;g.sendEvent(c.COMPLETE)},1000)}function i(o){l=a.loaderstatus.ERROR;g.sendEvent(c.ERROR)}this.load=function(){if(l==a.loaderstatus.NEW){if(e.lastIndexOf(".swf")>0){m=e;l=a.loaderstatus.COMPLETE;g.sendEvent(c.COMPLETE);return}else{if(a.getPluginPathType(e)==a.pluginPathType.CDN){l=a.loaderstatus.COMPLETE;g.sendEvent(c.COMPLETE);return}}l=a.loaderstatus.LOADING;var o=new a.scriptloader(h());o.addEventListener(c.COMPLETE,j);o.addEventListener(c.ERROR,i);o.load()}};this.registerPlugin=function(r,q,p,o){if(n){clearTimeout(n);n=undefined}f=q;if(p&&o){m=o;k=p}else{if(typeof p=="string"){m=p}else{if(typeof p=="function"){k=p}else{if(!p&&!o){m=r}}}}l=a.loaderstatus.COMPLETE;g.sendEvent(c.COMPLETE)};this.getStatus=function(){return l};this.getPluginName=function(){return a.getPluginName(e)};this.getFlashPath=function(){if(m){switch(a.getPluginPathType(m)){case a.pluginPathType.ABSOLUTE:return m;case a.pluginPathType.RELATIVE:if(e.lastIndexOf(".swf")>0){return a.getAbsolutePath(m,window.location.href)}return a.getAbsolutePath(m,h())}}return null};this.getJS=function(){return k};this.getTarget=function(){return f};this.getPluginmode=function(){if(typeof m!=d&&typeof k!=d){return b.pluginmodes.HYBRID}else{if(typeof m!=d){return b.pluginmodes.FLASH}else{if(typeof k!=d){return b.pluginmodes.JAVASCRIPT}}}};this.getNewInstance=function(p,o,q){return new k(p,o,q)};this.getURL=function(){return e}}})(jwplayer.plugins);(function(b){var a=b.utils,c=b.events;b.plugins.pluginloader=function(i,h){var o=a.loaderstatus.NEW,g=false,d=false,k=false,l,m=h,e=new c.eventdispatcher();a.extend(this,e);function f(){if(k){e.sendEvent(c.ERROR,{message:l})}else{if(!d){d=true;o=a.loaderstatus.COMPLETE;e.sendEvent(c.COMPLETE)}}}function n(){if(!m){f()}if(!d&&!k){var r=0,q=i.getPlugins();for(var s in m){var t=a.getPluginName(s),w=q[t],v=w.getJS(),u=w.getTarget(),p=w.getStatus();if(p==a.loaderstatus.LOADING||p==a.loaderstatus.NEW){r++}else{if(v&&(!u||parseFloat(u)>parseFloat(b.version))){k=true;l="Incompatible player version";f()}}}if(r==0){f()}}}this.setupPlugins=function(x,s,A){var r={length:0,plugins:{}},v={length:0,plugins:{}},u=i.getPlugins();for(var w in s.plugins){var y=a.getPluginName(w),z=u[y],B=z.getFlashPath(),C=z.getJS(),p=z.getURL();if(B){r.plugins[B]=a.extend({},s.plugins[w]);r.plugins[B].pluginmode=z.getPluginmode();r.length++}try{if(C&&s.plugins&&s.plugins[p]){var q=document.createElement("div");q.id=x.id+"_"+y;q.style.position="absolute";q.style.top=0;q.style.zIndex=v.length+10;v.plugins[y]=z.getNewInstance(x,a.extend({},s.plugins[p]),q);v.length++;x.onReady(A(v.plugins[y],q,true));x.onResize(A(v.plugins[y],q))}}catch(t){console.log("ERROR: Failed to load "+y+".")}}x.plugins=v.plugins;return r};this.load=function(){if(a.exists(h)&&a.typeOf(h)!="object"){n();return}o=a.loaderstatus.LOADING;g=true;for(var q in h){if(a.exists(q)){var r=i.addPlugin(q);r.addEventListener(c.COMPLETE,n);r.addEventListener(c.ERROR,j)}}var p=i.getPlugins();for(q in p){p[q].load()}g=false;n()};var j=this.pluginFailed=function(p){if(!k){k=true;l="File not found";f()}};this.getStatus=function(){return o}}})(jwplayer);(function(a){a.playlist=function(c){var d=[];if(a.utils.typeOf(c)=="array"){for(var b=0;b<c.length;b++){d.push(new a.playlist.item(c[b]))}}else{d.push(new a.playlist.item(c))}return d}})(jwplayer);(function(b){var a=b.item=function(d){var c=jwplayer.utils.extend({},a.defaults,d);if(c.sources.length==0){c.sources=[new b.source(c)]}for(var e=0;e<c.sources.length;e++){c.sources[e]=new b.source(c.sources[e])}return c};a.defaults={description:"",image:"",mediaid:"",title:"",tags:"",duration:-1,sources:[]}})(jwplayer.playlist);(function(d){var b=undefined,a=jwplayer.utils,c={file:b,label:b,bitrate:b,width:b,height:b,type:b};d.source=function(f){var e=a.extend({},c);for(var g in c){if(a.exists(f[g])){e[g]=f[g];delete f[g]}}if(e.type&&e.type.indexOf("/")>0){e.type=a.extensionmap.mimeType(e.type)}return e}})(jwplayer.playlist);(function(b){var a=b.utils,c=b.events,d=document;var e=b.embed=function(u){var q=new e.config(u.config),j,l,h,k=q.width,m=q.height,o="Error loading player: ",i=b.plugins.loadPlugins(u.id,q.plugins);if(q.fallbackDiv){h=q.fallbackDiv;delete q.fallbackDiv}q.id=u.id;l=d.getElementById(u.id);j=d.createElement("div");j.id=l.id;j.style.width=k.toString().indexOf("%")>0?k:(k+"px");j.style.height=m.toString().indexOf("%")>0?m:(m+"px");l.parentNode.replaceChild(j,l);function n(x,w){for(var v in w){if(typeof x[v]=="function"){(x[v]).call(x,w[v])}}}function f(){if(a.typeOf(q.playlist)=="array"&&q.playlist.length<2){if(q.playlist.length==0||!q.playlist[0].sources||q.playlist[0].sources.length==0){s();return}}if(i.getStatus()==a.loaderstatus.COMPLETE){for(var x=0;x<q.modes.length;x++){if(q.modes[x].type&&e[q.modes[x].type]){var v=a.extend({},q),w=new e[q.modes[x].type](j,q.modes[x],v,i,u);if(w.supportsConfig()){w.addEventListener(c.ERROR,g);w.embed();n(u,v.events);return u}}}if(q.fallback){a.log("No suitable players found and fallback enabled");new e.download(j,q,s)}else{a.log("No suitable players found and fallback disabled");r()}}}function r(){j.parentNode.replaceChild(h,j)}function g(v){t(j,o+v.message)}function p(v){t(j,"Could not load plugins: "+v.message)}function s(){t(j,o+"No playable sources found")}function t(v,x){if(!q.fallback){return}var w=v.style;w.backgroundColor="#000";w.color="#FFF";w.width=a.styleDimension(q.width);w.height=a.styleDimension(q.height);w.display="table";w.opacity=1;var z=document.createElement("p"),y=z.style;y.verticalAlign="middle";y.textAlign="center";y.display="table-cell";y.font="15px/20px Arial, Helvetica, sans-serif";z.innerHTML=x.replace(":",":<br>");v.innerHTML="";v.appendChild(z)}b.embed.errorScreen=t;i.addEventListener(c.COMPLETE,f);i.addEventListener(c.ERROR,p);i.load();return u}})(jwplayer);(function(d){var a=d.utils,h=d.embed,b=d.playlist.item,f=undefined;var c=h.config=function(j){var l={fallback:true,height:270,primary:"html5",width:480,base:j.base?j.base:a.getScriptPath("jwplayer.js")},k=a.extend(l,j),i={html5:{type:"html5",src:k.base+"jwplayer.html5.js"},flash:{type:"flash",src:k.base+"jwplayer.flash.swf"}};k.modes=(k.primary=="flash")?[i.flash,i.html5]:[i.html5,i.flash];if(k.listbar){k.playlistsize=k.listbar.size;k.playlistposition=k.listbar.position}e(k);return k};c.addConfig=function(i,j){e(j);return a.extend(i,j)};function e(l){if(!l.playlist){var n={};for(var k in b.defaults){g(l,n,k)}if(!n.sources){if(l.levels){n.sources=l.levels;delete l.levels}else{var j={};g(l,j,"file");g(l,j,"type");n.sources=j.file?[j]:[]}}l.playlist=[n]}else{for(var m=0;m<l.playlist.length;m++){l.playlist[m]=new b(l.playlist[m])}}}function g(k,i,j){if(a.exists(k[j])){i[j]=k[j];delete k[j]}}})(jwplayer);(function(e){var g=e.embed,j=e.utils,i=document,h="pointer",c="none",a="block",f="100%",d="relative",b="absolute";g.download=function(n,y,l){var q=j.extend({},y),u,o=q.width?q.width:480,r=q.height?q.height:320,z,s,k=y.logo?y.logo:{prefix:"http://p.jwpcdn.com/",file:"logo.png",margin:10};function x(){var E,F,D,G,C=q.playlist,J,B,G,H=["mp4","aac","mp3"];if(C&&C.length){J=C[0];B=J.sources;for(G=0;G<B.length;G++){var A=B[G],I=A.type?A.type:j.extensionmap.extType(j.extension(A.file));if(A.file){for(G in H){if(I==H[G]){E=A.file;F=J.image}else{if(j.isYouTube(A.file)){D=A.file}}}if(E||D){continue}}}}else{return}if(E){z=E;s=F;if(k.prefix){if(j.isHTTPS()){k.prefix=k.prefix.replace("http://","https://ssl.")}k.prefix+=e.version.split(/\W/).splice(0,2).join("/")}t();p()}else{if(D){m(D)}else{l()}}}function t(){if(n){u=v("a","display",n);v("div","icon",u);v("div","logo",u);if(z){u.setAttribute("href",j.getAbsolutePath(z))}}}function w(A,C){var D=i.querySelectorAll(A);for(var B=0;B<D.length;B++){for(var E in C){D[B].style[E]=C[E]}}}function p(){var A="#"+n.id+" .jwdownload";n.style.width="";n.style.height="";w(A+"display",{width:j.styleDimension(Math.max(320,o)),height:j.styleDimension(Math.max(180,r)),background:"black center no-repeat "+(s?"url("+s+")":""),backgroundSize:"contain",position:d,border:c,display:a});w(A+"display div",{position:b,width:f,height:f});w(A+"logo",{top:k.margin+"px",right:k.margin+"px",background:"top right no-repeat url("+k.prefix+k.file+")"});w(A+"icon",{background:"center no-repeat url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAgNJREFUeNrs28lqwkAYB/CZqNVDDj2r6FN41QeIy8Fe+gj6BL275Q08u9FbT8ZdwVfotSBYEPUkxFOoks4EKiJdaDuTjMn3wWBO0V/+sySR8SNSqVRKIR8qaXHkzlqS9jCfzzWcTCYp9hF5o+59sVjsiRzcegSckFzcjT+ruN80TeSlAjCAAXzdJSGPFXRpAAMYwACGZQkSdhG4WCzehMNhqV6vG6vVSrirKVEw66YoSqDb7cqlUilE8JjHd/y1MQefVzqdDmiaJpfLZWHgXMHn8F6vJ1cqlVAkEsGuAn83J4gAd2RZymQygX6/L1erVQt+9ZPWb+CDwcCC2zXGJaewl/DhcHhK3DVj+KfKZrMWvFarcYNLomAv4aPRSFZVlTlcSPA5fDweW/BoNIqFnKV53JvncjkLns/n/cLdS+92O7RYLLgsKfv9/t8XlDn4eDyiw+HA9Jyz2eyt0+kY2+3WFC5hluej0Ha7zQQq9PPwdDq1Et1sNsx/nFBgCqWJ8oAK1aUptNVqcYWewE4nahfU0YQnk4ntUEfGMIU2m01HoLaCKbTRaDgKtaVLk9tBYaBcE/6Artdr4RZ5TB6/dC+9iIe/WgAMYADDpAUJAxjAAAYwgGFZgoS/AtNNTF7Z2bL0BYPBV3Jw5xFwwWcYxgtBP5OkE8i9G7aWGOOCruvauwADALMLMEbKf4SdAAAAAElFTkSuQmCC)"})}function v(A,D,C){var B=i.createElement(A);if(D){B.className="jwdownload"+D}if(C){C.appendChild(B)}return B}function m(A){var B=v("embed","",n);B.src="http://www.youtube.com/v/"+(/v[=\/](\w*)|\/(\w+)$|^(\w+)$/i).exec(A).slice(1).join("");B.type="application/x-shockwave-flash";B.width=o;B.height=r}x()}})(jwplayer);(function(c){var b=c.utils,d=c.events,a={};var e=c.embed.flash=function(l,m,p,k,n){var h=new c.events.eventdispatcher(),i=b.flashVersion();b.extend(this,h);function q(s,r,t){var u=document.createElement("param");u.setAttribute("name",r);u.setAttribute("value",t);s.appendChild(u)}function o(s,t,r){return function(u){try{if(r){document.getElementById(n.id+"_wrapper").appendChild(t)}var w=document.getElementById(n.id).getPluginConfig("display");if(typeof s.resize=="function"){s.resize(w.width,w.height)}t.style.left=w.x;t.style.top=w.h}catch(v){}}}function j(t){if(!t){return{}}var v={};for(var s in t){var r=t[s];for(var u in r){v[s+"."+u]=r[u]}}return v}function g(u){if(!u){return{}}var x={},w=[];for(var r in u){var t=b.getPluginName(r);var s=u[r];w.push(r);for(var v in s){x[t+"."+v]=s[v]}}x.plugins=w.join(",");return x}this.embed=function(){p.id=n.id;if(i<10){h.sendEvent(d.ERROR,{message:"Flash version must be 10.0 or greater"});return false}var C;var v=b.extend({},p);if(l.id+"_wrapper"==l.parentNode.id){C=document.getElementById(l.id+"_wrapper")}else{C=document.createElement("div");C.id=l.id+"_wrapper";C.style.position="relative";C.style.width=b.styleDimension(v.width);C.style.height=b.styleDimension(v.height);l.parentNode.replaceChild(C,l);C.appendChild(l)}var t=k.setupPlugins(n,v,o);if(t.length>0){b.extend(v,g(t.plugins))}else{delete v.plugins}if(typeof v["dock.position"]!="undefined"){if(v["dock.position"].toString().toLowerCase()=="false"){v.dock=v["dock.position"];delete v["dock.position"]}}var D="#000000",y,u=v.wmode?v.wmode:(v.height&&v.height<=40?"transparent":"opaque"),w=["height","width","modes","events","primary","base","fallback","volume"];for(var z=0;z<w.length;z++){delete v[w[z]]}var B=b.getCookies();for(var s in B){if(typeof(v[s])=="undefined"){v[s]=B[s]}}var r=window.location.pathname.split("/");r.splice(r.length-1,1);r=r.join("/");v.base=r+"/";a[l.id]=v;if(b.isIE()){var A='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" " width="100%" height="100%" id="'+l.id+'" name="'+l.id+'" tabindex=0"">';A+='<param name="movie" value="'+m.src+'">';A+='<param name="allowfullscreen" value="true">';A+='<param name="allowscriptaccess" value="always">';A+='<param name="seamlesstabbing" value="true">';A+='<param name="wmode" value="'+u+'">';A+='<param name="bgcolor" value="'+D+'">';A+="</object>";l.outerHTML=A;y=document.getElementById(l.id)}else{var x=document.createElement("object");x.setAttribute("type","application/x-shockwave-flash");x.setAttribute("data",m.src);x.setAttribute("width","100%");x.setAttribute("height","100%");x.setAttribute("bgcolor",D);x.setAttribute("id",l.id);x.setAttribute("name",l.id);x.setAttribute("tabindex",0);q(x,"allowfullscreen","true");q(x,"allowscriptaccess","always");q(x,"seamlesstabbing","true");q(x,"wmode",u);l.parentNode.replaceChild(x,l);y=x}n.container=y;n.setPlayer(y,"flash")};this.supportsConfig=function(){if(i){if(p){if(b.typeOf(p.playlist)=="string"){return true}try{var t=p.playlist[0],r=t.sources;if(typeof r=="undefined"){return true}else{for(var s=0;s<r.length;s++){if(r[s].file&&f(r[s].file,r[s].type)){return true}}}}catch(u){return false}}else{return true}}return false};function f(r,s){if(b.isYouTube(r)){return true}if(b.isRtmp(r,s)){return true}if(s=="hls"){return true}var t=b.extensionmap[s?s:b.extension(r)];if(!t){return false}return !!(t.flash)}};e.getVars=function(f){return a[f]}})(jwplayer);(function(c){var a=c.utils,b=a.extensionmap,d=c.events;c.embed.html5=function(g,h,o,f,k){var j=this,e=new d.eventdispatcher();a.extend(j,e);function l(q,r,p){return function(s){try{var t=document.querySelector("#"+g.id+" .jwmain");if(p){t.appendChild(r)}if(typeof q.resize=="function"){q.resize(t.clientWidth,t.clientHeight);setTimeout(function(){q.resize(t.clientWidth,t.clientHeight)},400)}r.left=t.style.left;r.top=t.style.top}catch(u){}}}j.embed=function(){if(c.html5){f.setupPlugins(k,o,l);g.innerHTML="";var p=c.utils.extend({},o);delete p.volume;var q=new c.html5.player(p);k.container=document.getElementById(k.id);k.setPlayer(q,"html5")}else{var r=new a.scriptloader(h.src);r.addEventListener(d.ERROR,i);r.addEventListener(d.COMPLETE,j.embed);r.load()}};function i(p){j.sendEvent(p.type,{message:"HTML5 player not found"})}j.supportsConfig=function(){if(!!c.vid.canPlayType){try{if(a.typeOf(o.playlist)=="string"){return true}else{var p=o.playlist[0].sources;for(var r=0;r<p.length;r++){var q=p[r].file,s=p[r].type;if(n(q,s)){return true}}}}catch(t){return false}}return false};function n(p,q){if(navigator.userAgent.match(/BlackBerry/i)!==null){return false}if(a.isAndroid()&&(a.extension(p)=="m3u"||a.extension(p)=="m3u8")){return false}if(a.isRtmp(p,q)){return false}var r=b[q?q:a.extension(p)];if(!r){return false}if(r.flash&&!r.html5){return false}return m(r.html5)}function m(p){var q=c.vid;if(!p){return true}try{if(q.canPlayType(p)){return true}else{return false}}catch(r){return false}}}})(jwplayer);(function(c){var b=c.embed,a=c.utils,d=a.extend(function(k){var j=(a.isHTTPS()?"https://ssl.":"http://")+"p.jwpcdn.com/"+c.version.replace(/(\d+)\.(\d+).*/,"$1/$2/"),g=k.config,e=g.plugins,f=g.analytics,i=j+"jwpsrv.js",h=new c.utils.key(c.key);if(h.edition()=="ads"&&g.advertising){g.plugins[j+g.advertising.client+(g.primary=="flash"?".swf":".js")]=g.advertising}delete g.advertising;g.key=c.key;delete g.analytics;e=e?e:{};e[i]=f?f:{};g.plugins=e;return new b(k)},b);c.embed=d})(jwplayer);(function(d){var c=[],a=d.utils,e=d.events,b=e.state,g=document;var f=d.api=function(t){var x=this,h={},l={},A={},o=[],i=undefined,D=false,p=[],y=undefined,s={},n={};x.container=t;x.id=t.id;x.getBuffer=function(){return w("jwGetBuffer")};x.getContainer=function(){return x.container};x.addButton=function(H,F,G,K){try{n[K]=G;var J="jwplayer('"+x.id+"').callback('"+K+"')";w("jwDockAddButton",H,F,J,K)}catch(I){a.log("Could not add dock button"+I.message)}};x.removeButton=function(F){w("jwDockRemoveButton",F)},x.callback=function(F){if(n[F]){n[F]()}};x.getDuration=function(){return w("jwGetDuration")};x.getFullscreen=function(){return w("jwGetFullscreen")};x.getStretching=function(){return w("jwGetStretching")};x.getHeight=function(){return w("jwGetHeight")};x.getLockState=function(){return w("jwGetLockState")};x.getMeta=function(){return x.getItemMeta()};x.getMute=function(){return w("jwGetMute")};x.getPlaylist=function(){var G=w("jwGetPlaylist");if(x.renderingMode=="flash"){a.deepReplaceKeyName(G,["__dot__","__spc__","__dsh__"],["."," ","-"])}for(var F=0;F<G.length;F++){if(!a.exists(G[F].index)){G[F].index=F}}return G};x.getPlaylistItem=function(F){if(!a.exists(F)){F=x.getCurrentItem()}return x.getPlaylist()[F]};x.getPosition=function(){return w("jwGetPosition")};x.getRenderingMode=function(){return x.renderingMode};x.getState=function(){return w("jwGetState")};x.getVolume=function(){return w("jwGetVolume")};x.getWidth=function(){return w("jwGetWidth")};x.setFullscreen=function(F){if(!a.exists(F)){w("jwSetFullscreen",!w("jwGetFullscreen"))}else{w("jwSetFullscreen",F)}return x};x.setStretching=function(F){w("jwSetStretching",F);return x};x.setMute=function(F){if(!a.exists(F)){w("jwSetMute",!w("jwGetMute"))}else{w("jwSetMute",F)}return x};x.lock=function(){return x};x.unlock=function(){return x};x.load=function(F){w("jwLoad",F);return x};x.playlistItem=function(F){w("jwPlaylistItem",parseInt(F));return x};x.playlistPrev=function(){w("jwPlaylistPrev");return x};x.playlistNext=function(){w("jwPlaylistNext");return x};x.resize=function(G,F){if(x.renderingMode!="flash"){w("jwResize",G,F)}else{var H=g.getElementById(x.id+"_wrapper");if(H){H.style.width=a.styleDimension(G);H.style.height=a.styleDimension(F)}}return x};x.play=function(F){if(typeof F=="undefined"){F=x.getState();if(F==b.PLAYING||F==b.BUFFERING){w("jwPause")}else{w("jwPlay")}}else{w("jwPlay",F)}return x};x.pause=function(F){if(typeof F=="undefined"){F=x.getState();if(F==b.PLAYING||F==b.BUFFERING){w("jwPause")}else{w("jwPlay")}}else{w("jwPause",F)}return x};x.stop=function(){w("jwStop");return x};x.seek=function(F){w("jwSeek",F);return x};x.setVolume=function(F){w("jwSetVolume",F);return x};x.loadInstream=function(G,F){y=new f.instream(this,i,G,F);return y};x.getQualityLevels=function(){return w("jwGetQualityLevels")};x.getCurrentQuality=function(){return w("jwGetCurrentQuality")};x.setCurrentQuality=function(F){w("jwSetCurrentQuality",F)};x.getCaptionsList=function(){return w("jwGetCaptionsList")};x.getCurrentCaptions=function(){return w("jwGetCurrentCaptions")};x.setCurrentCaptions=function(F){w("jwSetCurrentCaptions",F)};x.getControls=function(){return w("jwGetControls")};x.getSafeRegion=function(){return w("jwGetSafeRegion")};x.setControls=function(F){w("jwSetControls",F)};x.destroyPlayer=function(){w("jwPlayerDestroy")};var r={onBufferChange:e.JWPLAYER_MEDIA_BUFFER,onBufferFull:e.JWPLAYER_MEDIA_BUFFER_FULL,onError:e.JWPLAYER_ERROR,onFullscreen:e.JWPLAYER_FULLSCREEN,onMeta:e.JWPLAYER_MEDIA_META,onMute:e.JWPLAYER_MEDIA_MUTE,onPlaylist:e.JWPLAYER_PLAYLIST_LOADED,onPlaylistItem:e.JWPLAYER_PLAYLIST_ITEM,onPlaylistComplete:e.JWPLAYER_PLAYLIST_COMPLETE,onReady:e.API_READY,onResize:e.JWPLAYER_RESIZE,onComplete:e.JWPLAYER_MEDIA_COMPLETE,onSeek:e.JWPLAYER_MEDIA_SEEK,onTime:e.JWPLAYER_MEDIA_TIME,onVolume:e.JWPLAYER_MEDIA_VOLUME,onBeforePlay:e.JWPLAYER_MEDIA_BEFOREPLAY,onBeforeComplete:e.JWPLAYER_MEDIA_BEFORECOMPLETE,onDisplayClick:e.JWPLAYER_DISPLAY_CLICK,onControls:e.JWPLAYER_CONTROLS,onQualityLevels:e.JWPLAYER_MEDIA_LEVELS,onQualityChange:e.JWPLAYER_MEDIA_LEVEL_CHANGED,onCaptionsList:e.JWPLAYER_CAPTIONS_LIST,onCaptionsChange:e.JWPLAYER_CAPTIONS_CHANGED};a.foreach(r,function(F){x[F]=C(r[F],z)});var v={onBuffer:b.BUFFERING,onPause:b.PAUSED,onPlay:b.PLAYING,onIdle:b.IDLE};a.foreach(v,function(F){x[F]=C(v[F],q)});function C(F,G){return function(H){return G(F,H)}}x.remove=function(){if(!D){throw"Cannot call remove() before player is ready";return}m(this)};function m(F){p=[];f.destroyPlayer(F.id)}x.setup=function(F){if(d.embed){var G=g.getElementById(x.id);if(G){F.fallbackDiv=G}m(x);var H=d(x.id);H.config=F;return new d.embed(H)}return x};x.registerPlugin=function(I,H,G,F){d.plugins.registerPlugin(I,H,G,F)};x.setPlayer=function(F,G){i=F;x.renderingMode=G};x.detachMedia=function(){if(x.renderingMode=="html5"){return w("jwDetachMedia")}};x.attachMedia=function(){if(x.renderingMode=="html5"){return w("jwAttachMedia")}};function q(F,G){if(!l[F]){l[F]=[];z(e.JWPLAYER_PLAYER_STATE,E(F))}l[F].push(G);return x}function E(F){return function(H){var G=H.newstate,J=H.oldstate;if(G==F){var I=l[G];if(I){for(var K=0;K<I.length;K++){if(typeof I[K]=="function"){I[K].call(this,{oldstate:J,newstate:G})}}}}}}function B(F,G,H){if(!A[F]){A[F]={}}if(!A[F][G]){A[F][G]=[];z(G,k(F,G))}A[F][G].push(H);return x}function k(F,G){return function(I){if(F==I.component){var H=A[F][G];if(H){for(var J=0;J<H.length;J++){if(typeof H[J]=="function"){H[J].call(this,I)}}}}}}function j(F,G){try{F.jwAddEventListener(G,'function(dat) { jwplayer("'+x.id+'").dispatchEvent("'+G+'", dat); }')}catch(H){a.log("Could not add internal listener")}}function z(F,G){if(!h[F]){h[F]=[];if(i&&D){j(i,F)}}h[F].push(G);return x}x.dispatchEvent=function(H){if(h[H]){var G=a.translateEventResponse(H,arguments[1]);for(var F=0;F<h[H].length;F++){if(typeof h[H][F]=="function"){h[H][F].call(this,G)}}}};x.dispatchInstreamEvent=function(F){if(y){y.dispatchEvent(F,arguments)}};function w(){if(D){var H=arguments[0],F=[];for(var G=1;G<arguments.length;G++){F.push(arguments[G])}if(typeof i!="undefined"&&typeof i[H]=="function"){switch(F.length){case 4:return(i[H])(F[0],F[1],F[2],F[3]);case 3:return(i[H])(F[0],F[1],F[2]);case 2:return(i[H])(F[0],F[1]);case 1:return(i[H])(F[0]);default:return(i[H])()}}return null}else{p.push(arguments)}}x.playerReady=function(F){D=true;if(!i){x.setPlayer(g.getElementById(F.id))}x.container=g.getElementById(x.id);a.foreach(h,function(G){j(i,G)});z(e.JWPLAYER_PLAYLIST_ITEM,function(G){s={}});z(e.JWPLAYER_MEDIA_META,function(G){a.extend(s,G.metadata)});x.dispatchEvent(e.API_READY);while(p.length>0){w.apply(this,p.shift())}};x.getItemMeta=function(){return s};x.getCurrentItem=function(){return w("jwGetPlaylistIndex")};function u(H,J,I){var F=[];if(!J){J=0}if(!I){I=H.length-1}for(var G=J;G<=I;G++){F.push(H[G])}return F}return x};f.selectPlayer=function(i){var h;if(!a.exists(i)){i=0}if(i.nodeType){h=i}else{if(typeof i=="string"){h=g.getElementById(i)}}if(h){var j=f.playerById(h.id);if(j){return j}else{return f.addPlayer(new f(h))}}else{if(typeof i=="number"){return c[i]}}return null};f.playerById=function(i){for(var h=0;h<c.length;h++){if(c[h].id==i){return c[h]}}return null};f.addPlayer=function(h){for(var i=0;i<c.length;i++){if(c[i]==h){return h}}c.push(h);return h};f.destroyPlayer=function(j){var i=-1,k;for(var m=0;m<c.length;m++){if(c[m].id==j){i=m;k=c[m];continue}}if(i>=0){var n=k.id,h=g.getElementById(n+(k.renderingMode=="flash"?"_wrapper":""));if(a.clearCss){a.clearCss("#"+n)}if(h){if(k.renderingMode=="html5"){k.destroyPlayer()}var l=g.createElement("div");l.id=n;h.parentNode.replaceChild(l,h)}c.splice(i,1)}return null};d.playerReady=function(i){var h=d.api.playerById(i.id);if(h){h.playerReady(i)}else{d.api.selectPlayer(i.id).playerReady(i)}}})(jwplayer);(function(b){var c=b.events,a=c.state;b.api.instream=function(e,k,o,r){var j=e,d=k,i=o,l=r,g={},q={};function h(){j.callInternal("jwLoadInstream",o,r)}function n(s,t){d.jwInstreamAddEventListener(t,'function(dat) { jwplayer("'+j.id+'").dispatchInstreamEvent("'+t+'", dat); }')}function f(s,t){if(!g[s]){g[s]=[];n(d,s)}g[s].push(t);return this}function p(s,t){if(!q[s]){q[s]=[];f(c.JWPLAYER_PLAYER_STATE,m(s))}q[s].push(t);return this}function m(s){return function(u){var t=u.newstate,w=u.oldstate;if(t==s){var v=q[t];if(v){for(var x=0;x<v.length;x++){if(typeof v[x]=="function"){v[x].call(this,{oldstate:w,newstate:t,type:u.type})}}}}}}this.dispatchEvent=function(v,u){if(g[v]){var t=_utils.translateEventResponse(v,u[1]);for(var s=0;s<g[v].length;s++){if(typeof g[v][s]=="function"){g[v][s].call(this,t)}}}};this.onError=function(s){return f(c.JWPLAYER_ERROR,s)};this.onFullscreen=function(s){return f(c.JWPLAYER_FULLSCREEN,s)};this.onMeta=function(s){return f(c.JWPLAYER_MEDIA_META,s)};this.onMute=function(s){return f(c.JWPLAYER_MEDIA_MUTE,s)};this.onComplete=function(s){return f(c.JWPLAYER_MEDIA_COMPLETE,s)};this.onSeek=function(s){return f(c.JWPLAYER_MEDIA_SEEK,s)};this.onTime=function(s){return f(c.JWPLAYER_MEDIA_TIME,s)};this.onVolume=function(s){return f(c.JWPLAYER_MEDIA_VOLUME,s)};this.onBuffer=function(s){return p(a.BUFFERING,s)};this.onPause=function(s){return p(a.PAUSED,s)};this.onPlay=function(s){return p(a.PLAYING,s)};this.onIdle=function(s){return p(a.IDLE,s)};this.onInstreamClick=function(s){return f(c.JWPLAYER_INSTREAM_CLICK,s)};this.onInstreamDestroyed=function(s){return f(c.JWPLAYER_INSTREAM_DESTROYED,s)};this.play=function(s){d.jwInstreamPlay(s)};this.pause=function(s){d.jwInstreamPause(s)};this.seek=function(s){d.jwInstreamSeek(s)};this.destroy=function(){d.jwInstreamDestroy()};this.getState=function(){return d.jwInstreamGetState()};this.getDuration=function(){return d.jwInstreamGetDuration()};this.getPosition=function(){return d.jwInstreamGetPosition()};h()}})(jwplayer);(function(a){var b=a.api,c=b.selectPlayer;b.selectPlayer=function(d){var e=c(d);if(e){return e}else{return{registerPlugin:function(i,h,g,f){a.plugins.registerPlugin(i,h,g)}}}}})(jwplayer)}; |
不能预览此文件类型
trunk/players/osmf/StrobeMediaPlayback.swf
0 → 100644
不能预览此文件类型
trunk/players/osmf/index.html
0 → 100644
| 1 | +<head> | ||
| 2 | + <meta http-equiv=Content-Type content="text/html;charset=utf-8"> | ||
| 3 | + <title>OSMFPlayer</title> | ||
| 4 | +</head> | ||
| 5 | + | ||
| 6 | +<style> | ||
| 7 | +body{margin:0; padding:0; color:#EEEEEE;} | ||
| 8 | +input.url{width:300px; height:20px;} | ||
| 9 | +input.size{width:40px; height:20px;} | ||
| 10 | +input.buffer{width:20px; height:20px;} | ||
| 11 | +input.play{width:60px; height: 25px;} | ||
| 12 | +select.type{width:50px; } | ||
| 13 | +span.size{padding-left:10px; padding-right:10px;} | ||
| 14 | +div.main{font-size:12px; padding:5px 10px 0px 5px; background-color:#333333;} | ||
| 15 | +div.player{padding-top:3px; padding-bottom:10px;} | ||
| 16 | +div.control{padding-bottom:10px; background-color:#333333; } | ||
| 17 | +</style> | ||
| 18 | + | ||
| 19 | +<div class="main" id="main"> | ||
| 20 | + <div id="player" class="player"></div> | ||
| 21 | + <div class="control" id="control"> | ||
| 22 | + Url(RTMP/HTTP): <input id="url" type="text" class="url" value="rtmp://dev:1935/live/livestream"></input> | ||
| 23 | + <select class="type" id="type"> | ||
| 24 | + <option value="live" selected>live</option> | ||
| 25 | + <option value="recorded">vod</option> | ||
| 26 | + </select> | ||
| 27 | + <span class="size"> | ||
| 28 | + Width: <input id="width" type="text" class="size" value="720"></input> | ||
| 29 | + Height: <input id="height" type="text" class="size" value="576"></input> | ||
| 30 | + Buffer: <input id="buffer" type="text" class="buffer" value="2"></input>(s) | ||
| 31 | + </span> | ||
| 32 | + <input type="button" class="play" value="Play" onclick="play()"></input> | ||
| 33 | + </div> | ||
| 34 | +</div> | ||
| 35 | + | ||
| 36 | +<script type="text/javascript" src="swfobject.js"></script> | ||
| 37 | + | ||
| 38 | +<script type="text/javascript"> | ||
| 39 | + player = document.getElementById("player"); | ||
| 40 | + player_div = null; | ||
| 41 | + | ||
| 42 | + function play(){ | ||
| 43 | + // remove old player | ||
| 44 | + if(player_div != null){ | ||
| 45 | + player.innerHTML = ""; | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + // create new div | ||
| 49 | + player_div = document.createElement("div"); | ||
| 50 | + player.appendChild(player_div); | ||
| 51 | + | ||
| 52 | + // set id to swfobject to create player. | ||
| 53 | + player_div.id = "player_div"; | ||
| 54 | + | ||
| 55 | + // generate player. | ||
| 56 | + var width = document.getElementById("width").value; | ||
| 57 | + var height = document.getElementById("height").value; | ||
| 58 | + | ||
| 59 | + // set new style | ||
| 60 | + var main = document.getElementById("main"); | ||
| 61 | + var min_width = 830; | ||
| 62 | + main.style.width = Math.max(min_width, width); | ||
| 63 | + | ||
| 64 | + var flashvars = {}; | ||
| 65 | + flashvars.src = document.getElementById("url").value; | ||
| 66 | + flashvars.streamType = document.getElementById("type").value; // live or recorded | ||
| 67 | + flashvars.autoPlay = true; | ||
| 68 | + flashvars.controlBarAutoHide = false; | ||
| 69 | + flashvars.scaleMode = "stretch"; | ||
| 70 | + flashvars.bufferTime = document.getElementById("buffer").value; | ||
| 71 | + | ||
| 72 | + var params = {}; | ||
| 73 | + params.allowFullScreen = true; | ||
| 74 | + | ||
| 75 | + var attributes = {}; | ||
| 76 | + | ||
| 77 | + swfobject.embedSWF( | ||
| 78 | + "StrobeMediaPlayback.swf", "player_div", | ||
| 79 | + width, height, | ||
| 80 | + "11.1", "AdobeFlashPlayerInstall.swf", | ||
| 81 | + flashvars, params, attributes | ||
| 82 | + ); | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | + // play the default stream. | ||
| 86 | + play(); | ||
| 87 | +</script> |
trunk/players/osmf/swfobject.js
0 → 100644
| 1 | +/* SWFObject v2.2 <http://code.google.com/p/swfobject/> | ||
| 2 | + is released under the MIT License <http://www.opensource.org/licenses/mit-license.php> | ||
| 3 | +*/ | ||
| 4 | +var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]()}}function K(X){if(J){X()}else{U[U.length]=X}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false)}else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false)}else{if(typeof O.attachEvent!=D){i(O,"onload",Y)}else{if(typeof O.onload=="function"){var X=O.onload;O.onload=function(){X();Y()}}else{O.onload=Y}}}}}function h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName("body")[0];var aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");if(ab){ab=ab.split(" ")[1].split(",");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);return}}X.removeChild(aa);Z=null;H()})()}else{H()}}function H(){var ag=o.length;if(ag>0){for(var af=0;af<ag;af++){var Y=o[af].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value")}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z}}}return X}function A(){return !a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)){aa.width="310"}if(typeof aa.height==D||(!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)){aa.height="137"}j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+O.location.toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac}else{ab.flashvars=ac}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");X+="SWFObjectNew";Y.setAttribute("id",X);ae.parentNode.insertBefore(Y,ae);ae.style.display="none";(function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)}else{setTimeout(arguments.callee,10)}})()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display="none";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)}else{setTimeout(arguments.callee,10)}})()}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C("div");if(M.win&&M.ie){aa.innerHTML=ab.innerHTML}else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312){return X}if(aa){if(typeof ai.id==D){ai.id=Y}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae]}else{if(ae.toLowerCase()=="styleclass"){ah+=' class="'+ai[ae]+'"'}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+'="'+ai[ae]+'"'}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='<param name="'+ad+'" value="'+ag[ad]+'" />'}}aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab<ac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2])}var Z=N.length;for(var aa=0;aa<Z;aa++){y(N[aa])}for(var Y in M){M[Y]=null}M=null;for(var X in swfobject){swfobject[X]=null}swfobject=null})}}();return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;Y.callbackFn=Z;o[o.length]=Y;w(ab,false)}else{if(Z){Z({success:false,id:ab})}}},getObjectById:function(X){if(M.w3){return z(X)}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};if(M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y){w(ah,false);K(function(){ae+="";ag+="";var aj={};if(af&&typeof af===r){for(var al in af){aj[al]=af[al]}}aj.data=ab;aj.width=ae;aj.height=ag;var am={};if(ad&&typeof ad===r){for(var ak in ad){am[ak]=ad[ak]}}if(Z&&typeof Z===r){for(var ai in Z){if(typeof am.flashvars!=D){am.flashvars+="&"+ai+"="+Z[ai]}else{am.flashvars=ai+"="+Z[ai]}}}if(F(Y)){var an=u(aj,am,ah);if(aj.id==ah){w(ah,true)}X.success=true;X.ref=an}else{if(aa&&A()){aj.data=aa;P(aj,am,ah,ac);return}else{w(ah,true)}}if(ac){ac(X)}})}else{if(ac){ac(X)}}},switchOffAutoHideShow:function(){m=false},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X)}else{return undefined}},showExpressInstall:function(Z,aa,X,Y){if(M.w3&&A()){P(Z,aa,X,Y)}},removeSWF:function(X){if(M.w3){y(X)}},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X)}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\?/.test(Z)){Z=Z.split("?")[1]}if(aa==null){return L(Z)}var Y=Z.split("&");for(var X=0;X<Y.length;X++){if(Y[X].substring(0,Y[X].indexOf("="))==aa){return L(Y[X].substring((Y[X].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(a){var X=c(R);if(X&&l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);if(M.ie&&M.win){l.style.display="block"}}if(E){E(B)}}a=false}}}}(); |
不能预览此文件类型
trunk/players/rtmp/RtmpPlayer.swf
0 → 100644
不能预览此文件类型
trunk/players/rtmp/index.html
0 → 100644
| 1 | +<head> | ||
| 2 | + <meta http-equiv=Content-Type content="text/html;charset=utf-8"> | ||
| 3 | + <title>RtmpPlayer</title> | ||
| 4 | + <style> | ||
| 5 | + body{margin:0; padding:0; color:#EEEEEE;} | ||
| 6 | + input.url{width:400px; height:20px;} | ||
| 7 | + input.size{width:40px; height:20px;} | ||
| 8 | + input.buffer{width:20px; height:20px;} | ||
| 9 | + input.play{width:60px; height: 25px;} | ||
| 10 | + select.type{width:50px; } | ||
| 11 | + span.size{padding-left:10px; padding-right:10px;} | ||
| 12 | + div.main{font-size:12px; padding:5px 10px 0px 5px; background-color:#333333; width: 980px;} | ||
| 13 | + div.player{padding-top:3px; padding-bottom:10px;} | ||
| 14 | + div.control{padding-bottom:10px; background-color:#333333; } | ||
| 15 | + </style> | ||
| 16 | +</head> | ||
| 17 | +<script type="text/javascript" src="rtmp.player.js"></script> | ||
| 18 | +<div> | ||
| 19 | + <div id="player"></div> | ||
| 20 | +</div> | ||
| 21 | +<script type="text/javascript"> | ||
| 22 | + var o = new RtmpPlayer("player", "RtmpPlayer.swf", 1350, 1050); | ||
| 23 | + | ||
| 24 | + o.setRtmpUrl("rtmp://dev:1935/live/livestream"); | ||
| 25 | + o.admin = "admin"; | ||
| 26 | + o.password = "123456"; | ||
| 27 | + o.loop = false; | ||
| 28 | + o.cansave = true; | ||
| 29 | + o.islive = true; | ||
| 30 | + o.autostart = true; | ||
| 31 | + | ||
| 32 | + o.run(); | ||
| 33 | +</script> |
trunk/players/rtmp/rtmp.player.js
0 → 100644
| 1 | +// china cache RTMP player: | ||
| 2 | +// run() to run player. | ||
| 3 | +// server: the RTMP server, e.g. 192.168.1.5 | ||
| 4 | +// port: the RTMP port, default is 1935. | ||
| 5 | +// adminPort: the admin port, default is 1111. | ||
| 6 | +// user: the admin login user name, default is admin. | ||
| 7 | +// password: the admin login user password, default is null. | ||
| 8 | +// app: the application of fms to play. e.g vod | ||
| 9 | +// stream: the stream of fms to play. e.g mp4:sample1_1500kbps.f4v | ||
| 10 | +// islive: if true, live mode. | ||
| 11 | +// autostart:Boolean a property which specify auto play. | ||
| 12 | +// loop:Boolean a property which specify auto loop. | ||
| 13 | +// | ||
| 14 | +// generate the release js version using GC: | ||
| 15 | +// java -jar google_closure_compiler/compiler.jar --js chinacache.src.js --js_output_file chinacache.js | ||
| 16 | +function RtmpPlayer(div_container, swf_url, width, height){ | ||
| 17 | + this.swf_url = swf_url; | ||
| 18 | + this.div_container = div_container; | ||
| 19 | + this.width = width; | ||
| 20 | + this.height = height; | ||
| 21 | + | ||
| 22 | + this.flashvars = {}; | ||
| 23 | + this.flashvars.width = width; | ||
| 24 | + this.flashvars.height = height; | ||
| 25 | + | ||
| 26 | + this.params = {}; | ||
| 27 | + this.params.quality = "high"; | ||
| 28 | + this.params.bgcolor = "#EEEEEE"; | ||
| 29 | + this.params.allowscriptaccess = "always"; | ||
| 30 | + this.params.allowfullscreen = "true"; | ||
| 31 | + this.params.wmode = "Window"; | ||
| 32 | + | ||
| 33 | + this.attributes = {}; | ||
| 34 | + var html_element_id = "RtmpPlayer"; | ||
| 35 | + this.attributes.id = html_element_id; | ||
| 36 | + this.attributes.name = html_element_id; | ||
| 37 | + this.attributes.align = "middle"; | ||
| 38 | + | ||
| 39 | + this.autostart = false; | ||
| 40 | + this.appLevel = 1; | ||
| 41 | + this.loop = false; | ||
| 42 | + this.port = 1935; | ||
| 43 | + this.adminPort = 1111; | ||
| 44 | + this.server = null; | ||
| 45 | + this.app = null; | ||
| 46 | + this.stream = null; | ||
| 47 | + this.islive = false; | ||
| 48 | + this.cansave = true; | ||
| 49 | + this.user = "admin"; | ||
| 50 | + this.password = null; | ||
| 51 | +} | ||
| 52 | + | ||
| 53 | +RtmpPlayer.prototype.setRtmpUrl = function(url) { | ||
| 54 | + var s = this.trim(url.replace("rtmp://", ""), "/"); | ||
| 55 | + | ||
| 56 | + if(s.indexOf(":") < 0 || s.indexOf(":") > s.indexOf("/")){ | ||
| 57 | + this.server = s.substr(0, s.indexOf("/")); | ||
| 58 | + s = this.trim(s.substr(this.server.length), "/"); | ||
| 59 | + } | ||
| 60 | + else{ | ||
| 61 | + this.server = s.substr(0, s.indexOf(":")); | ||
| 62 | + s = this.trim(s.substr(this.server.length), ":"); | ||
| 63 | + | ||
| 64 | + this.port = s.substr(0, s.indexOf("/")); | ||
| 65 | + s = this.trim(s.substr(this.port.length), "/"); | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + this.app = s.substr(0, s.indexOf("/")); | ||
| 69 | + s = this.trim(s.substr(this.app.length), "/"); | ||
| 70 | + | ||
| 71 | + this.stream = s; | ||
| 72 | +} | ||
| 73 | + | ||
| 74 | +RtmpPlayer.prototype.trim = function(s, str) { | ||
| 75 | + var r = s; | ||
| 76 | + | ||
| 77 | + while(r.indexOf(str) == 0){ | ||
| 78 | + r = r.substr(str.length); | ||
| 79 | + } | ||
| 80 | + while(r.lastIndexOf(str) == r.length - str.length){ | ||
| 81 | + r = r.substr(0, r.length - str.length); | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + return r; | ||
| 85 | +} | ||
| 86 | + | ||
| 87 | +RtmpPlayer.prototype.ck = function(v, pro) { | ||
| 88 | + if(v == null || v == undefined){ | ||
| 89 | + alert(pro + "不能为空!"); | ||
| 90 | + return true; | ||
| 91 | + } | ||
| 92 | + return false; | ||
| 93 | +} | ||
| 94 | + | ||
| 95 | +RtmpPlayer.prototype.run = function() { | ||
| 96 | + // const values | ||
| 97 | + swfVersionStr = "11.1"; | ||
| 98 | + xiSwfUrlStr = "AdobeFlashPlayerInstall.swf"; | ||
| 99 | + | ||
| 100 | + // check | ||
| 101 | + if(this.ck(this.autostart, "autostart(是否自动播放)") || this.ck(this.port, "port(FMS服务器端口)") | ||
| 102 | + || this.ck(this.adminPort, "adminPort(FMS服务器管理端口)") || this.ck(this.server, "server(FMS服务器地址)") | ||
| 103 | + || this.ck(this.app, "app(FMS application)") || this.ck(this.stream, "stream(流名称)") | ||
| 104 | + || this.ck(this.user, "user(FMS登录用户名)") || this.ck(this.password, "password(FMS登录用户密码)")){ | ||
| 105 | + return; | ||
| 106 | + } | ||
| 107 | + | ||
| 108 | + this.flashvars.autostart = this.autostart; | ||
| 109 | + this.flashvars.appLevel = this.appLevel; | ||
| 110 | + this.flashvars.loop = this.loop; | ||
| 111 | + this.flashvars.port = this.port; | ||
| 112 | + this.flashvars.adminPort = this.adminPort; | ||
| 113 | + this.flashvars.server = this.server; | ||
| 114 | + this.flashvars.app = this.app; | ||
| 115 | + this.flashvars.stream = this.stream; | ||
| 116 | + this.flashvars.islive = this.islive; | ||
| 117 | + this.flashvars.cansave = this.cansave; | ||
| 118 | + this.flashvars.user = this.user; | ||
| 119 | + this.flashvars.password = this.password; | ||
| 120 | + | ||
| 121 | + var chnvideoPlayerHost = this; | ||
| 122 | + swfobject.embedSWF( | ||
| 123 | + this.swf_url, this.div_container, | ||
| 124 | + this.width, this.height, | ||
| 125 | + swfVersionStr, xiSwfUrlStr, | ||
| 126 | + this.flashvars, this.params, this.attributes, | ||
| 127 | + function(callbackObj){ | ||
| 128 | + chnvideoPlayerHost.callbackObj = callbackObj; | ||
| 129 | + } | ||
| 130 | + ); | ||
| 131 | +} | ||
| 132 | + | ||
| 133 | +/*! SWFObject v2.2 <http://code.google.com/p/swfobject/> | ||
| 134 | + is released under the MIT License <http://www.opensource.org/licenses/mit-license.php> | ||
| 135 | +*/ | ||
| 136 | + | ||
| 137 | +var swfobject = function() { | ||
| 138 | + | ||
| 139 | + var UNDEF = "undefined", | ||
| 140 | + OBJECT = "object", | ||
| 141 | + SHOCKWAVE_FLASH = "Shockwave Flash", | ||
| 142 | + SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash", | ||
| 143 | + FLASH_MIME_TYPE = "application/x-shockwave-flash", | ||
| 144 | + EXPRESS_INSTALL_ID = "SWFObjectExprInst", | ||
| 145 | + ON_READY_STATE_CHANGE = "onreadystatechange", | ||
| 146 | + | ||
| 147 | + win = window, | ||
| 148 | + doc = document, | ||
| 149 | + nav = navigator, | ||
| 150 | + | ||
| 151 | + plugin = false, | ||
| 152 | + domLoadFnArr = [main], | ||
| 153 | + regObjArr = [], | ||
| 154 | + objIdArr = [], | ||
| 155 | + listenersArr = [], | ||
| 156 | + storedAltContent, | ||
| 157 | + storedAltContentId, | ||
| 158 | + storedCallbackFn, | ||
| 159 | + storedCallbackObj, | ||
| 160 | + isDomLoaded = false, | ||
| 161 | + isExpressInstallActive = false, | ||
| 162 | + dynamicStylesheet, | ||
| 163 | + dynamicStylesheetMedia, | ||
| 164 | + autoHideShow = true, | ||
| 165 | + | ||
| 166 | + /* Centralized function for browser feature detection | ||
| 167 | + - User agent string detection is only used when no good alternative is possible | ||
| 168 | + - Is executed directly for optimal performance | ||
| 169 | + */ | ||
| 170 | + ua = function() { | ||
| 171 | + var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF, | ||
| 172 | + u = nav.userAgent.toLowerCase(), | ||
| 173 | + p = nav.platform.toLowerCase(), | ||
| 174 | + windows = p ? /win/.test(p) : /win/.test(u), | ||
| 175 | + mac = p ? /mac/.test(p) : /mac/.test(u), | ||
| 176 | + webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit | ||
| 177 | + ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html | ||
| 178 | + playerVersion = [0,0,0], | ||
| 179 | + d = null; | ||
| 180 | + if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) { | ||
| 181 | + d = nav.plugins[SHOCKWAVE_FLASH].description; | ||
| 182 | + if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+ | ||
| 183 | + plugin = true; | ||
| 184 | + ie = false; // cascaded feature detection for Internet Explorer | ||
| 185 | + d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1"); | ||
| 186 | + playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10); | ||
| 187 | + playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10); | ||
| 188 | + playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0; | ||
| 189 | + } | ||
| 190 | + } | ||
| 191 | + else if (typeof win.ActiveXObject != UNDEF) { | ||
| 192 | + try { | ||
| 193 | + var a = new ActiveXObject(SHOCKWAVE_FLASH_AX); | ||
| 194 | + if (a) { // a will return null when ActiveX is disabled | ||
| 195 | + d = a.GetVariable("$version"); | ||
| 196 | + if (d) { | ||
| 197 | + ie = true; // cascaded feature detection for Internet Explorer | ||
| 198 | + d = d.split(" ")[1].split(","); | ||
| 199 | + playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)]; | ||
| 200 | + } | ||
| 201 | + } | ||
| 202 | + } | ||
| 203 | + catch(e) {} | ||
| 204 | + } | ||
| 205 | + return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac }; | ||
| 206 | + }(), | ||
| 207 | + | ||
| 208 | + /* Cross-browser onDomLoad | ||
| 209 | + - Will fire an event as soon as the DOM of a web page is loaded | ||
| 210 | + - Internet Explorer workaround based on Diego Perini's solution: http://javascript.nwbox.com/IEContentLoaded/ | ||
| 211 | + - Regular onload serves as fallback | ||
| 212 | + */ | ||
| 213 | + onDomLoad = function() { | ||
| 214 | + if (!ua.w3) { return; } | ||
| 215 | + if ((typeof doc.readyState != UNDEF && doc.readyState == "complete") || (typeof doc.readyState == UNDEF && (doc.getElementsByTagName("body")[0] || doc.body))) { // function is fired after onload, e.g. when script is inserted dynamically | ||
| 216 | + callDomLoadFunctions(); | ||
| 217 | + } | ||
| 218 | + if (!isDomLoaded) { | ||
| 219 | + if (typeof doc.addEventListener != UNDEF) { | ||
| 220 | + doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false); | ||
| 221 | + } | ||
| 222 | + if (ua.ie && ua.win) { | ||
| 223 | + doc.attachEvent(ON_READY_STATE_CHANGE, function() { | ||
| 224 | + if (doc.readyState == "complete") { | ||
| 225 | + doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee); | ||
| 226 | + callDomLoadFunctions(); | ||
| 227 | + } | ||
| 228 | + }); | ||
| 229 | + if (win == top) { // if not inside an iframe | ||
| 230 | + (function(){ | ||
| 231 | + if (isDomLoaded) { return; } | ||
| 232 | + try { | ||
| 233 | + doc.documentElement.doScroll("left"); | ||
| 234 | + } | ||
| 235 | + catch(e) { | ||
| 236 | + setTimeout(arguments.callee, 0); | ||
| 237 | + return; | ||
| 238 | + } | ||
| 239 | + callDomLoadFunctions(); | ||
| 240 | + })(); | ||
| 241 | + } | ||
| 242 | + } | ||
| 243 | + if (ua.wk) { | ||
| 244 | + (function(){ | ||
| 245 | + if (isDomLoaded) { return; } | ||
| 246 | + if (!/loaded|complete/.test(doc.readyState)) { | ||
| 247 | + setTimeout(arguments.callee, 0); | ||
| 248 | + return; | ||
| 249 | + } | ||
| 250 | + callDomLoadFunctions(); | ||
| 251 | + })(); | ||
| 252 | + } | ||
| 253 | + addLoadEvent(callDomLoadFunctions); | ||
| 254 | + } | ||
| 255 | + }(); | ||
| 256 | + | ||
| 257 | + function callDomLoadFunctions() { | ||
| 258 | + if (isDomLoaded) { return; } | ||
| 259 | + try { // test if we can really add/remove elements to/from the DOM; we don't want to fire it too early | ||
| 260 | + var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span")); | ||
| 261 | + t.parentNode.removeChild(t); | ||
| 262 | + } | ||
| 263 | + catch (e) { return; } | ||
| 264 | + isDomLoaded = true; | ||
| 265 | + var dl = domLoadFnArr.length; | ||
| 266 | + for (var i = 0; i < dl; i++) { | ||
| 267 | + domLoadFnArr[i](); | ||
| 268 | + } | ||
| 269 | + } | ||
| 270 | + | ||
| 271 | + function addDomLoadEvent(fn) { | ||
| 272 | + if (isDomLoaded) { | ||
| 273 | + fn(); | ||
| 274 | + } | ||
| 275 | + else { | ||
| 276 | + domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+ | ||
| 277 | + } | ||
| 278 | + } | ||
| 279 | + | ||
| 280 | + /* Cross-browser onload | ||
| 281 | + - Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/ | ||
| 282 | + - Will fire an event as soon as a web page including all of its assets are loaded | ||
| 283 | + */ | ||
| 284 | + function addLoadEvent(fn) { | ||
| 285 | + if (typeof win.addEventListener != UNDEF) { | ||
| 286 | + win.addEventListener("load", fn, false); | ||
| 287 | + } | ||
| 288 | + else if (typeof doc.addEventListener != UNDEF) { | ||
| 289 | + doc.addEventListener("load", fn, false); | ||
| 290 | + } | ||
| 291 | + else if (typeof win.attachEvent != UNDEF) { | ||
| 292 | + addListener(win, "onload", fn); | ||
| 293 | + } | ||
| 294 | + else if (typeof win.onload == "function") { | ||
| 295 | + var fnOld = win.onload; | ||
| 296 | + win.onload = function() { | ||
| 297 | + fnOld(); | ||
| 298 | + fn(); | ||
| 299 | + }; | ||
| 300 | + } | ||
| 301 | + else { | ||
| 302 | + win.onload = fn; | ||
| 303 | + } | ||
| 304 | + } | ||
| 305 | + | ||
| 306 | + /* Main function | ||
| 307 | + - Will preferably execute onDomLoad, otherwise onload (as a fallback) | ||
| 308 | + */ | ||
| 309 | + function main() { | ||
| 310 | + if (plugin) { | ||
| 311 | + testPlayerVersion(); | ||
| 312 | + } | ||
| 313 | + else { | ||
| 314 | + matchVersions(); | ||
| 315 | + } | ||
| 316 | + } | ||
| 317 | + | ||
| 318 | + /* Detect the Flash Player version for non-Internet Explorer browsers | ||
| 319 | + - Detecting the plug-in version via the object element is more precise than using the plugins collection item's description: | ||
| 320 | + a. Both release and build numbers can be detected | ||
| 321 | + b. Avoid wrong descriptions by corrupt installers provided by Adobe | ||
| 322 | + c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports | ||
| 323 | + - Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available | ||
| 324 | + */ | ||
| 325 | + function testPlayerVersion() { | ||
| 326 | + var b = doc.getElementsByTagName("body")[0]; | ||
| 327 | + var o = createElement(OBJECT); | ||
| 328 | + o.setAttribute("type", FLASH_MIME_TYPE); | ||
| 329 | + var t = b.appendChild(o); | ||
| 330 | + if (t) { | ||
| 331 | + var counter = 0; | ||
| 332 | + (function(){ | ||
| 333 | + if (typeof t.GetVariable != UNDEF) { | ||
| 334 | + var d = t.GetVariable("$version"); | ||
| 335 | + if (d) { | ||
| 336 | + d = d.split(" ")[1].split(","); | ||
| 337 | + ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)]; | ||
| 338 | + } | ||
| 339 | + } | ||
| 340 | + else if (counter < 10) { | ||
| 341 | + counter++; | ||
| 342 | + setTimeout(arguments.callee, 10); | ||
| 343 | + return; | ||
| 344 | + } | ||
| 345 | + b.removeChild(o); | ||
| 346 | + t = null; | ||
| 347 | + matchVersions(); | ||
| 348 | + })(); | ||
| 349 | + } | ||
| 350 | + else { | ||
| 351 | + matchVersions(); | ||
| 352 | + } | ||
| 353 | + } | ||
| 354 | + | ||
| 355 | + /* Perform Flash Player and SWF version matching; static publishing only | ||
| 356 | + */ | ||
| 357 | + function matchVersions() { | ||
| 358 | + var rl = regObjArr.length; | ||
| 359 | + if (rl > 0) { | ||
| 360 | + for (var i = 0; i < rl; i++) { // for each registered object element | ||
| 361 | + var id = regObjArr[i].id; | ||
| 362 | + var cb = regObjArr[i].callbackFn; | ||
| 363 | + var cbObj = {success:false, id:id}; | ||
| 364 | + if (ua.pv[0] > 0) { | ||
| 365 | + var obj = getElementById(id); | ||
| 366 | + if (obj) { | ||
| 367 | + if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match! | ||
| 368 | + setVisibility(id, true); | ||
| 369 | + if (cb) { | ||
| 370 | + cbObj.success = true; | ||
| 371 | + cbObj.ref = getObjectById(id); | ||
| 372 | + cb(cbObj); | ||
| 373 | + } | ||
| 374 | + } | ||
| 375 | + else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported | ||
| 376 | + var att = {}; | ||
| 377 | + att.data = regObjArr[i].expressInstall; | ||
| 378 | + att.width = obj.getAttribute("width") || "0"; | ||
| 379 | + att.height = obj.getAttribute("height") || "0"; | ||
| 380 | + if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); } | ||
| 381 | + if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); } | ||
| 382 | + // parse HTML object param element's name-value pairs | ||
| 383 | + var par = {}; | ||
| 384 | + var p = obj.getElementsByTagName("param"); | ||
| 385 | + var pl = p.length; | ||
| 386 | + for (var j = 0; j < pl; j++) { | ||
| 387 | + if (p[j].getAttribute("name").toLowerCase() != "movie") { | ||
| 388 | + par[p[j].getAttribute("name")] = p[j].getAttribute("value"); | ||
| 389 | + } | ||
| 390 | + } | ||
| 391 | + showExpressInstall(att, par, id, cb); | ||
| 392 | + } | ||
| 393 | + else { // Flash Player and SWF version mismatch or an older Webkit engine that ignores the HTML object element's nested param elements: display alternative content instead of SWF | ||
| 394 | + displayAltContent(obj); | ||
| 395 | + if (cb) { cb(cbObj); } | ||
| 396 | + } | ||
| 397 | + } | ||
| 398 | + } | ||
| 399 | + else { // if no Flash Player is installed or the fp version cannot be detected we let the HTML object element do its job (either show a SWF or alternative content) | ||
| 400 | + setVisibility(id, true); | ||
| 401 | + if (cb) { | ||
| 402 | + var o = getObjectById(id); // test whether there is an HTML object element or not | ||
| 403 | + if (o && typeof o.SetVariable != UNDEF) { | ||
| 404 | + cbObj.success = true; | ||
| 405 | + cbObj.ref = o; | ||
| 406 | + } | ||
| 407 | + cb(cbObj); | ||
| 408 | + } | ||
| 409 | + } | ||
| 410 | + } | ||
| 411 | + } | ||
| 412 | + } | ||
| 413 | + | ||
| 414 | + function getObjectById(objectIdStr) { | ||
| 415 | + var r = null; | ||
| 416 | + var o = getElementById(objectIdStr); | ||
| 417 | + if (o && o.nodeName == "OBJECT") { | ||
| 418 | + if (typeof o.SetVariable != UNDEF) { | ||
| 419 | + r = o; | ||
| 420 | + } | ||
| 421 | + else { | ||
| 422 | + var n = o.getElementsByTagName(OBJECT)[0]; | ||
| 423 | + if (n) { | ||
| 424 | + r = n; | ||
| 425 | + } | ||
| 426 | + } | ||
| 427 | + } | ||
| 428 | + return r; | ||
| 429 | + } | ||
| 430 | + | ||
| 431 | + /* Requirements for Adobe Express Install | ||
| 432 | + - only one instance can be active at a time | ||
| 433 | + - fp 6.0.65 or higher | ||
| 434 | + - Win/Mac OS only | ||
| 435 | + - no Webkit engines older than version 312 | ||
| 436 | + */ | ||
| 437 | + function canExpressInstall() { | ||
| 438 | + return !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac) && !(ua.wk && ua.wk < 312); | ||
| 439 | + } | ||
| 440 | + | ||
| 441 | + /* Show the Adobe Express Install dialog | ||
| 442 | + - Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75 | ||
| 443 | + */ | ||
| 444 | + function showExpressInstall(att, par, replaceElemIdStr, callbackFn) { | ||
| 445 | + isExpressInstallActive = true; | ||
| 446 | + storedCallbackFn = callbackFn || null; | ||
| 447 | + storedCallbackObj = {success:false, id:replaceElemIdStr}; | ||
| 448 | + var obj = getElementById(replaceElemIdStr); | ||
| 449 | + if (obj) { | ||
| 450 | + if (obj.nodeName == "OBJECT") { // static publishing | ||
| 451 | + storedAltContent = abstractAltContent(obj); | ||
| 452 | + storedAltContentId = null; | ||
| 453 | + } | ||
| 454 | + else { // dynamic publishing | ||
| 455 | + storedAltContent = obj; | ||
| 456 | + storedAltContentId = replaceElemIdStr; | ||
| 457 | + } | ||
| 458 | + att.id = EXPRESS_INSTALL_ID; | ||
| 459 | + if (typeof att.width == UNDEF || (!/%$/.test(att.width) && parseInt(att.width, 10) < 310)) { att.width = "310"; } | ||
| 460 | + if (typeof att.height == UNDEF || (!/%$/.test(att.height) && parseInt(att.height, 10) < 137)) { att.height = "137"; } | ||
| 461 | + doc.title = doc.title.slice(0, 47) + " - Flash Player Installation"; | ||
| 462 | + var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn", | ||
| 463 | + fv = "MMredirectURL=" + encodeURI(window.location).toString().replace(/&/g,"%26") + "&MMplayerType=" + pt + "&MMdoctitle=" + doc.title; | ||
| 464 | + if (typeof par.flashvars != UNDEF) { | ||
| 465 | + par.flashvars += "&" + fv; | ||
| 466 | + } | ||
| 467 | + else { | ||
| 468 | + par.flashvars = fv; | ||
| 469 | + } | ||
| 470 | + // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it, | ||
| 471 | + // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work | ||
| 472 | + if (ua.ie && ua.win && obj.readyState != 4) { | ||
| 473 | + var newObj = createElement("div"); | ||
| 474 | + replaceElemIdStr += "SWFObjectNew"; | ||
| 475 | + newObj.setAttribute("id", replaceElemIdStr); | ||
| 476 | + obj.parentNode.insertBefore(newObj, obj); // insert placeholder div that will be replaced by the object element that loads expressinstall.swf | ||
| 477 | + obj.style.display = "none"; | ||
| 478 | + (function(){ | ||
| 479 | + if (obj.readyState == 4) { | ||
| 480 | + obj.parentNode.removeChild(obj); | ||
| 481 | + } | ||
| 482 | + else { | ||
| 483 | + setTimeout(arguments.callee, 10); | ||
| 484 | + } | ||
| 485 | + })(); | ||
| 486 | + } | ||
| 487 | + createSWF(att, par, replaceElemIdStr); | ||
| 488 | + } | ||
| 489 | + } | ||
| 490 | + | ||
| 491 | + /* Functions to abstract and display alternative content | ||
| 492 | + */ | ||
| 493 | + function displayAltContent(obj) { | ||
| 494 | + if (ua.ie && ua.win && obj.readyState != 4) { | ||
| 495 | + // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it, | ||
| 496 | + // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work | ||
| 497 | + var el = createElement("div"); | ||
| 498 | + obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content | ||
| 499 | + el.parentNode.replaceChild(abstractAltContent(obj), el); | ||
| 500 | + obj.style.display = "none"; | ||
| 501 | + (function(){ | ||
| 502 | + if (obj.readyState == 4) { | ||
| 503 | + obj.parentNode.removeChild(obj); | ||
| 504 | + } | ||
| 505 | + else { | ||
| 506 | + setTimeout(arguments.callee, 10); | ||
| 507 | + } | ||
| 508 | + })(); | ||
| 509 | + } | ||
| 510 | + else { | ||
| 511 | + obj.parentNode.replaceChild(abstractAltContent(obj), obj); | ||
| 512 | + } | ||
| 513 | + } | ||
| 514 | + | ||
| 515 | + function abstractAltContent(obj) { | ||
| 516 | + var ac = createElement("div"); | ||
| 517 | + if (ua.win && ua.ie) { | ||
| 518 | + ac.innerHTML = obj.innerHTML; | ||
| 519 | + } | ||
| 520 | + else { | ||
| 521 | + var nestedObj = obj.getElementsByTagName(OBJECT)[0]; | ||
| 522 | + if (nestedObj) { | ||
| 523 | + var c = nestedObj.childNodes; | ||
| 524 | + if (c) { | ||
| 525 | + var cl = c.length; | ||
| 526 | + for (var i = 0; i < cl; i++) { | ||
| 527 | + if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) { | ||
| 528 | + ac.appendChild(c[i].cloneNode(true)); | ||
| 529 | + } | ||
| 530 | + } | ||
| 531 | + } | ||
| 532 | + } | ||
| 533 | + } | ||
| 534 | + return ac; | ||
| 535 | + } | ||
| 536 | + | ||
| 537 | + /* Cross-browser dynamic SWF creation | ||
| 538 | + */ | ||
| 539 | + function createSWF(attObj, parObj, id) { | ||
| 540 | + var r, el = getElementById(id); | ||
| 541 | + if (ua.wk && ua.wk < 312) { return r; } | ||
| 542 | + if (el) { | ||
| 543 | + if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content | ||
| 544 | + attObj.id = id; | ||
| 545 | + } | ||
| 546 | + if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML | ||
| 547 | + var att = ""; | ||
| 548 | + for (var i in attObj) { | ||
| 549 | + if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries | ||
| 550 | + if (i.toLowerCase() == "data") { | ||
| 551 | + parObj.movie = attObj[i]; | ||
| 552 | + } | ||
| 553 | + else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword | ||
| 554 | + att += ' class="' + attObj[i] + '"'; | ||
| 555 | + } | ||
| 556 | + else if (i.toLowerCase() != "classid") { | ||
| 557 | + att += ' ' + i + '="' + attObj[i] + '"'; | ||
| 558 | + } | ||
| 559 | + } | ||
| 560 | + } | ||
| 561 | + var par = ""; | ||
| 562 | + for (var j in parObj) { | ||
| 563 | + if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries | ||
| 564 | + par += '<param name="' + j + '" value="' + parObj[j] + '" />'; | ||
| 565 | + } | ||
| 566 | + } | ||
| 567 | + el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>'; | ||
| 568 | + objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only) | ||
| 569 | + r = getElementById(attObj.id); | ||
| 570 | + } | ||
| 571 | + else { // well-behaving browsers | ||
| 572 | + var o = createElement(OBJECT); | ||
| 573 | + o.setAttribute("type", FLASH_MIME_TYPE); | ||
| 574 | + for (var m in attObj) { | ||
| 575 | + if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries | ||
| 576 | + if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword | ||
| 577 | + o.setAttribute("class", attObj[m]); | ||
| 578 | + } | ||
| 579 | + else if (m.toLowerCase() != "classid") { // filter out IE specific attribute | ||
| 580 | + o.setAttribute(m, attObj[m]); | ||
| 581 | + } | ||
| 582 | + } | ||
| 583 | + } | ||
| 584 | + for (var n in parObj) { | ||
| 585 | + if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element | ||
| 586 | + createObjParam(o, n, parObj[n]); | ||
| 587 | + } | ||
| 588 | + } | ||
| 589 | + el.parentNode.replaceChild(o, el); | ||
| 590 | + r = o; | ||
| 591 | + } | ||
| 592 | + } | ||
| 593 | + return r; | ||
| 594 | + } | ||
| 595 | + | ||
| 596 | + function createObjParam(el, pName, pValue) { | ||
| 597 | + var p = createElement("param"); | ||
| 598 | + p.setAttribute("name", pName); | ||
| 599 | + p.setAttribute("value", pValue); | ||
| 600 | + el.appendChild(p); | ||
| 601 | + } | ||
| 602 | + | ||
| 603 | + /* Cross-browser SWF removal | ||
| 604 | + - Especially needed to safely and completely remove a SWF in Internet Explorer | ||
| 605 | + */ | ||
| 606 | + function removeSWF(id) { | ||
| 607 | + var obj = getElementById(id); | ||
| 608 | + if (obj && obj.nodeName == "OBJECT") { | ||
| 609 | + if (ua.ie && ua.win) { | ||
| 610 | + obj.style.display = "none"; | ||
| 611 | + (function(){ | ||
| 612 | + if (obj.readyState == 4) { | ||
| 613 | + removeObjectInIE(id); | ||
| 614 | + } | ||
| 615 | + else { | ||
| 616 | + setTimeout(arguments.callee, 10); | ||
| 617 | + } | ||
| 618 | + })(); | ||
| 619 | + } | ||
| 620 | + else { | ||
| 621 | + obj.parentNode.removeChild(obj); | ||
| 622 | + } | ||
| 623 | + } | ||
| 624 | + } | ||
| 625 | + | ||
| 626 | + function removeObjectInIE(id) { | ||
| 627 | + var obj = getElementById(id); | ||
| 628 | + if (obj) { | ||
| 629 | + for (var i in obj) { | ||
| 630 | + if (typeof obj[i] == "function") { | ||
| 631 | + obj[i] = null; | ||
| 632 | + } | ||
| 633 | + } | ||
| 634 | + obj.parentNode.removeChild(obj); | ||
| 635 | + } | ||
| 636 | + } | ||
| 637 | + | ||
| 638 | + /* Functions to optimize JavaScript compression | ||
| 639 | + */ | ||
| 640 | + function getElementById(id) { | ||
| 641 | + var el = null; | ||
| 642 | + try { | ||
| 643 | + el = doc.getElementById(id); | ||
| 644 | + } | ||
| 645 | + catch (e) {} | ||
| 646 | + return el; | ||
| 647 | + } | ||
| 648 | + | ||
| 649 | + function createElement(el) { | ||
| 650 | + return doc.createElement(el); | ||
| 651 | + } | ||
| 652 | + | ||
| 653 | + /* Updated attachEvent function for Internet Explorer | ||
| 654 | + - Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks | ||
| 655 | + */ | ||
| 656 | + function addListener(target, eventType, fn) { | ||
| 657 | + target.attachEvent(eventType, fn); | ||
| 658 | + listenersArr[listenersArr.length] = [target, eventType, fn]; | ||
| 659 | + } | ||
| 660 | + | ||
| 661 | + /* Flash Player and SWF content version matching | ||
| 662 | + */ | ||
| 663 | + function hasPlayerVersion(rv) { | ||
| 664 | + var pv = ua.pv, v = rv.split("."); | ||
| 665 | + v[0] = parseInt(v[0], 10); | ||
| 666 | + v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0" | ||
| 667 | + v[2] = parseInt(v[2], 10) || 0; | ||
| 668 | + return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false; | ||
| 669 | + } | ||
| 670 | + | ||
| 671 | + /* Cross-browser dynamic CSS creation | ||
| 672 | + - Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php | ||
| 673 | + */ | ||
| 674 | + function createCSS(sel, decl, media, newStyle) { | ||
| 675 | + if (ua.ie && ua.mac) { return; } | ||
| 676 | + var h = doc.getElementsByTagName("head")[0]; | ||
| 677 | + if (!h) { return; } // to also support badly authored HTML pages that lack a head element | ||
| 678 | + var m = (media && typeof media == "string") ? media : "screen"; | ||
| 679 | + if (newStyle) { | ||
| 680 | + dynamicStylesheet = null; | ||
| 681 | + dynamicStylesheetMedia = null; | ||
| 682 | + } | ||
| 683 | + if (!dynamicStylesheet || dynamicStylesheetMedia != m) { | ||
| 684 | + // create dynamic stylesheet + get a global reference to it | ||
| 685 | + var s = createElement("style"); | ||
| 686 | + s.setAttribute("type", "text/css"); | ||
| 687 | + s.setAttribute("media", m); | ||
| 688 | + dynamicStylesheet = h.appendChild(s); | ||
| 689 | + if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) { | ||
| 690 | + dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1]; | ||
| 691 | + } | ||
| 692 | + dynamicStylesheetMedia = m; | ||
| 693 | + } | ||
| 694 | + // add style rule | ||
| 695 | + if (ua.ie && ua.win) { | ||
| 696 | + if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) { | ||
| 697 | + dynamicStylesheet.addRule(sel, decl); | ||
| 698 | + } | ||
| 699 | + } | ||
| 700 | + else { | ||
| 701 | + if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) { | ||
| 702 | + dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}")); | ||
| 703 | + } | ||
| 704 | + } | ||
| 705 | + } | ||
| 706 | + | ||
| 707 | + function setVisibility(id, isVisible) { | ||
| 708 | + if (!autoHideShow) { return; } | ||
| 709 | + var v = isVisible ? "visible" : "hidden"; | ||
| 710 | + if (isDomLoaded && getElementById(id)) { | ||
| 711 | + getElementById(id).style.visibility = v; | ||
| 712 | + } | ||
| 713 | + else { | ||
| 714 | + createCSS("#" + id, "visibility:" + v); | ||
| 715 | + } | ||
| 716 | + } | ||
| 717 | + | ||
| 718 | + /* Filter to avoid XSS attacks | ||
| 719 | + */ | ||
| 720 | + function urlEncodeIfNecessary(s) { | ||
| 721 | + var regex = /[\\\"<>\.;]/; | ||
| 722 | + var hasBadChars = regex.exec(s) != null; | ||
| 723 | + return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s; | ||
| 724 | + } | ||
| 725 | + | ||
| 726 | + /* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only) | ||
| 727 | + */ | ||
| 728 | + var cleanup = function() { | ||
| 729 | + if (ua.ie && ua.win) { | ||
| 730 | + window.attachEvent("onunload", function() { | ||
| 731 | + // remove listeners to avoid memory leaks | ||
| 732 | + var ll = listenersArr.length; | ||
| 733 | + for (var i = 0; i < ll; i++) { | ||
| 734 | + listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]); | ||
| 735 | + } | ||
| 736 | + // cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect | ||
| 737 | + var il = objIdArr.length; | ||
| 738 | + for (var j = 0; j < il; j++) { | ||
| 739 | + removeSWF(objIdArr[j]); | ||
| 740 | + } | ||
| 741 | + // cleanup library's main closures to avoid memory leaks | ||
| 742 | + for (var k in ua) { | ||
| 743 | + ua[k] = null; | ||
| 744 | + } | ||
| 745 | + ua = null; | ||
| 746 | + for (var l in swfobject) { | ||
| 747 | + swfobject[l] = null; | ||
| 748 | + } | ||
| 749 | + swfobject = null; | ||
| 750 | + }); | ||
| 751 | + } | ||
| 752 | + }(); | ||
| 753 | + | ||
| 754 | + return { | ||
| 755 | + /* Public API | ||
| 756 | + - Reference: http://code.google.com/p/swfobject/wiki/documentation | ||
| 757 | + */ | ||
| 758 | + registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr, callbackFn) { | ||
| 759 | + if (ua.w3 && objectIdStr && swfVersionStr) { | ||
| 760 | + var regObj = {}; | ||
| 761 | + regObj.id = objectIdStr; | ||
| 762 | + regObj.swfVersion = swfVersionStr; | ||
| 763 | + regObj.expressInstall = xiSwfUrlStr; | ||
| 764 | + regObj.callbackFn = callbackFn; | ||
| 765 | + regObjArr[regObjArr.length] = regObj; | ||
| 766 | + setVisibility(objectIdStr, false); | ||
| 767 | + } | ||
| 768 | + else if (callbackFn) { | ||
| 769 | + callbackFn({success:false, id:objectIdStr}); | ||
| 770 | + } | ||
| 771 | + }, | ||
| 772 | + | ||
| 773 | + getObjectById: function(objectIdStr) { | ||
| 774 | + if (ua.w3) { | ||
| 775 | + return getObjectById(objectIdStr); | ||
| 776 | + } | ||
| 777 | + }, | ||
| 778 | + | ||
| 779 | + embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) { | ||
| 780 | + var callbackObj = {success:false, id:replaceElemIdStr}; | ||
| 781 | + if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) { | ||
| 782 | + setVisibility(replaceElemIdStr, false); | ||
| 783 | + addDomLoadEvent(function() { | ||
| 784 | + widthStr += ""; // auto-convert to string | ||
| 785 | + heightStr += ""; | ||
| 786 | + var att = {}; | ||
| 787 | + if (attObj && typeof attObj === OBJECT) { | ||
| 788 | + for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs | ||
| 789 | + att[i] = attObj[i]; | ||
| 790 | + } | ||
| 791 | + } | ||
| 792 | + att.data = swfUrlStr; | ||
| 793 | + att.width = widthStr; | ||
| 794 | + att.height = heightStr; | ||
| 795 | + var par = {}; | ||
| 796 | + if (parObj && typeof parObj === OBJECT) { | ||
| 797 | + for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs | ||
| 798 | + par[j] = parObj[j]; | ||
| 799 | + } | ||
| 800 | + } | ||
| 801 | + if (flashvarsObj && typeof flashvarsObj === OBJECT) { | ||
| 802 | + for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs | ||
| 803 | + if (typeof par.flashvars != UNDEF) { | ||
| 804 | + par.flashvars += "&" + k + "=" + flashvarsObj[k]; | ||
| 805 | + } | ||
| 806 | + else { | ||
| 807 | + par.flashvars = k + "=" + flashvarsObj[k]; | ||
| 808 | + } | ||
| 809 | + } | ||
| 810 | + } | ||
| 811 | + if (hasPlayerVersion(swfVersionStr)) { // create SWF | ||
| 812 | + var obj = createSWF(att, par, replaceElemIdStr); | ||
| 813 | + if (att.id == replaceElemIdStr) { | ||
| 814 | + setVisibility(replaceElemIdStr, true); | ||
| 815 | + } | ||
| 816 | + callbackObj.success = true; | ||
| 817 | + callbackObj.ref = obj; | ||
| 818 | + } | ||
| 819 | + else if (xiSwfUrlStr && canExpressInstall()) { // show Adobe Express Install | ||
| 820 | + att.data = xiSwfUrlStr; | ||
| 821 | + showExpressInstall(att, par, replaceElemIdStr, callbackFn); | ||
| 822 | + return; | ||
| 823 | + } | ||
| 824 | + else { // show alternative content | ||
| 825 | + setVisibility(replaceElemIdStr, true); | ||
| 826 | + } | ||
| 827 | + if (callbackFn) { callbackFn(callbackObj); } | ||
| 828 | + }); | ||
| 829 | + } | ||
| 830 | + else if (callbackFn) { callbackFn(callbackObj); } | ||
| 831 | + }, | ||
| 832 | + | ||
| 833 | + switchOffAutoHideShow: function() { | ||
| 834 | + autoHideShow = false; | ||
| 835 | + }, | ||
| 836 | + | ||
| 837 | + ua: ua, | ||
| 838 | + | ||
| 839 | + getFlashPlayerVersion: function() { | ||
| 840 | + return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] }; | ||
| 841 | + }, | ||
| 842 | + | ||
| 843 | + hasFlashPlayerVersion: hasPlayerVersion, | ||
| 844 | + | ||
| 845 | + createSWF: function(attObj, parObj, replaceElemIdStr) { | ||
| 846 | + if (ua.w3) { | ||
| 847 | + return createSWF(attObj, parObj, replaceElemIdStr); | ||
| 848 | + } | ||
| 849 | + else { | ||
| 850 | + return undefined; | ||
| 851 | + } | ||
| 852 | + }, | ||
| 853 | + | ||
| 854 | + showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) { | ||
| 855 | + if (ua.w3 && canExpressInstall()) { | ||
| 856 | + showExpressInstall(att, par, replaceElemIdStr, callbackFn); | ||
| 857 | + } | ||
| 858 | + }, | ||
| 859 | + | ||
| 860 | + removeSWF: function(objElemIdStr) { | ||
| 861 | + if (ua.w3) { | ||
| 862 | + removeSWF(objElemIdStr); | ||
| 863 | + } | ||
| 864 | + }, | ||
| 865 | + | ||
| 866 | + createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) { | ||
| 867 | + if (ua.w3) { | ||
| 868 | + createCSS(selStr, declStr, mediaStr, newStyleBoolean); | ||
| 869 | + } | ||
| 870 | + }, | ||
| 871 | + | ||
| 872 | + addDomLoadEvent: addDomLoadEvent, | ||
| 873 | + | ||
| 874 | + addLoadEvent: addLoadEvent, | ||
| 875 | + | ||
| 876 | + getQueryParamValue: function(param) { | ||
| 877 | + var q = doc.location.search || doc.location.hash; | ||
| 878 | + if (q) { | ||
| 879 | + if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark | ||
| 880 | + if (param == null) { | ||
| 881 | + return urlEncodeIfNecessary(q); | ||
| 882 | + } | ||
| 883 | + var pairs = q.split("&"); | ||
| 884 | + for (var i = 0; i < pairs.length; i++) { | ||
| 885 | + if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) { | ||
| 886 | + return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1))); | ||
| 887 | + } | ||
| 888 | + } | ||
| 889 | + } | ||
| 890 | + return ""; | ||
| 891 | + }, | ||
| 892 | + | ||
| 893 | + // For internal usage only | ||
| 894 | + expressInstallCallback: function() { | ||
| 895 | + if (isExpressInstallActive) { | ||
| 896 | + var obj = getElementById(EXPRESS_INSTALL_ID); | ||
| 897 | + if (obj && storedAltContent) { | ||
| 898 | + obj.parentNode.replaceChild(storedAltContent, obj); | ||
| 899 | + if (storedAltContentId) { | ||
| 900 | + setVisibility(storedAltContentId, true); | ||
| 901 | + if (ua.ie && ua.win) { storedAltContent.style.display = "block"; } | ||
| 902 | + } | ||
| 903 | + if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); } | ||
| 904 | + } | ||
| 905 | + isExpressInstallActive = false; | ||
| 906 | + } | ||
| 907 | + } | ||
| 908 | + }; | ||
| 909 | +}(); |
-
请 注册 或 登录 后发表评论