Changeset 1392
- Timestamp:
- 10/19/10 20:03:42 (3 years ago)
- Location:
- trunk/js
- Files:
-
- 2 added
- 7 edited
-
bin-debug/jwplayer.js (modified) (13 diffs)
-
build/build.xml (modified) (1 diff)
-
jwplayer.min.js (modified) (1 diff)
-
src/api/jwplayer.api.js (modified) (5 diffs)
-
src/embed/jwplayer.embed.js (modified) (4 diffs)
-
src/utils/jwplayer.utils.extensionmap.js (added)
-
src/utils/jwplayer.utils.js (modified) (2 diffs)
-
src/utils/jwplayer.utils.strings.js (modified) (1 diff)
-
test/fallback.html (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/js/bin-debug/jwplayer.js
r1363 r1392 3 3 jwplayer.constructor = function(container) {}; 4 4 5 $jw = jwplayer;jwplayer.utils = function() { 5 $jw = jwplayer; 6 jwplayer.utils = function() { 6 7 }; 7 8 … … 123 124 }; 124 125 126 125 127 /** 126 128 * Detects whether the current browser is mobile Safari. … … 134 136 * Detects whether the browser can handle HTML5 video. 135 137 * Using this as a proxy for detecting all HTML5 features needed for the JW HTML5 Player. Do we need more granularity? 138 * 139 * @param config (optional) If set, check to see if the first playable item 136 140 */ 137 jwplayer.utils.hasHTML5 = function() { 138 return !!document.createElement('video').canPlayType; 139 }; 141 jwplayer.utils.hasHTML5 = function(config) { 142 var vid = document.createElement('video'); 143 144 if (!!vid.canPlayType) { 145 if (config) { 146 var item = {}; 147 if (config.playlist && config.playlist.length) { 148 item.file = config.playlist[0].file; 149 item.levels = config.playlist[0].levels; 150 } else { 151 item.file = config.file; 152 item.levels = config.levels; 153 } 154 155 if (item.file) { 156 return jwplayer.utils.vidCanPlay(vid, item.file); 157 } else if (item.levels && item.levels.length) { 158 for (var i=0; i<item.levels.length; i++) { 159 if (item.levels[i].file && jwplayer.utils.vidCanPlay(vid, item.levels[i].file)) { 160 return true; 161 } 162 } 163 } 164 } else { 165 return true; 166 } 167 } 168 169 return false; 170 }; 171 172 jwplayer.utils.vidCanPlay = function(video, file) { 173 var extension = jwplayer.utils.strings.extension(file); 174 if (jwplayer.utils.extensionmap[extension] !== undefined) { 175 sourceType = jwplayer.utils.extensionmap[extension]; 176 } else { 177 sourceType = 'video/' + extension + ';'; 178 } 179 return video.canPlayType(sourceType); 180 }; 181 182 140 183 141 184 /** … … 349 392 };jwplayer.utils.strings = function(){}; 350 393 394 /** Removes whitespace from the beginning and end of a string **/ 351 395 jwplayer.utils.strings.trim = function(inputString){ 352 396 return inputString.replace(/^\s*/, "").replace(/\s*$/, ""); 353 397 }; 398 399 /** Returns the extension of a file name **/ 400 jwplayer.utils.strings.extension = function(path) { 401 return path.substr(path.lastIndexOf('.') + 1, path.length).toLowerCase(); 402 };/** 403 * JW Player Media Extension to Mime Type mapping 404 * 405 * @author zach 406 * @version 1.0 407 */ 408 (function(jwplayer) { 409 jwplayer.utils.extensionmap = { 410 "3gp": "video/3gpp", 411 "3gpp": "video/3gpp", 412 "3g2": "video/3gpp2", 413 "3gpp2": "video/3gpp2", 414 "flv": "video/x-flv", 415 "f4a": "audio/mp4", 416 "f4b": "audio/mp4", 417 "f4p": "video/mp4", 418 "f4v": "video/mp4", 419 "mov": "video/quicktime", 420 "m4a": "audio/mp4", 421 "m4b": "audio/mp4", 422 "m4p": "audio/mp4", 423 "m4v": "video/mp4", 424 "mkv": "video/x-matroska", 425 "mp4": "video/mp4", 426 "sdp": "application/sdp", 427 "vp6": "video/x-vp6", 428 "aac": "audio/aac", 429 "mp3": "audio/mp3", 430 "ogg": "audio/ogg", 431 "ogv": "video/ogg", 432 "webm": "video/webm" 433 }; 434 })(jwplayer); 354 435 (function(jwplayer) { 355 436 var _players = []; … … 402 483 403 484 var _itemMeta = {}; 485 var _currentItem = 0; 404 486 405 487 /** Use this function to set the internal low-level player. This is a javascript object which contains the low-level API calls. **/ … … 463 545 var translated = jwplayer.utils.extend({}, eventProperties); 464 546 if (type == jwplayer.api.events.JWPLAYER_FULLSCREEN) { 465 translated['fullscreen'] = translated['message']; 466 delete translated['message']; 547 translated.fullscreen = translated.message; 548 delete translated.message; 549 } else if (type == jwplayer.api.events.JWPLAYER_PLAYLIST_ITEM) { 550 if (translated.item && translated.index === undefined) { 551 translated.index = translated.item; 552 delete translated.item; 553 } 467 554 } else if (typeof translated['data'] == "object") { 468 555 // Takes ViewEvent "data" block and moves it up a level … … 501 588 502 589 this.eventListener(jwplayer.api.events.JWPLAYER_PLAYLIST_ITEM, function(data) { 590 if (data.index !== undefined) { 591 // Flash player item event 592 _currentItem = data.index; 593 } else if (data.item !== undefined) { 594 // HTML5 player item event 595 _currentItem = data.item; 596 } 597 // TODO: reconcile API discrepancies 503 598 _itemMeta = {}; 504 599 }); … … 518 613 this.getItemMeta = function() { 519 614 return _itemMeta; 615 }; 616 617 this.getCurrentItem = function() { 618 return _currentItem; 520 619 }; 521 620 … … 556 655 getMeta: function() { return this.getItemMeta(); }, 557 656 getMute: function() { return this.callInternal('jwGetMute'); }, 558 getPlaylist: function() { return this.callInternal('jwGetPlaylist'); }, 657 getPlaylist: function() { 658 var playlist = this.callInternal('jwGetPlaylist'); 659 for (var i=0; i<playlist.length; i++) { 660 if (playlist[i].index === undefined) { 661 playlist[i].index = i; 662 } 663 } 664 return playlist; 665 }, 559 666 getPlaylistItem: function(item) { 560 if (item == undefined) item = 0;667 if (item == undefined) item = this.getCurrentItem(); 561 668 return this.getPlaylist()[item]; 562 669 }, … … 814 921 break; 815 922 case 'html5': 816 if (jwplayer.utils.hasHTML5( )) {923 if (jwplayer.utils.hasHTML5(this.config)) { 817 924 var html5player = jwplayer.embed.embedHTML5(document.getElementById(this.api.id), player, this.config); 818 925 this.api.container = document.getElementById(this.api.id); … … 848 955 var item = this.getPlaylistItem(0); 849 956 if (!item) { 850 item = { file: loadParams.levels[0].file, provider: 'video'};957 item = { file: loadParams.levels[0].file, provider:(loadParams.provider ? loadParams.provider : "video") }; 851 958 } 852 959 if (!item.image) { … … 919 1026 html += '<param name="allowfullscreen" value="true">'; 920 1027 html += '<param name="allowscriptaccess" value="always">'; 1028 html += '<param name="wmode" value="opaque">'; 921 1029 html += '<param name="flashvars" value="' + jwplayer.embed 922 1030 .jsonToFlashvars(params) + '">'; … … 938 1046 jwplayer.embed.appendAttribute(obj, 'allowfullscreen', 'true'); 939 1047 jwplayer.embed.appendAttribute(obj, 'allowscriptaccess', 'always'); 1048 jwplayer.embed.appendAttribute(obj, 'wmode', 'opaque'); 940 1049 jwplayer.embed.appendAttribute(obj, 'flashvars', jwplayer.embed 941 1050 .jsonToFlashvars(params)); -
trunk/js/build/build.xml
r1335 r1392 10 10 <concat destfile="${basedir}/bin-debug/jwplayer.js"> 11 11 <fileset dir="${basedir}/src" includes="jwplayer.js" /> 12 <fileset dir="${basedir}/src/utils" includes="**/*.js" /> 12 <fileset dir="${basedir}/src/utils" includes="**/*.js" excludes="jwplayer.utils.extensionmap.js" /> 13 <fileset dir="${basedir}/src/utils" includes="jwplayer.utils.extensionmap.js" /> 13 14 <fileset dir="${basedir}/src/api" includes="**/*.js" /> 14 15 <fileset dir="${basedir}/src/embed" includes="**/*.js" /> -
trunk/js/jwplayer.min.js
r1363 r1392 1 jwplayer=function(a){return jwplayer.constructor(a)};jwplayer.constructor=function(a){};$jw=jwplayer;jwplayer.utils=function(){};jwplayer.utils.typeOf=function(b){var a=typeof b;if(a==="object"){if(b){if(b instanceof Array){a="array"}}else{a="null"}}return a};jwplayer.utils.extend=function(){var a=jwplayer.utils.extend["arguments"];if(a.length>1){for(var b=1;b<a.length;b++){for(element in a[b]){a[0][element]=a[b][element]}}return a[0]}return null};jwplayer.utils.extension=function(a){return a.substr(a.lastIndexOf(".")+1,a.length).toLowerCase()};jwplayer.utils.html=function(a,b){a.innerHTML=b};jwplayer.utils.append=function(a,b){a.appendChild(b)};jwplayer.utils.wrap=function(a,b){a.parentNode.replaceChild(b,a);b.appendChild(a)};jwplayer.utils.ajax=function(d,c,a){var b;if(window.XMLHttpRequest){b=new XMLHttpRequest()}else{b=new ActiveXObject("Microsoft.XMLHTTP")}b.onreadystatechange=function(){if(b.readyState===4){if(b.status===200){if(c){c(b)}}else{if(a){a(d)}}}};b.open("GET",d,true);b.send(null);return b};jwplayer.utils.load=function(b,c,a){b.onreadystatechange=function(){if(b.readyState===4){if(b.status===200){if(c){c()}}else{if(a){a()}}}}};jwplayer.utils.find=function(b,a){return b.getElementsByTagName(a)};jwplayer.utils.append=function(a,b){a.appendChild(b)};jwplayer.utils.isIE=function(){return(!+"\v1")};jwplayer.utils.isIOS=function(){var a=navigator.userAgent.toLowerCase();return(a.match(/iP(hone|ad)/i)!==null)};jwplayer.utils.hasHTML5=function( ){return !!document.createElement("video").canPlayType};jwplayer.utils.hasFlash=function(){return(typeof navigator.plugins!="undefined"&&typeof navigator.plugins["Shockwave Flash"]!="undefined")||(typeof window.ActiveXObject!="undefined")};(function(e){e.utils.mediaparser=function(){};var g={element:{width:"width",height:"height",id:"id","class":"className",name:"name"},media:{src:"file",preload:"preload",autoplay:"autostart",loop:"repeat",controls:"controls"},source:{src:"file",type:"type",media:"media","data-jw-width":"width","data-jw-bitrate":"bitrate"},video:{poster:"image"}};var f={};e.utils.mediaparser.parseMedia=function(i){return d(i)};function c(j,i){if(i===undefined){i=g[j]}else{e.utils.extend(i,g[j])}return i}function d(m,i){if(f[m.tagName.toLowerCase()]&&(i===undefined)){return f[m.tagName.toLowerCase()](m)}else{i=c("element",i);var n={};for(var j in i){if(j!="length"){var l=m.getAttribute(j);if(!(l===""||l===undefined||l===null)){n[i[j]]=m.getAttribute(j)}}}var k=m.style["#background-color"];if(k&&!(k=="transparent"||k=="rgba(0, 0, 0, 0)")){n.screencolor=k}return n}}function h(o,k){k=c("media",k);var m=[];if(e.utils.isIE()){var l=o.nextSibling;if(l!==undefined){while(l.tagName.toLowerCase()=="source"){m.push(a(l));l=l.nextSibling}}}else{var j=e.utils.selectors("source",o);for(var n in j){if(!isNaN(n)){m.push(a(j[n]))}}}var p=d(o,k);if(p.file!==undefined){m[0]={file:p.file}}p.levels=m;return p}function a(k,j){j=c("source",j);var i=d(k,j);i.width=i.width?i.width:0;i.bitrate=i.bitrate?i.bitrate:0;return i}function b(k,j){j=c("video",j);var i=h(k,j);return i}e.utils.mediaparser.replaceMediaElement=function(i,k){if(e.utils.isIE()){var l=false;var n=[];var m=i.nextSibling;while(m&&!l){n.push(m);if(m.nodeType==1&&m.tagName.toLowerCase()==("/")+i.tagName.toLowerCase()){l=true}m=m.nextSibling}if(l){while(n.length>0){var j=n.pop();j.parentNode.removeChild(j)}}i.outerHTML=k}};f.media=h;f.audio=h;f.source=a;f.video=b})(jwplayer);jwplayer.utils.selectors=function(a,c){if(c===undefined){c=document}a=jwplayer.utils.strings.trim(a);var b=a.charAt(0);if(b=="#"){return c.getElementById(a.substr(1))}else{if(b=="."){if(c.getElementsByClassName){return c.getElementsByClassName(a.substr(1))}else{return jwplayer.utils.selectors.getElementsByTagAndClass("*",a.substr(1))}}else{if(a.indexOf(".")>0){selectors=a.split(".");return jwplayer.utils.selectors.getElementsByTagAndClass(selectors[0],selectors[1])}else{return c.getElementsByTagName(a)}}}return null};jwplayer.utils.selectors.getElementsByTagAndClass=function(d,g,f){elements=[];if(f===undefined){f=document}var e=f.getElementsByTagName(d);for(var c=0;c<e.length;c++){if(e[c].className!==undefined){var b=e[c].className.split(" ");for(var a=0;a<b.length;a++){if(b[a]==g){elements.push(e[c])}}}}return elements};jwplayer.utils.strings=function(){};jwplayer.utils.strings.trim=function(a){return a.replace(/^\s*/,"").replace(/\s*$/,"")};(function(b){var a=[];b.constructor=function(c){return b.api.selectPlayer(c)};b.api=function(){};b.api.events={API_READY:"jwplayerAPIReady",JWPLAYER_READY:"jwplayerReady",JWPLAYER_FULLSCREEN:"jwplayerFullscreen",JWPLAYER_RESIZE:"jwplayerResize",JWPLAYER_ERROR:"jwplayerError",JWPLAYER_MEDIA_BUFFER:"jwplayerMediaBuffer",JWPLAYER_MEDIA_BUFFER_FULL:"jwplayerMediaBufferFull",JWPLAYER_MEDIA_ERROR:"jwplayerMediaError",JWPLAYER_MEDIA_LOADED:"jwplayerMediaLoaded",JWPLAYER_MEDIA_COMPLETE:"jwplayerMediaComplete",JWPLAYER_MEDIA_TIME:"jwplayerMediaTime",JWPLAYER_MEDIA_VOLUME:"jwplayerMediaVolume",JWPLAYER_MEDIA_META:"jwplayerMediaMeta",JWPLAYER_MEDIA_MUTE:"jwplayerMediaMute",JWPLAYER_PLAYER_STATE:"jwplayerPlayerState",JWPLAYER_PLAYLIST_LOADED:"jwplayerPlaylistLoaded",JWPLAYER_PLAYLIST_ITEM:"jwplayerPlaylistItem"};b.api.events.state={BUFFERING:"BUFFERING",IDLE:"IDLE",PAUSED:"PAUSED",PLAYING:"PLAYING"};b.api.PlayerAPI=function(d){this.container=d;this.id=d.id;var j={};var n={};var c=[];var g=undefined;var i=false;var h=[];var l=d.outerHTML;var m={};this.setPlayer=function(o){g=o};this.stateListener=function(o,p){if(!n[o]){n[o]=[];this.eventListener(b.api.events.JWPLAYER_PLAYER_STATE,f(o))}n[o].push(p);return this};function f(o){return function(q){var p=q.newstate,s=q.oldstate;if(p==o){var r=n[p];if(r){for(var t in r){if(typeof r[t]=="function"){r[t].call(this,{oldstate:s,newstate:p})}}}}}}this.addInternalListener=function(o,p){o.jwAddEventListener(p,'function(dat) { jwplayer("'+this.id+'").dispatchEvent("'+p+'", dat); }')};this.eventListener=function(o,p){if(!j[o]){j[o]=[];if(g&&i){this.addInternalListener(g,o)}}j[o].push(p);return this};this.dispatchEvent=function(q){if(j[q]){var p=e(q,arguments[1]);for(var o in j[q]){if(typeof j[q][o]=="function"){j[q][o].call(this,p)}}}};function e(p,o){var q=b.utils.extend({},o);if(p==b.api.events.JWPLAYER_FULLSCREEN){q.fullscreen=q.message;delete q.message}else{if(typeof q.data=="object"){q=b.utils.extend(q,q.data);delete q.data}}return q}this.callInternal=function(p,o){if(i){if(typeof g!="undefined"&&typeof g[p]=="function"){if(o!==undefined){return(g[p])(o)}else{return(g[p])()}}return null}else{h.push({method:p,parameters:o})}};this.playerReady=function(q){i=true;if(!g){this.setPlayer(document.getElementById(q.id))}this.container=document.getElementById(this.id);for(var o in j){this.addInternalListener(g,o)}this.eventListener(b.api.events.JWPLAYER_PLAYLIST_ITEM,function(r){m={}});this.eventListener(b.api.events.JWPLAYER_MEDIA_META,function(r){b.utils.extend(m,r.metadata)});this.dispatchEvent(b.api.events.API_READY);while(h.length>0){var p=h.shift();this.callInternal(p.method,p.parameters)}};this.getItemMeta=function(){return m};this.destroy=function(){j={};h=[];if(this.container.outerHTML!=l){b.api.destroyPlayer(this.id,l)}};function k(q,s,r){var o=[];if(!s){s=0}if(!r){r=q.length-1}for(var p=s;p<=r;p++){o.push(q[p])}return o}};b.api.PlayerAPI.prototype={container:undefined,options:undefined,id:undefined,getBuffer:function(){return this.callInternal("jwGetBuffer")},getDuration:function(){return this.callInternal("jwGetDuration")},getFullscreen:function(){return this.callInternal("jwGetFullscreen")},getHeight:function(){return this.callInternal("jwGetHeight")},getLockState:function(){return this.callInternal("jwGetLockState")},getMeta:function(){return this.getItemMeta()},getMute:function(){return this.callInternal("jwGetMute")},getPlaylist:function(){return this.callInternal("jwGetPlaylist")},getPlaylistItem:function(c){if(c==undefined){c=0}return this.getPlaylist()[c]},getPosition:function(){return this.callInternal("jwGetPosition")},getState:function(){return this.callInternal("jwGetState")},getVolume:function(){return this.callInternal("jwGetVolume")},getWidth:function(){return this.callInternal("jwGetWidth")},setFullscreen:function(c){if(c===undefined){this.callInternal("jwSetFullscreen",true)}else{this.callInternal("jwSetFullscreen",c)}return this},setMute:function(c){if(c===undefined){this.callInternal("jwSetMute",true)}else{this.callInternal("jwSetMute",c)}return this},lock:function(){return this},unlock:function(){return this},load:function(c){this.callInternal("jwLoad",c);return this},playlistItem:function(c){this.callInternal("jwPlaylistItem",c);return this},playlistPrev:function(){this.callInternal("jwPlaylistPrev");return this},playlistNext:function(){this.callInternal("jwPlaylistNext");return this},resize:function(d,c){this.container.width=d;this.container.height=c;return this},play:function(c){if(typeof c==="undefined"){var c=this.getState();if(c==b.api.events.state.PLAYING||c==b.api.events.state.BUFFERING){this.callInternal("jwPause")}else{this.callInternal("jwPlay")}}else{this.callInternal("jwPlay",c)}return this},pause:function(){var c=this.getState();switch(c){case b.api.events.state.PLAYING:case b.api.events.state.BUFFERING:this.callInternal("jwPause");break;case b.api.events.state.PAUSED:this.callInternal("jwPlay");break}return this},stop:function(){this.callInternal("jwStop");return this},seek:function(c){this.callInternal("jwSeek",c);return this},setVolume:function(c){this.callInternal("jwSetVolume",c);return this},onBufferChange:function(c){return this.eventListener(b.api.events.JWPLAYER_MEDIA_BUFFER,c)},onBufferFull:function(c){return this.eventListener(b.api.events.JWPLAYER_MEDIA_BUFFER_FULL,c)},onError:function(c){return this.eventListener(b.api.events.JWPLAYER_ERROR,c)},onFullscreen:function(c){return this.eventListener(b.api.events.JWPLAYER_FULLSCREEN,c)},onMeta:function(c){return this.eventListener(b.api.events.JWPLAYER_MEDIA_META,c)},onMute:function(c){return this.eventListener(b.api.events.JWPLAYER_MEDIA_MUTE,c)},onPlaylist:function(c){return this.eventListener(b.api.events.JWPLAYER_PLAYLIST_LOADED,c)},onPlaylistItem:function(c){return this.eventListener(b.api.events.JWPLAYER_PLAYLIST_ITEM,c)},onReady:function(c){return this.eventListener(b.api.events.API_READY,c)},onResize:function(c){return this.eventListener(b.api.events.JWPLAYER_RESIZE,c)},onComplete:function(c){return this.eventListener(b.api.events.JWPLAYER_MEDIA_COMPLETE,c)},onTime:function(c){return this.eventListener(b.api.events.JWPLAYER_MEDIA_TIME,c)},onVolume:function(c){return this.eventListener(b.api.events.JWPLAYER_MEDIA_VOLUME,c)},onBuffer:function(c){return this.stateListener(b.api.events.state.BUFFERING,c)},onPause:function(c){return this.stateListener(b.api.events.state.PAUSED,c)},onPlay:function(c){return this.stateListener(b.api.events.state.PLAYING,c)},onIdle:function(c){return this.stateListener(b.api.events.state.IDLE,c)},setup:function(c){return this},remove:function(){this.destroy()},initializePlugin:function(c,d){return this}};b.api.selectPlayer=function(d){var c;if(d==undefined){d=0}if(d.nodeType){c=d}else{if(typeof d=="string"){c=document.getElementById(d)}}if(c){var e=b.api.playerById(c.id);if(e){return e}else{return b.api.addPlayer(new b.api.PlayerAPI(c))}}else{if(typeof d=="number"){return b.getPlayers()[d]}}return null};b.api.playerById=function(d){for(var c in a){if(a[c].id==d){return a[c]}}return null};b.api.addPlayer=function(d){for(var c in a){if(a[c]==d){return d}}a.push(d);return d};b.api.destroyPlayer=function(f,d){var e=-1;for(var h in a){if(a[h].id==f){e=h;continue}}if(e>=0){var c=document.getElementById(a[e].id);if(c){if(d){c.outerHTML=d}else{var g=document.createElement("div");g.setAttribute("id",c.id);c.parentNode.replaceChild(g,c)}}a.splice(e,1)}return null};b.getPlayers=function(){return a.slice(0)}})(jwplayer);var _userPlayerReady=(typeof playerReady=="function")?playerReady:undefined;playerReady=function(b){var a=jwplayer.api.playerById(b.id);if(a){a.playerReady(b)}if(_userPlayerReady){_userPlayerReady.call(this,b)}};(function(a){a.embed=function(){};a.embed.Embedder=function(c){this.constructor(c)};a.embed.defaults={width:400,height:300,players:[{type:"flash",src:"player.swf"},{type:"html5"}],components:{controlbar:{position:"over"}}};a.embed.Embedder.prototype={config:undefined,api:undefined,events:{},players:undefined,constructor:function(d){this.api=d;var c=a.utils.mediaparser.parseMedia(this.api.container);this.config=this.parseConfig(a.utils.extend({},a.embed.defaults,c,this.api.config))},embedPlayer:function(){var c=this.players[0];if(c&&c.type){switch(c.type){case"flash":if(a.utils.hasFlash()){if(this.config.file&&!this.config.provider){switch(a.utils.extension(this.config.file).toLowerCase()){case"webm":case"ogv":case"ogg":this.config.provider="video";break}}if(this.config.levels||this.config.playlist){this.api.onReady(this.loadAfterReady(this.config))}this.config.id=this.api.id;var e=a.embed.embedFlash(document.getElementById(this.api.id),c,this.config);this.api.container=e;this.api.setPlayer(e)}else{this.players.splice(0,1);return this.embedPlayer()}break;case"html5":if(a.utils.hasHTML5()){var d=a.embed.embedHTML5(document.getElementById(this.api.id),c,this.config);this.api.container=document.getElementById(this.api.id);this.api.setPlayer(d)}else{this.players.splice(0,1);return this.embedPlayer()}break}}else{this.api.container.innerHTML="<p>No suitable players found</p>"}this.setupEvents();return this.api},setupEvents:function(){for(evt in this.events){if(typeof this.api[evt]=="function"){(this.api[evt]).call(this.api,this.events[evt])}}},loadAfterReady:function(c){return function(e){if(c.playlist){this.load(c.playlist)}else{if(c.levels){var d=this.getPlaylistItem(0);if(!d){d={file:c.levels[0].file,provider:"video"}}if(!d.image){d.image=c.image}d.levels=c.levels;this.load(d)}}}},parseConfig:function(c){var d=a.utils.extend({},c);if(d.events){this.events=d.events;delete d.events}if(d.players){this.players=d.players;delete d.players}if(d.plugins){if(typeof d.plugins=="object"){d=a.utils.extend(d,a.embed.parsePlugins(d.plugins))}}if(d.playlist&&typeof d.playlist==="string"&&!d["playlist.position"]){d["playlist.position"]=d.playlist;delete d.playlist}if(d.controlbar&&typeof d.controlbar==="string"&&!d["controlbar.position"]){d["controlbar.position"]=d.controlbar;delete d.controlbar}return d}};a.embed.embedFlash=function(e,i,d){var j=a.utils.extend({},d);var g=j.width;delete j.width;var c=j.height;delete j.height;delete j.levels;delete j.playlist;a.embed.parseConfigBlock(j,"components");a.embed.parseConfigBlock(j,"providers");if(a.utils.isIE()){var f='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+g+'" height="'+c+'" id="'+e.id+'" name="'+e.id+'">';f+='<param name="movie" value="'+i.src+'">';f+='<param name="allowfullscreen" value="true">';f+='<param name="allowscriptaccess" value="always">';f+='<param name="flashvars" value="'+a.embed.jsonToFlashvars(j)+'">';f+="</object>";if(e.tagName.toLowerCase()=="video"){a.utils.mediaparser.replaceMediaElement(e,f)}else{e.outerHTML=f}return document.getElementById(e.id)}else{var h=document.createElement("object");h.setAttribute("type","application/x-shockwave-flash");h.setAttribute("data",i.src);h.setAttribute("width",g);h.setAttribute("height",c);h.setAttribute("id",e.id);h.setAttribute("name",e.id);a.embed.appendAttribute(h,"allowfullscreen","true");a.embed.appendAttribute(h,"allowscriptaccess","always");a.embed.appendAttribute(h,"flashvars",a.embed.jsonToFlashvars(j));e.parentNode.replaceChild(h,e);return h}};a.embed.embedHTML5=function(d,f,e){if(a.html5){d.innerHTML="";var c=a.utils.extend({screencolor:"0x000000"},e);a.embed.parseConfigBlock(c,"components");if(c.levels&&!c.sources){c.sources=e.levels}if(c.skin&&c.skin.toLowerCase().indexOf(".zip")>0){c.skin=c.skin.replace(/\.zip/i,".xml")}return new (a.html5(d)).setup(c)}else{return null}};a.embed.appendAttribute=function(d,c,e){var f=document.createElement("param");f.setAttribute("name",c);f.setAttribute("value",e);d.appendChild(f)};a.embed.jsonToFlashvars=function(d){var c="";for(key in d){c+=key+"="+escape(d[key])+"&"}return c.substring(0,c.length-1)};a.embed.parsePlugins=function(e){if(!e){return{}}var g={},f=[];for(plugin in e){var d=plugin.indexOf("-")>0?plugin.substring(0,plugin.indexOf("-")):plugin;var c=e[plugin];f.push(plugin);for(param in c){g[d+"."+param]=c[param]}}g.plugins=f.join(",");return g};a.embed.parseConfigBlock=function(f,e){if(f[e]){var h=f[e];for(var d in h){var c=h[d];if(typeof c=="string"){if(!f[d]){f[d]=c}}else{for(var g in c){if(!f[d+"."+g]){f[d+"."+g]=c[g]}}}}delete f[e]}};a.api.PlayerAPI.prototype.setup=function(d,e){if(d&&d.flashplayer&&!d.players){d.players=[{type:"flash",src:d.flashplayer},{type:"html5"}];delete d.flashplayer}if(e&&!d.players){if(typeof e=="string"){d.players=[{type:"flash",src:e}]}else{if(e instanceof Array){d.players=e}else{if(typeof e=="object"&&e.type){d.players=[e]}}}}var c=this.id;this.remove();var f=a(c);f.config=d;return(new a.embed.Embedder(f)).embedPlayer()};function b(){if(!document.body){return setTimeout(b,15)}var c=a.utils.selectors.getElementsByTagAndClass("video","jwplayer");for(var d=0;d<c.length;d++){var e=c[d];a(e.id).setup({players:[{type:"flash",src:"/jwplayer/player.swf"},{type:"html5"}]})}}b()})(jwplayer);1 jwplayer=function(a){return jwplayer.constructor(a)};jwplayer.constructor=function(a){};$jw=jwplayer;jwplayer.utils=function(){};jwplayer.utils.typeOf=function(b){var a=typeof b;if(a==="object"){if(b){if(b instanceof Array){a="array"}}else{a="null"}}return a};jwplayer.utils.extend=function(){var a=jwplayer.utils.extend["arguments"];if(a.length>1){for(var b=1;b<a.length;b++){for(element in a[b]){a[0][element]=a[b][element]}}return a[0]}return null};jwplayer.utils.extension=function(a){return a.substr(a.lastIndexOf(".")+1,a.length).toLowerCase()};jwplayer.utils.html=function(a,b){a.innerHTML=b};jwplayer.utils.append=function(a,b){a.appendChild(b)};jwplayer.utils.wrap=function(a,b){a.parentNode.replaceChild(b,a);b.appendChild(a)};jwplayer.utils.ajax=function(d,c,a){var b;if(window.XMLHttpRequest){b=new XMLHttpRequest()}else{b=new ActiveXObject("Microsoft.XMLHTTP")}b.onreadystatechange=function(){if(b.readyState===4){if(b.status===200){if(c){c(b)}}else{if(a){a(d)}}}};b.open("GET",d,true);b.send(null);return b};jwplayer.utils.load=function(b,c,a){b.onreadystatechange=function(){if(b.readyState===4){if(b.status===200){if(c){c()}}else{if(a){a()}}}}};jwplayer.utils.find=function(b,a){return b.getElementsByTagName(a)};jwplayer.utils.append=function(a,b){a.appendChild(b)};jwplayer.utils.isIE=function(){return(!+"\v1")};jwplayer.utils.isIOS=function(){var a=navigator.userAgent.toLowerCase();return(a.match(/iP(hone|ad)/i)!==null)};jwplayer.utils.hasHTML5=function(b){var a=document.createElement("video");if(!!a.canPlayType){if(b){var d={};if(b.playlist&&b.playlist.length){d.file=b.playlist[0].file;d.levels=b.playlist[0].levels}else{d.file=b.file;d.levels=b.levels}if(d.file){return jwplayer.utils.vidCanPlay(a,d.file)}else{if(d.levels&&d.levels.length){for(var c=0;c<d.levels.length;c++){if(d.levels[c].file&&jwplayer.utils.vidCanPlay(a,d.levels[c].file)){return true}}}}}else{return true}}return false};jwplayer.utils.vidCanPlay=function(b,a){var c=jwplayer.utils.strings.extension(a);if(jwplayer.utils.extensionmap[c]!==undefined){sourceType=jwplayer.utils.extensionmap[c]}else{sourceType="video/"+c+";"}return b.canPlayType(sourceType)};jwplayer.utils.hasFlash=function(){return(typeof navigator.plugins!="undefined"&&typeof navigator.plugins["Shockwave Flash"]!="undefined")||(typeof window.ActiveXObject!="undefined")};(function(e){e.utils.mediaparser=function(){};var g={element:{width:"width",height:"height",id:"id","class":"className",name:"name"},media:{src:"file",preload:"preload",autoplay:"autostart",loop:"repeat",controls:"controls"},source:{src:"file",type:"type",media:"media","data-jw-width":"width","data-jw-bitrate":"bitrate"},video:{poster:"image"}};var f={};e.utils.mediaparser.parseMedia=function(i){return d(i)};function c(j,i){if(i===undefined){i=g[j]}else{e.utils.extend(i,g[j])}return i}function d(m,i){if(f[m.tagName.toLowerCase()]&&(i===undefined)){return f[m.tagName.toLowerCase()](m)}else{i=c("element",i);var n={};for(var j in i){if(j!="length"){var l=m.getAttribute(j);if(!(l===""||l===undefined||l===null)){n[i[j]]=m.getAttribute(j)}}}var k=m.style["#background-color"];if(k&&!(k=="transparent"||k=="rgba(0, 0, 0, 0)")){n.screencolor=k}return n}}function h(o,k){k=c("media",k);var m=[];if(e.utils.isIE()){var l=o.nextSibling;if(l!==undefined){while(l.tagName.toLowerCase()=="source"){m.push(a(l));l=l.nextSibling}}}else{var j=e.utils.selectors("source",o);for(var n in j){if(!isNaN(n)){m.push(a(j[n]))}}}var p=d(o,k);if(p.file!==undefined){m[0]={file:p.file}}p.levels=m;return p}function a(k,j){j=c("source",j);var i=d(k,j);i.width=i.width?i.width:0;i.bitrate=i.bitrate?i.bitrate:0;return i}function b(k,j){j=c("video",j);var i=h(k,j);return i}e.utils.mediaparser.replaceMediaElement=function(i,k){if(e.utils.isIE()){var l=false;var n=[];var m=i.nextSibling;while(m&&!l){n.push(m);if(m.nodeType==1&&m.tagName.toLowerCase()==("/")+i.tagName.toLowerCase()){l=true}m=m.nextSibling}if(l){while(n.length>0){var j=n.pop();j.parentNode.removeChild(j)}}i.outerHTML=k}};f.media=h;f.audio=h;f.source=a;f.video=b})(jwplayer);jwplayer.utils.selectors=function(a,c){if(c===undefined){c=document}a=jwplayer.utils.strings.trim(a);var b=a.charAt(0);if(b=="#"){return c.getElementById(a.substr(1))}else{if(b=="."){if(c.getElementsByClassName){return c.getElementsByClassName(a.substr(1))}else{return jwplayer.utils.selectors.getElementsByTagAndClass("*",a.substr(1))}}else{if(a.indexOf(".")>0){selectors=a.split(".");return jwplayer.utils.selectors.getElementsByTagAndClass(selectors[0],selectors[1])}else{return c.getElementsByTagName(a)}}}return null};jwplayer.utils.selectors.getElementsByTagAndClass=function(d,g,f){elements=[];if(f===undefined){f=document}var e=f.getElementsByTagName(d);for(var c=0;c<e.length;c++){if(e[c].className!==undefined){var b=e[c].className.split(" ");for(var a=0;a<b.length;a++){if(b[a]==g){elements.push(e[c])}}}}return elements};jwplayer.utils.strings=function(){};jwplayer.utils.strings.trim=function(a){return a.replace(/^\s*/,"").replace(/\s*$/,"")};jwplayer.utils.strings.extension=function(a){return a.substr(a.lastIndexOf(".")+1,a.length).toLowerCase()};(function(a){a.utils.extensionmap={"3gp":"video/3gpp","3gpp":"video/3gpp","3g2":"video/3gpp2","3gpp2":"video/3gpp2",flv:"video/x-flv",f4a:"audio/mp4",f4b:"audio/mp4",f4p:"video/mp4",f4v:"video/mp4",mov:"video/quicktime",m4a:"audio/mp4",m4b:"audio/mp4",m4p:"audio/mp4",m4v:"video/mp4",mkv:"video/x-matroska",mp4:"video/mp4",sdp:"application/sdp",vp6:"video/x-vp6",aac:"audio/aac",mp3:"audio/mp3",ogg:"audio/ogg",ogv:"video/ogg",webm:"video/webm"}})(jwplayer);(function(b){var a=[];b.constructor=function(c){return b.api.selectPlayer(c)};b.api=function(){};b.api.events={API_READY:"jwplayerAPIReady",JWPLAYER_READY:"jwplayerReady",JWPLAYER_FULLSCREEN:"jwplayerFullscreen",JWPLAYER_RESIZE:"jwplayerResize",JWPLAYER_ERROR:"jwplayerError",JWPLAYER_MEDIA_BUFFER:"jwplayerMediaBuffer",JWPLAYER_MEDIA_BUFFER_FULL:"jwplayerMediaBufferFull",JWPLAYER_MEDIA_ERROR:"jwplayerMediaError",JWPLAYER_MEDIA_LOADED:"jwplayerMediaLoaded",JWPLAYER_MEDIA_COMPLETE:"jwplayerMediaComplete",JWPLAYER_MEDIA_TIME:"jwplayerMediaTime",JWPLAYER_MEDIA_VOLUME:"jwplayerMediaVolume",JWPLAYER_MEDIA_META:"jwplayerMediaMeta",JWPLAYER_MEDIA_MUTE:"jwplayerMediaMute",JWPLAYER_PLAYER_STATE:"jwplayerPlayerState",JWPLAYER_PLAYLIST_LOADED:"jwplayerPlaylistLoaded",JWPLAYER_PLAYLIST_ITEM:"jwplayerPlaylistItem"};b.api.events.state={BUFFERING:"BUFFERING",IDLE:"IDLE",PAUSED:"PAUSED",PLAYING:"PLAYING"};b.api.PlayerAPI=function(d){this.container=d;this.id=d.id;var j={};var o={};var c=[];var g=undefined;var i=false;var h=[];var m=d.outerHTML;var n={};var k=0;this.setPlayer=function(p){g=p};this.stateListener=function(p,q){if(!o[p]){o[p]=[];this.eventListener(b.api.events.JWPLAYER_PLAYER_STATE,f(p))}o[p].push(q);return this};function f(p){return function(r){var q=r.newstate,t=r.oldstate;if(q==p){var s=o[q];if(s){for(var u in s){if(typeof s[u]=="function"){s[u].call(this,{oldstate:t,newstate:q})}}}}}}this.addInternalListener=function(p,q){p.jwAddEventListener(q,'function(dat) { jwplayer("'+this.id+'").dispatchEvent("'+q+'", dat); }')};this.eventListener=function(p,q){if(!j[p]){j[p]=[];if(g&&i){this.addInternalListener(g,p)}}j[p].push(q);return this};this.dispatchEvent=function(r){if(j[r]){var q=e(r,arguments[1]);for(var p in j[r]){if(typeof j[r][p]=="function"){j[r][p].call(this,q)}}}};function e(q,p){var r=b.utils.extend({},p);if(q==b.api.events.JWPLAYER_FULLSCREEN){r.fullscreen=r.message;delete r.message}else{if(q==b.api.events.JWPLAYER_PLAYLIST_ITEM){if(r.item&&r.index===undefined){r.index=r.item;delete r.item}}else{if(typeof r.data=="object"){r=b.utils.extend(r,r.data);delete r.data}}}return r}this.callInternal=function(q,p){if(i){if(typeof g!="undefined"&&typeof g[q]=="function"){if(p!==undefined){return(g[q])(p)}else{return(g[q])()}}return null}else{h.push({method:q,parameters:p})}};this.playerReady=function(r){i=true;if(!g){this.setPlayer(document.getElementById(r.id))}this.container=document.getElementById(this.id);for(var p in j){this.addInternalListener(g,p)}this.eventListener(b.api.events.JWPLAYER_PLAYLIST_ITEM,function(s){if(s.index!==undefined){k=s.index}else{if(s.item!==undefined){k=s.item}}n={}});this.eventListener(b.api.events.JWPLAYER_MEDIA_META,function(s){b.utils.extend(n,s.metadata)});this.dispatchEvent(b.api.events.API_READY);while(h.length>0){var q=h.shift();this.callInternal(q.method,q.parameters)}};this.getItemMeta=function(){return n};this.getCurrentItem=function(){return k};this.destroy=function(){j={};h=[];if(this.container.outerHTML!=m){b.api.destroyPlayer(this.id,m)}};function l(r,t,s){var p=[];if(!t){t=0}if(!s){s=r.length-1}for(var q=t;q<=s;q++){p.push(r[q])}return p}};b.api.PlayerAPI.prototype={container:undefined,options:undefined,id:undefined,getBuffer:function(){return this.callInternal("jwGetBuffer")},getDuration:function(){return this.callInternal("jwGetDuration")},getFullscreen:function(){return this.callInternal("jwGetFullscreen")},getHeight:function(){return this.callInternal("jwGetHeight")},getLockState:function(){return this.callInternal("jwGetLockState")},getMeta:function(){return this.getItemMeta()},getMute:function(){return this.callInternal("jwGetMute")},getPlaylist:function(){var d=this.callInternal("jwGetPlaylist");for(var c=0;c<d.length;c++){if(d[c].index===undefined){d[c].index=c}}return d},getPlaylistItem:function(c){if(c==undefined){c=this.getCurrentItem()}return this.getPlaylist()[c]},getPosition:function(){return this.callInternal("jwGetPosition")},getState:function(){return this.callInternal("jwGetState")},getVolume:function(){return this.callInternal("jwGetVolume")},getWidth:function(){return this.callInternal("jwGetWidth")},setFullscreen:function(c){if(c===undefined){this.callInternal("jwSetFullscreen",true)}else{this.callInternal("jwSetFullscreen",c)}return this},setMute:function(c){if(c===undefined){this.callInternal("jwSetMute",true)}else{this.callInternal("jwSetMute",c)}return this},lock:function(){return this},unlock:function(){return this},load:function(c){this.callInternal("jwLoad",c);return this},playlistItem:function(c){this.callInternal("jwPlaylistItem",c);return this},playlistPrev:function(){this.callInternal("jwPlaylistPrev");return this},playlistNext:function(){this.callInternal("jwPlaylistNext");return this},resize:function(d,c){this.container.width=d;this.container.height=c;return this},play:function(c){if(typeof c==="undefined"){var c=this.getState();if(c==b.api.events.state.PLAYING||c==b.api.events.state.BUFFERING){this.callInternal("jwPause")}else{this.callInternal("jwPlay")}}else{this.callInternal("jwPlay",c)}return this},pause:function(){var c=this.getState();switch(c){case b.api.events.state.PLAYING:case b.api.events.state.BUFFERING:this.callInternal("jwPause");break;case b.api.events.state.PAUSED:this.callInternal("jwPlay");break}return this},stop:function(){this.callInternal("jwStop");return this},seek:function(c){this.callInternal("jwSeek",c);return this},setVolume:function(c){this.callInternal("jwSetVolume",c);return this},onBufferChange:function(c){return this.eventListener(b.api.events.JWPLAYER_MEDIA_BUFFER,c)},onBufferFull:function(c){return this.eventListener(b.api.events.JWPLAYER_MEDIA_BUFFER_FULL,c)},onError:function(c){return this.eventListener(b.api.events.JWPLAYER_ERROR,c)},onFullscreen:function(c){return this.eventListener(b.api.events.JWPLAYER_FULLSCREEN,c)},onMeta:function(c){return this.eventListener(b.api.events.JWPLAYER_MEDIA_META,c)},onMute:function(c){return this.eventListener(b.api.events.JWPLAYER_MEDIA_MUTE,c)},onPlaylist:function(c){return this.eventListener(b.api.events.JWPLAYER_PLAYLIST_LOADED,c)},onPlaylistItem:function(c){return this.eventListener(b.api.events.JWPLAYER_PLAYLIST_ITEM,c)},onReady:function(c){return this.eventListener(b.api.events.API_READY,c)},onResize:function(c){return this.eventListener(b.api.events.JWPLAYER_RESIZE,c)},onComplete:function(c){return this.eventListener(b.api.events.JWPLAYER_MEDIA_COMPLETE,c)},onTime:function(c){return this.eventListener(b.api.events.JWPLAYER_MEDIA_TIME,c)},onVolume:function(c){return this.eventListener(b.api.events.JWPLAYER_MEDIA_VOLUME,c)},onBuffer:function(c){return this.stateListener(b.api.events.state.BUFFERING,c)},onPause:function(c){return this.stateListener(b.api.events.state.PAUSED,c)},onPlay:function(c){return this.stateListener(b.api.events.state.PLAYING,c)},onIdle:function(c){return this.stateListener(b.api.events.state.IDLE,c)},setup:function(c){return this},remove:function(){this.destroy()},initializePlugin:function(c,d){return this}};b.api.selectPlayer=function(d){var c;if(d==undefined){d=0}if(d.nodeType){c=d}else{if(typeof d=="string"){c=document.getElementById(d)}}if(c){var e=b.api.playerById(c.id);if(e){return e}else{return b.api.addPlayer(new b.api.PlayerAPI(c))}}else{if(typeof d=="number"){return b.getPlayers()[d]}}return null};b.api.playerById=function(d){for(var c in a){if(a[c].id==d){return a[c]}}return null};b.api.addPlayer=function(d){for(var c in a){if(a[c]==d){return d}}a.push(d);return d};b.api.destroyPlayer=function(f,d){var e=-1;for(var h in a){if(a[h].id==f){e=h;continue}}if(e>=0){var c=document.getElementById(a[e].id);if(c){if(d){c.outerHTML=d}else{var g=document.createElement("div");g.setAttribute("id",c.id);c.parentNode.replaceChild(g,c)}}a.splice(e,1)}return null};b.getPlayers=function(){return a.slice(0)}})(jwplayer);var _userPlayerReady=(typeof playerReady=="function")?playerReady:undefined;playerReady=function(b){var a=jwplayer.api.playerById(b.id);if(a){a.playerReady(b)}if(_userPlayerReady){_userPlayerReady.call(this,b)}};(function(a){a.embed=function(){};a.embed.Embedder=function(c){this.constructor(c)};a.embed.defaults={width:400,height:300,players:[{type:"flash",src:"player.swf"},{type:"html5"}],components:{controlbar:{position:"over"}}};a.embed.Embedder.prototype={config:undefined,api:undefined,events:{},players:undefined,constructor:function(d){this.api=d;var c=a.utils.mediaparser.parseMedia(this.api.container);this.config=this.parseConfig(a.utils.extend({},a.embed.defaults,c,this.api.config))},embedPlayer:function(){var c=this.players[0];if(c&&c.type){switch(c.type){case"flash":if(a.utils.hasFlash()){if(this.config.file&&!this.config.provider){switch(a.utils.extension(this.config.file).toLowerCase()){case"webm":case"ogv":case"ogg":this.config.provider="video";break}}if(this.config.levels||this.config.playlist){this.api.onReady(this.loadAfterReady(this.config))}this.config.id=this.api.id;var e=a.embed.embedFlash(document.getElementById(this.api.id),c,this.config);this.api.container=e;this.api.setPlayer(e)}else{this.players.splice(0,1);return this.embedPlayer()}break;case"html5":if(a.utils.hasHTML5(this.config)){var d=a.embed.embedHTML5(document.getElementById(this.api.id),c,this.config);this.api.container=document.getElementById(this.api.id);this.api.setPlayer(d)}else{this.players.splice(0,1);return this.embedPlayer()}break}}else{this.api.container.innerHTML="<p>No suitable players found</p>"}this.setupEvents();return this.api},setupEvents:function(){for(evt in this.events){if(typeof this.api[evt]=="function"){(this.api[evt]).call(this.api,this.events[evt])}}},loadAfterReady:function(c){return function(e){if(c.playlist){this.load(c.playlist)}else{if(c.levels){var d=this.getPlaylistItem(0);if(!d){d={file:c.levels[0].file,provider:(c.provider?c.provider:"video")}}if(!d.image){d.image=c.image}d.levels=c.levels;this.load(d)}}}},parseConfig:function(c){var d=a.utils.extend({},c);if(d.events){this.events=d.events;delete d.events}if(d.players){this.players=d.players;delete d.players}if(d.plugins){if(typeof d.plugins=="object"){d=a.utils.extend(d,a.embed.parsePlugins(d.plugins))}}if(d.playlist&&typeof d.playlist==="string"&&!d["playlist.position"]){d["playlist.position"]=d.playlist;delete d.playlist}if(d.controlbar&&typeof d.controlbar==="string"&&!d["controlbar.position"]){d["controlbar.position"]=d.controlbar;delete d.controlbar}return d}};a.embed.embedFlash=function(e,i,d){var j=a.utils.extend({},d);var g=j.width;delete j.width;var c=j.height;delete j.height;delete j.levels;delete j.playlist;a.embed.parseConfigBlock(j,"components");a.embed.parseConfigBlock(j,"providers");if(a.utils.isIE()){var f='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+g+'" height="'+c+'" id="'+e.id+'" name="'+e.id+'">';f+='<param name="movie" value="'+i.src+'">';f+='<param name="allowfullscreen" value="true">';f+='<param name="allowscriptaccess" value="always">';f+='<param name="wmode" value="opaque">';f+='<param name="flashvars" value="'+a.embed.jsonToFlashvars(j)+'">';f+="</object>";if(e.tagName.toLowerCase()=="video"){a.utils.mediaparser.replaceMediaElement(e,f)}else{e.outerHTML=f}return document.getElementById(e.id)}else{var h=document.createElement("object");h.setAttribute("type","application/x-shockwave-flash");h.setAttribute("data",i.src);h.setAttribute("width",g);h.setAttribute("height",c);h.setAttribute("id",e.id);h.setAttribute("name",e.id);a.embed.appendAttribute(h,"allowfullscreen","true");a.embed.appendAttribute(h,"allowscriptaccess","always");a.embed.appendAttribute(h,"wmode","opaque");a.embed.appendAttribute(h,"flashvars",a.embed.jsonToFlashvars(j));e.parentNode.replaceChild(h,e);return h}};a.embed.embedHTML5=function(d,f,e){if(a.html5){d.innerHTML="";var c=a.utils.extend({screencolor:"0x000000"},e);a.embed.parseConfigBlock(c,"components");if(c.levels&&!c.sources){c.sources=e.levels}if(c.skin&&c.skin.toLowerCase().indexOf(".zip")>0){c.skin=c.skin.replace(/\.zip/i,".xml")}return new (a.html5(d)).setup(c)}else{return null}};a.embed.appendAttribute=function(d,c,e){var f=document.createElement("param");f.setAttribute("name",c);f.setAttribute("value",e);d.appendChild(f)};a.embed.jsonToFlashvars=function(d){var c="";for(key in d){c+=key+"="+escape(d[key])+"&"}return c.substring(0,c.length-1)};a.embed.parsePlugins=function(e){if(!e){return{}}var g={},f=[];for(plugin in e){var d=plugin.indexOf("-")>0?plugin.substring(0,plugin.indexOf("-")):plugin;var c=e[plugin];f.push(plugin);for(param in c){g[d+"."+param]=c[param]}}g.plugins=f.join(",");return g};a.embed.parseConfigBlock=function(f,e){if(f[e]){var h=f[e];for(var d in h){var c=h[d];if(typeof c=="string"){if(!f[d]){f[d]=c}}else{for(var g in c){if(!f[d+"."+g]){f[d+"."+g]=c[g]}}}}delete f[e]}};a.api.PlayerAPI.prototype.setup=function(d,e){if(d&&d.flashplayer&&!d.players){d.players=[{type:"flash",src:d.flashplayer},{type:"html5"}];delete d.flashplayer}if(e&&!d.players){if(typeof e=="string"){d.players=[{type:"flash",src:e}]}else{if(e instanceof Array){d.players=e}else{if(typeof e=="object"&&e.type){d.players=[e]}}}}var c=this.id;this.remove();var f=a(c);f.config=d;return(new a.embed.Embedder(f)).embedPlayer()};function b(){if(!document.body){return setTimeout(b,15)}var c=a.utils.selectors.getElementsByTagAndClass("video","jwplayer");for(var d=0;d<c.length;d++){var e=c[d];a(e.id).setup({players:[{type:"flash",src:"/jwplayer/player.swf"},{type:"html5"}]})}}b()})(jwplayer); -
trunk/js/src/api/jwplayer.api.js
r1354 r1392 49 49 50 50 var _itemMeta = {}; 51 var _currentItem = 0; 51 52 52 53 /** Use this function to set the internal low-level player. This is a javascript object which contains the low-level API calls. **/ … … 110 111 var translated = jwplayer.utils.extend({}, eventProperties); 111 112 if (type == jwplayer.api.events.JWPLAYER_FULLSCREEN) { 112 translated['fullscreen'] = translated['message']; 113 delete translated['message']; 113 translated.fullscreen = translated.message; 114 delete translated.message; 115 } else if (type == jwplayer.api.events.JWPLAYER_PLAYLIST_ITEM) { 116 if (translated.item && translated.index === undefined) { 117 translated.index = translated.item; 118 delete translated.item; 119 } 114 120 } else if (typeof translated['data'] == "object") { 115 121 // Takes ViewEvent "data" block and moves it up a level … … 148 154 149 155 this.eventListener(jwplayer.api.events.JWPLAYER_PLAYLIST_ITEM, function(data) { 156 if (data.index !== undefined) { 157 // Flash player item event 158 _currentItem = data.index; 159 } else if (data.item !== undefined) { 160 // HTML5 player item event 161 _currentItem = data.item; 162 } 163 // TODO: reconcile API discrepancies 150 164 _itemMeta = {}; 151 165 }); … … 165 179 this.getItemMeta = function() { 166 180 return _itemMeta; 181 }; 182 183 this.getCurrentItem = function() { 184 return _currentItem; 167 185 }; 168 186 … … 203 221 getMeta: function() { return this.getItemMeta(); }, 204 222 getMute: function() { return this.callInternal('jwGetMute'); }, 205 getPlaylist: function() { return this.callInternal('jwGetPlaylist'); }, 223 getPlaylist: function() { 224 var playlist = this.callInternal('jwGetPlaylist'); 225 for (var i=0; i<playlist.length; i++) { 226 if (playlist[i].index === undefined) { 227 playlist[i].index = i; 228 } 229 } 230 return playlist; 231 }, 206 232 getPlaylistItem: function(item) { 207 if (item == undefined) item = 0;233 if (item == undefined) item = this.getCurrentItem(); 208 234 return this.getPlaylist()[item]; 209 235 }, -
trunk/js/src/embed/jwplayer.embed.js
r1357 r1392 67 67 break; 68 68 case 'html5': 69 if (jwplayer.utils.hasHTML5( )) {69 if (jwplayer.utils.hasHTML5(this.config)) { 70 70 var html5player = jwplayer.embed.embedHTML5(document.getElementById(this.api.id), player, this.config); 71 71 this.api.container = document.getElementById(this.api.id); … … 101 101 var item = this.getPlaylistItem(0); 102 102 if (!item) { 103 item = { file: loadParams.levels[0].file, provider: 'video'};103 item = { file: loadParams.levels[0].file, provider:(loadParams.provider ? loadParams.provider : "video") }; 104 104 } 105 105 if (!item.image) { … … 172 172 html += '<param name="allowfullscreen" value="true">'; 173 173 html += '<param name="allowscriptaccess" value="always">'; 174 html += '<param name="wmode" value="opaque">'; 174 175 html += '<param name="flashvars" value="' + jwplayer.embed 175 176 .jsonToFlashvars(params) + '">'; … … 191 192 jwplayer.embed.appendAttribute(obj, 'allowfullscreen', 'true'); 192 193 jwplayer.embed.appendAttribute(obj, 'allowscriptaccess', 'always'); 194 jwplayer.embed.appendAttribute(obj, 'wmode', 'opaque'); 193 195 jwplayer.embed.appendAttribute(obj, 'flashvars', jwplayer.embed 194 196 .jsonToFlashvars(params)); -
trunk/js/src/utils/jwplayer.utils.js
r1348 r1392 119 119 }; 120 120 121 121 122 /** 122 123 * Detects whether the current browser is mobile Safari. … … 130 131 * Detects whether the browser can handle HTML5 video. 131 132 * Using this as a proxy for detecting all HTML5 features needed for the JW HTML5 Player. Do we need more granularity? 133 * 134 * @param config (optional) If set, check to see if the first playable item 132 135 */ 133 jwplayer.utils.hasHTML5 = function() { 134 return !!document.createElement('video').canPlayType; 136 jwplayer.utils.hasHTML5 = function(config) { 137 var vid = document.createElement('video'); 138 139 if (!!vid.canPlayType) { 140 if (config) { 141 var item = {}; 142 if (config.playlist && config.playlist.length) { 143 item.file = config.playlist[0].file; 144 item.levels = config.playlist[0].levels; 145 } else { 146 item.file = config.file; 147 item.levels = config.levels; 148 } 149 150 if (item.file) { 151 return jwplayer.utils.vidCanPlay(vid, item.file); 152 } else if (item.levels && item.levels.length) { 153 for (var i=0; i<item.levels.length; i++) { 154 if (item.levels[i].file && jwplayer.utils.vidCanPlay(vid, item.levels[i].file)) { 155 return true; 156 } 157 } 158 } 159 } else { 160 return true; 161 } 162 } 163 164 return false; 135 165 }; 166 167 jwplayer.utils.vidCanPlay = function(video, file) { 168 var extension = jwplayer.utils.strings.extension(file); 169 if (jwplayer.utils.extensionmap[extension] !== undefined) { 170 sourceType = jwplayer.utils.extensionmap[extension]; 171 } else { 172 sourceType = 'video/' + extension + ';'; 173 } 174 return video.canPlayType(sourceType); 175 }; 176 177 136 178 137 179 /** -
trunk/js/src/utils/jwplayer.utils.strings.js
r1171 r1392 1 1 jwplayer.utils.strings = function(){}; 2 2 3 /** Removes whitespace from the beginning and end of a string **/ 3 4 jwplayer.utils.strings.trim = function(inputString){ 4 5 return inputString.replace(/^\s*/, "").replace(/\s*$/, ""); 5 6 }; 7 8 /** Returns the extension of a file name **/ 9 jwplayer.utils.strings.extension = function(path) { 10 return path.substr(path.lastIndexOf('.') + 1, path.length).toLowerCase(); 11 };
Note: See TracChangeset
for help on using the changeset viewer.
