Index: trunk/extensions/SoundManager2Button/script/soundmanager2-nodebug-jsmin.js |
— | — | @@ -8,69 +8,70 @@ |
9 | 9 | * Code provided under the BSD License: |
10 | 10 | * http://schillmania.com/projects/soundmanager2/license.txt |
11 | 11 | * |
12 | | - * V2.97a.20111030 |
| 12 | + * V2.97a.20111220 |
13 | 13 | */ |
14 | | -(function($){function N(N,Z){function j(c){return function(a){return!this._t||!this._t._a?null:c.call(this,a)}}this.flashVersion=8;this.debugFlash=this.debugMode=false;this.useConsole=true;this.waitForWindowLoad=this.consoleOnly=false;this.bgColor="#ffffff";this.useHighPerformance=false;this.flashPollingInterval=null;this.flashLoadTimeout=1E3;this.wmode=null;this.allowScriptAccess="always";this.useFlashBlock=false;this.useHTML5Audio=true;this.html5Test=/^(probably|maybe)$/i;this.preferFlash=true; |
15 | | -this.noSWFCache=false;this.audioFormats={mp3:{type:['audio/mpeg; codecs="mp3"',"audio/mpeg","audio/mp3","audio/MPA","audio/mpa-robust"],required:true},mp4:{related:["aac","m4a"],type:['audio/mp4; codecs="mp4a.40.2"',"audio/aac","audio/x-m4a","audio/MP4A-LATM","audio/mpeg4-generic"],required:false},ogg:{type:["audio/ogg; codecs=vorbis"],required:false},wav:{type:['audio/wav; codecs="1"',"audio/wav","audio/wave","audio/x-wav"],required:false}};this.defaultOptions={autoLoad:false,stream:true,autoPlay:false, |
16 | | -loops:1,onid3:null,onload:null,whileloading:null,onplay:null,onpause:null,onresume:null,whileplaying:null,onstop:null,onfailure:null,onfinish:null,multiShot:true,multiShotEvents:false,position:null,pan:0,type:null,usePolicyFile:false,volume:100};this.flash9Options={isMovieStar:null,usePeakData:false,useWaveformData:false,useEQData:false,onbufferchange:null,ondataerror:null};this.movieStarOptions={bufferTime:3,serverURL:null,onconnect:null,duration:null};this.movieID="sm2-container";this.id=Z||"sm2movie"; |
17 | | -this.swfCSS={swfBox:"sm2-object-box",swfDefault:"movieContainer",swfError:"swf_error",swfTimedout:"swf_timedout",swfLoaded:"swf_loaded",swfUnblocked:"swf_unblocked",sm2Debug:"sm2_debug",highPerf:"high_performance",flashDebug:"flash_debug"};this.debugID="soundmanager-debug";this.debugURLParam=/([#?&])debug=1/i;this.versionNumber="V2.97a.20111030";this.movieURL=this.version=null;this.url=N||null;this.altURL=null;this.enabled=this.swfLoaded=false;this.oMC=this.o=null;this.sounds={};this.soundIDs=[]; |
18 | | -this.didFlashBlock=this.specialWmodeCase=this.muted=false;this.filePattern=null;this.filePatterns={flash8:/\.mp3(\?.*)?$/i,flash9:/\.mp3(\?.*)?$/i};this.features={buffering:false,peakData:false,waveformData:false,eqData:false,movieStar:false};this.sandbox={};var F;try{F=typeof Audio!=="undefined"&&typeof(new Audio).canPlayType!=="undefined"}catch(Oa){F=false}this.hasHTML5=F;this.html5={usingFlash:null};this.flash={};this.ignoreFlash=this.html5Only=false;var ra,c=this,O,o=navigator.userAgent,i=$,aa= |
19 | | -i.location.href.toString(),h=document,ba,P,g,s=[],G=false,H=false,m=false,t=false,sa=false,I,n,ca,z,A,Q,ta,da,x,R,B,ea,fa,S,C,ua,ga,va,T,wa,J=null,ha=null,y,ia,D,U,V,ja,l,W=false,ka=false,xa,ya,q=null,za,X,K,u,la,ma,Aa,k,Ia=Array.prototype.slice,L=false,p,Y,Ba,r,Ca,na=o.match(/(ipad|iphone|ipod)/i),Ja=o.match(/firefox/i),Ka=o.match(/droid/i),v=o.match(/msie/i),La=o.match(/webkit/i),M=o.match(/safari/i)&&!o.match(/chrome/i),Ma=o.match(/opera/i);F=o.match(/(mobile|pre\/|xoom)/i)||na;var oa=!aa.match(/usehtml5audio/i)&& |
20 | | -!aa.match(/sm2\-ignorebadua/i)&&M&&o.match(/OS X 10_6_([3-7])/i),pa=typeof h.hasFocus!=="undefined"?h.hasFocus():null,E=M&&typeof h.hasFocus==="undefined",Da=!E,Ea=/(mp3|mp4|mpa)/i,qa=h.location?h.location.protocol.match(/http/i):null,Fa=!qa?"http://":"",Ga=/^\s*audio\/(?:x-)?(?:mpeg4|aac|flv|mov|mp4||m4v|m4a|mp4v|3gp|3g2)\s*(?:$|;)/i,Ha="mpeg4,aac,flv,mov,mp4,m4v,f4v,m4a,mp4v,3gp,3g2".split(","),Na=RegExp("\\.("+Ha.join("|")+")(\\?.*)?$","i");this.mimePattern=/^\s*audio\/(?:x-)?(?:mp(?:eg|3))\s*(?:$|;)/i; |
21 | | -this.useAltURL=!qa;this._global_a=null;if(F&&(c.useHTML5Audio=true,c.preferFlash=false,na))L=c.ignoreFlash=true;this.supported=this.ok=function(){return q?m&&!t:c.useHTML5Audio&&c.hasHTML5};this.getMovie=function(c){return O(c)||h[c]||i[c]};this.createSound=function(b){function a(){e=U(e);c.sounds[d.id]=new ra(d);c.soundIDs.push(d.id);return c.sounds[d.id]}var e=null,f=null,d=null;if(!m||!c.ok())return ja("soundManager.createSound(): "+y(!m?"notReady":"notOK")),false;arguments.length===2&&(b={id:arguments[0], |
22 | | -url:arguments[1]});d=e=n(b);if(l(d.id,true))return c.sounds[d.id];if(X(d))f=a(),f._setup_html5(d);else{if(g>8){if(d.isMovieStar===null)d.isMovieStar=d.serverURL||(d.type?d.type.match(Ga):false)||d.url.match(Na);if(d.isMovieStar&&d.usePeakData)d.usePeakData=false}d=V(d,"soundManager.createSound(): ");f=a();if(g===8)c.o._createSound(d.id,d.loops||1,d.usePolicyFile);else if(c.o._createSound(d.id,d.url,d.usePeakData,d.useWaveformData,d.useEQData,d.isMovieStar,d.isMovieStar?d.bufferTime:false,d.loops|| |
23 | | -1,d.serverURL,d.duration||null,d.autoPlay,true,d.autoLoad,d.usePolicyFile),!d.serverURL)f.connected=true,d.onconnect&&d.onconnect.apply(f);!d.serverURL&&(d.autoLoad||d.autoPlay)&&f.load(d)}!d.serverURL&&d.autoPlay&&f.play();return f};this.destroySound=function(b,a){if(!l(b))return false;var e=c.sounds[b],f;e._iO={};e.stop();e.unload();for(f=0;f<c.soundIDs.length;f++)if(c.soundIDs[f]===b){c.soundIDs.splice(f,1);break}a||e.destruct(true);delete c.sounds[b];return true};this.load=function(b,a){return!l(b)? |
24 | | -false:c.sounds[b].load(a)};this.unload=function(b){return!l(b)?false:c.sounds[b].unload()};this.onposition=function(b,a,e,f){return!l(b)?false:c.sounds[b].onposition(a,e,f)};this.start=this.play=function(b,a){if(!m||!c.ok())return ja("soundManager.play(): "+y(!m?"notReady":"notOK")),false;return!l(b)?(a instanceof Object||(a={url:a}),a&&a.url?(a.id=b,c.createSound(a).play()):false):c.sounds[b].play(a)};this.setPosition=function(b,a){return!l(b)?false:c.sounds[b].setPosition(a)};this.stop=function(b){return!l(b)? |
25 | | -false:c.sounds[b].stop()};this.stopAll=function(){for(var b in c.sounds)c.sounds.hasOwnProperty(b)&&c.sounds[b].stop()};this.pause=function(b){return!l(b)?false:c.sounds[b].pause()};this.pauseAll=function(){var b;for(b=c.soundIDs.length;b--;)c.sounds[c.soundIDs[b]].pause()};this.resume=function(b){return!l(b)?false:c.sounds[b].resume()};this.resumeAll=function(){var b;for(b=c.soundIDs.length;b--;)c.sounds[c.soundIDs[b]].resume()};this.togglePause=function(b){return!l(b)?false:c.sounds[b].togglePause()}; |
26 | | -this.setPan=function(b,a){return!l(b)?false:c.sounds[b].setPan(a)};this.setVolume=function(b,a){return!l(b)?false:c.sounds[b].setVolume(a)};this.mute=function(b){var a=0;typeof b!=="string"&&(b=null);if(b)return!l(b)?false:c.sounds[b].mute();else{for(a=c.soundIDs.length;a--;)c.sounds[c.soundIDs[a]].mute();c.muted=true}return true};this.muteAll=function(){c.mute()};this.unmute=function(b){typeof b!=="string"&&(b=null);if(b)return!l(b)?false:c.sounds[b].unmute();else{for(b=c.soundIDs.length;b--;)c.sounds[c.soundIDs[b]].unmute(); |
27 | | -c.muted=false}return true};this.unmuteAll=function(){c.unmute()};this.toggleMute=function(b){return!l(b)?false:c.sounds[b].toggleMute()};this.getMemoryUse=function(){var b=0;c.o&&g!==8&&(b=parseInt(c.o._getMemoryUse(),10));return b};this.disable=function(b){var a;typeof b==="undefined"&&(b=false);if(t)return false;t=true;for(a=c.soundIDs.length;a--;)va(c.sounds[c.soundIDs[a]]);I(b);k.remove(i,"load",A);return true};this.canPlayMIME=function(b){var a;c.hasHTML5&&(a=K({type:b}));return!q||a?a:b?!!(g> |
28 | | -8&&b.match(Ga)||b.match(c.mimePattern)):null};this.canPlayURL=function(b){var a;c.hasHTML5&&(a=K({url:b}));return!q||a?a:b?!!b.match(c.filePattern):null};this.canPlayLink=function(b){return typeof b.type!=="undefined"&&b.type&&c.canPlayMIME(b.type)?true:c.canPlayURL(b.href)};this.getSoundById=function(b){if(!b)throw Error("soundManager.getSoundById(): sID is null/undefined");return c.sounds[b]};this.onready=function(c,a){if(c&&c instanceof Function)return a||(a=i),ca("onready",c,a),z(),true;else throw y("needFunction", |
29 | | -"onready");};this.ontimeout=function(c,a){if(c&&c instanceof Function)return a||(a=i),ca("ontimeout",c,a),z({type:"ontimeout"}),true;else throw y("needFunction","ontimeout");};this._wD=this._writeDebug=function(){return true};this._debug=function(){};this.reboot=function(){var b,a;for(b=c.soundIDs.length;b--;)c.sounds[c.soundIDs[b]].destruct();try{if(v)ha=c.o.innerHTML;J=c.o.parentNode.removeChild(c.o)}catch(e){}ha=J=q=null;c.enabled=ea=m=W=ka=G=H=t=c.swfLoaded=false;c.soundIDs=c.sounds=[];c.o=null; |
30 | | -for(b in s)if(s.hasOwnProperty(b))for(a=s[b].length;a--;)s[b][a].fired=false;i.setTimeout(c.beginDelayedInit,20)};this.getMoviePercent=function(){return c.o&&typeof c.o.PercentLoaded!=="undefined"?c.o.PercentLoaded():null};this.beginDelayedInit=function(){sa=true;B();setTimeout(function(){if(ka)return false;S();R();return ka=true},20);Q()};this.destruct=function(){c.disable(true)};ra=function(b){var a=this,e,f,d;this.sID=b.id;this.url=b.url;this._iO=this.instanceOptions=this.options=n(b);this.pan= |
31 | | -this.options.pan;this.volume=this.options.volume;this._lastURL=null;this.isHTML5=false;this._a=null;this.id3={};this._debug=function(){};this.load=function(b){var d=null;if(typeof b!=="undefined")a._iO=n(b,a.options),a.instanceOptions=a._iO;else if(b=a.options,a._iO=b,a.instanceOptions=a._iO,a._lastURL&&a._lastURL!==a.url)a._iO.url=a.url,a.url=null;if(!a._iO.url)a._iO.url=a.url;if(a._iO.url===a.url&&a.readyState!==0&&a.readyState!==2)return a;a._lastURL=a.url;a.loaded=false;a.readyState=1;a.playState= |
32 | | -0;if(X(a._iO)){if(d=a._setup_html5(a._iO),!d._called_load)a._html5_canplay=false,d.load(),d._called_load=true,a._iO.autoPlay&&a.play()}else try{a.isHTML5=false,a._iO=V(U(a._iO)),g===8?c.o._load(a.sID,a._iO.url,a._iO.stream,a._iO.autoPlay,a._iO.whileloading?1:0,a._iO.loops||1,a._iO.usePolicyFile):c.o._load(a.sID,a._iO.url,!!a._iO.stream,!!a._iO.autoPlay,a._iO.loops||1,!!a._iO.autoLoad,a._iO.usePolicyFile)}catch(e){C({type:"SMSOUND_LOAD_JS_EXCEPTION",fatal:true})}return a};this.unload=function(){a.readyState!== |
33 | | -0&&(a.isHTML5?(f(),a._a&&(a._a.pause(),la(a._a))):g===8?c.o._unload(a.sID,"about:blank"):c.o._unload(a.sID),e());return a};this.destruct=function(b){if(a.isHTML5){if(f(),a._a)a._a.pause(),la(a._a),L||a._remove_html5_events(),a._a._t=null,a._a=null}else a._iO.onfailure=null,c.o._destroySound(a.sID);b||c.destroySound(a.sID,true)};this.start=this.play=function(b,w){var e,w=w===void 0?true:w;b||(b={});a._iO=n(b,a._iO);a._iO=n(a._iO,a.options);a.instanceOptions=a._iO;if(a._iO.serverURL&&!a.connected)return a.getAutoPlay()|| |
34 | | -a.setAutoPlay(true),a;X(a._iO)&&(a._setup_html5(a._iO),d());if(a.playState===1&&!a.paused&&(e=a._iO.multiShot,!e))return a;if(!a.loaded)if(a.readyState===0){if(!a.isHTML5)a._iO.autoPlay=true;a.load(a._iO)}else if(a.readyState===2)return a;if(!a.isHTML5&&g===9&&a.position>0&&a.position===a.duration)a._iO.position=0;if(a.paused&&a.position&&a.position>0)a.resume();else{a.playState=1;a.paused=false;(!a.instanceCount||a._iO.multiShotEvents||!a.isHTML5&&g>8&&!a.getAutoPlay())&&a.instanceCount++;a.position= |
35 | | -typeof a._iO.position!=="undefined"&&!isNaN(a._iO.position)?a._iO.position:0;if(!a.isHTML5)a._iO=V(U(a._iO));if(a._iO.onplay&&w)a._iO.onplay.apply(a),a._onplay_called=true;a.setVolume(a._iO.volume,true);a.setPan(a._iO.pan,true);a.isHTML5?(d(),e=a._setup_html5(),a.setPosition(a._iO.position),e.play()):c.o._start(a.sID,a._iO.loops||1,g===9?a._iO.position:a._iO.position/1E3)}return a};this.stop=function(b){if(a.playState===1){a._onbufferchange(0);a.resetOnPosition(0);a.paused=false;if(!a.isHTML5)a.playState= |
36 | | -0;a._iO.onstop&&a._iO.onstop.apply(a);if(a.isHTML5){if(a._a)a.setPosition(0),a._a.pause(),a.playState=0,a._onTimer(),f()}else c.o._stop(a.sID,b),a._iO.serverURL&&a.unload();a.instanceCount=0;a._iO={}}return a};this.setAutoPlay=function(b){a._iO.autoPlay=b;a.isHTML5||(c.o._setAutoPlay(a.sID,b),b&&!a.instanceCount&&a.readyState===1&&a.instanceCount++)};this.getAutoPlay=function(){return a._iO.autoPlay};this.setPosition=function(b){b===void 0&&(b=0);var d=a.isHTML5?Math.max(b,0):Math.min(a.duration|| |
37 | | -a._iO.duration,Math.max(b,0));a.position=d;b=a.position/1E3;a.resetOnPosition(a.position);a._iO.position=d;if(a.isHTML5){if(a._a&&a._html5_canplay&&a._a.currentTime!==b)try{a._a.currentTime=b,(a.playState===0||a.paused)&&a._a.pause()}catch(e){}}else b=g===9?a.position:b,a.readyState&&a.readyState!==2&&c.o._setPosition(a.sID,b,a.paused||!a.playState);a.isHTML5&&a.paused&&a._onTimer(true);return a};this.pause=function(b){if(a.paused||a.playState===0&&a.readyState!==1)return a;a.paused=true;a.isHTML5? |
38 | | -(a._setup_html5().pause(),f()):(b||b===void 0)&&c.o._pause(a.sID);a._iO.onpause&&a._iO.onpause.apply(a);return a};this.resume=function(){if(!a.paused)return a;a.paused=false;a.playState=1;a.isHTML5?(a._setup_html5().play(),d()):(a._iO.isMovieStar&&a.setPosition(a.position),c.o._pause(a.sID));!a._onplay_called&&a._iO.onplay?(a._iO.onplay.apply(a),a._onplay_called=true):a._iO.onresume&&a._iO.onresume.apply(a);return a};this.togglePause=function(){if(a.playState===0)return a.play({position:g===9&&!a.isHTML5? |
39 | | -a.position:a.position/1E3}),a;a.paused?a.resume():a.pause();return a};this.setPan=function(b,d){typeof b==="undefined"&&(b=0);typeof d==="undefined"&&(d=false);a.isHTML5||c.o._setPan(a.sID,b);a._iO.pan=b;if(!d)a.pan=b,a.options.pan=b;return a};this.setVolume=function(b,d){typeof b==="undefined"&&(b=100);typeof d==="undefined"&&(d=false);if(a.isHTML5){if(a._a)a._a.volume=Math.max(0,Math.min(1,b/100))}else c.o._setVolume(a.sID,c.muted&&!a.muted||a.muted?0:b);a._iO.volume=b;if(!d)a.volume=b,a.options.volume= |
40 | | -b;return a};this.mute=function(){a.muted=true;if(a.isHTML5){if(a._a)a._a.muted=true}else c.o._setVolume(a.sID,0);return a};this.unmute=function(){a.muted=false;var b=typeof a._iO.volume!=="undefined";if(a.isHTML5){if(a._a)a._a.muted=false}else c.o._setVolume(a.sID,b?a._iO.volume:a.options.volume);return a};this.toggleMute=function(){return a.muted?a.unmute():a.mute()};this.onposition=function(b,c,d){a._onPositionItems.push({position:b,method:c,scope:typeof d!=="undefined"?d:a,fired:false});return a}; |
41 | | -this.processOnPosition=function(){var b,d;b=a._onPositionItems.length;if(!b||!a.playState||a._onPositionFired>=b)return false;for(;b--;)if(d=a._onPositionItems[b],!d.fired&&a.position>=d.position)d.fired=true,c._onPositionFired++,d.method.apply(d.scope,[d.position]);return true};this.resetOnPosition=function(b){var d,e;d=a._onPositionItems.length;if(!d)return false;for(;d--;)if(e=a._onPositionItems[d],e.fired&&b<=e.position)e.fired=false,c._onPositionFired--;return true};d=function(){a.isHTML5&&xa(a)}; |
42 | | -f=function(){a.isHTML5&&ya(a)};e=function(){a._onPositionItems=[];a._onPositionFired=0;a._hasTimer=null;a._onplay_called=false;a._a=null;a._html5_canplay=false;a.bytesLoaded=null;a.bytesTotal=null;a.position=null;a.duration=a._iO&&a._iO.duration?a._iO.duration:null;a.durationEstimate=null;a.failures=0;a.loaded=false;a.playState=0;a.paused=false;a.readyState=0;a.muted=false;a.isBuffering=false;a.instanceOptions={};a.instanceCount=0;a.peakData={left:0,right:0};a.waveformData={left:[],right:[]};a.eqData= |
43 | | -[];a.eqData.left=[];a.eqData.right=[]};e();this._onTimer=function(b){var c={};if(a._hasTimer||b)return a._a&&(b||(a.playState>0||a.readyState===1)&&!a.paused)?(a.duration=a._get_html5_duration(),a.durationEstimate=a.duration,b=a._a.currentTime?a._a.currentTime*1E3:0,a._whileplaying(b,c,c,c,c),true):false};this._get_html5_duration=function(){var b=a._a?a._a.duration*1E3:a._iO?a._iO.duration:void 0;return b&&!isNaN(b)&&b!==Infinity?b:a._iO?a._iO.duration:null};this._setup_html5=function(b){var b=n(a._iO, |
44 | | -b),d=L?c._global_a:a._a;decodeURI(b.url);var f=d&&d._t?d._t.instanceOptions:null;if(d){if(d._t&&f.url===b.url&&(!a._lastURL||a._lastURL===f.url))return d;L&&d._t&&d._t.playState&&b.url!==f.url&&d._t.stop();e();d.src=b.url;a.url=b.url;a._lastURL=b.url;d._called_load=false}else{d=new Audio(b.url);d._called_load=false;if(Ka)d._called_load=true;if(L)c._global_a=d}a.isHTML5=true;a._a=d;d._t=a;a._add_html5_events();d.loop=b.loops>1?"loop":"";b.autoLoad||b.autoPlay?(d.autobuffer="auto",d.preload="auto", |
45 | | -a.load(),d._called_load=true):(d.autobuffer=false,d.preload="none");d.loop=b.loops>1?"loop":"";return d};this._add_html5_events=function(){if(a._a._added_events)return false;var b;a._a._added_events=true;for(b in r)r.hasOwnProperty(b)&&a._a&&a._a.addEventListener(b,r[b],false);return true};this._remove_html5_events=function(){var b;a._a._added_events=false;for(b in r)r.hasOwnProperty(b)&&a._a&&a._a.removeEventListener(b,r[b],false)};this._onload=function(b){b=!!b;a.loaded=b;a.readyState=b?3:2;a._onbufferchange(0); |
46 | | -a._iO.onload&&a._iO.onload.apply(a,[b]);return true};this._onbufferchange=function(b){if(a.playState===0)return false;if(b&&a.isBuffering||!b&&!a.isBuffering)return false;a.isBuffering=b===1;a._iO.onbufferchange&&a._iO.onbufferchange.apply(a);return true};this._onsuspend=function(){a._iO.onsuspend&&a._iO.onsuspend.apply(a);return true};this._onfailure=function(b,c,d){a.failures++;if(a._iO.onfailure&&a.failures===1)a._iO.onfailure(a,b,c,d)};this._onfinish=function(){var b=a._iO.onfinish;a._onbufferchange(0); |
47 | | -a.resetOnPosition(0);if(a.instanceCount){a.instanceCount--;if(!a.instanceCount)a.playState=0,a.paused=false,a.instanceCount=0,a.instanceOptions={},a._iO={},f();(!a.instanceCount||a._iO.multiShotEvents)&&b&&b.apply(a)}};this._whileloading=function(b,c,d,e){a.bytesLoaded=b;a.bytesTotal=c;a.duration=Math.floor(d);a.bufferLength=e;if(a._iO.isMovieStar)a.durationEstimate=a.duration;else if(a.durationEstimate=a._iO.duration?a.duration>a._iO.duration?a.duration:a._iO.duration:parseInt(a.bytesTotal/a.bytesLoaded* |
48 | | -a.duration,10),a.durationEstimate===void 0)a.durationEstimate=a.duration;a.readyState!==3&&a._iO.whileloading&&a._iO.whileloading.apply(a)};this._whileplaying=function(b,c,d,e,f){if(isNaN(b)||b===null)return false;a.position=b;a.processOnPosition();if(!a.isHTML5&&g>8){if(a._iO.usePeakData&&typeof c!=="undefined"&&c)a.peakData={left:c.leftPeak,right:c.rightPeak};if(a._iO.useWaveformData&&typeof d!=="undefined"&&d)a.waveformData={left:d.split(","),right:e.split(",")};if(a._iO.useEQData&&typeof f!== |
49 | | -"undefined"&&f&&f.leftEQ&&(b=f.leftEQ.split(","),a.eqData=b,a.eqData.left=b,typeof f.rightEQ!=="undefined"&&f.rightEQ))a.eqData.right=f.rightEQ.split(",")}a.playState===1&&(!a.isHTML5&&g===8&&!a.position&&a.isBuffering&&a._onbufferchange(0),a._iO.whileplaying&&a._iO.whileplaying.apply(a));return true};this._onid3=function(b,c){var d=[],e,f;for(e=0,f=b.length;e<f;e++)d[b[e]]=c[e];a.id3=n(a.id3,d);a._iO.onid3&&a._iO.onid3.apply(a)};this._onconnect=function(b){b=b===1;if(a.connected=b)a.failures=0,l(a.sID)&& |
50 | | -(a.getAutoPlay()?a.play(void 0,a.getAutoPlay()):a._iO.autoLoad&&a.load()),a._iO.onconnect&&a._iO.onconnect.apply(a,[b])};this._ondataerror=function(){a.playState>0&&a._iO.ondataerror&&a._iO.ondataerror.apply(a)}};fa=function(){return h.body||h._docElement||h.getElementsByTagName("div")[0]};O=function(b){return h.getElementById(b)};n=function(b,a){var e={},f,d;for(f in b)b.hasOwnProperty(f)&&(e[f]=b[f]);f=typeof a==="undefined"?c.defaultOptions:a;for(d in f)f.hasOwnProperty(d)&&typeof e[d]==="undefined"&& |
51 | | -(e[d]=f[d]);return e};k=function(){function b(a){var a=Ia.call(a),b=a.length;c?(a[1]="on"+a[1],b>3&&a.pop()):b===3&&a.push(false);return a}function a(a,b){var w=a.shift(),h=[f[b]];if(c)w[h](a[0],a[1]);else w[h].apply(w,a)}var c=i.attachEvent,f={add:c?"attachEvent":"addEventListener",remove:c?"detachEvent":"removeEventListener"};return{add:function(){a(b(arguments),"add")},remove:function(){a(b(arguments),"remove")}}}();r={abort:j(function(){}),canplay:j(function(){if(this._t._html5_canplay)return true; |
52 | | -this._t._html5_canplay=true;this._t._onbufferchange(0);var b=!isNaN(this._t.position)?this._t.position/1E3:null;if(this._t.position&&this.currentTime!==b)try{this.currentTime=b}catch(a){}}),load:j(function(){this._t.loaded||(this._t._onbufferchange(0),this._t._whileloading(this._t.bytesTotal,this._t.bytesTotal,this._t._get_html5_duration()),this._t._onload(true))}),emptied:j(function(){}),ended:j(function(){this._t._onfinish()}),error:j(function(){this._t._onload(false)}),loadeddata:j(function(){var b= |
53 | | -this._t,a=b.bytesTotal||1;if(!b._loaded&&!M)b.duration=b._get_html5_duration(),b._whileloading(a,a,b._get_html5_duration()),b._onload(true)}),loadedmetadata:j(function(){}),loadstart:j(function(){this._t._onbufferchange(1)}),play:j(function(){this._t._onbufferchange(0)}),playing:j(function(){this._t._onbufferchange(0)}),progress:j(function(b){if(this._t.loaded)return false;var a,c=0,f=b.target.buffered;a=b.loaded||0;var d=b.total||1;if(f&&f.length){for(a=f.length;a--;)c=f.end(a)-f.start(a);a=c/b.target.duration}isNaN(a)|| |
54 | | -(this._t._onbufferchange(0),this._t._whileloading(a,d,this._t._get_html5_duration()),a&&d&&a===d&&r.load.call(this,b))}),ratechange:j(function(){}),suspend:j(function(b){r.progress.call(this,b);this._t._onsuspend()}),stalled:j(function(){}),timeupdate:j(function(){this._t._onTimer()}),waiting:j(function(){this._t._onbufferchange(1)})};X=function(b){return!b.serverURL&&(b.type?K({type:b.type}):K({url:b.url})||c.html5Only)};la=function(b){if(b)b.src=Ja?"":"about:blank"};K=function(b){function a(a){return c.preferFlash&& |
55 | | -p&&!c.ignoreFlash&&typeof c.flash[a]!=="undefined"&&c.flash[a]}if(!c.useHTML5Audio||!c.hasHTML5)return false;var e=b.url||null,b=b.type||null,f=c.audioFormats,d;if(b&&c.html5[b]!=="undefined")return c.html5[b]&&!a(b);if(!u){u=[];for(d in f)f.hasOwnProperty(d)&&(u.push(d),f[d].related&&(u=u.concat(f[d].related)));u=RegExp("\\.("+u.join("|")+")(\\?.*)?$","i")}d=e?e.toLowerCase().match(u):null;if(!d||!d.length)if(b)e=b.indexOf(";"),d=(e!==-1?b.substr(0,e):b).substr(6);else return false;else d=d[1];return d&& |
56 | | -typeof c.html5[d]!=="undefined"?c.html5[d]&&!a(d):(b="audio/"+d,e=c.html5.canPlayType({type:b}),(c.html5[d]=e)&&c.html5[b]&&!a(b))};Aa=function(){function b(b){var d,e,f=false;if(!a||typeof a.canPlayType!=="function")return false;if(b instanceof Array){for(d=0,e=b.length;d<e&&!f;d++)if(c.html5[b[d]]||a.canPlayType(b[d]).match(c.html5Test))f=true,c.html5[b[d]]=true,c.flash[b[d]]=!(!c.preferFlash||!p||!b[d].match(Ea));return f}else return b=a&&typeof a.canPlayType==="function"?a.canPlayType(b):false, |
57 | | -!(!b||!b.match(c.html5Test))}if(!c.useHTML5Audio||typeof Audio==="undefined")return false;var a=typeof Audio!=="undefined"?Ma?new Audio(null):new Audio:null,e,f={},d,h;d=c.audioFormats;for(e in d)if(d.hasOwnProperty(e)&&(f[e]=b(d[e].type),f["audio/"+e]=f[e],c.flash[e]=c.preferFlash&&!c.ignoreFlash&&e.match(Ea)?true:false,d[e]&&d[e].related))for(h=d[e].related.length;h--;)f["audio/"+d[e].related[h]]=f[e],c.html5[d[e].related[h]]=f[e],c.flash[d[e].related[h]]=f[e];f.canPlayType=a?b:null;c.html5=n(c.html5, |
58 | | -f);return true};y=function(){};U=function(b){if(g===8&&b.loops>1&&b.stream)b.stream=false;return b};V=function(b){if(b&&!b.usePolicyFile&&(b.onid3||b.usePeakData||b.useWaveformData||b.useEQData))b.usePolicyFile=true;return b};ja=function(){};ba=function(){return false};va=function(b){for(var a in b)b.hasOwnProperty(a)&&typeof b[a]==="function"&&(b[a]=ba)};T=function(b){typeof b==="undefined"&&(b=false);(t||b)&&c.disable(b)};wa=function(b){var a=null;if(b)if(b.match(/\.swf(\?.*)?$/i)){if(a=b.substr(b.toLowerCase().lastIndexOf(".swf?")+ |
59 | | -4))return b}else b.lastIndexOf("/")!==b.length-1&&(b+="/");b=(b&&b.lastIndexOf("/")!==-1?b.substr(0,b.lastIndexOf("/")+1):"./")+c.movieURL;c.noSWFCache&&(b+="?ts="+(new Date).getTime());return b};da=function(){g=parseInt(c.flashVersion,10);if(g!==8&&g!==9)c.flashVersion=g=8;var b=c.debugMode||c.debugFlash?"_debug.swf":".swf";if(c.useHTML5Audio&&!c.html5Only&&c.audioFormats.mp4.required&&g<9)c.flashVersion=g=9;c.version=c.versionNumber+(c.html5Only?" (HTML5-only mode)":g===9?" (AS3/Flash 9)":" (AS2/Flash 8)"); |
60 | | -g>8?(c.defaultOptions=n(c.defaultOptions,c.flash9Options),c.features.buffering=true,c.defaultOptions=n(c.defaultOptions,c.movieStarOptions),c.filePatterns.flash9=RegExp("\\.(mp3|"+Ha.join("|")+")(\\?.*)?$","i"),c.features.movieStar=true):c.features.movieStar=false;c.filePattern=c.filePatterns[g!==8?"flash9":"flash8"];c.movieURL=(g===8?"soundmanager2.swf":"soundmanager2_flash9.swf").replace(".swf",b);c.features.peakData=c.features.waveformData=c.features.eqData=g>8};ua=function(b,a){if(!c.o)return false; |
61 | | -c.o._setPolling(b,a)};ga=function(){if(c.debugURLParam.test(aa))c.debugMode=true};l=this.getSoundById;D=function(){var b=[];c.debugMode&&b.push(c.swfCSS.sm2Debug);c.debugFlash&&b.push(c.swfCSS.flashDebug);c.useHighPerformance&&b.push(c.swfCSS.highPerf);return b.join(" ")};ia=function(){y("fbHandler");var b=c.getMoviePercent(),a=c.swfCSS,e={type:"FLASHBLOCK"};if(c.html5Only)return false;if(c.ok()){if(c.oMC)c.oMC.className=[D(),a.swfDefault,a.swfLoaded+(c.didFlashBlock?" "+a.swfUnblocked:"")].join(" ")}else{if(q)c.oMC.className= |
62 | | -D()+" "+a.swfDefault+" "+(b===null?a.swfTimedout:a.swfError);c.didFlashBlock=true;z({type:"ontimeout",ignoreInit:true,error:e});C(e)}};ca=function(b,a,c){typeof s[b]==="undefined"&&(s[b]=[]);s[b].push({method:a,scope:c||null,fired:false})};z=function(b){b||(b={type:"onready"});if(!m&&b&&!b.ignoreInit)return false;if(b.type==="ontimeout"&&c.ok())return false;var a={success:b&&b.ignoreInit?c.ok():!t},e=b&&b.type?s[b.type]||[]:[],f=[],d,a=[a],h=q&&c.useFlashBlock&&!c.ok();if(b.error)a[0].error=b.error; |
63 | | -for(b=0,d=e.length;b<d;b++)e[b].fired!==true&&f.push(e[b]);if(f.length)for(b=0,d=f.length;b<d;b++)if(f[b].scope?f[b].method.apply(f[b].scope,a):f[b].method.apply(this,a),!h)f[b].fired=true;return true};A=function(){i.setTimeout(function(){c.useFlashBlock&&ia();z();c.onload instanceof Function&&c.onload.apply(i);c.waitForWindowLoad&&k.add(i,"load",A)},1)};Y=function(){if(p!==void 0)return p;var b=false,a=navigator,c=a.plugins,f,d=i.ActiveXObject;if(c&&c.length)(a=a.mimeTypes)&&a["application/x-shockwave-flash"]&& |
64 | | -a["application/x-shockwave-flash"].enabledPlugin&&a["application/x-shockwave-flash"].enabledPlugin.description&&(b=true);else if(typeof d!=="undefined"){try{f=new d("ShockwaveFlash.ShockwaveFlash")}catch(h){}b=!!f}return p=b};za=function(){var b,a;if(na&&o.match(/os (1|2|3_0|3_1)/i)){c.hasHTML5=false;c.html5Only=true;if(c.oMC)c.oMC.style.display="none";return false}if(c.useHTML5Audio){if(!c.html5||!c.html5.canPlayType)return c.hasHTML5=false,true;else c.hasHTML5=true;if(oa&&Y())return true}else return true; |
65 | | -for(a in c.audioFormats)if(c.audioFormats.hasOwnProperty(a)&&(c.audioFormats[a].required&&!c.html5.canPlayType(c.audioFormats[a].type)||c.flash[a]||c.flash[c.audioFormats[a].type]))b=true;c.ignoreFlash&&(b=false);c.html5Only=c.hasHTML5&&c.useHTML5Audio&&!b;return!c.html5Only};xa=function(b){if(!b._hasTimer)b._hasTimer=true};ya=function(b){if(b._hasTimer)b._hasTimer=false};C=function(b){b=typeof b!=="undefined"?b:{};c.onerror instanceof Function&&c.onerror.apply(i,[{type:typeof b.type!=="undefined"? |
66 | | -b.type:null}]);typeof b.fatal!=="undefined"&&b.fatal&&c.disable()};Ba=function(){if(!oa||!Y())return false;var b=c.audioFormats,a,e;for(e in b)if(b.hasOwnProperty(e)&&(e==="mp3"||e==="mp4"))if(c.html5[e]=false,b[e]&&b[e].related)for(a=b[e].related.length;a--;)c.html5[b[e].related[a]]=false};this._setSandboxType=function(){};this._externalInterfaceOK=function(){if(c.swfLoaded)return false;(new Date).getTime();c.swfLoaded=true;E=false;oa&&Ba();v?setTimeout(P,100):P()};S=function(b,a){function e(a,b){return'<param name="'+ |
67 | | -a+'" value="'+b+'" />'}if(G&&H)return false;if(c.html5Only)return da(),c.oMC=O(c.movieID),P(),H=G=true,false;var f=a||c.url,d=c.altURL||f,g;g=fa();var i,l,j=D(),k,m=null,m=(m=h.getElementsByTagName("html")[0])&&m.dir&&m.dir.match(/rtl/i),b=typeof b==="undefined"?c.id:b;da();c.url=wa(qa?f:d);a=c.url;c.wmode=!c.wmode&&c.useHighPerformance?"transparent":c.wmode;if(c.wmode!==null&&(o.match(/msie 8/i)||!v&&!c.useHighPerformance)&&navigator.platform.match(/win32|win64/i))c.specialWmodeCase=true,c.wmode= |
68 | | -null;g={name:b,id:b,src:a,width:"auto",height:"auto",quality:"high",allowScriptAccess:c.allowScriptAccess,bgcolor:c.bgColor,pluginspage:Fa+"www.macromedia.com/go/getflashplayer",title:"JS/Flash audio component (SoundManager 2)",type:"application/x-shockwave-flash",wmode:c.wmode,hasPriority:"true"};if(c.debugFlash)g.FlashVars="debug=1";c.wmode||delete g.wmode;if(v)f=h.createElement("div"),l=['<object id="'+b+'" data="'+a+'" type="'+g.type+'" title="'+g.title+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="'+ |
69 | | -Fa+'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" width="'+g.width+'" height="'+g.height+'">',e("movie",a),e("AllowScriptAccess",c.allowScriptAccess),e("quality",g.quality),c.wmode?e("wmode",c.wmode):"",e("bgcolor",c.bgColor),e("hasPriority","true"),c.debugFlash?e("FlashVars",g.FlashVars):"","</object>"].join("");else for(i in f=h.createElement("embed"),g)g.hasOwnProperty(i)&&f.setAttribute(i,g[i]);ga();j=D();if(g=fa())if(c.oMC=O(c.movieID)||h.createElement("div"), |
70 | | -c.oMC.id){k=c.oMC.className;c.oMC.className=(k?k+" ":c.swfCSS.swfDefault)+(j?" "+j:"");c.oMC.appendChild(f);if(v)i=c.oMC.appendChild(h.createElement("div")),i.className=c.swfCSS.swfBox,i.innerHTML=l;H=true}else{c.oMC.id=c.movieID;c.oMC.className=c.swfCSS.swfDefault+" "+j;i=j=null;if(!c.useFlashBlock)if(c.useHighPerformance)j={position:"fixed",width:"8px",height:"8px",bottom:"0px",left:"0px",overflow:"hidden"};else if(j={position:"absolute",width:"6px",height:"6px",top:"-9999px",left:"-9999px"},m)j.left= |
71 | | -Math.abs(parseInt(j.left,10))+"px";if(La)c.oMC.style.zIndex=1E4;if(!c.debugFlash)for(k in j)j.hasOwnProperty(k)&&(c.oMC.style[k]=j[k]);try{v||c.oMC.appendChild(f);g.appendChild(c.oMC);if(v)i=c.oMC.appendChild(h.createElement("div")),i.className=c.swfCSS.swfBox,i.innerHTML=l;H=true}catch(n){throw Error(y("domError")+" \n"+n.toString());}}return G=true};R=function(){if(c.html5Only)return S(),false;if(c.o)return false;c.o=c.getMovie(c.id);if(!c.o)J?(v?c.oMC.innerHTML=ha:c.oMC.appendChild(J),J=null,G= |
72 | | -true):S(c.id,c.url),c.o=c.getMovie(c.id);c.oninitmovie instanceof Function&&setTimeout(c.oninitmovie,1);return true};Q=function(){setTimeout(ta,1E3)};ta=function(){if(W)return false;W=true;k.remove(i,"load",Q);if(E&&!pa)return false;var b;m||(b=c.getMoviePercent());setTimeout(function(){b=c.getMoviePercent();!m&&Da&&(b===null?c.useFlashBlock||c.flashLoadTimeout===0?c.useFlashBlock&&ia():T(true):c.flashLoadTimeout!==0&&T(true))},c.flashLoadTimeout)};x=function(){function b(){k.remove(i,"focus",x); |
73 | | -k.remove(i,"load",x)}if(pa||!E)return b(),true;pa=Da=true;M&&E&&k.remove(i,"mousemove",x);W=false;b();return true};Ca=function(){var b,a=[];if(c.useHTML5Audio&&c.hasHTML5)for(b in c.audioFormats)c.audioFormats.hasOwnProperty(b)&&a.push(b+": "+c.html5[b]+(!c.html5[b]&&p&&c.flash[b]?" (using flash)":c.preferFlash&&c.flash[b]&&p?" (preferring flash)":!c.html5[b]?" ("+(c.audioFormats[b].required?"required, ":"")+"and no flash support)":""))};I=function(b){if(m)return false;if(c.html5Only)return m=true, |
74 | | -A(),true;var a;if(!c.useFlashBlock||!c.flashLoadTimeout||c.getMoviePercent())m=true,t&&(a={type:!p&&q?"NO_FLASH":"INIT_TIMEOUT"});if(t||b){if(c.useFlashBlock&&c.oMC)c.oMC.className=D()+" "+(c.getMoviePercent()===null?c.swfCSS.swfTimedout:c.swfCSS.swfError);z({type:"ontimeout",error:a});C(a);return false}if(c.waitForWindowLoad&&!sa)return k.add(i,"load",A),false;else A();return true};P=function(){if(m)return false;if(c.html5Only){if(!m)k.remove(i,"load",c.beginDelayedInit),c.enabled=true,I();return true}R(); |
75 | | -try{c.o._externalInterfaceTest(false),ua(true,c.flashPollingInterval||(c.useHighPerformance?10:50)),c.debugMode||c.o._disableDebug(),c.enabled=true,c.html5Only||k.add(i,"unload",ba)}catch(b){return C({type:"JS_TO_FLASH_EXCEPTION",fatal:true}),T(true),I(),false}I();k.remove(i,"load",c.beginDelayedInit);return true};B=function(){if(ea)return false;ea=true;ga();if(!p&&c.hasHTML5)c.useHTML5Audio=true,c.preferFlash=false;Aa();c.html5.usingFlash=za();q=c.html5.usingFlash;Ca();if(!p&&q)c.flashLoadTimeout= |
76 | | -1;h.removeEventListener&&h.removeEventListener("DOMContentLoaded",B,false);R();return true};ma=function(){h.readyState==="complete"&&(B(),h.detachEvent("onreadystatechange",ma));return true};Y();k.add(i,"focus",x);k.add(i,"load",x);k.add(i,"load",Q);M&&E&&k.add(i,"mousemove",x);h.addEventListener?h.addEventListener("DOMContentLoaded",B,false):h.attachEvent?h.attachEvent("onreadystatechange",ma):C({type:"NO_DOM2_EVENTS",fatal:true});h.readyState==="complete"&&setTimeout(B,100)}var Z=null;if(typeof SM2_DEFER=== |
77 | | -"undefined"||!SM2_DEFER)Z=new N;$.SoundManager=N;$.soundManager=Z})(window); |
\ No newline at end of file |
| 14 | +(function(J){function R(R,ea){function l(b){return function(a){var c=this._t;return!c||!c._a?null:b.call(this,a)}}this.flashVersion=8;this.debugFlash=this.debugMode=!1;this.consoleOnly=this.useConsole=!0;this.waitForWindowLoad=!1;this.bgColor="#ffffff";this.useHighPerformance=!1;this.html5PollingInterval=this.flashPollingInterval=null;this.flashLoadTimeout=1E3;this.wmode=null;this.allowScriptAccess="always";this.useFlashBlock=!1;this.useHTML5Audio=!0;this.html5Test=/^(probably|maybe)$/i;this.preferFlash= |
| 15 | +!0;this.noSWFCache=!1;this.audioFormats={mp3:{type:['audio/mpeg; codecs="mp3"',"audio/mpeg","audio/mp3","audio/MPA","audio/mpa-robust"],required:!0},mp4:{related:["aac","m4a"],type:['audio/mp4; codecs="mp4a.40.2"',"audio/aac","audio/x-m4a","audio/MP4A-LATM","audio/mpeg4-generic"],required:!1},ogg:{type:["audio/ogg; codecs=vorbis"],required:!1},wav:{type:['audio/wav; codecs="1"',"audio/wav","audio/wave","audio/x-wav"],required:!1}};this.defaultOptions={autoLoad:!1,autoPlay:!1,from:null,loops:1,onid3:null, |
| 16 | +onload:null,whileloading:null,onplay:null,onpause:null,onresume:null,whileplaying:null,onposition:null,onstop:null,onfailure:null,onfinish:null,multiShot:!0,multiShotEvents:!1,position:null,pan:0,stream:!0,to:null,type:null,usePolicyFile:!1,volume:100};this.flash9Options={isMovieStar:null,usePeakData:!1,useWaveformData:!1,useEQData:!1,onbufferchange:null,ondataerror:null};this.movieStarOptions={bufferTime:3,serverURL:null,onconnect:null,duration:null};this.movieID="sm2-container";this.id=ea||"sm2movie"; |
| 17 | +this.debugID="soundmanager-debug";this.debugURLParam=/([#?&])debug=1/i;this.versionNumber="V2.97a.20111220";this.movieURL=this.version=null;this.url=R||null;this.altURL=null;this.enabled=this.swfLoaded=!1;this.oMC=null;this.sounds={};this.soundIDs=[];this.didFlashBlock=this.muted=!1;this.filePattern=null;this.filePatterns={flash8:/\.mp3(\?.*)?$/i,flash9:/\.mp3(\?.*)?$/i};this.features={buffering:!1,peakData:!1,waveformData:!1,eqData:!1,movieStar:!1};this.sandbox={};var fa;try{fa="undefined"!==typeof Audio&& |
| 18 | +"undefined"!==typeof(new Audio).canPlayType}catch(Xa){fa=!1}this.hasHTML5=fa;this.html5={usingFlash:null};this.flash={};this.ignoreFlash=this.html5Only=!1;var Aa,c=this,h=null,S,p=navigator.userAgent,j=J,ga=j.location.href.toString(),k=document,ha,T,i,v=[],K=!1,L=!1,m=!1,w=!1,ia=!1,M,q,ja,C,D,U,Ba,ka,A,V,E,la,ma,na,W,F,Ca,oa,Da,X,Ea,N=null,pa=null,G,qa,H,Y,Z,ra,o,$=!1,sa=!1,Fa,Ga,Ha,aa=0,O=null,ba,s=null,Ia,ca,P,x,ta,ua,Ja,n,Ra=Array.prototype.slice,B=!1,r,da,Ka,u,La,va=p.match(/(ipad|iphone|ipod)/i), |
| 19 | +Sa=p.match(/firefox/i),Ta=p.match(/droid/i),y=p.match(/msie/i),Ua=p.match(/webkit/i),Q=p.match(/safari/i)&&!p.match(/chrome/i),Va=p.match(/opera/i),wa=p.match(/(mobile|pre\/|xoom)/i)||va,xa=!ga.match(/usehtml5audio/i)&&!ga.match(/sm2\-ignorebadua/i)&&Q&&!p.match(/silk/i)&&p.match(/OS X 10_6_([3-7])/i),ya="undefined"!==typeof k.hasFocus?k.hasFocus():null,I=Q&&"undefined"===typeof k.hasFocus,Ma=!I,Na=/(mp3|mp4|mpa)/i,za=k.location?k.location.protocol.match(/http/i):null,Oa=!za?"http://":"",Pa=/^\s*audio\/(?:x-)?(?:mpeg4|aac|flv|mov|mp4||m4v|m4a|mp4v|3gp|3g2)\s*(?:$|;)/i, |
| 20 | +Qa="mpeg4,aac,flv,mov,mp4,m4v,f4v,m4a,mp4v,3gp,3g2".split(","),Wa=RegExp("\\.("+Qa.join("|")+")(\\?.*)?$","i");this.mimePattern=/^\s*audio\/(?:x-)?(?:mp(?:eg|3))\s*(?:$|;)/i;this.useAltURL=!za;this._global_a=null;if(wa&&(c.useHTML5Audio=!0,c.preferFlash=!1,va))B=c.ignoreFlash=!0;this.supported=this.ok=function(){return s?m&&!w:c.useHTML5Audio&&c.hasHTML5};this.getMovie=function(b){return S(b)||k[b]||j[b]};this.createSound=function(b){function a(){e=Y(e);c.sounds[d.id]=new Aa(d);c.soundIDs.push(d.id); |
| 21 | +return c.sounds[d.id]}var e=null,f=null,d=null;if(!m||!c.ok())return ra(void 0),!1;2===arguments.length&&(b={id:arguments[0],url:arguments[1]});e=q(b);e.url=ba(e.url);d=e;if(o(d.id,!0))return c.sounds[d.id];if(ca(d))f=a(),f._setup_html5(d);else{if(8<i){if(null===d.isMovieStar)d.isMovieStar=d.serverURL||(d.type?d.type.match(Pa):!1)||d.url.match(Wa);if(d.isMovieStar&&d.usePeakData)d.usePeakData=!1}d=Z(d,void 0);f=a();if(8===i)h._createSound(d.id,d.loops||1,d.usePolicyFile);else if(h._createSound(d.id, |
| 22 | +d.url,d.usePeakData,d.useWaveformData,d.useEQData,d.isMovieStar,d.isMovieStar?d.bufferTime:!1,d.loops||1,d.serverURL,d.duration||null,d.autoPlay,!0,d.autoLoad,d.usePolicyFile),!d.serverURL)f.connected=!0,d.onconnect&&d.onconnect.apply(f);!d.serverURL&&(d.autoLoad||d.autoPlay)&&f.load(d)}!d.serverURL&&d.autoPlay&&f.play();return f};this.destroySound=function(b,a){if(!o(b))return!1;var e=c.sounds[b],f;e._iO={};e.stop();e.unload();for(f=0;f<c.soundIDs.length;f++)if(c.soundIDs[f]===b){c.soundIDs.splice(f, |
| 23 | +1);break}a||e.destruct(!0);delete c.sounds[b];return!0};this.load=function(b,a){return!o(b)?!1:c.sounds[b].load(a)};this.unload=function(b){return!o(b)?!1:c.sounds[b].unload()};this.onposition=this.onPosition=function(b,a,e,f){return!o(b)?!1:c.sounds[b].onposition(a,e,f)};this.clearOnPosition=function(b,a,e){return!o(b)?!1:c.sounds[b].clearOnPosition(a,e)};this.start=this.play=function(b,a){if(!m||!c.ok())return ra("soundManager.play(): "+G(!m?"notReady":"notOK")),!1;if(!o(b)){a instanceof Object|| |
| 24 | +(a={url:a});return a&&a.url?(a.id=b,c.createSound(a).play()):!1}return c.sounds[b].play(a)};this.setPosition=function(b,a){return!o(b)?!1:c.sounds[b].setPosition(a)};this.stop=function(b){return!o(b)?!1:c.sounds[b].stop()};this.stopAll=function(){for(var b in c.sounds)c.sounds.hasOwnProperty(b)&&c.sounds[b].stop()};this.pause=function(b){return!o(b)?!1:c.sounds[b].pause()};this.pauseAll=function(){var b;for(b=c.soundIDs.length;b--;)c.sounds[c.soundIDs[b]].pause()};this.resume=function(b){return!o(b)? |
| 25 | +!1:c.sounds[b].resume()};this.resumeAll=function(){var b;for(b=c.soundIDs.length;b--;)c.sounds[c.soundIDs[b]].resume()};this.togglePause=function(b){return!o(b)?!1:c.sounds[b].togglePause()};this.setPan=function(b,a){return!o(b)?!1:c.sounds[b].setPan(a)};this.setVolume=function(b,a){return!o(b)?!1:c.sounds[b].setVolume(a)};this.mute=function(b){var a=0;"string"!==typeof b&&(b=null);if(b)return!o(b)?!1:c.sounds[b].mute();for(a=c.soundIDs.length;a--;)c.sounds[c.soundIDs[a]].mute();return c.muted=!0}; |
| 26 | +this.muteAll=function(){c.mute()};this.unmute=function(b){"string"!==typeof b&&(b=null);if(b)return!o(b)?!1:c.sounds[b].unmute();for(b=c.soundIDs.length;b--;)c.sounds[c.soundIDs[b]].unmute();c.muted=!1;return!0};this.unmuteAll=function(){c.unmute()};this.toggleMute=function(b){return!o(b)?!1:c.sounds[b].toggleMute()};this.getMemoryUse=function(){var b=0;h&&8!==i&&(b=parseInt(h._getMemoryUse(),10));return b};this.disable=function(b){var a;"undefined"===typeof b&&(b=!1);if(w)return!1;w=!0;for(a=c.soundIDs.length;a--;)Da(c.sounds[c.soundIDs[a]]); |
| 27 | +M(b);n.remove(j,"load",D);return!0};this.canPlayMIME=function(b){var a;c.hasHTML5&&(a=P({type:b}));return!s||a?a:b?!!(8<i&&b.match(Pa)||b.match(c.mimePattern)):null};this.canPlayURL=function(b){var a;c.hasHTML5&&(a=P({url:b}));return!s||a?a:b?!!b.match(c.filePattern):null};this.canPlayLink=function(b){return"undefined"!==typeof b.type&&b.type&&c.canPlayMIME(b.type)?!0:c.canPlayURL(b.href)};this.getSoundById=function(b){if(!b)throw Error("soundManager.getSoundById(): sID is null/undefined");return c.sounds[b]}; |
| 28 | +this.onready=function(b,a){if(b&&b instanceof Function)return a||(a=j),ja("onready",b,a),C(),!0;throw G("needFunction","onready");};this.ontimeout=function(b,a){if(b&&b instanceof Function)return a||(a=j),ja("ontimeout",b,a),C({type:"ontimeout"}),!0;throw G("needFunction","ontimeout");};this._wD=this._writeDebug=function(){return!0};this._debug=function(){};this.reboot=function(){var b,a;for(b=c.soundIDs.length;b--;)c.sounds[c.soundIDs[b]].destruct();try{if(y)pa=h.innerHTML;N=h.parentNode.removeChild(h)}catch(e){}pa= |
| 29 | +N=s=null;c.enabled=ma=m=$=sa=K=L=w=c.swfLoaded=!1;c.soundIDs=c.sounds=[];h=null;for(b in v)if(v.hasOwnProperty(b))for(a=v[b].length;a--;)v[b][a].fired=!1;j.setTimeout(c.beginDelayedInit,20)};this.getMoviePercent=function(){return h&&"undefined"!==typeof h.PercentLoaded?h.PercentLoaded():null};this.beginDelayedInit=function(){ia=!0;E();setTimeout(function(){if(sa)return!1;W();V();return sa=!0},20);U()};this.destruct=function(){c.disable(!0)};Aa=function(b){var a=this,e,f,d,g,z,j,k=!1,t=[],l=0,n,p, |
| 30 | +m=null,r=null,s=null;this.sID=b.id;this.url=b.url;this._iO=this.instanceOptions=this.options=q(b);this.pan=this.options.pan;this.volume=this.options.volume;this.isHTML5=!1;this._a=null;this.id3={};this._debug=function(){};this.load=function(b){var c=null;if("undefined"!==typeof b)a._iO=q(b,a.options),a.instanceOptions=a._iO;else if(b=a.options,a._iO=b,a.instanceOptions=a._iO,m&&m!==a.url)a._iO.url=a.url,a.url=null;if(!a._iO.url)a._iO.url=a.url;a._iO.url=ba(a._iO.url);if(a._iO.url===a.url&&0!==a.readyState&& |
| 31 | +2!==a.readyState)return 3===a.readyState&&a._iO.onload&&a._iO.onload.apply(a,[!!a.duration]),a;b=a._iO;m=a.url;a.loaded=!1;a.readyState=1;a.playState=0;if(ca(b)){if(c=a._setup_html5(b),!c._called_load)a._html5_canplay=!1,a._a.autobuffer="auto",a._a.preload="auto",c.load(),c._called_load=!0,b.autoPlay&&a.play()}else try{a.isHTML5=!1,a._iO=Z(Y(b)),b=a._iO,8===i?h._load(a.sID,b.url,b.stream,b.autoPlay,b.whileloading?1:0,b.loops||1,b.usePolicyFile):h._load(a.sID,b.url,!!b.stream,!!b.autoPlay,b.loops|| |
| 32 | +1,!!b.autoLoad,b.usePolicyFile)}catch(d){F({type:"SMSOUND_LOAD_JS_EXCEPTION",fatal:!0})}return a};this.unload=function(){0!==a.readyState&&(a.isHTML5?(g(),a._a&&(a._a.pause(),ta(a._a))):8===i?h._unload(a.sID,"about:blank"):h._unload(a.sID),e());return a};this.destruct=function(b){if(a.isHTML5){if(g(),a._a)a._a.pause(),ta(a._a),B||d(),a._a._t=null,a._a=null}else a._iO.onfailure=null,h._destroySound(a.sID);b||c.destroySound(a.sID,!0)};this.start=this.play=function(b,c){var d,c=void 0===c?!0:c;b||(b= |
| 33 | +{});a._iO=q(b,a._iO);a._iO=q(a._iO,a.options);a._iO.url=ba(a._iO.url);a.instanceOptions=a._iO;if(a._iO.serverURL&&!a.connected)return a.getAutoPlay()||a.setAutoPlay(!0),a;ca(a._iO)&&(a._setup_html5(a._iO),z());if(1===a.playState&&!a.paused&&(d=a._iO.multiShot,!d))return a;if(!a.loaded)if(0===a.readyState){if(!a.isHTML5)a._iO.autoPlay=!0;a.load(a._iO)}else if(2===a.readyState)return a;if(!a.isHTML5&&9===i&&0<a.position&&a.position===a.duration)b.position=0;if(a.paused&&a.position&&0<a.position)a.resume(); |
| 34 | +else{a._iO=q(b,a._iO);if(null!==a._iO.from&&null!==a._iO.to&&0===a.instanceCount&&0===a.playState&&!a._iO.serverURL){d=function(){a._iO=q(b,a._iO);a.play(a._iO)};if(a.isHTML5&&!a._html5_canplay)return a.load({_oncanplay:d}),!1;if(!a.isHTML5&&!a.loaded&&(!a.readyState||2!==a.readyState))return a.load({onload:d}),!1;a._iO=p()}(!a.instanceCount||a._iO.multiShotEvents||!a.isHTML5&&8<i&&!a.getAutoPlay())&&a.instanceCount++;0===a.playState&&a._iO.onposition&&j(a);a.playState=1;a.paused=!1;a.position="undefined"!== |
| 35 | +typeof a._iO.position&&!isNaN(a._iO.position)?a._iO.position:0;if(!a.isHTML5)a._iO=Z(Y(a._iO));a._iO.onplay&&c&&(a._iO.onplay.apply(a),k=!0);a.setVolume(a._iO.volume,!0);a.setPan(a._iO.pan,!0);a.isHTML5?(z(),d=a._setup_html5(),a.setPosition(a._iO.position),d.play()):h._start(a.sID,a._iO.loops||1,9===i?a._iO.position:a._iO.position/1E3)}return a};this.stop=function(b){var c=a._iO;if(1===a.playState){a._onbufferchange(0);a._resetOnPosition(0);a.paused=!1;if(!a.isHTML5)a.playState=0;n();c.to&&a.clearOnPosition(c.to); |
| 36 | +if(a.isHTML5){if(a._a)b=a.position,a.setPosition(0),a.position=b,a._a.pause(),a.playState=0,a._onTimer(),g()}else h._stop(a.sID,b),c.serverURL&&a.unload();a.instanceCount=0;a._iO={};c.onstop&&c.onstop.apply(a)}return a};this.setAutoPlay=function(b){a._iO.autoPlay=b;a.isHTML5||(h._setAutoPlay(a.sID,b),b&&!a.instanceCount&&1===a.readyState&&a.instanceCount++)};this.getAutoPlay=function(){return a._iO.autoPlay};this.setPosition=function(b){void 0===b&&(b=0);var c=a.isHTML5?Math.max(b,0):Math.min(a.duration|| |
| 37 | +a._iO.duration,Math.max(b,0));a.position=c;b=a.position/1E3;a._resetOnPosition(a.position);a._iO.position=c;if(a.isHTML5){if(a._a&&a._html5_canplay&&a._a.currentTime!==b)try{a._a.currentTime=b,(0===a.playState||a.paused)&&a._a.pause()}catch(d){}}else b=9===i?a.position:b,a.readyState&&2!==a.readyState&&h._setPosition(a.sID,b,a.paused||!a.playState);a.isHTML5&&a.paused&&a._onTimer(!0);return a};this.pause=function(b){if(a.paused||0===a.playState&&1!==a.readyState)return a;a.paused=!0;a.isHTML5?(a._setup_html5().pause(), |
| 38 | +g()):(b||void 0===b)&&h._pause(a.sID);a._iO.onpause&&a._iO.onpause.apply(a);return a};this.resume=function(){var b=a._iO;if(!a.paused)return a;a.paused=!1;a.playState=1;a.isHTML5?(a._setup_html5().play(),z()):(b.isMovieStar&&!b.serverURL&&a.setPosition(a.position),h._pause(a.sID));k&&b.onplay?(b.onplay.apply(a),k=!0):b.onresume&&b.onresume.apply(a);return a};this.togglePause=function(){if(0===a.playState)return a.play({position:9===i&&!a.isHTML5?a.position:a.position/1E3}),a;a.paused?a.resume():a.pause(); |
| 39 | +return a};this.setPan=function(b,c){"undefined"===typeof b&&(b=0);"undefined"===typeof c&&(c=!1);a.isHTML5||h._setPan(a.sID,b);a._iO.pan=b;if(!c)a.pan=b,a.options.pan=b;return a};this.setVolume=function(b,d){"undefined"===typeof b&&(b=100);"undefined"===typeof d&&(d=!1);if(a.isHTML5){if(a._a)a._a.volume=Math.max(0,Math.min(1,b/100))}else h._setVolume(a.sID,c.muted&&!a.muted||a.muted?0:b);a._iO.volume=b;if(!d)a.volume=b,a.options.volume=b;return a};this.mute=function(){a.muted=!0;if(a.isHTML5){if(a._a)a._a.muted= |
| 40 | +!0}else h._setVolume(a.sID,0);return a};this.unmute=function(){a.muted=!1;var b="undefined"!==typeof a._iO.volume;if(a.isHTML5){if(a._a)a._a.muted=!1}else h._setVolume(a.sID,b?a._iO.volume:a.options.volume);return a};this.toggleMute=function(){return a.muted?a.unmute():a.mute()};this.onposition=this.onPosition=function(b,c,d){t.push({position:b,method:c,scope:"undefined"!==typeof d?d:a,fired:!1});return a};this.clearOnPosition=function(a,b){var c,a=parseInt(a,10);if(isNaN(a))return!1;for(c=0;c<t.length;c++)if(a=== |
| 41 | +t[c].position&&(!b||b===t[c].method))t[c].fired&&l--,t.splice(c,1)};this._processOnPosition=function(){var b,c;b=t.length;if(!b||!a.playState||l>=b)return!1;for(;b--;)if(c=t[b],!c.fired&&a.position>=c.position)c.fired=!0,l++,c.method.apply(c.scope,[c.position]);return!0};this._resetOnPosition=function(a){var b,c;b=t.length;if(!b)return!1;for(;b--;)if(c=t[b],c.fired&&a<=c.position)c.fired=!1,l--;return!0};p=function(){var b=a._iO,c=b.from,d=b.to,e,f;f=function(){a.clearOnPosition(d,f);a.stop()};e= |
| 42 | +function(){if(null!==d&&!isNaN(d))a.onPosition(d,f)};if(null!==c&&!isNaN(c))b.position=c,b.multiShot=!1,e();return b};j=function(){var b=a._iO.onposition;if(b)for(var c in b)if(b.hasOwnProperty(c))a.onPosition(parseInt(c,10),b[c])};n=function(){var b=a._iO.onposition;if(b)for(var c in b)b.hasOwnProperty(c)&&a.clearOnPosition(parseInt(c,10))};z=function(){a.isHTML5&&Fa(a)};g=function(){a.isHTML5&&Ga(a)};e=function(){t=[];l=0;k=!1;a._hasTimer=null;a._a=null;a._html5_canplay=!1;a.bytesLoaded=null;a.bytesTotal= |
| 43 | +null;a.duration=a._iO&&a._iO.duration?a._iO.duration:null;a.durationEstimate=null;a.eqData=[];a.eqData.left=[];a.eqData.right=[];a.failures=0;a.isBuffering=!1;a.instanceOptions={};a.instanceCount=0;a.loaded=!1;a.metadata={};a.readyState=0;a.muted=!1;a.paused=!1;a.peakData={left:0,right:0};a.waveformData={left:[],right:[]};a.playState=0;a.position=null};e();this._onTimer=function(b){var c,d=!1,e={};if(a._hasTimer||b){if(a._a&&(b||(0<a.playState||1===a.readyState)&&!a.paused)){c=a._get_html5_duration(); |
| 44 | +if(c!==r)r=c,a.duration=c,d=!0;a.durationEstimate=a.duration;c=1E3*a._a.currentTime||0;c!==s&&(s=c,d=!0);(d||b)&&a._whileplaying(c,e,e,e,e);return d}return!1}};this._get_html5_duration=function(){var b=a._iO,c=a._a?1E3*a._a.duration:b?b.duration:void 0;return c&&!isNaN(c)&&Infinity!==c?c:b?b.duration:null};this._setup_html5=function(b){var b=q(a._iO,b),d=decodeURI,g=B?c._global_a:a._a,h=d(b.url),z=g&&g._t?g._t.instanceOptions:null;if(g){if(g._t&&(!B&&h===d(m)||B&&z.url===b.url&&(!m||m===z.url)))return g; |
| 45 | +B&&g._t&&g._t.playState&&b.url!==z.url&&g._t.stop();e();g.src=b.url;m=a.url=b.url;g._called_load=!1}else{g=new Audio(b.url);g._called_load=!1;if(Ta)g._called_load=!0;if(B)c._global_a=g}a.isHTML5=!0;a._a=g;g._t=a;f();g.loop=1<b.loops?"loop":"";b.autoLoad||b.autoPlay?a.load():(g.autobuffer=!1,g.preload="none");g.loop=1<b.loops?"loop":"";return g};f=function(){if(a._a._added_events)return!1;var b;a._a._added_events=!0;for(b in u)u.hasOwnProperty(b)&&a._a&&a._a.addEventListener(b,u[b],!1);return!0};d= |
| 46 | +function(){var b;a._a._added_events=!1;for(b in u)u.hasOwnProperty(b)&&a._a&&a._a.removeEventListener(b,u[b],!1)};this._onload=function(b){b=!!b;a.loaded=b;a.readyState=b?3:2;a._onbufferchange(0);a._iO.onload&&a._iO.onload.apply(a,[b]);return!0};this._onbufferchange=function(b){if(0===a.playState||b&&a.isBuffering||!b&&!a.isBuffering)return!1;a.isBuffering=1===b;a._iO.onbufferchange&&a._iO.onbufferchange.apply(a);return!0};this._onsuspend=function(){a._iO.onsuspend&&a._iO.onsuspend.apply(a);return!0}; |
| 47 | +this._onfailure=function(b,c,d){a.failures++;if(a._iO.onfailure&&1===a.failures)a._iO.onfailure(a,b,c,d)};this._onfinish=function(){var b=a._iO.onfinish;a._onbufferchange(0);a._resetOnPosition(0);if(a.instanceCount){a.instanceCount--;if(!a.instanceCount)n(),a.playState=0,a.paused=!1,a.instanceCount=0,a.instanceOptions={},a._iO={},g();(!a.instanceCount||a._iO.multiShotEvents)&&b&&b.apply(a)}};this._whileloading=function(b,c,d,e){var f=a._iO;a.bytesLoaded=b;a.bytesTotal=c;a.duration=Math.floor(d);a.bufferLength= |
| 48 | +e;if(f.isMovieStar)a.durationEstimate=a.duration;else if(a.durationEstimate=f.duration?a.duration>f.duration?a.duration:f.duration:parseInt(a.bytesTotal/a.bytesLoaded*a.duration,10),void 0===a.durationEstimate)a.durationEstimate=a.duration;3!==a.readyState&&f.whileloading&&f.whileloading.apply(a)};this._whileplaying=function(b,c,d,e,f){var g=a._iO;if(isNaN(b)||null===b)return!1;a.position=b;a._processOnPosition();if(!a.isHTML5&&8<i){if(g.usePeakData&&"undefined"!==typeof c&&c)a.peakData={left:c.leftPeak, |
| 49 | +right:c.rightPeak};if(g.useWaveformData&&"undefined"!==typeof d&&d)a.waveformData={left:d.split(","),right:e.split(",")};if(g.useEQData&&"undefined"!==typeof f&&f&&f.leftEQ&&(b=f.leftEQ.split(","),a.eqData=b,a.eqData.left=b,"undefined"!==typeof f.rightEQ&&f.rightEQ))a.eqData.right=f.rightEQ.split(",")}1===a.playState&&(!a.isHTML5&&8===i&&!a.position&&a.isBuffering&&a._onbufferchange(0),g.whileplaying&&g.whileplaying.apply(a));return!0};this._onmetadata=function(b,c){var d={},e,f;for(e=0,f=b.length;e< |
| 50 | +f;e++)d[b[e]]=c[e];a.metadata=d;a._iO.onmetadata&&a._iO.onmetadata.apply(a)};this._onid3=function(b,c){var d=[],e,f;for(e=0,f=b.length;e<f;e++)d[b[e]]=c[e];a.id3=q(a.id3,d);a._iO.onid3&&a._iO.onid3.apply(a)};this._onconnect=function(b){b=1===b;if(a.connected=b)a.failures=0,o(a.sID)&&(a.getAutoPlay()?a.play(void 0,a.getAutoPlay()):a._iO.autoLoad&&a.load()),a._iO.onconnect&&a._iO.onconnect.apply(a,[b])};this._ondataerror=function(){0<a.playState&&a._iO.ondataerror&&a._iO.ondataerror.apply(a)}};na=function(){return k.body|| |
| 51 | +k._docElement||k.getElementsByTagName("div")[0]};S=function(b){return k.getElementById(b)};q=function(b,a){var e={},f,d;for(f in b)b.hasOwnProperty(f)&&(e[f]=b[f]);f="undefined"===typeof a?c.defaultOptions:a;for(d in f)f.hasOwnProperty(d)&&"undefined"===typeof e[d]&&(e[d]=f[d]);return e};n=function(){function b(a){var a=Ra.call(a),b=a.length;c?(a[1]="on"+a[1],3<b&&a.pop()):3===b&&a.push(!1);return a}function a(a,b){var h=a.shift(),k=[f[b]];if(c)h[k](a[0],a[1]);else h[k].apply(h,a)}var c=j.attachEvent, |
| 52 | +f={add:c?"attachEvent":"addEventListener",remove:c?"detachEvent":"removeEventListener"};return{add:function(){a(b(arguments),"add")},remove:function(){a(b(arguments),"remove")}}}();u={abort:l(function(){}),canplay:l(function(){var b=this._t;if(b._html5_canplay)return!0;b._html5_canplay=!0;b._onbufferchange(0);var a=!isNaN(b.position)?b.position/1E3:null;if(b.position&&this.currentTime!==a)try{this.currentTime=a}catch(c){}b._iO._oncanplay&&b._iO._oncanplay()}),load:l(function(){var b=this._t;b.loaded|| |
| 53 | +(b._onbufferchange(0),b._whileloading(b.bytesTotal,b.bytesTotal,b._get_html5_duration()),b._onload(!0))}),emptied:l(function(){}),ended:l(function(){this._t._onfinish()}),error:l(function(){this._t._onload(!1)}),loadeddata:l(function(){var b=this._t,a=b.bytesTotal||1;if(!b._loaded&&!Q)b.duration=b._get_html5_duration(),b._whileloading(a,a,b._get_html5_duration()),b._onload(!0)}),loadedmetadata:l(function(){}),loadstart:l(function(){this._t._onbufferchange(1)}),play:l(function(){this._t._onbufferchange(0)}), |
| 54 | +playing:l(function(){this._t._onbufferchange(0)}),progress:l(function(b){var a=this._t;if(a.loaded)return!1;var c,f=0,d=b.target.buffered;c=b.loaded||0;var g=b.total||1;if(d&&d.length){for(c=d.length;c--;)f=d.end(c)-d.start(c);c=f/b.target.duration}isNaN(c)||(a._onbufferchange(0),a._whileloading(c,g,a._get_html5_duration()),c&&g&&c===g&&u.load.call(this,b))}),ratechange:l(function(){}),suspend:l(function(b){var a=this._t;u.progress.call(this,b);a._onsuspend()}),stalled:l(function(){}),timeupdate:l(function(){this._t._onTimer()}), |
| 55 | +waiting:l(function(){this._t._onbufferchange(1)})};ca=function(b){return!b.serverURL&&(b.type?P({type:b.type}):P({url:b.url})||c.html5Only)};ta=function(b){if(b)b.src=Sa?"":"about:blank"};P=function(b){function a(a){return c.preferFlash&&r&&!c.ignoreFlash&&"undefined"!==typeof c.flash[a]&&c.flash[a]}if(!c.useHTML5Audio||!c.hasHTML5)return!1;var e=b.url||null,b=b.type||null,f=c.audioFormats,d;if(b&&"undefined"!==c.html5[b])return c.html5[b]&&!a(b);if(!x){x=[];for(d in f)f.hasOwnProperty(d)&&(x.push(d), |
| 56 | +f[d].related&&(x=x.concat(f[d].related)));x=RegExp("\\.("+x.join("|")+")(\\?.*)?$","i")}d=e?e.toLowerCase().match(x):null;if(!d||!d.length)if(b)e=b.indexOf(";"),d=(-1!==e?b.substr(0,e):b).substr(6);else return!1;else d=d[1];if(d&&"undefined"!==typeof c.html5[d])return c.html5[d]&&!a(d);b="audio/"+d;e=c.html5.canPlayType({type:b});return(c.html5[d]=e)&&c.html5[b]&&!a(b)};Ja=function(){function b(b){var d,e,f=!1;if(!a||"function"!==typeof a.canPlayType)return!1;if(b instanceof Array){for(d=0,e=b.length;d< |
| 57 | +e&&!f;d++)if(c.html5[b[d]]||a.canPlayType(b[d]).match(c.html5Test))f=!0,c.html5[b[d]]=!0,c.flash[b[d]]=!(!c.preferFlash||!r||!b[d].match(Na));return f}b=a&&"function"===typeof a.canPlayType?a.canPlayType(b):!1;return!(!b||!b.match(c.html5Test))}if(!c.useHTML5Audio||"undefined"===typeof Audio)return!1;var a="undefined"!==typeof Audio?Va?new Audio(null):new Audio:null,e,f={},d,g;d=c.audioFormats;for(e in d)if(d.hasOwnProperty(e)&&(f[e]=b(d[e].type),f["audio/"+e]=f[e],c.flash[e]=c.preferFlash&&!c.ignoreFlash&& |
| 58 | +e.match(Na)?!0:!1,d[e]&&d[e].related))for(g=d[e].related.length;g--;)f["audio/"+d[e].related[g]]=f[e],c.html5[d[e].related[g]]=f[e],c.flash[d[e].related[g]]=f[e];f.canPlayType=a?b:null;c.html5=q(c.html5,f);return!0};G=function(){};Y=function(b){if(8===i&&1<b.loops&&b.stream)b.stream=!1;return b};Z=function(b){if(b&&!b.usePolicyFile&&(b.onid3||b.usePeakData||b.useWaveformData||b.useEQData))b.usePolicyFile=!0;return b};ra=function(){};ha=function(){return!1};Da=function(b){for(var a in b)b.hasOwnProperty(a)&& |
| 59 | +"function"===typeof b[a]&&(b[a]=ha)};X=function(b){"undefined"===typeof b&&(b=!1);(w||b)&&c.disable(b)};Ea=function(b){var a=null;if(b)if(b.match(/\.swf(\?.*)?$/i)){if(a=b.substr(b.toLowerCase().lastIndexOf(".swf?")+4))return b}else b.lastIndexOf("/")!==b.length-1&&(b+="/");b=(b&&-1!==b.lastIndexOf("/")?b.substr(0,b.lastIndexOf("/")+1):"./")+c.movieURL;c.noSWFCache&&(b+="?ts="+(new Date).getTime());return b};ka=function(){i=parseInt(c.flashVersion,10);if(8!==i&&9!==i)c.flashVersion=i=8;var b=c.debugMode|| |
| 60 | +c.debugFlash?"_debug.swf":".swf";if(c.useHTML5Audio&&!c.html5Only&&c.audioFormats.mp4.required&&9>i)c.flashVersion=i=9;c.version=c.versionNumber+(c.html5Only?" (HTML5-only mode)":9===i?" (AS3/Flash 9)":" (AS2/Flash 8)");8<i?(c.defaultOptions=q(c.defaultOptions,c.flash9Options),c.features.buffering=!0,c.defaultOptions=q(c.defaultOptions,c.movieStarOptions),c.filePatterns.flash9=RegExp("\\.(mp3|"+Qa.join("|")+")(\\?.*)?$","i"),c.features.movieStar=!0):c.features.movieStar=!1;c.filePattern=c.filePatterns[8!== |
| 61 | +i?"flash9":"flash8"];c.movieURL=(8===i?"soundmanager2.swf":"soundmanager2_flash9.swf").replace(".swf",b);c.features.peakData=c.features.waveformData=c.features.eqData=8<i};Ca=function(b,a){if(!h)return!1;h._setPolling(b,a)};oa=function(){if(c.debugURLParam.test(ga))c.debugMode=!0};o=this.getSoundById;H=function(){var b=[];c.debugMode&&b.push("sm2_debug");c.debugFlash&&b.push("flash_debug");c.useHighPerformance&&b.push("high_performance");return b.join(" ")};qa=function(){G("fbHandler");var b=c.getMoviePercent(), |
| 62 | +a={type:"FLASHBLOCK"};if(c.html5Only)return!1;if(c.ok()){if(c.oMC)c.oMC.className=[H(),"movieContainer","swf_loaded"+(c.didFlashBlock?" swf_unblocked":"")].join(" ")}else{if(s)c.oMC.className=H()+" movieContainer "+(null===b?"swf_timedout":"swf_error");c.didFlashBlock=!0;C({type:"ontimeout",ignoreInit:!0,error:a});F(a)}};ja=function(b,a,c){"undefined"===typeof v[b]&&(v[b]=[]);v[b].push({method:a,scope:c||null,fired:!1})};C=function(b){b||(b={type:"onready"});if(!m&&b&&!b.ignoreInit||"ontimeout"=== |
| 63 | +b.type&&c.ok())return!1;var a={success:b&&b.ignoreInit?c.ok():!w},e=b&&b.type?v[b.type]||[]:[],f=[],d,a=[a],g=s&&c.useFlashBlock&&!c.ok();if(b.error)a[0].error=b.error;for(b=0,d=e.length;b<d;b++)!0!==e[b].fired&&f.push(e[b]);if(f.length)for(b=0,d=f.length;b<d;b++)if(f[b].scope?f[b].method.apply(f[b].scope,a):f[b].method.apply(this,a),!g)f[b].fired=!0;return!0};D=function(){j.setTimeout(function(){c.useFlashBlock&&qa();C();c.onload instanceof Function&&c.onload.apply(j);c.waitForWindowLoad&&n.add(j, |
| 64 | +"load",D)},1)};da=function(){if(void 0!==r)return r;var b=!1,a=navigator,c=a.plugins,f,d=j.ActiveXObject;if(c&&c.length)(a=a.mimeTypes)&&a["application/x-shockwave-flash"]&&a["application/x-shockwave-flash"].enabledPlugin&&a["application/x-shockwave-flash"].enabledPlugin.description&&(b=!0);else if("undefined"!==typeof d){try{f=new d("ShockwaveFlash.ShockwaveFlash")}catch(g){}b=!!f}return r=b};Ia=function(){var b,a;if(va&&p.match(/os (1|2|3_0|3_1)/i)){c.hasHTML5=!1;c.html5Only=!0;if(c.oMC)c.oMC.style.display= |
| 65 | +"none";return!1}if(c.useHTML5Audio){if(!c.html5||!c.html5.canPlayType)return c.hasHTML5=!1,!0;c.hasHTML5=!0;if(xa&&da())return!0}else return!0;for(a in c.audioFormats)if(c.audioFormats.hasOwnProperty(a)&&(c.audioFormats[a].required&&!c.html5.canPlayType(c.audioFormats[a].type)||c.flash[a]||c.flash[c.audioFormats[a].type]))b=!0;c.ignoreFlash&&(b=!1);c.html5Only=c.hasHTML5&&c.useHTML5Audio&&!b;return!c.html5Only};ba=function(b){var a,e,f=0;if(b instanceof Array){for(a=0,e=b.length;a<e;a++)if(b[a]instanceof |
| 66 | +Object){if(c.canPlayMIME(b[a].type)){f=a;break}}else if(c.canPlayURL(b[a])){f=a;break}if(b[f].url)b[f]=b[f].url;return b[f]}return b};Fa=function(b){if(!b._hasTimer)b._hasTimer=!0,!wa&&c.html5PollingInterval&&(null===O&&0===aa&&(O=J.setInterval(Ha,c.html5PollingInterval)),aa++)};Ga=function(b){if(b._hasTimer)b._hasTimer=!1,!wa&&c.html5PollingInterval&&aa--};Ha=function(){var b;if(null!==O&&!aa)return J.clearInterval(O),O=null,!1;for(b=c.soundIDs.length;b--;)c.sounds[c.soundIDs[b]].isHTML5&&c.sounds[c.soundIDs[b]]._hasTimer&& |
| 67 | +c.sounds[c.soundIDs[b]]._onTimer()};F=function(b){b="undefined"!==typeof b?b:{};c.onerror instanceof Function&&c.onerror.apply(j,[{type:"undefined"!==typeof b.type?b.type:null}]);"undefined"!==typeof b.fatal&&b.fatal&&c.disable()};Ka=function(){if(!xa||!da())return!1;var b=c.audioFormats,a,e;for(e in b)if(b.hasOwnProperty(e)&&("mp3"===e||"mp4"===e))if(c.html5[e]=!1,b[e]&&b[e].related)for(a=b[e].related.length;a--;)c.html5[b[e].related[a]]=!1};this._setSandboxType=function(){};this._externalInterfaceOK= |
| 68 | +function(){if(c.swfLoaded)return!1;(new Date).getTime();c.swfLoaded=!0;I=!1;xa&&Ka();y?setTimeout(T,100):T()};W=function(b,a){function e(a,b){return'<param name="'+a+'" value="'+b+'" />'}if(K&&L)return!1;if(c.html5Only)return ka(),c.oMC=S(c.movieID),T(),L=K=!0,!1;var f=a||c.url,d=c.altURL||f,g;g=na();var h,j,i=H(),l,m=null,m=(m=k.getElementsByTagName("html")[0])&&m.dir&&m.dir.match(/rtl/i),b="undefined"===typeof b?c.id:b;ka();c.url=Ea(za?f:d);a=c.url;c.wmode=!c.wmode&&c.useHighPerformance?"transparent": |
| 69 | +c.wmode;if(null!==c.wmode&&(p.match(/msie 8/i)||!y&&!c.useHighPerformance)&&navigator.platform.match(/win32|win64/i))c.wmode=null;g={name:b,id:b,src:a,width:"auto",height:"auto",quality:"high",allowScriptAccess:c.allowScriptAccess,bgcolor:c.bgColor,pluginspage:Oa+"www.macromedia.com/go/getflashplayer",title:"JS/Flash audio component (SoundManager 2)",type:"application/x-shockwave-flash",wmode:c.wmode,hasPriority:"true"};if(c.debugFlash)g.FlashVars="debug=1";c.wmode||delete g.wmode;if(y)f=k.createElement("div"), |
| 70 | +j=['<object id="'+b+'" data="'+a+'" type="'+g.type+'" title="'+g.title+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="'+Oa+'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" width="'+g.width+'" height="'+g.height+'">',e("movie",a),e("AllowScriptAccess",c.allowScriptAccess),e("quality",g.quality),c.wmode?e("wmode",c.wmode):"",e("bgcolor",c.bgColor),e("hasPriority","true"),c.debugFlash?e("FlashVars",g.FlashVars):"","</object>"].join("");else for(h in f= |
| 71 | +k.createElement("embed"),g)g.hasOwnProperty(h)&&f.setAttribute(h,g[h]);oa();i=H();if(g=na())if(c.oMC=S(c.movieID)||k.createElement("div"),c.oMC.id){l=c.oMC.className;c.oMC.className=(l?l+" ":"movieContainer")+(i?" "+i:"");c.oMC.appendChild(f);if(y)h=c.oMC.appendChild(k.createElement("div")),h.className="sm2-object-box",h.innerHTML=j;L=!0}else{c.oMC.id=c.movieID;c.oMC.className="movieContainer "+i;h=i=null;if(!c.useFlashBlock)if(c.useHighPerformance)i={position:"fixed",width:"8px",height:"8px",bottom:"0px", |
| 72 | +left:"0px",overflow:"hidden"};else if(i={position:"absolute",width:"6px",height:"6px",top:"-9999px",left:"-9999px"},m)i.left=Math.abs(parseInt(i.left,10))+"px";if(Ua)c.oMC.style.zIndex=1E4;if(!c.debugFlash)for(l in i)i.hasOwnProperty(l)&&(c.oMC.style[l]=i[l]);try{y||c.oMC.appendChild(f);g.appendChild(c.oMC);if(y)h=c.oMC.appendChild(k.createElement("div")),h.className="sm2-object-box",h.innerHTML=j;L=!0}catch(n){throw Error(G("domError")+" \n"+n.toString());}}return K=!0};V=function(){if(c.html5Only)return W(), |
| 73 | +!1;if(h)return!1;h=c.getMovie(c.id);if(!h)N?(y?c.oMC.innerHTML=pa:c.oMC.appendChild(N),N=null,K=!0):W(c.id,c.url),h=c.getMovie(c.id);c.oninitmovie instanceof Function&&setTimeout(c.oninitmovie,1);return!0};U=function(){setTimeout(Ba,1E3)};Ba=function(){if($)return!1;$=!0;n.remove(j,"load",U);if(I&&!ya)return!1;var b;m||(b=c.getMoviePercent());setTimeout(function(){b=c.getMoviePercent();!m&&Ma&&(null===b?c.useFlashBlock||0===c.flashLoadTimeout?c.useFlashBlock&&qa():X(!0):0!==c.flashLoadTimeout&&X(!0))}, |
| 74 | +c.flashLoadTimeout)};A=function(){function b(){n.remove(j,"focus",A);n.remove(j,"load",A)}if(ya||!I)return b(),!0;ya=Ma=!0;Q&&I&&n.remove(j,"mousemove",A);$=!1;b();return!0};La=function(){var b,a=[];if(c.useHTML5Audio&&c.hasHTML5)for(b in c.audioFormats)c.audioFormats.hasOwnProperty(b)&&a.push(b+": "+c.html5[b]+(!c.html5[b]&&r&&c.flash[b]?" (using flash)":c.preferFlash&&c.flash[b]&&r?" (preferring flash)":!c.html5[b]?" ("+(c.audioFormats[b].required?"required, ":"")+"and no flash support)":""))}; |
| 75 | +M=function(b){if(m)return!1;if(c.html5Only)return m=!0,D(),!0;var a;if(!c.useFlashBlock||!c.flashLoadTimeout||c.getMoviePercent())m=!0,w&&(a={type:!r&&s?"NO_FLASH":"INIT_TIMEOUT"});if(w||b){if(c.useFlashBlock&&c.oMC)c.oMC.className=H()+" "+(null===c.getMoviePercent()?"swf_timedout":"swf_error");C({type:"ontimeout",error:a});F(a);return!1}if(c.waitForWindowLoad&&!ia)return n.add(j,"load",D),!1;D();return!0};T=function(){if(m)return!1;if(c.html5Only){if(!m)n.remove(j,"load",c.beginDelayedInit),c.enabled= |
| 76 | +!0,M();return!0}V();try{h._externalInterfaceTest(!1),Ca(!0,c.flashPollingInterval||(c.useHighPerformance?10:50)),c.debugMode||h._disableDebug(),c.enabled=!0,c.html5Only||n.add(j,"unload",ha)}catch(b){return F({type:"JS_TO_FLASH_EXCEPTION",fatal:!0}),X(!0),M(),!1}M();n.remove(j,"load",c.beginDelayedInit);return!0};E=function(){if(ma)return!1;ma=!0;oa();if(!r&&c.hasHTML5)c.useHTML5Audio=!0,c.preferFlash=!1;Ja();c.html5.usingFlash=Ia();s=c.html5.usingFlash;La();if(!r&&s)c.flashLoadTimeout=1;k.removeEventListener&& |
| 77 | +k.removeEventListener("DOMContentLoaded",E,!1);V();return!0};ua=function(){"complete"===k.readyState&&(E(),k.detachEvent("onreadystatechange",ua));return!0};la=function(){ia=!0;n.remove(j,"load",la)};da();n.add(j,"focus",A);n.add(j,"load",A);n.add(j,"load",U);n.add(j,"load",la);Q&&I&&n.add(j,"mousemove",A);k.addEventListener?k.addEventListener("DOMContentLoaded",E,!1):k.attachEvent?k.attachEvent("onreadystatechange",ua):F({type:"NO_DOM2_EVENTS",fatal:!0});"complete"===k.readyState&&setTimeout(E,100)} |
| 78 | +var ea=null;if("undefined"===typeof SM2_DEFER||!SM2_DEFER)ea=new R;J.SoundManager=R;J.soundManager=ea})(window); |
\ No newline at end of file |
Index: trunk/extensions/SoundManager2Button/script/soundmanager2.js |
— | — | @@ -8,7 +8,7 @@ |
9 | 9 | * Code provided under the BSD License: |
10 | 10 | * http://schillmania.com/projects/soundmanager2/license.txt |
11 | 11 | * |
12 | | - * V2.97a.20111030 |
| 12 | + * V2.97a.20111220 |
13 | 13 | */ |
14 | 14 | |
15 | 15 | /*global window, SM2_DEFER, sm2Debugger, console, document, navigator, setTimeout, setInterval, clearInterval, Audio */ |
— | — | @@ -26,6 +26,8 @@ |
27 | 27 | * |
28 | 28 | * You may notice <d> and </d> comments in this source; these are delimiters for |
29 | 29 | * debug blocks which are removed in the -nodebug builds, further optimizing code size. |
| 30 | + * |
| 31 | + * Also, as you may note: Whoa, reliable cross-platform/device audio support is hard! ;) |
30 | 32 | */ |
31 | 33 | |
32 | 34 | (function(window) { |
— | — | @@ -46,18 +48,19 @@ |
47 | 49 | |
48 | 50 | // Top-level configuration options |
49 | 51 | |
50 | | - this.flashVersion = 8; // version of flash to require, either 8 or 9. Some API features require Flash 9. |
51 | | - this.debugMode = true; // enable debugging output (div#soundmanager-debug, OR console if available+configured) |
| 52 | + this.flashVersion = 8; // flash build to use (8 or 9.) Some API features require 9. |
| 53 | + this.debugMode = true; // enable debugging output (console.log() with HTML fallback) |
52 | 54 | this.debugFlash = false; // enable debugging output inside SWF, troubleshoot Flash/browser issues |
53 | | - this.useConsole = true; // use firebug/safari console.log()-type debug console if available |
54 | | - this.consoleOnly = false; // if console is being used, do not create/write to #soundmanager-debug |
| 55 | + this.useConsole = true; // use console.log() if available (otherwise, writes to #soundmanager-debug element) |
| 56 | + this.consoleOnly = true; // if console is being used, do not create/write to #soundmanager-debug |
55 | 57 | this.waitForWindowLoad = false; // force SM2 to wait for window.onload() before trying to call soundManager.onload() |
56 | | - this.bgColor = '#ffffff'; // movie (.swf) background color, eg. '#000000' |
| 58 | + this.bgColor = '#ffffff'; // SWF background color. N/A when wmode = 'transparent' |
57 | 59 | this.useHighPerformance = false; // position:fixed flash movie can help increase js/flash speed, minimize lag |
58 | 60 | this.flashPollingInterval = null; // msec affecting whileplaying/loading callback frequency. If null, default of 50 msec is used. |
| 61 | + this.html5PollingInterval = null; // msec affecting whileplaying() for HTML5 audio, excluding mobile devices. If null, native HTML5 update events are used. |
59 | 62 | this.flashLoadTimeout = 1000; // msec to wait for flash movie to load before failing (0 = infinity) |
60 | | - this.wmode = null; // string: flash rendering mode - null, transparent, opaque (last two allow layering of HTML on top) |
61 | | - this.allowScriptAccess = 'always'; // for scripting the SWF (object/embed property), either 'always' or 'sameDomain' |
| 63 | + this.wmode = null; // flash rendering mode - null, 'transparent', or 'opaque' (last two allow z-index to work) |
| 64 | + this.allowScriptAccess = 'always'; // for scripting the SWF (object/embed property), 'always' or 'sameDomain' |
62 | 65 | this.useFlashBlock = false; // *requires flashblock.css, see demos* - allow recovery from flash blockers. Wait indefinitely and apply timeout CSS to SWF, if applicable. |
63 | 66 | this.useHTML5Audio = true; // use HTML5 Audio() where API is supported (most Safari, Chrome versions), Firefox (no MP3/MP4.) Ideally, transparent vs. Flash API where possible. |
64 | 67 | this.html5Test = /^(probably|maybe)$/i; // HTML5 Audio() format support test. Use /^probably$/i; if you want to be more conservative. |
— | — | @@ -82,7 +85,6 @@ |
83 | 86 | 'related': ['aac','m4a'], // additional formats under the MP4 container |
84 | 87 | 'type': ['audio/mp4; codecs="mp4a.40.2"', 'audio/aac', 'audio/x-m4a', 'audio/MP4A-LATM', 'audio/mpeg4-generic'], |
85 | 88 | 'required': false |
86 | | - |
87 | 89 | }, |
88 | 90 | |
89 | 91 | 'ogg': { |
— | — | @@ -105,8 +107,8 @@ |
106 | 108 | */ |
107 | 109 | |
108 | 110 | 'autoLoad': false, // enable automatic loading (otherwise .load() will be called on demand with .play(), the latter being nicer on bandwidth - if you want to .load yourself, you also can) |
109 | | - 'stream': true, // allows playing before entire file has loaded (recommended) |
110 | 111 | 'autoPlay': false, // enable playing of file as soon as possible (much faster if "stream" is true) |
| 112 | + 'from': null, // position to start playback within a sound (msec), default = beginning |
111 | 113 | 'loops': 1, // how many times to repeat the sound (position will wrap around to 0, setPosition() will break out of loop when >0) |
112 | 114 | 'onid3': null, // callback function for "ID3 data is added/available" |
113 | 115 | 'onload': null, // callback function for "load finished" |
— | — | @@ -115,6 +117,7 @@ |
116 | 118 | 'onpause': null, // callback for "pause" |
117 | 119 | 'onresume': null, // callback for "resume" (pause toggle) |
118 | 120 | 'whileplaying': null, // callback during play (position update) |
| 121 | + 'onposition': null, // object containing times and function callbacks for positions of interest |
119 | 122 | 'onstop': null, // callback for "user stop" |
120 | 123 | 'onfailure': null, // callback function for when playing fails |
121 | 124 | 'onfinish': null, // callback function for "sound finished playing" |
— | — | @@ -122,6 +125,8 @@ |
123 | 126 | 'multiShotEvents': false, // fire multiple sound events (currently onfinish() only) when multiShot is enabled |
124 | 127 | 'position': null, // offset (milliseconds) to seek to within loaded sound data. |
125 | 128 | 'pan': 0, // "pan" settings, left-to-right, -100 to 100 |
| 129 | + 'stream': true, // allows playing before entire file has loaded (recommended) |
| 130 | + 'to': null, // position to end playback within a sound (msec), default = end |
126 | 131 | 'type': null, // MIME-like hint for file pattern / canPlay() tests, eg. audio/mp3 |
127 | 132 | 'usePolicyFile': false, // enable crossdomain.xml request for audio on remote domains (for ID3/waveform access) |
128 | 133 | 'volume': 100 // self-explanatory. 0-100, the latter being the max. |
— | — | @@ -163,38 +168,22 @@ |
164 | 169 | this.movieID = 'sm2-container'; |
165 | 170 | this.id = (smID || 'sm2movie'); |
166 | 171 | |
167 | | - this.swfCSS = { |
168 | | - |
169 | | - 'swfBox': 'sm2-object-box', |
170 | | - 'swfDefault': 'movieContainer', |
171 | | - 'swfError': 'swf_error', // SWF loaded, but SM2 couldn't start (other error) |
172 | | - 'swfTimedout': 'swf_timedout', |
173 | | - 'swfLoaded': 'swf_loaded', |
174 | | - 'swfUnblocked': 'swf_unblocked', // or loaded OK |
175 | | - 'sm2Debug': 'sm2_debug', |
176 | | - 'highPerf': 'high_performance', |
177 | | - 'flashDebug': 'flash_debug' |
178 | | - |
179 | | - }; |
180 | | - |
181 | 172 | this.debugID = 'soundmanager-debug'; |
182 | 173 | this.debugURLParam = /([#?&])debug=1/i; |
183 | 174 | |
184 | 175 | // dynamic attributes |
185 | 176 | |
186 | | - this.versionNumber = 'V2.97a.20111030'; |
| 177 | + this.versionNumber = 'V2.97a.20111220'; |
187 | 178 | this.version = null; |
188 | 179 | this.movieURL = null; |
189 | 180 | this.url = (smURL || null); |
190 | 181 | this.altURL = null; |
191 | 182 | this.swfLoaded = false; |
192 | 183 | this.enabled = false; |
193 | | - this.o = null; |
194 | 184 | this.oMC = null; |
195 | 185 | this.sounds = {}; |
196 | 186 | this.soundIDs = []; |
197 | 187 | this.muted = false; |
198 | | - this.specialWmodeCase = false; |
199 | 188 | this.didFlashBlock = false; |
200 | 189 | this.filePattern = null; |
201 | 190 | |
— | — | @@ -261,7 +250,7 @@ |
262 | 251 | 'usingFlash': null // set if/when flash fallback is needed |
263 | 252 | }; |
264 | 253 | |
265 | | - this.flash = {}; |
| 254 | + this.flash = {}; // file type support hash |
266 | 255 | |
267 | 256 | this.html5Only = false; // determined at init time |
268 | 257 | this.ignoreFlash = false; // used for special cases (eg. iPad/iPhone/palm OS?) |
— | — | @@ -271,10 +260,11 @@ |
272 | 261 | */ |
273 | 262 | |
274 | 263 | var SMSound, |
275 | | - _s = this, _sm = 'soundManager', _smc = _sm+'::', _h5 = 'HTML5::', _id, _ua = navigator.userAgent, _win = window, _wl = _win.location.href.toString(), _doc = document, _doNothing, _init, _fV, _on_queue = [], _debugOpen = true, _debugTS, _didAppend = false, _appendSuccess = false, _didInit = false, _disabled = false, _windowLoaded = false, _wDS, _wdCount = 0, _initComplete, _mixin, _addOnEvent, _processOnEvents, _initUserOnload, _delayWaitForEI, _waitForEI, _setVersionInfo, _handleFocus, _strings, _initMovie, _domContentLoaded, _didDCLoaded, _getDocument, _createMovie, _catchError, _setPolling, _initDebug, _debugLevels = ['log', 'info', 'warn', 'error'], _defaultFlashVersion = 8, _disableObject, _failSafely, _normalizeMovieURL, _oRemoved = null, _oRemovedHTML = null, _str, _flashBlockHandler, _getSWFCSS, _toggleDebug, _loopFix, _policyFix, _complain, _idCheck, _waitingForEI = false, _initPending = false, _smTimer, _onTimer, _startTimer, _stopTimer, _needsFlash = null, _featureCheck, _html5OK, _html5CanPlay, _html5Ext, _html5Unload, _domContentLoadedIE, _testHTML5, _event, _slice = Array.prototype.slice, _useGlobalHTML5Audio = false, _hasFlash, _detectFlash, _badSafariFix, _html5_events, _showSupport, |
| 264 | + _s = this, _flash = null, _sm = 'soundManager', _smc = _sm+'::', _h5 = 'HTML5::', _id, _ua = navigator.userAgent, _win = window, _wl = _win.location.href.toString(), _doc = document, _doNothing, _init, _fV, _on_queue = [], _debugOpen = true, _debugTS, _didAppend = false, _appendSuccess = false, _didInit = false, _disabled = false, _windowLoaded = false, _wDS, _wdCount = 0, _initComplete, _mixin, _addOnEvent, _processOnEvents, _initUserOnload, _delayWaitForEI, _waitForEI, _setVersionInfo, _handleFocus, _strings, _initMovie, _domContentLoaded, _winOnLoad, _didDCLoaded, _getDocument, _createMovie, _catchError, _setPolling, _initDebug, _debugLevels = ['log', 'info', 'warn', 'error'], _defaultFlashVersion = 8, _disableObject, _failSafely, _normalizeMovieURL, _oRemoved = null, _oRemovedHTML = null, _str, _flashBlockHandler, _getSWFCSS, _swfCSS, _toggleDebug, _loopFix, _policyFix, _complain, _idCheck, _waitingForEI = false, _initPending = false, _smTimer, _onTimer, _startTimer, _stopTimer, _timerExecute, _h5TimerCount = 0, _h5IntervalTimer = null, _parseURL, |
| 265 | + _needsFlash = null, _featureCheck, _html5OK, _html5CanPlay, _html5Ext, _html5Unload, _domContentLoadedIE, _testHTML5, _event, _slice = Array.prototype.slice, _useGlobalHTML5Audio = false, _hasFlash, _detectFlash, _badSafariFix, _html5_events, _showSupport, |
276 | 266 | _is_iDevice = _ua.match(/(ipad|iphone|ipod)/i), _is_firefox = _ua.match(/firefox/i), _is_android = _ua.match(/droid/i), _isIE = _ua.match(/msie/i), _isWebkit = _ua.match(/webkit/i), _isSafari = (_ua.match(/safari/i) && !_ua.match(/chrome/i)), _isOpera = (_ua.match(/opera/i)), |
277 | 267 | _likesHTML5 = (_ua.match(/(mobile|pre\/|xoom)/i) || _is_iDevice), |
278 | | - _isBadSafari = (!_wl.match(/usehtml5audio/i) && !_wl.match(/sm2\-ignorebadua/i) && _isSafari && _ua.match(/OS X 10_6_([3-7])/i)), // Safari 4 and 5 occasionally fail to load/play HTML5 audio on Snow Leopard 10.6.3 through 10.6.7 due to bug(s) in QuickTime X and/or other underlying frameworks. :/ Confirmed bug. https://bugs.webkit.org/show_bug.cgi?id=32159 |
| 268 | + _isBadSafari = (!_wl.match(/usehtml5audio/i) && !_wl.match(/sm2\-ignorebadua/i) && _isSafari && !_ua.match(/silk/i) && _ua.match(/OS X 10_6_([3-7])/i)), // Safari 4 and 5 (excluding Kindle Fire, "Silk") occasionally fail to load/play HTML5 audio on Snow Leopard 10.6.3 through 10.6.7 due to bug(s) in QuickTime X and/or other underlying frameworks. :/ Confirmed bug. https://bugs.webkit.org/show_bug.cgi?id=32159 |
279 | 269 | _hasConsole = (typeof console !== 'undefined' && typeof console.log !== 'undefined'), _isFocused = (typeof _doc.hasFocus !== 'undefined'?_doc.hasFocus():null), _tryInitOnFocus = (_isSafari && typeof _doc.hasFocus === 'undefined'), _okToDisable = !_tryInitOnFocus, _flashMIME = /(mp3|mp4|mpa)/i, |
280 | 270 | _emptyURL = 'about:blank', // safe URL to unload, or load nothing from (flash 8 + most HTML5 UAs) |
281 | 271 | _overHTTP = (_doc.location?_doc.location.protocol.match(/http/i):null), |
— | — | @@ -284,12 +274,27 @@ |
285 | 275 | // Flash v9.0r115+ "moviestar" formats |
286 | 276 | _netStreamTypes = ['mpeg4', 'aac', 'flv', 'mov', 'mp4', 'm4v', 'f4v', 'm4a', 'mp4v', '3gp', '3g2'], |
287 | 277 | _netStreamPattern = new RegExp('\\.(' + _netStreamTypes.join('|') + ')(\\?.*)?$', 'i'); |
| 278 | + |
288 | 279 | this.mimePattern = /^\s*audio\/(?:x-)?(?:mp(?:eg|3))\s*(?:$|;)/i; // default mp3 set |
289 | 280 | |
290 | 281 | // use altURL if not "online" |
291 | 282 | this.useAltURL = !_overHTTP; |
292 | 283 | this._global_a = null; |
293 | 284 | |
| 285 | + _swfCSS = { |
| 286 | + |
| 287 | + 'swfBox': 'sm2-object-box', |
| 288 | + 'swfDefault': 'movieContainer', |
| 289 | + 'swfError': 'swf_error', // SWF loaded, but SM2 couldn't start (other error) |
| 290 | + 'swfTimedout': 'swf_timedout', |
| 291 | + 'swfLoaded': 'swf_loaded', |
| 292 | + 'swfUnblocked': 'swf_unblocked', // or loaded OK |
| 293 | + 'sm2Debug': 'sm2_debug', |
| 294 | + 'highPerf': 'high_performance', |
| 295 | + 'flashDebug': 'flash_debug' |
| 296 | + |
| 297 | + }; |
| 298 | + |
294 | 299 | if (_likesHTML5) { |
295 | 300 | |
296 | 301 | // prefer HTML5 for mobile + tablet-like devices, probably more reliable vs. flash at this point. |
— | — | @@ -333,11 +338,16 @@ |
334 | 339 | |
335 | 340 | this.createSound = function(oOptions) { |
336 | 341 | |
337 | | - var _cs = _sm+'.createSound(): ', |
| 342 | + var _cs, _cs_string, |
338 | 343 | thisOptions = null, oSound = null, _tO = null; |
339 | 344 | |
| 345 | + // <d> |
| 346 | + _cs = _sm+'.createSound(): '; |
| 347 | + _cs_string = _cs + _str(!_didInit?'notReady':'notOK'); |
| 348 | + // </d> |
| 349 | + |
340 | 350 | if (!_didInit || !_s.ok()) { |
341 | | - _complain(_cs + _str(!_didInit?'notReady':'notOK')); |
| 351 | + _complain(_cs_string); |
342 | 352 | return false; |
343 | 353 | } |
344 | 354 | |
— | — | @@ -352,7 +362,9 @@ |
353 | 363 | // inherit from defaultOptions |
354 | 364 | thisOptions = _mixin(oOptions); |
355 | 365 | |
356 | | - // alias |
| 366 | + thisOptions.url = _parseURL(thisOptions.url); |
| 367 | + |
| 368 | + // local shortcut |
357 | 369 | _tO = thisOptions; |
358 | 370 | |
359 | 371 | // <d> |
— | — | @@ -412,9 +424,9 @@ |
413 | 425 | oSound = make(); |
414 | 426 | |
415 | 427 | if (_fV === 8) { |
416 | | - _s.o._createSound(_tO.id, _tO.loops||1, _tO.usePolicyFile); |
| 428 | + _flash._createSound(_tO.id, _tO.loops||1, _tO.usePolicyFile); |
417 | 429 | } else { |
418 | | - _s.o._createSound(_tO.id, _tO.url, _tO.usePeakData, _tO.useWaveformData, _tO.useEQData, _tO.isMovieStar, (_tO.isMovieStar?_tO.bufferTime:false), _tO.loops||1, _tO.serverURL, _tO.duration||null, _tO.autoPlay, true, _tO.autoLoad, _tO.usePolicyFile); |
| 430 | + _flash._createSound(_tO.id, _tO.url, _tO.usePeakData, _tO.useWaveformData, _tO.useEQData, _tO.isMovieStar, (_tO.isMovieStar?_tO.bufferTime:false), _tO.loops||1, _tO.serverURL, _tO.duration||null, _tO.autoPlay, true, _tO.autoLoad, _tO.usePolicyFile); |
419 | 431 | if (!_tO.serverURL) { |
420 | 432 | // We are connected immediately |
421 | 433 | oSound.connected = true; |
— | — | @@ -508,13 +520,12 @@ |
509 | 521 | if (!_idCheck(sID)) { |
510 | 522 | return false; |
511 | 523 | } |
512 | | - |
513 | 524 | return _s.sounds[sID].unload(); |
514 | 525 | |
515 | 526 | }; |
516 | 527 | |
517 | 528 | /** |
518 | | - * Calls the onposition() method of a SMSound object by ID. |
| 529 | + * Calls the onPosition() method of a SMSound object by ID. |
519 | 530 | * |
520 | 531 | * @param {string} sID The ID of the sound |
521 | 532 | * @param {number} nPosition The position to watch for |
— | — | @@ -523,7 +534,7 @@ |
524 | 535 | * @return {SMSound} The SMSound object |
525 | 536 | */ |
526 | 537 | |
527 | | - this.onposition = function(sID, nPosition, oMethod, oScope) { |
| 538 | + this.onPosition = function(sID, nPosition, oMethod, oScope) { |
528 | 539 | |
529 | 540 | if (!_idCheck(sID)) { |
530 | 541 | return false; |
— | — | @@ -532,7 +543,28 @@ |
533 | 544 | |
534 | 545 | }; |
535 | 546 | |
| 547 | + // legacy/backwards-compability: lower-case method name |
| 548 | + this.onposition = this.onPosition; |
| 549 | + |
536 | 550 | /** |
| 551 | + * Calls the clearOnPosition() method of a SMSound object by ID. |
| 552 | + * |
| 553 | + * @param {string} sID The ID of the sound |
| 554 | + * @param {number} nPosition The position to watch for |
| 555 | + * @param {function} oMethod Optional: The relevant callback to fire |
| 556 | + * @return {SMSound} The SMSound object |
| 557 | + */ |
| 558 | + |
| 559 | + this.clearOnPosition = function(sID, nPosition, oMethod) { |
| 560 | + |
| 561 | + if (!_idCheck(sID)) { |
| 562 | + return false; |
| 563 | + } |
| 564 | + return _s.sounds[sID].clearOnPosition(nPosition, oMethod); |
| 565 | + |
| 566 | + }; |
| 567 | + |
| 568 | + /** |
537 | 569 | * Calls the play() method of a SMSound object by ID. |
538 | 570 | * |
539 | 571 | * @param {string} sID The ID of the sound |
— | — | @@ -542,22 +574,21 @@ |
543 | 575 | |
544 | 576 | this.play = function(sID, oOptions) { |
545 | 577 | |
546 | | - var fN = _sm+'.play(): '; |
547 | | - |
548 | 578 | if (!_didInit || !_s.ok()) { |
549 | | - _complain(fN + _str(!_didInit?'notReady':'notOK')); |
| 579 | + _complain(_sm+'.play(): ' + _str(!_didInit?'notReady':'notOK')); |
550 | 580 | return false; |
551 | 581 | } |
552 | 582 | |
553 | 583 | if (!_idCheck(sID)) { |
554 | 584 | if (!(oOptions instanceof Object)) { |
| 585 | + // overloading use case: play('mySound','/path/to/some.mp3'); |
555 | 586 | oOptions = { |
556 | 587 | url: oOptions |
557 | | - }; // overloading use case: play('mySound','/path/to/some.mp3'); |
| 588 | + }; |
558 | 589 | } |
559 | 590 | if (oOptions && oOptions.url) { |
560 | 591 | // overloading use case, create+play: .play('someID',{url:'/path/to.mp3'}); |
561 | | - _s._wD(fN + 'attempting to create "' + sID + '"', 1); |
| 592 | + _s._wD(_sm+'.play(): attempting to create "' + sID + '"', 1); |
562 | 593 | oOptions.id = sID; |
563 | 594 | return _s.createSound(oOptions).play(); |
564 | 595 | } else { |
— | — | @@ -583,7 +614,6 @@ |
584 | 615 | |
585 | 616 | if (!_idCheck(sID)) { |
586 | 617 | return false; |
587 | | - |
588 | 618 | } |
589 | 619 | return _s.sounds[sID].setPosition(nMsecOffset); |
590 | 620 | |
— | — | @@ -601,6 +631,7 @@ |
602 | 632 | if (!_idCheck(sID)) { |
603 | 633 | return false; |
604 | 634 | } |
| 635 | + |
605 | 636 | _s._wD(_sm+'.stop(' + sID + ')', 1); |
606 | 637 | return _s.sounds[sID].stop(); |
607 | 638 | |
— | — | @@ -740,15 +771,14 @@ |
741 | 772 | |
742 | 773 | this.mute = function(sID) { |
743 | 774 | |
744 | | - var fN = _sm+'.mute(): ', |
745 | | - i = 0; |
| 775 | + var i = 0; |
746 | 776 | |
747 | 777 | if (typeof sID !== 'string') { |
748 | 778 | sID = null; |
749 | 779 | } |
750 | 780 | |
751 | 781 | if (!sID) { |
752 | | - _s._wD(fN + 'Muting all sounds'); |
| 782 | + _s._wD(_sm+'.mute(): Muting all sounds'); |
753 | 783 | for (i = _s.soundIDs.length; i--;) { |
754 | 784 | _s.sounds[_s.soundIDs[i]].mute(); |
755 | 785 | } |
— | — | @@ -757,7 +787,7 @@ |
758 | 788 | if (!_idCheck(sID)) { |
759 | 789 | return false; |
760 | 790 | } |
761 | | - _s._wD(fN + 'Muting "' + sID + '"'); |
| 791 | + _s._wD(_sm+'.mute(): Muting "' + sID + '"'); |
762 | 792 | return _s.sounds[sID].mute(); |
763 | 793 | } |
764 | 794 | |
— | — | @@ -783,7 +813,7 @@ |
784 | 814 | |
785 | 815 | this.unmute = function(sID) { |
786 | 816 | |
787 | | - var fN = _sm+'.unmute(): ', i; |
| 817 | + var i; |
788 | 818 | |
789 | 819 | if (typeof sID !== 'string') { |
790 | 820 | sID = null; |
— | — | @@ -791,7 +821,7 @@ |
792 | 822 | |
793 | 823 | if (!sID) { |
794 | 824 | |
795 | | - _s._wD(fN + 'Unmuting all sounds'); |
| 825 | + _s._wD(_sm+'.unmute(): Unmuting all sounds'); |
796 | 826 | for (i = _s.soundIDs.length; i--;) { |
797 | 827 | _s.sounds[_s.soundIDs[i]].unmute(); |
798 | 828 | } |
— | — | @@ -802,7 +832,7 @@ |
803 | 833 | if (!_idCheck(sID)) { |
804 | 834 | return false; |
805 | 835 | } |
806 | | - _s._wD(fN + 'Unmuting "' + sID + '"'); |
| 836 | + _s._wD(_sm+'.unmute(): Unmuting "' + sID + '"'); |
807 | 837 | return _s.sounds[sID].unmute(); |
808 | 838 | |
809 | 839 | } |
— | — | @@ -833,7 +863,6 @@ |
834 | 864 | if (!_idCheck(sID)) { |
835 | 865 | return false; |
836 | 866 | } |
837 | | - |
838 | 867 | return _s.sounds[sID].toggleMute(); |
839 | 868 | |
840 | 869 | }; |
— | — | @@ -849,8 +878,8 @@ |
850 | 879 | // flash-only |
851 | 880 | var ram = 0; |
852 | 881 | |
853 | | - if (_s.o && _fV !== 8) { |
854 | | - ram = parseInt(_s.o._getMemoryUse(), 10); |
| 882 | + if (_flash && _fV !== 8) { |
| 883 | + ram = parseInt(_flash._getMemoryUse(), 10); |
855 | 884 | } |
856 | 885 | |
857 | 886 | return ram; |
— | — | @@ -1082,7 +1111,7 @@ |
1083 | 1112 | } else { |
1084 | 1113 | console.log(sText); |
1085 | 1114 | } |
1086 | | - if (_s.useConsoleOnly) { |
| 1115 | + if (_s.consoleOnly) { |
1087 | 1116 | return true; |
1088 | 1117 | } |
1089 | 1118 | } |
— | — | @@ -1180,9 +1209,9 @@ |
1181 | 1210 | |
1182 | 1211 | try { |
1183 | 1212 | if (_isIE) { |
1184 | | - _oRemovedHTML = _s.o.innerHTML; |
| 1213 | + _oRemovedHTML = _flash.innerHTML; |
1185 | 1214 | } |
1186 | | - _oRemoved = _s.o.parentNode.removeChild(_s.o); |
| 1215 | + _oRemoved = _flash.parentNode.removeChild(_flash); |
1187 | 1216 | _s._wD('Flash movie removed.'); |
1188 | 1217 | } catch(e) { |
1189 | 1218 | // uh-oh. |
— | — | @@ -1194,7 +1223,7 @@ |
1195 | 1224 | |
1196 | 1225 | _s.enabled = _didDCLoaded = _didInit = _waitingForEI = _initPending = _didAppend = _appendSuccess = _disabled = _s.swfLoaded = false; |
1197 | 1226 | _s.soundIDs = _s.sounds = []; |
1198 | | - _s.o = null; |
| 1227 | + _flash = null; |
1199 | 1228 | |
1200 | 1229 | for (i in _on_queue) { |
1201 | 1230 | if (_on_queue.hasOwnProperty(i)) { |
— | — | @@ -1217,7 +1246,7 @@ |
1218 | 1247 | |
1219 | 1248 | this.getMoviePercent = function() { |
1220 | 1249 | |
1221 | | - return (_s.o && typeof _s.o.PercentLoaded !== 'undefined' ? _s.o.PercentLoaded() : null); |
| 1250 | + return (_flash && typeof _flash.PercentLoaded !== 'undefined' ? _flash.PercentLoaded() : null); |
1222 | 1251 | |
1223 | 1252 | }; |
1224 | 1253 | |
— | — | @@ -1269,7 +1298,14 @@ |
1270 | 1299 | |
1271 | 1300 | SMSound = function(oOptions) { |
1272 | 1301 | |
1273 | | - var _t = this, _resetProperties, _stop_html5_timer, _start_html5_timer; |
| 1302 | + var _t = this, _resetProperties, _add_html5_events, _remove_html5_events, _stop_html5_timer, _start_html5_timer, _attachOnPosition, _onplay_called = false, _onPositionItems = [], _onPositionFired = 0, _detachOnPosition, _applyFromTo, _lastURL = null; |
| 1303 | + |
| 1304 | + var _lastHTML5State = { |
| 1305 | + // tracks duration + position (time) |
| 1306 | + duration: null, |
| 1307 | + time: null |
| 1308 | + }; |
| 1309 | + |
1274 | 1310 | this.sID = oOptions.id; |
1275 | 1311 | this.url = oOptions.url; |
1276 | 1312 | this.options = _mixin(oOptions); |
— | — | @@ -1283,7 +1319,6 @@ |
1284 | 1320 | // assign property defaults |
1285 | 1321 | this.pan = this.options.pan; |
1286 | 1322 | this.volume = this.options.volume; |
1287 | | - this._lastURL = null; |
1288 | 1323 | this.isHTML5 = false; |
1289 | 1324 | this._a = null; |
1290 | 1325 | |
— | — | @@ -1342,7 +1377,7 @@ |
1343 | 1378 | |
1344 | 1379 | this.load = function(oOptions) { |
1345 | 1380 | |
1346 | | - var oS = null; |
| 1381 | + var oS = null, _iO; |
1347 | 1382 | |
1348 | 1383 | if (typeof oOptions !== 'undefined') { |
1349 | 1384 | _t._iO = _mixin(oOptions, _t.options); |
— | — | @@ -1351,7 +1386,7 @@ |
1352 | 1387 | oOptions = _t.options; |
1353 | 1388 | _t._iO = oOptions; |
1354 | 1389 | _t.instanceOptions = _t._iO; |
1355 | | - if (_t._lastURL && _t._lastURL !== _t.url) { |
| 1390 | + if (_lastURL && _lastURL !== _t.url) { |
1356 | 1391 | _wDS('manURL'); |
1357 | 1392 | _t._iO.url = _t.url; |
1358 | 1393 | _t.url = null; |
— | — | @@ -1362,31 +1397,52 @@ |
1363 | 1398 | _t._iO.url = _t.url; |
1364 | 1399 | } |
1365 | 1400 | |
| 1401 | + _t._iO.url = _parseURL(_t._iO.url); |
| 1402 | + |
1366 | 1403 | _s._wD('SMSound.load(): ' + _t._iO.url, 1); |
1367 | 1404 | |
1368 | 1405 | if (_t._iO.url === _t.url && _t.readyState !== 0 && _t.readyState !== 2) { |
1369 | 1406 | _wDS('onURL', 1); |
| 1407 | + // if loaded and an onload() exists, fire immediately. |
| 1408 | + if (_t.readyState === 3 && _t._iO.onload) { |
| 1409 | + // assume success based on truthy duration. |
| 1410 | + _t._iO.onload.apply(_t, [(!!_t.duration)]); |
| 1411 | + } |
1370 | 1412 | return _t; |
1371 | 1413 | } |
1372 | 1414 | |
1373 | | - _t._lastURL = _t.url; |
| 1415 | + // local shortcut |
| 1416 | + _iO = _t._iO; |
| 1417 | + |
| 1418 | + _lastURL = _t.url; |
1374 | 1419 | _t.loaded = false; |
1375 | 1420 | _t.readyState = 1; |
1376 | 1421 | _t.playState = 0; |
1377 | 1422 | |
1378 | 1423 | // TODO: If switching from HTML5 -> flash (or vice versa), stop currently-playing audio. |
1379 | 1424 | |
1380 | | - if (_html5OK(_t._iO)) { |
| 1425 | + if (_html5OK(_iO)) { |
1381 | 1426 | |
1382 | | - oS = _t._setup_html5(_t._iO); |
| 1427 | + oS = _t._setup_html5(_iO); |
| 1428 | + |
1383 | 1429 | if (!oS._called_load) { |
| 1430 | + |
1384 | 1431 | _s._wD(_h5+'load: '+_t.sID); |
1385 | 1432 | _t._html5_canplay = false; |
| 1433 | + |
| 1434 | + // given explicit load call, try to get whole file. |
| 1435 | + // early HTML5 implementation (non-standard) |
| 1436 | + _t._a.autobuffer = 'auto'; |
| 1437 | + // standard |
| 1438 | + _t._a.preload = 'auto'; |
| 1439 | + |
1386 | 1440 | oS.load(); |
1387 | 1441 | oS._called_load = true; |
1388 | | - if (_t._iO.autoPlay) { |
| 1442 | + |
| 1443 | + if (_iO.autoPlay) { |
1389 | 1444 | _t.play(); |
1390 | 1445 | } |
| 1446 | + |
1391 | 1447 | } else { |
1392 | 1448 | _s._wD(_h5+'ignoring request to load again: '+_t.sID); |
1393 | 1449 | } |
— | — | @@ -1395,11 +1451,13 @@ |
1396 | 1452 | |
1397 | 1453 | try { |
1398 | 1454 | _t.isHTML5 = false; |
1399 | | - _t._iO = _policyFix(_loopFix(_t._iO)); |
| 1455 | + _t._iO = _policyFix(_loopFix(_iO)); |
| 1456 | + // re-assign local shortcut |
| 1457 | + _iO = _t._iO; |
1400 | 1458 | if (_fV === 8) { |
1401 | | - _s.o._load(_t.sID, _t._iO.url, _t._iO.stream, _t._iO.autoPlay, (_t._iO.whileloading?1:0), _t._iO.loops||1, _t._iO.usePolicyFile); |
| 1459 | + _flash._load(_t.sID, _iO.url, _iO.stream, _iO.autoPlay, (_iO.whileloading?1:0), _iO.loops||1, _iO.usePolicyFile); |
1402 | 1460 | } else { |
1403 | | - _s.o._load(_t.sID, _t._iO.url, !!(_t._iO.stream), !!(_t._iO.autoPlay), _t._iO.loops||1, !!(_t._iO.autoLoad), _t._iO.usePolicyFile); |
| 1461 | + _flash._load(_t.sID, _iO.url, !!(_iO.stream), !!(_iO.autoPlay), _iO.loops||1, !!(_iO.autoLoad), _iO.usePolicyFile); |
1404 | 1462 | } |
1405 | 1463 | } catch(e) { |
1406 | 1464 | _wDS('smError', 2); |
— | — | @@ -1432,9 +1490,9 @@ |
1433 | 1491 | |
1434 | 1492 | if (!_t.isHTML5) { |
1435 | 1493 | if (_fV === 8) { |
1436 | | - _s.o._unload(_t.sID, _emptyURL); |
| 1494 | + _flash._unload(_t.sID, _emptyURL); |
1437 | 1495 | } else { |
1438 | | - _s.o._unload(_t.sID); |
| 1496 | + _flash._unload(_t.sID); |
1439 | 1497 | } |
1440 | 1498 | } else { |
1441 | 1499 | _stop_html5_timer(); |
— | — | @@ -1466,7 +1524,7 @@ |
1467 | 1525 | // kill sound within Flash |
1468 | 1526 | // Disable the onfailure handler |
1469 | 1527 | _t._iO.onfailure = null; |
1470 | | - _s.o._destroySound(_t.sID); |
| 1528 | + _flash._destroySound(_t.sID); |
1471 | 1529 | |
1472 | 1530 | } else { |
1473 | 1531 | |
— | — | @@ -1476,7 +1534,7 @@ |
1477 | 1535 | _t._a.pause(); |
1478 | 1536 | _html5Unload(_t._a); |
1479 | 1537 | if (!_useGlobalHTML5Audio) { |
1480 | | - _t._remove_html5_events(); |
| 1538 | + _remove_html5_events(); |
1481 | 1539 | } |
1482 | 1540 | // break obvious circular reference |
1483 | 1541 | _t._a._t = null; |
— | — | @@ -1502,8 +1560,12 @@ |
1503 | 1561 | |
1504 | 1562 | this.play = function(oOptions, _updatePlayState) { |
1505 | 1563 | |
1506 | | - var fN = 'SMSound.play(): ', allowMulti, a; |
| 1564 | + var fN, allowMulti, a, onready; |
1507 | 1565 | |
| 1566 | + // <d> |
| 1567 | + fN = 'SMSound.play(): '; |
| 1568 | + // </d> |
| 1569 | + |
1508 | 1570 | _updatePlayState = _updatePlayState === undefined ? true : _updatePlayState; // default to true |
1509 | 1571 | |
1510 | 1572 | if (!oOptions) { |
— | — | @@ -1512,6 +1574,7 @@ |
1513 | 1575 | |
1514 | 1576 | _t._iO = _mixin(oOptions, _t._iO); |
1515 | 1577 | _t._iO = _mixin(_t._iO, _t.options); |
| 1578 | + _t._iO.url = _parseURL(_t._iO.url); |
1516 | 1579 | _t.instanceOptions = _t._iO; |
1517 | 1580 | |
1518 | 1581 | // RTMP-only |
— | — | @@ -1544,11 +1607,13 @@ |
1545 | 1608 | if (_t.readyState === 0) { |
1546 | 1609 | |
1547 | 1610 | _s._wD(fN + 'Attempting to load "' + _t.sID + '"', 1); |
| 1611 | + |
1548 | 1612 | // try to get this sound playing ASAP |
1549 | 1613 | if (!_t.isHTML5) { |
1550 | 1614 | // assign directly because setAutoPlay() increments the instanceCount |
1551 | 1615 | _t._iO.autoPlay = true; |
1552 | 1616 | } |
| 1617 | + |
1553 | 1618 | _t.load(_t._iO); |
1554 | 1619 | |
1555 | 1620 | } else if (_t.readyState === 2) { |
— | — | @@ -1571,7 +1636,7 @@ |
1572 | 1637 | if (!_t.isHTML5 && _fV === 9 && _t.position > 0 && _t.position === _t.duration) { |
1573 | 1638 | // flash 9 needs a position reset if play() is called while at the end of a sound. |
1574 | 1639 | _s._wD(fN + '"' + _t.sID + '": Sound at end, resetting to position:0'); |
1575 | | - _t._iO.position = 0; |
| 1640 | + oOptions.position = 0; |
1576 | 1641 | } |
1577 | 1642 | |
1578 | 1643 | /** |
— | — | @@ -1590,35 +1655,89 @@ |
1591 | 1656 | |
1592 | 1657 | } else { |
1593 | 1658 | |
| 1659 | + _t._iO = _mixin(oOptions, _t._iO); |
| 1660 | + |
| 1661 | + // apply from/to parameters, if they exist (and not using RTMP) |
| 1662 | + if (_t._iO.from !== null && _t._iO.to !== null && _t.instanceCount === 0 && _t.playState === 0 && !_t._iO.serverURL) { |
| 1663 | + |
| 1664 | + onready = function() { |
| 1665 | + // sound "canplay" or onload() |
| 1666 | + // re-apply from/to to instance options, and start playback |
| 1667 | + _t._iO = _mixin(oOptions, _t._iO); |
| 1668 | + _t.play(_t._iO); |
| 1669 | + }; |
| 1670 | + |
| 1671 | + // HTML5 needs to at least have "canplay" fired before seeking. |
| 1672 | + if (_t.isHTML5 && !_t._html5_canplay) { |
| 1673 | + |
| 1674 | + // this hasn't been loaded yet. load it first, and then do this again. |
| 1675 | + _s._wD(fN+'Beginning load of "'+ _t.sID+'" for from/to case'); |
| 1676 | + |
| 1677 | + _t.load({ |
| 1678 | + _oncanplay: onready |
| 1679 | + }); |
| 1680 | + |
| 1681 | + return false; |
| 1682 | + |
| 1683 | + } else if (!_t.isHTML5 && !_t.loaded && (!_t.readyState || _t.readyState !== 2)) { |
| 1684 | + |
| 1685 | + // to be safe, preload the whole thing in Flash. |
| 1686 | + |
| 1687 | + _s._wD(fN+'Preloading "'+ _t.sID+'" for from/to case'); |
| 1688 | + |
| 1689 | + _t.load({ |
| 1690 | + onload: onready |
| 1691 | + }); |
| 1692 | + |
| 1693 | + return false; |
| 1694 | + |
| 1695 | + } |
| 1696 | + |
| 1697 | + // otherwise, we're ready to go. re-apply local options, and continue |
| 1698 | + |
| 1699 | + _t._iO = _applyFromTo(); |
| 1700 | + |
| 1701 | + } |
| 1702 | + |
1594 | 1703 | _s._wD(fN+'"'+ _t.sID+'" is starting to play'); |
1595 | | - _t.playState = 1; |
1596 | | - _t.paused = false; |
1597 | 1704 | |
1598 | 1705 | if (!_t.instanceCount || _t._iO.multiShotEvents || (!_t.isHTML5 && _fV > 8 && !_t.getAutoPlay())) { |
1599 | 1706 | _t.instanceCount++; |
1600 | 1707 | } |
1601 | 1708 | |
1602 | | - _t.position = (typeof _t._iO.position !== 'undefined' && !isNaN(_t._iO.position)?_t._iO.position:0); |
| 1709 | + // if first play and onposition parameters exist, apply them now |
| 1710 | + if (_t.playState === 0 && _t._iO.onposition) { |
| 1711 | + _attachOnPosition(_t); |
| 1712 | + } |
1603 | 1713 | |
| 1714 | + _t.playState = 1; |
| 1715 | + _t.paused = false; |
| 1716 | + |
| 1717 | + _t.position = (typeof _t._iO.position !== 'undefined' && !isNaN(_t._iO.position) ? _t._iO.position : 0); |
| 1718 | + |
1604 | 1719 | if (!_t.isHTML5) { |
1605 | 1720 | _t._iO = _policyFix(_loopFix(_t._iO)); |
1606 | 1721 | } |
1607 | 1722 | |
1608 | 1723 | if (_t._iO.onplay && _updatePlayState) { |
1609 | 1724 | _t._iO.onplay.apply(_t); |
1610 | | - _t._onplay_called = true; |
| 1725 | + _onplay_called = true; |
1611 | 1726 | } |
1612 | 1727 | |
1613 | 1728 | _t.setVolume(_t._iO.volume, true); |
1614 | 1729 | _t.setPan(_t._iO.pan, true); |
1615 | 1730 | |
1616 | 1731 | if (!_t.isHTML5) { |
1617 | | - _s.o._start(_t.sID, _t._iO.loops || 1, (_fV === 9?_t._iO.position:_t._iO.position / 1000)); |
| 1732 | + |
| 1733 | + _flash._start(_t.sID, _t._iO.loops || 1, (_fV === 9?_t._iO.position:_t._iO.position / 1000)); |
| 1734 | + |
1618 | 1735 | } else { |
| 1736 | + |
1619 | 1737 | _start_html5_timer(); |
1620 | 1738 | a = _t._setup_html5(); |
1621 | 1739 | _t.setPosition(_t._iO.position); |
1622 | 1740 | a.play(); |
| 1741 | + |
1623 | 1742 | } |
1624 | 1743 | |
1625 | 1744 | } |
— | — | @@ -1639,25 +1758,32 @@ |
1640 | 1759 | |
1641 | 1760 | this.stop = function(bAll) { |
1642 | 1761 | |
| 1762 | + var _iO = _t._iO, _oP; |
| 1763 | + |
1643 | 1764 | if (_t.playState === 1) { |
1644 | 1765 | |
1645 | 1766 | _t._onbufferchange(0); |
1646 | | - _t.resetOnPosition(0); |
| 1767 | + _t._resetOnPosition(0); |
1647 | 1768 | _t.paused = false; |
1648 | 1769 | |
1649 | 1770 | if (!_t.isHTML5) { |
1650 | 1771 | _t.playState = 0; |
1651 | 1772 | } |
1652 | 1773 | |
1653 | | - if (_t._iO.onstop) { |
1654 | | - _t._iO.onstop.apply(_t); |
| 1774 | + // remove onPosition listeners, if any |
| 1775 | + _detachOnPosition(); |
| 1776 | + |
| 1777 | + // and "to" position, if set |
| 1778 | + if (_iO.to) { |
| 1779 | + _t.clearOnPosition(_iO.to); |
1655 | 1780 | } |
1656 | 1781 | |
1657 | 1782 | if (!_t.isHTML5) { |
1658 | 1783 | |
1659 | | - _s.o._stop(_t.sID, bAll); |
| 1784 | + _flash._stop(_t.sID, bAll); |
| 1785 | + |
1660 | 1786 | // hack for netStream: just unload |
1661 | | - if (_t._iO.serverURL) { |
| 1787 | + if (_iO.serverURL) { |
1662 | 1788 | _t.unload(); |
1663 | 1789 | } |
1664 | 1790 | |
— | — | @@ -1665,10 +1791,16 @@ |
1666 | 1792 | |
1667 | 1793 | if (_t._a) { |
1668 | 1794 | |
| 1795 | + _oP = _t.position; |
| 1796 | + |
1669 | 1797 | // act like Flash, though |
1670 | 1798 | _t.setPosition(0); |
1671 | 1799 | |
| 1800 | + // hack: reflect old position for onstop() (also like Flash) |
| 1801 | + _t.position = _oP; |
| 1802 | + |
1672 | 1803 | // html5 has no stop() |
| 1804 | + // NOTE: pausing means iOS requires interaction to resume. |
1673 | 1805 | _t._a.pause(); |
1674 | 1806 | |
1675 | 1807 | _t.playState = 0; |
— | — | @@ -1685,6 +1817,10 @@ |
1686 | 1818 | _t.instanceCount = 0; |
1687 | 1819 | _t._iO = {}; |
1688 | 1820 | |
| 1821 | + if (_iO.onstop) { |
| 1822 | + _iO.onstop.apply(_t); |
| 1823 | + } |
| 1824 | + |
1689 | 1825 | } |
1690 | 1826 | |
1691 | 1827 | return _t; |
— | — | @@ -1703,7 +1839,7 @@ |
1704 | 1840 | _t._iO.autoPlay = autoPlay; |
1705 | 1841 | |
1706 | 1842 | if (!_t.isHTML5) { |
1707 | | - _s.o._setAutoPlay(_t.sID, autoPlay); |
| 1843 | + _flash._setAutoPlay(_t.sID, autoPlay); |
1708 | 1844 | if (autoPlay) { |
1709 | 1845 | // only increment the instanceCount if the sound isn't loaded (TODO: verify RTMP) |
1710 | 1846 | if (!_t.instanceCount && _t.readyState === 1) { |
— | — | @@ -1749,7 +1885,7 @@ |
1750 | 1886 | original_pos = _t.position; |
1751 | 1887 | _t.position = offset; |
1752 | 1888 | position1K = _t.position/1000; |
1753 | | - _t.resetOnPosition(_t.position); |
| 1889 | + _t._resetOnPosition(_t.position); |
1754 | 1890 | _t._iO.position = offset; |
1755 | 1891 | |
1756 | 1892 | if (!_t.isHTML5) { |
— | — | @@ -1757,7 +1893,7 @@ |
1758 | 1894 | position = (_fV === 9 ? _t.position : position1K); |
1759 | 1895 | if (_t.readyState && _t.readyState !== 2) { |
1760 | 1896 | // if paused or not playing, will not resume (by playing) |
1761 | | - _s.o._setPosition(_t.sID, position, (_t.paused || !_t.playState)); |
| 1897 | + _flash._setPosition(_t.sID, position, (_t.paused || !_t.playState)); |
1762 | 1898 | } |
1763 | 1899 | |
1764 | 1900 | } else if (_t._a) { |
— | — | @@ -1765,7 +1901,7 @@ |
1766 | 1902 | // Set the position in the canplay handler if the sound is not ready yet |
1767 | 1903 | if (_t._html5_canplay) { |
1768 | 1904 | if (_t._a.currentTime !== position1K) { |
1769 | | - /* |
| 1905 | + /** |
1770 | 1906 | * DOM/JS errors/exceptions to watch out for: |
1771 | 1907 | * if seek is beyond (loaded?) position, "DOM exception 11" |
1772 | 1908 | * "INDEX_SIZE_ERR": DOM exception 1 |
— | — | @@ -1816,7 +1952,7 @@ |
1817 | 1953 | |
1818 | 1954 | if (!_t.isHTML5) { |
1819 | 1955 | if (_bCallFlash || _bCallFlash === undefined) { |
1820 | | - _s.o._pause(_t.sID); |
| 1956 | + _flash._pause(_t.sID); |
1821 | 1957 | } |
1822 | 1958 | } else { |
1823 | 1959 | _t._setup_html5().pause(); |
— | — | @@ -1847,6 +1983,8 @@ |
1848 | 1984 | |
1849 | 1985 | this.resume = function() { |
1850 | 1986 | |
| 1987 | + var _iO = _t._iO; |
| 1988 | + |
1851 | 1989 | if (!_t.paused) { |
1852 | 1990 | return _t; |
1853 | 1991 | } |
— | — | @@ -1856,22 +1994,22 @@ |
1857 | 1995 | _t.playState = 1; |
1858 | 1996 | |
1859 | 1997 | if (!_t.isHTML5) { |
1860 | | - if (_t._iO.isMovieStar) { |
| 1998 | + if (_iO.isMovieStar && !_iO.serverURL) { |
1861 | 1999 | // Bizarre Webkit bug (Chrome reported via 8tracks.com dudes): AAC content paused for 30+ seconds(?) will not resume without a reposition. |
1862 | 2000 | _t.setPosition(_t.position); |
1863 | 2001 | } |
1864 | 2002 | // flash method is toggle-based (pause/resume) |
1865 | | - _s.o._pause(_t.sID); |
| 2003 | + _flash._pause(_t.sID); |
1866 | 2004 | } else { |
1867 | 2005 | _t._setup_html5().play(); |
1868 | 2006 | _start_html5_timer(); |
1869 | 2007 | } |
1870 | 2008 | |
1871 | | - if (!_t._onplay_called && _t._iO.onplay) { |
1872 | | - _t._iO.onplay.apply(_t); |
1873 | | - _t._onplay_called = true; |
1874 | | - } else if (_t._iO.onresume) { |
1875 | | - _t._iO.onresume.apply(_t); |
| 2009 | + if (_onplay_called && _iO.onplay) { |
| 2010 | + _iO.onplay.apply(_t); |
| 2011 | + _onplay_called = true; |
| 2012 | + } else if (_iO.onresume) { |
| 2013 | + _iO.onresume.apply(_t); |
1876 | 2014 | } |
1877 | 2015 | |
1878 | 2016 | return _t; |
— | — | @@ -1923,7 +2061,7 @@ |
1924 | 2062 | } |
1925 | 2063 | |
1926 | 2064 | if (!_t.isHTML5) { |
1927 | | - _s.o._setPan(_t.sID, nPan); |
| 2065 | + _flash._setPan(_t.sID, nPan); |
1928 | 2066 | } // else { no HTML5 pan? } |
1929 | 2067 | |
1930 | 2068 | _t._iO.pan = nPan; |
— | — | @@ -1946,6 +2084,13 @@ |
1947 | 2085 | |
1948 | 2086 | this.setVolume = function(nVol, _bInstanceOnly) { |
1949 | 2087 | |
| 2088 | + /** |
| 2089 | + * Note: Setting volume has no effect on iOS "special snowflake" devices. |
| 2090 | + * Hardware volume control overrides software, and volume |
| 2091 | + * will always return 1 per Apple docs. (iOS 4 + 5.) |
| 2092 | + * http://developer.apple.com/library/safari/documentation/AudioVideo/Conceptual/HTML-canvas-guide/AddingSoundtoCanvasAnimations/AddingSoundtoCanvasAnimations.html |
| 2093 | + */ |
| 2094 | + |
1950 | 2095 | if (typeof nVol === 'undefined') { |
1951 | 2096 | nVol = 100; |
1952 | 2097 | } |
— | — | @@ -1955,9 +2100,10 @@ |
1956 | 2101 | } |
1957 | 2102 | |
1958 | 2103 | if (!_t.isHTML5) { |
1959 | | - _s.o._setVolume(_t.sID, (_s.muted && !_t.muted) || _t.muted?0:nVol); |
| 2104 | + _flash._setVolume(_t.sID, (_s.muted && !_t.muted) || _t.muted?0:nVol); |
1960 | 2105 | } else if (_t._a) { |
1961 | | - _t._a.volume = Math.max(0, Math.min(1, nVol/100)); // valid range: 0-1 |
| 2106 | + // valid range: 0-1 |
| 2107 | + _t._a.volume = Math.max(0, Math.min(1, nVol/100)); |
1962 | 2108 | } |
1963 | 2109 | |
1964 | 2110 | _t._iO.volume = nVol; |
— | — | @@ -1982,7 +2128,7 @@ |
1983 | 2129 | _t.muted = true; |
1984 | 2130 | |
1985 | 2131 | if (!_t.isHTML5) { |
1986 | | - _s.o._setVolume(_t.sID, 0); |
| 2132 | + _flash._setVolume(_t.sID, 0); |
1987 | 2133 | } else if (_t._a) { |
1988 | 2134 | _t._a.muted = true; |
1989 | 2135 | } |
— | — | @@ -2003,7 +2149,7 @@ |
2004 | 2150 | var hasIO = typeof _t._iO.volume !== 'undefined'; |
2005 | 2151 | |
2006 | 2152 | if (!_t.isHTML5) { |
2007 | | - _s.o._setVolume(_t.sID, hasIO?_t._iO.volume:_t.options.volume); |
| 2153 | + _flash._setVolume(_t.sID, hasIO?_t._iO.volume:_t.options.volume); |
2008 | 2154 | } else if (_t._a) { |
2009 | 2155 | _t._a.muted = false; |
2010 | 2156 | } |
— | — | @@ -2025,7 +2171,7 @@ |
2026 | 2172 | }; |
2027 | 2173 | |
2028 | 2174 | /** |
2029 | | - * Calls the onposition() method of a SMSound object. |
| 2175 | + * Registers a callback to be fired when a sound reaches a given position during playback. |
2030 | 2176 | * |
2031 | 2177 | * @param {number} nPosition The position to watch for |
2032 | 2178 | * @param {function} oMethod The relevant callback to fire |
— | — | @@ -2033,14 +2179,14 @@ |
2034 | 2180 | * @return {SMSound} The SMSound object |
2035 | 2181 | */ |
2036 | 2182 | |
2037 | | - this.onposition = function(nPosition, oMethod, oScope) { |
| 2183 | + this.onPosition = function(nPosition, oMethod, oScope) { |
2038 | 2184 | |
2039 | | - // TODO: allow for ranges, too? eg. (nPosition instanceof Array) |
| 2185 | + // TODO: basic dupe checking? |
2040 | 2186 | |
2041 | | - _t._onPositionItems.push({ |
| 2187 | + _onPositionItems.push({ |
2042 | 2188 | position: nPosition, |
2043 | 2189 | method: oMethod, |
2044 | | - scope: (typeof oScope !== 'undefined'?oScope:_t), |
| 2190 | + scope: (typeof oScope !== 'undefined' ? oScope : _t), |
2045 | 2191 | fired: false |
2046 | 2192 | }); |
2047 | 2193 | |
— | — | @@ -2048,24 +2194,59 @@ |
2049 | 2195 | |
2050 | 2196 | }; |
2051 | 2197 | |
| 2198 | + // legacy/backwards-compability: lower-case method name |
| 2199 | + this.onposition = this.onPosition; |
| 2200 | + |
2052 | 2201 | /** |
2053 | | - * TODO: This should be marked as pseudo-private. |
| 2202 | + * Removes registered callback(s) from a sound, by position and/or callback. |
| 2203 | + * |
| 2204 | + * @param {number} nPosition The position to clear callback(s) for |
| 2205 | + * @param {function} oMethod Optional: Identify one callback to be removed when multiple listeners exist for one position |
| 2206 | + * @return {SMSound} The SMSound object |
2054 | 2207 | */ |
2055 | 2208 | |
2056 | | - this.processOnPosition = function() { |
| 2209 | + this.clearOnPosition = function(nPosition, oMethod) { |
2057 | 2210 | |
2058 | | - var i, item, j = _t._onPositionItems.length; |
| 2211 | + var i; |
2059 | 2212 | |
2060 | | - if (!j || !_t.playState || _t._onPositionFired >= j) { |
| 2213 | + nPosition = parseInt(nPosition, 10); |
| 2214 | + |
| 2215 | + if (isNaN(nPosition)) { |
| 2216 | + // safety check |
2061 | 2217 | return false; |
2062 | 2218 | } |
2063 | 2219 | |
| 2220 | + for (i=0; i < _onPositionItems.length; i++) { |
| 2221 | + |
| 2222 | + if (nPosition === _onPositionItems[i].position) { |
| 2223 | + // remove this item if no method was specified, or, if the method matches |
| 2224 | + if (!oMethod || (oMethod === _onPositionItems[i].method)) { |
| 2225 | + if (_onPositionItems[i].fired) { |
| 2226 | + // decrement "fired" counter, too |
| 2227 | + _onPositionFired--; |
| 2228 | + } |
| 2229 | + _onPositionItems.splice(i, 1); |
| 2230 | + } |
| 2231 | + } |
| 2232 | + |
| 2233 | + } |
| 2234 | + |
| 2235 | + }; |
| 2236 | + |
| 2237 | + this._processOnPosition = function() { |
| 2238 | + |
| 2239 | + var i, item, j = _onPositionItems.length; |
| 2240 | + |
| 2241 | + if (!j || !_t.playState || _onPositionFired >= j) { |
| 2242 | + return false; |
| 2243 | + } |
| 2244 | + |
2064 | 2245 | for (i=j; i--;) { |
2065 | | - item = _t._onPositionItems[i]; |
| 2246 | + item = _onPositionItems[i]; |
2066 | 2247 | if (!item.fired && _t.position >= item.position) { |
2067 | 2248 | item.fired = true; |
2068 | | - _s._onPositionFired++; |
2069 | | - item.method.apply(item.scope,[item.position]); |
| 2249 | + _onPositionFired++; |
| 2250 | + item.method.apply(item.scope, [item.position]); |
2070 | 2251 | } |
2071 | 2252 | } |
2072 | 2253 | |
— | — | @@ -2073,20 +2254,20 @@ |
2074 | 2255 | |
2075 | 2256 | }; |
2076 | 2257 | |
2077 | | - this.resetOnPosition = function(nPosition) { |
| 2258 | + this._resetOnPosition = function(nPosition) { |
2078 | 2259 | |
2079 | 2260 | // reset "fired" for items interested in this position |
2080 | | - var i, item, j = _t._onPositionItems.length; |
| 2261 | + var i, item, j = _onPositionItems.length; |
2081 | 2262 | |
2082 | 2263 | if (!j) { |
2083 | 2264 | return false; |
2084 | 2265 | } |
2085 | 2266 | |
2086 | 2267 | for (i=j; i--;) { |
2087 | | - item = _t._onPositionItems[i]; |
| 2268 | + item = _onPositionItems[i]; |
2088 | 2269 | if (item.fired && nPosition <= item.position) { |
2089 | 2270 | item.fired = false; |
2090 | | - _s._onPositionFired--; |
| 2271 | + _onPositionFired--; |
2091 | 2272 | } |
2092 | 2273 | } |
2093 | 2274 | |
— | — | @@ -2095,10 +2276,98 @@ |
2096 | 2277 | }; |
2097 | 2278 | |
2098 | 2279 | /** |
2099 | | - * SoundManager() private internals |
| 2280 | + * SMSound() private internals |
2100 | 2281 | * -------------------------------- |
2101 | 2282 | */ |
2102 | 2283 | |
| 2284 | + _applyFromTo = function() { |
| 2285 | + |
| 2286 | + var _iO = _t._iO, |
| 2287 | + f = _iO.from, |
| 2288 | + t = _iO.to, |
| 2289 | + start, end; |
| 2290 | + |
| 2291 | + end = function() { |
| 2292 | + |
| 2293 | + // end has been reached. |
| 2294 | + _s._wD(_t.sID + ': "to" time of ' + t + ' reached.'); |
| 2295 | + |
| 2296 | + // detach listener |
| 2297 | + _t.clearOnPosition(t, end); |
| 2298 | + |
| 2299 | + // stop should clear this, too |
| 2300 | + _t.stop(); |
| 2301 | + |
| 2302 | + }; |
| 2303 | + |
| 2304 | + start = function() { |
| 2305 | + |
| 2306 | + _s._wD(_t.sID + ': playing "from" ' + f); |
| 2307 | + |
| 2308 | + // add listener for end |
| 2309 | + if (t !== null && !isNaN(t)) { |
| 2310 | + _t.onPosition(t, end); |
| 2311 | + } |
| 2312 | + |
| 2313 | + }; |
| 2314 | + |
| 2315 | + if (f !== null && !isNaN(f)) { |
| 2316 | + |
| 2317 | + // apply to instance options, guaranteeing correct start position. |
| 2318 | + _iO.position = f; |
| 2319 | + |
| 2320 | + // multiShot timing can't be tracked, so prevent that. |
| 2321 | + _iO.multiShot = false; |
| 2322 | + |
| 2323 | + start(); |
| 2324 | + |
| 2325 | + } |
| 2326 | + |
| 2327 | + // return updated instanceOptions including starting position |
| 2328 | + return _iO; |
| 2329 | + |
| 2330 | + }; |
| 2331 | + |
| 2332 | + _attachOnPosition = function() { |
| 2333 | + |
| 2334 | + var op = _t._iO.onposition; |
| 2335 | + |
| 2336 | + // attach onposition things, if any, now. |
| 2337 | + |
| 2338 | + if (op) { |
| 2339 | + |
| 2340 | + var item; |
| 2341 | + |
| 2342 | + for (item in op) { |
| 2343 | + if (op.hasOwnProperty(item)) { |
| 2344 | + _t.onPosition(parseInt(item, 10), op[item]); |
| 2345 | + } |
| 2346 | + } |
| 2347 | + |
| 2348 | + } |
| 2349 | + |
| 2350 | + }; |
| 2351 | + |
| 2352 | + _detachOnPosition = function() { |
| 2353 | + |
| 2354 | + var op = _t._iO.onposition; |
| 2355 | + |
| 2356 | + // detach any onposition()-style listeners. |
| 2357 | + |
| 2358 | + if (op) { |
| 2359 | + |
| 2360 | + var item; |
| 2361 | + |
| 2362 | + for (item in op) { |
| 2363 | + if (op.hasOwnProperty(item)) { |
| 2364 | + _t.clearOnPosition(parseInt(item, 10)); |
| 2365 | + } |
| 2366 | + } |
| 2367 | + |
| 2368 | + } |
| 2369 | + |
| 2370 | + }; |
| 2371 | + |
2103 | 2372 | _start_html5_timer = function() { |
2104 | 2373 | |
2105 | 2374 | if (_t.isHTML5) { |
— | — | @@ -2117,29 +2386,36 @@ |
2118 | 2387 | |
2119 | 2388 | _resetProperties = function() { |
2120 | 2389 | |
2121 | | - _t._onPositionItems = []; |
2122 | | - _t._onPositionFired = 0; |
| 2390 | + _onPositionItems = []; |
| 2391 | + _onPositionFired = 0; |
| 2392 | + _onplay_called = false; |
| 2393 | + |
2123 | 2394 | _t._hasTimer = null; |
2124 | | - _t._onplay_called = false; |
2125 | 2395 | _t._a = null; |
2126 | 2396 | _t._html5_canplay = false; |
2127 | 2397 | _t.bytesLoaded = null; |
2128 | 2398 | _t.bytesTotal = null; |
2129 | | - _t.position = null; |
2130 | | - _t.duration = (_t._iO && _t._iO.duration?_t._iO.duration:null); |
| 2399 | + _t.duration = (_t._iO && _t._iO.duration ? _t._iO.duration : null); |
2131 | 2400 | _t.durationEstimate = null; |
| 2401 | + |
| 2402 | + // legacy: 1D array |
| 2403 | + _t.eqData = []; |
| 2404 | + |
| 2405 | + _t.eqData.left = []; |
| 2406 | + _t.eqData.right = []; |
| 2407 | + |
2132 | 2408 | _t.failures = 0; |
| 2409 | + _t.isBuffering = false; |
| 2410 | + _t.instanceOptions = {}; |
| 2411 | + _t.instanceCount = 0; |
2133 | 2412 | _t.loaded = false; |
2134 | | - _t.playState = 0; |
2135 | | - _t.paused = false; |
| 2413 | + _t.metadata = {}; |
2136 | 2414 | |
2137 | 2415 | // 0 = uninitialised, 1 = loading, 2 = failed/error, 3 = loaded/success |
2138 | 2416 | _t.readyState = 0; |
2139 | 2417 | |
2140 | 2418 | _t.muted = false; |
2141 | | - _t.isBuffering = false; |
2142 | | - _t.instanceOptions = {}; |
2143 | | - _t.instanceCount = 0; |
| 2419 | + _t.paused = false; |
2144 | 2420 | |
2145 | 2421 | _t.peakData = { |
2146 | 2422 | left: 0, |
— | — | @@ -2151,12 +2427,9 @@ |
2152 | 2428 | right: [] |
2153 | 2429 | }; |
2154 | 2430 | |
2155 | | - // legacy: 1D array |
2156 | | - _t.eqData = []; |
| 2431 | + _t.playState = 0; |
| 2432 | + _t.position = null; |
2157 | 2433 | |
2158 | | - _t.eqData.left = []; |
2159 | | - _t.eqData.right = []; |
2160 | | - |
2161 | 2434 | }; |
2162 | 2435 | |
2163 | 2436 | _resetProperties(); |
— | — | @@ -2168,9 +2441,13 @@ |
2169 | 2442 | |
2170 | 2443 | this._onTimer = function(bForce) { |
2171 | 2444 | |
2172 | | - // HTML5-only _whileplaying() etc. |
| 2445 | + /** |
| 2446 | + * HTML5-only _whileplaying() etc. |
| 2447 | + * called from both HTML5 native events, and polling/interval-based timers |
| 2448 | + * mimics flash and fires only when time/duration change, so as to be polling-friendly |
| 2449 | + */ |
2173 | 2450 | |
2174 | | - var time, x = {}; |
| 2451 | + var duration, isNew = false, time, x = {}; |
2175 | 2452 | |
2176 | 2453 | if (_t._hasTimer || bForce) { |
2177 | 2454 | |
— | — | @@ -2178,15 +2455,40 @@ |
2179 | 2456 | |
2180 | 2457 | if (_t._a && (bForce || ((_t.playState > 0 || _t.readyState === 1) && !_t.paused))) { |
2181 | 2458 | |
2182 | | - _t.duration = _t._get_html5_duration(); |
| 2459 | + duration = _t._get_html5_duration(); |
| 2460 | + |
| 2461 | + if (duration !== _lastHTML5State.duration) { |
| 2462 | + |
| 2463 | + _lastHTML5State.duration = duration; |
| 2464 | + _t.duration = duration; |
| 2465 | + isNew = true; |
| 2466 | + |
| 2467 | + } |
| 2468 | + |
| 2469 | + // TODO: investigate why this goes wack if not set/re-set each time. |
2183 | 2470 | _t.durationEstimate = _t.duration; |
2184 | | - time = _t._a.currentTime?_t._a.currentTime*1000:0; |
2185 | | - _t._whileplaying(time,x,x,x,x); |
2186 | | - return true; |
2187 | 2471 | |
| 2472 | + time = (_t._a.currentTime * 1000 || 0); |
| 2473 | + |
| 2474 | + if (time !== _lastHTML5State.time) { |
| 2475 | + |
| 2476 | + _lastHTML5State.time = time; |
| 2477 | + isNew = true; |
| 2478 | + |
| 2479 | + } |
| 2480 | + |
| 2481 | + if (isNew || bForce) { |
| 2482 | + |
| 2483 | + _t._whileplaying(time,x,x,x,x); |
| 2484 | + |
| 2485 | + } |
| 2486 | + |
| 2487 | + return isNew; |
| 2488 | + |
2188 | 2489 | } else { |
2189 | 2490 | |
2190 | | - _s._wD('_onTimer: Warn for "'+_t.sID+'": '+(!_t._a?'Could not find element. ':'')+(_t.playState === 0?'playState bad, 0?':'playState = '+_t.playState+', OK')); |
| 2491 | + // _s._wD('_onTimer: Warn for "'+_t.sID+'": '+(!_t._a?'Could not find element. ':'')+(_t.playState === 0?'playState bad, 0?':'playState = '+_t.playState+', OK')); |
| 2492 | + |
2191 | 2493 | return false; |
2192 | 2494 | |
2193 | 2495 | } |
— | — | @@ -2197,8 +2499,9 @@ |
2198 | 2500 | |
2199 | 2501 | this._get_html5_duration = function() { |
2200 | 2502 | |
2201 | | - var d = (_t._a ? _t._a.duration*1000 : (_t._iO ? _t._iO.duration : undefined)), |
2202 | | - result = (d && !isNaN(d) && d !== Infinity ? d : (_t._iO ? _t._iO.duration : null)); |
| 2503 | + var _iO = _t._iO, |
| 2504 | + d = (_t._a ? _t._a.duration*1000 : (_iO ? _iO.duration : undefined)), |
| 2505 | + result = (d && !isNaN(d) && d !== Infinity ? d : (_iO ? _iO.duration : null)); |
2203 | 2506 | |
2204 | 2507 | return result; |
2205 | 2508 | |
— | — | @@ -2213,12 +2516,19 @@ |
2214 | 2517 | |
2215 | 2518 | if (_a) { |
2216 | 2519 | |
2217 | | - if (_a._t && _oldIO.url === _iO.url && (!_t._lastURL || (_t._lastURL === _oldIO.url))) { |
2218 | | - // same url, ignore request |
2219 | | - return _a; |
| 2520 | + if (_a._t) { |
| 2521 | + |
| 2522 | + if (!_useGlobalHTML5Audio && _dURL === d(_lastURL)) { |
| 2523 | + // same url, ignore request |
| 2524 | + return _a; |
| 2525 | + } else if (_useGlobalHTML5Audio && _oldIO.url === _iO.url && (!_lastURL || (_lastURL === _oldIO.url))) { |
| 2526 | + // iOS-type reuse case |
| 2527 | + return _a; |
| 2528 | + } |
| 2529 | + |
2220 | 2530 | } |
2221 | 2531 | |
2222 | | - _s._wD('setting new URL on existing object: ' + _dURL + (_t._lastURL ? ', old URL: ' + _t._lastURL : '')); |
| 2532 | + _s._wD('setting new URL on existing object: ' + _dURL + (_lastURL ? ', old URL: ' + _lastURL : '')); |
2223 | 2533 | |
2224 | 2534 | /** |
2225 | 2535 | * "First things first, I, Poppa.." (reset the previous state of the old sound, if playing) |
— | — | @@ -2235,7 +2545,7 @@ |
2236 | 2546 | |
2237 | 2547 | _a.src = _iO.url; |
2238 | 2548 | _t.url = _iO.url; |
2239 | | - _t._lastURL = _iO.url; |
| 2549 | + _lastURL = _iO.url; |
2240 | 2550 | _a._called_load = false; |
2241 | 2551 | |
2242 | 2552 | } else { |
— | — | @@ -2255,6 +2565,7 @@ |
2256 | 2566 | } |
2257 | 2567 | |
2258 | 2568 | } |
| 2569 | + |
2259 | 2570 | _t.isHTML5 = true; |
2260 | 2571 | |
2261 | 2572 | // store a ref on the track |
— | — | @@ -2263,19 +2574,12 @@ |
2264 | 2575 | // store a ref on the audio |
2265 | 2576 | _a._t = _t; |
2266 | 2577 | |
2267 | | - _t._add_html5_events(); |
| 2578 | + _add_html5_events(); |
2268 | 2579 | _a.loop = (_iO.loops>1?'loop':''); |
2269 | 2580 | |
2270 | 2581 | if (_iO.autoLoad || _iO.autoPlay) { |
2271 | 2582 | |
2272 | | - // early HTML5 implementation (non-standard) |
2273 | | - _a.autobuffer = 'auto'; |
2274 | | - |
2275 | | - // standard |
2276 | | - _a.preload = 'auto'; |
2277 | | - |
2278 | 2583 | _t.load(); |
2279 | | - _a._called_load = true; |
2280 | 2584 | |
2281 | 2585 | } else { |
2282 | 2586 | |
— | — | @@ -2288,13 +2592,13 @@ |
2289 | 2593 | } |
2290 | 2594 | |
2291 | 2595 | // boolean instead of "loop", for webkit? - spec says string. http://www.w3.org/TR/html-markup/audio.html#audio.attrs.loop |
2292 | | - _a.loop = (_iO.loops>1?'loop':''); |
| 2596 | + _a.loop = (_iO.loops > 1 ? 'loop' : ''); |
2293 | 2597 | |
2294 | 2598 | return _a; |
2295 | 2599 | |
2296 | 2600 | }; |
2297 | 2601 | |
2298 | | - this._add_html5_events = function() { |
| 2602 | + _add_html5_events = function() { |
2299 | 2603 | |
2300 | 2604 | if (_t._a._added_events) { |
2301 | 2605 | return false; |
— | — | @@ -2319,7 +2623,7 @@ |
2320 | 2624 | |
2321 | 2625 | }; |
2322 | 2626 | |
2323 | | - this._remove_html5_events = function() { |
| 2627 | + _remove_html5_events = function() { |
2324 | 2628 | |
2325 | 2629 | // Remove event listeners |
2326 | 2630 | |
— | — | @@ -2348,10 +2652,11 @@ |
2349 | 2653 | this._onload = function(nSuccess) { |
2350 | 2654 | |
2351 | 2655 | |
2352 | | - var fN = 'SMSound._onload(): ', loadOK = !!(nSuccess); |
| 2656 | + var fN, loadOK = !!(nSuccess); |
2353 | 2657 | _s._wD(fN + '"' + _t.sID + '"' + (loadOK?' loaded.':' failed to load? - ' + _t.url), (loadOK?1:2)); |
| 2658 | + |
2354 | 2659 | // <d> |
2355 | | - |
| 2660 | + fN = 'SMSound._onload(): '; |
2356 | 2661 | if (!loadOK && !_t.isHTML5) { |
2357 | 2662 | if (_s.sandbox.noRemote === true) { |
2358 | 2663 | _s._wD(fN + _str('noNet'), 1); |
— | — | @@ -2376,8 +2681,6 @@ |
2377 | 2682 | |
2378 | 2683 | this._onbufferchange = function(nIsBuffering) { |
2379 | 2684 | |
2380 | | - var fN = 'SMSound._onbufferchange()'; |
2381 | | - |
2382 | 2685 | if (_t.playState === 0) { |
2383 | 2686 | // ignore if not playing |
2384 | 2687 | return false; |
— | — | @@ -2389,7 +2692,7 @@ |
2390 | 2693 | |
2391 | 2694 | _t.isBuffering = (nIsBuffering === 1); |
2392 | 2695 | if (_t._iO.onbufferchange) { |
2393 | | - _s._wD(fN + ': ' + nIsBuffering); |
| 2696 | + _s._wD('SMSound._onbufferchange(): ' + nIsBuffering); |
2394 | 2697 | _t._iO.onbufferchange.apply(_t); |
2395 | 2698 | } |
2396 | 2699 | |
— | — | @@ -2402,7 +2705,7 @@ |
2403 | 2706 | * to continue playing / loading the audio file. |
2404 | 2707 | */ |
2405 | 2708 | |
2406 | | - this._onsuspend = function () { |
| 2709 | + this._onsuspend = function() { |
2407 | 2710 | |
2408 | 2711 | if (_t._iO.onsuspend) { |
2409 | 2712 | _s._wD('SMSound._onsuspend()'); |
— | — | @@ -2435,14 +2738,20 @@ |
2436 | 2739 | |
2437 | 2740 | // store local copy before it gets trashed.. |
2438 | 2741 | var _io_onfinish = _t._iO.onfinish; |
| 2742 | + |
2439 | 2743 | _t._onbufferchange(0); |
2440 | | - _t.resetOnPosition(0); |
| 2744 | + _t._resetOnPosition(0); |
2441 | 2745 | |
2442 | 2746 | // reset some state items |
2443 | 2747 | if (_t.instanceCount) { |
2444 | 2748 | |
2445 | 2749 | _t.instanceCount--; |
| 2750 | + |
2446 | 2751 | if (!_t.instanceCount) { |
| 2752 | + |
| 2753 | + // remove onPosition listeners, if any |
| 2754 | + _detachOnPosition(); |
| 2755 | + |
2447 | 2756 | // reset instance options |
2448 | 2757 | _t.playState = 0; |
2449 | 2758 | _t.paused = false; |
— | — | @@ -2450,6 +2759,7 @@ |
2451 | 2760 | _t.instanceOptions = {}; |
2452 | 2761 | _t._iO = {}; |
2453 | 2762 | _stop_html5_timer(); |
| 2763 | + |
2454 | 2764 | } |
2455 | 2765 | |
2456 | 2766 | if (!_t.instanceCount || _t._iO.multiShotEvents) { |
— | — | @@ -2466,16 +2776,18 @@ |
2467 | 2777 | |
2468 | 2778 | this._whileloading = function(nBytesLoaded, nBytesTotal, nDuration, nBufferLength) { |
2469 | 2779 | |
| 2780 | + var _iO = _t._iO; |
| 2781 | + |
2470 | 2782 | _t.bytesLoaded = nBytesLoaded; |
2471 | 2783 | _t.bytesTotal = nBytesTotal; |
2472 | 2784 | _t.duration = Math.floor(nDuration); |
2473 | 2785 | _t.bufferLength = nBufferLength; |
2474 | 2786 | |
2475 | | - if (!_t._iO.isMovieStar) { |
| 2787 | + if (!_iO.isMovieStar) { |
2476 | 2788 | |
2477 | | - if (_t._iO.duration) { |
| 2789 | + if (_iO.duration) { |
2478 | 2790 | // use options, if specified and larger |
2479 | | - _t.durationEstimate = (_t.duration > _t._iO.duration) ? _t.duration : _t._iO.duration; |
| 2791 | + _t.durationEstimate = (_t.duration > _iO.duration) ? _t.duration : _iO.duration; |
2480 | 2792 | } else { |
2481 | 2793 | _t.durationEstimate = parseInt((_t.bytesTotal / _t.bytesLoaded) * _t.duration, 10); |
2482 | 2794 | |
— | — | @@ -2485,15 +2797,15 @@ |
2486 | 2798 | _t.durationEstimate = _t.duration; |
2487 | 2799 | } |
2488 | 2800 | |
2489 | | - if (_t.readyState !== 3 && _t._iO.whileloading) { |
2490 | | - _t._iO.whileloading.apply(_t); |
| 2801 | + if (_t.readyState !== 3 && _iO.whileloading) { |
| 2802 | + _iO.whileloading.apply(_t); |
2491 | 2803 | } |
2492 | 2804 | |
2493 | 2805 | } else { |
2494 | 2806 | |
2495 | 2807 | _t.durationEstimate = _t.duration; |
2496 | | - if (_t.readyState !== 3 && _t._iO.whileloading) { |
2497 | | - _t._iO.whileloading.apply(_t); |
| 2808 | + if (_t.readyState !== 3 && _iO.whileloading) { |
| 2809 | + _iO.whileloading.apply(_t); |
2498 | 2810 | } |
2499 | 2811 | |
2500 | 2812 | } |
— | — | @@ -2502,31 +2814,33 @@ |
2503 | 2815 | |
2504 | 2816 | this._whileplaying = function(nPosition, oPeakData, oWaveformDataLeft, oWaveformDataRight, oEQData) { |
2505 | 2817 | |
| 2818 | + var _iO = _t._iO; |
| 2819 | + |
2506 | 2820 | if (isNaN(nPosition) || nPosition === null) { |
2507 | 2821 | // flash safety net |
2508 | 2822 | return false; |
2509 | 2823 | } |
2510 | 2824 | |
2511 | 2825 | _t.position = nPosition; |
2512 | | - _t.processOnPosition(); |
| 2826 | + _t._processOnPosition(); |
2513 | 2827 | |
2514 | 2828 | if (!_t.isHTML5 && _fV > 8) { |
2515 | 2829 | |
2516 | | - if (_t._iO.usePeakData && typeof oPeakData !== 'undefined' && oPeakData) { |
| 2830 | + if (_iO.usePeakData && typeof oPeakData !== 'undefined' && oPeakData) { |
2517 | 2831 | _t.peakData = { |
2518 | 2832 | left: oPeakData.leftPeak, |
2519 | 2833 | right: oPeakData.rightPeak |
2520 | 2834 | }; |
2521 | 2835 | } |
2522 | 2836 | |
2523 | | - if (_t._iO.useWaveformData && typeof oWaveformDataLeft !== 'undefined' && oWaveformDataLeft) { |
| 2837 | + if (_iO.useWaveformData && typeof oWaveformDataLeft !== 'undefined' && oWaveformDataLeft) { |
2524 | 2838 | _t.waveformData = { |
2525 | 2839 | left: oWaveformDataLeft.split(','), |
2526 | 2840 | right: oWaveformDataRight.split(',') |
2527 | 2841 | }; |
2528 | 2842 | } |
2529 | 2843 | |
2530 | | - if (_t._iO.useEQData) { |
| 2844 | + if (_iO.useEQData) { |
2531 | 2845 | if (typeof oEQData !== 'undefined' && oEQData && oEQData.leftEQ) { |
2532 | 2846 | var eqLeft = oEQData.leftEQ.split(','); |
2533 | 2847 | _t.eqData = eqLeft; |
— | — | @@ -2546,9 +2860,9 @@ |
2547 | 2861 | _t._onbufferchange(0); |
2548 | 2862 | } |
2549 | 2863 | |
2550 | | - if (_t._iO.whileplaying) { |
| 2864 | + if (_iO.whileplaying) { |
2551 | 2865 | // flash may call after actual finish |
2552 | | - _t._iO.whileplaying.apply(_t); |
| 2866 | + _iO.whileplaying.apply(_t); |
2553 | 2867 | } |
2554 | 2868 | |
2555 | 2869 | } |
— | — | @@ -2557,16 +2871,47 @@ |
2558 | 2872 | |
2559 | 2873 | }; |
2560 | 2874 | |
2561 | | - this._onid3 = function(oID3PropNames, oID3Data) { |
| 2875 | + this._onmetadata = function(oMDProps, oMDData) { |
2562 | 2876 | |
2563 | | - // oID3PropNames: string array (names) |
2564 | | - // ID3Data: string array (data) |
| 2877 | + /** |
| 2878 | + * internal: flash 9 + NetStream (MovieStar/RTMP-only) feature |
| 2879 | + * RTMP may include song title, MovieStar content may include encoding info |
| 2880 | + * |
| 2881 | + * @param {array} oMDProps (names) |
| 2882 | + * @param {array} oMDData (values) |
| 2883 | + */ |
| 2884 | + |
| 2885 | + _s._wD('SMSound._onmetadata(): "' + this.sID + '" metadata received.'); |
| 2886 | + |
| 2887 | + var oData = {}, i, j; |
| 2888 | + |
| 2889 | + for (i = 0, j = oMDProps.length; i < j; i++) { |
| 2890 | + oData[oMDProps[i]] = oMDData[i]; |
| 2891 | + } |
| 2892 | + _t.metadata = oData; |
| 2893 | + |
| 2894 | + if (_t._iO.onmetadata) { |
| 2895 | + _t._iO.onmetadata.apply(_t); |
| 2896 | + } |
| 2897 | + |
| 2898 | + }; |
| 2899 | + |
| 2900 | + this._onid3 = function(oID3Props, oID3Data) { |
| 2901 | + |
| 2902 | + /** |
| 2903 | + * internal: flash 8 + flash 9 ID3 feature |
| 2904 | + * may include artist, song title etc. |
| 2905 | + * |
| 2906 | + * @param {array} oID3Props (names) |
| 2907 | + * @param {array} oID3Data (values) |
| 2908 | + */ |
| 2909 | + |
2565 | 2910 | _s._wD('SMSound._onid3(): "' + this.sID + '" ID3 data received.'); |
2566 | 2911 | |
2567 | 2912 | var oData = [], i, j; |
2568 | 2913 | |
2569 | | - for (i = 0, j = oID3PropNames.length; i < j; i++) { |
2570 | | - oData[oID3PropNames[i]] = oID3Data[i]; |
| 2914 | + for (i = 0, j = oID3Props.length; i < j; i++) { |
| 2915 | + oData[oID3Props[i]] = oID3Data[i]; |
2571 | 2916 | } |
2572 | 2917 | _t.id3 = _mixin(_t.id3, oData); |
2573 | 2918 | |
— | — | @@ -2580,9 +2925,8 @@ |
2581 | 2926 | |
2582 | 2927 | this._onconnect = function(bSuccess) { |
2583 | 2928 | |
2584 | | - var fN = 'SMSound._onconnect(): '; |
2585 | 2929 | bSuccess = (bSuccess === 1); |
2586 | | - _s._wD(fN+'"'+_t.sID+'"'+(bSuccess?' connected.':' failed to connect? - '+_t.url), (bSuccess?1:2)); |
| 2930 | + _s._wD('SMSound._onconnect(): "'+_t.sID+'"'+(bSuccess?' connected.':' failed to connect? - '+_t.url), (bSuccess?1:2)); |
2587 | 2931 | _t.connected = bSuccess; |
2588 | 2932 | |
2589 | 2933 | if (bSuccess) { |
— | — | @@ -2599,7 +2943,7 @@ |
2600 | 2944 | } |
2601 | 2945 | |
2602 | 2946 | if (_t._iO.onconnect) { |
2603 | | - _t._iO.onconnect.apply(_t,[bSuccess]); |
| 2947 | + _t._iO.onconnect.apply(_t, [bSuccess]); |
2604 | 2948 | } |
2605 | 2949 | |
2606 | 2950 | } |
— | — | @@ -2682,6 +3026,7 @@ |
2683 | 3027 | } else if (len === 3) { |
2684 | 3028 | args.push(false); |
2685 | 3029 | } |
| 3030 | + |
2686 | 3031 | return args; |
2687 | 3032 | |
2688 | 3033 | } |
— | — | @@ -2729,10 +3074,12 @@ |
2730 | 3075 | |
2731 | 3076 | return function(e) { |
2732 | 3077 | |
2733 | | - if (!this._t || !this._t._a) { |
| 3078 | + var t = this._t; |
| 3079 | + |
| 3080 | + if (!t || !t._a) { |
2734 | 3081 | // <d> |
2735 | | - if (this._t && this._t.sID) { |
2736 | | - _s._wD(_h5+'ignoring '+e.type+': '+this._t.sID); |
| 3082 | + if (t && t.sID) { |
| 3083 | + _s._wD(_h5+'ignoring '+e.type+': '+t.sID); |
2737 | 3084 | } else { |
2738 | 3085 | _s._wD(_h5+'ignoring '+e.type); |
2739 | 3086 | } |
— | — | @@ -2760,18 +3107,20 @@ |
2761 | 3108 | |
2762 | 3109 | canplay: _html5_event(function(e) { |
2763 | 3110 | |
2764 | | - if (this._t._html5_canplay) { |
| 3111 | + var t = this._t; |
| 3112 | + |
| 3113 | + if (t._html5_canplay) { |
2765 | 3114 | // this event has already fired. ignore. |
2766 | 3115 | return true; |
2767 | 3116 | } |
2768 | 3117 | |
2769 | | - this._t._html5_canplay = true; |
2770 | | - _s._wD(_h5+'canplay: '+this._t.sID+', '+this._t.url); |
2771 | | - this._t._onbufferchange(0); |
2772 | | - var position1K = (!isNaN(this._t.position)?this._t.position/1000:null); |
| 3118 | + t._html5_canplay = true; |
| 3119 | + _s._wD(_h5+'canplay: '+t.sID+', '+t.url); |
| 3120 | + t._onbufferchange(0); |
| 3121 | + var position1K = (!isNaN(t.position)?t.position/1000:null); |
2773 | 3122 | |
2774 | 3123 | // set the position if position was set before the sound loaded |
2775 | | - if (this._t.position && this.currentTime !== position1K) { |
| 3124 | + if (t.position && this.currentTime !== position1K) { |
2776 | 3125 | _s._wD(_h5+'canplay: setting position to '+position1K); |
2777 | 3126 | try { |
2778 | 3127 | this.currentTime = position1K; |
— | — | @@ -2780,15 +3129,22 @@ |
2781 | 3130 | } |
2782 | 3131 | } |
2783 | 3132 | |
| 3133 | + // hack for HTML5 from/to case |
| 3134 | + if (t._iO._oncanplay) { |
| 3135 | + t._iO._oncanplay(); |
| 3136 | + } |
| 3137 | + |
2784 | 3138 | }), |
2785 | 3139 | |
2786 | 3140 | load: _html5_event(function(e) { |
2787 | 3141 | |
2788 | | - if (!this._t.loaded) { |
2789 | | - this._t._onbufferchange(0); |
| 3142 | + var t = this._t; |
| 3143 | + |
| 3144 | + if (!t.loaded) { |
| 3145 | + t._onbufferchange(0); |
2790 | 3146 | // should be 1, and the same |
2791 | | - this._t._whileloading(this._t.bytesTotal, this._t.bytesTotal, this._t._get_html5_duration()); |
2792 | | - this._t._onload(true); |
| 3147 | + t._whileloading(t.bytesTotal, t.bytesTotal, t._get_html5_duration()); |
| 3148 | + t._onload(true); |
2793 | 3149 | } |
2794 | 3150 | |
2795 | 3151 | }), |
— | — | @@ -2801,9 +3157,11 @@ |
2802 | 3158 | |
2803 | 3159 | ended: _html5_event(function(e) { |
2804 | 3160 | |
2805 | | - _s._wD(_h5+'ended: '+this._t.sID); |
2806 | | - this._t._onfinish(); |
| 3161 | + var t = this._t; |
2807 | 3162 | |
| 3163 | + _s._wD(_h5+'ended: '+t.sID); |
| 3164 | + t._onfinish(); |
| 3165 | + |
2808 | 3166 | }), |
2809 | 3167 | |
2810 | 3168 | error: _html5_event(function(e) { |
— | — | @@ -2854,10 +3212,9 @@ |
2855 | 3213 | |
2856 | 3214 | }), |
2857 | 3215 | |
2858 | | - // TODO: verify if this is actually implemented anywhere yet. |
2859 | 3216 | playing: _html5_event(function(e) { |
2860 | 3217 | |
2861 | | - _s._wD(_h5+'playing: '+this._t.sID+', '+this._t.url); |
| 3218 | + _s._wD(_h5+'playing: '+this._t.sID); |
2862 | 3219 | |
2863 | 3220 | // once play starts, no buffering |
2864 | 3221 | this._t._onbufferchange(0); |
— | — | @@ -2866,7 +3223,9 @@ |
2867 | 3224 | |
2868 | 3225 | progress: _html5_event(function(e) { |
2869 | 3226 | |
2870 | | - if (this._t.loaded) { |
| 3227 | + var t = this._t; |
| 3228 | + |
| 3229 | + if (t.loaded) { |
2871 | 3230 | return false; |
2872 | 3231 | } |
2873 | 3232 | |
— | — | @@ -2902,7 +3261,7 @@ |
2903 | 3262 | } |
2904 | 3263 | |
2905 | 3264 | if (isProgress && !isNaN(loaded)) { |
2906 | | - _s._wD(_h5+'progress: '+this._t.sID+': ' + Math.floor(loaded*100)+'% loaded'); |
| 3265 | + _s._wD(_h5+'progress: '+t.sID+': ' + Math.floor(loaded*100)+'% loaded'); |
2907 | 3266 | } |
2908 | 3267 | // </d> |
2909 | 3268 | |
— | — | @@ -2911,8 +3270,8 @@ |
2912 | 3271 | if (!isNaN(loaded)) { |
2913 | 3272 | |
2914 | 3273 | // if progress, likely not buffering |
2915 | | - this._t._onbufferchange(0); |
2916 | | - this._t._whileloading(loaded, total, this._t._get_html5_duration()); |
| 3274 | + t._onbufferchange(0); |
| 3275 | + t._whileloading(loaded, total, t._get_html5_duration()); |
2917 | 3276 | if (loaded && total && loaded === total) { |
2918 | 3277 | // in case "onload" doesn't fire (eg. gecko 1.9.2) |
2919 | 3278 | _html5_events.load.call(this, e); |
— | — | @@ -2931,10 +3290,11 @@ |
2932 | 3291 | suspend: _html5_event(function(e) { |
2933 | 3292 | |
2934 | 3293 | // download paused/stopped, may have finished (eg. onload) |
| 3294 | + var t = this._t; |
2935 | 3295 | |
2936 | | - _s._wD(_h5+'suspend: '+this._t.sID); |
| 3296 | + _s._wD(_h5+'suspend: '+t.sID); |
2937 | 3297 | _html5_events.progress.call(this, e); |
2938 | | - this._t._onsuspend(); |
| 3298 | + t._onsuspend(); |
2939 | 3299 | |
2940 | 3300 | }), |
2941 | 3301 | |
— | — | @@ -2952,11 +3312,13 @@ |
2953 | 3313 | |
2954 | 3314 | waiting: _html5_event(function(e) { |
2955 | 3315 | |
| 3316 | + var t = this._t; |
| 3317 | + |
2956 | 3318 | // see also: seeking |
2957 | | - _s._wD(_h5+'waiting: '+this._t.sID); |
| 3319 | + _s._wD(_h5+'waiting: '+t.sID); |
2958 | 3320 | |
2959 | 3321 | // playback faster than download rate, etc. |
2960 | | - this._t._onbufferchange(1); |
| 3322 | + t._onbufferchange(1); |
2961 | 3323 | |
2962 | 3324 | }) |
2963 | 3325 | |
— | — | @@ -3126,7 +3488,6 @@ |
3127 | 3489 | support['audio/'+aF[item].related[i]] = support[item]; |
3128 | 3490 | _s.html5[aF[item].related[i]] = support[item]; |
3129 | 3491 | _s.flash[aF[item].related[i]] = support[item]; |
3130 | | - |
3131 | 3492 | } |
3132 | 3493 | } |
3133 | 3494 | } |
— | — | @@ -3171,7 +3532,7 @@ |
3172 | 3533 | queue: _sm + ': Queueing %s handler', |
3173 | 3534 | smFail: _sm + ': Failed to initialise.', |
3174 | 3535 | smError: 'SMSound.load(): Exception: JS-Flash communication failed, or JS error.', |
3175 | | - fbTimeout: 'No flash response, applying .'+_s.swfCSS.swfTimedout+' CSS..', |
| 3536 | + fbTimeout: 'No flash response, applying .'+_swfCSS.swfTimedout+' CSS..', |
3176 | 3537 | fbLoaded: 'Flash loaded', |
3177 | 3538 | fbHandler: _smc+'flashBlockHandler()', |
3178 | 3539 | manURL: 'SMSound.load(): Using manually-assigned URL', |
— | — | @@ -3355,11 +3716,11 @@ |
3356 | 3717 | |
3357 | 3718 | _setPolling = function(bPolling, bHighPerformance) { |
3358 | 3719 | |
3359 | | - if (!_s.o) { |
| 3720 | + if (!_flash) { |
3360 | 3721 | return false; |
3361 | 3722 | } |
3362 | 3723 | |
3363 | | - _s.o._setPolling(bPolling, bHighPerformance); |
| 3724 | + _flash._setPolling(bPolling, bHighPerformance); |
3364 | 3725 | |
3365 | 3726 | }; |
3366 | 3727 | |
— | — | @@ -3379,7 +3740,7 @@ |
3380 | 3741 | |
3381 | 3742 | var oD, oDebug, oTarget, oToggle, tmp; |
3382 | 3743 | |
3383 | | - if (_s.debugMode && !_id(_s.debugID) && ((!_hasConsole || !_s.useConsole) || (_s.useConsole && _hasConsole && !_s.consoleOnly))) { |
| 3744 | + if (_s.debugMode && !_id(_s.debugID) && (!_hasConsole || !_s.useConsole || !_s.consoleOnly)) { |
3384 | 3745 | |
3385 | 3746 | oD = _doc.createElement('div'); |
3386 | 3747 | oD.id = _s.debugID + '-toggle'; |
— | — | @@ -3499,15 +3860,15 @@ |
3500 | 3861 | var css = []; |
3501 | 3862 | |
3502 | 3863 | if (_s.debugMode) { |
3503 | | - css.push(_s.swfCSS.sm2Debug); |
| 3864 | + css.push(_swfCSS.sm2Debug); |
3504 | 3865 | } |
3505 | 3866 | |
3506 | 3867 | if (_s.debugFlash) { |
3507 | | - css.push(_s.swfCSS.flashDebug); |
| 3868 | + css.push(_swfCSS.flashDebug); |
3508 | 3869 | } |
3509 | 3870 | |
3510 | 3871 | if (_s.useHighPerformance) { |
3511 | | - css.push(_s.swfCSS.highPerf); |
| 3872 | + css.push(_swfCSS.highPerf); |
3512 | 3873 | } |
3513 | 3874 | |
3514 | 3875 | return css.join(' '); |
— | — | @@ -3520,7 +3881,7 @@ |
3521 | 3882 | |
3522 | 3883 | var name = _str('fbHandler'), |
3523 | 3884 | p = _s.getMoviePercent(), |
3524 | | - css = _s.swfCSS, |
| 3885 | + css = _swfCSS, |
3525 | 3886 | error = {type:'FLASHBLOCK'}; |
3526 | 3887 | |
3527 | 3888 | if (_s.html5Only) { |
— | — | @@ -3545,9 +3906,11 @@ |
3546 | 3907 | |
3547 | 3908 | // SM2 loaded OK (or recovered) |
3548 | 3909 | |
| 3910 | + // <d> |
3549 | 3911 | if (_s.didFlashBlock) { |
3550 | 3912 | _s._wD(name+': Unblocked'); |
3551 | 3913 | } |
| 3914 | + // </d> |
3552 | 3915 | |
3553 | 3916 | if (_s.oMC) { |
3554 | 3917 | _s.oMC.className = [_getSWFCSS(), css.swfDefault, css.swfLoaded + (_s.didFlashBlock?' '+css.swfUnblocked:'')].join(' '); |
— | — | @@ -3754,22 +4117,134 @@ |
3755 | 4118 | |
3756 | 4119 | }; |
3757 | 4120 | |
| 4121 | + _parseURL = function(url) { |
| 4122 | + |
| 4123 | + /** |
| 4124 | + * Internal: Finds and returns the first playable URL (or failing that, the first URL.) |
| 4125 | + * @param {string or array} url A single URL string, OR, an array of URL strings or {url:'/path/to/resource', type:'audio/mp3'} objects. |
| 4126 | + */ |
| 4127 | + |
| 4128 | + var i, j, result = 0; |
| 4129 | + |
| 4130 | + if (url instanceof Array) { |
| 4131 | + |
| 4132 | + // find the first good one |
| 4133 | + for (i=0, j=url.length; i<j; i++) { |
| 4134 | + |
| 4135 | + if (url[i] instanceof Object) { |
| 4136 | + // MIME check |
| 4137 | + if (_s.canPlayMIME(url[i].type)) { |
| 4138 | + result = i; |
| 4139 | + break; |
| 4140 | + } |
| 4141 | + |
| 4142 | + } else if (_s.canPlayURL(url[i])) { |
| 4143 | + // URL string check |
| 4144 | + result = i; |
| 4145 | + break; |
| 4146 | + } |
| 4147 | + |
| 4148 | + } |
| 4149 | + |
| 4150 | + // normalize to string |
| 4151 | + if (url[result].url) { |
| 4152 | + url[result] = url[result].url; |
| 4153 | + } |
| 4154 | + |
| 4155 | + return url[result]; |
| 4156 | + |
| 4157 | + } else { |
| 4158 | + |
| 4159 | + // single URL case |
| 4160 | + return url; |
| 4161 | + |
| 4162 | + } |
| 4163 | + |
| 4164 | + }; |
| 4165 | + |
| 4166 | + |
3758 | 4167 | _startTimer = function(oSound) { |
3759 | 4168 | |
| 4169 | + /** |
| 4170 | + * attach a timer to this sound, and start an interval if needed |
| 4171 | + */ |
| 4172 | + |
3760 | 4173 | if (!oSound._hasTimer) { |
| 4174 | + |
3761 | 4175 | oSound._hasTimer = true; |
| 4176 | + |
| 4177 | + if (!_likesHTML5 && _s.html5PollingInterval) { |
| 4178 | + |
| 4179 | + if (_h5IntervalTimer === null && _h5TimerCount === 0) { |
| 4180 | + |
| 4181 | + _h5IntervalTimer = window.setInterval(_timerExecute, _s.html5PollingInterval); |
| 4182 | + |
| 4183 | + } |
| 4184 | + |
| 4185 | + _h5TimerCount++; |
| 4186 | + |
| 4187 | + } |
| 4188 | + |
3762 | 4189 | } |
3763 | 4190 | |
3764 | 4191 | }; |
3765 | 4192 | |
3766 | 4193 | _stopTimer = function(oSound) { |
3767 | 4194 | |
| 4195 | + /** |
| 4196 | + * detach a timer |
| 4197 | + */ |
| 4198 | + |
3768 | 4199 | if (oSound._hasTimer) { |
| 4200 | + |
3769 | 4201 | oSound._hasTimer = false; |
| 4202 | + |
| 4203 | + if (!_likesHTML5 && _s.html5PollingInterval) { |
| 4204 | + |
| 4205 | + // interval will stop itself at next execution. |
| 4206 | + |
| 4207 | + _h5TimerCount--; |
| 4208 | + |
| 4209 | + } |
| 4210 | + |
3770 | 4211 | } |
3771 | 4212 | |
3772 | 4213 | }; |
3773 | 4214 | |
| 4215 | + _timerExecute = function() { |
| 4216 | + |
| 4217 | + /** |
| 4218 | + * manual polling for HTML5 progress events, ie., whileplaying() (can achieve greater precision than conservative default HTML5 interval) |
| 4219 | + */ |
| 4220 | + |
| 4221 | + var i, j; |
| 4222 | + |
| 4223 | + if (_h5IntervalTimer !== null && !_h5TimerCount) { |
| 4224 | + |
| 4225 | + // no active timers, stop polling interval. |
| 4226 | + |
| 4227 | + window.clearInterval(_h5IntervalTimer); |
| 4228 | + |
| 4229 | + _h5IntervalTimer = null; |
| 4230 | + |
| 4231 | + return false; |
| 4232 | + |
| 4233 | + } |
| 4234 | + |
| 4235 | + // check all HTML5 sounds with timers |
| 4236 | + |
| 4237 | + for (i = _s.soundIDs.length; i--;) { |
| 4238 | + |
| 4239 | + if (_s.sounds[_s.soundIDs[i]].isHTML5 && _s.sounds[_s.soundIDs[i]]._hasTimer) { |
| 4240 | + |
| 4241 | + _s.sounds[_s.soundIDs[i]]._onTimer(); |
| 4242 | + |
| 4243 | + } |
| 4244 | + |
| 4245 | + } |
| 4246 | + |
| 4247 | + }; |
| 4248 | + |
3774 | 4249 | _catchError = function(options) { |
3775 | 4250 | |
3776 | 4251 | options = (typeof options !== 'undefined' ? options : {}); |
— | — | @@ -3847,16 +4322,17 @@ |
3848 | 4323 | |
3849 | 4324 | }; |
3850 | 4325 | |
3851 | | - this._externalInterfaceOK = function(flashDate) { |
| 4326 | + this._externalInterfaceOK = function(flashDate, swfVersion) { |
3852 | 4327 | |
3853 | 4328 | // flash callback confirming flash loaded, EI working etc. |
3854 | 4329 | // flashDate = approx. timing/delay info for JS/flash bridge |
| 4330 | + // swfVersion: SWF build string |
3855 | 4331 | |
3856 | 4332 | if (_s.swfLoaded) { |
3857 | 4333 | return false; |
3858 | 4334 | } |
3859 | 4335 | |
3860 | | - var eiTime = new Date().getTime(); |
| 4336 | + var e, eiTime = new Date().getTime(); |
3861 | 4337 | |
3862 | 4338 | _s._wD(_smc+'externalInterfaceOK()' + (flashDate?' (~' + (eiTime - flashDate) + ' ms)':'')); |
3863 | 4339 | _debugTS('swf', true); |
— | — | @@ -3868,6 +4344,23 @@ |
3869 | 4345 | _badSafariFix(); |
3870 | 4346 | } |
3871 | 4347 | |
| 4348 | + // complain if JS + SWF build/version strings don't match, excluding +DEV builds |
| 4349 | + // <d> |
| 4350 | + if (!swfVersion || swfVersion.replace(/\+dev/i,'') !== _s.versionNumber.replace(/\+dev/i, '')) { |
| 4351 | + |
| 4352 | + e = _sm + ': Fatal: JavaScript file build "' + _s.versionNumber + '" does not match Flash SWF build "' + swfVersion + '" at ' + _s.url + '. Ensure both are up-to-date.'; |
| 4353 | + |
| 4354 | + // escape flash -> JS stack so this error fires in window. |
| 4355 | + setTimeout(function versionMismatch() { |
| 4356 | + throw new Error(e); |
| 4357 | + }, 0); |
| 4358 | + |
| 4359 | + // exit, init will fail with timeout |
| 4360 | + return false; |
| 4361 | + |
| 4362 | + } |
| 4363 | + // </d> |
| 4364 | + |
3872 | 4365 | if (_isIE) { |
3873 | 4366 | // IE needs a timeout OR delay until window.onload - may need TODO: investigating |
3874 | 4367 | setTimeout(_init, 100); |
— | — | @@ -3939,7 +4432,6 @@ |
3940 | 4433 | * does not apply when using high performance (position:fixed means on-screen), OR infinite flash load timeout |
3941 | 4434 | * wmode breaks IE 8 on Vista + Win7 too in some cases, as of January 2011 (?) |
3942 | 4435 | */ |
3943 | | - _s.specialWmodeCase = true; |
3944 | 4436 | _wDS('spcWmode'); |
3945 | 4437 | _s.wmode = null; |
3946 | 4438 | } |
— | — | @@ -4008,7 +4500,7 @@ |
4009 | 4501 | if (!_s.oMC.id) { |
4010 | 4502 | |
4011 | 4503 | _s.oMC.id = _s.movieID; |
4012 | | - _s.oMC.className = _s.swfCSS.swfDefault + ' ' + extraClass; |
| 4504 | + _s.oMC.className = _swfCSS.swfDefault + ' ' + extraClass; |
4013 | 4505 | s = null; |
4014 | 4506 | oEl = null; |
4015 | 4507 | |
— | — | @@ -4059,7 +4551,7 @@ |
4060 | 4552 | oTarget.appendChild(_s.oMC); |
4061 | 4553 | if (_isIE) { |
4062 | 4554 | oEl = _s.oMC.appendChild(_doc.createElement('div')); |
4063 | | - oEl.className = _s.swfCSS.swfBox; |
| 4555 | + oEl.className = _swfCSS.swfBox; |
4064 | 4556 | oEl.innerHTML = movieHTML; |
4065 | 4557 | } |
4066 | 4558 | _appendSuccess = true; |
— | — | @@ -4071,11 +4563,11 @@ |
4072 | 4564 | |
4073 | 4565 | // SM2 container is already in the document (eg. flashblock use case) |
4074 | 4566 | sClass = _s.oMC.className; |
4075 | | - _s.oMC.className = (sClass?sClass+' ':_s.swfCSS.swfDefault) + (extraClass?' '+extraClass:''); |
| 4567 | + _s.oMC.className = (sClass?sClass+' ':_swfCSS.swfDefault) + (extraClass?' '+extraClass:''); |
4076 | 4568 | _s.oMC.appendChild(oMovie); |
4077 | 4569 | if (_isIE) { |
4078 | 4570 | oEl = _s.oMC.appendChild(_doc.createElement('div')); |
4079 | | - oEl.className = _s.swfCSS.swfBox; |
| 4571 | + oEl.className = _swfCSS.swfBox; |
4080 | 4572 | oEl.innerHTML = movieHTML; |
4081 | 4573 | } |
4082 | 4574 | _appendSuccess = true; |
— | — | @@ -4101,14 +4593,14 @@ |
4102 | 4594 | |
4103 | 4595 | // attempt to get, or create, movie |
4104 | 4596 | // may already exist |
4105 | | - if (_s.o) { |
| 4597 | + if (_flash) { |
4106 | 4598 | return false; |
4107 | 4599 | } |
4108 | 4600 | |
4109 | 4601 | // inline markup case |
4110 | | - _s.o = _s.getMovie(_s.id); |
| 4602 | + _flash = _s.getMovie(_s.id); |
4111 | 4603 | |
4112 | | - if (!_s.o) { |
| 4604 | + if (!_flash) { |
4113 | 4605 | if (!_oRemoved) { |
4114 | 4606 | // try to create |
4115 | 4607 | _createMovie(_s.id, _s.url); |
— | — | @@ -4122,11 +4614,11 @@ |
4123 | 4615 | _oRemoved = null; |
4124 | 4616 | _didAppend = true; |
4125 | 4617 | } |
4126 | | - _s.o = _s.getMovie(_s.id); |
| 4618 | + _flash = _s.getMovie(_s.id); |
4127 | 4619 | } |
4128 | 4620 | |
4129 | 4621 | // <d> |
4130 | | - if (_s.o) { |
| 4622 | + if (_flash) { |
4131 | 4623 | _wDS('waitEI'); |
4132 | 4624 | } |
4133 | 4625 | // </d> |
— | — | @@ -4287,7 +4779,7 @@ |
4288 | 4780 | |
4289 | 4781 | if (_disabled || bNoDisable) { |
4290 | 4782 | if (_s.useFlashBlock && _s.oMC) { |
4291 | | - _s.oMC.className = _getSWFCSS() + ' ' + (_s.getMoviePercent() === null?_s.swfCSS.swfTimedout:_s.swfCSS.swfError); |
| 4783 | + _s.oMC.className = _getSWFCSS() + ' ' + (_s.getMoviePercent() === null?_swfCSS.swfTimedout:_swfCSS.swfError); |
4292 | 4784 | } |
4293 | 4785 | _processOnEvents({type:'ontimeout', error:error}); |
4294 | 4786 | _debugTS('onload', false); |
— | — | @@ -4347,7 +4839,7 @@ |
4348 | 4840 | _wDS('flashJS'); |
4349 | 4841 | |
4350 | 4842 | // attempt to talk to Flash |
4351 | | - _s.o._externalInterfaceTest(false); |
| 4843 | + _flash._externalInterfaceTest(false); |
4352 | 4844 | |
4353 | 4845 | // apply user-specified polling interval, OR, if "high performance" set, faster vs. default polling |
4354 | 4846 | // (determines frequency of whileloading/whileplaying callbacks, effectively driving UI framerates) |
— | — | @@ -4355,7 +4847,7 @@ |
4356 | 4848 | |
4357 | 4849 | if (!_s.debugMode) { |
4358 | 4850 | // stop the SWF from making debug output calls to JS |
4359 | | - _s.o._disableDebug(); |
| 4851 | + _flash._disableDebug(); |
4360 | 4852 | } |
4361 | 4853 | |
4362 | 4854 | _s.enabled = true; |
— | — | @@ -4467,6 +4959,12 @@ |
4468 | 4960 | |
4469 | 4961 | }; |
4470 | 4962 | |
| 4963 | + _winOnLoad = function() { |
| 4964 | + // catch edge case of _initComplete() firing after window.load() |
| 4965 | + _windowLoaded = true; |
| 4966 | + _event.remove(_win, 'load', _winOnLoad); |
| 4967 | + }; |
| 4968 | + |
4471 | 4969 | // sniff up-front |
4472 | 4970 | _detectFlash(); |
4473 | 4971 | |
— | — | @@ -4474,7 +4972,9 @@ |
4475 | 4973 | _event.add(_win, 'focus', _handleFocus); |
4476 | 4974 | _event.add(_win, 'load', _handleFocus); |
4477 | 4975 | _event.add(_win, 'load', _delayWaitForEI); |
| 4976 | + _event.add(_win, 'load', _winOnLoad); |
4478 | 4977 | |
| 4978 | + |
4479 | 4979 | if (_isSafari && _tryInitOnFocus) { |
4480 | 4980 | // massive Safari 3.1 focus detection hack |
4481 | 4981 | _event.add(_win, 'mousemove', _handleFocus); |
Index: trunk/extensions/SoundManager2Button/script/soundmanager2-nodebug.js |
— | — | @@ -8,7 +8,7 @@ |
9 | 9 | * Code provided under the BSD License: |
10 | 10 | * http://schillmania.com/projects/soundmanager2/license.txt |
11 | 11 | * |
12 | | - * V2.97a.20111030 |
| 12 | + * V2.97a.20111220 |
13 | 13 | */ |
14 | 14 | |
15 | 15 | /*global window, SM2_DEFER, sm2Debugger, console, document, navigator, setTimeout, setInterval, clearInterval, Audio */ |
— | — | @@ -21,11 +21,12 @@ |
22 | 22 | this.debugMode = false; |
23 | 23 | this.debugFlash = false; |
24 | 24 | this.useConsole = true; |
25 | | - this.consoleOnly = false; |
| 25 | + this.consoleOnly = true; |
26 | 26 | this.waitForWindowLoad = false; |
27 | 27 | this.bgColor = '#ffffff'; |
28 | 28 | this.useHighPerformance = false; |
29 | 29 | this.flashPollingInterval = null; |
| 30 | + this.html5PollingInterval = null; |
30 | 31 | this.flashLoadTimeout = 1000; |
31 | 32 | this.wmode = null; |
32 | 33 | this.allowScriptAccess = 'always'; |
— | — | @@ -55,8 +56,8 @@ |
56 | 57 | }; |
57 | 58 | this.defaultOptions = { |
58 | 59 | 'autoLoad': false, |
59 | | - 'stream': true, |
60 | 60 | 'autoPlay': false, |
| 61 | + 'from': null, |
61 | 62 | 'loops': 1, |
62 | 63 | 'onid3': null, |
63 | 64 | 'onload': null, |
— | — | @@ -65,6 +66,7 @@ |
66 | 67 | 'onpause': null, |
67 | 68 | 'onresume': null, |
68 | 69 | 'whileplaying': null, |
| 70 | + 'onposition': null, |
69 | 71 | 'onstop': null, |
70 | 72 | 'onfailure': null, |
71 | 73 | 'onfinish': null, |
— | — | @@ -72,6 +74,8 @@ |
73 | 75 | 'multiShotEvents': false, |
74 | 76 | 'position': null, |
75 | 77 | 'pan': 0, |
| 78 | + 'stream': true, |
| 79 | + 'to': null, |
76 | 80 | 'type': null, |
77 | 81 | 'usePolicyFile': false, |
78 | 82 | 'volume': 100 |
— | — | @@ -92,32 +96,19 @@ |
93 | 97 | }; |
94 | 98 | this.movieID = 'sm2-container'; |
95 | 99 | this.id = (smID || 'sm2movie'); |
96 | | - this.swfCSS = { |
97 | | - 'swfBox': 'sm2-object-box', |
98 | | - 'swfDefault': 'movieContainer', |
99 | | - 'swfError': 'swf_error', |
100 | | - 'swfTimedout': 'swf_timedout', |
101 | | - 'swfLoaded': 'swf_loaded', |
102 | | - 'swfUnblocked': 'swf_unblocked', |
103 | | - 'sm2Debug': 'sm2_debug', |
104 | | - 'highPerf': 'high_performance', |
105 | | - 'flashDebug': 'flash_debug' |
106 | | - }; |
107 | 100 | this.debugID = 'soundmanager-debug'; |
108 | 101 | this.debugURLParam = /([#?&])debug=1/i; |
109 | | - this.versionNumber = 'V2.97a.20111030'; |
| 102 | + this.versionNumber = 'V2.97a.20111220'; |
110 | 103 | this.version = null; |
111 | 104 | this.movieURL = null; |
112 | 105 | this.url = (smURL || null); |
113 | 106 | this.altURL = null; |
114 | 107 | this.swfLoaded = false; |
115 | 108 | this.enabled = false; |
116 | | - this.o = null; |
117 | 109 | this.oMC = null; |
118 | 110 | this.sounds = {}; |
119 | 111 | this.soundIDs = []; |
120 | 112 | this.muted = false; |
121 | | - this.specialWmodeCase = false; |
122 | 113 | this.didFlashBlock = false; |
123 | 114 | this.filePattern = null; |
124 | 115 | this.filePatterns = { |
— | — | @@ -147,10 +138,11 @@ |
148 | 139 | this.html5Only = false; |
149 | 140 | this.ignoreFlash = false; |
150 | 141 | var SMSound, |
151 | | - _s = this, _sm = 'soundManager', _smc = _sm+'::', _h5 = 'HTML5::', _id, _ua = navigator.userAgent, _win = window, _wl = _win.location.href.toString(), _doc = document, _doNothing, _init, _fV, _on_queue = [], _debugOpen = true, _debugTS, _didAppend = false, _appendSuccess = false, _didInit = false, _disabled = false, _windowLoaded = false, _wDS, _wdCount = 0, _initComplete, _mixin, _addOnEvent, _processOnEvents, _initUserOnload, _delayWaitForEI, _waitForEI, _setVersionInfo, _handleFocus, _strings, _initMovie, _domContentLoaded, _didDCLoaded, _getDocument, _createMovie, _catchError, _setPolling, _initDebug, _debugLevels = ['log', 'info', 'warn', 'error'], _defaultFlashVersion = 8, _disableObject, _failSafely, _normalizeMovieURL, _oRemoved = null, _oRemovedHTML = null, _str, _flashBlockHandler, _getSWFCSS, _toggleDebug, _loopFix, _policyFix, _complain, _idCheck, _waitingForEI = false, _initPending = false, _smTimer, _onTimer, _startTimer, _stopTimer, _needsFlash = null, _featureCheck, _html5OK, _html5CanPlay, _html5Ext, _html5Unload, _domContentLoadedIE, _testHTML5, _event, _slice = Array.prototype.slice, _useGlobalHTML5Audio = false, _hasFlash, _detectFlash, _badSafariFix, _html5_events, _showSupport, |
| 142 | + _s = this, _flash = null, _sm = 'soundManager', _smc = _sm+'::', _h5 = 'HTML5::', _id, _ua = navigator.userAgent, _win = window, _wl = _win.location.href.toString(), _doc = document, _doNothing, _init, _fV, _on_queue = [], _debugOpen = true, _debugTS, _didAppend = false, _appendSuccess = false, _didInit = false, _disabled = false, _windowLoaded = false, _wDS, _wdCount = 0, _initComplete, _mixin, _addOnEvent, _processOnEvents, _initUserOnload, _delayWaitForEI, _waitForEI, _setVersionInfo, _handleFocus, _strings, _initMovie, _domContentLoaded, _winOnLoad, _didDCLoaded, _getDocument, _createMovie, _catchError, _setPolling, _initDebug, _debugLevels = ['log', 'info', 'warn', 'error'], _defaultFlashVersion = 8, _disableObject, _failSafely, _normalizeMovieURL, _oRemoved = null, _oRemovedHTML = null, _str, _flashBlockHandler, _getSWFCSS, _swfCSS, _toggleDebug, _loopFix, _policyFix, _complain, _idCheck, _waitingForEI = false, _initPending = false, _smTimer, _onTimer, _startTimer, _stopTimer, _timerExecute, _h5TimerCount = 0, _h5IntervalTimer = null, _parseURL, |
| 143 | + _needsFlash = null, _featureCheck, _html5OK, _html5CanPlay, _html5Ext, _html5Unload, _domContentLoadedIE, _testHTML5, _event, _slice = Array.prototype.slice, _useGlobalHTML5Audio = false, _hasFlash, _detectFlash, _badSafariFix, _html5_events, _showSupport, |
152 | 144 | _is_iDevice = _ua.match(/(ipad|iphone|ipod)/i), _is_firefox = _ua.match(/firefox/i), _is_android = _ua.match(/droid/i), _isIE = _ua.match(/msie/i), _isWebkit = _ua.match(/webkit/i), _isSafari = (_ua.match(/safari/i) && !_ua.match(/chrome/i)), _isOpera = (_ua.match(/opera/i)), |
153 | 145 | _likesHTML5 = (_ua.match(/(mobile|pre\/|xoom)/i) || _is_iDevice), |
154 | | - _isBadSafari = (!_wl.match(/usehtml5audio/i) && !_wl.match(/sm2\-ignorebadua/i) && _isSafari && _ua.match(/OS X 10_6_([3-7])/i)), |
| 146 | + _isBadSafari = (!_wl.match(/usehtml5audio/i) && !_wl.match(/sm2\-ignorebadua/i) && _isSafari && !_ua.match(/silk/i) && _ua.match(/OS X 10_6_([3-7])/i)), |
155 | 147 | _hasConsole = (typeof console !== 'undefined' && typeof console.log !== 'undefined'), _isFocused = (typeof _doc.hasFocus !== 'undefined'?_doc.hasFocus():null), _tryInitOnFocus = (_isSafari && typeof _doc.hasFocus === 'undefined'), _okToDisable = !_tryInitOnFocus, _flashMIME = /(mp3|mp4|mpa)/i, |
156 | 148 | _emptyURL = 'about:blank', |
157 | 149 | _overHTTP = (_doc.location?_doc.location.protocol.match(/http/i):null), |
— | — | @@ -161,6 +153,17 @@ |
162 | 154 | this.mimePattern = /^\s*audio\/(?:x-)?(?:mp(?:eg|3))\s*(?:$|;)/i; |
163 | 155 | this.useAltURL = !_overHTTP; |
164 | 156 | this._global_a = null; |
| 157 | + _swfCSS = { |
| 158 | + 'swfBox': 'sm2-object-box', |
| 159 | + 'swfDefault': 'movieContainer', |
| 160 | + 'swfError': 'swf_error', |
| 161 | + 'swfTimedout': 'swf_timedout', |
| 162 | + 'swfLoaded': 'swf_loaded', |
| 163 | + 'swfUnblocked': 'swf_unblocked', |
| 164 | + 'sm2Debug': 'sm2_debug', |
| 165 | + 'highPerf': 'high_performance', |
| 166 | + 'flashDebug': 'flash_debug' |
| 167 | + }; |
165 | 168 | if (_likesHTML5) { |
166 | 169 | _s.useHTML5Audio = true; |
167 | 170 | _s.preferFlash = false; |
— | — | @@ -177,10 +180,10 @@ |
178 | 181 | return _id(smID) || _doc[smID] || _win[smID]; |
179 | 182 | }; |
180 | 183 | this.createSound = function(oOptions) { |
181 | | - var _cs = _sm+'.createSound(): ', |
| 184 | + var _cs, _cs_string, |
182 | 185 | thisOptions = null, oSound = null, _tO = null; |
183 | 186 | if (!_didInit || !_s.ok()) { |
184 | | - _complain(_cs + _str(!_didInit?'notReady':'notOK')); |
| 187 | + _complain(_cs_string); |
185 | 188 | return false; |
186 | 189 | } |
187 | 190 | if (arguments.length === 2) { |
— | — | @@ -190,6 +193,7 @@ |
191 | 194 | }; |
192 | 195 | } |
193 | 196 | thisOptions = _mixin(oOptions); |
| 197 | + thisOptions.url = _parseURL(thisOptions.url); |
194 | 198 | _tO = thisOptions; |
195 | 199 | if (_idCheck(_tO.id, true)) { |
196 | 200 | return _s.sounds[_tO.id]; |
— | — | @@ -217,9 +221,9 @@ |
218 | 222 | _tO = _policyFix(_tO, _cs); |
219 | 223 | oSound = make(); |
220 | 224 | if (_fV === 8) { |
221 | | - _s.o._createSound(_tO.id, _tO.loops||1, _tO.usePolicyFile); |
| 225 | + _flash._createSound(_tO.id, _tO.loops||1, _tO.usePolicyFile); |
222 | 226 | } else { |
223 | | - _s.o._createSound(_tO.id, _tO.url, _tO.usePeakData, _tO.useWaveformData, _tO.useEQData, _tO.isMovieStar, (_tO.isMovieStar?_tO.bufferTime:false), _tO.loops||1, _tO.serverURL, _tO.duration||null, _tO.autoPlay, true, _tO.autoLoad, _tO.usePolicyFile); |
| 227 | + _flash._createSound(_tO.id, _tO.url, _tO.usePeakData, _tO.useWaveformData, _tO.useEQData, _tO.isMovieStar, (_tO.isMovieStar?_tO.bufferTime:false), _tO.loops||1, _tO.serverURL, _tO.duration||null, _tO.autoPlay, true, _tO.autoLoad, _tO.usePolicyFile); |
224 | 228 | if (!_tO.serverURL) { |
225 | 229 | oSound.connected = true; |
226 | 230 | if (_tO.onconnect) { |
— | — | @@ -269,16 +273,22 @@ |
270 | 274 | } |
271 | 275 | return _s.sounds[sID].unload(); |
272 | 276 | }; |
273 | | - this.onposition = function(sID, nPosition, oMethod, oScope) { |
| 277 | + this.onPosition = function(sID, nPosition, oMethod, oScope) { |
274 | 278 | if (!_idCheck(sID)) { |
275 | 279 | return false; |
276 | 280 | } |
277 | 281 | return _s.sounds[sID].onposition(nPosition, oMethod, oScope); |
278 | 282 | }; |
| 283 | + this.onposition = this.onPosition; |
| 284 | + this.clearOnPosition = function(sID, nPosition, oMethod) { |
| 285 | + if (!_idCheck(sID)) { |
| 286 | + return false; |
| 287 | + } |
| 288 | + return _s.sounds[sID].clearOnPosition(nPosition, oMethod); |
| 289 | + }; |
279 | 290 | this.play = function(sID, oOptions) { |
280 | | - var fN = _sm+'.play(): '; |
281 | 291 | if (!_didInit || !_s.ok()) { |
282 | | - _complain(fN + _str(!_didInit?'notReady':'notOK')); |
| 292 | + _complain(_sm+'.play(): ' + _str(!_didInit?'notReady':'notOK')); |
283 | 293 | return false; |
284 | 294 | } |
285 | 295 | if (!_idCheck(sID)) { |
— | — | @@ -360,8 +370,7 @@ |
361 | 371 | return _s.sounds[sID].setVolume(nVol); |
362 | 372 | }; |
363 | 373 | this.mute = function(sID) { |
364 | | - var fN = _sm+'.mute(): ', |
365 | | - i = 0; |
| 374 | + var i = 0; |
366 | 375 | if (typeof sID !== 'string') { |
367 | 376 | sID = null; |
368 | 377 | } |
— | — | @@ -382,7 +391,7 @@ |
383 | 392 | _s.mute(); |
384 | 393 | }; |
385 | 394 | this.unmute = function(sID) { |
386 | | - var fN = _sm+'.unmute(): ', i; |
| 395 | + var i; |
387 | 396 | if (typeof sID !== 'string') { |
388 | 397 | sID = null; |
389 | 398 | } |
— | — | @@ -410,8 +419,8 @@ |
411 | 420 | }; |
412 | 421 | this.getMemoryUse = function() { |
413 | 422 | var ram = 0; |
414 | | - if (_s.o && _fV !== 8) { |
415 | | - ram = parseInt(_s.o._getMemoryUse(), 10); |
| 423 | + if (_flash && _fV !== 8) { |
| 424 | + ram = parseInt(_flash._getMemoryUse(), 10); |
416 | 425 | } |
417 | 426 | return ram; |
418 | 427 | }; |
— | — | @@ -507,15 +516,15 @@ |
508 | 517 | } |
509 | 518 | try { |
510 | 519 | if (_isIE) { |
511 | | - _oRemovedHTML = _s.o.innerHTML; |
| 520 | + _oRemovedHTML = _flash.innerHTML; |
512 | 521 | } |
513 | | - _oRemoved = _s.o.parentNode.removeChild(_s.o); |
| 522 | + _oRemoved = _flash.parentNode.removeChild(_flash); |
514 | 523 | } catch(e) { |
515 | 524 | } |
516 | 525 | _oRemovedHTML = _oRemoved = _needsFlash = null; |
517 | 526 | _s.enabled = _didDCLoaded = _didInit = _waitingForEI = _initPending = _didAppend = _appendSuccess = _disabled = _s.swfLoaded = false; |
518 | 527 | _s.soundIDs = _s.sounds = []; |
519 | | - _s.o = null; |
| 528 | + _flash = null; |
520 | 529 | for (i in _on_queue) { |
521 | 530 | if (_on_queue.hasOwnProperty(i)) { |
522 | 531 | for (j = _on_queue[i].length; j--;) { |
— | — | @@ -526,7 +535,7 @@ |
527 | 536 | _win.setTimeout(_s.beginDelayedInit, 20); |
528 | 537 | }; |
529 | 538 | this.getMoviePercent = function() { |
530 | | - return (_s.o && typeof _s.o.PercentLoaded !== 'undefined' ? _s.o.PercentLoaded() : null); |
| 539 | + return (_flash && typeof _flash.PercentLoaded !== 'undefined' ? _flash.PercentLoaded() : null); |
531 | 540 | }; |
532 | 541 | this.beginDelayedInit = function() { |
533 | 542 | _windowLoaded = true; |
— | — | @@ -546,7 +555,11 @@ |
547 | 556 | _s.disable(true); |
548 | 557 | }; |
549 | 558 | SMSound = function(oOptions) { |
550 | | - var _t = this, _resetProperties, _stop_html5_timer, _start_html5_timer; |
| 559 | + var _t = this, _resetProperties, _add_html5_events, _remove_html5_events, _stop_html5_timer, _start_html5_timer, _attachOnPosition, _onplay_called = false, _onPositionItems = [], _onPositionFired = 0, _detachOnPosition, _applyFromTo, _lastURL = null; |
| 560 | + var _lastHTML5State = { |
| 561 | + duration: null, |
| 562 | + time: null |
| 563 | + }; |
551 | 564 | this.sID = oOptions.id; |
552 | 565 | this.url = oOptions.url; |
553 | 566 | this.options = _mixin(oOptions); |
— | — | @@ -554,14 +567,13 @@ |
555 | 568 | this._iO = this.instanceOptions; |
556 | 569 | this.pan = this.options.pan; |
557 | 570 | this.volume = this.options.volume; |
558 | | - this._lastURL = null; |
559 | 571 | this.isHTML5 = false; |
560 | 572 | this._a = null; |
561 | 573 | this.id3 = {}; |
562 | 574 | this._debug = function() { |
563 | 575 | }; |
564 | 576 | this.load = function(oOptions) { |
565 | | - var oS = null; |
| 577 | + var oS = null, _iO; |
566 | 578 | if (typeof oOptions !== 'undefined') { |
567 | 579 | _t._iO = _mixin(oOptions, _t.options); |
568 | 580 | _t.instanceOptions = _t._iO; |
— | — | @@ -569,7 +581,7 @@ |
570 | 582 | oOptions = _t.options; |
571 | 583 | _t._iO = oOptions; |
572 | 584 | _t.instanceOptions = _t._iO; |
573 | | - if (_t._lastURL && _t._lastURL !== _t.url) { |
| 585 | + if (_lastURL && _lastURL !== _t.url) { |
574 | 586 | _t._iO.url = _t.url; |
575 | 587 | _t.url = null; |
576 | 588 | } |
— | — | @@ -577,20 +589,27 @@ |
578 | 590 | if (!_t._iO.url) { |
579 | 591 | _t._iO.url = _t.url; |
580 | 592 | } |
| 593 | + _t._iO.url = _parseURL(_t._iO.url); |
581 | 594 | if (_t._iO.url === _t.url && _t.readyState !== 0 && _t.readyState !== 2) { |
| 595 | + if (_t.readyState === 3 && _t._iO.onload) { |
| 596 | + _t._iO.onload.apply(_t, [(!!_t.duration)]); |
| 597 | + } |
582 | 598 | return _t; |
583 | 599 | } |
584 | | - _t._lastURL = _t.url; |
| 600 | + _iO = _t._iO; |
| 601 | + _lastURL = _t.url; |
585 | 602 | _t.loaded = false; |
586 | 603 | _t.readyState = 1; |
587 | 604 | _t.playState = 0; |
588 | | - if (_html5OK(_t._iO)) { |
589 | | - oS = _t._setup_html5(_t._iO); |
| 605 | + if (_html5OK(_iO)) { |
| 606 | + oS = _t._setup_html5(_iO); |
590 | 607 | if (!oS._called_load) { |
591 | 608 | _t._html5_canplay = false; |
| 609 | + _t._a.autobuffer = 'auto'; |
| 610 | + _t._a.preload = 'auto'; |
592 | 611 | oS.load(); |
593 | 612 | oS._called_load = true; |
594 | | - if (_t._iO.autoPlay) { |
| 613 | + if (_iO.autoPlay) { |
595 | 614 | _t.play(); |
596 | 615 | } |
597 | 616 | } else { |
— | — | @@ -598,11 +617,12 @@ |
599 | 618 | } else { |
600 | 619 | try { |
601 | 620 | _t.isHTML5 = false; |
602 | | - _t._iO = _policyFix(_loopFix(_t._iO)); |
| 621 | + _t._iO = _policyFix(_loopFix(_iO)); |
| 622 | + _iO = _t._iO; |
603 | 623 | if (_fV === 8) { |
604 | | - _s.o._load(_t.sID, _t._iO.url, _t._iO.stream, _t._iO.autoPlay, (_t._iO.whileloading?1:0), _t._iO.loops||1, _t._iO.usePolicyFile); |
| 624 | + _flash._load(_t.sID, _iO.url, _iO.stream, _iO.autoPlay, (_iO.whileloading?1:0), _iO.loops||1, _iO.usePolicyFile); |
605 | 625 | } else { |
606 | | - _s.o._load(_t.sID, _t._iO.url, !!(_t._iO.stream), !!(_t._iO.autoPlay), _t._iO.loops||1, !!(_t._iO.autoLoad), _t._iO.usePolicyFile); |
| 626 | + _flash._load(_t.sID, _iO.url, !!(_iO.stream), !!(_iO.autoPlay), _iO.loops||1, !!(_iO.autoLoad), _iO.usePolicyFile); |
607 | 627 | } |
608 | 628 | } catch(e) { |
609 | 629 | _catchError({type:'SMSOUND_LOAD_JS_EXCEPTION', fatal:true}); |
— | — | @@ -614,9 +634,9 @@ |
615 | 635 | if (_t.readyState !== 0) { |
616 | 636 | if (!_t.isHTML5) { |
617 | 637 | if (_fV === 8) { |
618 | | - _s.o._unload(_t.sID, _emptyURL); |
| 638 | + _flash._unload(_t.sID, _emptyURL); |
619 | 639 | } else { |
620 | | - _s.o._unload(_t.sID); |
| 640 | + _flash._unload(_t.sID); |
621 | 641 | } |
622 | 642 | } else { |
623 | 643 | _stop_html5_timer(); |
— | — | @@ -632,14 +652,14 @@ |
633 | 653 | this.destruct = function(_bFromSM) { |
634 | 654 | if (!_t.isHTML5) { |
635 | 655 | _t._iO.onfailure = null; |
636 | | - _s.o._destroySound(_t.sID); |
| 656 | + _flash._destroySound(_t.sID); |
637 | 657 | } else { |
638 | 658 | _stop_html5_timer(); |
639 | 659 | if (_t._a) { |
640 | 660 | _t._a.pause(); |
641 | 661 | _html5Unload(_t._a); |
642 | 662 | if (!_useGlobalHTML5Audio) { |
643 | | - _t._remove_html5_events(); |
| 663 | + _remove_html5_events(); |
644 | 664 | } |
645 | 665 | _t._a._t = null; |
646 | 666 | _t._a = null; |
— | — | @@ -650,13 +670,14 @@ |
651 | 671 | } |
652 | 672 | }; |
653 | 673 | this.play = function(oOptions, _updatePlayState) { |
654 | | - var fN = 'SMSound.play(): ', allowMulti, a; |
| 674 | + var fN, allowMulti, a, onready; |
655 | 675 | _updatePlayState = _updatePlayState === undefined ? true : _updatePlayState; |
656 | 676 | if (!oOptions) { |
657 | 677 | oOptions = {}; |
658 | 678 | } |
659 | 679 | _t._iO = _mixin(oOptions, _t._iO); |
660 | 680 | _t._iO = _mixin(_t._iO, _t.options); |
| 681 | + _t._iO.url = _parseURL(_t._iO.url); |
661 | 682 | _t.instanceOptions = _t._iO; |
662 | 683 | if (_t._iO.serverURL && !_t.connected) { |
663 | 684 | if (!_t.getAutoPlay()) { |
— | — | @@ -688,28 +709,50 @@ |
689 | 710 | } else { |
690 | 711 | } |
691 | 712 | if (!_t.isHTML5 && _fV === 9 && _t.position > 0 && _t.position === _t.duration) { |
692 | | - _t._iO.position = 0; |
| 713 | + oOptions.position = 0; |
693 | 714 | } |
694 | 715 | if (_t.paused && _t.position && _t.position > 0) { |
695 | 716 | _t.resume(); |
696 | 717 | } else { |
697 | | - _t.playState = 1; |
698 | | - _t.paused = false; |
| 718 | + _t._iO = _mixin(oOptions, _t._iO); |
| 719 | + if (_t._iO.from !== null && _t._iO.to !== null && _t.instanceCount === 0 && _t.playState === 0 && !_t._iO.serverURL) { |
| 720 | + onready = function() { |
| 721 | + _t._iO = _mixin(oOptions, _t._iO); |
| 722 | + _t.play(_t._iO); |
| 723 | + }; |
| 724 | + if (_t.isHTML5 && !_t._html5_canplay) { |
| 725 | + _t.load({ |
| 726 | + _oncanplay: onready |
| 727 | + }); |
| 728 | + return false; |
| 729 | + } else if (!_t.isHTML5 && !_t.loaded && (!_t.readyState || _t.readyState !== 2)) { |
| 730 | + _t.load({ |
| 731 | + onload: onready |
| 732 | + }); |
| 733 | + return false; |
| 734 | + } |
| 735 | + _t._iO = _applyFromTo(); |
| 736 | + } |
699 | 737 | if (!_t.instanceCount || _t._iO.multiShotEvents || (!_t.isHTML5 && _fV > 8 && !_t.getAutoPlay())) { |
700 | 738 | _t.instanceCount++; |
701 | 739 | } |
702 | | - _t.position = (typeof _t._iO.position !== 'undefined' && !isNaN(_t._iO.position)?_t._iO.position:0); |
| 740 | + if (_t.playState === 0 && _t._iO.onposition) { |
| 741 | + _attachOnPosition(_t); |
| 742 | + } |
| 743 | + _t.playState = 1; |
| 744 | + _t.paused = false; |
| 745 | + _t.position = (typeof _t._iO.position !== 'undefined' && !isNaN(_t._iO.position) ? _t._iO.position : 0); |
703 | 746 | if (!_t.isHTML5) { |
704 | 747 | _t._iO = _policyFix(_loopFix(_t._iO)); |
705 | 748 | } |
706 | 749 | if (_t._iO.onplay && _updatePlayState) { |
707 | 750 | _t._iO.onplay.apply(_t); |
708 | | - _t._onplay_called = true; |
| 751 | + _onplay_called = true; |
709 | 752 | } |
710 | 753 | _t.setVolume(_t._iO.volume, true); |
711 | 754 | _t.setPan(_t._iO.pan, true); |
712 | 755 | if (!_t.isHTML5) { |
713 | | - _s.o._start(_t.sID, _t._iO.loops || 1, (_fV === 9?_t._iO.position:_t._iO.position / 1000)); |
| 756 | + _flash._start(_t.sID, _t._iO.loops || 1, (_fV === 9?_t._iO.position:_t._iO.position / 1000)); |
714 | 757 | } else { |
715 | 758 | _start_html5_timer(); |
716 | 759 | a = _t._setup_html5(); |
— | — | @@ -721,24 +764,28 @@ |
722 | 765 | }; |
723 | 766 | this.start = this.play; |
724 | 767 | this.stop = function(bAll) { |
| 768 | + var _iO = _t._iO, _oP; |
725 | 769 | if (_t.playState === 1) { |
726 | 770 | _t._onbufferchange(0); |
727 | | - _t.resetOnPosition(0); |
| 771 | + _t._resetOnPosition(0); |
728 | 772 | _t.paused = false; |
729 | 773 | if (!_t.isHTML5) { |
730 | 774 | _t.playState = 0; |
731 | 775 | } |
732 | | - if (_t._iO.onstop) { |
733 | | - _t._iO.onstop.apply(_t); |
| 776 | + _detachOnPosition(); |
| 777 | + if (_iO.to) { |
| 778 | + _t.clearOnPosition(_iO.to); |
734 | 779 | } |
735 | 780 | if (!_t.isHTML5) { |
736 | | - _s.o._stop(_t.sID, bAll); |
737 | | - if (_t._iO.serverURL) { |
| 781 | + _flash._stop(_t.sID, bAll); |
| 782 | + if (_iO.serverURL) { |
738 | 783 | _t.unload(); |
739 | 784 | } |
740 | 785 | } else { |
741 | 786 | if (_t._a) { |
| 787 | + _oP = _t.position; |
742 | 788 | _t.setPosition(0); |
| 789 | + _t.position = _oP; |
743 | 790 | _t._a.pause(); |
744 | 791 | _t.playState = 0; |
745 | 792 | _t._onTimer(); |
— | — | @@ -747,13 +794,16 @@ |
748 | 795 | } |
749 | 796 | _t.instanceCount = 0; |
750 | 797 | _t._iO = {}; |
| 798 | + if (_iO.onstop) { |
| 799 | + _iO.onstop.apply(_t); |
| 800 | + } |
751 | 801 | } |
752 | 802 | return _t; |
753 | 803 | }; |
754 | 804 | this.setAutoPlay = function(autoPlay) { |
755 | 805 | _t._iO.autoPlay = autoPlay; |
756 | 806 | if (!_t.isHTML5) { |
757 | | - _s.o._setAutoPlay(_t.sID, autoPlay); |
| 807 | + _flash._setAutoPlay(_t.sID, autoPlay); |
758 | 808 | if (autoPlay) { |
759 | 809 | if (!_t.instanceCount && _t.readyState === 1) { |
760 | 810 | _t.instanceCount++; |
— | — | @@ -774,12 +824,12 @@ |
775 | 825 | original_pos = _t.position; |
776 | 826 | _t.position = offset; |
777 | 827 | position1K = _t.position/1000; |
778 | | - _t.resetOnPosition(_t.position); |
| 828 | + _t._resetOnPosition(_t.position); |
779 | 829 | _t._iO.position = offset; |
780 | 830 | if (!_t.isHTML5) { |
781 | 831 | position = (_fV === 9 ? _t.position : position1K); |
782 | 832 | if (_t.readyState && _t.readyState !== 2) { |
783 | | - _s.o._setPosition(_t.sID, position, (_t.paused || !_t.playState)); |
| 833 | + _flash._setPosition(_t.sID, position, (_t.paused || !_t.playState)); |
784 | 834 | } |
785 | 835 | } else if (_t._a) { |
786 | 836 | if (_t._html5_canplay) { |
— | — | @@ -809,7 +859,7 @@ |
810 | 860 | _t.paused = true; |
811 | 861 | if (!_t.isHTML5) { |
812 | 862 | if (_bCallFlash || _bCallFlash === undefined) { |
813 | | - _s.o._pause(_t.sID); |
| 863 | + _flash._pause(_t.sID); |
814 | 864 | } |
815 | 865 | } else { |
816 | 866 | _t._setup_html5().pause(); |
— | — | @@ -821,25 +871,26 @@ |
822 | 872 | return _t; |
823 | 873 | }; |
824 | 874 | this.resume = function() { |
| 875 | + var _iO = _t._iO; |
825 | 876 | if (!_t.paused) { |
826 | 877 | return _t; |
827 | 878 | } |
828 | 879 | _t.paused = false; |
829 | 880 | _t.playState = 1; |
830 | 881 | if (!_t.isHTML5) { |
831 | | - if (_t._iO.isMovieStar) { |
| 882 | + if (_iO.isMovieStar && !_iO.serverURL) { |
832 | 883 | _t.setPosition(_t.position); |
833 | 884 | } |
834 | | - _s.o._pause(_t.sID); |
| 885 | + _flash._pause(_t.sID); |
835 | 886 | } else { |
836 | 887 | _t._setup_html5().play(); |
837 | 888 | _start_html5_timer(); |
838 | 889 | } |
839 | | - if (!_t._onplay_called && _t._iO.onplay) { |
840 | | - _t._iO.onplay.apply(_t); |
841 | | - _t._onplay_called = true; |
842 | | - } else if (_t._iO.onresume) { |
843 | | - _t._iO.onresume.apply(_t); |
| 890 | + if (_onplay_called && _iO.onplay) { |
| 891 | + _iO.onplay.apply(_t); |
| 892 | + _onplay_called = true; |
| 893 | + } else if (_iO.onresume) { |
| 894 | + _iO.onresume.apply(_t); |
844 | 895 | } |
845 | 896 | return _t; |
846 | 897 | }; |
— | — | @@ -865,7 +916,7 @@ |
866 | 917 | bInstanceOnly = false; |
867 | 918 | } |
868 | 919 | if (!_t.isHTML5) { |
869 | | - _s.o._setPan(_t.sID, nPan); |
| 920 | + _flash._setPan(_t.sID, nPan); |
870 | 921 | } |
871 | 922 | _t._iO.pan = nPan; |
872 | 923 | if (!bInstanceOnly) { |
— | — | @@ -882,7 +933,7 @@ |
883 | 934 | _bInstanceOnly = false; |
884 | 935 | } |
885 | 936 | if (!_t.isHTML5) { |
886 | | - _s.o._setVolume(_t.sID, (_s.muted && !_t.muted) || _t.muted?0:nVol); |
| 937 | + _flash._setVolume(_t.sID, (_s.muted && !_t.muted) || _t.muted?0:nVol); |
887 | 938 | } else if (_t._a) { |
888 | 939 | _t._a.volume = Math.max(0, Math.min(1, nVol/100)); |
889 | 940 | } |
— | — | @@ -896,7 +947,7 @@ |
897 | 948 | this.mute = function() { |
898 | 949 | _t.muted = true; |
899 | 950 | if (!_t.isHTML5) { |
900 | | - _s.o._setVolume(_t.sID, 0); |
| 951 | + _flash._setVolume(_t.sID, 0); |
901 | 952 | } else if (_t._a) { |
902 | 953 | _t._a.muted = true; |
903 | 954 | } |
— | — | @@ -906,7 +957,7 @@ |
907 | 958 | _t.muted = false; |
908 | 959 | var hasIO = typeof _t._iO.volume !== 'undefined'; |
909 | 960 | if (!_t.isHTML5) { |
910 | | - _s.o._setVolume(_t.sID, hasIO?_t._iO.volume:_t.options.volume); |
| 961 | + _flash._setVolume(_t.sID, hasIO?_t._iO.volume:_t.options.volume); |
911 | 962 | } else if (_t._a) { |
912 | 963 | _t._a.muted = false; |
913 | 964 | } |
— | — | @@ -915,44 +966,105 @@ |
916 | 967 | this.toggleMute = function() { |
917 | 968 | return (_t.muted?_t.unmute():_t.mute()); |
918 | 969 | }; |
919 | | - this.onposition = function(nPosition, oMethod, oScope) { |
920 | | - _t._onPositionItems.push({ |
| 970 | + this.onPosition = function(nPosition, oMethod, oScope) { |
| 971 | + _onPositionItems.push({ |
921 | 972 | position: nPosition, |
922 | 973 | method: oMethod, |
923 | | - scope: (typeof oScope !== 'undefined'?oScope:_t), |
| 974 | + scope: (typeof oScope !== 'undefined' ? oScope : _t), |
924 | 975 | fired: false |
925 | 976 | }); |
926 | 977 | return _t; |
927 | 978 | }; |
928 | | - this.processOnPosition = function() { |
929 | | - var i, item, j = _t._onPositionItems.length; |
930 | | - if (!j || !_t.playState || _t._onPositionFired >= j) { |
| 979 | + this.onposition = this.onPosition; |
| 980 | + this.clearOnPosition = function(nPosition, oMethod) { |
| 981 | + var i; |
| 982 | + nPosition = parseInt(nPosition, 10); |
| 983 | + if (isNaN(nPosition)) { |
931 | 984 | return false; |
932 | 985 | } |
| 986 | + for (i=0; i < _onPositionItems.length; i++) { |
| 987 | + if (nPosition === _onPositionItems[i].position) { |
| 988 | + if (!oMethod || (oMethod === _onPositionItems[i].method)) { |
| 989 | + if (_onPositionItems[i].fired) { |
| 990 | + _onPositionFired--; |
| 991 | + } |
| 992 | + _onPositionItems.splice(i, 1); |
| 993 | + } |
| 994 | + } |
| 995 | + } |
| 996 | + }; |
| 997 | + this._processOnPosition = function() { |
| 998 | + var i, item, j = _onPositionItems.length; |
| 999 | + if (!j || !_t.playState || _onPositionFired >= j) { |
| 1000 | + return false; |
| 1001 | + } |
933 | 1002 | for (i=j; i--;) { |
934 | | - item = _t._onPositionItems[i]; |
| 1003 | + item = _onPositionItems[i]; |
935 | 1004 | if (!item.fired && _t.position >= item.position) { |
936 | 1005 | item.fired = true; |
937 | | - _s._onPositionFired++; |
938 | | - item.method.apply(item.scope,[item.position]); |
| 1006 | + _onPositionFired++; |
| 1007 | + item.method.apply(item.scope, [item.position]); |
939 | 1008 | } |
940 | 1009 | } |
941 | 1010 | return true; |
942 | 1011 | }; |
943 | | - this.resetOnPosition = function(nPosition) { |
944 | | - var i, item, j = _t._onPositionItems.length; |
| 1012 | + this._resetOnPosition = function(nPosition) { |
| 1013 | + var i, item, j = _onPositionItems.length; |
945 | 1014 | if (!j) { |
946 | 1015 | return false; |
947 | 1016 | } |
948 | 1017 | for (i=j; i--;) { |
949 | | - item = _t._onPositionItems[i]; |
| 1018 | + item = _onPositionItems[i]; |
950 | 1019 | if (item.fired && nPosition <= item.position) { |
951 | 1020 | item.fired = false; |
952 | | - _s._onPositionFired--; |
| 1021 | + _onPositionFired--; |
953 | 1022 | } |
954 | 1023 | } |
955 | 1024 | return true; |
956 | 1025 | }; |
| 1026 | + _applyFromTo = function() { |
| 1027 | + var _iO = _t._iO, |
| 1028 | + f = _iO.from, |
| 1029 | + t = _iO.to, |
| 1030 | + start, end; |
| 1031 | + end = function() { |
| 1032 | + _t.clearOnPosition(t, end); |
| 1033 | + _t.stop(); |
| 1034 | + }; |
| 1035 | + start = function() { |
| 1036 | + if (t !== null && !isNaN(t)) { |
| 1037 | + _t.onPosition(t, end); |
| 1038 | + } |
| 1039 | + }; |
| 1040 | + if (f !== null && !isNaN(f)) { |
| 1041 | + _iO.position = f; |
| 1042 | + _iO.multiShot = false; |
| 1043 | + start(); |
| 1044 | + } |
| 1045 | + return _iO; |
| 1046 | + }; |
| 1047 | + _attachOnPosition = function() { |
| 1048 | + var op = _t._iO.onposition; |
| 1049 | + if (op) { |
| 1050 | + var item; |
| 1051 | + for (item in op) { |
| 1052 | + if (op.hasOwnProperty(item)) { |
| 1053 | + _t.onPosition(parseInt(item, 10), op[item]); |
| 1054 | + } |
| 1055 | + } |
| 1056 | + } |
| 1057 | + }; |
| 1058 | + _detachOnPosition = function() { |
| 1059 | + var op = _t._iO.onposition; |
| 1060 | + if (op) { |
| 1061 | + var item; |
| 1062 | + for (item in op) { |
| 1063 | + if (op.hasOwnProperty(item)) { |
| 1064 | + _t.clearOnPosition(parseInt(item, 10)); |
| 1065 | + } |
| 1066 | + } |
| 1067 | + } |
| 1068 | + }; |
957 | 1069 | _start_html5_timer = function() { |
958 | 1070 | if (_t.isHTML5) { |
959 | 1071 | _startTimer(_t); |
— | — | @@ -964,26 +1076,28 @@ |
965 | 1077 | } |
966 | 1078 | }; |
967 | 1079 | _resetProperties = function() { |
968 | | - _t._onPositionItems = []; |
969 | | - _t._onPositionFired = 0; |
| 1080 | + _onPositionItems = []; |
| 1081 | + _onPositionFired = 0; |
| 1082 | + _onplay_called = false; |
970 | 1083 | _t._hasTimer = null; |
971 | | - _t._onplay_called = false; |
972 | 1084 | _t._a = null; |
973 | 1085 | _t._html5_canplay = false; |
974 | 1086 | _t.bytesLoaded = null; |
975 | 1087 | _t.bytesTotal = null; |
976 | | - _t.position = null; |
977 | | - _t.duration = (_t._iO && _t._iO.duration?_t._iO.duration:null); |
| 1088 | + _t.duration = (_t._iO && _t._iO.duration ? _t._iO.duration : null); |
978 | 1089 | _t.durationEstimate = null; |
| 1090 | + _t.eqData = []; |
| 1091 | + _t.eqData.left = []; |
| 1092 | + _t.eqData.right = []; |
979 | 1093 | _t.failures = 0; |
| 1094 | + _t.isBuffering = false; |
| 1095 | + _t.instanceOptions = {}; |
| 1096 | + _t.instanceCount = 0; |
980 | 1097 | _t.loaded = false; |
981 | | - _t.playState = 0; |
982 | | - _t.paused = false; |
| 1098 | + _t.metadata = {}; |
983 | 1099 | _t.readyState = 0; |
984 | 1100 | _t.muted = false; |
985 | | - _t.isBuffering = false; |
986 | | - _t.instanceOptions = {}; |
987 | | - _t.instanceCount = 0; |
| 1101 | + _t.paused = false; |
988 | 1102 | _t.peakData = { |
989 | 1103 | left: 0, |
990 | 1104 | right: 0 |
— | — | @@ -992,28 +1106,39 @@ |
993 | 1107 | left: [], |
994 | 1108 | right: [] |
995 | 1109 | }; |
996 | | - _t.eqData = []; |
997 | | - _t.eqData.left = []; |
998 | | - _t.eqData.right = []; |
| 1110 | + _t.playState = 0; |
| 1111 | + _t.position = null; |
999 | 1112 | }; |
1000 | 1113 | _resetProperties(); |
1001 | 1114 | this._onTimer = function(bForce) { |
1002 | | - var time, x = {}; |
| 1115 | + var duration, isNew = false, time, x = {}; |
1003 | 1116 | if (_t._hasTimer || bForce) { |
1004 | 1117 | if (_t._a && (bForce || ((_t.playState > 0 || _t.readyState === 1) && !_t.paused))) { |
1005 | | - _t.duration = _t._get_html5_duration(); |
| 1118 | + duration = _t._get_html5_duration(); |
| 1119 | + if (duration !== _lastHTML5State.duration) { |
| 1120 | + _lastHTML5State.duration = duration; |
| 1121 | + _t.duration = duration; |
| 1122 | + isNew = true; |
| 1123 | + } |
1006 | 1124 | _t.durationEstimate = _t.duration; |
1007 | | - time = _t._a.currentTime?_t._a.currentTime*1000:0; |
1008 | | - _t._whileplaying(time,x,x,x,x); |
1009 | | - return true; |
| 1125 | + time = (_t._a.currentTime * 1000 || 0); |
| 1126 | + if (time !== _lastHTML5State.time) { |
| 1127 | + _lastHTML5State.time = time; |
| 1128 | + isNew = true; |
| 1129 | + } |
| 1130 | + if (isNew || bForce) { |
| 1131 | + _t._whileplaying(time,x,x,x,x); |
| 1132 | + } |
| 1133 | + return isNew; |
1010 | 1134 | } else { |
1011 | 1135 | return false; |
1012 | 1136 | } |
1013 | 1137 | } |
1014 | 1138 | }; |
1015 | 1139 | this._get_html5_duration = function() { |
1016 | | - var d = (_t._a ? _t._a.duration*1000 : (_t._iO ? _t._iO.duration : undefined)), |
1017 | | - result = (d && !isNaN(d) && d !== Infinity ? d : (_t._iO ? _t._iO.duration : null)); |
| 1140 | + var _iO = _t._iO, |
| 1141 | + d = (_t._a ? _t._a.duration*1000 : (_iO ? _iO.duration : undefined)), |
| 1142 | + result = (d && !isNaN(d) && d !== Infinity ? d : (_iO ? _iO.duration : null)); |
1018 | 1143 | return result; |
1019 | 1144 | }; |
1020 | 1145 | this._setup_html5 = function(oOptions) { |
— | — | @@ -1022,8 +1147,12 @@ |
1023 | 1148 | _dURL = d(_iO.url), |
1024 | 1149 | _oldIO = (_a && _a._t ? _a._t.instanceOptions : null); |
1025 | 1150 | if (_a) { |
1026 | | - if (_a._t && _oldIO.url === _iO.url && (!_t._lastURL || (_t._lastURL === _oldIO.url))) { |
1027 | | - return _a; |
| 1151 | + if (_a._t) { |
| 1152 | + if (!_useGlobalHTML5Audio && _dURL === d(_lastURL)) { |
| 1153 | + return _a; |
| 1154 | + } else if (_useGlobalHTML5Audio && _oldIO.url === _iO.url && (!_lastURL || (_lastURL === _oldIO.url))) { |
| 1155 | + return _a; |
| 1156 | + } |
1028 | 1157 | } |
1029 | 1158 | if (_useGlobalHTML5Audio && _a._t && _a._t.playState && _iO.url !== _oldIO.url) { |
1030 | 1159 | _a._t.stop(); |
— | — | @@ -1031,7 +1160,7 @@ |
1032 | 1161 | _resetProperties(); |
1033 | 1162 | _a.src = _iO.url; |
1034 | 1163 | _t.url = _iO.url; |
1035 | | - _t._lastURL = _iO.url; |
| 1164 | + _lastURL = _iO.url; |
1036 | 1165 | _a._called_load = false; |
1037 | 1166 | } else { |
1038 | 1167 | _a = new Audio(_iO.url); |
— | — | @@ -1046,21 +1175,18 @@ |
1047 | 1176 | _t.isHTML5 = true; |
1048 | 1177 | _t._a = _a; |
1049 | 1178 | _a._t = _t; |
1050 | | - _t._add_html5_events(); |
| 1179 | + _add_html5_events(); |
1051 | 1180 | _a.loop = (_iO.loops>1?'loop':''); |
1052 | 1181 | if (_iO.autoLoad || _iO.autoPlay) { |
1053 | | - _a.autobuffer = 'auto'; |
1054 | | - _a.preload = 'auto'; |
1055 | 1182 | _t.load(); |
1056 | | - _a._called_load = true; |
1057 | 1183 | } else { |
1058 | 1184 | _a.autobuffer = false; |
1059 | 1185 | _a.preload = 'none'; |
1060 | 1186 | } |
1061 | | - _a.loop = (_iO.loops>1?'loop':''); |
| 1187 | + _a.loop = (_iO.loops > 1 ? 'loop' : ''); |
1062 | 1188 | return _a; |
1063 | 1189 | }; |
1064 | | - this._add_html5_events = function() { |
| 1190 | + _add_html5_events = function() { |
1065 | 1191 | if (_t._a._added_events) { |
1066 | 1192 | return false; |
1067 | 1193 | } |
— | — | @@ -1076,7 +1202,7 @@ |
1077 | 1203 | } |
1078 | 1204 | return true; |
1079 | 1205 | }; |
1080 | | - this._remove_html5_events = function() { |
| 1206 | + _remove_html5_events = function() { |
1081 | 1207 | var f; |
1082 | 1208 | function remove(oEvt, oFn, bCapture) { |
1083 | 1209 | return (_t._a ? _t._a.removeEventListener(oEvt, oFn, bCapture||false) : null); |
— | — | @@ -1089,7 +1215,7 @@ |
1090 | 1216 | } |
1091 | 1217 | }; |
1092 | 1218 | this._onload = function(nSuccess) { |
1093 | | - var fN = 'SMSound._onload(): ', loadOK = !!(nSuccess); |
| 1219 | + var fN, loadOK = !!(nSuccess); |
1094 | 1220 | _t.loaded = loadOK; |
1095 | 1221 | _t.readyState = loadOK?3:2; |
1096 | 1222 | _t._onbufferchange(0); |
— | — | @@ -1099,7 +1225,6 @@ |
1100 | 1226 | return true; |
1101 | 1227 | }; |
1102 | 1228 | this._onbufferchange = function(nIsBuffering) { |
1103 | | - var fN = 'SMSound._onbufferchange()'; |
1104 | 1229 | if (_t.playState === 0) { |
1105 | 1230 | return false; |
1106 | 1231 | } |
— | — | @@ -1112,7 +1237,7 @@ |
1113 | 1238 | } |
1114 | 1239 | return true; |
1115 | 1240 | }; |
1116 | | - this._onsuspend = function () { |
| 1241 | + this._onsuspend = function() { |
1117 | 1242 | if (_t._iO.onsuspend) { |
1118 | 1243 | _t._iO.onsuspend.apply(_t); |
1119 | 1244 | } |
— | — | @@ -1128,10 +1253,11 @@ |
1129 | 1254 | this._onfinish = function() { |
1130 | 1255 | var _io_onfinish = _t._iO.onfinish; |
1131 | 1256 | _t._onbufferchange(0); |
1132 | | - _t.resetOnPosition(0); |
| 1257 | + _t._resetOnPosition(0); |
1133 | 1258 | if (_t.instanceCount) { |
1134 | 1259 | _t.instanceCount--; |
1135 | 1260 | if (!_t.instanceCount) { |
| 1261 | + _detachOnPosition(); |
1136 | 1262 | _t.playState = 0; |
1137 | 1263 | _t.paused = false; |
1138 | 1264 | _t.instanceCount = 0; |
— | — | @@ -1147,49 +1273,51 @@ |
1148 | 1274 | } |
1149 | 1275 | }; |
1150 | 1276 | this._whileloading = function(nBytesLoaded, nBytesTotal, nDuration, nBufferLength) { |
| 1277 | + var _iO = _t._iO; |
1151 | 1278 | _t.bytesLoaded = nBytesLoaded; |
1152 | 1279 | _t.bytesTotal = nBytesTotal; |
1153 | 1280 | _t.duration = Math.floor(nDuration); |
1154 | 1281 | _t.bufferLength = nBufferLength; |
1155 | | - if (!_t._iO.isMovieStar) { |
1156 | | - if (_t._iO.duration) { |
1157 | | - _t.durationEstimate = (_t.duration > _t._iO.duration) ? _t.duration : _t._iO.duration; |
| 1282 | + if (!_iO.isMovieStar) { |
| 1283 | + if (_iO.duration) { |
| 1284 | + _t.durationEstimate = (_t.duration > _iO.duration) ? _t.duration : _iO.duration; |
1158 | 1285 | } else { |
1159 | 1286 | _t.durationEstimate = parseInt((_t.bytesTotal / _t.bytesLoaded) * _t.duration, 10); |
1160 | 1287 | } |
1161 | 1288 | if (_t.durationEstimate === undefined) { |
1162 | 1289 | _t.durationEstimate = _t.duration; |
1163 | 1290 | } |
1164 | | - if (_t.readyState !== 3 && _t._iO.whileloading) { |
1165 | | - _t._iO.whileloading.apply(_t); |
| 1291 | + if (_t.readyState !== 3 && _iO.whileloading) { |
| 1292 | + _iO.whileloading.apply(_t); |
1166 | 1293 | } |
1167 | 1294 | } else { |
1168 | 1295 | _t.durationEstimate = _t.duration; |
1169 | | - if (_t.readyState !== 3 && _t._iO.whileloading) { |
1170 | | - _t._iO.whileloading.apply(_t); |
| 1296 | + if (_t.readyState !== 3 && _iO.whileloading) { |
| 1297 | + _iO.whileloading.apply(_t); |
1171 | 1298 | } |
1172 | 1299 | } |
1173 | 1300 | }; |
1174 | 1301 | this._whileplaying = function(nPosition, oPeakData, oWaveformDataLeft, oWaveformDataRight, oEQData) { |
| 1302 | + var _iO = _t._iO; |
1175 | 1303 | if (isNaN(nPosition) || nPosition === null) { |
1176 | 1304 | return false; |
1177 | 1305 | } |
1178 | 1306 | _t.position = nPosition; |
1179 | | - _t.processOnPosition(); |
| 1307 | + _t._processOnPosition(); |
1180 | 1308 | if (!_t.isHTML5 && _fV > 8) { |
1181 | | - if (_t._iO.usePeakData && typeof oPeakData !== 'undefined' && oPeakData) { |
| 1309 | + if (_iO.usePeakData && typeof oPeakData !== 'undefined' && oPeakData) { |
1182 | 1310 | _t.peakData = { |
1183 | 1311 | left: oPeakData.leftPeak, |
1184 | 1312 | right: oPeakData.rightPeak |
1185 | 1313 | }; |
1186 | 1314 | } |
1187 | | - if (_t._iO.useWaveformData && typeof oWaveformDataLeft !== 'undefined' && oWaveformDataLeft) { |
| 1315 | + if (_iO.useWaveformData && typeof oWaveformDataLeft !== 'undefined' && oWaveformDataLeft) { |
1188 | 1316 | _t.waveformData = { |
1189 | 1317 | left: oWaveformDataLeft.split(','), |
1190 | 1318 | right: oWaveformDataRight.split(',') |
1191 | 1319 | }; |
1192 | 1320 | } |
1193 | | - if (_t._iO.useEQData) { |
| 1321 | + if (_iO.useEQData) { |
1194 | 1322 | if (typeof oEQData !== 'undefined' && oEQData && oEQData.leftEQ) { |
1195 | 1323 | var eqLeft = oEQData.leftEQ.split(','); |
1196 | 1324 | _t.eqData = eqLeft; |
— | — | @@ -1204,16 +1332,26 @@ |
1205 | 1333 | if (!_t.isHTML5 && _fV === 8 && !_t.position && _t.isBuffering) { |
1206 | 1334 | _t._onbufferchange(0); |
1207 | 1335 | } |
1208 | | - if (_t._iO.whileplaying) { |
1209 | | - _t._iO.whileplaying.apply(_t); |
| 1336 | + if (_iO.whileplaying) { |
| 1337 | + _iO.whileplaying.apply(_t); |
1210 | 1338 | } |
1211 | 1339 | } |
1212 | 1340 | return true; |
1213 | 1341 | }; |
1214 | | - this._onid3 = function(oID3PropNames, oID3Data) { |
| 1342 | + this._onmetadata = function(oMDProps, oMDData) { |
| 1343 | + var oData = {}, i, j; |
| 1344 | + for (i = 0, j = oMDProps.length; i < j; i++) { |
| 1345 | + oData[oMDProps[i]] = oMDData[i]; |
| 1346 | + } |
| 1347 | + _t.metadata = oData; |
| 1348 | + if (_t._iO.onmetadata) { |
| 1349 | + _t._iO.onmetadata.apply(_t); |
| 1350 | + } |
| 1351 | + }; |
| 1352 | + this._onid3 = function(oID3Props, oID3Data) { |
1215 | 1353 | var oData = [], i, j; |
1216 | | - for (i = 0, j = oID3PropNames.length; i < j; i++) { |
1217 | | - oData[oID3PropNames[i]] = oID3Data[i]; |
| 1354 | + for (i = 0, j = oID3Props.length; i < j; i++) { |
| 1355 | + oData[oID3Props[i]] = oID3Data[i]; |
1218 | 1356 | } |
1219 | 1357 | _t.id3 = _mixin(_t.id3, oData); |
1220 | 1358 | if (_t._iO.onid3) { |
— | — | @@ -1221,7 +1359,6 @@ |
1222 | 1360 | } |
1223 | 1361 | }; |
1224 | 1362 | this._onconnect = function(bSuccess) { |
1225 | | - var fN = 'SMSound._onconnect(): '; |
1226 | 1363 | bSuccess = (bSuccess === 1); |
1227 | 1364 | _t.connected = bSuccess; |
1228 | 1365 | if (bSuccess) { |
— | — | @@ -1234,7 +1371,7 @@ |
1235 | 1372 | } |
1236 | 1373 | } |
1237 | 1374 | if (_t._iO.onconnect) { |
1238 | | - _t._iO.onconnect.apply(_t,[bSuccess]); |
| 1375 | + _t._iO.onconnect.apply(_t, [bSuccess]); |
1239 | 1376 | } |
1240 | 1377 | } |
1241 | 1378 | }; |
— | — | @@ -1307,7 +1444,8 @@ |
1308 | 1445 | }()); |
1309 | 1446 | function _html5_event(oFn) { |
1310 | 1447 | return function(e) { |
1311 | | - if (!this._t || !this._t._a) { |
| 1448 | + var t = this._t; |
| 1449 | + if (!t || !t._a) { |
1312 | 1450 | return null; |
1313 | 1451 | } else { |
1314 | 1452 | return oFn.call(this, e); |
— | — | @@ -1318,30 +1456,36 @@ |
1319 | 1457 | abort: _html5_event(function(e) { |
1320 | 1458 | }), |
1321 | 1459 | canplay: _html5_event(function(e) { |
1322 | | - if (this._t._html5_canplay) { |
| 1460 | + var t = this._t; |
| 1461 | + if (t._html5_canplay) { |
1323 | 1462 | return true; |
1324 | 1463 | } |
1325 | | - this._t._html5_canplay = true; |
1326 | | - this._t._onbufferchange(0); |
1327 | | - var position1K = (!isNaN(this._t.position)?this._t.position/1000:null); |
1328 | | - if (this._t.position && this.currentTime !== position1K) { |
| 1464 | + t._html5_canplay = true; |
| 1465 | + t._onbufferchange(0); |
| 1466 | + var position1K = (!isNaN(t.position)?t.position/1000:null); |
| 1467 | + if (t.position && this.currentTime !== position1K) { |
1329 | 1468 | try { |
1330 | 1469 | this.currentTime = position1K; |
1331 | 1470 | } catch(ee) { |
1332 | 1471 | } |
1333 | 1472 | } |
| 1473 | + if (t._iO._oncanplay) { |
| 1474 | + t._iO._oncanplay(); |
| 1475 | + } |
1334 | 1476 | }), |
1335 | 1477 | load: _html5_event(function(e) { |
1336 | | - if (!this._t.loaded) { |
1337 | | - this._t._onbufferchange(0); |
1338 | | - this._t._whileloading(this._t.bytesTotal, this._t.bytesTotal, this._t._get_html5_duration()); |
1339 | | - this._t._onload(true); |
| 1478 | + var t = this._t; |
| 1479 | + if (!t.loaded) { |
| 1480 | + t._onbufferchange(0); |
| 1481 | + t._whileloading(t.bytesTotal, t.bytesTotal, t._get_html5_duration()); |
| 1482 | + t._onload(true); |
1340 | 1483 | } |
1341 | 1484 | }), |
1342 | 1485 | emptied: _html5_event(function(e) { |
1343 | 1486 | }), |
1344 | 1487 | ended: _html5_event(function(e) { |
1345 | | - this._t._onfinish(); |
| 1488 | + var t = this._t; |
| 1489 | + t._onfinish(); |
1346 | 1490 | }), |
1347 | 1491 | error: _html5_event(function(e) { |
1348 | 1492 | this._t._onload(false); |
— | — | @@ -1367,7 +1511,8 @@ |
1368 | 1512 | this._t._onbufferchange(0); |
1369 | 1513 | }), |
1370 | 1514 | progress: _html5_event(function(e) { |
1371 | | - if (this._t.loaded) { |
| 1515 | + var t = this._t; |
| 1516 | + if (t.loaded) { |
1372 | 1517 | return false; |
1373 | 1518 | } |
1374 | 1519 | var i, j, str, buffered = 0, |
— | — | @@ -1382,8 +1527,8 @@ |
1383 | 1528 | loaded = buffered/e.target.duration; |
1384 | 1529 | } |
1385 | 1530 | if (!isNaN(loaded)) { |
1386 | | - this._t._onbufferchange(0); |
1387 | | - this._t._whileloading(loaded, total, this._t._get_html5_duration()); |
| 1531 | + t._onbufferchange(0); |
| 1532 | + t._whileloading(loaded, total, t._get_html5_duration()); |
1388 | 1533 | if (loaded && total && loaded === total) { |
1389 | 1534 | _html5_events.load.call(this, e); |
1390 | 1535 | } |
— | — | @@ -1392,8 +1537,9 @@ |
1393 | 1538 | ratechange: _html5_event(function(e) { |
1394 | 1539 | }), |
1395 | 1540 | suspend: _html5_event(function(e) { |
| 1541 | + var t = this._t; |
1396 | 1542 | _html5_events.progress.call(this, e); |
1397 | | - this._t._onsuspend(); |
| 1543 | + t._onsuspend(); |
1398 | 1544 | }), |
1399 | 1545 | stalled: _html5_event(function(e) { |
1400 | 1546 | }), |
— | — | @@ -1401,7 +1547,8 @@ |
1402 | 1548 | this._t._onTimer(); |
1403 | 1549 | }), |
1404 | 1550 | waiting: _html5_event(function(e) { |
1405 | | - this._t._onbufferchange(1); |
| 1551 | + var t = this._t; |
| 1552 | + t._onbufferchange(1); |
1406 | 1553 | }) |
1407 | 1554 | }; |
1408 | 1555 | _html5OK = function(iO) { |
— | — | @@ -1589,10 +1736,10 @@ |
1590 | 1737 | _s.features.peakData = _s.features.waveformData = _s.features.eqData = (_fV > 8); |
1591 | 1738 | }; |
1592 | 1739 | _setPolling = function(bPolling, bHighPerformance) { |
1593 | | - if (!_s.o) { |
| 1740 | + if (!_flash) { |
1594 | 1741 | return false; |
1595 | 1742 | } |
1596 | | - _s.o._setPolling(bPolling, bHighPerformance); |
| 1743 | + _flash._setPolling(bPolling, bHighPerformance); |
1597 | 1744 | }; |
1598 | 1745 | _initDebug = function() { |
1599 | 1746 | if (_s.debugURLParam.test(_wl)) { |
— | — | @@ -1603,20 +1750,20 @@ |
1604 | 1751 | _getSWFCSS = function() { |
1605 | 1752 | var css = []; |
1606 | 1753 | if (_s.debugMode) { |
1607 | | - css.push(_s.swfCSS.sm2Debug); |
| 1754 | + css.push(_swfCSS.sm2Debug); |
1608 | 1755 | } |
1609 | 1756 | if (_s.debugFlash) { |
1610 | | - css.push(_s.swfCSS.flashDebug); |
| 1757 | + css.push(_swfCSS.flashDebug); |
1611 | 1758 | } |
1612 | 1759 | if (_s.useHighPerformance) { |
1613 | | - css.push(_s.swfCSS.highPerf); |
| 1760 | + css.push(_swfCSS.highPerf); |
1614 | 1761 | } |
1615 | 1762 | return css.join(' '); |
1616 | 1763 | }; |
1617 | 1764 | _flashBlockHandler = function() { |
1618 | 1765 | var name = _str('fbHandler'), |
1619 | 1766 | p = _s.getMoviePercent(), |
1620 | | - css = _s.swfCSS, |
| 1767 | + css = _swfCSS, |
1621 | 1768 | error = {type:'FLASHBLOCK'}; |
1622 | 1769 | if (_s.html5Only) { |
1623 | 1770 | return false; |
— | — | @@ -1629,8 +1776,6 @@ |
1630 | 1777 | _processOnEvents({type:'ontimeout', ignoreInit:true, error:error}); |
1631 | 1778 | _catchError(error); |
1632 | 1779 | } else { |
1633 | | - if (_s.didFlashBlock) { |
1634 | | - } |
1635 | 1780 | if (_s.oMC) { |
1636 | 1781 | _s.oMC.className = [_getSWFCSS(), css.swfDefault, css.swfLoaded + (_s.didFlashBlock?' '+css.swfUnblocked:'')].join(' '); |
1637 | 1782 | } |
— | — | @@ -1761,16 +1906,60 @@ |
1762 | 1907 | _s.html5Only = (_s.hasHTML5 && _s.useHTML5Audio && !needsFlash); |
1763 | 1908 | return (!_s.html5Only); |
1764 | 1909 | }; |
| 1910 | + _parseURL = function(url) { |
| 1911 | + var i, j, result = 0; |
| 1912 | + if (url instanceof Array) { |
| 1913 | + for (i=0, j=url.length; i<j; i++) { |
| 1914 | + if (url[i] instanceof Object) { |
| 1915 | + if (_s.canPlayMIME(url[i].type)) { |
| 1916 | + result = i; |
| 1917 | + break; |
| 1918 | + } |
| 1919 | + } else if (_s.canPlayURL(url[i])) { |
| 1920 | + result = i; |
| 1921 | + break; |
| 1922 | + } |
| 1923 | + } |
| 1924 | + if (url[result].url) { |
| 1925 | + url[result] = url[result].url; |
| 1926 | + } |
| 1927 | + return url[result]; |
| 1928 | + } else { |
| 1929 | + return url; |
| 1930 | + } |
| 1931 | + }; |
1765 | 1932 | _startTimer = function(oSound) { |
1766 | 1933 | if (!oSound._hasTimer) { |
1767 | 1934 | oSound._hasTimer = true; |
| 1935 | + if (!_likesHTML5 && _s.html5PollingInterval) { |
| 1936 | + if (_h5IntervalTimer === null && _h5TimerCount === 0) { |
| 1937 | + _h5IntervalTimer = window.setInterval(_timerExecute, _s.html5PollingInterval); |
| 1938 | + } |
| 1939 | + _h5TimerCount++; |
| 1940 | + } |
1768 | 1941 | } |
1769 | 1942 | }; |
1770 | 1943 | _stopTimer = function(oSound) { |
1771 | 1944 | if (oSound._hasTimer) { |
1772 | 1945 | oSound._hasTimer = false; |
| 1946 | + if (!_likesHTML5 && _s.html5PollingInterval) { |
| 1947 | + _h5TimerCount--; |
| 1948 | + } |
1773 | 1949 | } |
1774 | 1950 | }; |
| 1951 | + _timerExecute = function() { |
| 1952 | + var i, j; |
| 1953 | + if (_h5IntervalTimer !== null && !_h5TimerCount) { |
| 1954 | + window.clearInterval(_h5IntervalTimer); |
| 1955 | + _h5IntervalTimer = null; |
| 1956 | + return false; |
| 1957 | + } |
| 1958 | + for (i = _s.soundIDs.length; i--;) { |
| 1959 | + if (_s.sounds[_s.soundIDs[i]].isHTML5 && _s.sounds[_s.soundIDs[i]]._hasTimer) { |
| 1960 | + _s.sounds[_s.soundIDs[i]]._onTimer(); |
| 1961 | + } |
| 1962 | + } |
| 1963 | + }; |
1775 | 1964 | _catchError = function(options) { |
1776 | 1965 | options = (typeof options !== 'undefined' ? options : {}); |
1777 | 1966 | if (_s.onerror instanceof Function) { |
— | — | @@ -1800,11 +1989,11 @@ |
1801 | 1990 | }; |
1802 | 1991 | this._setSandboxType = function(sandboxType) { |
1803 | 1992 | }; |
1804 | | - this._externalInterfaceOK = function(flashDate) { |
| 1993 | + this._externalInterfaceOK = function(flashDate, swfVersion) { |
1805 | 1994 | if (_s.swfLoaded) { |
1806 | 1995 | return false; |
1807 | 1996 | } |
1808 | | - var eiTime = new Date().getTime(); |
| 1997 | + var e, eiTime = new Date().getTime(); |
1809 | 1998 | _s.swfLoaded = true; |
1810 | 1999 | _tryInitOnFocus = false; |
1811 | 2000 | if (_isBadSafari) { |
— | — | @@ -1847,7 +2036,6 @@ |
1848 | 2037 | smURL = _s.url; |
1849 | 2038 | _s.wmode = (!_s.wmode && _s.useHighPerformance ? 'transparent' : _s.wmode); |
1850 | 2039 | if (_s.wmode !== null && (_ua.match(/msie 8/i) || (!_isIE && !_s.useHighPerformance)) && navigator.platform.match(/win32|win64/i)) { |
1851 | | - _s.specialWmodeCase = true; |
1852 | 2040 | _s.wmode = null; |
1853 | 2041 | } |
1854 | 2042 | oEmbed = { |
— | — | @@ -1899,7 +2087,7 @@ |
1900 | 2088 | _s.oMC = (_id(_s.movieID) || _doc.createElement('div')); |
1901 | 2089 | if (!_s.oMC.id) { |
1902 | 2090 | _s.oMC.id = _s.movieID; |
1903 | | - _s.oMC.className = _s.swfCSS.swfDefault + ' ' + extraClass; |
| 2091 | + _s.oMC.className = _swfCSS.swfDefault + ' ' + extraClass; |
1904 | 2092 | s = null; |
1905 | 2093 | oEl = null; |
1906 | 2094 | if (!_s.useFlashBlock) { |
— | — | @@ -1942,7 +2130,7 @@ |
1943 | 2131 | oTarget.appendChild(_s.oMC); |
1944 | 2132 | if (_isIE) { |
1945 | 2133 | oEl = _s.oMC.appendChild(_doc.createElement('div')); |
1946 | | - oEl.className = _s.swfCSS.swfBox; |
| 2134 | + oEl.className = _swfCSS.swfBox; |
1947 | 2135 | oEl.innerHTML = movieHTML; |
1948 | 2136 | } |
1949 | 2137 | _appendSuccess = true; |
— | — | @@ -1951,11 +2139,11 @@ |
1952 | 2140 | } |
1953 | 2141 | } else { |
1954 | 2142 | sClass = _s.oMC.className; |
1955 | | - _s.oMC.className = (sClass?sClass+' ':_s.swfCSS.swfDefault) + (extraClass?' '+extraClass:''); |
| 2143 | + _s.oMC.className = (sClass?sClass+' ':_swfCSS.swfDefault) + (extraClass?' '+extraClass:''); |
1956 | 2144 | _s.oMC.appendChild(oMovie); |
1957 | 2145 | if (_isIE) { |
1958 | 2146 | oEl = _s.oMC.appendChild(_doc.createElement('div')); |
1959 | | - oEl.className = _s.swfCSS.swfBox; |
| 2147 | + oEl.className = _swfCSS.swfBox; |
1960 | 2148 | oEl.innerHTML = movieHTML; |
1961 | 2149 | } |
1962 | 2150 | _appendSuccess = true; |
— | — | @@ -1970,11 +2158,11 @@ |
1971 | 2159 | _createMovie(); |
1972 | 2160 | return false; |
1973 | 2161 | } |
1974 | | - if (_s.o) { |
| 2162 | + if (_flash) { |
1975 | 2163 | return false; |
1976 | 2164 | } |
1977 | | - _s.o = _s.getMovie(_s.id); |
1978 | | - if (!_s.o) { |
| 2165 | + _flash = _s.getMovie(_s.id); |
| 2166 | + if (!_flash) { |
1979 | 2167 | if (!_oRemoved) { |
1980 | 2168 | _createMovie(_s.id, _s.url); |
1981 | 2169 | } else { |
— | — | @@ -1986,7 +2174,7 @@ |
1987 | 2175 | _oRemoved = null; |
1988 | 2176 | _didAppend = true; |
1989 | 2177 | } |
1990 | | - _s.o = _s.getMovie(_s.id); |
| 2178 | + _flash = _s.getMovie(_s.id); |
1991 | 2179 | } |
1992 | 2180 | if (_s.oninitmovie instanceof Function) { |
1993 | 2181 | setTimeout(_s.oninitmovie, 1); |
— | — | @@ -2076,7 +2264,7 @@ |
2077 | 2265 | } |
2078 | 2266 | if (_disabled || bNoDisable) { |
2079 | 2267 | if (_s.useFlashBlock && _s.oMC) { |
2080 | | - _s.oMC.className = _getSWFCSS() + ' ' + (_s.getMoviePercent() === null?_s.swfCSS.swfTimedout:_s.swfCSS.swfError); |
| 2268 | + _s.oMC.className = _getSWFCSS() + ' ' + (_s.getMoviePercent() === null?_swfCSS.swfTimedout:_swfCSS.swfError); |
2081 | 2269 | } |
2082 | 2270 | _processOnEvents({type:'ontimeout', error:error}); |
2083 | 2271 | _catchError(error); |
— | — | @@ -2108,10 +2296,10 @@ |
2109 | 2297 | } |
2110 | 2298 | _initMovie(); |
2111 | 2299 | try { |
2112 | | - _s.o._externalInterfaceTest(false); |
| 2300 | + _flash._externalInterfaceTest(false); |
2113 | 2301 | _setPolling(true, (_s.flashPollingInterval || (_s.useHighPerformance ? 10 : 50))); |
2114 | 2302 | if (!_s.debugMode) { |
2115 | | - _s.o._disableDebug(); |
| 2303 | + _flash._disableDebug(); |
2116 | 2304 | } |
2117 | 2305 | _s.enabled = true; |
2118 | 2306 | if (!_s.html5Only) { |
— | — | @@ -2157,10 +2345,15 @@ |
2158 | 2346 | } |
2159 | 2347 | return true; |
2160 | 2348 | }; |
| 2349 | + _winOnLoad = function() { |
| 2350 | + _windowLoaded = true; |
| 2351 | + _event.remove(_win, 'load', _winOnLoad); |
| 2352 | + }; |
2161 | 2353 | _detectFlash(); |
2162 | 2354 | _event.add(_win, 'focus', _handleFocus); |
2163 | 2355 | _event.add(_win, 'load', _handleFocus); |
2164 | 2356 | _event.add(_win, 'load', _delayWaitForEI); |
| 2357 | + _event.add(_win, 'load', _winOnLoad); |
2165 | 2358 | if (_isSafari && _tryInitOnFocus) { |
2166 | 2359 | _event.add(_win, 'mousemove', _handleFocus); |
2167 | 2360 | } |
Index: trunk/extensions/SoundManager2Button/script/mp3-player-button.js |
— | — | @@ -135,7 +135,7 @@ |
136 | 136 | this.stopEvent = function(e) { |
137 | 137 | if (typeof e !== 'undefined' && typeof e.preventDefault !== 'undefined') { |
138 | 138 | e.preventDefault(); |
139 | | - } else if (typeof window.event !== 'undefined' && typeof window.event.returnValue !== 'undefined') { |
| 139 | + } else if (typeof window.event !== 'undefined') { |
140 | 140 | window.event.returnValue = false; |
141 | 141 | } |
142 | 142 | return false; |
— | — | @@ -212,8 +212,7 @@ |
213 | 213 | thisSound.play(); |
214 | 214 | } |
215 | 215 | self.lastSound = thisSound; // reference for next call |
216 | | - self.stopEvent(e); |
217 | | - return false; |
| 216 | + return self.stopEvent(e); |
218 | 217 | }; |
219 | 218 | |
220 | 219 | this.stopSound = function(oSound) { |
Index: trunk/extensions/SoundManager2Button/script/soundmanager2-jsmin.js |
— | — | @@ -9,95 +9,96 @@ |
10 | 10 | Code provided under the BSD License: |
11 | 11 | http://schillmania.com/projects/soundmanager2/license.txt |
12 | 12 | |
13 | | - V2.97a.20111030 |
| 13 | + V2.97a.20111220 |
14 | 14 | */ |
15 | | -(function(S){function T(T,fa){function k(b){return function(a){return!this._t||!this._t._a?(this._t&&this._t.sID?c._wD(h+"ignoring "+a.type+": "+this._t.sID):c._wD(h+"ignoring "+a.type),null):b.call(this,a)}}this.flashVersion=8;this.debugMode=true;this.debugFlash=false;this.useConsole=true;this.waitForWindowLoad=this.consoleOnly=false;this.bgColor="#ffffff";this.useHighPerformance=false;this.flashPollingInterval=null;this.flashLoadTimeout=1E3;this.wmode=null;this.allowScriptAccess="always";this.useFlashBlock= |
16 | | -false;this.useHTML5Audio=true;this.html5Test=/^(probably|maybe)$/i;this.preferFlash=true;this.noSWFCache=false;this.audioFormats={mp3:{type:['audio/mpeg; codecs="mp3"',"audio/mpeg","audio/mp3","audio/MPA","audio/mpa-robust"],required:true},mp4:{related:["aac","m4a"],type:['audio/mp4; codecs="mp4a.40.2"',"audio/aac","audio/x-m4a","audio/MP4A-LATM","audio/mpeg4-generic"],required:false},ogg:{type:["audio/ogg; codecs=vorbis"],required:false},wav:{type:['audio/wav; codecs="1"',"audio/wav","audio/wave", |
17 | | -"audio/x-wav"],required:false}};this.defaultOptions={autoLoad:false,stream:true,autoPlay:false,loops:1,onid3:null,onload:null,whileloading:null,onplay:null,onpause:null,onresume:null,whileplaying:null,onstop:null,onfailure:null,onfinish:null,multiShot:true,multiShotEvents:false,position:null,pan:0,type:null,usePolicyFile:false,volume:100};this.flash9Options={isMovieStar:null,usePeakData:false,useWaveformData:false,useEQData:false,onbufferchange:null,ondataerror:null};this.movieStarOptions={bufferTime:3, |
18 | | -serverURL:null,onconnect:null,duration:null};this.movieID="sm2-container";this.id=fa||"sm2movie";this.swfCSS={swfBox:"sm2-object-box",swfDefault:"movieContainer",swfError:"swf_error",swfTimedout:"swf_timedout",swfLoaded:"swf_loaded",swfUnblocked:"swf_unblocked",sm2Debug:"sm2_debug",highPerf:"high_performance",flashDebug:"flash_debug"};this.debugID="soundmanager-debug";this.debugURLParam=/([#?&])debug=1/i;this.versionNumber="V2.97a.20111030";this.movieURL=this.version=null;this.url=T||null;this.altURL= |
19 | | -null;this.enabled=this.swfLoaded=false;this.oMC=this.o=null;this.sounds={};this.soundIDs=[];this.didFlashBlock=this.specialWmodeCase=this.muted=false;this.filePattern=null;this.filePatterns={flash8:/\.mp3(\?.*)?$/i,flash9:/\.mp3(\?.*)?$/i};this.features={buffering:false,peakData:false,waveformData:false,eqData:false,movieStar:false};this.sandbox={type:null,types:{remote:"remote (domain-based) rules",localWithFile:"local with file access (no internet access)",localWithNetwork:"local with network (internet access only, no local access)", |
20 | | -localTrusted:"local, trusted (local+internet access)"},description:null,noRemote:null,noLocal:null};var J;try{J=typeof Audio!=="undefined"&&typeof(new Audio).canPlayType!=="undefined"}catch(Xa){J=false}this.hasHTML5=J;this.html5={usingFlash:null};this.flash={};this.ignoreFlash=this.html5Only=false;var ya,c=this,h="HTML5::",u,q=navigator.userAgent,i=S,K=i.location.href.toString(),g=document,ga,U,j,y=[],ha=true,r,L=false,M=false,m=false,v=false,ia=false,l,Qa=0,N,s,ja,C,D,V,za,ka,B,W,X,E,la,Y,Z,F,Aa, |
21 | | -ma,Ra=["log","info","warn","error"],Ba,$,Ca,O=null,na=null,n,oa,G,Da,aa,ba,pa,o,ca=false,qa=false,Ea,Fa,w=null,Ga,da,P,z,ra,sa,Ha,p,Ia=Array.prototype.slice,Q=false,t,ea,Ja,x,Ka,ta=q.match(/(ipad|iphone|ipod)/i),Sa=q.match(/firefox/i),Ta=q.match(/droid/i),A=q.match(/msie/i),Ua=q.match(/webkit/i),R=q.match(/safari/i)&&!q.match(/chrome/i),Va=q.match(/opera/i);J=q.match(/(mobile|pre\/|xoom)/i)||ta;var ua=!K.match(/usehtml5audio/i)&&!K.match(/sm2\-ignorebadua/i)&&R&&q.match(/OS X 10_6_([3-7])/i),va=typeof console!== |
22 | | -"undefined"&&typeof console.log!=="undefined",wa=typeof g.hasFocus!=="undefined"?g.hasFocus():null,H=R&&typeof g.hasFocus==="undefined",La=!H,Ma=/(mp3|mp4|mpa)/i,I=g.location?g.location.protocol.match(/http/i):null,Na=!I?"http://":"",Oa=/^\s*audio\/(?:x-)?(?:mpeg4|aac|flv|mov|mp4||m4v|m4a|mp4v|3gp|3g2)\s*(?:$|;)/i,Pa="mpeg4,aac,flv,mov,mp4,m4v,f4v,m4a,mp4v,3gp,3g2".split(","),Wa=RegExp("\\.("+Pa.join("|")+")(\\?.*)?$","i");this.mimePattern=/^\s*audio\/(?:x-)?(?:mp(?:eg|3))\s*(?:$|;)/i;this.useAltURL= |
23 | | -!I;this._global_a=null;if(J&&(c.useHTML5Audio=true,c.preferFlash=false,ta))Q=c.ignoreFlash=true;this.supported=this.ok=function(){return w?m&&!v:c.useHTML5Audio&&c.hasHTML5};this.getMovie=function(c){return u(c)||g[c]||i[c]};this.createSound=function(b){function a(){e=aa(e);c.sounds[d.id]=new ya(d);c.soundIDs.push(d.id);return c.sounds[d.id]}var e=null,f=null,d=null;if(!m||!c.ok())return pa("soundManager.createSound(): "+n(!m?"notReady":"notOK")),false;arguments.length===2&&(b={id:arguments[0],url:arguments[1]}); |
24 | | -d=e=s(b);d.id.toString().charAt(0).match(/^[0-9]$/)&&c._wD("soundManager.createSound(): "+n("badID",d.id),2);c._wD("soundManager.createSound(): "+d.id+" ("+d.url+")",1);if(o(d.id,true))return c._wD("soundManager.createSound(): "+d.id+" exists",1),c.sounds[d.id];if(da(d))f=a(),c._wD("Loading sound "+d.id+" via HTML5"),f._setup_html5(d);else{if(j>8){if(d.isMovieStar===null)d.isMovieStar=d.serverURL||(d.type?d.type.match(Oa):false)||d.url.match(Wa);d.isMovieStar&&c._wD("soundManager.createSound(): using MovieStar handling"); |
25 | | -if(d.isMovieStar){if(d.usePeakData)l("noPeak"),d.usePeakData=false;d.loops>1&&l("noNSLoop")}}d=ba(d,"soundManager.createSound(): ");f=a();if(j===8)c.o._createSound(d.id,d.loops||1,d.usePolicyFile);else if(c.o._createSound(d.id,d.url,d.usePeakData,d.useWaveformData,d.useEQData,d.isMovieStar,d.isMovieStar?d.bufferTime:false,d.loops||1,d.serverURL,d.duration||null,d.autoPlay,true,d.autoLoad,d.usePolicyFile),!d.serverURL)f.connected=true,d.onconnect&&d.onconnect.apply(f);!d.serverURL&&(d.autoLoad||d.autoPlay)&& |
26 | | -f.load(d)}!d.serverURL&&d.autoPlay&&f.play();return f};this.destroySound=function(b,a){if(!o(b))return false;var e=c.sounds[b],f;e._iO={};e.stop();e.unload();for(f=0;f<c.soundIDs.length;f++)if(c.soundIDs[f]===b){c.soundIDs.splice(f,1);break}a||e.destruct(true);delete c.sounds[b];return true};this.load=function(b,a){return!o(b)?false:c.sounds[b].load(a)};this.unload=function(b){return!o(b)?false:c.sounds[b].unload()};this.onposition=function(b,a,e,f){return!o(b)?false:c.sounds[b].onposition(a,e,f)}; |
27 | | -this.start=this.play=function(b,a){if(!m||!c.ok())return pa("soundManager.play(): "+n(!m?"notReady":"notOK")),false;return!o(b)?(a instanceof Object||(a={url:a}),a&&a.url?(c._wD('soundManager.play(): attempting to create "'+b+'"',1),a.id=b,c.createSound(a).play()):false):c.sounds[b].play(a)};this.setPosition=function(b,a){return!o(b)?false:c.sounds[b].setPosition(a)};this.stop=function(b){if(!o(b))return false;c._wD("soundManager.stop("+b+")",1);return c.sounds[b].stop()};this.stopAll=function(){var b; |
28 | | -c._wD("soundManager.stopAll()",1);for(b in c.sounds)c.sounds.hasOwnProperty(b)&&c.sounds[b].stop()};this.pause=function(b){return!o(b)?false:c.sounds[b].pause()};this.pauseAll=function(){var b;for(b=c.soundIDs.length;b--;)c.sounds[c.soundIDs[b]].pause()};this.resume=function(b){return!o(b)?false:c.sounds[b].resume()};this.resumeAll=function(){var b;for(b=c.soundIDs.length;b--;)c.sounds[c.soundIDs[b]].resume()};this.togglePause=function(b){return!o(b)?false:c.sounds[b].togglePause()};this.setPan=function(b, |
29 | | -a){return!o(b)?false:c.sounds[b].setPan(a)};this.setVolume=function(b,a){return!o(b)?false:c.sounds[b].setVolume(a)};this.mute=function(b){var a=0;typeof b!=="string"&&(b=null);if(b){if(!o(b))return false;c._wD('soundManager.mute(): Muting "'+b+'"');return c.sounds[b].mute()}else{c._wD("soundManager.mute(): Muting all sounds");for(a=c.soundIDs.length;a--;)c.sounds[c.soundIDs[a]].mute();c.muted=true}return true};this.muteAll=function(){c.mute()};this.unmute=function(b){typeof b!=="string"&&(b=null); |
30 | | -if(b){if(!o(b))return false;c._wD('soundManager.unmute(): Unmuting "'+b+'"');return c.sounds[b].unmute()}else{c._wD("soundManager.unmute(): Unmuting all sounds");for(b=c.soundIDs.length;b--;)c.sounds[c.soundIDs[b]].unmute();c.muted=false}return true};this.unmuteAll=function(){c.unmute()};this.toggleMute=function(b){return!o(b)?false:c.sounds[b].toggleMute()};this.getMemoryUse=function(){var b=0;c.o&&j!==8&&(b=parseInt(c.o._getMemoryUse(),10));return b};this.disable=function(b){var a;typeof b==="undefined"&& |
31 | | -(b=false);if(v)return false;v=true;l("shutdown",1);for(a=c.soundIDs.length;a--;)Ba(c.sounds[c.soundIDs[a]]);N(b);p.remove(i,"load",D);return true};this.canPlayMIME=function(b){var a;c.hasHTML5&&(a=P({type:b}));return!w||a?a:b?!!(j>8&&b.match(Oa)||b.match(c.mimePattern)):null};this.canPlayURL=function(b){var a;c.hasHTML5&&(a=P({url:b}));return!w||a?a:b?!!b.match(c.filePattern):null};this.canPlayLink=function(b){return typeof b.type!=="undefined"&&b.type&&c.canPlayMIME(b.type)?true:c.canPlayURL(b.href)}; |
32 | | -this.getSoundById=function(b,a){if(!b)throw Error("soundManager.getSoundById(): sID is null/undefined");var e=c.sounds[b];!e&&!a&&c._wD('"'+b+'" is an invalid sound ID.',2);return e};this.onready=function(b,a){if(b&&b instanceof Function)return m&&c._wD(n("queue","onready")),a||(a=i),ja("onready",b,a),C(),true;else throw n("needFunction","onready");};this.ontimeout=function(b,a){if(b&&b instanceof Function)return m&&c._wD(n("queue","ontimeout")),a||(a=i),ja("ontimeout",b,a),C({type:"ontimeout"}), |
33 | | -true;else throw n("needFunction","ontimeout");};this._wD=this._writeDebug=function(b,a,e){var f,d;if(!c.debugMode)return false;typeof e!=="undefined"&&e&&(b=b+" | "+(new Date).getTime());if(va&&c.useConsole){e=Ra[a];if(typeof console[e]!=="undefined")console[e](b);else console.log(b);if(c.useConsoleOnly)return true}try{f=u("soundmanager-debug");if(!f)return false;d=g.createElement("div");if(++Qa%2===0)d.className="sm2-alt";a=typeof a==="undefined"?0:parseInt(a,10);d.appendChild(g.createTextNode(b)); |
34 | | -if(a){if(a>=2)d.style.fontWeight="bold";if(a===3)d.style.color="#ff3333"}f.insertBefore(d,f.firstChild)}catch(Ya){}return true};this._debug=function(){var b,a;l("currentObj",1);for(b=0,a=c.soundIDs.length;b<a;b++)c.sounds[c.soundIDs[b]]._debug()};this.reboot=function(){c._wD("soundManager.reboot()");c.soundIDs.length&&c._wD("Destroying "+c.soundIDs.length+" SMSound objects...");var b,a;for(b=c.soundIDs.length;b--;)c.sounds[c.soundIDs[b]].destruct();try{if(A)na=c.o.innerHTML;O=c.o.parentNode.removeChild(c.o); |
35 | | -c._wD("Flash movie removed.")}catch(e){l("badRemove",2)}na=O=w=null;c.enabled=la=m=ca=qa=L=M=v=c.swfLoaded=false;c.soundIDs=c.sounds=[];c.o=null;for(b in y)if(y.hasOwnProperty(b))for(a=y[b].length;a--;)y[b][a].fired=false;c._wD("soundManager: Rebooting...");i.setTimeout(c.beginDelayedInit,20)};this.getMoviePercent=function(){return c.o&&typeof c.o.PercentLoaded!=="undefined"?c.o.PercentLoaded():null};this.beginDelayedInit=function(){ia=true;E();setTimeout(function(){if(qa)return false;Z();X();return qa= |
36 | | -true},20);V()};this.destruct=function(){c._wD("soundManager.destruct()");c.disable(true)};ya=function(b){var a=this,e,f,d;this.sID=b.id;this.url=b.url;this._iO=this.instanceOptions=this.options=s(b);this.pan=this.options.pan;this.volume=this.options.volume;this._lastURL=null;this.isHTML5=false;this._a=null;this.id3={};this._debug=function(){if(c.debugMode){var b=null,d=[],e,f;for(b in a.options)a.options[b]!==null&&(a.options[b]instanceof Function?(e=a.options[b].toString(),e=e.replace(/\s\s+/g," "), |
37 | | -f=e.indexOf("{"),d.push(" "+b+": {"+e.substr(f+1,Math.min(Math.max(e.indexOf("\n")-1,64),64)).replace(/\n/g,"")+"... }")):d.push(" "+b+": "+a.options[b]));c._wD("SMSound() merged options: {\n"+d.join(", \n")+"\n}")}};this._debug();this.load=function(b){var d=null;if(typeof b!=="undefined")a._iO=s(b,a.options),a.instanceOptions=a._iO;else if(b=a.options,a._iO=b,a.instanceOptions=a._iO,a._lastURL&&a._lastURL!==a.url)l("manURL"),a._iO.url=a.url,a.url=null;if(!a._iO.url)a._iO.url=a.url;c._wD("SMSound.load(): "+ |
38 | | -a._iO.url,1);if(a._iO.url===a.url&&a.readyState!==0&&a.readyState!==2)return l("onURL",1),a;a._lastURL=a.url;a.loaded=false;a.readyState=1;a.playState=0;if(da(a._iO))d=a._setup_html5(a._iO),d._called_load?c._wD(h+"ignoring request to load again: "+a.sID):(c._wD(h+"load: "+a.sID),a._html5_canplay=false,d.load(),d._called_load=true,a._iO.autoPlay&&a.play());else try{a.isHTML5=false,a._iO=ba(aa(a._iO)),j===8?c.o._load(a.sID,a._iO.url,a._iO.stream,a._iO.autoPlay,a._iO.whileloading?1:0,a._iO.loops||1, |
39 | | -a._iO.usePolicyFile):c.o._load(a.sID,a._iO.url,!!a._iO.stream,!!a._iO.autoPlay,a._iO.loops||1,!!a._iO.autoLoad,a._iO.usePolicyFile)}catch(e){l("smError",2),r("onload",false),F({type:"SMSOUND_LOAD_JS_EXCEPTION",fatal:true})}return a};this.unload=function(){a.readyState!==0&&(c._wD('SMSound.unload(): "'+a.sID+'"'),a.isHTML5?(f(),a._a&&(a._a.pause(),ra(a._a))):j===8?c.o._unload(a.sID,"about:blank"):c.o._unload(a.sID),e());return a};this.destruct=function(b){c._wD('SMSound.destruct(): "'+a.sID+'"');if(a.isHTML5){if(f(), |
40 | | -a._a)a._a.pause(),ra(a._a),Q||a._remove_html5_events(),a._a._t=null,a._a=null}else a._iO.onfailure=null,c.o._destroySound(a.sID);b||c.destroySound(a.sID,true)};this.start=this.play=function(b,e){var f,e=e===void 0?true:e;b||(b={});a._iO=s(b,a._iO);a._iO=s(a._iO,a.options);a.instanceOptions=a._iO;if(a._iO.serverURL&&!a.connected)return a.getAutoPlay()||(c._wD("SMSound.play(): Netstream not connected yet - setting autoPlay"),a.setAutoPlay(true)),a;da(a._iO)&&(a._setup_html5(a._iO),d());if(a.playState=== |
41 | | -1&&!a.paused)if(f=a._iO.multiShot)c._wD('SMSound.play(): "'+a.sID+'" already playing (multi-shot)',1);else return c._wD('SMSound.play(): "'+a.sID+'" already playing (one-shot)',1),a;if(a.loaded)c._wD('SMSound.play(): "'+a.sID+'"');else if(a.readyState===0){c._wD('SMSound.play(): Attempting to load "'+a.sID+'"',1);if(!a.isHTML5)a._iO.autoPlay=true;a.load(a._iO)}else if(a.readyState===2)return c._wD('SMSound.play(): Could not load "'+a.sID+'" - exiting',2),a;else c._wD('SMSound.play(): "'+a.sID+'" is loading - attempting to play..', |
42 | | -1);if(!a.isHTML5&&j===9&&a.position>0&&a.position===a.duration)c._wD('SMSound.play(): "'+a.sID+'": Sound at end, resetting to position:0'),a._iO.position=0;if(a.paused&&a.position&&a.position>0)c._wD('SMSound.play(): "'+a.sID+'" is resuming from paused state',1),a.resume();else{c._wD('SMSound.play(): "'+a.sID+'" is starting to play');a.playState=1;a.paused=false;(!a.instanceCount||a._iO.multiShotEvents||!a.isHTML5&&j>8&&!a.getAutoPlay())&&a.instanceCount++;a.position=typeof a._iO.position!=="undefined"&& |
43 | | -!isNaN(a._iO.position)?a._iO.position:0;if(!a.isHTML5)a._iO=ba(aa(a._iO));if(a._iO.onplay&&e)a._iO.onplay.apply(a),a._onplay_called=true;a.setVolume(a._iO.volume,true);a.setPan(a._iO.pan,true);a.isHTML5?(d(),f=a._setup_html5(),a.setPosition(a._iO.position),f.play()):c.o._start(a.sID,a._iO.loops||1,j===9?a._iO.position:a._iO.position/1E3)}return a};this.stop=function(b){if(a.playState===1){a._onbufferchange(0);a.resetOnPosition(0);a.paused=false;if(!a.isHTML5)a.playState=0;a._iO.onstop&&a._iO.onstop.apply(a); |
44 | | -if(a.isHTML5){if(a._a)a.setPosition(0),a._a.pause(),a.playState=0,a._onTimer(),f()}else c.o._stop(a.sID,b),a._iO.serverURL&&a.unload();a.instanceCount=0;a._iO={}}return a};this.setAutoPlay=function(b){c._wD("sound "+a.sID+" turned autoplay "+(b?"on":"off"));a._iO.autoPlay=b;a.isHTML5||(c.o._setAutoPlay(a.sID,b),b&&!a.instanceCount&&a.readyState===1&&(a.instanceCount++,c._wD("sound "+a.sID+" incremented instance count to "+a.instanceCount)))};this.getAutoPlay=function(){return a._iO.autoPlay};this.setPosition= |
45 | | -function(b){b===void 0&&(b=0);var d=a.isHTML5?Math.max(b,0):Math.min(a.duration||a._iO.duration,Math.max(b,0));a.position=d;b=a.position/1E3;a.resetOnPosition(a.position);a._iO.position=d;if(a.isHTML5){if(a._a)if(a._html5_canplay){if(a._a.currentTime!==b){c._wD("setPosition("+b+"): setting position");try{a._a.currentTime=b,(a.playState===0||a.paused)&&a._a.pause()}catch(e){c._wD("setPosition("+b+"): setting position failed: "+e.message,2)}}}else c._wD("setPosition("+b+"): delaying, sound not ready")}else b= |
46 | | -j===9?a.position:b,a.readyState&&a.readyState!==2&&c.o._setPosition(a.sID,b,a.paused||!a.playState);a.isHTML5&&a.paused&&a._onTimer(true);return a};this.pause=function(b){if(a.paused||a.playState===0&&a.readyState!==1)return a;c._wD("SMSound.pause()");a.paused=true;a.isHTML5?(a._setup_html5().pause(),f()):(b||b===void 0)&&c.o._pause(a.sID);a._iO.onpause&&a._iO.onpause.apply(a);return a};this.resume=function(){if(!a.paused)return a;c._wD("SMSound.resume()");a.paused=false;a.playState=1;a.isHTML5?(a._setup_html5().play(), |
47 | | -d()):(a._iO.isMovieStar&&a.setPosition(a.position),c.o._pause(a.sID));!a._onplay_called&&a._iO.onplay?(a._iO.onplay.apply(a),a._onplay_called=true):a._iO.onresume&&a._iO.onresume.apply(a);return a};this.togglePause=function(){c._wD("SMSound.togglePause()");if(a.playState===0)return a.play({position:j===9&&!a.isHTML5?a.position:a.position/1E3}),a;a.paused?a.resume():a.pause();return a};this.setPan=function(b,d){typeof b==="undefined"&&(b=0);typeof d==="undefined"&&(d=false);a.isHTML5||c.o._setPan(a.sID, |
48 | | -b);a._iO.pan=b;if(!d)a.pan=b,a.options.pan=b;return a};this.setVolume=function(b,d){typeof b==="undefined"&&(b=100);typeof d==="undefined"&&(d=false);if(a.isHTML5){if(a._a)a._a.volume=Math.max(0,Math.min(1,b/100))}else c.o._setVolume(a.sID,c.muted&&!a.muted||a.muted?0:b);a._iO.volume=b;if(!d)a.volume=b,a.options.volume=b;return a};this.mute=function(){a.muted=true;if(a.isHTML5){if(a._a)a._a.muted=true}else c.o._setVolume(a.sID,0);return a};this.unmute=function(){a.muted=false;var b=typeof a._iO.volume!== |
49 | | -"undefined";if(a.isHTML5){if(a._a)a._a.muted=false}else c.o._setVolume(a.sID,b?a._iO.volume:a.options.volume);return a};this.toggleMute=function(){return a.muted?a.unmute():a.mute()};this.onposition=function(c,b,d){a._onPositionItems.push({position:c,method:b,scope:typeof d!=="undefined"?d:a,fired:false});return a};this.processOnPosition=function(){var b,d;b=a._onPositionItems.length;if(!b||!a.playState||a._onPositionFired>=b)return false;for(;b--;)if(d=a._onPositionItems[b],!d.fired&&a.position>= |
50 | | -d.position)d.fired=true,c._onPositionFired++,d.method.apply(d.scope,[d.position]);return true};this.resetOnPosition=function(b){var d,e;d=a._onPositionItems.length;if(!d)return false;for(;d--;)if(e=a._onPositionItems[d],e.fired&&b<=e.position)e.fired=false,c._onPositionFired--;return true};d=function(){a.isHTML5&&Ea(a)};f=function(){a.isHTML5&&Fa(a)};e=function(){a._onPositionItems=[];a._onPositionFired=0;a._hasTimer=null;a._onplay_called=false;a._a=null;a._html5_canplay=false;a.bytesLoaded=null; |
51 | | -a.bytesTotal=null;a.position=null;a.duration=a._iO&&a._iO.duration?a._iO.duration:null;a.durationEstimate=null;a.failures=0;a.loaded=false;a.playState=0;a.paused=false;a.readyState=0;a.muted=false;a.isBuffering=false;a.instanceOptions={};a.instanceCount=0;a.peakData={left:0,right:0};a.waveformData={left:[],right:[]};a.eqData=[];a.eqData.left=[];a.eqData.right=[]};e();this._onTimer=function(b){var d={};if(a._hasTimer||b)return a._a&&(b||(a.playState>0||a.readyState===1)&&!a.paused)?(a.duration=a._get_html5_duration(), |
52 | | -a.durationEstimate=a.duration,b=a._a.currentTime?a._a.currentTime*1E3:0,a._whileplaying(b,d,d,d,d),true):(c._wD('_onTimer: Warn for "'+a.sID+'": '+(!a._a?"Could not find element. ":"")+(a.playState===0?"playState bad, 0?":"playState = "+a.playState+", OK")),false)};this._get_html5_duration=function(){var c=a._a?a._a.duration*1E3:a._iO?a._iO.duration:void 0;return c&&!isNaN(c)&&c!==Infinity?c:a._iO?a._iO.duration:null};this._setup_html5=function(b){var b=s(a._iO,b),d=Q?c._global_a:a._a,f=decodeURI(b.url), |
53 | | -g=d&&d._t?d._t.instanceOptions:null;if(d){if(d._t&&g.url===b.url&&(!a._lastURL||a._lastURL===g.url))return d;c._wD("setting new URL on existing object: "+f+(a._lastURL?", old URL: "+a._lastURL:""));Q&&d._t&&d._t.playState&&b.url!==g.url&&d._t.stop();e();d.src=b.url;a.url=b.url;a._lastURL=b.url;d._called_load=false}else{c._wD("creating HTML5 Audio() element with URL: "+f);d=new Audio(b.url);d._called_load=false;if(Ta)d._called_load=true;if(Q)c._global_a=d}a.isHTML5=true;a._a=d;d._t=a;a._add_html5_events(); |
54 | | -d.loop=b.loops>1?"loop":"";b.autoLoad||b.autoPlay?(d.autobuffer="auto",d.preload="auto",a.load(),d._called_load=true):(d.autobuffer=false,d.preload="none");d.loop=b.loops>1?"loop":"";return d};this._add_html5_events=function(){if(a._a._added_events)return false;var b;c._wD(h+"adding event listeners: "+a.sID);a._a._added_events=true;for(b in x)x.hasOwnProperty(b)&&a._a&&a._a.addEventListener(b,x[b],false);return true};this._remove_html5_events=function(){var b;c._wD(h+"removing event listeners: "+ |
55 | | -a.sID);a._a._added_events=false;for(b in x)x.hasOwnProperty(b)&&a._a&&a._a.removeEventListener(b,x[b],false)};this._onload=function(b){b=!!b;c._wD('SMSound._onload(): "'+a.sID+'"'+(b?" loaded.":" failed to load? - "+a.url),b?1:2);!b&&!a.isHTML5&&(c.sandbox.noRemote===true&&c._wD("SMSound._onload(): "+n("noNet"),1),c.sandbox.noLocal===true&&c._wD("SMSound._onload(): "+n("noLocal"),1));a.loaded=b;a.readyState=b?3:2;a._onbufferchange(0);a._iO.onload&&a._iO.onload.apply(a,[b]);return true};this._onbufferchange= |
56 | | -function(b){if(a.playState===0)return false;if(b&&a.isBuffering||!b&&!a.isBuffering)return false;a.isBuffering=b===1;a._iO.onbufferchange&&(c._wD("SMSound._onbufferchange(): "+b),a._iO.onbufferchange.apply(a));return true};this._onsuspend=function(){a._iO.onsuspend&&(c._wD("SMSound._onsuspend()"),a._iO.onsuspend.apply(a));return true};this._onfailure=function(b,d,e){a.failures++;c._wD('SMSound._onfailure(): "'+a.sID+'" count '+a.failures);if(a._iO.onfailure&&a.failures===1)a._iO.onfailure(a,b,d,e); |
57 | | -else c._wD("SMSound._onfailure(): ignoring")};this._onfinish=function(){var b=a._iO.onfinish;a._onbufferchange(0);a.resetOnPosition(0);if(a.instanceCount){a.instanceCount--;if(!a.instanceCount)a.playState=0,a.paused=false,a.instanceCount=0,a.instanceOptions={},a._iO={},f();if((!a.instanceCount||a._iO.multiShotEvents)&&b)c._wD('SMSound._onfinish(): "'+a.sID+'"'),b.apply(a)}};this._whileloading=function(c,b,d,e){a.bytesLoaded=c;a.bytesTotal=b;a.duration=Math.floor(d);a.bufferLength=e;if(a._iO.isMovieStar)a.durationEstimate= |
58 | | -a.duration;else if(a.durationEstimate=a._iO.duration?a.duration>a._iO.duration?a.duration:a._iO.duration:parseInt(a.bytesTotal/a.bytesLoaded*a.duration,10),a.durationEstimate===void 0)a.durationEstimate=a.duration;a.readyState!==3&&a._iO.whileloading&&a._iO.whileloading.apply(a)};this._whileplaying=function(c,b,d,e,f){if(isNaN(c)||c===null)return false;a.position=c;a.processOnPosition();if(!a.isHTML5&&j>8){if(a._iO.usePeakData&&typeof b!=="undefined"&&b)a.peakData={left:b.leftPeak,right:b.rightPeak}; |
59 | | -if(a._iO.useWaveformData&&typeof d!=="undefined"&&d)a.waveformData={left:d.split(","),right:e.split(",")};if(a._iO.useEQData&&typeof f!=="undefined"&&f&&f.leftEQ&&(c=f.leftEQ.split(","),a.eqData=c,a.eqData.left=c,typeof f.rightEQ!=="undefined"&&f.rightEQ))a.eqData.right=f.rightEQ.split(",")}a.playState===1&&(!a.isHTML5&&j===8&&!a.position&&a.isBuffering&&a._onbufferchange(0),a._iO.whileplaying&&a._iO.whileplaying.apply(a));return true};this._onid3=function(b,d){c._wD('SMSound._onid3(): "'+this.sID+ |
60 | | -'" ID3 data received.');var e=[],f,g;for(f=0,g=b.length;f<g;f++)e[b[f]]=d[f];a.id3=s(a.id3,e);a._iO.onid3&&a._iO.onid3.apply(a)};this._onconnect=function(b){b=b===1;c._wD('SMSound._onconnect(): "'+a.sID+'"'+(b?" connected.":" failed to connect? - "+a.url),b?1:2);if(a.connected=b)a.failures=0,o(a.sID)&&(a.getAutoPlay()?a.play(void 0,a.getAutoPlay()):a._iO.autoLoad&&a.load()),a._iO.onconnect&&a._iO.onconnect.apply(a,[b])};this._ondataerror=function(b){a.playState>0&&(c._wD("SMSound._ondataerror(): "+ |
61 | | -b),a._iO.ondataerror&&a._iO.ondataerror.apply(a))}};Y=function(){return g.body||g._docElement||g.getElementsByTagName("div")[0]};u=function(b){return g.getElementById(b)};s=function(b,a){var e={},f,d;for(f in b)b.hasOwnProperty(f)&&(e[f]=b[f]);f=typeof a==="undefined"?c.defaultOptions:a;for(d in f)f.hasOwnProperty(d)&&typeof e[d]==="undefined"&&(e[d]=f[d]);return e};p=function(){function b(a){var a=Ia.call(a),b=a.length;c?(a[1]="on"+a[1],b>3&&a.pop()):b===3&&a.push(false);return a}function a(a,b){var g= |
62 | | -a.shift(),j=[f[b]];if(c)g[j](a[0],a[1]);else g[j].apply(g,a)}var c=i.attachEvent,f={add:c?"attachEvent":"addEventListener",remove:c?"detachEvent":"removeEventListener"};return{add:function(){a(b(arguments),"add")},remove:function(){a(b(arguments),"remove")}}}();x={abort:k(function(){c._wD(h+"abort: "+this._t.sID)}),canplay:k(function(){if(this._t._html5_canplay)return true;this._t._html5_canplay=true;c._wD(h+"canplay: "+this._t.sID+", "+this._t.url);this._t._onbufferchange(0);var b=!isNaN(this._t.position)? |
63 | | -this._t.position/1E3:null;if(this._t.position&&this.currentTime!==b){c._wD(h+"canplay: setting position to "+b);try{this.currentTime=b}catch(a){c._wD(h+"setting position failed: "+a.message,2)}}}),load:k(function(){this._t.loaded||(this._t._onbufferchange(0),this._t._whileloading(this._t.bytesTotal,this._t.bytesTotal,this._t._get_html5_duration()),this._t._onload(true))}),emptied:k(function(){c._wD(h+"emptied: "+this._t.sID)}),ended:k(function(){c._wD(h+"ended: "+this._t.sID);this._t._onfinish()}), |
64 | | -error:k(function(){c._wD(h+"error: "+this.error.code);this._t._onload(false)}),loadeddata:k(function(){var b=this._t,a=b.bytesTotal||1;c._wD(h+"loadeddata: "+this._t.sID);if(!b._loaded&&!R)b.duration=b._get_html5_duration(),b._whileloading(a,a,b._get_html5_duration()),b._onload(true)}),loadedmetadata:k(function(){c._wD(h+"loadedmetadata: "+this._t.sID)}),loadstart:k(function(){c._wD(h+"loadstart: "+this._t.sID);this._t._onbufferchange(1)}),play:k(function(){c._wD(h+"play: "+this._t.sID+", "+this._t.url); |
65 | | -this._t._onbufferchange(0)}),playing:k(function(){c._wD(h+"playing: "+this._t.sID+", "+this._t.url);this._t._onbufferchange(0)}),progress:k(function(b){if(this._t.loaded)return false;var a,e,f;f=0;var d=b.type==="progress";e=b.target.buffered;var g=b.loaded||0,xa=b.total||1;if(e&&e.length){for(a=e.length;a--;)f=e.end(a)-e.start(a);g=f/b.target.duration;if(d&&e.length>1){f=[];e=e.length;for(a=0;a<e;a++)f.push(b.target.buffered.start(a)+"-"+b.target.buffered.end(a));c._wD(h+"progress: timeRanges: "+ |
66 | | -f.join(", "))}d&&!isNaN(g)&&c._wD(h+"progress: "+this._t.sID+": "+Math.floor(g*100)+"% loaded")}isNaN(g)||(this._t._onbufferchange(0),this._t._whileloading(g,xa,this._t._get_html5_duration()),g&&xa&&g===xa&&x.load.call(this,b))}),ratechange:k(function(){c._wD(h+"ratechange: "+this._t.sID)}),suspend:k(function(b){c._wD(h+"suspend: "+this._t.sID);x.progress.call(this,b);this._t._onsuspend()}),stalled:k(function(){c._wD(h+"stalled: "+this._t.sID)}),timeupdate:k(function(){this._t._onTimer()}),waiting:k(function(){c._wD(h+ |
67 | | -"waiting: "+this._t.sID);this._t._onbufferchange(1)})};da=function(b){return!b.serverURL&&(b.type?P({type:b.type}):P({url:b.url})||c.html5Only)};ra=function(b){if(b)b.src=Sa?"":"about:blank"};P=function(b){function a(a){return c.preferFlash&&t&&!c.ignoreFlash&&typeof c.flash[a]!=="undefined"&&c.flash[a]}if(!c.useHTML5Audio||!c.hasHTML5)return false;var e=b.url||null,b=b.type||null,f=c.audioFormats,d;if(b&&c.html5[b]!=="undefined")return c.html5[b]&&!a(b);if(!z){z=[];for(d in f)f.hasOwnProperty(d)&& |
68 | | -(z.push(d),f[d].related&&(z=z.concat(f[d].related)));z=RegExp("\\.("+z.join("|")+")(\\?.*)?$","i")}d=e?e.toLowerCase().match(z):null;if(!d||!d.length)if(b)e=b.indexOf(";"),d=(e!==-1?b.substr(0,e):b).substr(6);else return false;else d=d[1];return d&&typeof c.html5[d]!=="undefined"?c.html5[d]&&!a(d):(b="audio/"+d,e=c.html5.canPlayType({type:b}),(c.html5[d]=e)&&c.html5[b]&&!a(b))};Ha=function(){function b(b){var d,e,f=false;if(!a||typeof a.canPlayType!=="function")return false;if(b instanceof Array){for(d= |
69 | | -0,e=b.length;d<e&&!f;d++)if(c.html5[b[d]]||a.canPlayType(b[d]).match(c.html5Test))f=true,c.html5[b[d]]=true,c.flash[b[d]]=!(!c.preferFlash||!t||!b[d].match(Ma));return f}else return b=a&&typeof a.canPlayType==="function"?a.canPlayType(b):false,!(!b||!b.match(c.html5Test))}if(!c.useHTML5Audio||typeof Audio==="undefined")return false;var a=typeof Audio!=="undefined"?Va?new Audio(null):new Audio:null,e,f={},d,g;d=c.audioFormats;for(e in d)if(d.hasOwnProperty(e)&&(f[e]=b(d[e].type),f["audio/"+e]=f[e], |
70 | | -c.flash[e]=c.preferFlash&&!c.ignoreFlash&&e.match(Ma)?true:false,d[e]&&d[e].related))for(g=d[e].related.length;g--;)f["audio/"+d[e].related[g]]=f[e],c.html5[d[e].related[g]]=f[e],c.flash[d[e].related[g]]=f[e];f.canPlayType=a?b:null;c.html5=s(c.html5,f);return true};W={notReady:"Not loaded yet - wait for soundManager.onload()/onready()",notOK:"Audio support is not available.",domError:"soundManager::createMovie(): appendChild/innerHTML call failed. DOM not ready or other error.",spcWmode:"soundManager::createMovie(): Removing wmode, preventing known SWF loading issue(s)", |
71 | | -swf404:"soundManager: Verify that %s is a valid path.",tryDebug:"Try soundManager.debugFlash = true for more security details (output goes to SWF.)",checkSWF:"See SWF output for more debug info.",localFail:"soundManager: Non-HTTP page ("+g.location.protocol+" URL?) Review Flash player security settings for this special case:\nhttp://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html\nMay need to add/allow path, eg. c:/sm2/ or /users/me/sm2/",waitFocus:"soundManager: Special case: Waiting for focus-related event..", |
72 | | -waitImpatient:"soundManager: Getting impatient, still waiting for Flash%s...",waitForever:"soundManager: Waiting indefinitely for Flash (will recover if unblocked)...",needFunction:"soundManager: Function object expected for %s",badID:'Warning: Sound ID "%s" should be a string, starting with a non-numeric character',currentObj:"--- soundManager._debug(): Current sound objects ---",waitEI:"soundManager::initMovie(): Waiting for ExternalInterface call from Flash..",waitOnload:"soundManager: Waiting for window.onload()", |
73 | | -docLoaded:"soundManager: Document already loaded",onload:"soundManager::initComplete(): calling soundManager.onload()",onloadOK:"soundManager.onload() complete",init:"soundManager::init()",didInit:"soundManager::init(): Already called?",flashJS:"soundManager: Attempting to call Flash from JS..",secNote:"Flash security note: Network/internet URLs will not load due to security restrictions. Access can be configured via Flash Player Global Security Settings Page: http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html", |
74 | | -badRemove:"Warning: Failed to remove flash movie.",noPeak:"Warning: peakData features unsupported for movieStar formats",shutdown:"soundManager.disable(): Shutting down",queue:"soundManager: Queueing %s handler",smFail:"soundManager: Failed to initialise.",smError:"SMSound.load(): Exception: JS-Flash communication failed, or JS error.",fbTimeout:"No flash response, applying ."+c.swfCSS.swfTimedout+" CSS..",fbLoaded:"Flash loaded",fbHandler:"soundManager::flashBlockHandler()",manURL:"SMSound.load(): Using manually-assigned URL", |
| 15 | +(function(G){function W(W,la){function l(b){return function(a){var d=this._t;return!d||!d._a?(d&&d.sID?c._wD(k+"ignoring "+a.type+": "+d.sID):c._wD(k+"ignoring "+a.type),null):b.call(this,a)}}this.flashVersion=8;this.debugMode=!0;this.debugFlash=!1;this.consoleOnly=this.useConsole=!0;this.waitForWindowLoad=!1;this.bgColor="#ffffff";this.useHighPerformance=!1;this.html5PollingInterval=this.flashPollingInterval=null;this.flashLoadTimeout=1E3;this.wmode=null;this.allowScriptAccess="always";this.useFlashBlock= |
| 16 | +!1;this.useHTML5Audio=!0;this.html5Test=/^(probably|maybe)$/i;this.preferFlash=!0;this.noSWFCache=!1;this.audioFormats={mp3:{type:['audio/mpeg; codecs="mp3"',"audio/mpeg","audio/mp3","audio/MPA","audio/mpa-robust"],required:!0},mp4:{related:["aac","m4a"],type:['audio/mp4; codecs="mp4a.40.2"',"audio/aac","audio/x-m4a","audio/MP4A-LATM","audio/mpeg4-generic"],required:!1},ogg:{type:["audio/ogg; codecs=vorbis"],required:!1},wav:{type:['audio/wav; codecs="1"',"audio/wav","audio/wave","audio/x-wav"],required:!1}}; |
| 17 | +this.defaultOptions={autoLoad:!1,autoPlay:!1,from:null,loops:1,onid3:null,onload:null,whileloading:null,onplay:null,onpause:null,onresume:null,whileplaying:null,onposition:null,onstop:null,onfailure:null,onfinish:null,multiShot:!0,multiShotEvents:!1,position:null,pan:0,stream:!0,to:null,type:null,usePolicyFile:!1,volume:100};this.flash9Options={isMovieStar:null,usePeakData:!1,useWaveformData:!1,useEQData:!1,onbufferchange:null,ondataerror:null};this.movieStarOptions={bufferTime:3,serverURL:null,onconnect:null, |
| 18 | +duration:null};this.movieID="sm2-container";this.id=la||"sm2movie";this.debugID="soundmanager-debug";this.debugURLParam=/([#?&])debug=1/i;this.versionNumber="V2.97a.20111220";this.movieURL=this.version=null;this.url=W||null;this.altURL=null;this.enabled=this.swfLoaded=!1;this.oMC=null;this.sounds={};this.soundIDs=[];this.didFlashBlock=this.muted=!1;this.filePattern=null;this.filePatterns={flash8:/\.mp3(\?.*)?$/i,flash9:/\.mp3(\?.*)?$/i};this.features={buffering:!1,peakData:!1,waveformData:!1,eqData:!1, |
| 19 | +movieStar:!1};this.sandbox={type:null,types:{remote:"remote (domain-based) rules",localWithFile:"local with file access (no internet access)",localWithNetwork:"local with network (internet access only, no local access)",localTrusted:"local, trusted (local+internet access)"},description:null,noRemote:null,noLocal:null};var ma;try{ma="undefined"!==typeof Audio&&"undefined"!==typeof(new Audio).canPlayType}catch(fb){ma=!1}this.hasHTML5=ma;this.html5={usingFlash:null};this.flash={};this.ignoreFlash=this.html5Only= |
| 20 | +!1;var Ea,c=this,i=null,k="HTML5::",u,p=navigator.userAgent,j=G,O=j.location.href.toString(),h=document,na,X,m,B=[],oa=!0,w,P=!1,Q=!1,n=!1,y=!1,Y=!1,o,Za=0,R,v,pa,H,I,Z,Fa,qa,E,$,aa,J,ra,sa,ba,ca,K,Ga,ta,$a=["log","info","warn","error"],Ha,da,Ia,S=null,ua=null,q,va,L,Ja,ea,fa,wa,s,ga=!1,xa=!1,Ka,La,Ma,ha=0,T=null,ia,z=null,Na,ja,U,C,ya,za,Oa,r,Pa=Array.prototype.slice,F=!1,t,ka,Qa,A,Ra,Aa=p.match(/(ipad|iphone|ipod)/i),ab=p.match(/firefox/i),bb=p.match(/droid/i),D=p.match(/msie/i),cb=p.match(/webkit/i), |
| 21 | +V=p.match(/safari/i)&&!p.match(/chrome/i),db=p.match(/opera/i),Ba=p.match(/(mobile|pre\/|xoom)/i)||Aa,Ca=!O.match(/usehtml5audio/i)&&!O.match(/sm2\-ignorebadua/i)&&V&&!p.match(/silk/i)&&p.match(/OS X 10_6_([3-7])/i),Sa="undefined"!==typeof console&&"undefined"!==typeof console.log,Da="undefined"!==typeof h.hasFocus?h.hasFocus():null,M=V&&"undefined"===typeof h.hasFocus,Ta=!M,Ua=/(mp3|mp4|mpa)/i,N=h.location?h.location.protocol.match(/http/i):null,Va=!N?"http://":"",Wa=/^\s*audio\/(?:x-)?(?:mpeg4|aac|flv|mov|mp4||m4v|m4a|mp4v|3gp|3g2)\s*(?:$|;)/i, |
| 22 | +Xa="mpeg4,aac,flv,mov,mp4,m4v,f4v,m4a,mp4v,3gp,3g2".split(","),eb=RegExp("\\.("+Xa.join("|")+")(\\?.*)?$","i");this.mimePattern=/^\s*audio\/(?:x-)?(?:mp(?:eg|3))\s*(?:$|;)/i;this.useAltURL=!N;this._global_a=null;if(Ba&&(c.useHTML5Audio=!0,c.preferFlash=!1,Aa))F=c.ignoreFlash=!0;this.supported=this.ok=function(){return z?n&&!y:c.useHTML5Audio&&c.hasHTML5};this.getMovie=function(c){return u(c)||h[c]||j[c]};this.createSound=function(b){function a(){f=ea(f);c.sounds[e.id]=new Ea(e);c.soundIDs.push(e.id); |
| 23 | +return c.sounds[e.id]}var d,f=null,e=d=null;d="soundManager.createSound(): "+q(!n?"notReady":"notOK");if(!n||!c.ok())return wa(d),!1;2===arguments.length&&(b={id:arguments[0],url:arguments[1]});f=v(b);f.url=ia(f.url);e=f;e.id.toString().charAt(0).match(/^[0-9]$/)&&c._wD("soundManager.createSound(): "+q("badID",e.id),2);c._wD("soundManager.createSound(): "+e.id+" ("+e.url+")",1);if(s(e.id,!0))return c._wD("soundManager.createSound(): "+e.id+" exists",1),c.sounds[e.id];if(ja(e))d=a(),c._wD("Loading sound "+ |
| 24 | +e.id+" via HTML5"),d._setup_html5(e);else{if(8<m){if(null===e.isMovieStar)e.isMovieStar=e.serverURL||(e.type?e.type.match(Wa):!1)||e.url.match(eb);e.isMovieStar&&c._wD("soundManager.createSound(): using MovieStar handling");if(e.isMovieStar){if(e.usePeakData)o("noPeak"),e.usePeakData=!1;1<e.loops&&o("noNSLoop")}}e=fa(e,"soundManager.createSound(): ");d=a();if(8===m)i._createSound(e.id,e.loops||1,e.usePolicyFile);else if(i._createSound(e.id,e.url,e.usePeakData,e.useWaveformData,e.useEQData,e.isMovieStar, |
| 25 | +e.isMovieStar?e.bufferTime:!1,e.loops||1,e.serverURL,e.duration||null,e.autoPlay,!0,e.autoLoad,e.usePolicyFile),!e.serverURL)d.connected=!0,e.onconnect&&e.onconnect.apply(d);!e.serverURL&&(e.autoLoad||e.autoPlay)&&d.load(e)}!e.serverURL&&e.autoPlay&&d.play();return d};this.destroySound=function(b,a){if(!s(b))return!1;var d=c.sounds[b],f;d._iO={};d.stop();d.unload();for(f=0;f<c.soundIDs.length;f++)if(c.soundIDs[f]===b){c.soundIDs.splice(f,1);break}a||d.destruct(!0);delete c.sounds[b];return!0};this.load= |
| 26 | +function(b,a){return!s(b)?!1:c.sounds[b].load(a)};this.unload=function(b){return!s(b)?!1:c.sounds[b].unload()};this.onposition=this.onPosition=function(b,a,d,f){return!s(b)?!1:c.sounds[b].onposition(a,d,f)};this.clearOnPosition=function(b,a,d){return!s(b)?!1:c.sounds[b].clearOnPosition(a,d)};this.start=this.play=function(b,a){if(!n||!c.ok())return wa("soundManager.play(): "+q(!n?"notReady":"notOK")),!1;if(!s(b)){a instanceof Object||(a={url:a});return a&&a.url?(c._wD('soundManager.play(): attempting to create "'+ |
| 27 | +b+'"',1),a.id=b,c.createSound(a).play()):!1}return c.sounds[b].play(a)};this.setPosition=function(b,a){return!s(b)?!1:c.sounds[b].setPosition(a)};this.stop=function(b){if(!s(b))return!1;c._wD("soundManager.stop("+b+")",1);return c.sounds[b].stop()};this.stopAll=function(){var b;c._wD("soundManager.stopAll()",1);for(b in c.sounds)c.sounds.hasOwnProperty(b)&&c.sounds[b].stop()};this.pause=function(b){return!s(b)?!1:c.sounds[b].pause()};this.pauseAll=function(){var b;for(b=c.soundIDs.length;b--;)c.sounds[c.soundIDs[b]].pause()}; |
| 28 | +this.resume=function(b){return!s(b)?!1:c.sounds[b].resume()};this.resumeAll=function(){var b;for(b=c.soundIDs.length;b--;)c.sounds[c.soundIDs[b]].resume()};this.togglePause=function(b){return!s(b)?!1:c.sounds[b].togglePause()};this.setPan=function(b,a){return!s(b)?!1:c.sounds[b].setPan(a)};this.setVolume=function(b,a){return!s(b)?!1:c.sounds[b].setVolume(a)};this.mute=function(b){var a=0;"string"!==typeof b&&(b=null);if(b){if(!s(b))return!1;c._wD('soundManager.mute(): Muting "'+b+'"');return c.sounds[b].mute()}c._wD("soundManager.mute(): Muting all sounds"); |
| 29 | +for(a=c.soundIDs.length;a--;)c.sounds[c.soundIDs[a]].mute();return c.muted=!0};this.muteAll=function(){c.mute()};this.unmute=function(b){"string"!==typeof b&&(b=null);if(b){if(!s(b))return!1;c._wD('soundManager.unmute(): Unmuting "'+b+'"');return c.sounds[b].unmute()}c._wD("soundManager.unmute(): Unmuting all sounds");for(b=c.soundIDs.length;b--;)c.sounds[c.soundIDs[b]].unmute();c.muted=!1;return!0};this.unmuteAll=function(){c.unmute()};this.toggleMute=function(b){return!s(b)?!1:c.sounds[b].toggleMute()}; |
| 30 | +this.getMemoryUse=function(){var c=0;i&&8!==m&&(c=parseInt(i._getMemoryUse(),10));return c};this.disable=function(b){var a;"undefined"===typeof b&&(b=!1);if(y)return!1;y=!0;o("shutdown",1);for(a=c.soundIDs.length;a--;)Ha(c.sounds[c.soundIDs[a]]);R(b);r.remove(j,"load",I);return!0};this.canPlayMIME=function(b){var a;c.hasHTML5&&(a=U({type:b}));return!z||a?a:b?!!(8<m&&b.match(Wa)||b.match(c.mimePattern)):null};this.canPlayURL=function(b){var a;c.hasHTML5&&(a=U({url:b}));return!z||a?a:b?!!b.match(c.filePattern): |
| 31 | +null};this.canPlayLink=function(b){return"undefined"!==typeof b.type&&b.type&&c.canPlayMIME(b.type)?!0:c.canPlayURL(b.href)};this.getSoundById=function(b,a){if(!b)throw Error("soundManager.getSoundById(): sID is null/undefined");var d=c.sounds[b];!d&&!a&&c._wD('"'+b+'" is an invalid sound ID.',2);return d};this.onready=function(b,a){if(b&&b instanceof Function)return n&&c._wD(q("queue","onready")),a||(a=j),pa("onready",b,a),H(),!0;throw q("needFunction","onready");};this.ontimeout=function(b,a){if(b&& |
| 32 | +b instanceof Function)return n&&c._wD(q("queue","ontimeout")),a||(a=j),pa("ontimeout",b,a),H({type:"ontimeout"}),!0;throw q("needFunction","ontimeout");};this._wD=this._writeDebug=function(b,a,d){var f,e;if(!c.debugMode)return!1;"undefined"!==typeof d&&d&&(b=b+" | "+(new Date).getTime());if(Sa&&c.useConsole){d=$a[a];if("undefined"!==typeof console[d])console[d](b);else console.log(b);if(c.consoleOnly)return!0}try{f=u("soundmanager-debug");if(!f)return!1;e=h.createElement("div");if(0===++Za%2)e.className= |
| 33 | +"sm2-alt";a="undefined"===typeof a?0:parseInt(a,10);e.appendChild(h.createTextNode(b));if(a){if(2<=a)e.style.fontWeight="bold";if(3===a)e.style.color="#ff3333"}f.insertBefore(e,f.firstChild)}catch(i){}return!0};this._debug=function(){var b,a;o("currentObj",1);for(b=0,a=c.soundIDs.length;b<a;b++)c.sounds[c.soundIDs[b]]._debug()};this.reboot=function(){c._wD("soundManager.reboot()");c.soundIDs.length&&c._wD("Destroying "+c.soundIDs.length+" SMSound objects...");var b,a;for(b=c.soundIDs.length;b--;)c.sounds[c.soundIDs[b]].destruct(); |
| 34 | +try{if(D)ua=i.innerHTML;S=i.parentNode.removeChild(i);c._wD("Flash movie removed.")}catch(d){o("badRemove",2)}ua=S=z=null;c.enabled=sa=n=ga=xa=P=Q=y=c.swfLoaded=!1;c.soundIDs=c.sounds=[];i=null;for(b in B)if(B.hasOwnProperty(b))for(a=B[b].length;a--;)B[b][a].fired=!1;c._wD("soundManager: Rebooting...");j.setTimeout(c.beginDelayedInit,20)};this.getMoviePercent=function(){return i&&"undefined"!==typeof i.PercentLoaded?i.PercentLoaded():null};this.beginDelayedInit=function(){Y=!0;J();setTimeout(function(){if(xa)return!1; |
| 35 | +ca();aa();return xa=!0},20);Z()};this.destruct=function(){c._wD("soundManager.destruct()");c.disable(!0)};Ea=function(b){var a=this,d,f,e,h,g,Ya,j=!1,x=[],l=0,n,r,p=null,t=null,u=null;this.sID=b.id;this.url=b.url;this._iO=this.instanceOptions=this.options=v(b);this.pan=this.options.pan;this.volume=this.options.volume;this.isHTML5=!1;this._a=null;this.id3={};this._debug=function(){if(c.debugMode){var b=null,e=[],d,f;for(b in a.options)null!==a.options[b]&&(a.options[b]instanceof Function?(d=a.options[b].toString(), |
| 36 | +d=d.replace(/\s\s+/g," "),f=d.indexOf("{"),e.push(" "+b+": {"+d.substr(f+1,Math.min(Math.max(d.indexOf("\n")-1,64),64)).replace(/\n/g,"")+"... }")):e.push(" "+b+": "+a.options[b]));c._wD("SMSound() merged options: {\n"+e.join(", \n")+"\n}")}};this._debug();this.load=function(b){var d=null;if("undefined"!==typeof b)a._iO=v(b,a.options),a.instanceOptions=a._iO;else if(b=a.options,a._iO=b,a.instanceOptions=a._iO,p&&p!==a.url)o("manURL"),a._iO.url=a.url,a.url=null;if(!a._iO.url)a._iO.url=a.url;a._iO.url= |
| 37 | +ia(a._iO.url);c._wD("SMSound.load(): "+a._iO.url,1);if(a._iO.url===a.url&&0!==a.readyState&&2!==a.readyState)return o("onURL",1),3===a.readyState&&a._iO.onload&&a._iO.onload.apply(a,[!!a.duration]),a;b=a._iO;p=a.url;a.loaded=!1;a.readyState=1;a.playState=0;if(ja(b))d=a._setup_html5(b),d._called_load?c._wD(k+"ignoring request to load again: "+a.sID):(c._wD(k+"load: "+a.sID),a._html5_canplay=!1,a._a.autobuffer="auto",a._a.preload="auto",d.load(),d._called_load=!0,b.autoPlay&&a.play());else try{a.isHTML5= |
| 38 | +!1,a._iO=fa(ea(b)),b=a._iO,8===m?i._load(a.sID,b.url,b.stream,b.autoPlay,b.whileloading?1:0,b.loops||1,b.usePolicyFile):i._load(a.sID,b.url,!!b.stream,!!b.autoPlay,b.loops||1,!!b.autoLoad,b.usePolicyFile)}catch(e){o("smError",2),w("onload",!1),K({type:"SMSOUND_LOAD_JS_EXCEPTION",fatal:!0})}return a};this.unload=function(){0!==a.readyState&&(c._wD('SMSound.unload(): "'+a.sID+'"'),a.isHTML5?(h(),a._a&&(a._a.pause(),ya(a._a))):8===m?i._unload(a.sID,"about:blank"):i._unload(a.sID),d());return a};this.destruct= |
| 39 | +function(b){c._wD('SMSound.destruct(): "'+a.sID+'"');if(a.isHTML5){if(h(),a._a)a._a.pause(),ya(a._a),F||e(),a._a._t=null,a._a=null}else a._iO.onfailure=null,i._destroySound(a.sID);b||c.destroySound(a.sID,!0)};this.start=this.play=function(b,d){var e,d=void 0===d?!0:d;b||(b={});a._iO=v(b,a._iO);a._iO=v(a._iO,a.options);a._iO.url=ia(a._iO.url);a.instanceOptions=a._iO;if(a._iO.serverURL&&!a.connected)return a.getAutoPlay()||(c._wD("SMSound.play(): Netstream not connected yet - setting autoPlay"),a.setAutoPlay(!0)), |
| 40 | +a;ja(a._iO)&&(a._setup_html5(a._iO),g());if(1===a.playState&&!a.paused)if(e=a._iO.multiShot)c._wD('SMSound.play(): "'+a.sID+'" already playing (multi-shot)',1);else return c._wD('SMSound.play(): "'+a.sID+'" already playing (one-shot)',1),a;if(a.loaded)c._wD('SMSound.play(): "'+a.sID+'"');else if(0===a.readyState){c._wD('SMSound.play(): Attempting to load "'+a.sID+'"',1);if(!a.isHTML5)a._iO.autoPlay=!0;a.load(a._iO)}else{if(2===a.readyState)return c._wD('SMSound.play(): Could not load "'+a.sID+'" - exiting', |
| 41 | +2),a;c._wD('SMSound.play(): "'+a.sID+'" is loading - attempting to play..',1)}if(!a.isHTML5&&9===m&&0<a.position&&a.position===a.duration)c._wD('SMSound.play(): "'+a.sID+'": Sound at end, resetting to position:0'),b.position=0;if(a.paused&&a.position&&0<a.position)c._wD('SMSound.play(): "'+a.sID+'" is resuming from paused state',1),a.resume();else{a._iO=v(b,a._iO);if(null!==a._iO.from&&null!==a._iO.to&&0===a.instanceCount&&0===a.playState&&!a._iO.serverURL){e=function(){a._iO=v(b,a._iO);a.play(a._iO)}; |
| 42 | +if(a.isHTML5&&!a._html5_canplay)return c._wD('SMSound.play(): Beginning load of "'+a.sID+'" for from/to case'),a.load({_oncanplay:e}),!1;if(!a.isHTML5&&!a.loaded&&(!a.readyState||2!==a.readyState))return c._wD('SMSound.play(): Preloading "'+a.sID+'" for from/to case'),a.load({onload:e}),!1;a._iO=r()}c._wD('SMSound.play(): "'+a.sID+'" is starting to play');(!a.instanceCount||a._iO.multiShotEvents||!a.isHTML5&&8<m&&!a.getAutoPlay())&&a.instanceCount++;0===a.playState&&a._iO.onposition&&Ya(a);a.playState= |
| 43 | +1;a.paused=!1;a.position="undefined"!==typeof a._iO.position&&!isNaN(a._iO.position)?a._iO.position:0;if(!a.isHTML5)a._iO=fa(ea(a._iO));a._iO.onplay&&d&&(a._iO.onplay.apply(a),j=!0);a.setVolume(a._iO.volume,!0);a.setPan(a._iO.pan,!0);a.isHTML5?(g(),e=a._setup_html5(),a.setPosition(a._iO.position),e.play()):i._start(a.sID,a._iO.loops||1,9===m?a._iO.position:a._iO.position/1E3)}return a};this.stop=function(c){var b=a._iO;if(1===a.playState){a._onbufferchange(0);a._resetOnPosition(0);a.paused=!1;if(!a.isHTML5)a.playState= |
| 44 | +0;n();b.to&&a.clearOnPosition(b.to);if(a.isHTML5){if(a._a)c=a.position,a.setPosition(0),a.position=c,a._a.pause(),a.playState=0,a._onTimer(),h()}else i._stop(a.sID,c),b.serverURL&&a.unload();a.instanceCount=0;a._iO={};b.onstop&&b.onstop.apply(a)}return a};this.setAutoPlay=function(b){c._wD("sound "+a.sID+" turned autoplay "+(b?"on":"off"));a._iO.autoPlay=b;a.isHTML5||(i._setAutoPlay(a.sID,b),b&&!a.instanceCount&&1===a.readyState&&(a.instanceCount++,c._wD("sound "+a.sID+" incremented instance count to "+ |
| 45 | +a.instanceCount)))};this.getAutoPlay=function(){return a._iO.autoPlay};this.setPosition=function(b){void 0===b&&(b=0);var d=a.isHTML5?Math.max(b,0):Math.min(a.duration||a._iO.duration,Math.max(b,0));a.position=d;b=a.position/1E3;a._resetOnPosition(a.position);a._iO.position=d;if(a.isHTML5){if(a._a)if(a._html5_canplay){if(a._a.currentTime!==b){c._wD("setPosition("+b+"): setting position");try{a._a.currentTime=b,(0===a.playState||a.paused)&&a._a.pause()}catch(e){c._wD("setPosition("+b+"): setting position failed: "+ |
| 46 | +e.message,2)}}}else c._wD("setPosition("+b+"): delaying, sound not ready")}else b=9===m?a.position:b,a.readyState&&2!==a.readyState&&i._setPosition(a.sID,b,a.paused||!a.playState);a.isHTML5&&a.paused&&a._onTimer(!0);return a};this.pause=function(b){if(a.paused||0===a.playState&&1!==a.readyState)return a;c._wD("SMSound.pause()");a.paused=!0;a.isHTML5?(a._setup_html5().pause(),h()):(b||void 0===b)&&i._pause(a.sID);a._iO.onpause&&a._iO.onpause.apply(a);return a};this.resume=function(){var b=a._iO;if(!a.paused)return a; |
| 47 | +c._wD("SMSound.resume()");a.paused=!1;a.playState=1;a.isHTML5?(a._setup_html5().play(),g()):(b.isMovieStar&&!b.serverURL&&a.setPosition(a.position),i._pause(a.sID));j&&b.onplay?(b.onplay.apply(a),j=!0):b.onresume&&b.onresume.apply(a);return a};this.togglePause=function(){c._wD("SMSound.togglePause()");if(0===a.playState)return a.play({position:9===m&&!a.isHTML5?a.position:a.position/1E3}),a;a.paused?a.resume():a.pause();return a};this.setPan=function(b,c){"undefined"===typeof b&&(b=0);"undefined"=== |
| 48 | +typeof c&&(c=!1);a.isHTML5||i._setPan(a.sID,b);a._iO.pan=b;if(!c)a.pan=b,a.options.pan=b;return a};this.setVolume=function(b,d){"undefined"===typeof b&&(b=100);"undefined"===typeof d&&(d=!1);if(a.isHTML5){if(a._a)a._a.volume=Math.max(0,Math.min(1,b/100))}else i._setVolume(a.sID,c.muted&&!a.muted||a.muted?0:b);a._iO.volume=b;if(!d)a.volume=b,a.options.volume=b;return a};this.mute=function(){a.muted=!0;if(a.isHTML5){if(a._a)a._a.muted=!0}else i._setVolume(a.sID,0);return a};this.unmute=function(){a.muted= |
| 49 | +!1;var b="undefined"!==typeof a._iO.volume;if(a.isHTML5){if(a._a)a._a.muted=!1}else i._setVolume(a.sID,b?a._iO.volume:a.options.volume);return a};this.toggleMute=function(){return a.muted?a.unmute():a.mute()};this.onposition=this.onPosition=function(b,c,d){x.push({position:b,method:c,scope:"undefined"!==typeof d?d:a,fired:!1});return a};this.clearOnPosition=function(a,b){var c,a=parseInt(a,10);if(isNaN(a))return!1;for(c=0;c<x.length;c++)if(a===x[c].position&&(!b||b===x[c].method))x[c].fired&&l--, |
| 50 | +x.splice(c,1)};this._processOnPosition=function(){var b,c;b=x.length;if(!b||!a.playState||l>=b)return!1;for(;b--;)if(c=x[b],!c.fired&&a.position>=c.position)c.fired=!0,l++,c.method.apply(c.scope,[c.position]);return!0};this._resetOnPosition=function(a){var b,c;b=x.length;if(!b)return!1;for(;b--;)if(c=x[b],c.fired&&a<=c.position)c.fired=!1,l--;return!0};r=function(){var b=a._iO,d=b.from,e=b.to,f,g;g=function(){c._wD(a.sID+': "to" time of '+e+" reached.");a.clearOnPosition(e,g);a.stop()};f=function(){c._wD(a.sID+ |
| 51 | +': playing "from" '+d);if(null!==e&&!isNaN(e))a.onPosition(e,g)};if(null!==d&&!isNaN(d))b.position=d,b.multiShot=!1,f();return b};Ya=function(){var b=a._iO.onposition;if(b)for(var c in b)if(b.hasOwnProperty(c))a.onPosition(parseInt(c,10),b[c])};n=function(){var b=a._iO.onposition;if(b)for(var c in b)b.hasOwnProperty(c)&&a.clearOnPosition(parseInt(c,10))};g=function(){a.isHTML5&&Ka(a)};h=function(){a.isHTML5&&La(a)};d=function(){x=[];l=0;j=!1;a._hasTimer=null;a._a=null;a._html5_canplay=!1;a.bytesLoaded= |
| 52 | +null;a.bytesTotal=null;a.duration=a._iO&&a._iO.duration?a._iO.duration:null;a.durationEstimate=null;a.eqData=[];a.eqData.left=[];a.eqData.right=[];a.failures=0;a.isBuffering=!1;a.instanceOptions={};a.instanceCount=0;a.loaded=!1;a.metadata={};a.readyState=0;a.muted=!1;a.paused=!1;a.peakData={left:0,right:0};a.waveformData={left:[],right:[]};a.playState=0;a.position=null};d();this._onTimer=function(b){var c,d=!1,e={};if(a._hasTimer||b){if(a._a&&(b||(0<a.playState||1===a.readyState)&&!a.paused)){c=a._get_html5_duration(); |
| 53 | +if(c!==t)t=c,a.duration=c,d=!0;a.durationEstimate=a.duration;c=1E3*a._a.currentTime||0;c!==u&&(u=c,d=!0);(d||b)&&a._whileplaying(c,e,e,e,e);return d}return!1}};this._get_html5_duration=function(){var b=a._iO,c=a._a?1E3*a._a.duration:b?b.duration:void 0;return c&&!isNaN(c)&&Infinity!==c?c:b?b.duration:null};this._setup_html5=function(b){var b=v(a._iO,b),e=decodeURI,g=F?c._global_a:a._a,h=e(b.url),i=g&&g._t?g._t.instanceOptions:null;if(g){if(g._t&&(!F&&h===e(p)||F&&i.url===b.url&&(!p||p===i.url)))return g; |
| 54 | +c._wD("setting new URL on existing object: "+h+(p?", old URL: "+p:""));F&&g._t&&g._t.playState&&b.url!==i.url&&g._t.stop();d();g.src=b.url;p=a.url=b.url;g._called_load=!1}else{c._wD("creating HTML5 Audio() element with URL: "+h);g=new Audio(b.url);g._called_load=!1;if(bb)g._called_load=!0;if(F)c._global_a=g}a.isHTML5=!0;a._a=g;g._t=a;f();g.loop=1<b.loops?"loop":"";b.autoLoad||b.autoPlay?a.load():(g.autobuffer=!1,g.preload="none");g.loop=1<b.loops?"loop":"";return g};f=function(){if(a._a._added_events)return!1; |
| 55 | +var b;c._wD(k+"adding event listeners: "+a.sID);a._a._added_events=!0;for(b in A)A.hasOwnProperty(b)&&a._a&&a._a.addEventListener(b,A[b],!1);return!0};e=function(){var b;c._wD(k+"removing event listeners: "+a.sID);a._a._added_events=!1;for(b in A)A.hasOwnProperty(b)&&a._a&&a._a.removeEventListener(b,A[b],!1)};this._onload=function(b){var d,b=!!b;c._wD(d+'"'+a.sID+'"'+(b?" loaded.":" failed to load? - "+a.url),b?1:2);d="SMSound._onload(): ";!b&&!a.isHTML5&&(!0===c.sandbox.noRemote&&c._wD(d+q("noNet"), |
| 56 | +1),!0===c.sandbox.noLocal&&c._wD(d+q("noLocal"),1));a.loaded=b;a.readyState=b?3:2;a._onbufferchange(0);a._iO.onload&&a._iO.onload.apply(a,[b]);return!0};this._onbufferchange=function(b){if(0===a.playState||b&&a.isBuffering||!b&&!a.isBuffering)return!1;a.isBuffering=1===b;a._iO.onbufferchange&&(c._wD("SMSound._onbufferchange(): "+b),a._iO.onbufferchange.apply(a));return!0};this._onsuspend=function(){a._iO.onsuspend&&(c._wD("SMSound._onsuspend()"),a._iO.onsuspend.apply(a));return!0};this._onfailure= |
| 57 | +function(b,d,e){a.failures++;c._wD('SMSound._onfailure(): "'+a.sID+'" count '+a.failures);if(a._iO.onfailure&&1===a.failures)a._iO.onfailure(a,b,d,e);else c._wD("SMSound._onfailure(): ignoring")};this._onfinish=function(){var b=a._iO.onfinish;a._onbufferchange(0);a._resetOnPosition(0);if(a.instanceCount){a.instanceCount--;if(!a.instanceCount)n(),a.playState=0,a.paused=!1,a.instanceCount=0,a.instanceOptions={},a._iO={},h();if((!a.instanceCount||a._iO.multiShotEvents)&&b)c._wD('SMSound._onfinish(): "'+ |
| 58 | +a.sID+'"'),b.apply(a)}};this._whileloading=function(b,c,d,e){var f=a._iO;a.bytesLoaded=b;a.bytesTotal=c;a.duration=Math.floor(d);a.bufferLength=e;if(f.isMovieStar)a.durationEstimate=a.duration;else if(a.durationEstimate=f.duration?a.duration>f.duration?a.duration:f.duration:parseInt(a.bytesTotal/a.bytesLoaded*a.duration,10),void 0===a.durationEstimate)a.durationEstimate=a.duration;3!==a.readyState&&f.whileloading&&f.whileloading.apply(a)};this._whileplaying=function(b,c,d,e,f){var g=a._iO;if(isNaN(b)|| |
| 59 | +null===b)return!1;a.position=b;a._processOnPosition();if(!a.isHTML5&&8<m){if(g.usePeakData&&"undefined"!==typeof c&&c)a.peakData={left:c.leftPeak,right:c.rightPeak};if(g.useWaveformData&&"undefined"!==typeof d&&d)a.waveformData={left:d.split(","),right:e.split(",")};if(g.useEQData&&"undefined"!==typeof f&&f&&f.leftEQ&&(b=f.leftEQ.split(","),a.eqData=b,a.eqData.left=b,"undefined"!==typeof f.rightEQ&&f.rightEQ))a.eqData.right=f.rightEQ.split(",")}1===a.playState&&(!a.isHTML5&&8===m&&!a.position&&a.isBuffering&& |
| 60 | +a._onbufferchange(0),g.whileplaying&&g.whileplaying.apply(a));return!0};this._onmetadata=function(b,d){c._wD('SMSound._onmetadata(): "'+this.sID+'" metadata received.');var e={},f,g;for(f=0,g=b.length;f<g;f++)e[b[f]]=d[f];a.metadata=e;a._iO.onmetadata&&a._iO.onmetadata.apply(a)};this._onid3=function(b,d){c._wD('SMSound._onid3(): "'+this.sID+'" ID3 data received.');var e=[],f,g;for(f=0,g=b.length;f<g;f++)e[b[f]]=d[f];a.id3=v(a.id3,e);a._iO.onid3&&a._iO.onid3.apply(a)};this._onconnect=function(b){b= |
| 61 | +1===b;c._wD('SMSound._onconnect(): "'+a.sID+'"'+(b?" connected.":" failed to connect? - "+a.url),b?1:2);if(a.connected=b)a.failures=0,s(a.sID)&&(a.getAutoPlay()?a.play(void 0,a.getAutoPlay()):a._iO.autoLoad&&a.load()),a._iO.onconnect&&a._iO.onconnect.apply(a,[b])};this._ondataerror=function(b){0<a.playState&&(c._wD("SMSound._ondataerror(): "+b),a._iO.ondataerror&&a._iO.ondataerror.apply(a))}};ba=function(){return h.body||h._docElement||h.getElementsByTagName("div")[0]};u=function(b){return h.getElementById(b)}; |
| 62 | +v=function(b,a){var d={},f,e;for(f in b)b.hasOwnProperty(f)&&(d[f]=b[f]);f="undefined"===typeof a?c.defaultOptions:a;for(e in f)f.hasOwnProperty(e)&&"undefined"===typeof d[e]&&(d[e]=f[e]);return d};r=function(){function b(a){var a=Pa.call(a),b=a.length;c?(a[1]="on"+a[1],3<b&&a.pop()):3===b&&a.push(!1);return a}function a(a,b){var g=a.shift(),h=[f[b]];if(c)g[h](a[0],a[1]);else g[h].apply(g,a)}var c=j.attachEvent,f={add:c?"attachEvent":"addEventListener",remove:c?"detachEvent":"removeEventListener"}; |
| 63 | +return{add:function(){a(b(arguments),"add")},remove:function(){a(b(arguments),"remove")}}}();A={abort:l(function(){c._wD(k+"abort: "+this._t.sID)}),canplay:l(function(){var b=this._t;if(b._html5_canplay)return!0;b._html5_canplay=!0;c._wD(k+"canplay: "+b.sID+", "+b.url);b._onbufferchange(0);var a=!isNaN(b.position)?b.position/1E3:null;if(b.position&&this.currentTime!==a){c._wD(k+"canplay: setting position to "+a);try{this.currentTime=a}catch(d){c._wD(k+"setting position failed: "+d.message,2)}}b._iO._oncanplay&& |
| 64 | +b._iO._oncanplay()}),load:l(function(){var b=this._t;b.loaded||(b._onbufferchange(0),b._whileloading(b.bytesTotal,b.bytesTotal,b._get_html5_duration()),b._onload(!0))}),emptied:l(function(){c._wD(k+"emptied: "+this._t.sID)}),ended:l(function(){var b=this._t;c._wD(k+"ended: "+b.sID);b._onfinish()}),error:l(function(){c._wD(k+"error: "+this.error.code);this._t._onload(!1)}),loadeddata:l(function(){var b=this._t,a=b.bytesTotal||1;c._wD(k+"loadeddata: "+this._t.sID);if(!b._loaded&&!V)b.duration=b._get_html5_duration(), |
| 65 | +b._whileloading(a,a,b._get_html5_duration()),b._onload(!0)}),loadedmetadata:l(function(){c._wD(k+"loadedmetadata: "+this._t.sID)}),loadstart:l(function(){c._wD(k+"loadstart: "+this._t.sID);this._t._onbufferchange(1)}),play:l(function(){c._wD(k+"play: "+this._t.sID+", "+this._t.url);this._t._onbufferchange(0)}),playing:l(function(){c._wD(k+"playing: "+this._t.sID);this._t._onbufferchange(0)}),progress:l(function(b){var a=this._t;if(a.loaded)return!1;var d,f,e;e=0;var h="progress"===b.type;f=b.target.buffered; |
| 66 | +var g=b.loaded||0,i=b.total||1;if(f&&f.length){for(d=f.length;d--;)e=f.end(d)-f.start(d);g=e/b.target.duration;if(h&&1<f.length){e=[];f=f.length;for(d=0;d<f;d++)e.push(b.target.buffered.start(d)+"-"+b.target.buffered.end(d));c._wD(k+"progress: timeRanges: "+e.join(", "))}h&&!isNaN(g)&&c._wD(k+"progress: "+a.sID+": "+Math.floor(100*g)+"% loaded")}isNaN(g)||(a._onbufferchange(0),a._whileloading(g,i,a._get_html5_duration()),g&&i&&g===i&&A.load.call(this,b))}),ratechange:l(function(){c._wD(k+"ratechange: "+ |
| 67 | +this._t.sID)}),suspend:l(function(b){var a=this._t;c._wD(k+"suspend: "+a.sID);A.progress.call(this,b);a._onsuspend()}),stalled:l(function(){c._wD(k+"stalled: "+this._t.sID)}),timeupdate:l(function(){this._t._onTimer()}),waiting:l(function(){var b=this._t;c._wD(k+"waiting: "+b.sID);b._onbufferchange(1)})};ja=function(b){return!b.serverURL&&(b.type?U({type:b.type}):U({url:b.url})||c.html5Only)};ya=function(b){if(b)b.src=ab?"":"about:blank"};U=function(b){function a(a){return c.preferFlash&&t&&!c.ignoreFlash&& |
| 68 | +"undefined"!==typeof c.flash[a]&&c.flash[a]}if(!c.useHTML5Audio||!c.hasHTML5)return!1;var d=b.url||null,b=b.type||null,f=c.audioFormats,e;if(b&&"undefined"!==c.html5[b])return c.html5[b]&&!a(b);if(!C){C=[];for(e in f)f.hasOwnProperty(e)&&(C.push(e),f[e].related&&(C=C.concat(f[e].related)));C=RegExp("\\.("+C.join("|")+")(\\?.*)?$","i")}e=d?d.toLowerCase().match(C):null;if(!e||!e.length)if(b)d=b.indexOf(";"),e=(-1!==d?b.substr(0,d):b).substr(6);else return!1;else e=e[1];if(e&&"undefined"!==typeof c.html5[e])return c.html5[e]&& |
| 69 | +!a(e);b="audio/"+e;d=c.html5.canPlayType({type:b});return(c.html5[e]=d)&&c.html5[b]&&!a(b)};Oa=function(){function b(b){var d,e,f=!1;if(!a||"function"!==typeof a.canPlayType)return!1;if(b instanceof Array){for(d=0,e=b.length;d<e&&!f;d++)if(c.html5[b[d]]||a.canPlayType(b[d]).match(c.html5Test))f=!0,c.html5[b[d]]=!0,c.flash[b[d]]=!(!c.preferFlash||!t||!b[d].match(Ua));return f}b=a&&"function"===typeof a.canPlayType?a.canPlayType(b):!1;return!(!b||!b.match(c.html5Test))}if(!c.useHTML5Audio||"undefined"=== |
| 70 | +typeof Audio)return!1;var a="undefined"!==typeof Audio?db?new Audio(null):new Audio:null,d,f={},e,h;e=c.audioFormats;for(d in e)if(e.hasOwnProperty(d)&&(f[d]=b(e[d].type),f["audio/"+d]=f[d],c.flash[d]=c.preferFlash&&!c.ignoreFlash&&d.match(Ua)?!0:!1,e[d]&&e[d].related))for(h=e[d].related.length;h--;)f["audio/"+e[d].related[h]]=f[d],c.html5[e[d].related[h]]=f[d],c.flash[e[d].related[h]]=f[d];f.canPlayType=a?b:null;c.html5=v(c.html5,f);return!0};$={notReady:"Not loaded yet - wait for soundManager.onload()/onready()", |
| 71 | +notOK:"Audio support is not available.",domError:"soundManager::createMovie(): appendChild/innerHTML call failed. DOM not ready or other error.",spcWmode:"soundManager::createMovie(): Removing wmode, preventing known SWF loading issue(s)",swf404:"soundManager: Verify that %s is a valid path.",tryDebug:"Try soundManager.debugFlash = true for more security details (output goes to SWF.)",checkSWF:"See SWF output for more debug info.",localFail:"soundManager: Non-HTTP page ("+h.location.protocol+" URL?) Review Flash player security settings for this special case:\nhttp://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html\nMay need to add/allow path, eg. c:/sm2/ or /users/me/sm2/", |
| 72 | +waitFocus:"soundManager: Special case: Waiting for focus-related event..",waitImpatient:"soundManager: Getting impatient, still waiting for Flash%s...",waitForever:"soundManager: Waiting indefinitely for Flash (will recover if unblocked)...",needFunction:"soundManager: Function object expected for %s",badID:'Warning: Sound ID "%s" should be a string, starting with a non-numeric character',currentObj:"--- soundManager._debug(): Current sound objects ---",waitEI:"soundManager::initMovie(): Waiting for ExternalInterface call from Flash..", |
| 73 | +waitOnload:"soundManager: Waiting for window.onload()",docLoaded:"soundManager: Document already loaded",onload:"soundManager::initComplete(): calling soundManager.onload()",onloadOK:"soundManager.onload() complete",init:"soundManager::init()",didInit:"soundManager::init(): Already called?",flashJS:"soundManager: Attempting to call Flash from JS..",secNote:"Flash security note: Network/internet URLs will not load due to security restrictions. Access can be configured via Flash Player Global Security Settings Page: http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html", |
| 74 | +badRemove:"Warning: Failed to remove flash movie.",noPeak:"Warning: peakData features unsupported for movieStar formats",shutdown:"soundManager.disable(): Shutting down",queue:"soundManager: Queueing %s handler",smFail:"soundManager: Failed to initialise.",smError:"SMSound.load(): Exception: JS-Flash communication failed, or JS error.",fbTimeout:"No flash response, applying .swf_timedout CSS..",fbLoaded:"Flash loaded",fbHandler:"soundManager::flashBlockHandler()",manURL:"SMSound.load(): Using manually-assigned URL", |
75 | 75 | onURL:"soundManager.load(): current URL already assigned.",badFV:'soundManager.flashVersion must be 8 or 9. "%s" is invalid. Reverting to %s.',as2loop:"Note: Setting stream:false so looping can work (flash 8 limitation)",noNSLoop:"Note: Looping not implemented for MovieStar formats",needfl9:"Note: Switching to flash 9, required for MP4 formats.",mfTimeout:"Setting flashLoadTimeout = 0 (infinite) for off-screen, mobile flash case",mfOn:"mobileFlash::enabling on-screen flash repositioning",policy:"Enabling usePolicyFile for data access"}; |
76 | | -n=function(){var b=Ia.call(arguments),a=b.shift(),a=W&&W[a]?W[a]:"",c,f;if(a&&b&&b.length)for(c=0,f=b.length;c<f;c++)a=a.replace("%s",b[c]);return a};aa=function(b){if(j===8&&b.loops>1&&b.stream)l("as2loop"),b.stream=false;return b};ba=function(b,a){if(b&&!b.usePolicyFile&&(b.onid3||b.usePeakData||b.useWaveformData||b.useEQData))c._wD((a||"")+n("policy")),b.usePolicyFile=true;return b};pa=function(b){typeof console!=="undefined"&&typeof console.warn!=="undefined"?console.warn(b):c._wD(b)};ga=function(){return false}; |
77 | | -Ba=function(b){for(var a in b)b.hasOwnProperty(a)&&typeof b[a]==="function"&&(b[a]=ga)};$=function(b){typeof b==="undefined"&&(b=false);if(v||b)l("smFail",2),c.disable(b)};Ca=function(b){var a=null;if(b)if(b.match(/\.swf(\?.*)?$/i)){if(a=b.substr(b.toLowerCase().lastIndexOf(".swf?")+4))return b}else b.lastIndexOf("/")!==b.length-1&&(b+="/");b=(b&&b.lastIndexOf("/")!==-1?b.substr(0,b.lastIndexOf("/")+1):"./")+c.movieURL;c.noSWFCache&&(b+="?ts="+(new Date).getTime());return b};ka=function(){j=parseInt(c.flashVersion, |
78 | | -10);if(j!==8&&j!==9)c._wD(n("badFV",j,8)),c.flashVersion=j=8;var b=c.debugMode||c.debugFlash?"_debug.swf":".swf";if(c.useHTML5Audio&&!c.html5Only&&c.audioFormats.mp4.required&&j<9)c._wD(n("needfl9")),c.flashVersion=j=9;c.version=c.versionNumber+(c.html5Only?" (HTML5-only mode)":j===9?" (AS3/Flash 9)":" (AS2/Flash 8)");j>8?(c.defaultOptions=s(c.defaultOptions,c.flash9Options),c.features.buffering=true,c.defaultOptions=s(c.defaultOptions,c.movieStarOptions),c.filePatterns.flash9=RegExp("\\.(mp3|"+Pa.join("|")+ |
79 | | -")(\\?.*)?$","i"),c.features.movieStar=true):c.features.movieStar=false;c.filePattern=c.filePatterns[j!==8?"flash9":"flash8"];c.movieURL=(j===8?"soundmanager2.swf":"soundmanager2_flash9.swf").replace(".swf",b);c.features.peakData=c.features.waveformData=c.features.eqData=j>8};Aa=function(b,a){if(!c.o)return false;c.o._setPolling(b,a)};ma=function(){if(c.debugURLParam.test(K))c.debugMode=true;if(u(c.debugID))return false;var b,a,e,f;if(c.debugMode&&!u(c.debugID)&&(!va||!c.useConsole||c.useConsole&& |
80 | | -va&&!c.consoleOnly)){b=g.createElement("div");b.id=c.debugID+"-toggle";a={position:"fixed",bottom:"0px",right:"0px",width:"1.2em",height:"1.2em",lineHeight:"1.2em",margin:"2px",textAlign:"center",border:"1px solid #999",cursor:"pointer",background:"#fff",color:"#333",zIndex:10001};b.appendChild(g.createTextNode("-"));b.onclick=Da;b.title="Toggle SM2 debug console";if(q.match(/msie 6/i))b.style.position="absolute",b.style.cursor="hand";for(f in a)a.hasOwnProperty(f)&&(b.style[f]=a[f]);a=g.createElement("div"); |
81 | | -a.id=c.debugID;a.style.display=c.debugMode?"block":"none";if(c.debugMode&&!u(b.id)){try{e=Y(),e.appendChild(b)}catch(d){throw Error(n("domError")+" \n"+d.toString());}e.appendChild(a)}}};o=this.getSoundById;l=function(b,a){return b?c._wD(n(b),a):""};if(K.indexOf("sm2-debug=alert")+1&&c.debugMode)c._wD=function(b){S.alert(b)};Da=function(){var b=u(c.debugID),a=u(c.debugID+"-toggle");if(!b)return false;ha?(a.innerHTML="+",b.style.display="none"):(a.innerHTML="-",b.style.display="block");ha=!ha};r=function(b, |
82 | | -a,c){if(typeof sm2Debugger!=="undefined")try{sm2Debugger.handleEvent(b,a,c)}catch(f){}return true};G=function(){var b=[];c.debugMode&&b.push(c.swfCSS.sm2Debug);c.debugFlash&&b.push(c.swfCSS.flashDebug);c.useHighPerformance&&b.push(c.swfCSS.highPerf);return b.join(" ")};oa=function(){var b=n("fbHandler"),a=c.getMoviePercent(),e=c.swfCSS,f={type:"FLASHBLOCK"};if(c.html5Only)return false;if(c.ok()){if(c.didFlashBlock&&c._wD(b+": Unblocked"),c.oMC)c.oMC.className=[G(),e.swfDefault,e.swfLoaded+(c.didFlashBlock? |
83 | | -" "+e.swfUnblocked:"")].join(" ")}else{if(w)c.oMC.className=G()+" "+e.swfDefault+" "+(a===null?e.swfTimedout:e.swfError),c._wD(b+": "+n("fbTimeout")+(a?" ("+n("fbLoaded")+")":""));c.didFlashBlock=true;C({type:"ontimeout",ignoreInit:true,error:f});F(f)}};ja=function(b,a,c){typeof y[b]==="undefined"&&(y[b]=[]);y[b].push({method:a,scope:c||null,fired:false})};C=function(b){b||(b={type:"onready"});if(!m&&b&&!b.ignoreInit)return false;if(b.type==="ontimeout"&&c.ok())return false;var a={success:b&&b.ignoreInit? |
84 | | -c.ok():!v},e=b&&b.type?y[b.type]||[]:[],f=[],d,g=[a],j=w&&c.useFlashBlock&&!c.ok();if(b.error)g[0].error=b.error;for(a=0,d=e.length;a<d;a++)e[a].fired!==true&&f.push(e[a]);if(f.length){c._wD("soundManager: Firing "+f.length+" "+b.type+"() item"+(f.length===1?"":"s"));for(a=0,d=f.length;a<d;a++)if(f[a].scope?f[a].method.apply(f[a].scope,g):f[a].method.apply(this,g),!j)f[a].fired=true}return true};D=function(){i.setTimeout(function(){c.useFlashBlock&&oa();C();c.onload instanceof Function&&(l("onload", |
85 | | -1),c.onload.apply(i),l("onloadOK",1));c.waitForWindowLoad&&p.add(i,"load",D)},1)};ea=function(){if(t!==void 0)return t;var b=false,a=navigator,c=a.plugins,f,d=i.ActiveXObject;if(c&&c.length)(a=a.mimeTypes)&&a["application/x-shockwave-flash"]&&a["application/x-shockwave-flash"].enabledPlugin&&a["application/x-shockwave-flash"].enabledPlugin.description&&(b=true);else if(typeof d!=="undefined"){try{f=new d("ShockwaveFlash.ShockwaveFlash")}catch(g){}b=!!f}return t=b};Ga=function(){var b,a;if(ta&&q.match(/os (1|2|3_0|3_1)/i)){c.hasHTML5= |
86 | | -false;c.html5Only=true;if(c.oMC)c.oMC.style.display="none";return false}if(c.useHTML5Audio){if(!c.html5||!c.html5.canPlayType)return c._wD("SoundManager: No HTML5 Audio() support detected."),c.hasHTML5=false,true;else c.hasHTML5=true;if(ua&&(c._wD("soundManager::Note: Buggy HTML5 Audio in Safari on this OS X release, see https://bugs.webkit.org/show_bug.cgi?id=32159 - "+(!t?" would use flash fallback for MP3/MP4, but none detected.":"will use flash fallback for MP3/MP4, if available"),1),ea()))return true}else return true; |
87 | | -for(a in c.audioFormats)if(c.audioFormats.hasOwnProperty(a)&&(c.audioFormats[a].required&&!c.html5.canPlayType(c.audioFormats[a].type)||c.flash[a]||c.flash[c.audioFormats[a].type]))b=true;c.ignoreFlash&&(b=false);c.html5Only=c.hasHTML5&&c.useHTML5Audio&&!b;return!c.html5Only};Ea=function(b){if(!b._hasTimer)b._hasTimer=true};Fa=function(b){if(b._hasTimer)b._hasTimer=false};F=function(b){b=typeof b!=="undefined"?b:{};c.onerror instanceof Function&&c.onerror.apply(i,[{type:typeof b.type!=="undefined"? |
88 | | -b.type:null}]);typeof b.fatal!=="undefined"&&b.fatal&&c.disable()};Ja=function(){if(!ua||!ea())return false;var b=c.audioFormats,a,e;for(e in b)if(b.hasOwnProperty(e)&&(e==="mp3"||e==="mp4"))if(c._wD("soundManager: Using flash fallback for "+e+" format"),c.html5[e]=false,b[e]&&b[e].related)for(a=b[e].related.length;a--;)c.html5[b[e].related[a]]=false};this._setSandboxType=function(b){var a=c.sandbox;a.type=b;a.description=a.types[typeof a.types[b]!=="undefined"?b:"unknown"];c._wD("Flash security sandbox type: "+ |
89 | | -a.type);if(a.type==="localWithFile")a.noRemote=true,a.noLocal=false,l("secNote",2);else if(a.type==="localWithNetwork")a.noRemote=false,a.noLocal=true;else if(a.type==="localTrusted")a.noRemote=false,a.noLocal=false};this._externalInterfaceOK=function(b){if(c.swfLoaded)return false;var a=(new Date).getTime();c._wD("soundManager::externalInterfaceOK()"+(b?" (~"+(a-b)+" ms)":""));r("swf",true);r("flashtojs",true);c.swfLoaded=true;H=false;ua&&Ja();A?setTimeout(U,100):U()};Z=function(b,a){function e(){c._wD("-- SoundManager 2 "+ |
90 | | -c.version+(!c.html5Only&&c.useHTML5Audio?c.hasHTML5?" + HTML5 audio":", no HTML5 audio support":"")+(!c.html5Only?(c.useHighPerformance?", high performance mode, ":", ")+((c.flashPollingInterval?"custom ("+c.flashPollingInterval+"ms)":"normal")+" polling")+(c.wmode?", wmode: "+c.wmode:"")+(c.debugFlash?", flash debug mode":"")+(c.useFlashBlock?", flashBlock mode":""):"")+" --",1)}function f(a,b){return'<param name="'+a+'" value="'+b+'" />'}if(L&&M)return false;if(c.html5Only)return ka(),e(),c.oMC= |
91 | | -u(c.movieID),U(),M=L=true,false;var d=a||c.url,j=c.altURL||d,h;h=Y();var i,o,k=G(),m,p=null,p=(p=g.getElementsByTagName("html")[0])&&p.dir&&p.dir.match(/rtl/i),b=typeof b==="undefined"?c.id:b;ka();c.url=Ca(I?d:j);a=c.url;c.wmode=!c.wmode&&c.useHighPerformance?"transparent":c.wmode;if(c.wmode!==null&&(q.match(/msie 8/i)||!A&&!c.useHighPerformance)&&navigator.platform.match(/win32|win64/i))c.specialWmodeCase=true,l("spcWmode"),c.wmode=null;h={name:b,id:b,src:a,width:"auto",height:"auto",quality:"high", |
92 | | -allowScriptAccess:c.allowScriptAccess,bgcolor:c.bgColor,pluginspage:Na+"www.macromedia.com/go/getflashplayer",title:"JS/Flash audio component (SoundManager 2)",type:"application/x-shockwave-flash",wmode:c.wmode,hasPriority:"true"};if(c.debugFlash)h.FlashVars="debug=1";c.wmode||delete h.wmode;if(A)d=g.createElement("div"),o=['<object id="'+b+'" data="'+a+'" type="'+h.type+'" title="'+h.title+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="'+Na+'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" width="'+ |
93 | | -h.width+'" height="'+h.height+'">',f("movie",a),f("AllowScriptAccess",c.allowScriptAccess),f("quality",h.quality),c.wmode?f("wmode",c.wmode):"",f("bgcolor",c.bgColor),f("hasPriority","true"),c.debugFlash?f("FlashVars",h.FlashVars):"","</object>"].join("");else for(i in d=g.createElement("embed"),h)h.hasOwnProperty(i)&&d.setAttribute(i,h[i]);ma();k=G();if(h=Y())if(c.oMC=u(c.movieID)||g.createElement("div"),c.oMC.id){m=c.oMC.className;c.oMC.className=(m?m+" ":c.swfCSS.swfDefault)+(k?" "+k:"");c.oMC.appendChild(d); |
94 | | -if(A)i=c.oMC.appendChild(g.createElement("div")),i.className=c.swfCSS.swfBox,i.innerHTML=o;M=true}else{c.oMC.id=c.movieID;c.oMC.className=c.swfCSS.swfDefault+" "+k;i=k=null;if(!c.useFlashBlock)if(c.useHighPerformance)k={position:"fixed",width:"8px",height:"8px",bottom:"0px",left:"0px",overflow:"hidden"};else if(k={position:"absolute",width:"6px",height:"6px",top:"-9999px",left:"-9999px"},p)k.left=Math.abs(parseInt(k.left,10))+"px";if(Ua)c.oMC.style.zIndex=1E4;if(!c.debugFlash)for(m in k)k.hasOwnProperty(m)&& |
95 | | -(c.oMC.style[m]=k[m]);try{A||c.oMC.appendChild(d);h.appendChild(c.oMC);if(A)i=c.oMC.appendChild(g.createElement("div")),i.className=c.swfCSS.swfBox,i.innerHTML=o;M=true}catch(r){throw Error(n("domError")+" \n"+r.toString());}}L=true;e();c._wD("soundManager::createMovie(): Trying to load "+a+(!I&&c.altURL?" (alternate URL)":""),1);return true};X=function(){if(c.html5Only)return Z(),false;if(c.o)return false;c.o=c.getMovie(c.id);if(!c.o)O?(A?c.oMC.innerHTML=na:c.oMC.appendChild(O),O=null,L=true):Z(c.id, |
96 | | -c.url),c.o=c.getMovie(c.id);c.o&&l("waitEI");c.oninitmovie instanceof Function&&setTimeout(c.oninitmovie,1);return true};V=function(){setTimeout(za,1E3)};za=function(){if(ca)return false;ca=true;p.remove(i,"load",V);if(H&&!wa)return l("waitFocus"),false;var b;m||(b=c.getMoviePercent(),c._wD(n("waitImpatient",b===100?" (SWF loaded)":b>0?" (SWF "+b+"% loaded)":"")));setTimeout(function(){b=c.getMoviePercent();m||(c._wD("soundManager: No Flash response within expected time.\nLikely causes: "+(b===0? |
97 | | -"Loading "+c.movieURL+" may have failed (and/or Flash "+j+"+ not present?), ":"")+"Flash blocked or JS-Flash security error."+(c.debugFlash?" "+n("checkSWF"):""),2),!I&&b&&(l("localFail",2),c.debugFlash||l("tryDebug",2)),b===0&&c._wD(n("swf404",c.url)),r("flashtojs",false,": Timed out"+I?" (Check flash security or flash blockers)":" (No plugin/missing SWF?)"));!m&&La&&(b===null?c.useFlashBlock||c.flashLoadTimeout===0?(c.useFlashBlock&&oa(),l("waitForever")):$(true):c.flashLoadTimeout===0?l("waitForever"): |
98 | | -$(true))},c.flashLoadTimeout)};B=function(){function b(){p.remove(i,"focus",B);p.remove(i,"load",B)}if(wa||!H)return b(),true;wa=La=true;c._wD("soundManager::handleFocus()");R&&H&&p.remove(i,"mousemove",B);ca=false;b();return true};Ka=function(){var b,a=[];if(c.useHTML5Audio&&c.hasHTML5){for(b in c.audioFormats)c.audioFormats.hasOwnProperty(b)&&a.push(b+": "+c.html5[b]+(!c.html5[b]&&t&&c.flash[b]?" (using flash)":c.preferFlash&&c.flash[b]&&t?" (preferring flash)":!c.html5[b]?" ("+(c.audioFormats[b].required? |
99 | | -"required, ":"")+"and no flash support)":""));c._wD("-- SoundManager 2: HTML5 support tests ("+c.html5Test+"): "+a.join(", ")+" --",1)}};N=function(b){if(m)return false;if(c.html5Only)return c._wD("-- SoundManager 2: loaded --"),m=true,D(),r("onload",true),true;var a;if(!c.useFlashBlock||!c.flashLoadTimeout||c.getMoviePercent())m=true,v&&(a={type:!t&&w?"NO_FLASH":"INIT_TIMEOUT"});c._wD("-- SoundManager 2 "+(v?"failed to load":"loaded")+" ("+(v?"security/load error":"OK")+") --",1);if(v||b){if(c.useFlashBlock&& |
100 | | -c.oMC)c.oMC.className=G()+" "+(c.getMoviePercent()===null?c.swfCSS.swfTimedout:c.swfCSS.swfError);C({type:"ontimeout",error:a});r("onload",false);F(a);return false}else r("onload",true);if(c.waitForWindowLoad&&!ia)return l("waitOnload"),p.add(i,"load",D),false;else c.waitForWindowLoad&&ia&&l("docLoaded"),D();return true};U=function(){l("init");if(m)return l("didInit"),false;if(c.html5Only){if(!m)p.remove(i,"load",c.beginDelayedInit),c.enabled=true,N();return true}X();try{l("flashJS"),c.o._externalInterfaceTest(false), |
101 | | -Aa(true,c.flashPollingInterval||(c.useHighPerformance?10:50)),c.debugMode||c.o._disableDebug(),c.enabled=true,r("jstoflash",true),c.html5Only||p.add(i,"unload",ga)}catch(b){return c._wD("js/flash exception: "+b.toString()),r("jstoflash",false),F({type:"JS_TO_FLASH_EXCEPTION",fatal:true}),$(true),N(),false}N();p.remove(i,"load",c.beginDelayedInit);return true};E=function(){if(la)return false;la=true;ma();var b=K.toLowerCase(),a=null,a=null,e=typeof console!=="undefined"&&typeof console.log!=="undefined"; |
102 | | -if(b.indexOf("sm2-usehtml5audio=")!==-1)a=b.charAt(b.indexOf("sm2-usehtml5audio=")+18)==="1",e&&console.log((a?"Enabling ":"Disabling ")+"useHTML5Audio via URL parameter"),c.useHTML5Audio=a;if(b.indexOf("sm2-preferflash=")!==-1)a=b.charAt(b.indexOf("sm2-preferflash=")+16)==="1",e&&console.log((a?"Enabling ":"Disabling ")+"preferFlash via URL parameter"),c.preferFlash=a;if(!t&&c.hasHTML5)c._wD("SoundManager: No Flash detected"+(!c.useHTML5Audio?", enabling HTML5.":". Trying HTML5-only mode.")),c.useHTML5Audio= |
103 | | -true,c.preferFlash=false;Ha();c.html5.usingFlash=Ga();w=c.html5.usingFlash;Ka();if(!t&&w)c._wD("SoundManager: Fatal error: Flash is needed to play some required formats, but is not available."),c.flashLoadTimeout=1;g.removeEventListener&&g.removeEventListener("DOMContentLoaded",E,false);X();return true};sa=function(){g.readyState==="complete"&&(E(),g.detachEvent("onreadystatechange",sa));return true};ea();p.add(i,"focus",B);p.add(i,"load",B);p.add(i,"load",V);R&&H&&p.add(i,"mousemove",B);g.addEventListener? |
104 | | -g.addEventListener("DOMContentLoaded",E,false):g.attachEvent?g.attachEvent("onreadystatechange",sa):(r("onload",false),F({type:"NO_DOM2_EVENTS",fatal:true}));g.readyState==="complete"&&setTimeout(E,100)}var fa=null;if(typeof SM2_DEFER==="undefined"||!SM2_DEFER)fa=new T;S.SoundManager=T;S.soundManager=fa})(window); |
\ No newline at end of file |
| 76 | +q=function(){var b=Pa.call(arguments),a=b.shift(),a=$&&$[a]?$[a]:"",c,f;if(a&&b&&b.length)for(c=0,f=b.length;c<f;c++)a=a.replace("%s",b[c]);return a};ea=function(b){if(8===m&&1<b.loops&&b.stream)o("as2loop"),b.stream=!1;return b};fa=function(b,a){if(b&&!b.usePolicyFile&&(b.onid3||b.usePeakData||b.useWaveformData||b.useEQData))c._wD((a||"")+q("policy")),b.usePolicyFile=!0;return b};wa=function(b){"undefined"!==typeof console&&"undefined"!==typeof console.warn?console.warn(b):c._wD(b)};na=function(){return!1}; |
| 77 | +Ha=function(b){for(var a in b)b.hasOwnProperty(a)&&"function"===typeof b[a]&&(b[a]=na)};da=function(b){"undefined"===typeof b&&(b=!1);if(y||b)o("smFail",2),c.disable(b)};Ia=function(b){var a=null;if(b)if(b.match(/\.swf(\?.*)?$/i)){if(a=b.substr(b.toLowerCase().lastIndexOf(".swf?")+4))return b}else b.lastIndexOf("/")!==b.length-1&&(b+="/");b=(b&&-1!==b.lastIndexOf("/")?b.substr(0,b.lastIndexOf("/")+1):"./")+c.movieURL;c.noSWFCache&&(b+="?ts="+(new Date).getTime());return b};qa=function(){m=parseInt(c.flashVersion, |
| 78 | +10);if(8!==m&&9!==m)c._wD(q("badFV",m,8)),c.flashVersion=m=8;var b=c.debugMode||c.debugFlash?"_debug.swf":".swf";if(c.useHTML5Audio&&!c.html5Only&&c.audioFormats.mp4.required&&9>m)c._wD(q("needfl9")),c.flashVersion=m=9;c.version=c.versionNumber+(c.html5Only?" (HTML5-only mode)":9===m?" (AS3/Flash 9)":" (AS2/Flash 8)");8<m?(c.defaultOptions=v(c.defaultOptions,c.flash9Options),c.features.buffering=!0,c.defaultOptions=v(c.defaultOptions,c.movieStarOptions),c.filePatterns.flash9=RegExp("\\.(mp3|"+Xa.join("|")+ |
| 79 | +")(\\?.*)?$","i"),c.features.movieStar=!0):c.features.movieStar=!1;c.filePattern=c.filePatterns[8!==m?"flash9":"flash8"];c.movieURL=(8===m?"soundmanager2.swf":"soundmanager2_flash9.swf").replace(".swf",b);c.features.peakData=c.features.waveformData=c.features.eqData=8<m};Ga=function(b,a){if(!i)return!1;i._setPolling(b,a)};ta=function(){if(c.debugURLParam.test(O))c.debugMode=!0;if(u(c.debugID))return!1;var b,a,d,f;if(c.debugMode&&!u(c.debugID)&&(!Sa||!c.useConsole||!c.consoleOnly)){b=h.createElement("div"); |
| 80 | +b.id=c.debugID+"-toggle";a={position:"fixed",bottom:"0px",right:"0px",width:"1.2em",height:"1.2em",lineHeight:"1.2em",margin:"2px",textAlign:"center",border:"1px solid #999",cursor:"pointer",background:"#fff",color:"#333",zIndex:10001};b.appendChild(h.createTextNode("-"));b.onclick=Ja;b.title="Toggle SM2 debug console";if(p.match(/msie 6/i))b.style.position="absolute",b.style.cursor="hand";for(f in a)a.hasOwnProperty(f)&&(b.style[f]=a[f]);a=h.createElement("div");a.id=c.debugID;a.style.display=c.debugMode? |
| 81 | +"block":"none";if(c.debugMode&&!u(b.id)){try{d=ba(),d.appendChild(b)}catch(e){throw Error(q("domError")+" \n"+e.toString());}d.appendChild(a)}}};s=this.getSoundById;o=function(b,a){return b?c._wD(q(b),a):""};if(O.indexOf("sm2-debug=alert")+1&&c.debugMode)c._wD=function(b){G.alert(b)};Ja=function(){var b=u(c.debugID),a=u(c.debugID+"-toggle");if(!b)return!1;oa?(a.innerHTML="+",b.style.display="none"):(a.innerHTML="-",b.style.display="block");oa=!oa};w=function(b,a,c){if("undefined"!==typeof sm2Debugger)try{sm2Debugger.handleEvent(b, |
| 82 | +a,c)}catch(f){}return!0};L=function(){var b=[];c.debugMode&&b.push("sm2_debug");c.debugFlash&&b.push("flash_debug");c.useHighPerformance&&b.push("high_performance");return b.join(" ")};va=function(){var b=q("fbHandler"),a=c.getMoviePercent(),d={type:"FLASHBLOCK"};if(c.html5Only)return!1;if(c.ok()){if(c.didFlashBlock&&c._wD(b+": Unblocked"),c.oMC)c.oMC.className=[L(),"movieContainer","swf_loaded"+(c.didFlashBlock?" swf_unblocked":"")].join(" ")}else{if(z)c.oMC.className=L()+" movieContainer "+(null=== |
| 83 | +a?"swf_timedout":"swf_error"),c._wD(b+": "+q("fbTimeout")+(a?" ("+q("fbLoaded")+")":""));c.didFlashBlock=!0;H({type:"ontimeout",ignoreInit:!0,error:d});K(d)}};pa=function(b,a,c){"undefined"===typeof B[b]&&(B[b]=[]);B[b].push({method:a,scope:c||null,fired:!1})};H=function(b){b||(b={type:"onready"});if(!n&&b&&!b.ignoreInit||"ontimeout"===b.type&&c.ok())return!1;var a={success:b&&b.ignoreInit?c.ok():!y},d=b&&b.type?B[b.type]||[]:[],f=[],e,h=[a],g=z&&c.useFlashBlock&&!c.ok();if(b.error)h[0].error=b.error; |
| 84 | +for(a=0,e=d.length;a<e;a++)!0!==d[a].fired&&f.push(d[a]);if(f.length){c._wD("soundManager: Firing "+f.length+" "+b.type+"() item"+(1===f.length?"":"s"));for(a=0,e=f.length;a<e;a++)if(f[a].scope?f[a].method.apply(f[a].scope,h):f[a].method.apply(this,h),!g)f[a].fired=!0}return!0};I=function(){j.setTimeout(function(){c.useFlashBlock&&va();H();c.onload instanceof Function&&(o("onload",1),c.onload.apply(j),o("onloadOK",1));c.waitForWindowLoad&&r.add(j,"load",I)},1)};ka=function(){if(void 0!==t)return t; |
| 85 | +var b=!1,a=navigator,c=a.plugins,f,e=j.ActiveXObject;if(c&&c.length)(a=a.mimeTypes)&&a["application/x-shockwave-flash"]&&a["application/x-shockwave-flash"].enabledPlugin&&a["application/x-shockwave-flash"].enabledPlugin.description&&(b=!0);else if("undefined"!==typeof e){try{f=new e("ShockwaveFlash.ShockwaveFlash")}catch(h){}b=!!f}return t=b};Na=function(){var b,a;if(Aa&&p.match(/os (1|2|3_0|3_1)/i)){c.hasHTML5=!1;c.html5Only=!0;if(c.oMC)c.oMC.style.display="none";return!1}if(c.useHTML5Audio){if(!c.html5|| |
| 86 | +!c.html5.canPlayType)return c._wD("SoundManager: No HTML5 Audio() support detected."),c.hasHTML5=!1,!0;c.hasHTML5=!0;if(Ca&&(c._wD("soundManager::Note: Buggy HTML5 Audio in Safari on this OS X release, see https://bugs.webkit.org/show_bug.cgi?id=32159 - "+(!t?" would use flash fallback for MP3/MP4, but none detected.":"will use flash fallback for MP3/MP4, if available"),1),ka()))return!0}else return!0;for(a in c.audioFormats)if(c.audioFormats.hasOwnProperty(a)&&(c.audioFormats[a].required&&!c.html5.canPlayType(c.audioFormats[a].type)|| |
| 87 | +c.flash[a]||c.flash[c.audioFormats[a].type]))b=!0;c.ignoreFlash&&(b=!1);c.html5Only=c.hasHTML5&&c.useHTML5Audio&&!b;return!c.html5Only};ia=function(b){var a,d,f=0;if(b instanceof Array){for(a=0,d=b.length;a<d;a++)if(b[a]instanceof Object){if(c.canPlayMIME(b[a].type)){f=a;break}}else if(c.canPlayURL(b[a])){f=a;break}if(b[f].url)b[f]=b[f].url;return b[f]}return b};Ka=function(b){if(!b._hasTimer)b._hasTimer=!0,!Ba&&c.html5PollingInterval&&(null===T&&0===ha&&(T=G.setInterval(Ma,c.html5PollingInterval)), |
| 88 | +ha++)};La=function(b){if(b._hasTimer)b._hasTimer=!1,!Ba&&c.html5PollingInterval&&ha--};Ma=function(){var b;if(null!==T&&!ha)return G.clearInterval(T),T=null,!1;for(b=c.soundIDs.length;b--;)c.sounds[c.soundIDs[b]].isHTML5&&c.sounds[c.soundIDs[b]]._hasTimer&&c.sounds[c.soundIDs[b]]._onTimer()};K=function(b){b="undefined"!==typeof b?b:{};c.onerror instanceof Function&&c.onerror.apply(j,[{type:"undefined"!==typeof b.type?b.type:null}]);"undefined"!==typeof b.fatal&&b.fatal&&c.disable()};Qa=function(){if(!Ca|| |
| 89 | +!ka())return!1;var b=c.audioFormats,a,d;for(d in b)if(b.hasOwnProperty(d)&&("mp3"===d||"mp4"===d))if(c._wD("soundManager: Using flash fallback for "+d+" format"),c.html5[d]=!1,b[d]&&b[d].related)for(a=b[d].related.length;a--;)c.html5[b[d].related[a]]=!1};this._setSandboxType=function(b){var a=c.sandbox;a.type=b;a.description=a.types["undefined"!==typeof a.types[b]?b:"unknown"];c._wD("Flash security sandbox type: "+a.type);if("localWithFile"===a.type)a.noRemote=!0,a.noLocal=!1,o("secNote",2);else if("localWithNetwork"=== |
| 90 | +a.type)a.noRemote=!1,a.noLocal=!0;else if("localTrusted"===a.type)a.noRemote=!1,a.noLocal=!1};this._externalInterfaceOK=function(b,a){if(c.swfLoaded)return!1;var d,f=(new Date).getTime();c._wD("soundManager::externalInterfaceOK()"+(b?" (~"+(f-b)+" ms)":""));w("swf",!0);w("flashtojs",!0);c.swfLoaded=!0;M=!1;Ca&&Qa();if(!a||a.replace(/\+dev/i,"")!==c.versionNumber.replace(/\+dev/i,""))return d='soundManager: Fatal: JavaScript file build "'+c.versionNumber+'" does not match Flash SWF build "'+a+'" at '+ |
| 91 | +c.url+". Ensure both are up-to-date.",setTimeout(function(){throw Error(d);},0),!1;D?setTimeout(X,100):X()};ca=function(b,a){function d(){c._wD("-- SoundManager 2 "+c.version+(!c.html5Only&&c.useHTML5Audio?c.hasHTML5?" + HTML5 audio":", no HTML5 audio support":"")+(!c.html5Only?(c.useHighPerformance?", high performance mode, ":", ")+((c.flashPollingInterval?"custom ("+c.flashPollingInterval+"ms)":"normal")+" polling")+(c.wmode?", wmode: "+c.wmode:"")+(c.debugFlash?", flash debug mode":"")+(c.useFlashBlock? |
| 92 | +", flashBlock mode":""):"")+" --",1)}function f(a,b){return'<param name="'+a+'" value="'+b+'" />'}if(P&&Q)return!1;if(c.html5Only)return qa(),d(),c.oMC=u(c.movieID),X(),Q=P=!0,!1;var e=a||c.url,i=c.altURL||e,g;g=ba();var j,m,k=L(),l,n=null,n=(n=h.getElementsByTagName("html")[0])&&n.dir&&n.dir.match(/rtl/i),b="undefined"===typeof b?c.id:b;qa();c.url=Ia(N?e:i);a=c.url;c.wmode=!c.wmode&&c.useHighPerformance?"transparent":c.wmode;if(null!==c.wmode&&(p.match(/msie 8/i)||!D&&!c.useHighPerformance)&&navigator.platform.match(/win32|win64/i))o("spcWmode"), |
| 93 | +c.wmode=null;g={name:b,id:b,src:a,width:"auto",height:"auto",quality:"high",allowScriptAccess:c.allowScriptAccess,bgcolor:c.bgColor,pluginspage:Va+"www.macromedia.com/go/getflashplayer",title:"JS/Flash audio component (SoundManager 2)",type:"application/x-shockwave-flash",wmode:c.wmode,hasPriority:"true"};if(c.debugFlash)g.FlashVars="debug=1";c.wmode||delete g.wmode;if(D)e=h.createElement("div"),m=['<object id="'+b+'" data="'+a+'" type="'+g.type+'" title="'+g.title+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="'+ |
| 94 | +Va+'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" width="'+g.width+'" height="'+g.height+'">',f("movie",a),f("AllowScriptAccess",c.allowScriptAccess),f("quality",g.quality),c.wmode?f("wmode",c.wmode):"",f("bgcolor",c.bgColor),f("hasPriority","true"),c.debugFlash?f("FlashVars",g.FlashVars):"","</object>"].join("");else for(j in e=h.createElement("embed"),g)g.hasOwnProperty(j)&&e.setAttribute(j,g[j]);ta();k=L();if(g=ba())if(c.oMC=u(c.movieID)||h.createElement("div"), |
| 95 | +c.oMC.id){l=c.oMC.className;c.oMC.className=(l?l+" ":"movieContainer")+(k?" "+k:"");c.oMC.appendChild(e);if(D)j=c.oMC.appendChild(h.createElement("div")),j.className="sm2-object-box",j.innerHTML=m;Q=!0}else{c.oMC.id=c.movieID;c.oMC.className="movieContainer "+k;j=k=null;if(!c.useFlashBlock)if(c.useHighPerformance)k={position:"fixed",width:"8px",height:"8px",bottom:"0px",left:"0px",overflow:"hidden"};else if(k={position:"absolute",width:"6px",height:"6px",top:"-9999px",left:"-9999px"},n)k.left=Math.abs(parseInt(k.left, |
| 96 | +10))+"px";if(cb)c.oMC.style.zIndex=1E4;if(!c.debugFlash)for(l in k)k.hasOwnProperty(l)&&(c.oMC.style[l]=k[l]);try{D||c.oMC.appendChild(e);g.appendChild(c.oMC);if(D)j=c.oMC.appendChild(h.createElement("div")),j.className="sm2-object-box",j.innerHTML=m;Q=!0}catch(r){throw Error(q("domError")+" \n"+r.toString());}}P=!0;d();c._wD("soundManager::createMovie(): Trying to load "+a+(!N&&c.altURL?" (alternate URL)":""),1);return!0};aa=function(){if(c.html5Only)return ca(),!1;if(i)return!1;i=c.getMovie(c.id); |
| 97 | +if(!i)S?(D?c.oMC.innerHTML=ua:c.oMC.appendChild(S),S=null,P=!0):ca(c.id,c.url),i=c.getMovie(c.id);i&&o("waitEI");c.oninitmovie instanceof Function&&setTimeout(c.oninitmovie,1);return!0};Z=function(){setTimeout(Fa,1E3)};Fa=function(){if(ga)return!1;ga=!0;r.remove(j,"load",Z);if(M&&!Da)return o("waitFocus"),!1;var b;n||(b=c.getMoviePercent(),c._wD(q("waitImpatient",100===b?" (SWF loaded)":0<b?" (SWF "+b+"% loaded)":"")));setTimeout(function(){b=c.getMoviePercent();n||(c._wD("soundManager: No Flash response within expected time.\nLikely causes: "+ |
| 98 | +(0===b?"Loading "+c.movieURL+" may have failed (and/or Flash "+m+"+ not present?), ":"")+"Flash blocked or JS-Flash security error."+(c.debugFlash?" "+q("checkSWF"):""),2),!N&&b&&(o("localFail",2),c.debugFlash||o("tryDebug",2)),0===b&&c._wD(q("swf404",c.url)),w("flashtojs",!1,": Timed out"+N?" (Check flash security or flash blockers)":" (No plugin/missing SWF?)"));!n&&Ta&&(null===b?c.useFlashBlock||0===c.flashLoadTimeout?(c.useFlashBlock&&va(),o("waitForever")):da(!0):0===c.flashLoadTimeout?o("waitForever"): |
| 99 | +da(!0))},c.flashLoadTimeout)};E=function(){function b(){r.remove(j,"focus",E);r.remove(j,"load",E)}if(Da||!M)return b(),!0;Da=Ta=!0;c._wD("soundManager::handleFocus()");V&&M&&r.remove(j,"mousemove",E);ga=!1;b();return!0};Ra=function(){var b,a=[];if(c.useHTML5Audio&&c.hasHTML5){for(b in c.audioFormats)c.audioFormats.hasOwnProperty(b)&&a.push(b+": "+c.html5[b]+(!c.html5[b]&&t&&c.flash[b]?" (using flash)":c.preferFlash&&c.flash[b]&&t?" (preferring flash)":!c.html5[b]?" ("+(c.audioFormats[b].required? |
| 100 | +"required, ":"")+"and no flash support)":""));c._wD("-- SoundManager 2: HTML5 support tests ("+c.html5Test+"): "+a.join(", ")+" --",1)}};R=function(b){if(n)return!1;if(c.html5Only)return c._wD("-- SoundManager 2: loaded --"),n=!0,I(),w("onload",!0),!0;var a;if(!c.useFlashBlock||!c.flashLoadTimeout||c.getMoviePercent())n=!0,y&&(a={type:!t&&z?"NO_FLASH":"INIT_TIMEOUT"});c._wD("-- SoundManager 2 "+(y?"failed to load":"loaded")+" ("+(y?"security/load error":"OK")+") --",1);if(y||b){if(c.useFlashBlock&& |
| 101 | +c.oMC)c.oMC.className=L()+" "+(null===c.getMoviePercent()?"swf_timedout":"swf_error");H({type:"ontimeout",error:a});w("onload",!1);K(a);return!1}w("onload",!0);if(c.waitForWindowLoad&&!Y)return o("waitOnload"),r.add(j,"load",I),!1;c.waitForWindowLoad&&Y&&o("docLoaded");I();return!0};X=function(){o("init");if(n)return o("didInit"),!1;if(c.html5Only){if(!n)r.remove(j,"load",c.beginDelayedInit),c.enabled=!0,R();return!0}aa();try{o("flashJS"),i._externalInterfaceTest(!1),Ga(!0,c.flashPollingInterval|| |
| 102 | +(c.useHighPerformance?10:50)),c.debugMode||i._disableDebug(),c.enabled=!0,w("jstoflash",!0),c.html5Only||r.add(j,"unload",na)}catch(b){return c._wD("js/flash exception: "+b.toString()),w("jstoflash",!1),K({type:"JS_TO_FLASH_EXCEPTION",fatal:!0}),da(!0),R(),!1}R();r.remove(j,"load",c.beginDelayedInit);return!0};J=function(){if(sa)return!1;sa=!0;ta();var b=O.toLowerCase(),a=null,a=null,d="undefined"!==typeof console&&"undefined"!==typeof console.log;if(-1!==b.indexOf("sm2-usehtml5audio="))a="1"===b.charAt(b.indexOf("sm2-usehtml5audio=")+ |
| 103 | +18),d&&console.log((a?"Enabling ":"Disabling ")+"useHTML5Audio via URL parameter"),c.useHTML5Audio=a;if(-1!==b.indexOf("sm2-preferflash="))a="1"===b.charAt(b.indexOf("sm2-preferflash=")+16),d&&console.log((a?"Enabling ":"Disabling ")+"preferFlash via URL parameter"),c.preferFlash=a;if(!t&&c.hasHTML5)c._wD("SoundManager: No Flash detected"+(!c.useHTML5Audio?", enabling HTML5.":". Trying HTML5-only mode.")),c.useHTML5Audio=!0,c.preferFlash=!1;Oa();c.html5.usingFlash=Na();z=c.html5.usingFlash;Ra();if(!t&& |
| 104 | +z)c._wD("SoundManager: Fatal error: Flash is needed to play some required formats, but is not available."),c.flashLoadTimeout=1;h.removeEventListener&&h.removeEventListener("DOMContentLoaded",J,!1);aa();return!0};za=function(){"complete"===h.readyState&&(J(),h.detachEvent("onreadystatechange",za));return!0};ra=function(){Y=!0;r.remove(j,"load",ra)};ka();r.add(j,"focus",E);r.add(j,"load",E);r.add(j,"load",Z);r.add(j,"load",ra);V&&M&&r.add(j,"mousemove",E);h.addEventListener?h.addEventListener("DOMContentLoaded", |
| 105 | +J,!1):h.attachEvent?h.attachEvent("onreadystatechange",za):(w("onload",!1),K({type:"NO_DOM2_EVENTS",fatal:!0}));"complete"===h.readyState&&setTimeout(J,100)}var la=null;if("undefined"===typeof SM2_DEFER||!SM2_DEFER)la=new W;G.SoundManager=W;G.soundManager=la})(window); |
\ No newline at end of file |