From 20575fd514a68f4ed9d12ba4f280b286b74f1ec9 Mon Sep 17 00:00:00 2001 From: phalla-khong Date: Mon, 12 Dec 2016 17:28:07 +0700 Subject: [PATCH 1/8] add shuffle --- Gruntfile.js | 1 + dist/angular-soundmanager2.js | 72 ++++++++++++++++++++++++++++--- dist/angular-soundmanager2.min.js | 6 +-- examples/index.html | 2 + src/03-factory-angularPlayer.js | 52 +++++++++++++++++++--- src/21-directive-shuffleMusic.js | 18 ++++++++ 6 files changed, 138 insertions(+), 13 deletions(-) create mode 100644 src/21-directive-shuffleMusic.js diff --git a/Gruntfile.js b/Gruntfile.js index 506a6ed..d165cb3 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -29,6 +29,7 @@ module.exports = function (grunt) { 'src/18-directive-playAll.js', 'src/19-directive-volumeBar.js', 'src/20-directive-playPauseToggle.js', + 'src/21-directive-shuffleMusic.js', ], dest: 'dist/angular-soundmanager2.js' } diff --git a/dist/angular-soundmanager2.js b/dist/angular-soundmanager2.js index acc39dd..431980a 100644 --- a/dist/angular-soundmanager2.js +++ b/dist/angular-soundmanager2.js @@ -4422,6 +4422,8 @@ ngSoundManager.factory('angularPlayer', ['$rootScope', '$log', var currentTrack = null, repeat = false, + shuffle = false, + tempTrack = [], autoPlay = true, isPlaying = false, volume = 90, @@ -4620,6 +4622,7 @@ ngSoundManager.factory('angularPlayer', ['$rootScope', '$log', } //unload from soundManager soundManager.destroySound(song); + //remove from playlist playlist.splice(index, 1); //once all done then broadcast @@ -4678,16 +4681,33 @@ ngSoundManager.factory('angularPlayer', ['$rootScope', '$log', $log.debug("Please click on Play before this action"); return null; } - var currentTrackKey = this.getIndexByValue(soundManager.soundIDs, this.getCurrentTrack()); + + // use shuffle track list if shuffle is true + var useTrack = angular.copy(soundManager.soundIDs); + if(shuffle === true){ + useTrack = tempTrack; + } + + console.log(soundManager.soundIDs); + console.log(tempTrack); + + var currentTrackKey = this.getIndexByValue(useTrack, this.getCurrentTrack()); var nextTrackKey = +currentTrackKey + 1; - var nextTrack = soundManager.soundIDs[nextTrackKey]; + var nextTrack = useTrack[nextTrackKey]; if(typeof nextTrack !== 'undefined') { this.playTrack(nextTrack); } else { + // generate shuffle track list + if(shuffle === true && isPlaying === true){ + tempTrack = angular.copy(soundManager.soundIDs); + tempTrack = (tempTrack).sort(function() { return 0.5 - Math.random() }); + $rootScope.$broadcast('music:tempTrack', tempTrack); + } + //if no next track found if(repeat === true) { //start first track if repeat is on - this.playTrack(soundManager.soundIDs[0]); + this.playTrack(useTrack[0]); } else { //breadcase not playing anything isPlaying = false; @@ -4700,9 +4720,16 @@ ngSoundManager.factory('angularPlayer', ['$rootScope', '$log', $log.debug("Please click on Play before this action"); return null; } - var currentTrackKey = this.getIndexByValue(soundManager.soundIDs, this.getCurrentTrack()); + + // use shuffle track list if shuffle is true + var useTrack = angular.copy(soundManager.soundIDs); + if(shuffle === true){ + useTrack = tempTrack; + } + + var currentTrackKey = this.getIndexByValue(useTrack, this.getCurrentTrack()); var prevTrackKey = +currentTrackKey - 1; - var prevTrack = soundManager.soundIDs[prevTrackKey]; + var prevTrack = useTrack[prevTrackKey]; if(typeof prevTrack !== 'undefined') { this.playTrack(prevTrack); } else { @@ -4731,6 +4758,21 @@ ngSoundManager.factory('angularPlayer', ['$rootScope', '$log', getRepeatStatus: function() { return repeat; }, + shuffleToggle: function() { + if(shuffle === true) { + shuffle = false; + tempTrack = angular.copy(soundManager.soundIDs); + } else { + shuffle = true; + tempTrack = angular.copy(soundManager.soundIDs); + tempTrack = (tempTrack).sort(function() { return 0.5 - Math.random() }); + } + $rootScope.$broadcast('music:shuffle', shuffle); + $rootScope.$broadcast('music:tempTrack', tempTrack); + }, + getShuffleStatus: function() { + return shuffle; + }, getVolume: function() { return volume; }, @@ -5173,3 +5215,23 @@ ngSoundManager.directive('playPauseToggle', ['angularPlayer', }; } ]); + + +ngSoundManager.directive('shuffleMusic', ['angularPlayer', function (angularPlayer) { + return { + restrict: "EA", + link: function (scope, element, attrs) { + + element.bind('click', function (event) { + angularPlayer.shuffleToggle(); + }); + + scope.shuffle = angularPlayer.getShuffleStatus(); + scope.$on('music:shuffle', function (event, data) { + scope.$apply(function () { + scope.shuffle = data; + }); + }); + } + }; + }]); \ No newline at end of file diff --git a/dist/angular-soundmanager2.min.js b/dist/angular-soundmanager2.min.js index 3226c93..2a37f24 100644 --- a/dist/angular-soundmanager2.min.js +++ b/dist/angular-soundmanager2.min.js @@ -1,3 +1,3 @@ -/*! angular-soundmanager2 22-04-2015 */ -!function(a,b){"use strict";function c(c,d){function e(a){return qb.preferFlash&&jb&&!qb.ignoreFlash&&qb.flash[a]!==b&&qb.flash[a]}function f(a){return function(b){var c,d=this._s;return d&&d._a?c=a.call(this,b):(qb._wD(d&&d.id?d.id+": Ignoring "+b.type:vb+"Ignoring "+b.type),c=null),c}}this.setupOptions={url:c||null,flashVersion:8,debugMode:!0,debugFlash:!1,useConsole:!0,consoleOnly:!0,waitForWindowLoad:!1,bgColor:"#ffffff",useHighPerformance:!1,flashPollingInterval:null,html5PollingInterval:null,flashLoadTimeout:1e3,wmode:null,allowScriptAccess:"always",useFlashBlock:!1,useHTML5Audio:!0,html5Test:/^(probably|maybe)$/i,preferFlash:!1,noSWFCache:!1,idPrefix:"sound"},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,duration:null},this.audioFormats={mp3:{type:['audio/mpeg; codecs="mp3"',"audio/mpeg","audio/mp3","audio/MPA","audio/mpa-robust"],required:!0},mp4:{related:["aac","m4a","m4b"],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},opus:{type:["audio/ogg; codecs=opus","audio/opus"],required:!1},wav:{type:['audio/wav; codecs="1"',"audio/wav","audio/wave","audio/x-wav"],required:!1}},this.movieID="sm2-container",this.id=d||"sm2movie",this.debugID="soundmanager-debug",this.debugURLParam=/([#?&])debug=1/i,this.versionNumber="V2.97a.20140901",this.version=null,this.movieURL=null,this.altURL=null,this.swfLoaded=!1,this.enabled=!1,this.oMC=null,this.sounds={},this.soundIDs=[],this.muted=!1,this.didFlashBlock=!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={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},this.html5={usingFlash:null},this.flash={},this.html5Only=!1,this.ignoreFlash=!1;var g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,$,_,ab,bb,cb,db,eb,fb,gb,hb,ib,jb,kb,lb,mb,nb,ob,pb,qb=this,rb=null,sb=null,tb="soundManager",ub=tb+": ",vb="HTML5::",wb=navigator.userAgent,xb=a.location.href.toString(),yb=document,zb=[],Ab=!0,Bb=!1,Cb=!1,Db=!1,Eb=!1,Fb=!1,Gb=0,Hb=["log","info","warn","error"],Ib=8,Jb=null,Kb=null,Lb=!1,Mb=!1,Nb=0,Ob=null,Pb=[],Qb=null,Rb=Array.prototype.slice,Sb=!1,Tb=0,Ub=wb.match(/(ipad|iphone|ipod)/i),Vb=wb.match(/android/i),Wb=wb.match(/msie/i),Xb=wb.match(/webkit/i),Yb=wb.match(/safari/i)&&!wb.match(/chrome/i),Zb=wb.match(/opera/i),$b=wb.match(/(mobile|pre\/|xoom)/i)||Ub||Vb,_b=!xb.match(/usehtml5audio/i)&&!xb.match(/sm2\-ignorebadua/i)&&Yb&&!wb.match(/silk/i)&&wb.match(/OS X 10_6_([3-7])/i),ac=a.console!==b&&console.log!==b,bc=yb.hasFocus!==b?yb.hasFocus():null,cc=Yb&&(yb.hasFocus===b||!yb.hasFocus()),dc=!cc,ec=/(mp3|mp4|mpa|m4a|m4b)/i,fc=1e3,gc="about:blank",hc="data:audio/wave;base64,/UklGRiYAAABXQVZFZm10IBAAAAABAAEARKwAAIhYAQACABAAZGF0YQIAAAD//w==",ic=yb.location?yb.location.protocol.match(/http/i):null,jc=ic?"":"http://",kc=/^\s*audio\/(?:x-)?(?:mpeg4|aac|flv|mov|mp4||m4v|m4a|m4b|mp4v|3gp|3g2)\s*(?:$|;)/i,lc=["mpeg4","aac","flv","mov","mp4","m4v","f4v","m4a","m4b","mp4v","3gp","3g2"],mc=new RegExp("\\.("+lc.join("|")+")(\\?.*)?$","i");this.mimePattern=/^\s*audio\/(?:x-)?(?:mp(?:eg|3))\s*(?:$|;)/i,this.useAltURL=!ic,R={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.hasHTML5=function(){try{return Audio!==b&&(Zb&&opera!==b&&opera.version()<10?new Audio(null):new Audio).canPlayType!==b}catch(a){return!1}}(),this.setup=function(a){var c=!qb.url;return a!==b&&Db&&Qb&&qb.ok()&&(a.flashVersion!==b||a.url!==b||a.html5Test!==b)&&V(O("setupLate")),q(a),a&&(c&&F&&a.url!==b&&qb.beginDelayedInit(),F||a.url===b||"complete"!==yb.readyState||setTimeout(D,1)),qb},this.ok=function(){return Qb?Db&&!Eb:qb.useHTML5Audio&&qb.hasHTML5},this.supported=this.ok,this.getMovie=function(b){return h(b)||yb[b]||a[b]},this.createSound=function(a,c){function d(){return h=T(h),qb.sounds[h.id]=new g(h),qb.soundIDs.push(h.id),qb.sounds[h.id]}var e,f,h,i=null;if(e=tb+".createSound(): ",f=e+O(Db?"notOK":"notReady"),!Db||!qb.ok())return V(f),!1;if(c!==b&&(a={id:a,url:c}),h=p(a),h.url=$(h.url),void 0===h.id&&(h.id=qb.setupOptions.idPrefix+Tb++),h.id.toString().charAt(0).match(/^[0-9]$/)&&qb._wD(e+O("badID",h.id),2),qb._wD(e+h.id+(h.url?" ("+h.url+")":""),1),W(h.id,!0))return qb._wD(e+h.id+" exists",1),qb.sounds[h.id];if(bb(h))i=d(),qb._wD(h.id+": Using HTML5"),i._setup_html5(h);else{if(qb.html5Only)return qb._wD(h.id+": No HTML5 support for this sound, and no Flash. Exiting."),d();if(qb.html5.usingFlash&&h.url&&h.url.match(/data\:/i))return qb._wD(h.id+": data: URIs not supported via Flash. Exiting."),d();l>8&&(null===h.isMovieStar&&(h.isMovieStar=!!(h.serverURL||(h.type?h.type.match(kc):!1)||h.url&&h.url.match(mc))),h.isMovieStar&&(qb._wD(e+"using MovieStar handling"),h.loops>1&&n("noNSLoop"))),h=U(h,e),i=d(),8===l?sb._createSound(h.id,h.loops||1,h.usePolicyFile):(sb._createSound(h.id,h.url,h.usePeakData,h.useWaveformData,h.useEQData,h.isMovieStar,h.isMovieStar?h.bufferTime:!1,h.loops||1,h.serverURL,h.duration||null,h.autoPlay,!0,h.autoLoad,h.usePolicyFile),h.serverURL||(i.connected=!0,h.onconnect&&h.onconnect.apply(i))),h.serverURL||!h.autoLoad&&!h.autoPlay||i.load(h)}return!h.serverURL&&h.autoPlay&&i.play(),i},this.destroySound=function(a,b){if(!W(a))return!1;var c,d=qb.sounds[a];for(d._iO={},d.stop(),d.unload(),c=0;c=0;a--)qb.sounds[qb.soundIDs[a]].pause()},this.resume=function(a){return W(a)?qb.sounds[a].resume():!1},this.resumeAll=function(){var a;for(a=qb.soundIDs.length-1;a>=0;a--)qb.sounds[qb.soundIDs[a]].resume()},this.togglePause=function(a){return W(a)?qb.sounds[a].togglePause():!1},this.setPan=function(a,b){return W(a)?qb.sounds[a].setPan(b):!1},this.setVolume=function(a,b){return W(a)?qb.sounds[a].setVolume(b):!1},this.mute=function(a){var b=0;if(a instanceof String&&(a=null),a)return W(a)?(qb._wD(tb+'.mute(): Muting "'+a+'"'),qb.sounds[a].mute()):!1;for(qb._wD(tb+".mute(): Muting all sounds"),b=qb.soundIDs.length-1;b>=0;b--)qb.sounds[qb.soundIDs[b]].mute();return qb.muted=!0,!0},this.muteAll=function(){qb.mute()},this.unmute=function(a){var b;if(a instanceof String&&(a=null),a)return W(a)?(qb._wD(tb+'.unmute(): Unmuting "'+a+'"'),qb.sounds[a].unmute()):!1;for(qb._wD(tb+".unmute(): Unmuting all sounds"),b=qb.soundIDs.length-1;b>=0;b--)qb.sounds[qb.soundIDs[b]].unmute();return qb.muted=!1,!0},this.unmuteAll=function(){qb.unmute()},this.toggleMute=function(a){return W(a)?qb.sounds[a].toggleMute():!1},this.getMemoryUse=function(){var a=0;return sb&&8!==l&&(a=parseInt(sb._getMemoryUse(),10)),a},this.disable=function(c){var d;if(c===b&&(c=!1),Eb)return!1;for(Eb=!0,n("shutdown",1),d=qb.soundIDs.length-1;d>=0;d--)L(qb.sounds[qb.soundIDs[d]]);return o(c),hb.remove(a,"load",u),!0},this.canPlayMIME=function(a){var b;return qb.hasHTML5&&(b=cb({type:a})),!b&&Qb&&(b=a&&qb.ok()?!!((l>8?a.match(kc):null)||a.match(qb.mimePattern)):null),b},this.canPlayURL=function(a){var b;return qb.hasHTML5&&(b=cb({url:a})),!b&&Qb&&(b=a&&qb.ok()?!!a.match(qb.filePattern):null),b},this.canPlayLink=function(a){return a.type!==b&&a.type&&qb.canPlayMIME(a.type)?!0:qb.canPlayURL(a.href)},this.getSoundById=function(a,b){if(!a)return null;var c=qb.sounds[a];return c||b||qb._wD(tb+'.getSoundById(): Sound "'+a+'" not found.',2),c},this.onready=function(b,c){var d="onready",e=!1;if("function"!=typeof b)throw O("needFunction",d);return Db&&qb._wD(O("queue",d)),c||(c=a),s(d,b,c),t(),e=!0,e},this.ontimeout=function(b,c){var d="ontimeout",e=!1;if("function"!=typeof b)throw O("needFunction",d);return Db&&qb._wD(O("queue",d)),c||(c=a),s(d,b,c),t({type:d}),e=!0,e},this._writeDebug=function(a,c){var d,e,f="soundmanager-debug";return qb.debugMode?ac&&qb.useConsole&&(c&&"object"==typeof c?console.log(a,c):Hb[c]!==b?console[Hb[c]](a):console.log(a),qb.consoleOnly)?!0:(d=h(f))?(e=yb.createElement("div"),++Gb%2===0&&(e.className="sm2-alt"),c=c===b?0:parseInt(c,10),e.appendChild(yb.createTextNode(a)),c&&(c>=2&&(e.style.fontWeight="bold"),3===c&&(e.style.color="#ff3333")),d.insertBefore(e,d.firstChild),d=null,!0):!1:!1},-1!==xb.indexOf("sm2-debug=alert")&&(this._writeDebug=function(b){a.alert(b)}),this._wD=this._writeDebug,this._debug=function(){var a,b;for(n("currentObj",1),a=0,b=qb.soundIDs.length;b>a;a++)qb.sounds[qb.soundIDs[a]]._debug()},this.reboot=function(b,c){qb.soundIDs.length&&qb._wD("Destroying "+qb.soundIDs.length+" SMSound object"+(1!==qb.soundIDs.length?"s":"")+"...");var d,e,f;for(d=qb.soundIDs.length-1;d>=0;d--)qb.sounds[qb.soundIDs[d]].destruct();if(sb)try{Wb&&(Kb=sb.innerHTML),Jb=sb.parentNode.removeChild(sb)}catch(g){n("badRemove",2)}if(Kb=Jb=Qb=sb=null,qb.enabled=F=Db=Lb=Mb=Bb=Cb=Eb=Sb=qb.swfLoaded=!1,qb.soundIDs=[],qb.sounds={},Tb=0,b)zb=[];else for(d in zb)if(zb.hasOwnProperty(d))for(e=0,f=zb[d].length;f>e;e++)zb[d][e].fired=!1;return c||qb._wD(tb+": Rebooting..."),qb.html5={usingFlash:null},qb.flash={},qb.html5Only=!1,qb.ignoreFlash=!1,a.setTimeout(function(){C(),c||qb.beginDelayedInit()},20),qb},this.reset=function(){return n("reset"),qb.reboot(!0,!0)},this.getMoviePercent=function(){return sb&&"PercentLoaded"in sb?sb.PercentLoaded():null},this.beginDelayedInit=function(){Fb=!0,D(),setTimeout(function(){return Mb?!1:(H(),B(),Mb=!0,!0)},20),v()},this.destruct=function(){qb._wD(tb+".destruct()"),qb.disable(!0)},g=function(a){var c,d,e,f,g,h,i,j,k,o,q=this,r=!1,s=[],t=0,u=null;k={duration:null,time:null},this.id=a.id,this.sID=this.id,this.url=a.url,this.options=p(a),this.instanceOptions=this.options,this._iO=this.instanceOptions,this.pan=this.options.pan,this.volume=this.options.volume,this.isHTML5=!1,this._a=null,o=this.url?!1:!0,this.id3={},this._debug=function(){qb._wD(q.id+": Merged options:",q.options)},this.load=function(a){var c,d=null;if(a!==b?q._iO=p(a,q.options):(a=q.options,q._iO=a,u&&u!==q.url&&(n("manURL"),q._iO.url=q.url,q.url=null)),q._iO.url||(q._iO.url=q.url),q._iO.url=$(q._iO.url),q.instanceOptions=q._iO,c=q._iO,qb._wD(q.id+": load ("+c.url+")"),!c.url&&!q.url)return qb._wD(q.id+": load(): url is unassigned. Exiting.",2),q;if(q.isHTML5||8!==l||q.url||c.autoPlay||qb._wD(q.id+": Flash 8 load() limitation: Wait for onload() before calling play().",1),c.url===q.url&&0!==q.readyState&&2!==q.readyState)return n("onURL",1),3===q.readyState&&c.onload&&pb(q,function(){c.onload.apply(q,[!!q.duration])}),q;if(q.loaded=!1,q.readyState=1,q.playState=0,q.id3={},bb(c))d=q._setup_html5(c),d._called_load?qb._wD(q.id+": Ignoring request to load again"):(q._html5_canplay=!1,q.url!==c.url&&(qb._wD(n("manURL")+": "+c.url),q._a.src=c.url,q.setPosition(0)),q._a.autobuffer="auto",q._a.preload="auto",q._a._called_load=!0);else{if(qb.html5Only)return qb._wD(q.id+": No flash support. Exiting."),q;if(q._iO.url&&q._iO.url.match(/data\:/i))return qb._wD(q.id+": data: URIs not supported via Flash. Exiting."),q;try{q.isHTML5=!1,q._iO=U(T(c)),q._iO.autoPlay&&(q._iO.position||q._iO.from)&&(qb._wD(q.id+": Disabling autoPlay because of non-zero offset case"),q._iO.autoPlay=!1),c=q._iO,8===l?sb._load(q.id,c.url,c.stream,c.autoPlay,c.usePolicyFile):sb._load(q.id,c.url,!!c.stream,!!c.autoPlay,c.loops||1,!!c.autoLoad,c.usePolicyFile)}catch(e){n("smError",2),m("onload",!1),I({type:"SMSOUND_LOAD_JS_EXCEPTION",fatal:!0})}}return q.url=c.url,q},this.unload=function(){return 0!==q.readyState&&(qb._wD(q.id+": unload()"),q.isHTML5?(f(),q._a&&(q._a.pause(),u=eb(q._a))):8===l?sb._unload(q.id,gc):sb._unload(q.id),c()),q},this.destruct=function(a){qb._wD(q.id+": Destruct"),q.isHTML5?(f(),q._a&&(q._a.pause(),eb(q._a),Sb||e(),q._a._s=null,q._a=null)):(q._iO.onfailure=null,sb._destroySound(q.id)),a||qb.destroySound(q.id,!0)},this.play=function(a,c){var d,e,f,i,k,m,n,s=!0,t=null;if(d=q.id+": play(): ",c=c===b?!0:c,a||(a={}),q.url&&(q._iO.url=q.url),q._iO=p(q._iO,q.options),q._iO=p(a,q._iO),q._iO.url=$(q._iO.url),q.instanceOptions=q._iO,!q.isHTML5&&q._iO.serverURL&&!q.connected)return q.getAutoPlay()||(qb._wD(d+" Netstream not connected yet - setting autoPlay"),q.setAutoPlay(!0)),q;if(bb(q._iO)&&(q._setup_html5(q._iO),g()),1!==q.playState||q.paused||(e=q._iO.multiShot,e?qb._wD(d+"Already playing (multi-shot)",1):(qb._wD(d+"Already playing (one-shot)",1),q.isHTML5&&q.setPosition(q._iO.position),t=q)),null!==t)return t;if(a.url&&a.url!==q.url&&(q.readyState||q.isHTML5||8!==l||!o?q.load(q._iO):o=!1),q.loaded?qb._wD(d.substr(0,d.lastIndexOf(":"))):0===q.readyState?(qb._wD(d+"Attempting to load"),q.isHTML5||qb.html5Only?q.isHTML5?q.load(q._iO):(qb._wD(d+"Unsupported type. Exiting."),t=q):(q._iO.autoPlay=!0,q.load(q._iO)),q.instanceOptions=q._iO):2===q.readyState?(qb._wD(d+"Could not load - exiting",2),t=q):qb._wD(d+"Loading - attempting to play..."),null!==t)return t;if(!q.isHTML5&&9===l&&q.position>0&&q.position===q.duration&&(qb._wD(d+"Sound at end, resetting to position:0"),a.position=0),q.paused&&q.position>=0&&(!q._iO.serverURL||q.position>0))qb._wD(d+"Resuming from paused state",1),q.resume();else{if(q._iO=p(a,q._iO),(!q.isHTML5&&null!==q._iO.position&&q._iO.position>0||null!==q._iO.from&&q._iO.from>0||null!==q._iO.to)&&0===q.instanceCount&&0===q.playState&&!q._iO.serverURL){if(i=function(){q._iO=p(a,q._iO),q.play(q._iO)},q.isHTML5&&!q._html5_canplay?(qb._wD(d+"Beginning load for non-zero offset case"),q.load({_oncanplay:i}),t=!1):q.isHTML5||q.loaded||q.readyState&&2===q.readyState||(qb._wD(d+"Preloading for non-zero offset case"),q.load({onload:i}),t=!1),null!==t)return t;q._iO=j()}(!q.instanceCount||q._iO.multiShotEvents||q.isHTML5&&q._iO.multiShot&&!Sb||!q.isHTML5&&l>8&&!q.getAutoPlay())&&q.instanceCount++,q._iO.onposition&&0===q.playState&&h(q),q.playState=1,q.paused=!1,q.position=q._iO.position===b||isNaN(q._iO.position)?0:q._iO.position,q.isHTML5||(q._iO=U(T(q._iO))),q._iO.onplay&&c&&(q._iO.onplay.apply(q),r=!0),q.setVolume(q._iO.volume,!0),q.setPan(q._iO.pan,!0),q.isHTML5?q.instanceCount<2?(g(),f=q._setup_html5(),q.setPosition(q._iO.position),f.play()):(qb._wD(q.id+": Cloning Audio() for instance #"+q.instanceCount+"..."),k=new Audio(q._iO.url),m=function(){hb.remove(k,"ended",m),q._onfinish(q),eb(k),k=null},n=function(){hb.remove(k,"canplay",n);try{k.currentTime=q._iO.position/fc}catch(a){V(q.id+": multiShot play() failed to apply position of "+q._iO.position/fc)}k.play()},hb.add(k,"ended",m),void 0!==q._iO.volume&&(k.volume=Math.max(0,Math.min(1,q._iO.volume/100))),q.muted&&(k.muted=!0),q._iO.position?hb.add(k,"canplay",n):k.play()):(s=sb._start(q.id,q._iO.loops||1,9===l?q.position:q.position/fc,q._iO.multiShot||!1),9!==l||s||(qb._wD(d+"No sound hardware, or 32-sound ceiling hit",2),q._iO.onplayerror&&q._iO.onplayerror.apply(q)))}return q},this.start=this.play,this.stop=function(a){var b,c=q._iO;return 1===q.playState&&(qb._wD(q.id+": stop()"),q._onbufferchange(0),q._resetOnPosition(0),q.paused=!1,q.isHTML5||(q.playState=0),i(),c.to&&q.clearOnPosition(c.to),q.isHTML5?q._a&&(b=q.position,q.setPosition(0),q.position=b,q._a.pause(),q.playState=0,q._onTimer(),f()):(sb._stop(q.id,a),c.serverURL&&q.unload()),q.instanceCount=0,q._iO={},c.onstop&&c.onstop.apply(q)),q},this.setAutoPlay=function(a){qb._wD(q.id+": Autoplay turned "+(a?"on":"off")),q._iO.autoPlay=a,q.isHTML5||(sb._setAutoPlay(q.id,a),a&&(q.instanceCount||1!==q.readyState||(q.instanceCount++,qb._wD(q.id+": Incremented instance count to "+q.instanceCount))))},this.getAutoPlay=function(){return q._iO.autoPlay},this.setPosition=function(a){a===b&&(a=0);var c,d,e=q.isHTML5?Math.max(a,0):Math.min(q.duration||q._iO.duration,Math.max(a,0));if(q.position=e,d=q.position/fc,q._resetOnPosition(q.position),q._iO.position=e,q.isHTML5){if(q._a){if(q._html5_canplay){if(q._a.currentTime!==d){qb._wD(q.id+": setPosition("+d+")");try{q._a.currentTime=d,(0===q.playState||q.paused)&&q._a.pause()}catch(f){qb._wD(q.id+": setPosition("+d+") failed: "+f.message,2)}}}else if(d)return qb._wD(q.id+": setPosition("+d+"): Cannot seek yet, sound not ready",2),q;q.paused&&q._onTimer(!0)}}else c=9===l?q.position:d,q.readyState&&2!==q.readyState&&sb._setPosition(q.id,c,q.paused||!q.playState,q._iO.multiShot);return q},this.pause=function(a){return q.paused||0===q.playState&&1!==q.readyState?q:(qb._wD(q.id+": pause()"),q.paused=!0,q.isHTML5?(q._setup_html5().pause(),f()):(a||a===b)&&sb._pause(q.id,q._iO.multiShot),q._iO.onpause&&q._iO.onpause.apply(q),q)},this.resume=function(){var a=q._iO;return q.paused?(qb._wD(q.id+": resume()"),q.paused=!1,q.playState=1,q.isHTML5?(q._setup_html5().play(),g()):(a.isMovieStar&&!a.serverURL&&q.setPosition(q.position),sb._pause(q.id,a.multiShot)),!r&&a.onplay?(a.onplay.apply(q),r=!0):a.onresume&&a.onresume.apply(q),q):q},this.togglePause=function(){return qb._wD(q.id+": togglePause()"),0===q.playState?(q.play({position:9!==l||q.isHTML5?q.position/fc:q.position}),q):(q.paused?q.resume():q.pause(),q)},this.setPan=function(a,c){return a===b&&(a=0),c===b&&(c=!1),q.isHTML5||sb._setPan(q.id,a),q._iO.pan=a,c||(q.pan=a,q.options.pan=a),q},this.setVolume=function(a,c){return a===b&&(a=100),c===b&&(c=!1),q.isHTML5?q._a&&(qb.muted&&!q.muted&&(q.muted=!0,q._a.muted=!0),q._a.volume=Math.max(0,Math.min(1,a/100))):sb._setVolume(q.id,qb.muted&&!q.muted||q.muted?0:a),q._iO.volume=a,c||(q.volume=a,q.options.volume=a),q},this.mute=function(){return q.muted=!0,q.isHTML5?q._a&&(q._a.muted=!0):sb._setVolume(q.id,0),q},this.unmute=function(){q.muted=!1;var a=q._iO.volume!==b;return q.isHTML5?q._a&&(q._a.muted=!1):sb._setVolume(q.id,a?q._iO.volume:q.options.volume),q},this.toggleMute=function(){return q.muted?q.unmute():q.mute()},this.onPosition=function(a,c,d){return s.push({position:parseInt(a,10),method:c,scope:d!==b?d:q,fired:!1}),q},this.onposition=this.onPosition,this.clearOnPosition=function(a,b){var c;if(a=parseInt(a,10),isNaN(a))return!1;for(c=0;c=c)return!1;for(a=c-1;a>=0;a--)b=s[a],!b.fired&&q.position>=b.position&&(b.fired=!0,t++,b.method.apply(b.scope,[b.position]),c=s.length);return!0},this._resetOnPosition=function(a){var b,c,d=s.length;if(!d)return!1;for(b=d-1;b>=0;b--)c=s[b],c.fired&&a<=c.position&&(c.fired=!1,t--);return!0},j=function(){var a,b,c=q._iO,d=c.from,e=c.to;return b=function(){qb._wD(q.id+': "To" time of '+e+" reached."),q.clearOnPosition(e,b),q.stop()},a=function(){qb._wD(q.id+': Playing "from" '+d),null===e||isNaN(e)||q.onPosition(e,b)},null===d||isNaN(d)||(c.position=d,c.multiShot=!1,a()),c},h=function(){var a,b=q._iO.onposition;if(b)for(a in b)b.hasOwnProperty(a)&&q.onPosition(parseInt(a,10),b[a])},i=function(){var a,b=q._iO.onposition;if(b)for(a in b)b.hasOwnProperty(a)&&q.clearOnPosition(parseInt(a,10))},g=function(){q.isHTML5&&X(q)},f=function(){q.isHTML5&&Y(q)},c=function(a){a||(s=[],t=0),r=!1,q._hasTimer=null,q._a=null,q._html5_canplay=!1,q.bytesLoaded=null,q.bytesTotal=null,q.duration=q._iO&&q._iO.duration?q._iO.duration:null,q.durationEstimate=null,q.buffered=[],q.eqData=[],q.eqData.left=[],q.eqData.right=[],q.failures=0,q.isBuffering=!1,q.instanceOptions={},q.instanceCount=0,q.loaded=!1,q.metadata={},q.readyState=0,q.muted=!1,q.paused=!1,q.peakData={left:0,right:0},q.waveformData={left:[],right:[]},q.playState=0,q.position=null,q.id3={}},c(),this._onTimer=function(a){var b,c,d=!1,e={};return q._hasTimer||a?(q._a&&(a||(q.playState>0||1===q.readyState)&&!q.paused)&&(b=q._get_html5_duration(),b!==k.duration&&(k.duration=b,q.duration=b,d=!0),q.durationEstimate=q.duration,c=q._a.currentTime*fc||0,c!==k.time&&(k.time=c,d=!0),(d||a)&&q._whileplaying(c,e,e,e,e)),d):void 0},this._get_html5_duration=function(){var a=q._iO,b=q._a&&q._a.duration?q._a.duration*fc:a&&a.duration?a.duration:null,c=b&&!isNaN(b)&&1/0!==b?b:null;return c},this._apply_loop=function(a,b){!a.loop&&b>1&&qb._wD("Note: Native HTML5 looping is infinite.",1),a.loop=b>1?"loop":""},this._setup_html5=function(a){var b,e=p(q._iO,a),f=Sb?rb:q._a,g=decodeURI(e.url);if(Sb?g===decodeURI(ib)&&(b=!0):g===decodeURI(u)&&(b=!0),f){if(f._s)if(Sb)f._s&&f._s.playState&&!b&&f._s.stop();else if(!Sb&&g===decodeURI(u))return q._apply_loop(f,e.loops),f;b||(u&&c(!1),f.src=e.url,q.url=e.url,u=e.url,ib=e.url,f._called_load=!1)}else e.autoLoad||e.autoPlay?(q._a=new Audio(e.url),q._a.load()):q._a=Zb&&opera.version()<10?new Audio(null):new Audio,f=q._a,f._called_load=!1,Sb&&(rb=f);return q.isHTML5=!0,q._a=f,f._s=q,d(),q._apply_loop(f,e.loops),e.autoLoad||e.autoPlay?q.load():(f.autobuffer=!1,f.preload="auto"),f},d=function(){function a(a,b,c){return q._a?q._a.addEventListener(a,b,c||!1):null}if(q._a._added_events)return!1;var b;q._a._added_events=!0;for(b in mb)mb.hasOwnProperty(b)&&a(b,mb[b]);return!0},e=function(){function a(a,b,c){return q._a?q._a.removeEventListener(a,b,c||!1):null}var b;qb._wD(q.id+": Removing event listeners"),q._a._added_events=!1;for(b in mb)mb.hasOwnProperty(b)&&a(b,mb[b])},this._onload=function(a){var b,c=!!a||!q.isHTML5&&8===l&&q.duration;return b=q.id+": ",qb._wD(b+(c?"onload()":"Failed to load / invalid sound?"+(q.duration?" -":" Zero-length duration reported.")+" ("+q.url+")"),c?1:2),c||q.isHTML5||(qb.sandbox.noRemote===!0&&qb._wD(b+O("noNet"),1),qb.sandbox.noLocal===!0&&qb._wD(b+O("noLocal"),1)),q.loaded=c,q.readyState=c?3:2,q._onbufferchange(0),q._iO.onload&&pb(q,function(){q._iO.onload.apply(q,[c])}),!0},this._onbufferchange=function(a){return 0===q.playState?!1:a&&q.isBuffering||!a&&!q.isBuffering?!1:(q.isBuffering=1===a,q._iO.onbufferchange&&(qb._wD(q.id+": Buffer state change: "+a),q._iO.onbufferchange.apply(q,[a])),!0)},this._onsuspend=function(){return q._iO.onsuspend&&(qb._wD(q.id+": Playback suspended"),q._iO.onsuspend.apply(q)),!0},this._onfailure=function(a,b,c){q.failures++,qb._wD(q.id+": Failure ("+q.failures+"): "+a),q._iO.onfailure&&1===q.failures?q._iO.onfailure(a,b,c):qb._wD(q.id+": Ignoring failure")},this._onwarning=function(a,b,c){q._iO.onwarning&&q._iO.onwarning(a,b,c)},this._onfinish=function(){var a=q._iO.onfinish;q._onbufferchange(0),q._resetOnPosition(0),q.instanceCount&&(q.instanceCount--,q.instanceCount||(i(),q.playState=0,q.paused=!1,q.instanceCount=0,q.instanceOptions={},q._iO={},f(),q.isHTML5&&(q.position=0)),(!q.instanceCount||q._iO.multiShotEvents)&&a&&(qb._wD(q.id+": onfinish()"),pb(q,function(){a.apply(q)})))},this._whileloading=function(a,b,c,d){var e=q._iO;q.bytesLoaded=a,q.bytesTotal=b,q.duration=Math.floor(c),q.bufferLength=d,q.durationEstimate=q.isHTML5||e.isMovieStar?q.duration:e.duration?q.duration>e.duration?q.duration:e.duration:parseInt(q.bytesTotal/q.bytesLoaded*q.duration,10),q.isHTML5||(q.buffered=[{start:0,end:q.duration}]),(3!==q.readyState||q.isHTML5)&&e.whileloading&&e.whileloading.apply(q)},this._whileplaying=function(a,c,d,e,f){var g,h=q._iO;return isNaN(a)||null===a?!1:(q.position=Math.max(0,a),q._processOnPosition(),!q.isHTML5&&l>8&&(h.usePeakData&&c!==b&&c&&(q.peakData={left:c.leftPeak,right:c.rightPeak}),h.useWaveformData&&d!==b&&d&&(q.waveformData={left:d.split(","),right:e.split(",")}),h.useEQData&&f!==b&&f&&f.leftEQ&&(g=f.leftEQ.split(","),q.eqData=g,q.eqData.left=g,f.rightEQ!==b&&f.rightEQ&&(q.eqData.right=f.rightEQ.split(",")))),1===q.playState&&(q.isHTML5||8!==l||q.position||!q.isBuffering||q._onbufferchange(0),h.whileplaying&&h.whileplaying.apply(q)),!0)},this._oncaptiondata=function(a){qb._wD(q.id+": Caption data received."),q.captiondata=a,q._iO.oncaptiondata&&q._iO.oncaptiondata.apply(q,[a])},this._onmetadata=function(a,b){qb._wD(q.id+": Metadata received.");var c,d,e={};for(c=0,d=a.length;d>c;c++)e[a[c]]=b[c];q.metadata=e,console.log("updated metadata",q.metadata),q._iO.onmetadata&&q._iO.onmetadata.call(q,q.metadata)},this._onid3=function(a,b){qb._wD(q.id+": ID3 data received.");var c,d,e=[];for(c=0,d=a.length;d>c;c++)e[a[c]]=b[c];q.id3=p(q.id3,e),q._iO.onid3&&q._iO.onid3.apply(q)},this._onconnect=function(a){a=1===a,qb._wD(q.id+": "+(a?"Connected.":"Failed to connect? - "+q.url),a?1:2),q.connected=a,a&&(q.failures=0,W(q.id)&&(q.getAutoPlay()?q.play(b,q.getAutoPlay()):q._iO.autoLoad&&q.load()),q._iO.onconnect&&q._iO.onconnect.apply(q,[a]))},this._ondataerror=function(a){q.playState>0&&(qb._wD(q.id+": Data error: "+a),q._iO.ondataerror&&q._iO.ondataerror.apply(q))},this._debug()},G=function(){return yb.body||yb.getElementsByTagName("div")[0]},h=function(a){return yb.getElementById(a)},p=function(a,c){var d,e,f=a||{};d=c===b?qb.defaultOptions:c;for(e in d)d.hasOwnProperty(e)&&f[e]===b&&(f[e]="object"!=typeof d[e]||null===d[e]?d[e]:p(f[e],d[e]));return f},pb=function(b,c){b.isHTML5||8!==l?c():a.setTimeout(c,0)},r={onready:1,ontimeout:1,defaultOptions:1,flash9Options:1,movieStarOptions:1},q=function(a,c){var d,e=!0,f=c!==b,g=qb.setupOptions,h=r;if(a===b){e=[];for(d in g)g.hasOwnProperty(d)&&e.push(d);for(d in h)h.hasOwnProperty(d)&&e.push("object"==typeof qb[d]?d+": {...}":qb[d]instanceof Function?d+": function() {...}":d);return qb._wD(O("setup",e.join(", "))),!1}for(d in a)if(a.hasOwnProperty(d))if("object"!=typeof a[d]||null===a[d]||a[d]instanceof Array||a[d]instanceof RegExp)f&&h[c]!==b?qb[c][d]=a[d]:g[d]!==b?(qb.setupOptions[d]=a[d],qb[d]=a[d]):h[d]===b?(V(O(qb[d]===b?"setupUndef":"setupError",d),2),e=!1):qb[d]instanceof Function?qb[d].apply(qb,a[d]instanceof Array?a[d]:[a[d]]):qb[d]=a[d];else{if(h[d]!==b)return q(a[d],d);V(O(qb[d]===b?"setupUndef":"setupError",d),2),e=!1}return e},hb=function(){function b(a){var b=Rb.call(a),c=b.length;return f?(b[1]="on"+b[1],c>3&&b.pop()):3===c&&b.push(!1),b}function c(a,b){var c=a.shift(),d=[g[b]];f?c[d](a[0],a[1]):c[d].apply(c,a)}function d(){c(b(arguments),"add")}function e(){c(b(arguments),"remove")}var f=a.attachEvent,g={add:f?"attachEvent":"addEventListener",remove:f?"detachEvent":"removeEventListener"};return{add:d,remove:e}}(),mb={abort:f(function(){qb._wD(this._s.id+": abort")}),canplay:f(function(){var a,c=this._s;if(c._html5_canplay)return!0;if(c._html5_canplay=!0,qb._wD(c.id+": canplay"),c._onbufferchange(0),a=c._iO.position===b||isNaN(c._iO.position)?null:c._iO.position/fc,this.currentTime!==a){qb._wD(c.id+": canplay: Setting position to "+a);try{this.currentTime=a}catch(d){qb._wD(c.id+": canplay: Setting position of "+a+" failed: "+d.message,2)}}c._iO._oncanplay&&c._iO._oncanplay()}),canplaythrough:f(function(){var a=this._s;a.loaded||(a._onbufferchange(0),a._whileloading(a.bytesLoaded,a.bytesTotal,a._get_html5_duration()),a._onload(!0))}),durationchange:f(function(){var a,b=this._s;a=b._get_html5_duration(),isNaN(a)||a===b.duration||(qb._wD(this._s.id+": durationchange ("+a+")"+(b.duration?", previously "+b.duration:"")),b.durationEstimate=b.duration=a)}),ended:f(function(){var a=this._s;qb._wD(a.id+": ended"),a._onfinish()}),error:f(function(){qb._wD(this._s.id+": HTML5 error, code "+this.error.code),this._s._onload(!1)}),loadeddata:f(function(){var a=this._s;qb._wD(a.id+": loadeddata"),a._loaded||Yb||(a.duration=a._get_html5_duration())}),loadedmetadata:f(function(){qb._wD(this._s.id+": loadedmetadata")}),loadstart:f(function(){qb._wD(this._s.id+": loadstart"),this._s._onbufferchange(1)}),play:f(function(){this._s._onbufferchange(0)}),playing:f(function(){qb._wD(this._s.id+": playing "+String.fromCharCode(9835)),this._s._onbufferchange(0)}),progress:f(function(a){var b,c,d,e=this._s,f=0,g="progress"===a.type,h=a.target.buffered,i=a.loaded||0,j=a.total||1;if(e.buffered=[],h&&h.length){for(b=0,c=h.length;c>b;b++)e.buffered.push({start:h.start(b)*fc,end:h.end(b)*fc});if(f=(h.end(0)-h.start(0))*fc,i=Math.min(1,f/(a.target.duration*fc)),g&&h.length>1){for(d=[],c=h.length,b=0;c>b;b++)d.push(a.target.buffered.start(b)*fc+"-"+a.target.buffered.end(b)*fc);qb._wD(this._s.id+": progress, timeRanges: "+d.join(", "))}g&&!isNaN(i)&&qb._wD(this._s.id+": progress, "+Math.floor(100*i)+"% loaded")}isNaN(i)||(e._whileloading(i,j,e._get_html5_duration()),i&&j&&i===j&&mb.canplaythrough.call(this,a))}),ratechange:f(function(){qb._wD(this._s.id+": ratechange")}),suspend:f(function(a){var b=this._s;qb._wD(this._s.id+": suspend"),mb.progress.call(this,a),b._onsuspend()}),stalled:f(function(){qb._wD(this._s.id+": stalled")}),timeupdate:f(function(){this._s._onTimer()}),waiting:f(function(){var a=this._s;qb._wD(this._s.id+": waiting"),a._onbufferchange(1)})},bb=function(a){var b;return b=a&&(a.type||a.url||a.serverURL)?a.serverURL||a.type&&e(a.type)?!1:a.type?cb({type:a.type}):cb({url:a.url})||qb.html5Only||a.url.match(/data\:/i):!1},eb=function(a){var b;return a&&(b=Yb?gc:qb.html5.canPlayType("audio/wav")?hc:gc,a.src=b,void 0!==a._called_unload&&(a._called_load=!1)),Sb&&(ib=null),b},cb=function(a){if(!qb.useHTML5Audio||!qb.hasHTML5)return!1;var c,d,f,g,h=a.url||null,i=a.type||null,j=qb.audioFormats;if(i&&qb.html5[i]!==b)return qb.html5[i]&&!e(i);if(!db){db=[];for(g in j)j.hasOwnProperty(g)&&(db.push(g),j[g].related&&(db=db.concat(j[g].related)));db=new RegExp("\\.("+db.join("|")+")(\\?.*)?$","i")}return f=h?h.toLowerCase().match(db):null,f&&f.length?f=f[1]:i?(d=i.indexOf(";"),f=(-1!==d?i.substr(0,d):i).substr(6)):c=!1,f&&qb.html5[f]!==b?c=qb.html5[f]&&!e(f):(i="audio/"+f,c=qb.html5.canPlayType({type:i}),qb.html5[f]=c,c=c&&qb.html5[i]&&!e(i)),c},gb=function(){function a(a){var b,c,d=!1,e=!1;if(!g||"function"!=typeof g.canPlayType)return d;if(a instanceof Array){for(f=0,c=a.length;c>f;f++)(qb.html5[a[f]]||g.canPlayType(a[f]).match(qb.html5Test))&&(e=!0,qb.html5[a[f]]=!0,qb.flash[a[f]]=!!a[f].match(ec));d=e}else b=g&&"function"==typeof g.canPlayType?g.canPlayType(a):!1,d=!(!b||!b.match(qb.html5Test));return d}if(!qb.useHTML5Audio||!qb.hasHTML5)return qb.html5.usingFlash=!0,Qb=!0,!1;var c,d,e,f,g=Audio!==b?Zb&&opera.version()<10?new Audio(null):new Audio:null,h={};e=qb.audioFormats;for(c in e)if(e.hasOwnProperty(c)&&(d="audio/"+c,h[c]=a(e[c].type),h[d]=h[c],c.match(ec)?(qb.flash[c]=!0,qb.flash[d]=!0):(qb.flash[c]=!1,qb.flash[d]=!1),e[c]&&e[c].related))for(f=e[c].related.length-1;f>=0;f--)h["audio/"+e[c].related[f]]=h[c],qb.html5[e[c].related[f]]=h[c],qb.flash[e[c].related[f]]=h[c]; -return h.canPlayType=g?a:null,qb.html5=p(qb.html5,h),qb.html5.usingFlash=ab(),Qb=qb.html5.usingFlash,!0},A={notReady:"Unavailable - wait until onready() has fired.",notOK:"Audio support is not available.",domError:tb+"exception caught while appending SWF to DOM.",spcWmode:"Removing wmode, preventing known SWF loading issue(s)",swf404:ub+"Verify that %s is a valid path.",tryDebug:"Try "+tb+".debugFlash = true for more security details (output goes to SWF.)",checkSWF:"See SWF output for more debug info.",localFail:ub+"Non-HTTP page ("+yb.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:ub+"Special case: Waiting for SWF to load with window focus...",waitForever:ub+"Waiting indefinitely for Flash (will recover if unblocked)...",waitSWF:ub+"Waiting for 100% SWF load...",needFunction:ub+"Function object expected for %s",badID:'Sound ID "%s" should be a string, starting with a non-numeric character',currentObj:ub+"_debug(): Current sound objects",waitOnload:ub+"Waiting for window.onload()",docLoaded:ub+"Document already loaded",onload:ub+"initComplete(): calling soundManager.onload()",onloadOK:tb+".onload() complete",didInit:ub+"init(): Already called?",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",badRemove:ub+"Failed to remove Flash node.",shutdown:tb+".disable(): Shutting down",queue:ub+"Queueing %s handler",smError:"SMSound.load(): Exception: JS-Flash communication failed, or JS error.",fbTimeout:"No flash response, applying ."+R.swfTimedout+" CSS...",fbLoaded:"Flash loaded",fbHandler:ub+"flashBlockHandler()",manURL:"SMSound.load(): Using manually-assigned URL",onURL:tb+".load(): current URL already assigned.",badFV:tb+'.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",needFlash:ub+"Fatal error: Flash is needed to play some required formats, but is not available.",gotFocus:ub+"Got window focus.",policy:"Enabling usePolicyFile for data access",setup:tb+".setup(): allowed parameters: %s",setupError:tb+'.setup(): "%s" cannot be assigned with this method.',setupUndef:tb+'.setup(): Could not find option "%s"',setupLate:tb+".setup(): url, flashVersion and html5Test property changes will not take effect until reboot().",noURL:ub+"Flash URL required. Call soundManager.setup({url:...}) to get started.",sm2Loaded:"SoundManager 2: Ready. "+String.fromCharCode(10003),reset:tb+".reset(): Removing event callbacks",mobileUA:"Mobile UA detected, preferring HTML5 by default.",globalHTML5:"Using singleton HTML5 Audio() pattern for this device."},O=function(){var a,b,c,d,e;if(a=Rb.call(arguments),d=a.shift(),e=A&&A[d]?A[d]:"",e&&a&&a.length)for(b=0,c=a.length;c>b;b++)e=e.replace("%s",a[b]);return e},T=function(a){return 8===l&&a.loops>1&&a.stream&&(n("as2loop"),a.stream=!1),a},U=function(a,b){return a&&!a.usePolicyFile&&(a.onid3||a.usePeakData||a.useWaveformData||a.useEQData)&&(qb._wD((b||"")+O("policy")),a.usePolicyFile=!0),a},V=function(a){ac&&console.warn!==b?console.warn(a):qb._wD(a)},i=function(){return!1},L=function(a){var b;for(b in a)a.hasOwnProperty(b)&&"function"==typeof a[b]&&(a[b]=i);b=null},M=function(a){a===b&&(a=!1),(Eb||a)&&qb.disable(a)},N=function(a){var b,c=null;if(a)if(a.match(/\.swf(\?.*)?$/i)){if(c=a.substr(a.toLowerCase().lastIndexOf(".swf?")+4))return a}else a.lastIndexOf("/")!==a.length-1&&(a+="/");return b=(a&&-1!==a.lastIndexOf("/")?a.substr(0,a.lastIndexOf("/")+1):"./")+qb.movieURL,qb.noSWFCache&&(b+="?ts="+(new Date).getTime()),b},y=function(){l=parseInt(qb.flashVersion,10),8!==l&&9!==l&&(qb._wD(O("badFV",l,Ib)),qb.flashVersion=l=Ib);var a=qb.debugMode||qb.debugFlash?"_debug.swf":".swf";qb.useHTML5Audio&&!qb.html5Only&&qb.audioFormats.mp4.required&&9>l&&(qb._wD(O("needfl9")),qb.flashVersion=l=9),qb.version=qb.versionNumber+(qb.html5Only?" (HTML5-only mode)":9===l?" (AS3/Flash 9)":" (AS2/Flash 8)"),l>8?(qb.defaultOptions=p(qb.defaultOptions,qb.flash9Options),qb.features.buffering=!0,qb.defaultOptions=p(qb.defaultOptions,qb.movieStarOptions),qb.filePatterns.flash9=new RegExp("\\.(mp3|"+lc.join("|")+")(\\?.*)?$","i"),qb.features.movieStar=!0):qb.features.movieStar=!1,qb.filePattern=qb.filePatterns[8!==l?"flash9":"flash8"],qb.movieURL=(8===l?"soundmanager2.swf":"soundmanager2_flash9.swf").replace(".swf",a),qb.features.peakData=qb.features.waveformData=qb.features.eqData=l>8},J=function(a,b){return sb?void sb._setPolling(a,b):!1},K=function(){if(qb.debugURLParam.test(xb)&&(qb.debugMode=!0),h(qb.debugID))return!1;var a,b,c,d,e;if(!(!qb.debugMode||h(qb.debugID)||ac&&qb.useConsole&&qb.consoleOnly)){a=yb.createElement("div"),a.id=qb.debugID+"-toggle",d={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},a.appendChild(yb.createTextNode("-")),a.onclick=S,a.title="Toggle SM2 debug console",wb.match(/msie 6/i)&&(a.style.position="absolute",a.style.cursor="hand");for(e in d)d.hasOwnProperty(e)&&(a.style[e]=d[e]);if(b=yb.createElement("div"),b.id=qb.debugID,b.style.display=qb.debugMode?"block":"none",qb.debugMode&&!h(a.id)){try{c=G(),c.appendChild(a)}catch(f){throw new Error(O("domError")+" \n"+f.toString())}c.appendChild(b)}}c=null},W=this.getSoundById,n=function(a,b){return a?qb._wD(O(a),b):""},S=function(){var a=h(qb.debugID),b=h(qb.debugID+"-toggle");return a?(Ab?(b.innerHTML="+",a.style.display="none"):(b.innerHTML="-",a.style.display="block"),void(Ab=!Ab)):!1},m=function(c,d,e){if(a.sm2Debugger!==b)try{sm2Debugger.handleEvent(c,d,e)}catch(f){return!1}return!0},Q=function(){var a=[];return qb.debugMode&&a.push(R.sm2Debug),qb.debugFlash&&a.push(R.flashDebug),qb.useHighPerformance&&a.push(R.highPerf),a.join(" ")},P=function(){var a=O("fbHandler"),b=qb.getMoviePercent(),c=R,d={type:"FLASHBLOCK"};return qb.html5Only?!1:void(qb.ok()?(qb.didFlashBlock&&qb._wD(a+": Unblocked"),qb.oMC&&(qb.oMC.className=[Q(),c.swfDefault,c.swfLoaded+(qb.didFlashBlock?" "+c.swfUnblocked:"")].join(" "))):(Qb&&(qb.oMC.className=Q()+" "+c.swfDefault+" "+(null===b?c.swfTimedout:c.swfError),qb._wD(a+": "+O("fbTimeout")+(b?" ("+O("fbLoaded")+")":""))),qb.didFlashBlock=!0,t({type:"ontimeout",ignoreInit:!0,error:d}),I(d)))},s=function(a,c,d){zb[a]===b&&(zb[a]=[]),zb[a].push({method:c,scope:d||null,fired:!1})},t=function(a){if(a||(a={type:qb.ok()?"onready":"ontimeout"}),!Db&&a&&!a.ignoreInit)return!1;if("ontimeout"===a.type&&(qb.ok()||Eb&&!a.ignoreInit))return!1;var b,c,d={success:a&&a.ignoreInit?qb.ok():!Eb},e=a&&a.type?zb[a.type]||[]:[],f=[],g=[d],h=Qb&&!qb.ok();for(a.error&&(g[0].error=a.error),b=0,c=e.length;c>b;b++)e[b].fired!==!0&&f.push(e[b]);if(f.length)for(b=0,c=f.length;c>b;b++)f[b].scope?f[b].method.apply(f[b].scope,g):f[b].method.apply(this,g),h||(f[b].fired=!0);return!0},u=function(){a.setTimeout(function(){qb.useFlashBlock&&P(),t(),"function"==typeof qb.onload&&(n("onload",1),qb.onload.apply(a),n("onloadOK",1)),qb.waitForWindowLoad&&hb.add(a,"load",u)},1)},kb=function(){if(jb!==b)return jb;var c,d,e,f=!1,g=navigator,h=g.plugins,i=a.ActiveXObject;if(h&&h.length)d="application/x-shockwave-flash",e=g.mimeTypes,e&&e[d]&&e[d].enabledPlugin&&e[d].enabledPlugin.description&&(f=!0);else if(i!==b&&!wb.match(/MSAppHost/i)){try{c=new i("ShockwaveFlash.ShockwaveFlash")}catch(j){c=null}f=!!c,c=null}return jb=f,f},ab=function(){var a,b,c=qb.audioFormats,d=Ub&&!!wb.match(/os (1|2|3_0|3_1)\s/i);if(d?(qb.hasHTML5=!1,qb.html5Only=!0,qb.oMC&&(qb.oMC.style.display="none")):qb.useHTML5Audio&&(qb.html5&&qb.html5.canPlayType||(qb._wD("SoundManager: No HTML5 Audio() support detected."),qb.hasHTML5=!1),_b&&qb._wD(ub+"Note: Buggy HTML5 Audio in Safari on this OS X release, see https://bugs.webkit.org/show_bug.cgi?id=32159 - "+(jb?"will use flash fallback for MP3/MP4, if available":" would use flash fallback for MP3/MP4, but none detected."),1)),qb.useHTML5Audio&&qb.hasHTML5){_=!0;for(b in c)c.hasOwnProperty(b)&&c[b].required&&(qb.html5.canPlayType(c[b].type)?qb.preferFlash&&(qb.flash[b]||qb.flash[c[b].type])&&(a=!0):(_=!1,a=!0))}return qb.ignoreFlash&&(a=!1,_=!0),qb.html5Only=qb.hasHTML5&&qb.useHTML5Audio&&!a,!qb.html5Only},$=function(a){var b,c,d,e=0;if(a instanceof Array){for(b=0,c=a.length;c>b;b++)if(a[b]instanceof Object){if(qb.canPlayMIME(a[b].type)){e=b;break}}else if(qb.canPlayURL(a[b])){e=b;break}a[e].url&&(a[e]=a[e].url),d=a[e]}else d=a;return d},X=function(a){a._hasTimer||(a._hasTimer=!0,!$b&&qb.html5PollingInterval&&(null===Ob&&0===Nb&&(Ob=setInterval(Z,qb.html5PollingInterval)),Nb++))},Y=function(a){a._hasTimer&&(a._hasTimer=!1,!$b&&qb.html5PollingInterval&&Nb--)},Z=function(){var a;if(null!==Ob&&!Nb)return clearInterval(Ob),Ob=null,!1;for(a=qb.soundIDs.length-1;a>=0;a--)qb.sounds[qb.soundIDs[a]].isHTML5&&qb.sounds[qb.soundIDs[a]]._hasTimer&&qb.sounds[qb.soundIDs[a]]._onTimer()},I=function(c){c=c!==b?c:{},"function"==typeof qb.onerror&&qb.onerror.apply(a,[{type:c.type!==b?c.type:null}]),c.fatal!==b&&c.fatal&&qb.disable()},lb=function(){if(!_b||!kb())return!1;var a,b,c=qb.audioFormats;for(b in c)if(c.hasOwnProperty(b)&&("mp3"===b||"mp4"===b)&&(qb._wD(tb+": Using flash fallback for "+b+" format"),qb.html5[b]=!1,c[b]&&c[b].related))for(a=c[b].related.length-1;a>=0;a--)qb.html5[c[b].related[a]]=!1},this._setSandboxType=function(a){var c=qb.sandbox;c.type=a,c.description=c.types[c.types[a]!==b?a:"unknown"],"localWithFile"===c.type?(c.noRemote=!0,c.noLocal=!1,n("secNote",2)):"localWithNetwork"===c.type?(c.noRemote=!1,c.noLocal=!0):"localTrusted"===c.type&&(c.noRemote=!1,c.noLocal=!1)},this._externalInterfaceOK=function(a){if(qb.swfLoaded)return!1;var b;return m("swf",!0),m("flashtojs",!0),qb.swfLoaded=!0,cc=!1,_b&&lb(),a&&a.replace(/\+dev/i,"")===qb.versionNumber.replace(/\+dev/i,"")?void setTimeout(k,Wb?100:1):(b=tb+': Fatal: JavaScript file build "'+qb.versionNumber+'" does not match Flash SWF build "'+a+'" at '+qb.url+". Ensure both are up-to-date.",setTimeout(function(){throw new Error(b)},0),!1)},H=function(a,c){function d(){var a,b=[],c=[],d=" + ";a="SoundManager "+qb.version+(!qb.html5Only&&qb.useHTML5Audio?qb.hasHTML5?" + HTML5 audio":", no HTML5 audio support":""),qb.html5Only?qb.html5PollingInterval&&b.push("html5PollingInterval ("+qb.html5PollingInterval+"ms)"):(qb.preferFlash&&b.push("preferFlash"),qb.useHighPerformance&&b.push("useHighPerformance"),qb.flashPollingInterval&&b.push("flashPollingInterval ("+qb.flashPollingInterval+"ms)"),qb.html5PollingInterval&&b.push("html5PollingInterval ("+qb.html5PollingInterval+"ms)"),qb.wmode&&b.push("wmode ("+qb.wmode+")"),qb.debugFlash&&b.push("debugFlash"),qb.useFlashBlock&&b.push("flashBlock")),b.length&&(c=c.concat([b.join(d)])),qb._wD(a+(c.length?d+c.join(", "):""),1),nb()}function e(a,b){return''}if(Bb&&Cb)return!1;if(qb.html5Only)return y(),d(),qb.oMC=h(qb.movieID),k(),Bb=!0,Cb=!0,!1;var f,g,i,j,l,m,n,o,p=c||qb.url,q=qb.altURL||p,r="JS/Flash audio component (SoundManager 2)",s=G(),t=Q(),u=null,v=yb.getElementsByTagName("html")[0];if(u=v&&v.dir&&v.dir.match(/rtl/i),a=a===b?qb.id:a,y(),qb.url=N(ic?p:q),c=qb.url,qb.wmode=!qb.wmode&&qb.useHighPerformance?"transparent":qb.wmode,null!==qb.wmode&&(wb.match(/msie 8/i)||!Wb&&!qb.useHighPerformance)&&navigator.platform.match(/win32|win64/i)&&(Pb.push(A.spcWmode),qb.wmode=null),f={name:a,id:a,src:c,quality:"high",allowScriptAccess:qb.allowScriptAccess,bgcolor:qb.bgColor,pluginspage:jc+"www.macromedia.com/go/getflashplayer",title:r,type:"application/x-shockwave-flash",wmode:qb.wmode,hasPriority:"true"},qb.debugFlash&&(f.FlashVars="debug=1"),qb.wmode||delete f.wmode,Wb)g=yb.createElement("div"),j=['',e("movie",c),e("AllowScriptAccess",qb.allowScriptAccess),e("quality",f.quality),qb.wmode?e("wmode",qb.wmode):"",e("bgcolor",qb.bgColor),e("hasPriority","true"),qb.debugFlash?e("FlashVars",f.FlashVars):"",""].join("");else{g=yb.createElement("embed");for(i in f)f.hasOwnProperty(i)&&g.setAttribute(i,f[i])}if(K(),t=Q(),s=G())if(qb.oMC=h(qb.movieID)||yb.createElement("div"),qb.oMC.id)o=qb.oMC.className,qb.oMC.className=(o?o+" ":R.swfDefault)+(t?" "+t:""),qb.oMC.appendChild(g),Wb&&(l=qb.oMC.appendChild(yb.createElement("div")),l.className=R.swfBox,l.innerHTML=j),Cb=!0;else{if(qb.oMC.id=qb.movieID,qb.oMC.className=R.swfDefault+" "+t,m=null,l=null,qb.useFlashBlock||(qb.useHighPerformance?m={position:"fixed",width:"8px",height:"8px",bottom:"0px",left:"0px",overflow:"hidden"}:(m={position:"absolute",width:"6px",height:"6px",top:"-9999px",left:"-9999px"},u&&(m.left=Math.abs(parseInt(m.left,10))+"px"))),Xb&&(qb.oMC.style.zIndex=1e4),!qb.debugFlash)for(n in m)m.hasOwnProperty(n)&&(qb.oMC.style[n]=m[n]);try{Wb||qb.oMC.appendChild(g),s.appendChild(qb.oMC),Wb&&(l=qb.oMC.appendChild(yb.createElement("div")),l.className=R.swfBox,l.innerHTML=j),Cb=!0}catch(w){throw new Error(O("domError")+" \n"+w.toString())}}return Bb=!0,d(),!0},B=function(){return qb.html5Only?(H(),!1):sb?!1:qb.url?(sb=qb.getMovie(qb.id),sb||(Jb?(Wb?qb.oMC.innerHTML=Kb:qb.oMC.appendChild(Jb),Jb=null,Bb=!0):H(qb.id,qb.url),sb=qb.getMovie(qb.id)),"function"==typeof qb.oninitmovie&&setTimeout(qb.oninitmovie,1),ob(),!0):(n("noURL"),!1)},v=function(){setTimeout(w,1e3)},x=function(){a.setTimeout(function(){V(ub+"useFlashBlock is false, 100% HTML5 mode is possible. Rebooting with preferFlash: false..."),qb.setup({preferFlash:!1}).reboot(),qb.didFlashBlock=!0,qb.beginDelayedInit()},1)},w=function(){var b,c=!1;return qb.url?Lb?!1:(Lb=!0,hb.remove(a,"load",v),jb&&cc&&!bc?(n("waitFocus"),!1):(Db||(b=qb.getMoviePercent(),b>0&&100>b&&(c=!0)),void setTimeout(function(){return b=qb.getMoviePercent(),c?(Lb=!1,qb._wD(O("waitSWF")),a.setTimeout(v,1),!1):(Db||(qb._wD(tb+": No Flash response within expected time. Likely causes: "+(0===b?"SWF load failed, ":"")+"Flash blocked or JS-Flash security error."+(qb.debugFlash?" "+O("checkSWF"):""),2),!ic&&b&&(n("localFail",2),qb.debugFlash||n("tryDebug",2)),0===b&&qb._wD(O("swf404",qb.url),1),m("flashtojs",!1," (Check flash security or flash blockers)")),void(!Db&&dc&&(null===b?qb.useFlashBlock||0===qb.flashLoadTimeout?(qb.useFlashBlock&&P(),n("waitForever")):!qb.useFlashBlock&&_?x():(n("waitForever"),t({type:"ontimeout",ignoreInit:!0,error:{type:"INIT_FLASHBLOCK"}})):0===qb.flashLoadTimeout?n("waitForever"):!qb.useFlashBlock&&_?x():M(!0))))},qb.flashLoadTimeout))):!1},z=function(){function b(){hb.remove(a,"focus",z)}return bc||!cc?(b(),!0):(dc=!0,bc=!0,n("gotFocus"),Lb=!1,v(),b(),!0)},ob=function(){Pb.length&&(qb._wD("SoundManager 2: "+Pb.join(" "),1),Pb=[])},nb=function(){ob();var a,b=[];if(qb.useHTML5Audio&&qb.hasHTML5){for(a in qb.audioFormats)qb.audioFormats.hasOwnProperty(a)&&b.push(a+" = "+qb.html5[a]+(!qb.html5[a]&&Qb&&qb.flash[a]?" (using flash)":qb.preferFlash&&qb.flash[a]&&Qb?" (preferring flash)":qb.html5[a]?"":" ("+(qb.audioFormats[a].required?"required, ":"")+"and no flash support)"));qb._wD("SoundManager 2 HTML5 support: "+b.join(", "),1)}},o=function(b){if(Db)return!1;if(qb.html5Only)return n("sm2Loaded",1),Db=!0,u(),m("onload",!0),!0;var c,d=qb.useFlashBlock&&qb.flashLoadTimeout&&!qb.getMoviePercent(),e=!0;return d||(Db=!0),c={type:!jb&&Qb?"NO_FLASH":"INIT_TIMEOUT"},qb._wD("SoundManager 2 "+(Eb?"failed to load":"loaded")+" ("+(Eb?"Flash security/load error":"OK")+") "+String.fromCharCode(Eb?10006:10003),Eb?2:1),Eb||b?(qb.useFlashBlock&&qb.oMC&&(qb.oMC.className=Q()+" "+(null===qb.getMoviePercent()?R.swfTimedout:R.swfError)),t({type:"ontimeout",error:c,ignoreInit:!0}),m("onload",!1),I(c),e=!1):m("onload",!0),Eb||(qb.waitForWindowLoad&&!Fb?(n("waitOnload"),hb.add(a,"load",u)):(qb.waitForWindowLoad&&Fb&&n("docLoaded"),u())),e},j=function(){var a,c=qb.setupOptions;for(a in c)c.hasOwnProperty(a)&&(qb[a]===b?qb[a]=c[a]:qb[a]!==c[a]&&(qb.setupOptions[a]=qb[a]))},k=function(){function b(){hb.remove(a,"load",qb.beginDelayedInit)}if(Db)return n("didInit"),!1;if(qb.html5Only)return Db||(b(),qb.enabled=!0,o()),!0;B();try{sb._externalInterfaceTest(!1),J(!0,qb.flashPollingInterval||(qb.useHighPerformance?10:50)),qb.debugMode||sb._disableDebug(),qb.enabled=!0,m("jstoflash",!0),qb.html5Only||hb.add(a,"unload",i)}catch(c){return qb._wD("js/flash exception: "+c.toString()),m("jstoflash",!1),I({type:"JS_TO_FLASH_EXCEPTION",fatal:!0}),M(!0),o(),!1}return o(),b(),!0},D=function(){return F?!1:(F=!0,j(),K(),function(){var a="sm2-usehtml5audio=",b="sm2-preferflash=",c=null,d=null,e=xb.toLowerCase();-1!==e.indexOf(a)&&(c="1"===e.charAt(e.indexOf(a)+a.length),ac&&console.log((c?"Enabling ":"Disabling ")+"useHTML5Audio via URL parameter"),qb.setup({useHTML5Audio:c})),-1!==e.indexOf(b)&&(d="1"===e.charAt(e.indexOf(b)+b.length),ac&&console.log((d?"Enabling ":"Disabling ")+"preferFlash via URL parameter"),qb.setup({preferFlash:d}))}(),!jb&&qb.hasHTML5&&(qb._wD("SoundManager 2: No Flash detected"+(qb.useHTML5Audio?". Trying HTML5-only mode.":", enabling HTML5."),1),qb.setup({useHTML5Audio:!0,preferFlash:!1})),gb(),!jb&&Qb&&(Pb.push(A.needFlash),qb.setup({flashLoadTimeout:1})),yb.removeEventListener&&yb.removeEventListener("DOMContentLoaded",D,!1),B(),!0)},fb=function(){return"complete"===yb.readyState&&(D(),yb.detachEvent("onreadystatechange",fb)),!0},E=function(){Fb=!0,D(),hb.remove(a,"load",E)},C=function(){$b&&((!qb.setupOptions.useHTML5Audio||qb.setupOptions.preferFlash)&&Pb.push(A.mobileUA),qb.setupOptions.useHTML5Audio=!0,qb.setupOptions.preferFlash=!1,(Ub||Vb&&!wb.match(/android\s2\.3/i))&&(Pb.push(A.globalHTML5),Ub&&(qb.ignoreFlash=!0),Sb=!0))},C(),kb(),hb.add(a,"focus",z),hb.add(a,"load",v),hb.add(a,"load",E),yb.addEventListener?yb.addEventListener("DOMContentLoaded",D,!1):yb.attachEvent?yb.attachEvent("onreadystatechange",fb):(m("onload",!1),I({type:"NO_DOM2_EVENTS",fatal:!0}))}if(!a||!a.document)throw new Error("SoundManager requires a browser with window and document objects.");var d=null;void 0!==a.SM2_DEFER&&SM2_DEFER||(d=new c),"object"==typeof module&&module&&"object"==typeof module.exports?(a.soundManager=d,module.exports.SoundManager=c,module.exports.soundManager=d):"function"==typeof define&&define.amd?define("SoundManager",[],function(){return{SoundManager:c,soundManager:d}}):(a.SoundManager=c,a.soundManager=d)}(window);var ngSoundManager=angular.module("angularSoundManager",[]).config(["$logProvider",function(a){a.debugEnabled(!1)}]);ngSoundManager.filter("humanTime",function(){return function(a){function b(a){return 10>a?"0"+a.toString():a.toString()}var c=a/1e3/60<<0,d=Math.round(a/1e3%60);return b(c)+":"+b(d)}}),ngSoundManager.factory("angularPlayer",["$rootScope","$log",function(a,b){var c=null,d=!1,e=!0,f=!1,g=90,h=0,i=[];return{init:function(){"undefined"==typeof soundManager&&alert("Please include SoundManager2 Library!"),soundManager.setup({preferFlash:!1,debugMode:!1,useHTML5Audio:!0,onready:function(){},ontimeout:function(){alert("SM2 failed to start. Flash missing, blocked or security error?"),alert("The status is "+status.success+", the error type is "+status.error.type)},defaultOptions:{autoLoad:!1,autoPlay:!1,from:null,loops:1,multiShot:!1,multiShotEvents:!1,onid3:null,onload:null,onstop:null,onfailure:"nextTrack",onpause:null,onplay:null,onresume:null,position:null,pan:0,stream:!0,to:null,type:"audio/mp3",usePolicyFile:!1,volume:g,whileloading:function(){var b=this.bytesLoaded/this.bytesTotal*100;a.$broadcast("track:loaded",b)},whileplaying:function(){c=this.id,h=this.position/this.duration*100,a.$broadcast("track:progress",h),a.$broadcast("currentTrack:position",this.position),a.$broadcast("currentTrack:duration",this.duration)},onfinish:function(){if(soundManager._writeDebug(this.id+" finished playing"),e===!0){var b=angular.element(document.querySelector("[ng-app]")),d=b.injector(),f=d.get("angularPlayer");f.nextTrack(),a.$broadcast("track:id",c)}}}}),soundManager.onready(function(){b.debug("song manager ready!");var c=soundManager.ok();b.debug("is supported: "+c),a.$broadcast("angularPlayer:ready",!0)})},isInArray:function(a,b){for(var c=0;c-1){if("undefined"==typeof a.url)return b.debug("invalid soundcloud track url"),!1}else if(soundManager.canPlayURL(a.url)!==!0)return b.debug("invalid song url"),!1},addTrack:function(a){if(!this.isTrackValid)return null;var b=this.isInArray(this.getPlaylist(),a.id);return b===!1&&(soundManager.createSound({id:a.id,url:a.url}),this.addToPlaylist(a)),a.id},removeSong:function(b,d){b===c&&this.stop(),soundManager.destroySound(b),i.splice(d,1),a.$broadcast("player:playlist",i)},initPlayTrack:function(b,c){c!==!0&&(this.stop(),this.setCurrentTrack(b)),soundManager.play(b),a.$broadcast("track:id",b),f=!0,a.$broadcast("music:isPlaying",f)},play:function(){var a=null;if(null===this.getCurrentTrack()){if(0===soundManager.soundIDs.length)return void b.debug("playlist is empty!");a=soundManager.soundIDs[0],this.initPlayTrack(a)}else a=this.getCurrentTrack(),this.initPlayTrack(a,!0)},pause:function(){soundManager.pause(this.getCurrentTrack()),f=!1,a.$broadcast("music:isPlaying",f)},stop:function(){this.pause(),this.resetProgress(),a.$broadcast("track:progress",h),a.$broadcast("currentTrack:position",0),a.$broadcast("currentTrack:duration",0),soundManager.stopAll(),soundManager.unload(this.getCurrentTrack())},playTrack:function(a){this.initPlayTrack(a)},nextTrack:function(){if(null===this.getCurrentTrack())return b.debug("Please click on Play before this action"),null;var c=this.getIndexByValue(soundManager.soundIDs,this.getCurrentTrack()),e=+c+1,g=soundManager.soundIDs[e];"undefined"!=typeof g?this.playTrack(g):d===!0?this.playTrack(soundManager.soundIDs[0]):(f=!1,a.$broadcast("music:isPlaying",f))},prevTrack:function(){if(null===this.getCurrentTrack())return b.debug("Please click on Play before this action"),null;var a=this.getIndexByValue(soundManager.soundIDs,this.getCurrentTrack()),c=+a-1,d=soundManager.soundIDs[c];"undefined"!=typeof d?this.playTrack(d):b.debug("no prev track found!")},mute:function(){soundManager.muted===!0?soundManager.unmute():soundManager.mute(),a.$broadcast("music:mute",soundManager.muted)},getMuteStatus:function(){return soundManager.muted},repeatToggle:function(){d=d===!0?!1:!0,a.$broadcast("music:repeat",d)},getRepeatStatus:function(){return d},getVolume:function(){return g},adjustVolume:function(b){var c=function(b){for(var c=0;cg&&(g+=10,c(g)):g>0&&(g-=10,c(g))},adjustVolumeSlider:function(b){var c=function(b){for(var c=0;c8&&(null===h.isMovieStar&&(h.isMovieStar=!!(h.serverURL||!!h.type&&h.type.match(kb)||h.url&&h.url.match(mb))),h.isMovieStar&&(qa._wD(e+"using MovieStar handling"),h.loops>1&&n("noNSLoop"))),h=U(h,e),i=d(),8===l?sa._createSound(h.id,h.loops||1,h.usePolicyFile):(sa._createSound(h.id,h.url,h.usePeakData,h.useWaveformData,h.useEQData,h.isMovieStar,!!h.isMovieStar&&h.bufferTime,h.loops||1,h.serverURL,h.duration||null,h.autoPlay,!0,h.autoLoad,h.usePolicyFile),h.serverURL||(i.connected=!0,h.onconnect&&h.onconnect.apply(i))),h.serverURL||!h.autoLoad&&!h.autoPlay||i.load(h)}return!h.serverURL&&h.autoPlay&&i.play(),i},this.destroySound=function(a,b){if(!W(a))return!1;var c,d=qa.sounds[a];for(d._iO={},d.stop(),d.unload(),c=0;c=0;a--)qa.sounds[qa.soundIDs[a]].pause()},this.resume=function(a){return!!W(a)&&qa.sounds[a].resume()},this.resumeAll=function(){var a;for(a=qa.soundIDs.length-1;a>=0;a--)qa.sounds[qa.soundIDs[a]].resume()},this.togglePause=function(a){return!!W(a)&&qa.sounds[a].togglePause()},this.setPan=function(a,b){return!!W(a)&&qa.sounds[a].setPan(b)},this.setVolume=function(a,b){return!!W(a)&&qa.sounds[a].setVolume(b)},this.mute=function(a){var b=0;if(a instanceof String&&(a=null),a)return!!W(a)&&(qa._wD(ta+'.mute(): Muting "'+a+'"'),qa.sounds[a].mute());for(qa._wD(ta+".mute(): Muting all sounds"),b=qa.soundIDs.length-1;b>=0;b--)qa.sounds[qa.soundIDs[b]].mute();return qa.muted=!0,!0},this.muteAll=function(){qa.mute()},this.unmute=function(a){var b;if(a instanceof String&&(a=null),a)return!!W(a)&&(qa._wD(ta+'.unmute(): Unmuting "'+a+'"'),qa.sounds[a].unmute());for(qa._wD(ta+".unmute(): Unmuting all sounds"),b=qa.soundIDs.length-1;b>=0;b--)qa.sounds[qa.soundIDs[b]].unmute();return qa.muted=!1,!0},this.unmuteAll=function(){qa.unmute()},this.toggleMute=function(a){return!!W(a)&&qa.sounds[a].toggleMute()},this.getMemoryUse=function(){var a=0;return sa&&8!==l&&(a=parseInt(sa._getMemoryUse(),10)),a},this.disable=function(c){var d;if(c===b&&(c=!1),Ea)return!1;for(Ea=!0,n("shutdown",1),d=qa.soundIDs.length-1;d>=0;d--)L(qa.sounds[qa.soundIDs[d]]);return o(c),ha.remove(a,"load",u),!0},this.canPlayMIME=function(a){var b;return qa.hasHTML5&&(b=ca({type:a})),!b&&Qa&&(b=a&&qa.ok()?!!((l>8?a.match(kb):null)||a.match(qa.mimePattern)):null),b},this.canPlayURL=function(a){var b;return qa.hasHTML5&&(b=ca({url:a})),!b&&Qa&&(b=a&&qa.ok()?!!a.match(qa.filePattern):null),b},this.canPlayLink=function(a){return!(a.type===b||!a.type||!qa.canPlayMIME(a.type))||qa.canPlayURL(a.href)},this.getSoundById=function(a,b){if(!a)return null;var c=qa.sounds[a];return c||b||qa._wD(ta+'.getSoundById(): Sound "'+a+'" not found.',2),c},this.onready=function(b,c){var d="onready",e=!1;if("function"!=typeof b)throw O("needFunction",d);return Da&&qa._wD(O("queue",d)),c||(c=a),s(d,b,c),t(),e=!0,e},this.ontimeout=function(b,c){var d="ontimeout",e=!1;if("function"!=typeof b)throw O("needFunction",d);return Da&&qa._wD(O("queue",d)),c||(c=a),s(d,b,c),t({type:d}),e=!0,e},this._writeDebug=function(a,c){var d,e,f="soundmanager-debug";return!!qa.debugMode&&(!!(ab&&qa.useConsole&&(c&&"object"==typeof c?console.log(a,c):Ha[c]!==b?console[Ha[c]](a):console.log(a),qa.consoleOnly))||!!(d=h(f))&&(e=ya.createElement("div"),++Ga%2===0&&(e.className="sm2-alt"),c=c===b?0:parseInt(c,10),e.appendChild(ya.createTextNode(a)),c&&(c>=2&&(e.style.fontWeight="bold"),3===c&&(e.style.color="#ff3333")),d.insertBefore(e,d.firstChild),d=null,!0))},xa.indexOf("sm2-debug=alert")!==-1&&(this._writeDebug=function(b){a.alert(b)}),this._wD=this._writeDebug,this._debug=function(){var a,b;for(n("currentObj",1),a=0,b=qa.soundIDs.length;a=0;d--)qa.sounds[qa.soundIDs[d]].destruct();if(sa)try{Wa&&(Ka=sa.innerHTML),Ja=sa.parentNode.removeChild(sa)}catch(a){n("badRemove",2)}if(Ka=Ja=Qa=sa=null,qa.enabled=F=Da=La=Ma=Ba=Ca=Ea=Sa=qa.swfLoaded=!1,qa.soundIDs=[],qa.sounds={},Ta=0,b)za=[];else for(d in za)if(za.hasOwnProperty(d))for(e=0,f=za[d].length;e0&&q.position===q.duration&&(qa._wD(d+"Sound at end, resetting to position:0"),a.position=0),q.paused&&q.position>=0&&(!q._iO.serverURL||q.position>0))qa._wD(d+"Resuming from paused state",1),q.resume();else{if(q._iO=p(a,q._iO),(!q.isHTML5&&null!==q._iO.position&&q._iO.position>0||null!==q._iO.from&&q._iO.from>0||null!==q._iO.to)&&0===q.instanceCount&&0===q.playState&&!q._iO.serverURL){if(i=function(){q._iO=p(a,q._iO),q.play(q._iO)},q.isHTML5&&!q._html5_canplay?(qa._wD(d+"Beginning load for non-zero offset case"),q.load({_oncanplay:i}),t=!1):q.isHTML5||q.loaded||q.readyState&&2===q.readyState||(qa._wD(d+"Preloading for non-zero offset case"),q.load({onload:i}),t=!1),null!==t)return t;q._iO=j()}(!q.instanceCount||q._iO.multiShotEvents||q.isHTML5&&q._iO.multiShot&&!Sa||!q.isHTML5&&l>8&&!q.getAutoPlay())&&q.instanceCount++,q._iO.onposition&&0===q.playState&&h(q),q.playState=1,q.paused=!1,q.position=q._iO.position===b||isNaN(q._iO.position)?0:q._iO.position,q.isHTML5||(q._iO=U(T(q._iO))),q._iO.onplay&&c&&(q._iO.onplay.apply(q),r=!0),q.setVolume(q._iO.volume,!0),q.setPan(q._iO.pan,!0),q.isHTML5?q.instanceCount<2?(g(),f=q._setup_html5(),q.setPosition(q._iO.position),f.play()):(qa._wD(q.id+": Cloning Audio() for instance #"+q.instanceCount+"..."),k=new Audio(q._iO.url),m=function(){ha.remove(k,"ended",m),q._onfinish(q),ea(k),k=null},n=function(){ha.remove(k,"canplay",n);try{k.currentTime=q._iO.position/fb}catch(a){V(q.id+": multiShot play() failed to apply position of "+q._iO.position/fb)}k.play()},ha.add(k,"ended",m),void 0!==q._iO.volume&&(k.volume=Math.max(0,Math.min(1,q._iO.volume/100))),q.muted&&(k.muted=!0),q._iO.position?ha.add(k,"canplay",n):k.play()):(s=sa._start(q.id,q._iO.loops||1,9===l?q.position:q.position/fb,q._iO.multiShot||!1),9!==l||s||(qa._wD(d+"No sound hardware, or 32-sound ceiling hit",2),q._iO.onplayerror&&q._iO.onplayerror.apply(q)))}return q},this.start=this.play,this.stop=function(a){var b,c=q._iO;return 1===q.playState&&(qa._wD(q.id+": stop()"),q._onbufferchange(0),q._resetOnPosition(0),q.paused=!1,q.isHTML5||(q.playState=0),i(),c.to&&q.clearOnPosition(c.to),q.isHTML5?q._a&&(b=q.position,q.setPosition(0),q.position=b,q._a.pause(),q.playState=0,q._onTimer(),f()):(sa._stop(q.id,a),c.serverURL&&q.unload()),q.instanceCount=0,q._iO={},c.onstop&&c.onstop.apply(q)),q},this.setAutoPlay=function(a){qa._wD(q.id+": Autoplay turned "+(a?"on":"off")),q._iO.autoPlay=a,q.isHTML5||(sa._setAutoPlay(q.id,a),a&&(q.instanceCount||1!==q.readyState||(q.instanceCount++,qa._wD(q.id+": Incremented instance count to "+q.instanceCount))))},this.getAutoPlay=function(){return q._iO.autoPlay},this.setPosition=function(a){a===b&&(a=0);var c,d,e=q.isHTML5?Math.max(a,0):Math.min(q.duration||q._iO.duration,Math.max(a,0));if(q.position=e,d=q.position/fb,q._resetOnPosition(q.position),q._iO.position=e,q.isHTML5){if(q._a){if(q._html5_canplay){if(q._a.currentTime!==d){qa._wD(q.id+": setPosition("+d+")");try{q._a.currentTime=d,(0===q.playState||q.paused)&&q._a.pause()}catch(a){qa._wD(q.id+": setPosition("+d+") failed: "+a.message,2)}}}else if(d)return qa._wD(q.id+": setPosition("+d+"): Cannot seek yet, sound not ready",2),q;q.paused&&q._onTimer(!0)}}else c=9===l?q.position:d,q.readyState&&2!==q.readyState&&sa._setPosition(q.id,c,q.paused||!q.playState,q._iO.multiShot);return q},this.pause=function(a){return q.paused||0===q.playState&&1!==q.readyState?q:(qa._wD(q.id+": pause()"),q.paused=!0,q.isHTML5?(q._setup_html5().pause(),f()):(a||a===b)&&sa._pause(q.id,q._iO.multiShot),q._iO.onpause&&q._iO.onpause.apply(q),q)},this.resume=function(){var a=q._iO;return q.paused?(qa._wD(q.id+": resume()"),q.paused=!1,q.playState=1,q.isHTML5?(q._setup_html5().play(),g()):(a.isMovieStar&&!a.serverURL&&q.setPosition(q.position),sa._pause(q.id,a.multiShot)),!r&&a.onplay?(a.onplay.apply(q),r=!0):a.onresume&&a.onresume.apply(q),q):q},this.togglePause=function(){return qa._wD(q.id+": togglePause()"),0===q.playState?(q.play({position:9!==l||q.isHTML5?q.position/fb:q.position}),q):(q.paused?q.resume():q.pause(),q)},this.setPan=function(a,c){return a===b&&(a=0),c===b&&(c=!1),q.isHTML5||sa._setPan(q.id,a),q._iO.pan=a,c||(q.pan=a,q.options.pan=a),q},this.setVolume=function(a,c){return a===b&&(a=100),c===b&&(c=!1),q.isHTML5?q._a&&(qa.muted&&!q.muted&&(q.muted=!0,q._a.muted=!0),q._a.volume=Math.max(0,Math.min(1,a/100))):sa._setVolume(q.id,qa.muted&&!q.muted||q.muted?0:a),q._iO.volume=a,c||(q.volume=a,q.options.volume=a),q},this.mute=function(){return q.muted=!0,q.isHTML5?q._a&&(q._a.muted=!0):sa._setVolume(q.id,0),q},this.unmute=function(){q.muted=!1;var a=q._iO.volume!==b;return q.isHTML5?q._a&&(q._a.muted=!1):sa._setVolume(q.id,a?q._iO.volume:q.options.volume),q},this.toggleMute=function(){return q.muted?q.unmute():q.mute()},this.onPosition=function(a,c,d){return s.push({position:parseInt(a,10),method:c,scope:d!==b?d:q,fired:!1}),q},this.onposition=this.onPosition,this.clearOnPosition=function(a,b){var c;if(a=parseInt(a,10),isNaN(a))return!1;for(c=0;c=c)return!1;for(a=c-1;a>=0;a--)b=s[a],!b.fired&&q.position>=b.position&&(b.fired=!0,t++,b.method.apply(b.scope,[b.position]),c=s.length);return!0},this._resetOnPosition=function(a){var b,c,d=s.length;if(!d)return!1;for(b=d-1;b>=0;b--)c=s[b],c.fired&&a<=c.position&&(c.fired=!1,t--);return!0},j=function(){var a,b,c=q._iO,d=c.from,e=c.to;return b=function(){qa._wD(q.id+': "To" time of '+e+" reached."),q.clearOnPosition(e,b),q.stop()},a=function(){qa._wD(q.id+': Playing "from" '+d),null===e||isNaN(e)||q.onPosition(e,b)},null===d||isNaN(d)||(c.position=d,c.multiShot=!1,a()),c},h=function(){var a,b=q._iO.onposition;if(b)for(a in b)b.hasOwnProperty(a)&&q.onPosition(parseInt(a,10),b[a])},i=function(){var a,b=q._iO.onposition;if(b)for(a in b)b.hasOwnProperty(a)&&q.clearOnPosition(parseInt(a,10))},g=function(){q.isHTML5&&X(q)},f=function(){q.isHTML5&&Y(q)},c=function(a){a||(s=[],t=0),r=!1,q._hasTimer=null,q._a=null,q._html5_canplay=!1,q.bytesLoaded=null,q.bytesTotal=null,q.duration=q._iO&&q._iO.duration?q._iO.duration:null,q.durationEstimate=null,q.buffered=[],q.eqData=[],q.eqData.left=[],q.eqData.right=[],q.failures=0,q.isBuffering=!1,q.instanceOptions={},q.instanceCount=0,q.loaded=!1,q.metadata={},q.readyState=0,q.muted=!1,q.paused=!1,q.peakData={left:0,right:0},q.waveformData={left:[],right:[]},q.playState=0,q.position=null,q.id3={}},c(),this._onTimer=function(a){var b,c,d=!1,e={};if(q._hasTimer||a)return q._a&&(a||(q.playState>0||1===q.readyState)&&!q.paused)&&(b=q._get_html5_duration(),b!==k.duration&&(k.duration=b,q.duration=b,d=!0),q.durationEstimate=q.duration,c=q._a.currentTime*fb||0,c!==k.time&&(k.time=c,d=!0),(d||a)&&q._whileplaying(c,e,e,e,e)),d},this._get_html5_duration=function(){var a=q._iO,b=q._a&&q._a.duration?q._a.duration*fb:a&&a.duration?a.duration:null,c=b&&!isNaN(b)&&b!==1/0?b:null;return c},this._apply_loop=function(a,b){!a.loop&&b>1&&qa._wD("Note: Native HTML5 looping is infinite.",1),a.loop=b>1?"loop":""},this._setup_html5=function(a){var b,e=p(q._iO,a),f=Sa?ra:q._a,g=decodeURI(e.url);if(Sa?g===decodeURI(ia)&&(b=!0):g===decodeURI(u)&&(b=!0),f){if(f._s)if(Sa)f._s&&f._s.playState&&!b&&f._s.stop();else if(!Sa&&g===decodeURI(u))return q._apply_loop(f,e.loops),f;b||(u&&c(!1),f.src=e.url,q.url=e.url,u=e.url,ia=e.url,f._called_load=!1)}else e.autoLoad||e.autoPlay?(q._a=new Audio(e.url),q._a.load()):q._a=Za&&opera.version()<10?new Audio(null):new Audio,f=q._a,f._called_load=!1,Sa&&(ra=f);return q.isHTML5=!0,q._a=f,f._s=q,d(),q._apply_loop(f,e.loops),e.autoLoad||e.autoPlay?q.load():(f.autobuffer=!1,f.preload="auto"),f},d=function(){function a(a,b,c){return q._a?q._a.addEventListener(a,b,c||!1):null}if(q._a._added_events)return!1;var b;q._a._added_events=!0;for(b in ma)ma.hasOwnProperty(b)&&a(b,ma[b]);return!0},e=function(){function a(a,b,c){return q._a?q._a.removeEventListener(a,b,c||!1):null}var b;qa._wD(q.id+": Removing event listeners"),q._a._added_events=!1;for(b in ma)ma.hasOwnProperty(b)&&a(b,ma[b])},this._onload=function(a){var b,c=!!a||!q.isHTML5&&8===l&&q.duration;return b=q.id+": ",qa._wD(b+(c?"onload()":"Failed to load / invalid sound?"+(q.duration?" -":" Zero-length duration reported.")+" ("+q.url+")"),c?1:2),c||q.isHTML5||(qa.sandbox.noRemote===!0&&qa._wD(b+O("noNet"),1),qa.sandbox.noLocal===!0&&qa._wD(b+O("noLocal"),1)),q.loaded=c,q.readyState=c?3:2,q._onbufferchange(0),q._iO.onload&&pa(q,function(){q._iO.onload.apply(q,[c])}),!0},this._onbufferchange=function(a){return 0!==q.playState&&(!(a&&q.isBuffering||!a&&!q.isBuffering)&&(q.isBuffering=1===a,q._iO.onbufferchange&&(qa._wD(q.id+": Buffer state change: "+a),q._iO.onbufferchange.apply(q,[a])),!0))},this._onsuspend=function(){return q._iO.onsuspend&&(qa._wD(q.id+": Playback suspended"),q._iO.onsuspend.apply(q)),!0},this._onfailure=function(a,b,c){q.failures++,qa._wD(q.id+": Failure ("+q.failures+"): "+a),q._iO.onfailure&&1===q.failures?q._iO.onfailure(a,b,c):qa._wD(q.id+": Ignoring failure")},this._onwarning=function(a,b,c){q._iO.onwarning&&q._iO.onwarning(a,b,c)},this._onfinish=function(){var a=q._iO.onfinish;q._onbufferchange(0),q._resetOnPosition(0),q.instanceCount&&(q.instanceCount--,q.instanceCount||(i(),q.playState=0,q.paused=!1,q.instanceCount=0,q.instanceOptions={},q._iO={},f(),q.isHTML5&&(q.position=0)),q.instanceCount&&!q._iO.multiShotEvents||a&&(qa._wD(q.id+": onfinish()"),pa(q,function(){a.apply(q)})))},this._whileloading=function(a,b,c,d){var e=q._iO;q.bytesLoaded=a,q.bytesTotal=b,q.duration=Math.floor(c),q.bufferLength=d,q.isHTML5||e.isMovieStar?q.durationEstimate=q.duration:e.duration?q.durationEstimate=q.duration>e.duration?q.duration:e.duration:q.durationEstimate=parseInt(q.bytesTotal/q.bytesLoaded*q.duration,10),q.isHTML5||(q.buffered=[{start:0,end:q.duration}]),(3!==q.readyState||q.isHTML5)&&e.whileloading&&e.whileloading.apply(q)},this._whileplaying=function(a,c,d,e,f){var g,h=q._iO;return!isNaN(a)&&null!==a&&(q.position=Math.max(0,a),q._processOnPosition(),!q.isHTML5&&l>8&&(h.usePeakData&&c!==b&&c&&(q.peakData={left:c.leftPeak,right:c.rightPeak}),h.useWaveformData&&d!==b&&d&&(q.waveformData={left:d.split(","),right:e.split(",")}),h.useEQData&&f!==b&&f&&f.leftEQ&&(g=f.leftEQ.split(","),q.eqData=g,q.eqData.left=g,f.rightEQ!==b&&f.rightEQ&&(q.eqData.right=f.rightEQ.split(",")))),1===q.playState&&(q.isHTML5||8!==l||q.position||!q.isBuffering||q._onbufferchange(0),h.whileplaying&&h.whileplaying.apply(q)),!0)},this._oncaptiondata=function(a){qa._wD(q.id+": Caption data received."),q.captiondata=a,q._iO.oncaptiondata&&q._iO.oncaptiondata.apply(q,[a])},this._onmetadata=function(a,b){qa._wD(q.id+": Metadata received.");var c,d,e={};for(c=0,d=a.length;c0&&(qa._wD(q.id+": Data error: "+a),q._iO.ondataerror&&q._iO.ondataerror.apply(q))},this._debug()},G=function(){return ya.body||ya.getElementsByTagName("div")[0]},h=function(a){return ya.getElementById(a)},p=function(a,c){var d,e,f=a||{};d=c===b?qa.defaultOptions:c;for(e in d)d.hasOwnProperty(e)&&f[e]===b&&("object"!=typeof d[e]||null===d[e]?f[e]=d[e]:f[e]=p(f[e],d[e]));return f},pa=function(b,c){b.isHTML5||8!==l?c():a.setTimeout(c,0)},r={onready:1,ontimeout:1,defaultOptions:1,flash9Options:1,movieStarOptions:1},q=function(a,c){var d,e=!0,f=c!==b,g=qa.setupOptions,h=r;if(a===b){e=[];for(d in g)g.hasOwnProperty(d)&&e.push(d);for(d in h)h.hasOwnProperty(d)&&("object"==typeof qa[d]?e.push(d+": {...}"):qa[d]instanceof Function?e.push(d+": function() {...}"):e.push(d));return qa._wD(O("setup",e.join(", "))),!1}for(d in a)if(a.hasOwnProperty(d))if("object"!=typeof a[d]||null===a[d]||a[d]instanceof Array||a[d]instanceof RegExp)f&&h[c]!==b?qa[c][d]=a[d]:g[d]!==b?(qa.setupOptions[d]=a[d],qa[d]=a[d]):h[d]===b?(V(O(qa[d]===b?"setupUndef":"setupError",d),2),e=!1):qa[d]instanceof Function?qa[d].apply(qa,a[d]instanceof Array?a[d]:[a[d]]):qa[d]=a[d];else{if(h[d]!==b)return q(a[d],d);V(O(qa[d]===b?"setupUndef":"setupError",d),2),e=!1}return e},ha=function(){function b(a){var b=Ra.call(a),c=b.length;return f?(b[1]="on"+b[1],c>3&&b.pop()):3===c&&b.push(!1),b}function c(a,b){var c=a.shift(),d=[g[b]];f?c[d](a[0],a[1]):c[d].apply(c,a)}function d(){c(b(arguments),"add")}function e(){c(b(arguments),"remove")}var f=a.attachEvent,g={add:f?"attachEvent":"addEventListener",remove:f?"detachEvent":"removeEventListener"};return{add:d,remove:e}}(),ma={abort:f(function(){qa._wD(this._s.id+": abort")}),canplay:f(function(){var a,c=this._s;if(c._html5_canplay)return!0;if(c._html5_canplay=!0,qa._wD(c.id+": canplay"),c._onbufferchange(0),a=c._iO.position===b||isNaN(c._iO.position)?null:c._iO.position/fb,this.currentTime!==a){qa._wD(c.id+": canplay: Setting position to "+a);try{this.currentTime=a}catch(b){qa._wD(c.id+": canplay: Setting position of "+a+" failed: "+b.message,2)}}c._iO._oncanplay&&c._iO._oncanplay()}),canplaythrough:f(function(){var a=this._s;a.loaded||(a._onbufferchange(0),a._whileloading(a.bytesLoaded,a.bytesTotal,a._get_html5_duration()),a._onload(!0))}),durationchange:f(function(){var a,b=this._s;a=b._get_html5_duration(),isNaN(a)||a===b.duration||(qa._wD(this._s.id+": durationchange ("+a+")"+(b.duration?", previously "+b.duration:"")),b.durationEstimate=b.duration=a)}),ended:f(function(){var a=this._s;qa._wD(a.id+": ended"),a._onfinish()}),error:f(function(){qa._wD(this._s.id+": HTML5 error, code "+this.error.code),this._s._onload(!1)}),loadeddata:f(function(){var a=this._s;qa._wD(a.id+": loadeddata"),a._loaded||Ya||(a.duration=a._get_html5_duration())}),loadedmetadata:f(function(){qa._wD(this._s.id+": loadedmetadata")}),loadstart:f(function(){qa._wD(this._s.id+": loadstart"),this._s._onbufferchange(1)}),play:f(function(){this._s._onbufferchange(0)}),playing:f(function(){qa._wD(this._s.id+": playing "+String.fromCharCode(9835)),this._s._onbufferchange(0)}),progress:f(function(a){var b,c,d,e=this._s,f=0,g="progress"===a.type,h=a.target.buffered,i=a.loaded||0,j=a.total||1;if(e.buffered=[],h&&h.length){for(b=0,c=h.length;b1){for(d=[],c=h.length,b=0;b=0;f--)h["audio/"+e[c].related[f]]=h[c], +qa.html5[e[c].related[f]]=h[c],qa.flash[e[c].related[f]]=h[c];return h.canPlayType=g?a:null,qa.html5=p(qa.html5,h),qa.html5.usingFlash=aa(),Qa=qa.html5.usingFlash,!0},A={notReady:"Unavailable - wait until onready() has fired.",notOK:"Audio support is not available.",domError:ta+"exception caught while appending SWF to DOM.",spcWmode:"Removing wmode, preventing known SWF loading issue(s)",swf404:ua+"Verify that %s is a valid path.",tryDebug:"Try "+ta+".debugFlash = true for more security details (output goes to SWF.)",checkSWF:"See SWF output for more debug info.",localFail:ua+"Non-HTTP page ("+ya.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:ua+"Special case: Waiting for SWF to load with window focus...",waitForever:ua+"Waiting indefinitely for Flash (will recover if unblocked)...",waitSWF:ua+"Waiting for 100% SWF load...",needFunction:ua+"Function object expected for %s",badID:'Sound ID "%s" should be a string, starting with a non-numeric character',currentObj:ua+"_debug(): Current sound objects",waitOnload:ua+"Waiting for window.onload()",docLoaded:ua+"Document already loaded",onload:ua+"initComplete(): calling soundManager.onload()",onloadOK:ta+".onload() complete",didInit:ua+"init(): Already called?",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",badRemove:ua+"Failed to remove Flash node.",shutdown:ta+".disable(): Shutting down",queue:ua+"Queueing %s handler",smError:"SMSound.load(): Exception: JS-Flash communication failed, or JS error.",fbTimeout:"No flash response, applying ."+R.swfTimedout+" CSS...",fbLoaded:"Flash loaded",fbHandler:ua+"flashBlockHandler()",manURL:"SMSound.load(): Using manually-assigned URL",onURL:ta+".load(): current URL already assigned.",badFV:ta+'.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",needFlash:ua+"Fatal error: Flash is needed to play some required formats, but is not available.",gotFocus:ua+"Got window focus.",policy:"Enabling usePolicyFile for data access",setup:ta+".setup(): allowed parameters: %s",setupError:ta+'.setup(): "%s" cannot be assigned with this method.',setupUndef:ta+'.setup(): Could not find option "%s"',setupLate:ta+".setup(): url, flashVersion and html5Test property changes will not take effect until reboot().",noURL:ua+"Flash URL required. Call soundManager.setup({url:...}) to get started.",sm2Loaded:"SoundManager 2: Ready. "+String.fromCharCode(10003),reset:ta+".reset(): Removing event callbacks",mobileUA:"Mobile UA detected, preferring HTML5 by default.",globalHTML5:"Using singleton HTML5 Audio() pattern for this device."},O=function(){var a,b,c,d,e;if(a=Ra.call(arguments),d=a.shift(),e=A&&A[d]?A[d]:"",e&&a&&a.length)for(b=0,c=a.length;b1&&a.stream&&(n("as2loop"),a.stream=!1),a},U=function(a,b){return a&&!a.usePolicyFile&&(a.onid3||a.usePeakData||a.useWaveformData||a.useEQData)&&(qa._wD((b||"")+O("policy")),a.usePolicyFile=!0),a},V=function(a){ab&&console.warn!==b?console.warn(a):qa._wD(a)},i=function(){return!1},L=function(a){var b;for(b in a)a.hasOwnProperty(b)&&"function"==typeof a[b]&&(a[b]=i);b=null},M=function(a){a===b&&(a=!1),(Ea||a)&&qa.disable(a)},N=function(a){var b,c=null;if(a)if(a.match(/\.swf(\?.*)?$/i)){if(c=a.substr(a.toLowerCase().lastIndexOf(".swf?")+4))return a}else a.lastIndexOf("/")!==a.length-1&&(a+="/");return b=(a&&a.lastIndexOf("/")!==-1?a.substr(0,a.lastIndexOf("/")+1):"./")+qa.movieURL,qa.noSWFCache&&(b+="?ts="+(new Date).getTime()),b},y=function(){l=parseInt(qa.flashVersion,10),8!==l&&9!==l&&(qa._wD(O("badFV",l,Ia)),qa.flashVersion=l=Ia);var a=qa.debugMode||qa.debugFlash?"_debug.swf":".swf";qa.useHTML5Audio&&!qa.html5Only&&qa.audioFormats.mp4.required&&l<9&&(qa._wD(O("needfl9")),qa.flashVersion=l=9),qa.version=qa.versionNumber+(qa.html5Only?" (HTML5-only mode)":9===l?" (AS3/Flash 9)":" (AS2/Flash 8)"),l>8?(qa.defaultOptions=p(qa.defaultOptions,qa.flash9Options),qa.features.buffering=!0,qa.defaultOptions=p(qa.defaultOptions,qa.movieStarOptions),qa.filePatterns.flash9=new RegExp("\\.(mp3|"+lb.join("|")+")(\\?.*)?$","i"),qa.features.movieStar=!0):qa.features.movieStar=!1,qa.filePattern=qa.filePatterns[8!==l?"flash9":"flash8"],qa.movieURL=(8===l?"soundmanager2.swf":"soundmanager2_flash9.swf").replace(".swf",a),qa.features.peakData=qa.features.waveformData=qa.features.eqData=l>8},J=function(a,b){return!!sa&&void sa._setPolling(a,b)},K=function(){if(qa.debugURLParam.test(xa)&&(qa.debugMode=!0),h(qa.debugID))return!1;var a,b,c,d,e;if(qa.debugMode&&!h(qa.debugID)&&(!ab||!qa.useConsole||!qa.consoleOnly)){a=ya.createElement("div"),a.id=qa.debugID+"-toggle",d={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},a.appendChild(ya.createTextNode("-")),a.onclick=S,a.title="Toggle SM2 debug console",wa.match(/msie 6/i)&&(a.style.position="absolute",a.style.cursor="hand");for(e in d)d.hasOwnProperty(e)&&(a.style[e]=d[e]);if(b=ya.createElement("div"),b.id=qa.debugID,b.style.display=qa.debugMode?"block":"none",qa.debugMode&&!h(a.id)){try{c=G(),c.appendChild(a)}catch(a){throw new Error(O("domError")+" \n"+a.toString())}c.appendChild(b)}}c=null},W=this.getSoundById,n=function(a,b){return a?qa._wD(O(a),b):""},S=function(){var a=h(qa.debugID),b=h(qa.debugID+"-toggle");return!!a&&(Aa?(b.innerHTML="+",a.style.display="none"):(b.innerHTML="-",a.style.display="block"),void(Aa=!Aa))},m=function(c,d,e){if(a.sm2Debugger!==b)try{sm2Debugger.handleEvent(c,d,e)}catch(a){return!1}return!0},Q=function(){var a=[];return qa.debugMode&&a.push(R.sm2Debug),qa.debugFlash&&a.push(R.flashDebug),qa.useHighPerformance&&a.push(R.highPerf),a.join(" ")},P=function(){var a=O("fbHandler"),b=qa.getMoviePercent(),c=R,d={type:"FLASHBLOCK"};return!qa.html5Only&&void(qa.ok()?(qa.didFlashBlock&&qa._wD(a+": Unblocked"),qa.oMC&&(qa.oMC.className=[Q(),c.swfDefault,c.swfLoaded+(qa.didFlashBlock?" "+c.swfUnblocked:"")].join(" "))):(Qa&&(qa.oMC.className=Q()+" "+c.swfDefault+" "+(null===b?c.swfTimedout:c.swfError),qa._wD(a+": "+O("fbTimeout")+(b?" ("+O("fbLoaded")+")":""))),qa.didFlashBlock=!0,t({type:"ontimeout",ignoreInit:!0,error:d}),I(d)))},s=function(a,c,d){za[a]===b&&(za[a]=[]),za[a].push({method:c,scope:d||null,fired:!1})},t=function(a){if(a||(a={type:qa.ok()?"onready":"ontimeout"}),!Da&&a&&!a.ignoreInit)return!1;if("ontimeout"===a.type&&(qa.ok()||Ea&&!a.ignoreInit))return!1;var b,c,d={success:a&&a.ignoreInit?qa.ok():!Ea},e=a&&a.type?za[a.type]||[]:[],f=[],g=[d],h=Qa&&!qa.ok();for(a.error&&(g[0].error=a.error),b=0,c=e.length;b=0;a--)qa.sounds[qa.soundIDs[a]].isHTML5&&qa.sounds[qa.soundIDs[a]]._hasTimer&&qa.sounds[qa.soundIDs[a]]._onTimer()},I=function(c){c=c!==b?c:{},"function"==typeof qa.onerror&&qa.onerror.apply(a,[{type:c.type!==b?c.type:null}]),c.fatal!==b&&c.fatal&&qa.disable()},la=function(){if(!_a||!ka())return!1;var a,b,c=qa.audioFormats;for(b in c)if(c.hasOwnProperty(b)&&("mp3"===b||"mp4"===b)&&(qa._wD(ta+": Using flash fallback for "+b+" format"),qa.html5[b]=!1,c[b]&&c[b].related))for(a=c[b].related.length-1;a>=0;a--)qa.html5[c[b].related[a]]=!1},this._setSandboxType=function(a){var c=qa.sandbox;c.type=a,c.description=c.types[c.types[a]!==b?a:"unknown"],"localWithFile"===c.type?(c.noRemote=!0,c.noLocal=!1,n("secNote",2)):"localWithNetwork"===c.type?(c.noRemote=!1,c.noLocal=!0):"localTrusted"===c.type&&(c.noRemote=!1,c.noLocal=!1)},this._externalInterfaceOK=function(a){if(qa.swfLoaded)return!1;var b;return m("swf",!0),m("flashtojs",!0),qa.swfLoaded=!0,cb=!1,_a&&la(),a&&a.replace(/\+dev/i,"")===qa.versionNumber.replace(/\+dev/i,"")?void setTimeout(k,Wa?100:1):(b=ta+': Fatal: JavaScript file build "'+qa.versionNumber+'" does not match Flash SWF build "'+a+'" at '+qa.url+". Ensure both are up-to-date.",setTimeout(function(){throw new Error(b)},0),!1)},H=function(a,c){function d(){var a,b=[],c=[],d=" + ";a="SoundManager "+qa.version+(!qa.html5Only&&qa.useHTML5Audio?qa.hasHTML5?" + HTML5 audio":", no HTML5 audio support":""),qa.html5Only?qa.html5PollingInterval&&b.push("html5PollingInterval ("+qa.html5PollingInterval+"ms)"):(qa.preferFlash&&b.push("preferFlash"),qa.useHighPerformance&&b.push("useHighPerformance"),qa.flashPollingInterval&&b.push("flashPollingInterval ("+qa.flashPollingInterval+"ms)"),qa.html5PollingInterval&&b.push("html5PollingInterval ("+qa.html5PollingInterval+"ms)"),qa.wmode&&b.push("wmode ("+qa.wmode+")"),qa.debugFlash&&b.push("debugFlash"),qa.useFlashBlock&&b.push("flashBlock")),b.length&&(c=c.concat([b.join(d)])),qa._wD(a+(c.length?d+c.join(", "):""),1),na()}function e(a,b){return''}if(Ba&&Ca)return!1;if(qa.html5Only)return y(),d(),qa.oMC=h(qa.movieID),k(),Ba=!0,Ca=!0,!1;var f,g,i,j,l,m,n,o,p=c||qa.url,q=qa.altURL||p,r="JS/Flash audio component (SoundManager 2)",s=G(),t=Q(),u=null,v=ya.getElementsByTagName("html")[0];if(u=v&&v.dir&&v.dir.match(/rtl/i),a=a===b?qa.id:a,y(),qa.url=N(ib?p:q),c=qa.url,qa.wmode=!qa.wmode&&qa.useHighPerformance?"transparent":qa.wmode,null!==qa.wmode&&(wa.match(/msie 8/i)||!Wa&&!qa.useHighPerformance)&&navigator.platform.match(/win32|win64/i)&&(Pa.push(A.spcWmode),qa.wmode=null),f={name:a,id:a,src:c,quality:"high",allowScriptAccess:qa.allowScriptAccess,bgcolor:qa.bgColor,pluginspage:jb+"www.macromedia.com/go/getflashplayer",title:r,type:"application/x-shockwave-flash",wmode:qa.wmode,hasPriority:"true"},qa.debugFlash&&(f.FlashVars="debug=1"),qa.wmode||delete f.wmode,Wa)g=ya.createElement("div"),j=['',e("movie",c),e("AllowScriptAccess",qa.allowScriptAccess),e("quality",f.quality),qa.wmode?e("wmode",qa.wmode):"",e("bgcolor",qa.bgColor),e("hasPriority","true"),qa.debugFlash?e("FlashVars",f.FlashVars):"",""].join("");else{g=ya.createElement("embed");for(i in f)f.hasOwnProperty(i)&&g.setAttribute(i,f[i])}if(K(),t=Q(),s=G())if(qa.oMC=h(qa.movieID)||ya.createElement("div"),qa.oMC.id)o=qa.oMC.className,qa.oMC.className=(o?o+" ":R.swfDefault)+(t?" "+t:""),qa.oMC.appendChild(g),Wa&&(l=qa.oMC.appendChild(ya.createElement("div")),l.className=R.swfBox,l.innerHTML=j),Ca=!0;else{if(qa.oMC.id=qa.movieID,qa.oMC.className=R.swfDefault+" "+t,m=null,l=null,qa.useFlashBlock||(qa.useHighPerformance?m={position:"fixed",width:"8px",height:"8px",bottom:"0px",left:"0px",overflow:"hidden"}:(m={position:"absolute",width:"6px",height:"6px",top:"-9999px",left:"-9999px"},u&&(m.left=Math.abs(parseInt(m.left,10))+"px"))),Xa&&(qa.oMC.style.zIndex=1e4),!qa.debugFlash)for(n in m)m.hasOwnProperty(n)&&(qa.oMC.style[n]=m[n]);try{Wa||qa.oMC.appendChild(g),s.appendChild(qa.oMC),Wa&&(l=qa.oMC.appendChild(ya.createElement("div")),l.className=R.swfBox,l.innerHTML=j),Ca=!0}catch(a){throw new Error(O("domError")+" \n"+a.toString())}}return Ba=!0,d(),!0},B=function(){return qa.html5Only?(H(),!1):!sa&&(qa.url?(sa=qa.getMovie(qa.id),sa||(Ja?(Wa?qa.oMC.innerHTML=Ka:qa.oMC.appendChild(Ja),Ja=null,Ba=!0):H(qa.id,qa.url),sa=qa.getMovie(qa.id)),"function"==typeof qa.oninitmovie&&setTimeout(qa.oninitmovie,1),oa(),!0):(n("noURL"),!1))},v=function(){setTimeout(w,1e3)},x=function(){a.setTimeout(function(){V(ua+"useFlashBlock is false, 100% HTML5 mode is possible. Rebooting with preferFlash: false..."),qa.setup({preferFlash:!1}).reboot(),qa.didFlashBlock=!0,qa.beginDelayedInit()},1)},w=function(){var b,c=!1;return!!qa.url&&(!La&&(La=!0,ha.remove(a,"load",v),ja&&cb&&!bb?(n("waitFocus"),!1):(Da||(b=qa.getMoviePercent(),b>0&&b<100&&(c=!0)),void setTimeout(function(){return b=qa.getMoviePercent(),c?(La=!1,qa._wD(O("waitSWF")),a.setTimeout(v,1),!1):(Da||(qa._wD(ta+": No Flash response within expected time. Likely causes: "+(0===b?"SWF load failed, ":"")+"Flash blocked or JS-Flash security error."+(qa.debugFlash?" "+O("checkSWF"):""),2),!ib&&b&&(n("localFail",2),qa.debugFlash||n("tryDebug",2)),0===b&&qa._wD(O("swf404",qa.url),1),m("flashtojs",!1," (Check flash security or flash blockers)")),void(!Da&&db&&(null===b?qa.useFlashBlock||0===qa.flashLoadTimeout?(qa.useFlashBlock&&P(),n("waitForever")):!qa.useFlashBlock&&_?x():(n("waitForever"),t({type:"ontimeout",ignoreInit:!0,error:{type:"INIT_FLASHBLOCK"}})):0===qa.flashLoadTimeout?n("waitForever"):!qa.useFlashBlock&&_?x():M(!0))))},qa.flashLoadTimeout))))},z=function(){function b(){ha.remove(a,"focus",z)}return bb||!cb?(b(),!0):(db=!0,bb=!0,n("gotFocus"),La=!1,v(),b(),!0)},oa=function(){Pa.length&&(qa._wD("SoundManager 2: "+Pa.join(" "),1),Pa=[])},na=function(){oa();var a,b=[];if(qa.useHTML5Audio&&qa.hasHTML5){for(a in qa.audioFormats)qa.audioFormats.hasOwnProperty(a)&&b.push(a+" = "+qa.html5[a]+(!qa.html5[a]&&Qa&&qa.flash[a]?" (using flash)":qa.preferFlash&&qa.flash[a]&&Qa?" (preferring flash)":qa.html5[a]?"":" ("+(qa.audioFormats[a].required?"required, ":"")+"and no flash support)"));qa._wD("SoundManager 2 HTML5 support: "+b.join(", "),1)}},o=function(b){if(Da)return!1;if(qa.html5Only)return n("sm2Loaded",1),Da=!0,u(),m("onload",!0),!0;var c,d=qa.useFlashBlock&&qa.flashLoadTimeout&&!qa.getMoviePercent(),e=!0;return d||(Da=!0),c={type:!ja&&Qa?"NO_FLASH":"INIT_TIMEOUT"},qa._wD("SoundManager 2 "+(Ea?"failed to load":"loaded")+" ("+(Ea?"Flash security/load error":"OK")+") "+String.fromCharCode(Ea?10006:10003),Ea?2:1),Ea||b?(qa.useFlashBlock&&qa.oMC&&(qa.oMC.className=Q()+" "+(null===qa.getMoviePercent()?R.swfTimedout:R.swfError)),t({type:"ontimeout",error:c,ignoreInit:!0}),m("onload",!1),I(c),e=!1):m("onload",!0),Ea||(qa.waitForWindowLoad&&!Fa?(n("waitOnload"),ha.add(a,"load",u)):(qa.waitForWindowLoad&&Fa&&n("docLoaded"),u())),e},j=function(){var a,c=qa.setupOptions;for(a in c)c.hasOwnProperty(a)&&(qa[a]===b?qa[a]=c[a]:qa[a]!==c[a]&&(qa.setupOptions[a]=qa[a]))},k=function(){function b(){ha.remove(a,"load",qa.beginDelayedInit)}if(Da)return n("didInit"),!1;if(qa.html5Only)return Da||(b(),qa.enabled=!0,o()),!0;B();try{sa._externalInterfaceTest(!1),J(!0,qa.flashPollingInterval||(qa.useHighPerformance?10:50)),qa.debugMode||sa._disableDebug(),qa.enabled=!0,m("jstoflash",!0),qa.html5Only||ha.add(a,"unload",i)}catch(a){return qa._wD("js/flash exception: "+a.toString()),m("jstoflash",!1),I({type:"JS_TO_FLASH_EXCEPTION",fatal:!0}),M(!0),o(),!1}return o(),b(),!0},D=function(){return!F&&(F=!0,j(),K(),function(){var a="sm2-usehtml5audio=",b="sm2-preferflash=",c=null,d=null,e=xa.toLowerCase();e.indexOf(a)!==-1&&(c="1"===e.charAt(e.indexOf(a)+a.length),ab&&console.log((c?"Enabling ":"Disabling ")+"useHTML5Audio via URL parameter"),qa.setup({useHTML5Audio:c})),e.indexOf(b)!==-1&&(d="1"===e.charAt(e.indexOf(b)+b.length),ab&&console.log((d?"Enabling ":"Disabling ")+"preferFlash via URL parameter"),qa.setup({preferFlash:d}))}(),!ja&&qa.hasHTML5&&(qa._wD("SoundManager 2: No Flash detected"+(qa.useHTML5Audio?". Trying HTML5-only mode.":", enabling HTML5."),1),qa.setup({useHTML5Audio:!0,preferFlash:!1})),ga(),!ja&&Qa&&(Pa.push(A.needFlash),qa.setup({flashLoadTimeout:1})),ya.removeEventListener&&ya.removeEventListener("DOMContentLoaded",D,!1),B(),!0)},fa=function(){return"complete"===ya.readyState&&(D(),ya.detachEvent("onreadystatechange",fa)),!0},E=function(){Fa=!0,D(),ha.remove(a,"load",E)},C=function(){$a&&(qa.setupOptions.useHTML5Audio&&!qa.setupOptions.preferFlash||Pa.push(A.mobileUA),qa.setupOptions.useHTML5Audio=!0,qa.setupOptions.preferFlash=!1,(Ua||Va&&!wa.match(/android\s2\.3/i))&&(Pa.push(A.globalHTML5),Ua&&(qa.ignoreFlash=!0),Sa=!0))},C(),ka(),ha.add(a,"focus",z),ha.add(a,"load",v),ha.add(a,"load",E),ya.addEventListener?ya.addEventListener("DOMContentLoaded",D,!1):ya.attachEvent?ya.attachEvent("onreadystatechange",fa):(m("onload",!1),I({type:"NO_DOM2_EVENTS",fatal:!0}))}if(!a||!a.document)throw new Error("SoundManager requires a browser with window and document objects.");var d=null;void 0!==a.SM2_DEFER&&SM2_DEFER||(d=new c),"object"==typeof module&&module&&"object"==typeof module.exports?(a.soundManager=d,module.exports.SoundManager=c,module.exports.soundManager=d):"function"==typeof define&&define.amd?define("SoundManager",[],function(){return{SoundManager:c,soundManager:d}}):(a.SoundManager=c,a.soundManager=d)}(window);var ngSoundManager=angular.module("angularSoundManager",[]).config(["$logProvider",function(a){a.debugEnabled(!1)}]);ngSoundManager.filter("humanTime",function(){return function(a){function b(a){return a<10?"0"+a.toString():a.toString()}var c=a/1e3/60<<0,d=Math.round(a/1e3%60);return b(c)+":"+b(d)}}),ngSoundManager.factory("angularPlayer",["$rootScope","$log",function(a,b){var c=null,d=!1,e=!1,f=[],g=!0,h=!1,i=90,j=0,k=[];return{init:function(){"undefined"==typeof soundManager&&alert("Please include SoundManager2 Library!"),soundManager.setup({preferFlash:!1,debugMode:!1,useHTML5Audio:!0,onready:function(){},ontimeout:function(){alert("SM2 failed to start. Flash missing, blocked or security error?"),alert("The status is "+status.success+", the error type is "+status.error.type)},defaultOptions:{autoLoad:!1,autoPlay:!1,from:null,loops:1,multiShot:!1,multiShotEvents:!1,onid3:null,onload:null,onstop:null,onfailure:"nextTrack",onpause:null,onplay:null,onresume:null,position:null,pan:0,stream:!0,to:null,type:"audio/mp3",usePolicyFile:!1,volume:i,whileloading:function(){var b=this.bytesLoaded/this.bytesTotal*100;a.$broadcast("track:loaded",b)},whileplaying:function(){c=this.id,j=this.position/this.duration*100,a.$broadcast("track:progress",j),a.$broadcast("currentTrack:position",this.position),a.$broadcast("currentTrack:duration",this.duration)},onfinish:function(){if(soundManager._writeDebug(this.id+" finished playing"),g===!0){var b=angular.element(document.querySelector("[ng-app]")),d=b.injector(),e=d.get("angularPlayer");e.nextTrack(),a.$broadcast("track:id",c)}}}}),soundManager.onready(function(){b.debug("song manager ready!");var c=soundManager.ok();b.debug("is supported: "+c),a.$broadcast("angularPlayer:ready",!0)})},isInArray:function(a,b){for(var c=0;c-1){if("undefined"==typeof a.url)return b.debug("invalid soundcloud track url"),!1}else if(soundManager.canPlayURL(a.url)!==!0)return b.debug("invalid song url"),!1},addTrack:function(a){if(!this.isTrackValid)return null;var b=this.isInArray(this.getPlaylist(),a.id);return b===!1&&(soundManager.createSound({id:a.id,url:a.url}),this.addToPlaylist(a)),a.id},removeSong:function(b,d){b===c&&this.stop(),soundManager.destroySound(b),k.splice(d,1),a.$broadcast("player:playlist",k)},initPlayTrack:function(b,c){c!==!0&&(this.stop(),this.setCurrentTrack(b)),soundManager.play(b),a.$broadcast("track:id",b),h=!0,a.$broadcast("music:isPlaying",h)},play:function(){var a=null;if(null===this.getCurrentTrack()){if(0===soundManager.soundIDs.length)return void b.debug("playlist is empty!");a=soundManager.soundIDs[0],this.initPlayTrack(a)}else a=this.getCurrentTrack(),this.initPlayTrack(a,!0)},pause:function(){soundManager.pause(this.getCurrentTrack()),h=!1,a.$broadcast("music:isPlaying",h)},stop:function(){this.pause(),this.resetProgress(),a.$broadcast("track:progress",j),a.$broadcast("currentTrack:position",0),a.$broadcast("currentTrack:duration",0),soundManager.stopAll(),soundManager.unload(this.getCurrentTrack())},playTrack:function(a){this.initPlayTrack(a)},nextTrack:function(){if(null===this.getCurrentTrack())return b.debug("Please click on Play before this action"),null;var c=angular.copy(soundManager.soundIDs);e===!0&&(c=f),console.log(soundManager.soundIDs),console.log(f);var g=this.getIndexByValue(c,this.getCurrentTrack()),i=+g+1,j=c[i];"undefined"!=typeof j?this.playTrack(j):(e===!0&&h===!0&&(f=angular.copy(soundManager.soundIDs),f=f.sort(function(){return.5-Math.random()}),a.$broadcast("music:tempTrack",f)),d===!0?this.playTrack(c[0]):(h=!1,a.$broadcast("music:isPlaying",h)))},prevTrack:function(){if(null===this.getCurrentTrack())return b.debug("Please click on Play before this action"),null;var a=angular.copy(soundManager.soundIDs);e===!0&&(a=f);var c=this.getIndexByValue(a,this.getCurrentTrack()),d=+c-1,g=a[d];"undefined"!=typeof g?this.playTrack(g):b.debug("no prev track found!")},mute:function(){soundManager.muted===!0?soundManager.unmute():soundManager.mute(),a.$broadcast("music:mute",soundManager.muted)},getMuteStatus:function(){return soundManager.muted},repeatToggle:function(){d=d!==!0,a.$broadcast("music:repeat",d)},getRepeatStatus:function(){return d},shuffleToggle:function(){e===!0?(e=!1,f=angular.copy(soundManager.soundIDs)):(e=!0,f=angular.copy(soundManager.soundIDs),f=f.sort(function(){return.5-Math.random()})),a.$broadcast("music:shuffle",e),a.$broadcast("music:tempTrack",f)},getShuffleStatus:function(){return e},getVolume:function(){return i},adjustVolume:function(b){var c=function(b){for(var c=0;c0&&(i-=10,c(i))},adjustVolumeSlider:function(b){var c=function(b){for(var c=0;cSongs - - + + - Is Playing: {{ isPlaying }} diff --git a/src/03-factory-angularPlayer.js b/src/03-factory-angularPlayer.js index 8fac400..ced89a6 100644 --- a/src/03-factory-angularPlayer.js +++ b/src/03-factory-angularPlayer.js @@ -3,6 +3,8 @@ ngSoundManager.factory('angularPlayer', ['$rootScope', '$log', var currentTrack = null, repeat = false, + shuffle = false, + tempTrack = [], autoPlay = true, isPlaying = false, volume = 90, @@ -201,6 +203,7 @@ ngSoundManager.factory('angularPlayer', ['$rootScope', '$log', } //unload from soundManager soundManager.destroySound(song); + //remove from playlist playlist.splice(index, 1); //once all done then broadcast @@ -259,16 +262,33 @@ ngSoundManager.factory('angularPlayer', ['$rootScope', '$log', $log.debug("Please click on Play before this action"); return null; } - var currentTrackKey = this.getIndexByValue(soundManager.soundIDs, this.getCurrentTrack()); + + // use shuffle track list if shuffle is true + var useTrack = angular.copy(soundManager.soundIDs); + if(shuffle === true){ + useTrack = tempTrack; + } + + console.log(soundManager.soundIDs); + console.log(tempTrack); + + var currentTrackKey = this.getIndexByValue(useTrack, this.getCurrentTrack()); var nextTrackKey = +currentTrackKey + 1; - var nextTrack = soundManager.soundIDs[nextTrackKey]; + var nextTrack = useTrack[nextTrackKey]; if(typeof nextTrack !== 'undefined') { this.playTrack(nextTrack); } else { + // generate shuffle track list + if(shuffle === true && isPlaying === true){ + tempTrack = angular.copy(soundManager.soundIDs); + tempTrack = (tempTrack).sort(function() { return 0.5 - Math.random() }); + $rootScope.$broadcast('music:tempTrack', tempTrack); + } + //if no next track found if(repeat === true) { //start first track if repeat is on - this.playTrack(soundManager.soundIDs[0]); + this.playTrack(useTrack[0]); } else { //breadcase not playing anything isPlaying = false; @@ -281,9 +301,16 @@ ngSoundManager.factory('angularPlayer', ['$rootScope', '$log', $log.debug("Please click on Play before this action"); return null; } - var currentTrackKey = this.getIndexByValue(soundManager.soundIDs, this.getCurrentTrack()); + + // use shuffle track list if shuffle is true + var useTrack = angular.copy(soundManager.soundIDs); + if(shuffle === true){ + useTrack = tempTrack; + } + + var currentTrackKey = this.getIndexByValue(useTrack, this.getCurrentTrack()); var prevTrackKey = +currentTrackKey - 1; - var prevTrack = soundManager.soundIDs[prevTrackKey]; + var prevTrack = useTrack[prevTrackKey]; if(typeof prevTrack !== 'undefined') { this.playTrack(prevTrack); } else { @@ -312,6 +339,21 @@ ngSoundManager.factory('angularPlayer', ['$rootScope', '$log', getRepeatStatus: function() { return repeat; }, + shuffleToggle: function() { + if(shuffle === true) { + shuffle = false; + tempTrack = angular.copy(soundManager.soundIDs); + } else { + shuffle = true; + tempTrack = angular.copy(soundManager.soundIDs); + tempTrack = (tempTrack).sort(function() { return 0.5 - Math.random() }); + } + $rootScope.$broadcast('music:shuffle', shuffle); + $rootScope.$broadcast('music:tempTrack', tempTrack); + }, + getShuffleStatus: function() { + return shuffle; + }, getVolume: function() { return volume; }, diff --git a/src/21-directive-shuffleMusic.js b/src/21-directive-shuffleMusic.js new file mode 100644 index 0000000..5aab0ad --- /dev/null +++ b/src/21-directive-shuffleMusic.js @@ -0,0 +1,18 @@ +ngSoundManager.directive('shuffleMusic', ['angularPlayer', function (angularPlayer) { + return { + restrict: "EA", + link: function (scope, element, attrs) { + + element.bind('click', function (event) { + angularPlayer.shuffleToggle(); + }); + + scope.shuffle = angularPlayer.getShuffleStatus(); + scope.$on('music:shuffle', function (event, data) { + scope.$apply(function () { + scope.shuffle = data; + }); + }); + } + }; + }]); \ No newline at end of file From dc08c00eb647b387e825675107a0bb34fe61b8a9 Mon Sep 17 00:00:00 2001 From: phalla-khong Date: Tue, 13 Dec 2016 09:04:14 +0700 Subject: [PATCH 2/8] fix some bug on shuffle --- dist/angular-soundmanager2.js | 3 --- dist/angular-soundmanager2.min.js | 4 ++-- src/03-factory-angularPlayer.js | 3 --- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/dist/angular-soundmanager2.js b/dist/angular-soundmanager2.js index 431980a..1f04c63 100644 --- a/dist/angular-soundmanager2.js +++ b/dist/angular-soundmanager2.js @@ -4688,9 +4688,6 @@ ngSoundManager.factory('angularPlayer', ['$rootScope', '$log', useTrack = tempTrack; } - console.log(soundManager.soundIDs); - console.log(tempTrack); - var currentTrackKey = this.getIndexByValue(useTrack, this.getCurrentTrack()); var nextTrackKey = +currentTrackKey + 1; var nextTrack = useTrack[nextTrackKey]; diff --git a/dist/angular-soundmanager2.min.js b/dist/angular-soundmanager2.min.js index 2a37f24..18a2c30 100644 --- a/dist/angular-soundmanager2.min.js +++ b/dist/angular-soundmanager2.min.js @@ -1,3 +1,3 @@ -/*! angular-soundmanager2 12-12-2016 */ +/*! angular-soundmanager2 13-12-2016 */ !function(a,b){"use strict";function c(c,d){function e(a){return qa.preferFlash&&ja&&!qa.ignoreFlash&&qa.flash[a]!==b&&qa.flash[a]}function f(a){return function(b){var c,d=this._s;return d&&d._a?c=a.call(this,b):(d&&d.id?qa._wD(d.id+": Ignoring "+b.type):qa._wD(va+"Ignoring "+b.type),c=null),c}}this.setupOptions={url:c||null,flashVersion:8,debugMode:!0,debugFlash:!1,useConsole:!0,consoleOnly:!0,waitForWindowLoad:!1,bgColor:"#ffffff",useHighPerformance:!1,flashPollingInterval:null,html5PollingInterval:null,flashLoadTimeout:1e3,wmode:null,allowScriptAccess:"always",useFlashBlock:!1,useHTML5Audio:!0,html5Test:/^(probably|maybe)$/i,preferFlash:!1,noSWFCache:!1,idPrefix:"sound"},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,duration:null},this.audioFormats={mp3:{type:['audio/mpeg; codecs="mp3"',"audio/mpeg","audio/mp3","audio/MPA","audio/mpa-robust"],required:!0},mp4:{related:["aac","m4a","m4b"],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},opus:{type:["audio/ogg; codecs=opus","audio/opus"],required:!1},wav:{type:['audio/wav; codecs="1"',"audio/wav","audio/wave","audio/x-wav"],required:!1}},this.movieID="sm2-container",this.id=d||"sm2movie",this.debugID="soundmanager-debug",this.debugURLParam=/([#?&])debug=1/i,this.versionNumber="V2.97a.20140901",this.version=null,this.movieURL=null,this.altURL=null,this.swfLoaded=!1,this.enabled=!1,this.oMC=null,this.sounds={},this.soundIDs=[],this.muted=!1,this.didFlashBlock=!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={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},this.html5={usingFlash:null},this.flash={},this.html5Only=!1,this.ignoreFlash=!1;var g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,$,_,aa,ba,ca,da,ea,fa,ga,ha,ia,ja,ka,la,ma,na,oa,pa,qa=this,ra=null,sa=null,ta="soundManager",ua=ta+": ",va="HTML5::",wa=navigator.userAgent,xa=a.location.href.toString(),ya=document,za=[],Aa=!0,Ba=!1,Ca=!1,Da=!1,Ea=!1,Fa=!1,Ga=0,Ha=["log","info","warn","error"],Ia=8,Ja=null,Ka=null,La=!1,Ma=!1,Na=0,Oa=null,Pa=[],Qa=null,Ra=Array.prototype.slice,Sa=!1,Ta=0,Ua=wa.match(/(ipad|iphone|ipod)/i),Va=wa.match(/android/i),Wa=wa.match(/msie/i),Xa=wa.match(/webkit/i),Ya=wa.match(/safari/i)&&!wa.match(/chrome/i),Za=wa.match(/opera/i),$a=wa.match(/(mobile|pre\/|xoom)/i)||Ua||Va,_a=!xa.match(/usehtml5audio/i)&&!xa.match(/sm2\-ignorebadua/i)&&Ya&&!wa.match(/silk/i)&&wa.match(/OS X 10_6_([3-7])/i),ab=a.console!==b&&console.log!==b,bb=ya.hasFocus!==b?ya.hasFocus():null,cb=Ya&&(ya.hasFocus===b||!ya.hasFocus()),db=!cb,eb=/(mp3|mp4|mpa|m4a|m4b)/i,fb=1e3,gb="about:blank",hb="data:audio/wave;base64,/UklGRiYAAABXQVZFZm10IBAAAAABAAEARKwAAIhYAQACABAAZGF0YQIAAAD//w==",ib=ya.location?ya.location.protocol.match(/http/i):null,jb=ib?"":"http://",kb=/^\s*audio\/(?:x-)?(?:mpeg4|aac|flv|mov|mp4||m4v|m4a|m4b|mp4v|3gp|3g2)\s*(?:$|;)/i,lb=["mpeg4","aac","flv","mov","mp4","m4v","f4v","m4a","m4b","mp4v","3gp","3g2"],mb=new RegExp("\\.("+lb.join("|")+")(\\?.*)?$","i");this.mimePattern=/^\s*audio\/(?:x-)?(?:mp(?:eg|3))\s*(?:$|;)/i,this.useAltURL=!ib,R={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.hasHTML5=function(){try{return Audio!==b&&(Za&&opera!==b&&opera.version()<10?new Audio(null):new Audio).canPlayType!==b}catch(a){return!1}}(),this.setup=function(a){var c=!qa.url;return a!==b&&Da&&Qa&&qa.ok()&&(a.flashVersion!==b||a.url!==b||a.html5Test!==b)&&V(O("setupLate")),q(a),a&&(c&&F&&a.url!==b&&qa.beginDelayedInit(),F||a.url===b||"complete"!==ya.readyState||setTimeout(D,1)),qa},this.ok=function(){return Qa?Da&&!Ea:qa.useHTML5Audio&&qa.hasHTML5},this.supported=this.ok,this.getMovie=function(b){return h(b)||ya[b]||a[b]},this.createSound=function(a,c){function d(){return h=T(h),qa.sounds[h.id]=new g(h),qa.soundIDs.push(h.id),qa.sounds[h.id]}var e,f,h,i=null;if(e=ta+".createSound(): ",f=e+O(Da?"notOK":"notReady"),!Da||!qa.ok())return V(f),!1;if(c!==b&&(a={id:a,url:c}),h=p(a),h.url=$(h.url),void 0===h.id&&(h.id=qa.setupOptions.idPrefix+Ta++),h.id.toString().charAt(0).match(/^[0-9]$/)&&qa._wD(e+O("badID",h.id),2),qa._wD(e+h.id+(h.url?" ("+h.url+")":""),1),W(h.id,!0))return qa._wD(e+h.id+" exists",1),qa.sounds[h.id];if(ba(h))i=d(),qa._wD(h.id+": Using HTML5"),i._setup_html5(h);else{if(qa.html5Only)return qa._wD(h.id+": No HTML5 support for this sound, and no Flash. Exiting."),d();if(qa.html5.usingFlash&&h.url&&h.url.match(/data\:/i))return qa._wD(h.id+": data: URIs not supported via Flash. Exiting."),d();l>8&&(null===h.isMovieStar&&(h.isMovieStar=!!(h.serverURL||!!h.type&&h.type.match(kb)||h.url&&h.url.match(mb))),h.isMovieStar&&(qa._wD(e+"using MovieStar handling"),h.loops>1&&n("noNSLoop"))),h=U(h,e),i=d(),8===l?sa._createSound(h.id,h.loops||1,h.usePolicyFile):(sa._createSound(h.id,h.url,h.usePeakData,h.useWaveformData,h.useEQData,h.isMovieStar,!!h.isMovieStar&&h.bufferTime,h.loops||1,h.serverURL,h.duration||null,h.autoPlay,!0,h.autoLoad,h.usePolicyFile),h.serverURL||(i.connected=!0,h.onconnect&&h.onconnect.apply(i))),h.serverURL||!h.autoLoad&&!h.autoPlay||i.load(h)}return!h.serverURL&&h.autoPlay&&i.play(),i},this.destroySound=function(a,b){if(!W(a))return!1;var c,d=qa.sounds[a];for(d._iO={},d.stop(),d.unload(),c=0;c=0;a--)qa.sounds[qa.soundIDs[a]].pause()},this.resume=function(a){return!!W(a)&&qa.sounds[a].resume()},this.resumeAll=function(){var a;for(a=qa.soundIDs.length-1;a>=0;a--)qa.sounds[qa.soundIDs[a]].resume()},this.togglePause=function(a){return!!W(a)&&qa.sounds[a].togglePause()},this.setPan=function(a,b){return!!W(a)&&qa.sounds[a].setPan(b)},this.setVolume=function(a,b){return!!W(a)&&qa.sounds[a].setVolume(b)},this.mute=function(a){var b=0;if(a instanceof String&&(a=null),a)return!!W(a)&&(qa._wD(ta+'.mute(): Muting "'+a+'"'),qa.sounds[a].mute());for(qa._wD(ta+".mute(): Muting all sounds"),b=qa.soundIDs.length-1;b>=0;b--)qa.sounds[qa.soundIDs[b]].mute();return qa.muted=!0,!0},this.muteAll=function(){qa.mute()},this.unmute=function(a){var b;if(a instanceof String&&(a=null),a)return!!W(a)&&(qa._wD(ta+'.unmute(): Unmuting "'+a+'"'),qa.sounds[a].unmute());for(qa._wD(ta+".unmute(): Unmuting all sounds"),b=qa.soundIDs.length-1;b>=0;b--)qa.sounds[qa.soundIDs[b]].unmute();return qa.muted=!1,!0},this.unmuteAll=function(){qa.unmute()},this.toggleMute=function(a){return!!W(a)&&qa.sounds[a].toggleMute()},this.getMemoryUse=function(){var a=0;return sa&&8!==l&&(a=parseInt(sa._getMemoryUse(),10)),a},this.disable=function(c){var d;if(c===b&&(c=!1),Ea)return!1;for(Ea=!0,n("shutdown",1),d=qa.soundIDs.length-1;d>=0;d--)L(qa.sounds[qa.soundIDs[d]]);return o(c),ha.remove(a,"load",u),!0},this.canPlayMIME=function(a){var b;return qa.hasHTML5&&(b=ca({type:a})),!b&&Qa&&(b=a&&qa.ok()?!!((l>8?a.match(kb):null)||a.match(qa.mimePattern)):null),b},this.canPlayURL=function(a){var b;return qa.hasHTML5&&(b=ca({url:a})),!b&&Qa&&(b=a&&qa.ok()?!!a.match(qa.filePattern):null),b},this.canPlayLink=function(a){return!(a.type===b||!a.type||!qa.canPlayMIME(a.type))||qa.canPlayURL(a.href)},this.getSoundById=function(a,b){if(!a)return null;var c=qa.sounds[a];return c||b||qa._wD(ta+'.getSoundById(): Sound "'+a+'" not found.',2),c},this.onready=function(b,c){var d="onready",e=!1;if("function"!=typeof b)throw O("needFunction",d);return Da&&qa._wD(O("queue",d)),c||(c=a),s(d,b,c),t(),e=!0,e},this.ontimeout=function(b,c){var d="ontimeout",e=!1;if("function"!=typeof b)throw O("needFunction",d);return Da&&qa._wD(O("queue",d)),c||(c=a),s(d,b,c),t({type:d}),e=!0,e},this._writeDebug=function(a,c){var d,e,f="soundmanager-debug";return!!qa.debugMode&&(!!(ab&&qa.useConsole&&(c&&"object"==typeof c?console.log(a,c):Ha[c]!==b?console[Ha[c]](a):console.log(a),qa.consoleOnly))||!!(d=h(f))&&(e=ya.createElement("div"),++Ga%2===0&&(e.className="sm2-alt"),c=c===b?0:parseInt(c,10),e.appendChild(ya.createTextNode(a)),c&&(c>=2&&(e.style.fontWeight="bold"),3===c&&(e.style.color="#ff3333")),d.insertBefore(e,d.firstChild),d=null,!0))},xa.indexOf("sm2-debug=alert")!==-1&&(this._writeDebug=function(b){a.alert(b)}),this._wD=this._writeDebug,this._debug=function(){var a,b;for(n("currentObj",1),a=0,b=qa.soundIDs.length;a=0;d--)qa.sounds[qa.soundIDs[d]].destruct();if(sa)try{Wa&&(Ka=sa.innerHTML),Ja=sa.parentNode.removeChild(sa)}catch(a){n("badRemove",2)}if(Ka=Ja=Qa=sa=null,qa.enabled=F=Da=La=Ma=Ba=Ca=Ea=Sa=qa.swfLoaded=!1,qa.soundIDs=[],qa.sounds={},Ta=0,b)za=[];else for(d in za)if(za.hasOwnProperty(d))for(e=0,f=za[d].length;e0&&q.position===q.duration&&(qa._wD(d+"Sound at end, resetting to position:0"),a.position=0),q.paused&&q.position>=0&&(!q._iO.serverURL||q.position>0))qa._wD(d+"Resuming from paused state",1),q.resume();else{if(q._iO=p(a,q._iO),(!q.isHTML5&&null!==q._iO.position&&q._iO.position>0||null!==q._iO.from&&q._iO.from>0||null!==q._iO.to)&&0===q.instanceCount&&0===q.playState&&!q._iO.serverURL){if(i=function(){q._iO=p(a,q._iO),q.play(q._iO)},q.isHTML5&&!q._html5_canplay?(qa._wD(d+"Beginning load for non-zero offset case"),q.load({_oncanplay:i}),t=!1):q.isHTML5||q.loaded||q.readyState&&2===q.readyState||(qa._wD(d+"Preloading for non-zero offset case"),q.load({onload:i}),t=!1),null!==t)return t;q._iO=j()}(!q.instanceCount||q._iO.multiShotEvents||q.isHTML5&&q._iO.multiShot&&!Sa||!q.isHTML5&&l>8&&!q.getAutoPlay())&&q.instanceCount++,q._iO.onposition&&0===q.playState&&h(q),q.playState=1,q.paused=!1,q.position=q._iO.position===b||isNaN(q._iO.position)?0:q._iO.position,q.isHTML5||(q._iO=U(T(q._iO))),q._iO.onplay&&c&&(q._iO.onplay.apply(q),r=!0),q.setVolume(q._iO.volume,!0),q.setPan(q._iO.pan,!0),q.isHTML5?q.instanceCount<2?(g(),f=q._setup_html5(),q.setPosition(q._iO.position),f.play()):(qa._wD(q.id+": Cloning Audio() for instance #"+q.instanceCount+"..."),k=new Audio(q._iO.url),m=function(){ha.remove(k,"ended",m),q._onfinish(q),ea(k),k=null},n=function(){ha.remove(k,"canplay",n);try{k.currentTime=q._iO.position/fb}catch(a){V(q.id+": multiShot play() failed to apply position of "+q._iO.position/fb)}k.play()},ha.add(k,"ended",m),void 0!==q._iO.volume&&(k.volume=Math.max(0,Math.min(1,q._iO.volume/100))),q.muted&&(k.muted=!0),q._iO.position?ha.add(k,"canplay",n):k.play()):(s=sa._start(q.id,q._iO.loops||1,9===l?q.position:q.position/fb,q._iO.multiShot||!1),9!==l||s||(qa._wD(d+"No sound hardware, or 32-sound ceiling hit",2),q._iO.onplayerror&&q._iO.onplayerror.apply(q)))}return q},this.start=this.play,this.stop=function(a){var b,c=q._iO;return 1===q.playState&&(qa._wD(q.id+": stop()"),q._onbufferchange(0),q._resetOnPosition(0),q.paused=!1,q.isHTML5||(q.playState=0),i(),c.to&&q.clearOnPosition(c.to),q.isHTML5?q._a&&(b=q.position,q.setPosition(0),q.position=b,q._a.pause(),q.playState=0,q._onTimer(),f()):(sa._stop(q.id,a),c.serverURL&&q.unload()),q.instanceCount=0,q._iO={},c.onstop&&c.onstop.apply(q)),q},this.setAutoPlay=function(a){qa._wD(q.id+": Autoplay turned "+(a?"on":"off")),q._iO.autoPlay=a,q.isHTML5||(sa._setAutoPlay(q.id,a),a&&(q.instanceCount||1!==q.readyState||(q.instanceCount++,qa._wD(q.id+": Incremented instance count to "+q.instanceCount))))},this.getAutoPlay=function(){return q._iO.autoPlay},this.setPosition=function(a){a===b&&(a=0);var c,d,e=q.isHTML5?Math.max(a,0):Math.min(q.duration||q._iO.duration,Math.max(a,0));if(q.position=e,d=q.position/fb,q._resetOnPosition(q.position),q._iO.position=e,q.isHTML5){if(q._a){if(q._html5_canplay){if(q._a.currentTime!==d){qa._wD(q.id+": setPosition("+d+")");try{q._a.currentTime=d,(0===q.playState||q.paused)&&q._a.pause()}catch(a){qa._wD(q.id+": setPosition("+d+") failed: "+a.message,2)}}}else if(d)return qa._wD(q.id+": setPosition("+d+"): Cannot seek yet, sound not ready",2),q;q.paused&&q._onTimer(!0)}}else c=9===l?q.position:d,q.readyState&&2!==q.readyState&&sa._setPosition(q.id,c,q.paused||!q.playState,q._iO.multiShot);return q},this.pause=function(a){return q.paused||0===q.playState&&1!==q.readyState?q:(qa._wD(q.id+": pause()"),q.paused=!0,q.isHTML5?(q._setup_html5().pause(),f()):(a||a===b)&&sa._pause(q.id,q._iO.multiShot),q._iO.onpause&&q._iO.onpause.apply(q),q)},this.resume=function(){var a=q._iO;return q.paused?(qa._wD(q.id+": resume()"),q.paused=!1,q.playState=1,q.isHTML5?(q._setup_html5().play(),g()):(a.isMovieStar&&!a.serverURL&&q.setPosition(q.position),sa._pause(q.id,a.multiShot)),!r&&a.onplay?(a.onplay.apply(q),r=!0):a.onresume&&a.onresume.apply(q),q):q},this.togglePause=function(){return qa._wD(q.id+": togglePause()"),0===q.playState?(q.play({position:9!==l||q.isHTML5?q.position/fb:q.position}),q):(q.paused?q.resume():q.pause(),q)},this.setPan=function(a,c){return a===b&&(a=0),c===b&&(c=!1),q.isHTML5||sa._setPan(q.id,a),q._iO.pan=a,c||(q.pan=a,q.options.pan=a),q},this.setVolume=function(a,c){return a===b&&(a=100),c===b&&(c=!1),q.isHTML5?q._a&&(qa.muted&&!q.muted&&(q.muted=!0,q._a.muted=!0),q._a.volume=Math.max(0,Math.min(1,a/100))):sa._setVolume(q.id,qa.muted&&!q.muted||q.muted?0:a),q._iO.volume=a,c||(q.volume=a,q.options.volume=a),q},this.mute=function(){return q.muted=!0,q.isHTML5?q._a&&(q._a.muted=!0):sa._setVolume(q.id,0),q},this.unmute=function(){q.muted=!1;var a=q._iO.volume!==b;return q.isHTML5?q._a&&(q._a.muted=!1):sa._setVolume(q.id,a?q._iO.volume:q.options.volume),q},this.toggleMute=function(){return q.muted?q.unmute():q.mute()},this.onPosition=function(a,c,d){return s.push({position:parseInt(a,10),method:c,scope:d!==b?d:q,fired:!1}),q},this.onposition=this.onPosition,this.clearOnPosition=function(a,b){var c;if(a=parseInt(a,10),isNaN(a))return!1;for(c=0;c=c)return!1;for(a=c-1;a>=0;a--)b=s[a],!b.fired&&q.position>=b.position&&(b.fired=!0,t++,b.method.apply(b.scope,[b.position]),c=s.length);return!0},this._resetOnPosition=function(a){var b,c,d=s.length;if(!d)return!1;for(b=d-1;b>=0;b--)c=s[b],c.fired&&a<=c.position&&(c.fired=!1,t--);return!0},j=function(){var a,b,c=q._iO,d=c.from,e=c.to;return b=function(){qa._wD(q.id+': "To" time of '+e+" reached."),q.clearOnPosition(e,b),q.stop()},a=function(){qa._wD(q.id+': Playing "from" '+d),null===e||isNaN(e)||q.onPosition(e,b)},null===d||isNaN(d)||(c.position=d,c.multiShot=!1,a()),c},h=function(){var a,b=q._iO.onposition;if(b)for(a in b)b.hasOwnProperty(a)&&q.onPosition(parseInt(a,10),b[a])},i=function(){var a,b=q._iO.onposition;if(b)for(a in b)b.hasOwnProperty(a)&&q.clearOnPosition(parseInt(a,10))},g=function(){q.isHTML5&&X(q)},f=function(){q.isHTML5&&Y(q)},c=function(a){a||(s=[],t=0),r=!1,q._hasTimer=null,q._a=null,q._html5_canplay=!1,q.bytesLoaded=null,q.bytesTotal=null,q.duration=q._iO&&q._iO.duration?q._iO.duration:null,q.durationEstimate=null,q.buffered=[],q.eqData=[],q.eqData.left=[],q.eqData.right=[],q.failures=0,q.isBuffering=!1,q.instanceOptions={},q.instanceCount=0,q.loaded=!1,q.metadata={},q.readyState=0,q.muted=!1,q.paused=!1,q.peakData={left:0,right:0},q.waveformData={left:[],right:[]},q.playState=0,q.position=null,q.id3={}},c(),this._onTimer=function(a){var b,c,d=!1,e={};if(q._hasTimer||a)return q._a&&(a||(q.playState>0||1===q.readyState)&&!q.paused)&&(b=q._get_html5_duration(),b!==k.duration&&(k.duration=b,q.duration=b,d=!0),q.durationEstimate=q.duration,c=q._a.currentTime*fb||0,c!==k.time&&(k.time=c,d=!0),(d||a)&&q._whileplaying(c,e,e,e,e)),d},this._get_html5_duration=function(){var a=q._iO,b=q._a&&q._a.duration?q._a.duration*fb:a&&a.duration?a.duration:null,c=b&&!isNaN(b)&&b!==1/0?b:null;return c},this._apply_loop=function(a,b){!a.loop&&b>1&&qa._wD("Note: Native HTML5 looping is infinite.",1),a.loop=b>1?"loop":""},this._setup_html5=function(a){var b,e=p(q._iO,a),f=Sa?ra:q._a,g=decodeURI(e.url);if(Sa?g===decodeURI(ia)&&(b=!0):g===decodeURI(u)&&(b=!0),f){if(f._s)if(Sa)f._s&&f._s.playState&&!b&&f._s.stop();else if(!Sa&&g===decodeURI(u))return q._apply_loop(f,e.loops),f;b||(u&&c(!1),f.src=e.url,q.url=e.url,u=e.url,ia=e.url,f._called_load=!1)}else e.autoLoad||e.autoPlay?(q._a=new Audio(e.url),q._a.load()):q._a=Za&&opera.version()<10?new Audio(null):new Audio,f=q._a,f._called_load=!1,Sa&&(ra=f);return q.isHTML5=!0,q._a=f,f._s=q,d(),q._apply_loop(f,e.loops),e.autoLoad||e.autoPlay?q.load():(f.autobuffer=!1,f.preload="auto"),f},d=function(){function a(a,b,c){return q._a?q._a.addEventListener(a,b,c||!1):null}if(q._a._added_events)return!1;var b;q._a._added_events=!0;for(b in ma)ma.hasOwnProperty(b)&&a(b,ma[b]);return!0},e=function(){function a(a,b,c){return q._a?q._a.removeEventListener(a,b,c||!1):null}var b;qa._wD(q.id+": Removing event listeners"),q._a._added_events=!1;for(b in ma)ma.hasOwnProperty(b)&&a(b,ma[b])},this._onload=function(a){var b,c=!!a||!q.isHTML5&&8===l&&q.duration;return b=q.id+": ",qa._wD(b+(c?"onload()":"Failed to load / invalid sound?"+(q.duration?" -":" Zero-length duration reported.")+" ("+q.url+")"),c?1:2),c||q.isHTML5||(qa.sandbox.noRemote===!0&&qa._wD(b+O("noNet"),1),qa.sandbox.noLocal===!0&&qa._wD(b+O("noLocal"),1)),q.loaded=c,q.readyState=c?3:2,q._onbufferchange(0),q._iO.onload&&pa(q,function(){q._iO.onload.apply(q,[c])}),!0},this._onbufferchange=function(a){return 0!==q.playState&&(!(a&&q.isBuffering||!a&&!q.isBuffering)&&(q.isBuffering=1===a,q._iO.onbufferchange&&(qa._wD(q.id+": Buffer state change: "+a),q._iO.onbufferchange.apply(q,[a])),!0))},this._onsuspend=function(){return q._iO.onsuspend&&(qa._wD(q.id+": Playback suspended"),q._iO.onsuspend.apply(q)),!0},this._onfailure=function(a,b,c){q.failures++,qa._wD(q.id+": Failure ("+q.failures+"): "+a),q._iO.onfailure&&1===q.failures?q._iO.onfailure(a,b,c):qa._wD(q.id+": Ignoring failure")},this._onwarning=function(a,b,c){q._iO.onwarning&&q._iO.onwarning(a,b,c)},this._onfinish=function(){var a=q._iO.onfinish;q._onbufferchange(0),q._resetOnPosition(0),q.instanceCount&&(q.instanceCount--,q.instanceCount||(i(),q.playState=0,q.paused=!1,q.instanceCount=0,q.instanceOptions={},q._iO={},f(),q.isHTML5&&(q.position=0)),q.instanceCount&&!q._iO.multiShotEvents||a&&(qa._wD(q.id+": onfinish()"),pa(q,function(){a.apply(q)})))},this._whileloading=function(a,b,c,d){var e=q._iO;q.bytesLoaded=a,q.bytesTotal=b,q.duration=Math.floor(c),q.bufferLength=d,q.isHTML5||e.isMovieStar?q.durationEstimate=q.duration:e.duration?q.durationEstimate=q.duration>e.duration?q.duration:e.duration:q.durationEstimate=parseInt(q.bytesTotal/q.bytesLoaded*q.duration,10),q.isHTML5||(q.buffered=[{start:0,end:q.duration}]),(3!==q.readyState||q.isHTML5)&&e.whileloading&&e.whileloading.apply(q)},this._whileplaying=function(a,c,d,e,f){var g,h=q._iO;return!isNaN(a)&&null!==a&&(q.position=Math.max(0,a),q._processOnPosition(),!q.isHTML5&&l>8&&(h.usePeakData&&c!==b&&c&&(q.peakData={left:c.leftPeak,right:c.rightPeak}),h.useWaveformData&&d!==b&&d&&(q.waveformData={left:d.split(","),right:e.split(",")}),h.useEQData&&f!==b&&f&&f.leftEQ&&(g=f.leftEQ.split(","),q.eqData=g,q.eqData.left=g,f.rightEQ!==b&&f.rightEQ&&(q.eqData.right=f.rightEQ.split(",")))),1===q.playState&&(q.isHTML5||8!==l||q.position||!q.isBuffering||q._onbufferchange(0),h.whileplaying&&h.whileplaying.apply(q)),!0)},this._oncaptiondata=function(a){qa._wD(q.id+": Caption data received."),q.captiondata=a,q._iO.oncaptiondata&&q._iO.oncaptiondata.apply(q,[a])},this._onmetadata=function(a,b){qa._wD(q.id+": Metadata received.");var c,d,e={};for(c=0,d=a.length;c0&&(qa._wD(q.id+": Data error: "+a),q._iO.ondataerror&&q._iO.ondataerror.apply(q))},this._debug()},G=function(){return ya.body||ya.getElementsByTagName("div")[0]},h=function(a){return ya.getElementById(a)},p=function(a,c){var d,e,f=a||{};d=c===b?qa.defaultOptions:c;for(e in d)d.hasOwnProperty(e)&&f[e]===b&&("object"!=typeof d[e]||null===d[e]?f[e]=d[e]:f[e]=p(f[e],d[e]));return f},pa=function(b,c){b.isHTML5||8!==l?c():a.setTimeout(c,0)},r={onready:1,ontimeout:1,defaultOptions:1,flash9Options:1,movieStarOptions:1},q=function(a,c){var d,e=!0,f=c!==b,g=qa.setupOptions,h=r;if(a===b){e=[];for(d in g)g.hasOwnProperty(d)&&e.push(d);for(d in h)h.hasOwnProperty(d)&&("object"==typeof qa[d]?e.push(d+": {...}"):qa[d]instanceof Function?e.push(d+": function() {...}"):e.push(d));return qa._wD(O("setup",e.join(", "))),!1}for(d in a)if(a.hasOwnProperty(d))if("object"!=typeof a[d]||null===a[d]||a[d]instanceof Array||a[d]instanceof RegExp)f&&h[c]!==b?qa[c][d]=a[d]:g[d]!==b?(qa.setupOptions[d]=a[d],qa[d]=a[d]):h[d]===b?(V(O(qa[d]===b?"setupUndef":"setupError",d),2),e=!1):qa[d]instanceof Function?qa[d].apply(qa,a[d]instanceof Array?a[d]:[a[d]]):qa[d]=a[d];else{if(h[d]!==b)return q(a[d],d);V(O(qa[d]===b?"setupUndef":"setupError",d),2),e=!1}return e},ha=function(){function b(a){var b=Ra.call(a),c=b.length;return f?(b[1]="on"+b[1],c>3&&b.pop()):3===c&&b.push(!1),b}function c(a,b){var c=a.shift(),d=[g[b]];f?c[d](a[0],a[1]):c[d].apply(c,a)}function d(){c(b(arguments),"add")}function e(){c(b(arguments),"remove")}var f=a.attachEvent,g={add:f?"attachEvent":"addEventListener",remove:f?"detachEvent":"removeEventListener"};return{add:d,remove:e}}(),ma={abort:f(function(){qa._wD(this._s.id+": abort")}),canplay:f(function(){var a,c=this._s;if(c._html5_canplay)return!0;if(c._html5_canplay=!0,qa._wD(c.id+": canplay"),c._onbufferchange(0),a=c._iO.position===b||isNaN(c._iO.position)?null:c._iO.position/fb,this.currentTime!==a){qa._wD(c.id+": canplay: Setting position to "+a);try{this.currentTime=a}catch(b){qa._wD(c.id+": canplay: Setting position of "+a+" failed: "+b.message,2)}}c._iO._oncanplay&&c._iO._oncanplay()}),canplaythrough:f(function(){var a=this._s;a.loaded||(a._onbufferchange(0),a._whileloading(a.bytesLoaded,a.bytesTotal,a._get_html5_duration()),a._onload(!0))}),durationchange:f(function(){var a,b=this._s;a=b._get_html5_duration(),isNaN(a)||a===b.duration||(qa._wD(this._s.id+": durationchange ("+a+")"+(b.duration?", previously "+b.duration:"")),b.durationEstimate=b.duration=a)}),ended:f(function(){var a=this._s;qa._wD(a.id+": ended"),a._onfinish()}),error:f(function(){qa._wD(this._s.id+": HTML5 error, code "+this.error.code),this._s._onload(!1)}),loadeddata:f(function(){var a=this._s;qa._wD(a.id+": loadeddata"),a._loaded||Ya||(a.duration=a._get_html5_duration())}),loadedmetadata:f(function(){qa._wD(this._s.id+": loadedmetadata")}),loadstart:f(function(){qa._wD(this._s.id+": loadstart"),this._s._onbufferchange(1)}),play:f(function(){this._s._onbufferchange(0)}),playing:f(function(){qa._wD(this._s.id+": playing "+String.fromCharCode(9835)),this._s._onbufferchange(0)}),progress:f(function(a){var b,c,d,e=this._s,f=0,g="progress"===a.type,h=a.target.buffered,i=a.loaded||0,j=a.total||1;if(e.buffered=[],h&&h.length){for(b=0,c=h.length;b1){for(d=[],c=h.length,b=0;b=0;f--)h["audio/"+e[c].related[f]]=h[c], -qa.html5[e[c].related[f]]=h[c],qa.flash[e[c].related[f]]=h[c];return h.canPlayType=g?a:null,qa.html5=p(qa.html5,h),qa.html5.usingFlash=aa(),Qa=qa.html5.usingFlash,!0},A={notReady:"Unavailable - wait until onready() has fired.",notOK:"Audio support is not available.",domError:ta+"exception caught while appending SWF to DOM.",spcWmode:"Removing wmode, preventing known SWF loading issue(s)",swf404:ua+"Verify that %s is a valid path.",tryDebug:"Try "+ta+".debugFlash = true for more security details (output goes to SWF.)",checkSWF:"See SWF output for more debug info.",localFail:ua+"Non-HTTP page ("+ya.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:ua+"Special case: Waiting for SWF to load with window focus...",waitForever:ua+"Waiting indefinitely for Flash (will recover if unblocked)...",waitSWF:ua+"Waiting for 100% SWF load...",needFunction:ua+"Function object expected for %s",badID:'Sound ID "%s" should be a string, starting with a non-numeric character',currentObj:ua+"_debug(): Current sound objects",waitOnload:ua+"Waiting for window.onload()",docLoaded:ua+"Document already loaded",onload:ua+"initComplete(): calling soundManager.onload()",onloadOK:ta+".onload() complete",didInit:ua+"init(): Already called?",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",badRemove:ua+"Failed to remove Flash node.",shutdown:ta+".disable(): Shutting down",queue:ua+"Queueing %s handler",smError:"SMSound.load(): Exception: JS-Flash communication failed, or JS error.",fbTimeout:"No flash response, applying ."+R.swfTimedout+" CSS...",fbLoaded:"Flash loaded",fbHandler:ua+"flashBlockHandler()",manURL:"SMSound.load(): Using manually-assigned URL",onURL:ta+".load(): current URL already assigned.",badFV:ta+'.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",needFlash:ua+"Fatal error: Flash is needed to play some required formats, but is not available.",gotFocus:ua+"Got window focus.",policy:"Enabling usePolicyFile for data access",setup:ta+".setup(): allowed parameters: %s",setupError:ta+'.setup(): "%s" cannot be assigned with this method.',setupUndef:ta+'.setup(): Could not find option "%s"',setupLate:ta+".setup(): url, flashVersion and html5Test property changes will not take effect until reboot().",noURL:ua+"Flash URL required. Call soundManager.setup({url:...}) to get started.",sm2Loaded:"SoundManager 2: Ready. "+String.fromCharCode(10003),reset:ta+".reset(): Removing event callbacks",mobileUA:"Mobile UA detected, preferring HTML5 by default.",globalHTML5:"Using singleton HTML5 Audio() pattern for this device."},O=function(){var a,b,c,d,e;if(a=Ra.call(arguments),d=a.shift(),e=A&&A[d]?A[d]:"",e&&a&&a.length)for(b=0,c=a.length;b1&&a.stream&&(n("as2loop"),a.stream=!1),a},U=function(a,b){return a&&!a.usePolicyFile&&(a.onid3||a.usePeakData||a.useWaveformData||a.useEQData)&&(qa._wD((b||"")+O("policy")),a.usePolicyFile=!0),a},V=function(a){ab&&console.warn!==b?console.warn(a):qa._wD(a)},i=function(){return!1},L=function(a){var b;for(b in a)a.hasOwnProperty(b)&&"function"==typeof a[b]&&(a[b]=i);b=null},M=function(a){a===b&&(a=!1),(Ea||a)&&qa.disable(a)},N=function(a){var b,c=null;if(a)if(a.match(/\.swf(\?.*)?$/i)){if(c=a.substr(a.toLowerCase().lastIndexOf(".swf?")+4))return a}else a.lastIndexOf("/")!==a.length-1&&(a+="/");return b=(a&&a.lastIndexOf("/")!==-1?a.substr(0,a.lastIndexOf("/")+1):"./")+qa.movieURL,qa.noSWFCache&&(b+="?ts="+(new Date).getTime()),b},y=function(){l=parseInt(qa.flashVersion,10),8!==l&&9!==l&&(qa._wD(O("badFV",l,Ia)),qa.flashVersion=l=Ia);var a=qa.debugMode||qa.debugFlash?"_debug.swf":".swf";qa.useHTML5Audio&&!qa.html5Only&&qa.audioFormats.mp4.required&&l<9&&(qa._wD(O("needfl9")),qa.flashVersion=l=9),qa.version=qa.versionNumber+(qa.html5Only?" (HTML5-only mode)":9===l?" (AS3/Flash 9)":" (AS2/Flash 8)"),l>8?(qa.defaultOptions=p(qa.defaultOptions,qa.flash9Options),qa.features.buffering=!0,qa.defaultOptions=p(qa.defaultOptions,qa.movieStarOptions),qa.filePatterns.flash9=new RegExp("\\.(mp3|"+lb.join("|")+")(\\?.*)?$","i"),qa.features.movieStar=!0):qa.features.movieStar=!1,qa.filePattern=qa.filePatterns[8!==l?"flash9":"flash8"],qa.movieURL=(8===l?"soundmanager2.swf":"soundmanager2_flash9.swf").replace(".swf",a),qa.features.peakData=qa.features.waveformData=qa.features.eqData=l>8},J=function(a,b){return!!sa&&void sa._setPolling(a,b)},K=function(){if(qa.debugURLParam.test(xa)&&(qa.debugMode=!0),h(qa.debugID))return!1;var a,b,c,d,e;if(qa.debugMode&&!h(qa.debugID)&&(!ab||!qa.useConsole||!qa.consoleOnly)){a=ya.createElement("div"),a.id=qa.debugID+"-toggle",d={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},a.appendChild(ya.createTextNode("-")),a.onclick=S,a.title="Toggle SM2 debug console",wa.match(/msie 6/i)&&(a.style.position="absolute",a.style.cursor="hand");for(e in d)d.hasOwnProperty(e)&&(a.style[e]=d[e]);if(b=ya.createElement("div"),b.id=qa.debugID,b.style.display=qa.debugMode?"block":"none",qa.debugMode&&!h(a.id)){try{c=G(),c.appendChild(a)}catch(a){throw new Error(O("domError")+" \n"+a.toString())}c.appendChild(b)}}c=null},W=this.getSoundById,n=function(a,b){return a?qa._wD(O(a),b):""},S=function(){var a=h(qa.debugID),b=h(qa.debugID+"-toggle");return!!a&&(Aa?(b.innerHTML="+",a.style.display="none"):(b.innerHTML="-",a.style.display="block"),void(Aa=!Aa))},m=function(c,d,e){if(a.sm2Debugger!==b)try{sm2Debugger.handleEvent(c,d,e)}catch(a){return!1}return!0},Q=function(){var a=[];return qa.debugMode&&a.push(R.sm2Debug),qa.debugFlash&&a.push(R.flashDebug),qa.useHighPerformance&&a.push(R.highPerf),a.join(" ")},P=function(){var a=O("fbHandler"),b=qa.getMoviePercent(),c=R,d={type:"FLASHBLOCK"};return!qa.html5Only&&void(qa.ok()?(qa.didFlashBlock&&qa._wD(a+": Unblocked"),qa.oMC&&(qa.oMC.className=[Q(),c.swfDefault,c.swfLoaded+(qa.didFlashBlock?" "+c.swfUnblocked:"")].join(" "))):(Qa&&(qa.oMC.className=Q()+" "+c.swfDefault+" "+(null===b?c.swfTimedout:c.swfError),qa._wD(a+": "+O("fbTimeout")+(b?" ("+O("fbLoaded")+")":""))),qa.didFlashBlock=!0,t({type:"ontimeout",ignoreInit:!0,error:d}),I(d)))},s=function(a,c,d){za[a]===b&&(za[a]=[]),za[a].push({method:c,scope:d||null,fired:!1})},t=function(a){if(a||(a={type:qa.ok()?"onready":"ontimeout"}),!Da&&a&&!a.ignoreInit)return!1;if("ontimeout"===a.type&&(qa.ok()||Ea&&!a.ignoreInit))return!1;var b,c,d={success:a&&a.ignoreInit?qa.ok():!Ea},e=a&&a.type?za[a.type]||[]:[],f=[],g=[d],h=Qa&&!qa.ok();for(a.error&&(g[0].error=a.error),b=0,c=e.length;b=0;a--)qa.sounds[qa.soundIDs[a]].isHTML5&&qa.sounds[qa.soundIDs[a]]._hasTimer&&qa.sounds[qa.soundIDs[a]]._onTimer()},I=function(c){c=c!==b?c:{},"function"==typeof qa.onerror&&qa.onerror.apply(a,[{type:c.type!==b?c.type:null}]),c.fatal!==b&&c.fatal&&qa.disable()},la=function(){if(!_a||!ka())return!1;var a,b,c=qa.audioFormats;for(b in c)if(c.hasOwnProperty(b)&&("mp3"===b||"mp4"===b)&&(qa._wD(ta+": Using flash fallback for "+b+" format"),qa.html5[b]=!1,c[b]&&c[b].related))for(a=c[b].related.length-1;a>=0;a--)qa.html5[c[b].related[a]]=!1},this._setSandboxType=function(a){var c=qa.sandbox;c.type=a,c.description=c.types[c.types[a]!==b?a:"unknown"],"localWithFile"===c.type?(c.noRemote=!0,c.noLocal=!1,n("secNote",2)):"localWithNetwork"===c.type?(c.noRemote=!1,c.noLocal=!0):"localTrusted"===c.type&&(c.noRemote=!1,c.noLocal=!1)},this._externalInterfaceOK=function(a){if(qa.swfLoaded)return!1;var b;return m("swf",!0),m("flashtojs",!0),qa.swfLoaded=!0,cb=!1,_a&&la(),a&&a.replace(/\+dev/i,"")===qa.versionNumber.replace(/\+dev/i,"")?void setTimeout(k,Wa?100:1):(b=ta+': Fatal: JavaScript file build "'+qa.versionNumber+'" does not match Flash SWF build "'+a+'" at '+qa.url+". Ensure both are up-to-date.",setTimeout(function(){throw new Error(b)},0),!1)},H=function(a,c){function d(){var a,b=[],c=[],d=" + ";a="SoundManager "+qa.version+(!qa.html5Only&&qa.useHTML5Audio?qa.hasHTML5?" + HTML5 audio":", no HTML5 audio support":""),qa.html5Only?qa.html5PollingInterval&&b.push("html5PollingInterval ("+qa.html5PollingInterval+"ms)"):(qa.preferFlash&&b.push("preferFlash"),qa.useHighPerformance&&b.push("useHighPerformance"),qa.flashPollingInterval&&b.push("flashPollingInterval ("+qa.flashPollingInterval+"ms)"),qa.html5PollingInterval&&b.push("html5PollingInterval ("+qa.html5PollingInterval+"ms)"),qa.wmode&&b.push("wmode ("+qa.wmode+")"),qa.debugFlash&&b.push("debugFlash"),qa.useFlashBlock&&b.push("flashBlock")),b.length&&(c=c.concat([b.join(d)])),qa._wD(a+(c.length?d+c.join(", "):""),1),na()}function e(a,b){return''}if(Ba&&Ca)return!1;if(qa.html5Only)return y(),d(),qa.oMC=h(qa.movieID),k(),Ba=!0,Ca=!0,!1;var f,g,i,j,l,m,n,o,p=c||qa.url,q=qa.altURL||p,r="JS/Flash audio component (SoundManager 2)",s=G(),t=Q(),u=null,v=ya.getElementsByTagName("html")[0];if(u=v&&v.dir&&v.dir.match(/rtl/i),a=a===b?qa.id:a,y(),qa.url=N(ib?p:q),c=qa.url,qa.wmode=!qa.wmode&&qa.useHighPerformance?"transparent":qa.wmode,null!==qa.wmode&&(wa.match(/msie 8/i)||!Wa&&!qa.useHighPerformance)&&navigator.platform.match(/win32|win64/i)&&(Pa.push(A.spcWmode),qa.wmode=null),f={name:a,id:a,src:c,quality:"high",allowScriptAccess:qa.allowScriptAccess,bgcolor:qa.bgColor,pluginspage:jb+"www.macromedia.com/go/getflashplayer",title:r,type:"application/x-shockwave-flash",wmode:qa.wmode,hasPriority:"true"},qa.debugFlash&&(f.FlashVars="debug=1"),qa.wmode||delete f.wmode,Wa)g=ya.createElement("div"),j=['',e("movie",c),e("AllowScriptAccess",qa.allowScriptAccess),e("quality",f.quality),qa.wmode?e("wmode",qa.wmode):"",e("bgcolor",qa.bgColor),e("hasPriority","true"),qa.debugFlash?e("FlashVars",f.FlashVars):"",""].join("");else{g=ya.createElement("embed");for(i in f)f.hasOwnProperty(i)&&g.setAttribute(i,f[i])}if(K(),t=Q(),s=G())if(qa.oMC=h(qa.movieID)||ya.createElement("div"),qa.oMC.id)o=qa.oMC.className,qa.oMC.className=(o?o+" ":R.swfDefault)+(t?" "+t:""),qa.oMC.appendChild(g),Wa&&(l=qa.oMC.appendChild(ya.createElement("div")),l.className=R.swfBox,l.innerHTML=j),Ca=!0;else{if(qa.oMC.id=qa.movieID,qa.oMC.className=R.swfDefault+" "+t,m=null,l=null,qa.useFlashBlock||(qa.useHighPerformance?m={position:"fixed",width:"8px",height:"8px",bottom:"0px",left:"0px",overflow:"hidden"}:(m={position:"absolute",width:"6px",height:"6px",top:"-9999px",left:"-9999px"},u&&(m.left=Math.abs(parseInt(m.left,10))+"px"))),Xa&&(qa.oMC.style.zIndex=1e4),!qa.debugFlash)for(n in m)m.hasOwnProperty(n)&&(qa.oMC.style[n]=m[n]);try{Wa||qa.oMC.appendChild(g),s.appendChild(qa.oMC),Wa&&(l=qa.oMC.appendChild(ya.createElement("div")),l.className=R.swfBox,l.innerHTML=j),Ca=!0}catch(a){throw new Error(O("domError")+" \n"+a.toString())}}return Ba=!0,d(),!0},B=function(){return qa.html5Only?(H(),!1):!sa&&(qa.url?(sa=qa.getMovie(qa.id),sa||(Ja?(Wa?qa.oMC.innerHTML=Ka:qa.oMC.appendChild(Ja),Ja=null,Ba=!0):H(qa.id,qa.url),sa=qa.getMovie(qa.id)),"function"==typeof qa.oninitmovie&&setTimeout(qa.oninitmovie,1),oa(),!0):(n("noURL"),!1))},v=function(){setTimeout(w,1e3)},x=function(){a.setTimeout(function(){V(ua+"useFlashBlock is false, 100% HTML5 mode is possible. Rebooting with preferFlash: false..."),qa.setup({preferFlash:!1}).reboot(),qa.didFlashBlock=!0,qa.beginDelayedInit()},1)},w=function(){var b,c=!1;return!!qa.url&&(!La&&(La=!0,ha.remove(a,"load",v),ja&&cb&&!bb?(n("waitFocus"),!1):(Da||(b=qa.getMoviePercent(),b>0&&b<100&&(c=!0)),void setTimeout(function(){return b=qa.getMoviePercent(),c?(La=!1,qa._wD(O("waitSWF")),a.setTimeout(v,1),!1):(Da||(qa._wD(ta+": No Flash response within expected time. Likely causes: "+(0===b?"SWF load failed, ":"")+"Flash blocked or JS-Flash security error."+(qa.debugFlash?" "+O("checkSWF"):""),2),!ib&&b&&(n("localFail",2),qa.debugFlash||n("tryDebug",2)),0===b&&qa._wD(O("swf404",qa.url),1),m("flashtojs",!1," (Check flash security or flash blockers)")),void(!Da&&db&&(null===b?qa.useFlashBlock||0===qa.flashLoadTimeout?(qa.useFlashBlock&&P(),n("waitForever")):!qa.useFlashBlock&&_?x():(n("waitForever"),t({type:"ontimeout",ignoreInit:!0,error:{type:"INIT_FLASHBLOCK"}})):0===qa.flashLoadTimeout?n("waitForever"):!qa.useFlashBlock&&_?x():M(!0))))},qa.flashLoadTimeout))))},z=function(){function b(){ha.remove(a,"focus",z)}return bb||!cb?(b(),!0):(db=!0,bb=!0,n("gotFocus"),La=!1,v(),b(),!0)},oa=function(){Pa.length&&(qa._wD("SoundManager 2: "+Pa.join(" "),1),Pa=[])},na=function(){oa();var a,b=[];if(qa.useHTML5Audio&&qa.hasHTML5){for(a in qa.audioFormats)qa.audioFormats.hasOwnProperty(a)&&b.push(a+" = "+qa.html5[a]+(!qa.html5[a]&&Qa&&qa.flash[a]?" (using flash)":qa.preferFlash&&qa.flash[a]&&Qa?" (preferring flash)":qa.html5[a]?"":" ("+(qa.audioFormats[a].required?"required, ":"")+"and no flash support)"));qa._wD("SoundManager 2 HTML5 support: "+b.join(", "),1)}},o=function(b){if(Da)return!1;if(qa.html5Only)return n("sm2Loaded",1),Da=!0,u(),m("onload",!0),!0;var c,d=qa.useFlashBlock&&qa.flashLoadTimeout&&!qa.getMoviePercent(),e=!0;return d||(Da=!0),c={type:!ja&&Qa?"NO_FLASH":"INIT_TIMEOUT"},qa._wD("SoundManager 2 "+(Ea?"failed to load":"loaded")+" ("+(Ea?"Flash security/load error":"OK")+") "+String.fromCharCode(Ea?10006:10003),Ea?2:1),Ea||b?(qa.useFlashBlock&&qa.oMC&&(qa.oMC.className=Q()+" "+(null===qa.getMoviePercent()?R.swfTimedout:R.swfError)),t({type:"ontimeout",error:c,ignoreInit:!0}),m("onload",!1),I(c),e=!1):m("onload",!0),Ea||(qa.waitForWindowLoad&&!Fa?(n("waitOnload"),ha.add(a,"load",u)):(qa.waitForWindowLoad&&Fa&&n("docLoaded"),u())),e},j=function(){var a,c=qa.setupOptions;for(a in c)c.hasOwnProperty(a)&&(qa[a]===b?qa[a]=c[a]:qa[a]!==c[a]&&(qa.setupOptions[a]=qa[a]))},k=function(){function b(){ha.remove(a,"load",qa.beginDelayedInit)}if(Da)return n("didInit"),!1;if(qa.html5Only)return Da||(b(),qa.enabled=!0,o()),!0;B();try{sa._externalInterfaceTest(!1),J(!0,qa.flashPollingInterval||(qa.useHighPerformance?10:50)),qa.debugMode||sa._disableDebug(),qa.enabled=!0,m("jstoflash",!0),qa.html5Only||ha.add(a,"unload",i)}catch(a){return qa._wD("js/flash exception: "+a.toString()),m("jstoflash",!1),I({type:"JS_TO_FLASH_EXCEPTION",fatal:!0}),M(!0),o(),!1}return o(),b(),!0},D=function(){return!F&&(F=!0,j(),K(),function(){var a="sm2-usehtml5audio=",b="sm2-preferflash=",c=null,d=null,e=xa.toLowerCase();e.indexOf(a)!==-1&&(c="1"===e.charAt(e.indexOf(a)+a.length),ab&&console.log((c?"Enabling ":"Disabling ")+"useHTML5Audio via URL parameter"),qa.setup({useHTML5Audio:c})),e.indexOf(b)!==-1&&(d="1"===e.charAt(e.indexOf(b)+b.length),ab&&console.log((d?"Enabling ":"Disabling ")+"preferFlash via URL parameter"),qa.setup({preferFlash:d}))}(),!ja&&qa.hasHTML5&&(qa._wD("SoundManager 2: No Flash detected"+(qa.useHTML5Audio?". Trying HTML5-only mode.":", enabling HTML5."),1),qa.setup({useHTML5Audio:!0,preferFlash:!1})),ga(),!ja&&Qa&&(Pa.push(A.needFlash),qa.setup({flashLoadTimeout:1})),ya.removeEventListener&&ya.removeEventListener("DOMContentLoaded",D,!1),B(),!0)},fa=function(){return"complete"===ya.readyState&&(D(),ya.detachEvent("onreadystatechange",fa)),!0},E=function(){Fa=!0,D(),ha.remove(a,"load",E)},C=function(){$a&&(qa.setupOptions.useHTML5Audio&&!qa.setupOptions.preferFlash||Pa.push(A.mobileUA),qa.setupOptions.useHTML5Audio=!0,qa.setupOptions.preferFlash=!1,(Ua||Va&&!wa.match(/android\s2\.3/i))&&(Pa.push(A.globalHTML5),Ua&&(qa.ignoreFlash=!0),Sa=!0))},C(),ka(),ha.add(a,"focus",z),ha.add(a,"load",v),ha.add(a,"load",E),ya.addEventListener?ya.addEventListener("DOMContentLoaded",D,!1):ya.attachEvent?ya.attachEvent("onreadystatechange",fa):(m("onload",!1),I({type:"NO_DOM2_EVENTS",fatal:!0}))}if(!a||!a.document)throw new Error("SoundManager requires a browser with window and document objects.");var d=null;void 0!==a.SM2_DEFER&&SM2_DEFER||(d=new c),"object"==typeof module&&module&&"object"==typeof module.exports?(a.soundManager=d,module.exports.SoundManager=c,module.exports.soundManager=d):"function"==typeof define&&define.amd?define("SoundManager",[],function(){return{SoundManager:c,soundManager:d}}):(a.SoundManager=c,a.soundManager=d)}(window);var ngSoundManager=angular.module("angularSoundManager",[]).config(["$logProvider",function(a){a.debugEnabled(!1)}]);ngSoundManager.filter("humanTime",function(){return function(a){function b(a){return a<10?"0"+a.toString():a.toString()}var c=a/1e3/60<<0,d=Math.round(a/1e3%60);return b(c)+":"+b(d)}}),ngSoundManager.factory("angularPlayer",["$rootScope","$log",function(a,b){var c=null,d=!1,e=!1,f=[],g=!0,h=!1,i=90,j=0,k=[];return{init:function(){"undefined"==typeof soundManager&&alert("Please include SoundManager2 Library!"),soundManager.setup({preferFlash:!1,debugMode:!1,useHTML5Audio:!0,onready:function(){},ontimeout:function(){alert("SM2 failed to start. Flash missing, blocked or security error?"),alert("The status is "+status.success+", the error type is "+status.error.type)},defaultOptions:{autoLoad:!1,autoPlay:!1,from:null,loops:1,multiShot:!1,multiShotEvents:!1,onid3:null,onload:null,onstop:null,onfailure:"nextTrack",onpause:null,onplay:null,onresume:null,position:null,pan:0,stream:!0,to:null,type:"audio/mp3",usePolicyFile:!1,volume:i,whileloading:function(){var b=this.bytesLoaded/this.bytesTotal*100;a.$broadcast("track:loaded",b)},whileplaying:function(){c=this.id,j=this.position/this.duration*100,a.$broadcast("track:progress",j),a.$broadcast("currentTrack:position",this.position),a.$broadcast("currentTrack:duration",this.duration)},onfinish:function(){if(soundManager._writeDebug(this.id+" finished playing"),g===!0){var b=angular.element(document.querySelector("[ng-app]")),d=b.injector(),e=d.get("angularPlayer");e.nextTrack(),a.$broadcast("track:id",c)}}}}),soundManager.onready(function(){b.debug("song manager ready!");var c=soundManager.ok();b.debug("is supported: "+c),a.$broadcast("angularPlayer:ready",!0)})},isInArray:function(a,b){for(var c=0;c-1){if("undefined"==typeof a.url)return b.debug("invalid soundcloud track url"),!1}else if(soundManager.canPlayURL(a.url)!==!0)return b.debug("invalid song url"),!1},addTrack:function(a){if(!this.isTrackValid)return null;var b=this.isInArray(this.getPlaylist(),a.id);return b===!1&&(soundManager.createSound({id:a.id,url:a.url}),this.addToPlaylist(a)),a.id},removeSong:function(b,d){b===c&&this.stop(),soundManager.destroySound(b),k.splice(d,1),a.$broadcast("player:playlist",k)},initPlayTrack:function(b,c){c!==!0&&(this.stop(),this.setCurrentTrack(b)),soundManager.play(b),a.$broadcast("track:id",b),h=!0,a.$broadcast("music:isPlaying",h)},play:function(){var a=null;if(null===this.getCurrentTrack()){if(0===soundManager.soundIDs.length)return void b.debug("playlist is empty!");a=soundManager.soundIDs[0],this.initPlayTrack(a)}else a=this.getCurrentTrack(),this.initPlayTrack(a,!0)},pause:function(){soundManager.pause(this.getCurrentTrack()),h=!1,a.$broadcast("music:isPlaying",h)},stop:function(){this.pause(),this.resetProgress(),a.$broadcast("track:progress",j),a.$broadcast("currentTrack:position",0),a.$broadcast("currentTrack:duration",0),soundManager.stopAll(),soundManager.unload(this.getCurrentTrack())},playTrack:function(a){this.initPlayTrack(a)},nextTrack:function(){if(null===this.getCurrentTrack())return b.debug("Please click on Play before this action"),null;var c=angular.copy(soundManager.soundIDs);e===!0&&(c=f),console.log(soundManager.soundIDs),console.log(f);var g=this.getIndexByValue(c,this.getCurrentTrack()),i=+g+1,j=c[i];"undefined"!=typeof j?this.playTrack(j):(e===!0&&h===!0&&(f=angular.copy(soundManager.soundIDs),f=f.sort(function(){return.5-Math.random()}),a.$broadcast("music:tempTrack",f)),d===!0?this.playTrack(c[0]):(h=!1,a.$broadcast("music:isPlaying",h)))},prevTrack:function(){if(null===this.getCurrentTrack())return b.debug("Please click on Play before this action"),null;var a=angular.copy(soundManager.soundIDs);e===!0&&(a=f);var c=this.getIndexByValue(a,this.getCurrentTrack()),d=+c-1,g=a[d];"undefined"!=typeof g?this.playTrack(g):b.debug("no prev track found!")},mute:function(){soundManager.muted===!0?soundManager.unmute():soundManager.mute(),a.$broadcast("music:mute",soundManager.muted)},getMuteStatus:function(){return soundManager.muted},repeatToggle:function(){d=d!==!0,a.$broadcast("music:repeat",d)},getRepeatStatus:function(){return d},shuffleToggle:function(){e===!0?(e=!1,f=angular.copy(soundManager.soundIDs)):(e=!0,f=angular.copy(soundManager.soundIDs),f=f.sort(function(){return.5-Math.random()})),a.$broadcast("music:shuffle",e),a.$broadcast("music:tempTrack",f)},getShuffleStatus:function(){return e},getVolume:function(){return i},adjustVolume:function(b){var c=function(b){for(var c=0;c0&&(i-=10,c(i))},adjustVolumeSlider:function(b){var c=function(b){for(var c=0;c1&&a.stream&&(n("as2loop"),a.stream=!1),a},U=function(a,b){return a&&!a.usePolicyFile&&(a.onid3||a.usePeakData||a.useWaveformData||a.useEQData)&&(qa._wD((b||"")+O("policy")),a.usePolicyFile=!0),a},V=function(a){ab&&console.warn!==b?console.warn(a):qa._wD(a)},i=function(){return!1},L=function(a){var b;for(b in a)a.hasOwnProperty(b)&&"function"==typeof a[b]&&(a[b]=i);b=null},M=function(a){a===b&&(a=!1),(Ea||a)&&qa.disable(a)},N=function(a){var b,c=null;if(a)if(a.match(/\.swf(\?.*)?$/i)){if(c=a.substr(a.toLowerCase().lastIndexOf(".swf?")+4))return a}else a.lastIndexOf("/")!==a.length-1&&(a+="/");return b=(a&&a.lastIndexOf("/")!==-1?a.substr(0,a.lastIndexOf("/")+1):"./")+qa.movieURL,qa.noSWFCache&&(b+="?ts="+(new Date).getTime()),b},y=function(){l=parseInt(qa.flashVersion,10),8!==l&&9!==l&&(qa._wD(O("badFV",l,Ia)),qa.flashVersion=l=Ia);var a=qa.debugMode||qa.debugFlash?"_debug.swf":".swf";qa.useHTML5Audio&&!qa.html5Only&&qa.audioFormats.mp4.required&&l<9&&(qa._wD(O("needfl9")),qa.flashVersion=l=9),qa.version=qa.versionNumber+(qa.html5Only?" (HTML5-only mode)":9===l?" (AS3/Flash 9)":" (AS2/Flash 8)"),l>8?(qa.defaultOptions=p(qa.defaultOptions,qa.flash9Options),qa.features.buffering=!0,qa.defaultOptions=p(qa.defaultOptions,qa.movieStarOptions),qa.filePatterns.flash9=new RegExp("\\.(mp3|"+lb.join("|")+")(\\?.*)?$","i"),qa.features.movieStar=!0):qa.features.movieStar=!1,qa.filePattern=qa.filePatterns[8!==l?"flash9":"flash8"],qa.movieURL=(8===l?"soundmanager2.swf":"soundmanager2_flash9.swf").replace(".swf",a),qa.features.peakData=qa.features.waveformData=qa.features.eqData=l>8},J=function(a,b){return!!sa&&void sa._setPolling(a,b)},K=function(){if(qa.debugURLParam.test(xa)&&(qa.debugMode=!0),h(qa.debugID))return!1;var a,b,c,d,e;if(qa.debugMode&&!h(qa.debugID)&&(!ab||!qa.useConsole||!qa.consoleOnly)){a=ya.createElement("div"),a.id=qa.debugID+"-toggle",d={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},a.appendChild(ya.createTextNode("-")),a.onclick=S,a.title="Toggle SM2 debug console",wa.match(/msie 6/i)&&(a.style.position="absolute",a.style.cursor="hand");for(e in d)d.hasOwnProperty(e)&&(a.style[e]=d[e]);if(b=ya.createElement("div"),b.id=qa.debugID,b.style.display=qa.debugMode?"block":"none",qa.debugMode&&!h(a.id)){try{c=G(),c.appendChild(a)}catch(a){throw new Error(O("domError")+" \n"+a.toString())}c.appendChild(b)}}c=null},W=this.getSoundById,n=function(a,b){return a?qa._wD(O(a),b):""},S=function(){var a=h(qa.debugID),b=h(qa.debugID+"-toggle");return!!a&&(Aa?(b.innerHTML="+",a.style.display="none"):(b.innerHTML="-",a.style.display="block"),void(Aa=!Aa))},m=function(c,d,e){if(a.sm2Debugger!==b)try{sm2Debugger.handleEvent(c,d,e)}catch(a){return!1}return!0},Q=function(){var a=[];return qa.debugMode&&a.push(R.sm2Debug),qa.debugFlash&&a.push(R.flashDebug),qa.useHighPerformance&&a.push(R.highPerf),a.join(" ")},P=function(){var a=O("fbHandler"),b=qa.getMoviePercent(),c=R,d={type:"FLASHBLOCK"};return!qa.html5Only&&void(qa.ok()?(qa.didFlashBlock&&qa._wD(a+": Unblocked"),qa.oMC&&(qa.oMC.className=[Q(),c.swfDefault,c.swfLoaded+(qa.didFlashBlock?" "+c.swfUnblocked:"")].join(" "))):(Qa&&(qa.oMC.className=Q()+" "+c.swfDefault+" "+(null===b?c.swfTimedout:c.swfError),qa._wD(a+": "+O("fbTimeout")+(b?" ("+O("fbLoaded")+")":""))),qa.didFlashBlock=!0,t({type:"ontimeout",ignoreInit:!0,error:d}),I(d)))},s=function(a,c,d){za[a]===b&&(za[a]=[]),za[a].push({method:c,scope:d||null,fired:!1})},t=function(a){if(a||(a={type:qa.ok()?"onready":"ontimeout"}),!Da&&a&&!a.ignoreInit)return!1;if("ontimeout"===a.type&&(qa.ok()||Ea&&!a.ignoreInit))return!1;var b,c,d={success:a&&a.ignoreInit?qa.ok():!Ea},e=a&&a.type?za[a.type]||[]:[],f=[],g=[d],h=Qa&&!qa.ok();for(a.error&&(g[0].error=a.error),b=0,c=e.length;b=0;a--)qa.sounds[qa.soundIDs[a]].isHTML5&&qa.sounds[qa.soundIDs[a]]._hasTimer&&qa.sounds[qa.soundIDs[a]]._onTimer()},I=function(c){c=c!==b?c:{},"function"==typeof qa.onerror&&qa.onerror.apply(a,[{type:c.type!==b?c.type:null}]),c.fatal!==b&&c.fatal&&qa.disable()},la=function(){if(!_a||!ka())return!1;var a,b,c=qa.audioFormats;for(b in c)if(c.hasOwnProperty(b)&&("mp3"===b||"mp4"===b)&&(qa._wD(ta+": Using flash fallback for "+b+" format"),qa.html5[b]=!1,c[b]&&c[b].related))for(a=c[b].related.length-1;a>=0;a--)qa.html5[c[b].related[a]]=!1},this._setSandboxType=function(a){var c=qa.sandbox;c.type=a,c.description=c.types[c.types[a]!==b?a:"unknown"],"localWithFile"===c.type?(c.noRemote=!0,c.noLocal=!1,n("secNote",2)):"localWithNetwork"===c.type?(c.noRemote=!1,c.noLocal=!0):"localTrusted"===c.type&&(c.noRemote=!1,c.noLocal=!1)},this._externalInterfaceOK=function(a){if(qa.swfLoaded)return!1;var b;return m("swf",!0),m("flashtojs",!0),qa.swfLoaded=!0,cb=!1,_a&&la(),a&&a.replace(/\+dev/i,"")===qa.versionNumber.replace(/\+dev/i,"")?void setTimeout(k,Wa?100:1):(b=ta+': Fatal: JavaScript file build "'+qa.versionNumber+'" does not match Flash SWF build "'+a+'" at '+qa.url+". Ensure both are up-to-date.",setTimeout(function(){throw new Error(b)},0),!1)},H=function(a,c){function d(){var a,b=[],c=[],d=" + ";a="SoundManager "+qa.version+(!qa.html5Only&&qa.useHTML5Audio?qa.hasHTML5?" + HTML5 audio":", no HTML5 audio support":""),qa.html5Only?qa.html5PollingInterval&&b.push("html5PollingInterval ("+qa.html5PollingInterval+"ms)"):(qa.preferFlash&&b.push("preferFlash"),qa.useHighPerformance&&b.push("useHighPerformance"),qa.flashPollingInterval&&b.push("flashPollingInterval ("+qa.flashPollingInterval+"ms)"),qa.html5PollingInterval&&b.push("html5PollingInterval ("+qa.html5PollingInterval+"ms)"),qa.wmode&&b.push("wmode ("+qa.wmode+")"),qa.debugFlash&&b.push("debugFlash"),qa.useFlashBlock&&b.push("flashBlock")),b.length&&(c=c.concat([b.join(d)])),qa._wD(a+(c.length?d+c.join(", "):""),1),na()}function e(a,b){return''}if(Ba&&Ca)return!1;if(qa.html5Only)return y(),d(),qa.oMC=h(qa.movieID),k(),Ba=!0,Ca=!0,!1;var f,g,i,j,l,m,n,o,p=c||qa.url,q=qa.altURL||p,r="JS/Flash audio component (SoundManager 2)",s=G(),t=Q(),u=null,v=ya.getElementsByTagName("html")[0];if(u=v&&v.dir&&v.dir.match(/rtl/i),a=a===b?qa.id:a,y(),qa.url=N(ib?p:q),c=qa.url,qa.wmode=!qa.wmode&&qa.useHighPerformance?"transparent":qa.wmode,null!==qa.wmode&&(wa.match(/msie 8/i)||!Wa&&!qa.useHighPerformance)&&navigator.platform.match(/win32|win64/i)&&(Pa.push(A.spcWmode),qa.wmode=null),f={name:a,id:a,src:c,quality:"high",allowScriptAccess:qa.allowScriptAccess,bgcolor:qa.bgColor,pluginspage:jb+"www.macromedia.com/go/getflashplayer",title:r,type:"application/x-shockwave-flash",wmode:qa.wmode,hasPriority:"true"},qa.debugFlash&&(f.FlashVars="debug=1"),qa.wmode||delete f.wmode,Wa)g=ya.createElement("div"),j=['',e("movie",c),e("AllowScriptAccess",qa.allowScriptAccess),e("quality",f.quality),qa.wmode?e("wmode",qa.wmode):"",e("bgcolor",qa.bgColor),e("hasPriority","true"),qa.debugFlash?e("FlashVars",f.FlashVars):"",""].join("");else{g=ya.createElement("embed");for(i in f)f.hasOwnProperty(i)&&g.setAttribute(i,f[i])}if(K(),t=Q(),s=G())if(qa.oMC=h(qa.movieID)||ya.createElement("div"),qa.oMC.id)o=qa.oMC.className,qa.oMC.className=(o?o+" ":R.swfDefault)+(t?" "+t:""),qa.oMC.appendChild(g),Wa&&(l=qa.oMC.appendChild(ya.createElement("div")),l.className=R.swfBox,l.innerHTML=j),Ca=!0;else{if(qa.oMC.id=qa.movieID,qa.oMC.className=R.swfDefault+" "+t,m=null,l=null,qa.useFlashBlock||(qa.useHighPerformance?m={position:"fixed",width:"8px",height:"8px",bottom:"0px",left:"0px",overflow:"hidden"}:(m={position:"absolute",width:"6px",height:"6px",top:"-9999px",left:"-9999px"},u&&(m.left=Math.abs(parseInt(m.left,10))+"px"))),Xa&&(qa.oMC.style.zIndex=1e4),!qa.debugFlash)for(n in m)m.hasOwnProperty(n)&&(qa.oMC.style[n]=m[n]);try{Wa||qa.oMC.appendChild(g),s.appendChild(qa.oMC),Wa&&(l=qa.oMC.appendChild(ya.createElement("div")),l.className=R.swfBox,l.innerHTML=j),Ca=!0}catch(a){throw new Error(O("domError")+" \n"+a.toString())}}return Ba=!0,d(),!0},B=function(){return qa.html5Only?(H(),!1):!sa&&(qa.url?(sa=qa.getMovie(qa.id),sa||(Ja?(Wa?qa.oMC.innerHTML=Ka:qa.oMC.appendChild(Ja),Ja=null,Ba=!0):H(qa.id,qa.url),sa=qa.getMovie(qa.id)),"function"==typeof qa.oninitmovie&&setTimeout(qa.oninitmovie,1),oa(),!0):(n("noURL"),!1))},v=function(){setTimeout(w,1e3)},x=function(){a.setTimeout(function(){V(ua+"useFlashBlock is false, 100% HTML5 mode is possible. Rebooting with preferFlash: false..."),qa.setup({preferFlash:!1}).reboot(),qa.didFlashBlock=!0,qa.beginDelayedInit()},1)},w=function(){var b,c=!1;return!!qa.url&&(!La&&(La=!0,ha.remove(a,"load",v),ja&&cb&&!bb?(n("waitFocus"),!1):(Da||(b=qa.getMoviePercent(),b>0&&b<100&&(c=!0)),void setTimeout(function(){return b=qa.getMoviePercent(),c?(La=!1,qa._wD(O("waitSWF")),a.setTimeout(v,1),!1):(Da||(qa._wD(ta+": No Flash response within expected time. Likely causes: "+(0===b?"SWF load failed, ":"")+"Flash blocked or JS-Flash security error."+(qa.debugFlash?" "+O("checkSWF"):""),2),!ib&&b&&(n("localFail",2),qa.debugFlash||n("tryDebug",2)),0===b&&qa._wD(O("swf404",qa.url),1),m("flashtojs",!1," (Check flash security or flash blockers)")),void(!Da&&db&&(null===b?qa.useFlashBlock||0===qa.flashLoadTimeout?(qa.useFlashBlock&&P(),n("waitForever")):!qa.useFlashBlock&&_?x():(n("waitForever"),t({type:"ontimeout",ignoreInit:!0,error:{type:"INIT_FLASHBLOCK"}})):0===qa.flashLoadTimeout?n("waitForever"):!qa.useFlashBlock&&_?x():M(!0))))},qa.flashLoadTimeout))))},z=function(){function b(){ha.remove(a,"focus",z)}return bb||!cb?(b(),!0):(db=!0,bb=!0,n("gotFocus"),La=!1,v(),b(),!0)},oa=function(){Pa.length&&(qa._wD("SoundManager 2: "+Pa.join(" "),1),Pa=[])},na=function(){oa();var a,b=[];if(qa.useHTML5Audio&&qa.hasHTML5){for(a in qa.audioFormats)qa.audioFormats.hasOwnProperty(a)&&b.push(a+" = "+qa.html5[a]+(!qa.html5[a]&&Qa&&qa.flash[a]?" (using flash)":qa.preferFlash&&qa.flash[a]&&Qa?" (preferring flash)":qa.html5[a]?"":" ("+(qa.audioFormats[a].required?"required, ":"")+"and no flash support)"));qa._wD("SoundManager 2 HTML5 support: "+b.join(", "),1)}},o=function(b){if(Da)return!1;if(qa.html5Only)return n("sm2Loaded",1),Da=!0,u(),m("onload",!0),!0;var c,d=qa.useFlashBlock&&qa.flashLoadTimeout&&!qa.getMoviePercent(),e=!0;return d||(Da=!0),c={type:!ja&&Qa?"NO_FLASH":"INIT_TIMEOUT"},qa._wD("SoundManager 2 "+(Ea?"failed to load":"loaded")+" ("+(Ea?"Flash security/load error":"OK")+") "+String.fromCharCode(Ea?10006:10003),Ea?2:1),Ea||b?(qa.useFlashBlock&&qa.oMC&&(qa.oMC.className=Q()+" "+(null===qa.getMoviePercent()?R.swfTimedout:R.swfError)),t({type:"ontimeout",error:c,ignoreInit:!0}),m("onload",!1),I(c),e=!1):m("onload",!0),Ea||(qa.waitForWindowLoad&&!Fa?(n("waitOnload"),ha.add(a,"load",u)):(qa.waitForWindowLoad&&Fa&&n("docLoaded"),u())),e},j=function(){var a,c=qa.setupOptions;for(a in c)c.hasOwnProperty(a)&&(qa[a]===b?qa[a]=c[a]:qa[a]!==c[a]&&(qa.setupOptions[a]=qa[a]))},k=function(){function b(){ha.remove(a,"load",qa.beginDelayedInit)}if(Da)return n("didInit"),!1;if(qa.html5Only)return Da||(b(),qa.enabled=!0,o()),!0;B();try{sa._externalInterfaceTest(!1),J(!0,qa.flashPollingInterval||(qa.useHighPerformance?10:50)),qa.debugMode||sa._disableDebug(),qa.enabled=!0,m("jstoflash",!0),qa.html5Only||ha.add(a,"unload",i)}catch(a){return qa._wD("js/flash exception: "+a.toString()),m("jstoflash",!1),I({type:"JS_TO_FLASH_EXCEPTION",fatal:!0}),M(!0),o(),!1}return o(),b(),!0},D=function(){return!F&&(F=!0,j(),K(),function(){var a="sm2-usehtml5audio=",b="sm2-preferflash=",c=null,d=null,e=xa.toLowerCase();e.indexOf(a)!==-1&&(c="1"===e.charAt(e.indexOf(a)+a.length),ab&&console.log((c?"Enabling ":"Disabling ")+"useHTML5Audio via URL parameter"),qa.setup({useHTML5Audio:c})),e.indexOf(b)!==-1&&(d="1"===e.charAt(e.indexOf(b)+b.length),ab&&console.log((d?"Enabling ":"Disabling ")+"preferFlash via URL parameter"),qa.setup({preferFlash:d}))}(),!ja&&qa.hasHTML5&&(qa._wD("SoundManager 2: No Flash detected"+(qa.useHTML5Audio?". Trying HTML5-only mode.":", enabling HTML5."),1),qa.setup({useHTML5Audio:!0,preferFlash:!1})),ga(),!ja&&Qa&&(Pa.push(A.needFlash),qa.setup({flashLoadTimeout:1})),ya.removeEventListener&&ya.removeEventListener("DOMContentLoaded",D,!1),B(),!0)},fa=function(){return"complete"===ya.readyState&&(D(),ya.detachEvent("onreadystatechange",fa)),!0},E=function(){Fa=!0,D(),ha.remove(a,"load",E)},C=function(){$a&&(qa.setupOptions.useHTML5Audio&&!qa.setupOptions.preferFlash||Pa.push(A.mobileUA),qa.setupOptions.useHTML5Audio=!0,qa.setupOptions.preferFlash=!1,(Ua||Va&&!wa.match(/android\s2\.3/i))&&(Pa.push(A.globalHTML5),Ua&&(qa.ignoreFlash=!0),Sa=!0))},C(),ka(),ha.add(a,"focus",z),ha.add(a,"load",v),ha.add(a,"load",E),ya.addEventListener?ya.addEventListener("DOMContentLoaded",D,!1):ya.attachEvent?ya.attachEvent("onreadystatechange",fa):(m("onload",!1),I({type:"NO_DOM2_EVENTS",fatal:!0}))}if(!a||!a.document)throw new Error("SoundManager requires a browser with window and document objects.");var d=null;void 0!==a.SM2_DEFER&&SM2_DEFER||(d=new c),"object"==typeof module&&module&&"object"==typeof module.exports?(a.soundManager=d,module.exports.SoundManager=c,module.exports.soundManager=d):"function"==typeof define&&define.amd?define("SoundManager",[],function(){return{SoundManager:c,soundManager:d}}):(a.SoundManager=c,a.soundManager=d)}(window);var ngSoundManager=angular.module("angularSoundManager",[]).config(["$logProvider",function(a){a.debugEnabled(!1)}]);ngSoundManager.filter("humanTime",function(){return function(a){function b(a){return a<10?"0"+a.toString():a.toString()}var c=a/1e3/60<<0,d=Math.round(a/1e3%60);return b(c)+":"+b(d)}}),ngSoundManager.factory("angularPlayer",["$rootScope","$log",function(a,b){var c=null,d=!1,e=!1,f=[],g=!0,h=!1,i=90,j=0,k=[];return{init:function(){"undefined"==typeof soundManager&&alert("Please include SoundManager2 Library!"),soundManager.setup({preferFlash:!1,debugMode:!1,useHTML5Audio:!0,onready:function(){},ontimeout:function(){alert("SM2 failed to start. Flash missing, blocked or security error?"),alert("The status is "+status.success+", the error type is "+status.error.type)},defaultOptions:{autoLoad:!1,autoPlay:!1,from:null,loops:1,multiShot:!1,multiShotEvents:!1,onid3:null,onload:null,onstop:null,onfailure:"nextTrack",onpause:null,onplay:null,onresume:null,position:null,pan:0,stream:!0,to:null,type:"audio/mp3",usePolicyFile:!1,volume:i,whileloading:function(){var b=this.bytesLoaded/this.bytesTotal*100;a.$broadcast("track:loaded",b)},whileplaying:function(){c=this.id,j=this.position/this.duration*100,a.$broadcast("track:progress",j),a.$broadcast("currentTrack:position",this.position),a.$broadcast("currentTrack:duration",this.duration)},onfinish:function(){if(soundManager._writeDebug(this.id+" finished playing"),g===!0){var b=angular.element(document.querySelector("[ng-app]")),d=b.injector(),e=d.get("angularPlayer");e.nextTrack(),a.$broadcast("track:id",c)}}}}),soundManager.onready(function(){b.debug("song manager ready!");var c=soundManager.ok();b.debug("is supported: "+c),a.$broadcast("angularPlayer:ready",!0)})},isInArray:function(a,b){for(var c=0;c-1){if("undefined"==typeof a.url)return b.debug("invalid soundcloud track url"),!1}else if(soundManager.canPlayURL(a.url)!==!0)return b.debug("invalid song url"),!1},addTrack:function(a){if(!this.isTrackValid)return null;var b=this.isInArray(this.getPlaylist(),a.id);return b===!1&&(soundManager.createSound({id:a.id,url:a.url}),this.addToPlaylist(a)),a.id},removeSong:function(b,d){b===c&&this.stop(),soundManager.destroySound(b),k.splice(d,1),a.$broadcast("player:playlist",k)},initPlayTrack:function(b,c){c!==!0&&(this.stop(),this.setCurrentTrack(b)),soundManager.play(b),a.$broadcast("track:id",b),h=!0,a.$broadcast("music:isPlaying",h)},play:function(){var a=null;if(null===this.getCurrentTrack()){if(0===soundManager.soundIDs.length)return void b.debug("playlist is empty!");a=soundManager.soundIDs[0],this.initPlayTrack(a)}else a=this.getCurrentTrack(),this.initPlayTrack(a,!0)},pause:function(){soundManager.pause(this.getCurrentTrack()),h=!1,a.$broadcast("music:isPlaying",h)},stop:function(){this.pause(),this.resetProgress(),a.$broadcast("track:progress",j),a.$broadcast("currentTrack:position",0),a.$broadcast("currentTrack:duration",0),soundManager.stopAll(),soundManager.unload(this.getCurrentTrack())},playTrack:function(a){this.initPlayTrack(a)},nextTrack:function(){if(null===this.getCurrentTrack())return b.debug("Please click on Play before this action"),null;var c=angular.copy(soundManager.soundIDs);e===!0&&(c=f);var g=this.getIndexByValue(c,this.getCurrentTrack()),i=+g+1,j=c[i];"undefined"!=typeof j?this.playTrack(j):(e===!0&&h===!0&&(f=angular.copy(soundManager.soundIDs),f=f.sort(function(){return.5-Math.random()}),a.$broadcast("music:tempTrack",f)),d===!0?this.playTrack(c[0]):(h=!1,a.$broadcast("music:isPlaying",h)))},prevTrack:function(){if(null===this.getCurrentTrack())return b.debug("Please click on Play before this action"),null;var a=angular.copy(soundManager.soundIDs);e===!0&&(a=f);var c=this.getIndexByValue(a,this.getCurrentTrack()),d=+c-1,g=a[d];"undefined"!=typeof g?this.playTrack(g):b.debug("no prev track found!")},mute:function(){soundManager.muted===!0?soundManager.unmute():soundManager.mute(),a.$broadcast("music:mute",soundManager.muted)},getMuteStatus:function(){return soundManager.muted},repeatToggle:function(){d=d!==!0,a.$broadcast("music:repeat",d)},getRepeatStatus:function(){return d},shuffleToggle:function(){e===!0?(e=!1,f=angular.copy(soundManager.soundIDs)):(e=!0,f=angular.copy(soundManager.soundIDs),f=f.sort(function(){return.5-Math.random()})),a.$broadcast("music:shuffle",e),a.$broadcast("music:tempTrack",f)},getShuffleStatus:function(){return e},getVolume:function(){return i},adjustVolume:function(b){var c=function(b){for(var c=0;c0&&(i-=10,c(i))},adjustVolumeSlider:function(b){var c=function(b){for(var c=0;c Date: Wed, 12 Apr 2017 14:20:21 +0700 Subject: [PATCH 3/8] add auto play when shuffle --- src/21-directive-shuffleMusic.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/21-directive-shuffleMusic.js b/src/21-directive-shuffleMusic.js index 5aab0ad..020bb82 100644 --- a/src/21-directive-shuffleMusic.js +++ b/src/21-directive-shuffleMusic.js @@ -12,6 +12,10 @@ ngSoundManager.directive('shuffleMusic', ['angularPlayer', function (angularPlay scope.$apply(function () { scope.shuffle = data; }); + + if(!angularPlayer.isPlayingStatus() && scope.shuffle) { + angularPlayer.play(); + } }); } }; From 3c42459f19fd1dfdc579eac148e89629d3ef6af1 Mon Sep 17 00:00:00 2001 From: kimsrung Date: Wed, 12 Apr 2017 14:40:46 +0700 Subject: [PATCH 4/8] grunt files --- dist/angular-soundmanager2.js | 4 ++++ dist/angular-soundmanager2.min.js | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/dist/angular-soundmanager2.js b/dist/angular-soundmanager2.js index 1f04c63..1664fb7 100644 --- a/dist/angular-soundmanager2.js +++ b/dist/angular-soundmanager2.js @@ -5228,6 +5228,10 @@ ngSoundManager.directive('shuffleMusic', ['angularPlayer', function (angularPlay scope.$apply(function () { scope.shuffle = data; }); + + if(!angularPlayer.isPlayingStatus() && scope.shuffle) { + angularPlayer.play(); + } }); } }; diff --git a/dist/angular-soundmanager2.min.js b/dist/angular-soundmanager2.min.js index 18a2c30..f77ab0b 100644 --- a/dist/angular-soundmanager2.min.js +++ b/dist/angular-soundmanager2.min.js @@ -1,3 +1,3 @@ -/*! angular-soundmanager2 13-12-2016 */ -!function(a,b){"use strict";function c(c,d){function e(a){return qa.preferFlash&&ja&&!qa.ignoreFlash&&qa.flash[a]!==b&&qa.flash[a]}function f(a){return function(b){var c,d=this._s;return d&&d._a?c=a.call(this,b):(d&&d.id?qa._wD(d.id+": Ignoring "+b.type):qa._wD(va+"Ignoring "+b.type),c=null),c}}this.setupOptions={url:c||null,flashVersion:8,debugMode:!0,debugFlash:!1,useConsole:!0,consoleOnly:!0,waitForWindowLoad:!1,bgColor:"#ffffff",useHighPerformance:!1,flashPollingInterval:null,html5PollingInterval:null,flashLoadTimeout:1e3,wmode:null,allowScriptAccess:"always",useFlashBlock:!1,useHTML5Audio:!0,html5Test:/^(probably|maybe)$/i,preferFlash:!1,noSWFCache:!1,idPrefix:"sound"},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,duration:null},this.audioFormats={mp3:{type:['audio/mpeg; codecs="mp3"',"audio/mpeg","audio/mp3","audio/MPA","audio/mpa-robust"],required:!0},mp4:{related:["aac","m4a","m4b"],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},opus:{type:["audio/ogg; codecs=opus","audio/opus"],required:!1},wav:{type:['audio/wav; codecs="1"',"audio/wav","audio/wave","audio/x-wav"],required:!1}},this.movieID="sm2-container",this.id=d||"sm2movie",this.debugID="soundmanager-debug",this.debugURLParam=/([#?&])debug=1/i,this.versionNumber="V2.97a.20140901",this.version=null,this.movieURL=null,this.altURL=null,this.swfLoaded=!1,this.enabled=!1,this.oMC=null,this.sounds={},this.soundIDs=[],this.muted=!1,this.didFlashBlock=!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={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},this.html5={usingFlash:null},this.flash={},this.html5Only=!1,this.ignoreFlash=!1;var g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,$,_,aa,ba,ca,da,ea,fa,ga,ha,ia,ja,ka,la,ma,na,oa,pa,qa=this,ra=null,sa=null,ta="soundManager",ua=ta+": ",va="HTML5::",wa=navigator.userAgent,xa=a.location.href.toString(),ya=document,za=[],Aa=!0,Ba=!1,Ca=!1,Da=!1,Ea=!1,Fa=!1,Ga=0,Ha=["log","info","warn","error"],Ia=8,Ja=null,Ka=null,La=!1,Ma=!1,Na=0,Oa=null,Pa=[],Qa=null,Ra=Array.prototype.slice,Sa=!1,Ta=0,Ua=wa.match(/(ipad|iphone|ipod)/i),Va=wa.match(/android/i),Wa=wa.match(/msie/i),Xa=wa.match(/webkit/i),Ya=wa.match(/safari/i)&&!wa.match(/chrome/i),Za=wa.match(/opera/i),$a=wa.match(/(mobile|pre\/|xoom)/i)||Ua||Va,_a=!xa.match(/usehtml5audio/i)&&!xa.match(/sm2\-ignorebadua/i)&&Ya&&!wa.match(/silk/i)&&wa.match(/OS X 10_6_([3-7])/i),ab=a.console!==b&&console.log!==b,bb=ya.hasFocus!==b?ya.hasFocus():null,cb=Ya&&(ya.hasFocus===b||!ya.hasFocus()),db=!cb,eb=/(mp3|mp4|mpa|m4a|m4b)/i,fb=1e3,gb="about:blank",hb="data:audio/wave;base64,/UklGRiYAAABXQVZFZm10IBAAAAABAAEARKwAAIhYAQACABAAZGF0YQIAAAD//w==",ib=ya.location?ya.location.protocol.match(/http/i):null,jb=ib?"":"http://",kb=/^\s*audio\/(?:x-)?(?:mpeg4|aac|flv|mov|mp4||m4v|m4a|m4b|mp4v|3gp|3g2)\s*(?:$|;)/i,lb=["mpeg4","aac","flv","mov","mp4","m4v","f4v","m4a","m4b","mp4v","3gp","3g2"],mb=new RegExp("\\.("+lb.join("|")+")(\\?.*)?$","i");this.mimePattern=/^\s*audio\/(?:x-)?(?:mp(?:eg|3))\s*(?:$|;)/i,this.useAltURL=!ib,R={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.hasHTML5=function(){try{return Audio!==b&&(Za&&opera!==b&&opera.version()<10?new Audio(null):new Audio).canPlayType!==b}catch(a){return!1}}(),this.setup=function(a){var c=!qa.url;return a!==b&&Da&&Qa&&qa.ok()&&(a.flashVersion!==b||a.url!==b||a.html5Test!==b)&&V(O("setupLate")),q(a),a&&(c&&F&&a.url!==b&&qa.beginDelayedInit(),F||a.url===b||"complete"!==ya.readyState||setTimeout(D,1)),qa},this.ok=function(){return Qa?Da&&!Ea:qa.useHTML5Audio&&qa.hasHTML5},this.supported=this.ok,this.getMovie=function(b){return h(b)||ya[b]||a[b]},this.createSound=function(a,c){function d(){return h=T(h),qa.sounds[h.id]=new g(h),qa.soundIDs.push(h.id),qa.sounds[h.id]}var e,f,h,i=null;if(e=ta+".createSound(): ",f=e+O(Da?"notOK":"notReady"),!Da||!qa.ok())return V(f),!1;if(c!==b&&(a={id:a,url:c}),h=p(a),h.url=$(h.url),void 0===h.id&&(h.id=qa.setupOptions.idPrefix+Ta++),h.id.toString().charAt(0).match(/^[0-9]$/)&&qa._wD(e+O("badID",h.id),2),qa._wD(e+h.id+(h.url?" ("+h.url+")":""),1),W(h.id,!0))return qa._wD(e+h.id+" exists",1),qa.sounds[h.id];if(ba(h))i=d(),qa._wD(h.id+": Using HTML5"),i._setup_html5(h);else{if(qa.html5Only)return qa._wD(h.id+": No HTML5 support for this sound, and no Flash. Exiting."),d();if(qa.html5.usingFlash&&h.url&&h.url.match(/data\:/i))return qa._wD(h.id+": data: URIs not supported via Flash. Exiting."),d();l>8&&(null===h.isMovieStar&&(h.isMovieStar=!!(h.serverURL||!!h.type&&h.type.match(kb)||h.url&&h.url.match(mb))),h.isMovieStar&&(qa._wD(e+"using MovieStar handling"),h.loops>1&&n("noNSLoop"))),h=U(h,e),i=d(),8===l?sa._createSound(h.id,h.loops||1,h.usePolicyFile):(sa._createSound(h.id,h.url,h.usePeakData,h.useWaveformData,h.useEQData,h.isMovieStar,!!h.isMovieStar&&h.bufferTime,h.loops||1,h.serverURL,h.duration||null,h.autoPlay,!0,h.autoLoad,h.usePolicyFile),h.serverURL||(i.connected=!0,h.onconnect&&h.onconnect.apply(i))),h.serverURL||!h.autoLoad&&!h.autoPlay||i.load(h)}return!h.serverURL&&h.autoPlay&&i.play(),i},this.destroySound=function(a,b){if(!W(a))return!1;var c,d=qa.sounds[a];for(d._iO={},d.stop(),d.unload(),c=0;c=0;a--)qa.sounds[qa.soundIDs[a]].pause()},this.resume=function(a){return!!W(a)&&qa.sounds[a].resume()},this.resumeAll=function(){var a;for(a=qa.soundIDs.length-1;a>=0;a--)qa.sounds[qa.soundIDs[a]].resume()},this.togglePause=function(a){return!!W(a)&&qa.sounds[a].togglePause()},this.setPan=function(a,b){return!!W(a)&&qa.sounds[a].setPan(b)},this.setVolume=function(a,b){return!!W(a)&&qa.sounds[a].setVolume(b)},this.mute=function(a){var b=0;if(a instanceof String&&(a=null),a)return!!W(a)&&(qa._wD(ta+'.mute(): Muting "'+a+'"'),qa.sounds[a].mute());for(qa._wD(ta+".mute(): Muting all sounds"),b=qa.soundIDs.length-1;b>=0;b--)qa.sounds[qa.soundIDs[b]].mute();return qa.muted=!0,!0},this.muteAll=function(){qa.mute()},this.unmute=function(a){var b;if(a instanceof String&&(a=null),a)return!!W(a)&&(qa._wD(ta+'.unmute(): Unmuting "'+a+'"'),qa.sounds[a].unmute());for(qa._wD(ta+".unmute(): Unmuting all sounds"),b=qa.soundIDs.length-1;b>=0;b--)qa.sounds[qa.soundIDs[b]].unmute();return qa.muted=!1,!0},this.unmuteAll=function(){qa.unmute()},this.toggleMute=function(a){return!!W(a)&&qa.sounds[a].toggleMute()},this.getMemoryUse=function(){var a=0;return sa&&8!==l&&(a=parseInt(sa._getMemoryUse(),10)),a},this.disable=function(c){var d;if(c===b&&(c=!1),Ea)return!1;for(Ea=!0,n("shutdown",1),d=qa.soundIDs.length-1;d>=0;d--)L(qa.sounds[qa.soundIDs[d]]);return o(c),ha.remove(a,"load",u),!0},this.canPlayMIME=function(a){var b;return qa.hasHTML5&&(b=ca({type:a})),!b&&Qa&&(b=a&&qa.ok()?!!((l>8?a.match(kb):null)||a.match(qa.mimePattern)):null),b},this.canPlayURL=function(a){var b;return qa.hasHTML5&&(b=ca({url:a})),!b&&Qa&&(b=a&&qa.ok()?!!a.match(qa.filePattern):null),b},this.canPlayLink=function(a){return!(a.type===b||!a.type||!qa.canPlayMIME(a.type))||qa.canPlayURL(a.href)},this.getSoundById=function(a,b){if(!a)return null;var c=qa.sounds[a];return c||b||qa._wD(ta+'.getSoundById(): Sound "'+a+'" not found.',2),c},this.onready=function(b,c){var d="onready",e=!1;if("function"!=typeof b)throw O("needFunction",d);return Da&&qa._wD(O("queue",d)),c||(c=a),s(d,b,c),t(),e=!0,e},this.ontimeout=function(b,c){var d="ontimeout",e=!1;if("function"!=typeof b)throw O("needFunction",d);return Da&&qa._wD(O("queue",d)),c||(c=a),s(d,b,c),t({type:d}),e=!0,e},this._writeDebug=function(a,c){var d,e,f="soundmanager-debug";return!!qa.debugMode&&(!!(ab&&qa.useConsole&&(c&&"object"==typeof c?console.log(a,c):Ha[c]!==b?console[Ha[c]](a):console.log(a),qa.consoleOnly))||!!(d=h(f))&&(e=ya.createElement("div"),++Ga%2===0&&(e.className="sm2-alt"),c=c===b?0:parseInt(c,10),e.appendChild(ya.createTextNode(a)),c&&(c>=2&&(e.style.fontWeight="bold"),3===c&&(e.style.color="#ff3333")),d.insertBefore(e,d.firstChild),d=null,!0))},xa.indexOf("sm2-debug=alert")!==-1&&(this._writeDebug=function(b){a.alert(b)}),this._wD=this._writeDebug,this._debug=function(){var a,b;for(n("currentObj",1),a=0,b=qa.soundIDs.length;a=0;d--)qa.sounds[qa.soundIDs[d]].destruct();if(sa)try{Wa&&(Ka=sa.innerHTML),Ja=sa.parentNode.removeChild(sa)}catch(a){n("badRemove",2)}if(Ka=Ja=Qa=sa=null,qa.enabled=F=Da=La=Ma=Ba=Ca=Ea=Sa=qa.swfLoaded=!1,qa.soundIDs=[],qa.sounds={},Ta=0,b)za=[];else for(d in za)if(za.hasOwnProperty(d))for(e=0,f=za[d].length;e0&&q.position===q.duration&&(qa._wD(d+"Sound at end, resetting to position:0"),a.position=0),q.paused&&q.position>=0&&(!q._iO.serverURL||q.position>0))qa._wD(d+"Resuming from paused state",1),q.resume();else{if(q._iO=p(a,q._iO),(!q.isHTML5&&null!==q._iO.position&&q._iO.position>0||null!==q._iO.from&&q._iO.from>0||null!==q._iO.to)&&0===q.instanceCount&&0===q.playState&&!q._iO.serverURL){if(i=function(){q._iO=p(a,q._iO),q.play(q._iO)},q.isHTML5&&!q._html5_canplay?(qa._wD(d+"Beginning load for non-zero offset case"),q.load({_oncanplay:i}),t=!1):q.isHTML5||q.loaded||q.readyState&&2===q.readyState||(qa._wD(d+"Preloading for non-zero offset case"),q.load({onload:i}),t=!1),null!==t)return t;q._iO=j()}(!q.instanceCount||q._iO.multiShotEvents||q.isHTML5&&q._iO.multiShot&&!Sa||!q.isHTML5&&l>8&&!q.getAutoPlay())&&q.instanceCount++,q._iO.onposition&&0===q.playState&&h(q),q.playState=1,q.paused=!1,q.position=q._iO.position===b||isNaN(q._iO.position)?0:q._iO.position,q.isHTML5||(q._iO=U(T(q._iO))),q._iO.onplay&&c&&(q._iO.onplay.apply(q),r=!0),q.setVolume(q._iO.volume,!0),q.setPan(q._iO.pan,!0),q.isHTML5?q.instanceCount<2?(g(),f=q._setup_html5(),q.setPosition(q._iO.position),f.play()):(qa._wD(q.id+": Cloning Audio() for instance #"+q.instanceCount+"..."),k=new Audio(q._iO.url),m=function(){ha.remove(k,"ended",m),q._onfinish(q),ea(k),k=null},n=function(){ha.remove(k,"canplay",n);try{k.currentTime=q._iO.position/fb}catch(a){V(q.id+": multiShot play() failed to apply position of "+q._iO.position/fb)}k.play()},ha.add(k,"ended",m),void 0!==q._iO.volume&&(k.volume=Math.max(0,Math.min(1,q._iO.volume/100))),q.muted&&(k.muted=!0),q._iO.position?ha.add(k,"canplay",n):k.play()):(s=sa._start(q.id,q._iO.loops||1,9===l?q.position:q.position/fb,q._iO.multiShot||!1),9!==l||s||(qa._wD(d+"No sound hardware, or 32-sound ceiling hit",2),q._iO.onplayerror&&q._iO.onplayerror.apply(q)))}return q},this.start=this.play,this.stop=function(a){var b,c=q._iO;return 1===q.playState&&(qa._wD(q.id+": stop()"),q._onbufferchange(0),q._resetOnPosition(0),q.paused=!1,q.isHTML5||(q.playState=0),i(),c.to&&q.clearOnPosition(c.to),q.isHTML5?q._a&&(b=q.position,q.setPosition(0),q.position=b,q._a.pause(),q.playState=0,q._onTimer(),f()):(sa._stop(q.id,a),c.serverURL&&q.unload()),q.instanceCount=0,q._iO={},c.onstop&&c.onstop.apply(q)),q},this.setAutoPlay=function(a){qa._wD(q.id+": Autoplay turned "+(a?"on":"off")),q._iO.autoPlay=a,q.isHTML5||(sa._setAutoPlay(q.id,a),a&&(q.instanceCount||1!==q.readyState||(q.instanceCount++,qa._wD(q.id+": Incremented instance count to "+q.instanceCount))))},this.getAutoPlay=function(){return q._iO.autoPlay},this.setPosition=function(a){a===b&&(a=0);var c,d,e=q.isHTML5?Math.max(a,0):Math.min(q.duration||q._iO.duration,Math.max(a,0));if(q.position=e,d=q.position/fb,q._resetOnPosition(q.position),q._iO.position=e,q.isHTML5){if(q._a){if(q._html5_canplay){if(q._a.currentTime!==d){qa._wD(q.id+": setPosition("+d+")");try{q._a.currentTime=d,(0===q.playState||q.paused)&&q._a.pause()}catch(a){qa._wD(q.id+": setPosition("+d+") failed: "+a.message,2)}}}else if(d)return qa._wD(q.id+": setPosition("+d+"): Cannot seek yet, sound not ready",2),q;q.paused&&q._onTimer(!0)}}else c=9===l?q.position:d,q.readyState&&2!==q.readyState&&sa._setPosition(q.id,c,q.paused||!q.playState,q._iO.multiShot);return q},this.pause=function(a){return q.paused||0===q.playState&&1!==q.readyState?q:(qa._wD(q.id+": pause()"),q.paused=!0,q.isHTML5?(q._setup_html5().pause(),f()):(a||a===b)&&sa._pause(q.id,q._iO.multiShot),q._iO.onpause&&q._iO.onpause.apply(q),q)},this.resume=function(){var a=q._iO;return q.paused?(qa._wD(q.id+": resume()"),q.paused=!1,q.playState=1,q.isHTML5?(q._setup_html5().play(),g()):(a.isMovieStar&&!a.serverURL&&q.setPosition(q.position),sa._pause(q.id,a.multiShot)),!r&&a.onplay?(a.onplay.apply(q),r=!0):a.onresume&&a.onresume.apply(q),q):q},this.togglePause=function(){return qa._wD(q.id+": togglePause()"),0===q.playState?(q.play({position:9!==l||q.isHTML5?q.position/fb:q.position}),q):(q.paused?q.resume():q.pause(),q)},this.setPan=function(a,c){return a===b&&(a=0),c===b&&(c=!1),q.isHTML5||sa._setPan(q.id,a),q._iO.pan=a,c||(q.pan=a,q.options.pan=a),q},this.setVolume=function(a,c){return a===b&&(a=100),c===b&&(c=!1),q.isHTML5?q._a&&(qa.muted&&!q.muted&&(q.muted=!0,q._a.muted=!0),q._a.volume=Math.max(0,Math.min(1,a/100))):sa._setVolume(q.id,qa.muted&&!q.muted||q.muted?0:a),q._iO.volume=a,c||(q.volume=a,q.options.volume=a),q},this.mute=function(){return q.muted=!0,q.isHTML5?q._a&&(q._a.muted=!0):sa._setVolume(q.id,0),q},this.unmute=function(){q.muted=!1;var a=q._iO.volume!==b;return q.isHTML5?q._a&&(q._a.muted=!1):sa._setVolume(q.id,a?q._iO.volume:q.options.volume),q},this.toggleMute=function(){return q.muted?q.unmute():q.mute()},this.onPosition=function(a,c,d){return s.push({position:parseInt(a,10),method:c,scope:d!==b?d:q,fired:!1}),q},this.onposition=this.onPosition,this.clearOnPosition=function(a,b){var c;if(a=parseInt(a,10),isNaN(a))return!1;for(c=0;c=c)return!1;for(a=c-1;a>=0;a--)b=s[a],!b.fired&&q.position>=b.position&&(b.fired=!0,t++,b.method.apply(b.scope,[b.position]),c=s.length);return!0},this._resetOnPosition=function(a){var b,c,d=s.length;if(!d)return!1;for(b=d-1;b>=0;b--)c=s[b],c.fired&&a<=c.position&&(c.fired=!1,t--);return!0},j=function(){var a,b,c=q._iO,d=c.from,e=c.to;return b=function(){qa._wD(q.id+': "To" time of '+e+" reached."),q.clearOnPosition(e,b),q.stop()},a=function(){qa._wD(q.id+': Playing "from" '+d),null===e||isNaN(e)||q.onPosition(e,b)},null===d||isNaN(d)||(c.position=d,c.multiShot=!1,a()),c},h=function(){var a,b=q._iO.onposition;if(b)for(a in b)b.hasOwnProperty(a)&&q.onPosition(parseInt(a,10),b[a])},i=function(){var a,b=q._iO.onposition;if(b)for(a in b)b.hasOwnProperty(a)&&q.clearOnPosition(parseInt(a,10))},g=function(){q.isHTML5&&X(q)},f=function(){q.isHTML5&&Y(q)},c=function(a){a||(s=[],t=0),r=!1,q._hasTimer=null,q._a=null,q._html5_canplay=!1,q.bytesLoaded=null,q.bytesTotal=null,q.duration=q._iO&&q._iO.duration?q._iO.duration:null,q.durationEstimate=null,q.buffered=[],q.eqData=[],q.eqData.left=[],q.eqData.right=[],q.failures=0,q.isBuffering=!1,q.instanceOptions={},q.instanceCount=0,q.loaded=!1,q.metadata={},q.readyState=0,q.muted=!1,q.paused=!1,q.peakData={left:0,right:0},q.waveformData={left:[],right:[]},q.playState=0,q.position=null,q.id3={}},c(),this._onTimer=function(a){var b,c,d=!1,e={};if(q._hasTimer||a)return q._a&&(a||(q.playState>0||1===q.readyState)&&!q.paused)&&(b=q._get_html5_duration(),b!==k.duration&&(k.duration=b,q.duration=b,d=!0),q.durationEstimate=q.duration,c=q._a.currentTime*fb||0,c!==k.time&&(k.time=c,d=!0),(d||a)&&q._whileplaying(c,e,e,e,e)),d},this._get_html5_duration=function(){var a=q._iO,b=q._a&&q._a.duration?q._a.duration*fb:a&&a.duration?a.duration:null,c=b&&!isNaN(b)&&b!==1/0?b:null;return c},this._apply_loop=function(a,b){!a.loop&&b>1&&qa._wD("Note: Native HTML5 looping is infinite.",1),a.loop=b>1?"loop":""},this._setup_html5=function(a){var b,e=p(q._iO,a),f=Sa?ra:q._a,g=decodeURI(e.url);if(Sa?g===decodeURI(ia)&&(b=!0):g===decodeURI(u)&&(b=!0),f){if(f._s)if(Sa)f._s&&f._s.playState&&!b&&f._s.stop();else if(!Sa&&g===decodeURI(u))return q._apply_loop(f,e.loops),f;b||(u&&c(!1),f.src=e.url,q.url=e.url,u=e.url,ia=e.url,f._called_load=!1)}else e.autoLoad||e.autoPlay?(q._a=new Audio(e.url),q._a.load()):q._a=Za&&opera.version()<10?new Audio(null):new Audio,f=q._a,f._called_load=!1,Sa&&(ra=f);return q.isHTML5=!0,q._a=f,f._s=q,d(),q._apply_loop(f,e.loops),e.autoLoad||e.autoPlay?q.load():(f.autobuffer=!1,f.preload="auto"),f},d=function(){function a(a,b,c){return q._a?q._a.addEventListener(a,b,c||!1):null}if(q._a._added_events)return!1;var b;q._a._added_events=!0;for(b in ma)ma.hasOwnProperty(b)&&a(b,ma[b]);return!0},e=function(){function a(a,b,c){return q._a?q._a.removeEventListener(a,b,c||!1):null}var b;qa._wD(q.id+": Removing event listeners"),q._a._added_events=!1;for(b in ma)ma.hasOwnProperty(b)&&a(b,ma[b])},this._onload=function(a){var b,c=!!a||!q.isHTML5&&8===l&&q.duration;return b=q.id+": ",qa._wD(b+(c?"onload()":"Failed to load / invalid sound?"+(q.duration?" -":" Zero-length duration reported.")+" ("+q.url+")"),c?1:2),c||q.isHTML5||(qa.sandbox.noRemote===!0&&qa._wD(b+O("noNet"),1),qa.sandbox.noLocal===!0&&qa._wD(b+O("noLocal"),1)),q.loaded=c,q.readyState=c?3:2,q._onbufferchange(0),q._iO.onload&&pa(q,function(){q._iO.onload.apply(q,[c])}),!0},this._onbufferchange=function(a){return 0!==q.playState&&(!(a&&q.isBuffering||!a&&!q.isBuffering)&&(q.isBuffering=1===a,q._iO.onbufferchange&&(qa._wD(q.id+": Buffer state change: "+a),q._iO.onbufferchange.apply(q,[a])),!0))},this._onsuspend=function(){return q._iO.onsuspend&&(qa._wD(q.id+": Playback suspended"),q._iO.onsuspend.apply(q)),!0},this._onfailure=function(a,b,c){q.failures++,qa._wD(q.id+": Failure ("+q.failures+"): "+a),q._iO.onfailure&&1===q.failures?q._iO.onfailure(a,b,c):qa._wD(q.id+": Ignoring failure")},this._onwarning=function(a,b,c){q._iO.onwarning&&q._iO.onwarning(a,b,c)},this._onfinish=function(){var a=q._iO.onfinish;q._onbufferchange(0),q._resetOnPosition(0),q.instanceCount&&(q.instanceCount--,q.instanceCount||(i(),q.playState=0,q.paused=!1,q.instanceCount=0,q.instanceOptions={},q._iO={},f(),q.isHTML5&&(q.position=0)),q.instanceCount&&!q._iO.multiShotEvents||a&&(qa._wD(q.id+": onfinish()"),pa(q,function(){a.apply(q)})))},this._whileloading=function(a,b,c,d){var e=q._iO;q.bytesLoaded=a,q.bytesTotal=b,q.duration=Math.floor(c),q.bufferLength=d,q.isHTML5||e.isMovieStar?q.durationEstimate=q.duration:e.duration?q.durationEstimate=q.duration>e.duration?q.duration:e.duration:q.durationEstimate=parseInt(q.bytesTotal/q.bytesLoaded*q.duration,10),q.isHTML5||(q.buffered=[{start:0,end:q.duration}]),(3!==q.readyState||q.isHTML5)&&e.whileloading&&e.whileloading.apply(q)},this._whileplaying=function(a,c,d,e,f){var g,h=q._iO;return!isNaN(a)&&null!==a&&(q.position=Math.max(0,a),q._processOnPosition(),!q.isHTML5&&l>8&&(h.usePeakData&&c!==b&&c&&(q.peakData={left:c.leftPeak,right:c.rightPeak}),h.useWaveformData&&d!==b&&d&&(q.waveformData={left:d.split(","),right:e.split(",")}),h.useEQData&&f!==b&&f&&f.leftEQ&&(g=f.leftEQ.split(","),q.eqData=g,q.eqData.left=g,f.rightEQ!==b&&f.rightEQ&&(q.eqData.right=f.rightEQ.split(",")))),1===q.playState&&(q.isHTML5||8!==l||q.position||!q.isBuffering||q._onbufferchange(0),h.whileplaying&&h.whileplaying.apply(q)),!0)},this._oncaptiondata=function(a){qa._wD(q.id+": Caption data received."),q.captiondata=a,q._iO.oncaptiondata&&q._iO.oncaptiondata.apply(q,[a])},this._onmetadata=function(a,b){qa._wD(q.id+": Metadata received.");var c,d,e={};for(c=0,d=a.length;c0&&(qa._wD(q.id+": Data error: "+a),q._iO.ondataerror&&q._iO.ondataerror.apply(q))},this._debug()},G=function(){return ya.body||ya.getElementsByTagName("div")[0]},h=function(a){return ya.getElementById(a)},p=function(a,c){var d,e,f=a||{};d=c===b?qa.defaultOptions:c;for(e in d)d.hasOwnProperty(e)&&f[e]===b&&("object"!=typeof d[e]||null===d[e]?f[e]=d[e]:f[e]=p(f[e],d[e]));return f},pa=function(b,c){b.isHTML5||8!==l?c():a.setTimeout(c,0)},r={onready:1,ontimeout:1,defaultOptions:1,flash9Options:1,movieStarOptions:1},q=function(a,c){var d,e=!0,f=c!==b,g=qa.setupOptions,h=r;if(a===b){e=[];for(d in g)g.hasOwnProperty(d)&&e.push(d);for(d in h)h.hasOwnProperty(d)&&("object"==typeof qa[d]?e.push(d+": {...}"):qa[d]instanceof Function?e.push(d+": function() {...}"):e.push(d));return qa._wD(O("setup",e.join(", "))),!1}for(d in a)if(a.hasOwnProperty(d))if("object"!=typeof a[d]||null===a[d]||a[d]instanceof Array||a[d]instanceof RegExp)f&&h[c]!==b?qa[c][d]=a[d]:g[d]!==b?(qa.setupOptions[d]=a[d],qa[d]=a[d]):h[d]===b?(V(O(qa[d]===b?"setupUndef":"setupError",d),2),e=!1):qa[d]instanceof Function?qa[d].apply(qa,a[d]instanceof Array?a[d]:[a[d]]):qa[d]=a[d];else{if(h[d]!==b)return q(a[d],d);V(O(qa[d]===b?"setupUndef":"setupError",d),2),e=!1}return e},ha=function(){function b(a){var b=Ra.call(a),c=b.length;return f?(b[1]="on"+b[1],c>3&&b.pop()):3===c&&b.push(!1),b}function c(a,b){var c=a.shift(),d=[g[b]];f?c[d](a[0],a[1]):c[d].apply(c,a)}function d(){c(b(arguments),"add")}function e(){c(b(arguments),"remove")}var f=a.attachEvent,g={add:f?"attachEvent":"addEventListener",remove:f?"detachEvent":"removeEventListener"};return{add:d,remove:e}}(),ma={abort:f(function(){qa._wD(this._s.id+": abort")}),canplay:f(function(){var a,c=this._s;if(c._html5_canplay)return!0;if(c._html5_canplay=!0,qa._wD(c.id+": canplay"),c._onbufferchange(0),a=c._iO.position===b||isNaN(c._iO.position)?null:c._iO.position/fb,this.currentTime!==a){qa._wD(c.id+": canplay: Setting position to "+a);try{this.currentTime=a}catch(b){qa._wD(c.id+": canplay: Setting position of "+a+" failed: "+b.message,2)}}c._iO._oncanplay&&c._iO._oncanplay()}),canplaythrough:f(function(){var a=this._s;a.loaded||(a._onbufferchange(0),a._whileloading(a.bytesLoaded,a.bytesTotal,a._get_html5_duration()),a._onload(!0))}),durationchange:f(function(){var a,b=this._s;a=b._get_html5_duration(),isNaN(a)||a===b.duration||(qa._wD(this._s.id+": durationchange ("+a+")"+(b.duration?", previously "+b.duration:"")),b.durationEstimate=b.duration=a)}),ended:f(function(){var a=this._s;qa._wD(a.id+": ended"),a._onfinish()}),error:f(function(){qa._wD(this._s.id+": HTML5 error, code "+this.error.code),this._s._onload(!1)}),loadeddata:f(function(){var a=this._s;qa._wD(a.id+": loadeddata"),a._loaded||Ya||(a.duration=a._get_html5_duration())}),loadedmetadata:f(function(){qa._wD(this._s.id+": loadedmetadata")}),loadstart:f(function(){qa._wD(this._s.id+": loadstart"),this._s._onbufferchange(1)}),play:f(function(){this._s._onbufferchange(0)}),playing:f(function(){qa._wD(this._s.id+": playing "+String.fromCharCode(9835)),this._s._onbufferchange(0)}),progress:f(function(a){var b,c,d,e=this._s,f=0,g="progress"===a.type,h=a.target.buffered,i=a.loaded||0,j=a.total||1;if(e.buffered=[],h&&h.length){for(b=0,c=h.length;b1){for(d=[],c=h.length,b=0;b=0;f--)h["audio/"+e[c].related[f]]=h[c], -qa.html5[e[c].related[f]]=h[c],qa.flash[e[c].related[f]]=h[c];return h.canPlayType=g?a:null,qa.html5=p(qa.html5,h),qa.html5.usingFlash=aa(),Qa=qa.html5.usingFlash,!0},A={notReady:"Unavailable - wait until onready() has fired.",notOK:"Audio support is not available.",domError:ta+"exception caught while appending SWF to DOM.",spcWmode:"Removing wmode, preventing known SWF loading issue(s)",swf404:ua+"Verify that %s is a valid path.",tryDebug:"Try "+ta+".debugFlash = true for more security details (output goes to SWF.)",checkSWF:"See SWF output for more debug info.",localFail:ua+"Non-HTTP page ("+ya.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:ua+"Special case: Waiting for SWF to load with window focus...",waitForever:ua+"Waiting indefinitely for Flash (will recover if unblocked)...",waitSWF:ua+"Waiting for 100% SWF load...",needFunction:ua+"Function object expected for %s",badID:'Sound ID "%s" should be a string, starting with a non-numeric character',currentObj:ua+"_debug(): Current sound objects",waitOnload:ua+"Waiting for window.onload()",docLoaded:ua+"Document already loaded",onload:ua+"initComplete(): calling soundManager.onload()",onloadOK:ta+".onload() complete",didInit:ua+"init(): Already called?",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",badRemove:ua+"Failed to remove Flash node.",shutdown:ta+".disable(): Shutting down",queue:ua+"Queueing %s handler",smError:"SMSound.load(): Exception: JS-Flash communication failed, or JS error.",fbTimeout:"No flash response, applying ."+R.swfTimedout+" CSS...",fbLoaded:"Flash loaded",fbHandler:ua+"flashBlockHandler()",manURL:"SMSound.load(): Using manually-assigned URL",onURL:ta+".load(): current URL already assigned.",badFV:ta+'.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",needFlash:ua+"Fatal error: Flash is needed to play some required formats, but is not available.",gotFocus:ua+"Got window focus.",policy:"Enabling usePolicyFile for data access",setup:ta+".setup(): allowed parameters: %s",setupError:ta+'.setup(): "%s" cannot be assigned with this method.',setupUndef:ta+'.setup(): Could not find option "%s"',setupLate:ta+".setup(): url, flashVersion and html5Test property changes will not take effect until reboot().",noURL:ua+"Flash URL required. Call soundManager.setup({url:...}) to get started.",sm2Loaded:"SoundManager 2: Ready. "+String.fromCharCode(10003),reset:ta+".reset(): Removing event callbacks",mobileUA:"Mobile UA detected, preferring HTML5 by default.",globalHTML5:"Using singleton HTML5 Audio() pattern for this device."},O=function(){var a,b,c,d,e;if(a=Ra.call(arguments),d=a.shift(),e=A&&A[d]?A[d]:"",e&&a&&a.length)for(b=0,c=a.length;b1&&a.stream&&(n("as2loop"),a.stream=!1),a},U=function(a,b){return a&&!a.usePolicyFile&&(a.onid3||a.usePeakData||a.useWaveformData||a.useEQData)&&(qa._wD((b||"")+O("policy")),a.usePolicyFile=!0),a},V=function(a){ab&&console.warn!==b?console.warn(a):qa._wD(a)},i=function(){return!1},L=function(a){var b;for(b in a)a.hasOwnProperty(b)&&"function"==typeof a[b]&&(a[b]=i);b=null},M=function(a){a===b&&(a=!1),(Ea||a)&&qa.disable(a)},N=function(a){var b,c=null;if(a)if(a.match(/\.swf(\?.*)?$/i)){if(c=a.substr(a.toLowerCase().lastIndexOf(".swf?")+4))return a}else a.lastIndexOf("/")!==a.length-1&&(a+="/");return b=(a&&a.lastIndexOf("/")!==-1?a.substr(0,a.lastIndexOf("/")+1):"./")+qa.movieURL,qa.noSWFCache&&(b+="?ts="+(new Date).getTime()),b},y=function(){l=parseInt(qa.flashVersion,10),8!==l&&9!==l&&(qa._wD(O("badFV",l,Ia)),qa.flashVersion=l=Ia);var a=qa.debugMode||qa.debugFlash?"_debug.swf":".swf";qa.useHTML5Audio&&!qa.html5Only&&qa.audioFormats.mp4.required&&l<9&&(qa._wD(O("needfl9")),qa.flashVersion=l=9),qa.version=qa.versionNumber+(qa.html5Only?" (HTML5-only mode)":9===l?" (AS3/Flash 9)":" (AS2/Flash 8)"),l>8?(qa.defaultOptions=p(qa.defaultOptions,qa.flash9Options),qa.features.buffering=!0,qa.defaultOptions=p(qa.defaultOptions,qa.movieStarOptions),qa.filePatterns.flash9=new RegExp("\\.(mp3|"+lb.join("|")+")(\\?.*)?$","i"),qa.features.movieStar=!0):qa.features.movieStar=!1,qa.filePattern=qa.filePatterns[8!==l?"flash9":"flash8"],qa.movieURL=(8===l?"soundmanager2.swf":"soundmanager2_flash9.swf").replace(".swf",a),qa.features.peakData=qa.features.waveformData=qa.features.eqData=l>8},J=function(a,b){return!!sa&&void sa._setPolling(a,b)},K=function(){if(qa.debugURLParam.test(xa)&&(qa.debugMode=!0),h(qa.debugID))return!1;var a,b,c,d,e;if(qa.debugMode&&!h(qa.debugID)&&(!ab||!qa.useConsole||!qa.consoleOnly)){a=ya.createElement("div"),a.id=qa.debugID+"-toggle",d={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},a.appendChild(ya.createTextNode("-")),a.onclick=S,a.title="Toggle SM2 debug console",wa.match(/msie 6/i)&&(a.style.position="absolute",a.style.cursor="hand");for(e in d)d.hasOwnProperty(e)&&(a.style[e]=d[e]);if(b=ya.createElement("div"),b.id=qa.debugID,b.style.display=qa.debugMode?"block":"none",qa.debugMode&&!h(a.id)){try{c=G(),c.appendChild(a)}catch(a){throw new Error(O("domError")+" \n"+a.toString())}c.appendChild(b)}}c=null},W=this.getSoundById,n=function(a,b){return a?qa._wD(O(a),b):""},S=function(){var a=h(qa.debugID),b=h(qa.debugID+"-toggle");return!!a&&(Aa?(b.innerHTML="+",a.style.display="none"):(b.innerHTML="-",a.style.display="block"),void(Aa=!Aa))},m=function(c,d,e){if(a.sm2Debugger!==b)try{sm2Debugger.handleEvent(c,d,e)}catch(a){return!1}return!0},Q=function(){var a=[];return qa.debugMode&&a.push(R.sm2Debug),qa.debugFlash&&a.push(R.flashDebug),qa.useHighPerformance&&a.push(R.highPerf),a.join(" ")},P=function(){var a=O("fbHandler"),b=qa.getMoviePercent(),c=R,d={type:"FLASHBLOCK"};return!qa.html5Only&&void(qa.ok()?(qa.didFlashBlock&&qa._wD(a+": Unblocked"),qa.oMC&&(qa.oMC.className=[Q(),c.swfDefault,c.swfLoaded+(qa.didFlashBlock?" "+c.swfUnblocked:"")].join(" "))):(Qa&&(qa.oMC.className=Q()+" "+c.swfDefault+" "+(null===b?c.swfTimedout:c.swfError),qa._wD(a+": "+O("fbTimeout")+(b?" ("+O("fbLoaded")+")":""))),qa.didFlashBlock=!0,t({type:"ontimeout",ignoreInit:!0,error:d}),I(d)))},s=function(a,c,d){za[a]===b&&(za[a]=[]),za[a].push({method:c,scope:d||null,fired:!1})},t=function(a){if(a||(a={type:qa.ok()?"onready":"ontimeout"}),!Da&&a&&!a.ignoreInit)return!1;if("ontimeout"===a.type&&(qa.ok()||Ea&&!a.ignoreInit))return!1;var b,c,d={success:a&&a.ignoreInit?qa.ok():!Ea},e=a&&a.type?za[a.type]||[]:[],f=[],g=[d],h=Qa&&!qa.ok();for(a.error&&(g[0].error=a.error),b=0,c=e.length;b=0;a--)qa.sounds[qa.soundIDs[a]].isHTML5&&qa.sounds[qa.soundIDs[a]]._hasTimer&&qa.sounds[qa.soundIDs[a]]._onTimer()},I=function(c){c=c!==b?c:{},"function"==typeof qa.onerror&&qa.onerror.apply(a,[{type:c.type!==b?c.type:null}]),c.fatal!==b&&c.fatal&&qa.disable()},la=function(){if(!_a||!ka())return!1;var a,b,c=qa.audioFormats;for(b in c)if(c.hasOwnProperty(b)&&("mp3"===b||"mp4"===b)&&(qa._wD(ta+": Using flash fallback for "+b+" format"),qa.html5[b]=!1,c[b]&&c[b].related))for(a=c[b].related.length-1;a>=0;a--)qa.html5[c[b].related[a]]=!1},this._setSandboxType=function(a){var c=qa.sandbox;c.type=a,c.description=c.types[c.types[a]!==b?a:"unknown"],"localWithFile"===c.type?(c.noRemote=!0,c.noLocal=!1,n("secNote",2)):"localWithNetwork"===c.type?(c.noRemote=!1,c.noLocal=!0):"localTrusted"===c.type&&(c.noRemote=!1,c.noLocal=!1)},this._externalInterfaceOK=function(a){if(qa.swfLoaded)return!1;var b;return m("swf",!0),m("flashtojs",!0),qa.swfLoaded=!0,cb=!1,_a&&la(),a&&a.replace(/\+dev/i,"")===qa.versionNumber.replace(/\+dev/i,"")?void setTimeout(k,Wa?100:1):(b=ta+': Fatal: JavaScript file build "'+qa.versionNumber+'" does not match Flash SWF build "'+a+'" at '+qa.url+". Ensure both are up-to-date.",setTimeout(function(){throw new Error(b)},0),!1)},H=function(a,c){function d(){var a,b=[],c=[],d=" + ";a="SoundManager "+qa.version+(!qa.html5Only&&qa.useHTML5Audio?qa.hasHTML5?" + HTML5 audio":", no HTML5 audio support":""),qa.html5Only?qa.html5PollingInterval&&b.push("html5PollingInterval ("+qa.html5PollingInterval+"ms)"):(qa.preferFlash&&b.push("preferFlash"),qa.useHighPerformance&&b.push("useHighPerformance"),qa.flashPollingInterval&&b.push("flashPollingInterval ("+qa.flashPollingInterval+"ms)"),qa.html5PollingInterval&&b.push("html5PollingInterval ("+qa.html5PollingInterval+"ms)"),qa.wmode&&b.push("wmode ("+qa.wmode+")"),qa.debugFlash&&b.push("debugFlash"),qa.useFlashBlock&&b.push("flashBlock")),b.length&&(c=c.concat([b.join(d)])),qa._wD(a+(c.length?d+c.join(", "):""),1),na()}function e(a,b){return''}if(Ba&&Ca)return!1;if(qa.html5Only)return y(),d(),qa.oMC=h(qa.movieID),k(),Ba=!0,Ca=!0,!1;var f,g,i,j,l,m,n,o,p=c||qa.url,q=qa.altURL||p,r="JS/Flash audio component (SoundManager 2)",s=G(),t=Q(),u=null,v=ya.getElementsByTagName("html")[0];if(u=v&&v.dir&&v.dir.match(/rtl/i),a=a===b?qa.id:a,y(),qa.url=N(ib?p:q),c=qa.url,qa.wmode=!qa.wmode&&qa.useHighPerformance?"transparent":qa.wmode,null!==qa.wmode&&(wa.match(/msie 8/i)||!Wa&&!qa.useHighPerformance)&&navigator.platform.match(/win32|win64/i)&&(Pa.push(A.spcWmode),qa.wmode=null),f={name:a,id:a,src:c,quality:"high",allowScriptAccess:qa.allowScriptAccess,bgcolor:qa.bgColor,pluginspage:jb+"www.macromedia.com/go/getflashplayer",title:r,type:"application/x-shockwave-flash",wmode:qa.wmode,hasPriority:"true"},qa.debugFlash&&(f.FlashVars="debug=1"),qa.wmode||delete f.wmode,Wa)g=ya.createElement("div"),j=['',e("movie",c),e("AllowScriptAccess",qa.allowScriptAccess),e("quality",f.quality),qa.wmode?e("wmode",qa.wmode):"",e("bgcolor",qa.bgColor),e("hasPriority","true"),qa.debugFlash?e("FlashVars",f.FlashVars):"",""].join("");else{g=ya.createElement("embed");for(i in f)f.hasOwnProperty(i)&&g.setAttribute(i,f[i])}if(K(),t=Q(),s=G())if(qa.oMC=h(qa.movieID)||ya.createElement("div"),qa.oMC.id)o=qa.oMC.className,qa.oMC.className=(o?o+" ":R.swfDefault)+(t?" "+t:""),qa.oMC.appendChild(g),Wa&&(l=qa.oMC.appendChild(ya.createElement("div")),l.className=R.swfBox,l.innerHTML=j),Ca=!0;else{if(qa.oMC.id=qa.movieID,qa.oMC.className=R.swfDefault+" "+t,m=null,l=null,qa.useFlashBlock||(qa.useHighPerformance?m={position:"fixed",width:"8px",height:"8px",bottom:"0px",left:"0px",overflow:"hidden"}:(m={position:"absolute",width:"6px",height:"6px",top:"-9999px",left:"-9999px"},u&&(m.left=Math.abs(parseInt(m.left,10))+"px"))),Xa&&(qa.oMC.style.zIndex=1e4),!qa.debugFlash)for(n in m)m.hasOwnProperty(n)&&(qa.oMC.style[n]=m[n]);try{Wa||qa.oMC.appendChild(g),s.appendChild(qa.oMC),Wa&&(l=qa.oMC.appendChild(ya.createElement("div")),l.className=R.swfBox,l.innerHTML=j),Ca=!0}catch(a){throw new Error(O("domError")+" \n"+a.toString())}}return Ba=!0,d(),!0},B=function(){return qa.html5Only?(H(),!1):!sa&&(qa.url?(sa=qa.getMovie(qa.id),sa||(Ja?(Wa?qa.oMC.innerHTML=Ka:qa.oMC.appendChild(Ja),Ja=null,Ba=!0):H(qa.id,qa.url),sa=qa.getMovie(qa.id)),"function"==typeof qa.oninitmovie&&setTimeout(qa.oninitmovie,1),oa(),!0):(n("noURL"),!1))},v=function(){setTimeout(w,1e3)},x=function(){a.setTimeout(function(){V(ua+"useFlashBlock is false, 100% HTML5 mode is possible. Rebooting with preferFlash: false..."),qa.setup({preferFlash:!1}).reboot(),qa.didFlashBlock=!0,qa.beginDelayedInit()},1)},w=function(){var b,c=!1;return!!qa.url&&(!La&&(La=!0,ha.remove(a,"load",v),ja&&cb&&!bb?(n("waitFocus"),!1):(Da||(b=qa.getMoviePercent(),b>0&&b<100&&(c=!0)),void setTimeout(function(){return b=qa.getMoviePercent(),c?(La=!1,qa._wD(O("waitSWF")),a.setTimeout(v,1),!1):(Da||(qa._wD(ta+": No Flash response within expected time. Likely causes: "+(0===b?"SWF load failed, ":"")+"Flash blocked or JS-Flash security error."+(qa.debugFlash?" "+O("checkSWF"):""),2),!ib&&b&&(n("localFail",2),qa.debugFlash||n("tryDebug",2)),0===b&&qa._wD(O("swf404",qa.url),1),m("flashtojs",!1," (Check flash security or flash blockers)")),void(!Da&&db&&(null===b?qa.useFlashBlock||0===qa.flashLoadTimeout?(qa.useFlashBlock&&P(),n("waitForever")):!qa.useFlashBlock&&_?x():(n("waitForever"),t({type:"ontimeout",ignoreInit:!0,error:{type:"INIT_FLASHBLOCK"}})):0===qa.flashLoadTimeout?n("waitForever"):!qa.useFlashBlock&&_?x():M(!0))))},qa.flashLoadTimeout))))},z=function(){function b(){ha.remove(a,"focus",z)}return bb||!cb?(b(),!0):(db=!0,bb=!0,n("gotFocus"),La=!1,v(),b(),!0)},oa=function(){Pa.length&&(qa._wD("SoundManager 2: "+Pa.join(" "),1),Pa=[])},na=function(){oa();var a,b=[];if(qa.useHTML5Audio&&qa.hasHTML5){for(a in qa.audioFormats)qa.audioFormats.hasOwnProperty(a)&&b.push(a+" = "+qa.html5[a]+(!qa.html5[a]&&Qa&&qa.flash[a]?" (using flash)":qa.preferFlash&&qa.flash[a]&&Qa?" (preferring flash)":qa.html5[a]?"":" ("+(qa.audioFormats[a].required?"required, ":"")+"and no flash support)"));qa._wD("SoundManager 2 HTML5 support: "+b.join(", "),1)}},o=function(b){if(Da)return!1;if(qa.html5Only)return n("sm2Loaded",1),Da=!0,u(),m("onload",!0),!0;var c,d=qa.useFlashBlock&&qa.flashLoadTimeout&&!qa.getMoviePercent(),e=!0;return d||(Da=!0),c={type:!ja&&Qa?"NO_FLASH":"INIT_TIMEOUT"},qa._wD("SoundManager 2 "+(Ea?"failed to load":"loaded")+" ("+(Ea?"Flash security/load error":"OK")+") "+String.fromCharCode(Ea?10006:10003),Ea?2:1),Ea||b?(qa.useFlashBlock&&qa.oMC&&(qa.oMC.className=Q()+" "+(null===qa.getMoviePercent()?R.swfTimedout:R.swfError)),t({type:"ontimeout",error:c,ignoreInit:!0}),m("onload",!1),I(c),e=!1):m("onload",!0),Ea||(qa.waitForWindowLoad&&!Fa?(n("waitOnload"),ha.add(a,"load",u)):(qa.waitForWindowLoad&&Fa&&n("docLoaded"),u())),e},j=function(){var a,c=qa.setupOptions;for(a in c)c.hasOwnProperty(a)&&(qa[a]===b?qa[a]=c[a]:qa[a]!==c[a]&&(qa.setupOptions[a]=qa[a]))},k=function(){function b(){ha.remove(a,"load",qa.beginDelayedInit)}if(Da)return n("didInit"),!1;if(qa.html5Only)return Da||(b(),qa.enabled=!0,o()),!0;B();try{sa._externalInterfaceTest(!1),J(!0,qa.flashPollingInterval||(qa.useHighPerformance?10:50)),qa.debugMode||sa._disableDebug(),qa.enabled=!0,m("jstoflash",!0),qa.html5Only||ha.add(a,"unload",i)}catch(a){return qa._wD("js/flash exception: "+a.toString()),m("jstoflash",!1),I({type:"JS_TO_FLASH_EXCEPTION",fatal:!0}),M(!0),o(),!1}return o(),b(),!0},D=function(){return!F&&(F=!0,j(),K(),function(){var a="sm2-usehtml5audio=",b="sm2-preferflash=",c=null,d=null,e=xa.toLowerCase();e.indexOf(a)!==-1&&(c="1"===e.charAt(e.indexOf(a)+a.length),ab&&console.log((c?"Enabling ":"Disabling ")+"useHTML5Audio via URL parameter"),qa.setup({useHTML5Audio:c})),e.indexOf(b)!==-1&&(d="1"===e.charAt(e.indexOf(b)+b.length),ab&&console.log((d?"Enabling ":"Disabling ")+"preferFlash via URL parameter"),qa.setup({preferFlash:d}))}(),!ja&&qa.hasHTML5&&(qa._wD("SoundManager 2: No Flash detected"+(qa.useHTML5Audio?". Trying HTML5-only mode.":", enabling HTML5."),1),qa.setup({useHTML5Audio:!0,preferFlash:!1})),ga(),!ja&&Qa&&(Pa.push(A.needFlash),qa.setup({flashLoadTimeout:1})),ya.removeEventListener&&ya.removeEventListener("DOMContentLoaded",D,!1),B(),!0)},fa=function(){return"complete"===ya.readyState&&(D(),ya.detachEvent("onreadystatechange",fa)),!0},E=function(){Fa=!0,D(),ha.remove(a,"load",E)},C=function(){$a&&(qa.setupOptions.useHTML5Audio&&!qa.setupOptions.preferFlash||Pa.push(A.mobileUA),qa.setupOptions.useHTML5Audio=!0,qa.setupOptions.preferFlash=!1,(Ua||Va&&!wa.match(/android\s2\.3/i))&&(Pa.push(A.globalHTML5),Ua&&(qa.ignoreFlash=!0),Sa=!0))},C(),ka(),ha.add(a,"focus",z),ha.add(a,"load",v),ha.add(a,"load",E),ya.addEventListener?ya.addEventListener("DOMContentLoaded",D,!1):ya.attachEvent?ya.attachEvent("onreadystatechange",fa):(m("onload",!1),I({type:"NO_DOM2_EVENTS",fatal:!0}))}if(!a||!a.document)throw new Error("SoundManager requires a browser with window and document objects.");var d=null;void 0!==a.SM2_DEFER&&SM2_DEFER||(d=new c),"object"==typeof module&&module&&"object"==typeof module.exports?(a.soundManager=d,module.exports.SoundManager=c,module.exports.soundManager=d):"function"==typeof define&&define.amd?define("SoundManager",[],function(){return{SoundManager:c,soundManager:d}}):(a.SoundManager=c,a.soundManager=d)}(window);var ngSoundManager=angular.module("angularSoundManager",[]).config(["$logProvider",function(a){a.debugEnabled(!1)}]);ngSoundManager.filter("humanTime",function(){return function(a){function b(a){return a<10?"0"+a.toString():a.toString()}var c=a/1e3/60<<0,d=Math.round(a/1e3%60);return b(c)+":"+b(d)}}),ngSoundManager.factory("angularPlayer",["$rootScope","$log",function(a,b){var c=null,d=!1,e=!1,f=[],g=!0,h=!1,i=90,j=0,k=[];return{init:function(){"undefined"==typeof soundManager&&alert("Please include SoundManager2 Library!"),soundManager.setup({preferFlash:!1,debugMode:!1,useHTML5Audio:!0,onready:function(){},ontimeout:function(){alert("SM2 failed to start. Flash missing, blocked or security error?"),alert("The status is "+status.success+", the error type is "+status.error.type)},defaultOptions:{autoLoad:!1,autoPlay:!1,from:null,loops:1,multiShot:!1,multiShotEvents:!1,onid3:null,onload:null,onstop:null,onfailure:"nextTrack",onpause:null,onplay:null,onresume:null,position:null,pan:0,stream:!0,to:null,type:"audio/mp3",usePolicyFile:!1,volume:i,whileloading:function(){var b=this.bytesLoaded/this.bytesTotal*100;a.$broadcast("track:loaded",b)},whileplaying:function(){c=this.id,j=this.position/this.duration*100,a.$broadcast("track:progress",j),a.$broadcast("currentTrack:position",this.position),a.$broadcast("currentTrack:duration",this.duration)},onfinish:function(){if(soundManager._writeDebug(this.id+" finished playing"),g===!0){var b=angular.element(document.querySelector("[ng-app]")),d=b.injector(),e=d.get("angularPlayer");e.nextTrack(),a.$broadcast("track:id",c)}}}}),soundManager.onready(function(){b.debug("song manager ready!");var c=soundManager.ok();b.debug("is supported: "+c),a.$broadcast("angularPlayer:ready",!0)})},isInArray:function(a,b){for(var c=0;c-1){if("undefined"==typeof a.url)return b.debug("invalid soundcloud track url"),!1}else if(soundManager.canPlayURL(a.url)!==!0)return b.debug("invalid song url"),!1},addTrack:function(a){if(!this.isTrackValid)return null;var b=this.isInArray(this.getPlaylist(),a.id);return b===!1&&(soundManager.createSound({id:a.id,url:a.url}),this.addToPlaylist(a)),a.id},removeSong:function(b,d){b===c&&this.stop(),soundManager.destroySound(b),k.splice(d,1),a.$broadcast("player:playlist",k)},initPlayTrack:function(b,c){c!==!0&&(this.stop(),this.setCurrentTrack(b)),soundManager.play(b),a.$broadcast("track:id",b),h=!0,a.$broadcast("music:isPlaying",h)},play:function(){var a=null;if(null===this.getCurrentTrack()){if(0===soundManager.soundIDs.length)return void b.debug("playlist is empty!");a=soundManager.soundIDs[0],this.initPlayTrack(a)}else a=this.getCurrentTrack(),this.initPlayTrack(a,!0)},pause:function(){soundManager.pause(this.getCurrentTrack()),h=!1,a.$broadcast("music:isPlaying",h)},stop:function(){this.pause(),this.resetProgress(),a.$broadcast("track:progress",j),a.$broadcast("currentTrack:position",0),a.$broadcast("currentTrack:duration",0),soundManager.stopAll(),soundManager.unload(this.getCurrentTrack())},playTrack:function(a){this.initPlayTrack(a)},nextTrack:function(){if(null===this.getCurrentTrack())return b.debug("Please click on Play before this action"),null;var c=angular.copy(soundManager.soundIDs);e===!0&&(c=f);var g=this.getIndexByValue(c,this.getCurrentTrack()),i=+g+1,j=c[i];"undefined"!=typeof j?this.playTrack(j):(e===!0&&h===!0&&(f=angular.copy(soundManager.soundIDs),f=f.sort(function(){return.5-Math.random()}),a.$broadcast("music:tempTrack",f)),d===!0?this.playTrack(c[0]):(h=!1,a.$broadcast("music:isPlaying",h)))},prevTrack:function(){if(null===this.getCurrentTrack())return b.debug("Please click on Play before this action"),null;var a=angular.copy(soundManager.soundIDs);e===!0&&(a=f);var c=this.getIndexByValue(a,this.getCurrentTrack()),d=+c-1,g=a[d];"undefined"!=typeof g?this.playTrack(g):b.debug("no prev track found!")},mute:function(){soundManager.muted===!0?soundManager.unmute():soundManager.mute(),a.$broadcast("music:mute",soundManager.muted)},getMuteStatus:function(){return soundManager.muted},repeatToggle:function(){d=d!==!0,a.$broadcast("music:repeat",d)},getRepeatStatus:function(){return d},shuffleToggle:function(){e===!0?(e=!1,f=angular.copy(soundManager.soundIDs)):(e=!0,f=angular.copy(soundManager.soundIDs),f=f.sort(function(){return.5-Math.random()})),a.$broadcast("music:shuffle",e),a.$broadcast("music:tempTrack",f)},getShuffleStatus:function(){return e},getVolume:function(){return i},adjustVolume:function(b){var c=function(b){for(var c=0;c0&&(i-=10,c(i))},adjustVolumeSlider:function(b){var c=function(b){for(var c=0;c8&&(null===h.isMovieStar&&(h.isMovieStar=!!(h.serverURL||h.type&&h.type.match(jb)||h.url&&h.url.match(lb))),h.isMovieStar&&(qa._wD(e+"using MovieStar handling"),h.loops>1&&n("noNSLoop"))),h=U(h,e),i=d(),8===l?sa._createSound(h.id,h.loops||1,h.usePolicyFile):(sa._createSound(h.id,h.url,h.usePeakData,h.useWaveformData,h.useEQData,h.isMovieStar,!!h.isMovieStar&&h.bufferTime,h.loops||1,h.serverURL,h.duration||null,h.autoPlay,!0,h.autoLoad,h.usePolicyFile),h.serverURL||(i.connected=!0,h.onconnect&&h.onconnect.apply(i))),h.serverURL||!h.autoLoad&&!h.autoPlay||i.load(h)}return!h.serverURL&&h.autoPlay&&i.play(),i},this.destroySound=function(a,b){if(!W(a))return!1;var c,d=qa.sounds[a];for(d._iO={},d.stop(),d.unload(),c=0;c=0;a--)qa.sounds[qa.soundIDs[a]].pause()},this.resume=function(a){return!!W(a)&&qa.sounds[a].resume()},this.resumeAll=function(){var a;for(a=qa.soundIDs.length-1;a>=0;a--)qa.sounds[qa.soundIDs[a]].resume()},this.togglePause=function(a){return!!W(a)&&qa.sounds[a].togglePause()},this.setPan=function(a,b){return!!W(a)&&qa.sounds[a].setPan(b)},this.setVolume=function(a,b){return!!W(a)&&qa.sounds[a].setVolume(b)},this.mute=function(a){var b=0;if(a instanceof String&&(a=null),a)return!!W(a)&&(qa._wD(ta+'.mute(): Muting "'+a+'"'),qa.sounds[a].mute());for(qa._wD(ta+".mute(): Muting all sounds"),b=qa.soundIDs.length-1;b>=0;b--)qa.sounds[qa.soundIDs[b]].mute();return qa.muted=!0,!0},this.muteAll=function(){qa.mute()},this.unmute=function(a){var b;if(a instanceof String&&(a=null),a)return!!W(a)&&(qa._wD(ta+'.unmute(): Unmuting "'+a+'"'),qa.sounds[a].unmute());for(qa._wD(ta+".unmute(): Unmuting all sounds"),b=qa.soundIDs.length-1;b>=0;b--)qa.sounds[qa.soundIDs[b]].unmute();return qa.muted=!1,!0},this.unmuteAll=function(){qa.unmute()},this.toggleMute=function(a){return!!W(a)&&qa.sounds[a].toggleMute()},this.getMemoryUse=function(){var a=0;return sa&&8!==l&&(a=parseInt(sa._getMemoryUse(),10)),a},this.disable=function(c){var d;if(c===b&&(c=!1),Ea)return!1;for(Ea=!0,n("shutdown",1),d=qa.soundIDs.length-1;d>=0;d--)L(qa.sounds[qa.soundIDs[d]]);return o(c),ha.remove(a,"load",u),!0},this.canPlayMIME=function(a){var b;return qa.hasHTML5&&(b=ca({type:a})),!b&&Qa&&(b=a&&qa.ok()?!!((l>8?a.match(jb):null)||a.match(qa.mimePattern)):null),b},this.canPlayURL=function(a){var b;return qa.hasHTML5&&(b=ca({url:a})),!b&&Qa&&(b=a&&qa.ok()?!!a.match(qa.filePattern):null),b},this.canPlayLink=function(a){return!(a.type===b||!a.type||!qa.canPlayMIME(a.type))||qa.canPlayURL(a.href)},this.getSoundById=function(a,b){if(!a)return null;var c=qa.sounds[a];return c||b||qa._wD(ta+'.getSoundById(): Sound "'+a+'" not found.',2),c},this.onready=function(b,c){var d="onready";if("function"!=typeof b)throw O("needFunction",d);return Da&&qa._wD(O("queue",d)),c||(c=a),s(d,b,c),t(),!0},this.ontimeout=function(b,c){var d="ontimeout";if("function"!=typeof b)throw O("needFunction",d);return Da&&qa._wD(O("queue",d)),c||(c=a),s(d,b,c),t({type:d}),!0},this._writeDebug=function(a,c){var d,e;return!(!qa.debugMode||!(ab&&qa.useConsole&&(c&&"object"==typeof c?console.log(a,c):Ha[c]!==b?console[Ha[c]](a):console.log(a),qa.consoleOnly))&&(!(d=h("soundmanager-debug"))||(e=ya.createElement("div"),++Ga%2==0&&(e.className="sm2-alt"),c=c===b?0:parseInt(c,10),e.appendChild(ya.createTextNode(a)),c&&(c>=2&&(e.style.fontWeight="bold"),3===c&&(e.style.color="#ff3333")),d.insertBefore(e,d.firstChild),d=null,0)))},-1!==xa.indexOf("sm2-debug=alert")&&(this._writeDebug=function(b){a.alert(b)}),this._wD=this._writeDebug,this._debug=function(){var a,b;for(n("currentObj",1),a=0,b=qa.soundIDs.length;a=0;d--)qa.sounds[qa.soundIDs[d]].destruct();if(sa)try{Wa&&(Ka=sa.innerHTML),Ja=sa.parentNode.removeChild(sa)}catch(a){n("badRemove",2)}if(Ka=Ja=Qa=sa=null,qa.enabled=F=Da=La=Ma=Ba=Ca=Ea=Sa=qa.swfLoaded=!1,qa.soundIDs=[],qa.sounds={},Ta=0,b)za=[];else for(d in za)if(za.hasOwnProperty(d))for(e=0,f=za[d].length;e0&&q.position===q.duration&&(qa._wD(d+"Sound at end, resetting to position:0"),a.position=0),q.paused&&q.position>=0&&(!q._iO.serverURL||q.position>0))qa._wD(d+"Resuming from paused state",1),q.resume();else{if(q._iO=p(a,q._iO),(!q.isHTML5&&null!==q._iO.position&&q._iO.position>0||null!==q._iO.from&&q._iO.from>0||null!==q._iO.to)&&0===q.instanceCount&&0===q.playState&&!q._iO.serverURL){if(i=function(){q._iO=p(a,q._iO),q.play(q._iO)},q.isHTML5&&!q._html5_canplay?(qa._wD(d+"Beginning load for non-zero offset case"),q.load({_oncanplay:i}),t=!1):q.isHTML5||q.loaded||q.readyState&&2===q.readyState||(qa._wD(d+"Preloading for non-zero offset case"),q.load({onload:i}),t=!1),null!==t)return t;q._iO=j()}(!q.instanceCount||q._iO.multiShotEvents||q.isHTML5&&q._iO.multiShot&&!Sa||!q.isHTML5&&l>8&&!q.getAutoPlay())&&q.instanceCount++,q._iO.onposition&&0===q.playState&&h(q),q.playState=1,q.paused=!1,q.position=q._iO.position===b||isNaN(q._iO.position)?0:q._iO.position,q.isHTML5||(q._iO=U(T(q._iO))),q._iO.onplay&&c&&(q._iO.onplay.apply(q),r=!0),q.setVolume(q._iO.volume,!0),q.setPan(q._iO.pan,!0),q.isHTML5?q.instanceCount<2?(g(),f=q._setup_html5(),q.setPosition(q._iO.position),f.play()):(qa._wD(q.id+": Cloning Audio() for instance #"+q.instanceCount+"..."),k=new Audio(q._iO.url),m=function(){ha.remove(k,"ended",m),q._onfinish(q),ea(k),k=null},n=function(){ha.remove(k,"canplay",n);try{k.currentTime=q._iO.position/fb}catch(a){V(q.id+": multiShot play() failed to apply position of "+q._iO.position/fb)}k.play()},ha.add(k,"ended",m),void 0!==q._iO.volume&&(k.volume=Math.max(0,Math.min(1,q._iO.volume/100))),q.muted&&(k.muted=!0),q._iO.position?ha.add(k,"canplay",n):k.play()):(s=sa._start(q.id,q._iO.loops||1,9===l?q.position:q.position/fb,q._iO.multiShot||!1),9!==l||s||(qa._wD(d+"No sound hardware, or 32-sound ceiling hit",2),q._iO.onplayerror&&q._iO.onplayerror.apply(q)))}return q},this.start=this.play,this.stop=function(a){var b,c=q._iO;return 1===q.playState&&(qa._wD(q.id+": stop()"),q._onbufferchange(0),q._resetOnPosition(0),q.paused=!1,q.isHTML5||(q.playState=0),i(),c.to&&q.clearOnPosition(c.to),q.isHTML5?q._a&&(b=q.position,q.setPosition(0),q.position=b,q._a.pause(),q.playState=0,q._onTimer(),f()):(sa._stop(q.id,a),c.serverURL&&q.unload()),q.instanceCount=0,q._iO={},c.onstop&&c.onstop.apply(q)),q},this.setAutoPlay=function(a){qa._wD(q.id+": Autoplay turned "+(a?"on":"off")),q._iO.autoPlay=a,q.isHTML5||(sa._setAutoPlay(q.id,a),a&&(q.instanceCount||1!==q.readyState||(q.instanceCount++,qa._wD(q.id+": Incremented instance count to "+q.instanceCount))))},this.getAutoPlay=function(){return q._iO.autoPlay},this.setPosition=function(a){a===b&&(a=0);var c,d,e=q.isHTML5?Math.max(a,0):Math.min(q.duration||q._iO.duration,Math.max(a,0));if(q.position=e,d=q.position/fb,q._resetOnPosition(q.position),q._iO.position=e,q.isHTML5){if(q._a){if(q._html5_canplay){if(q._a.currentTime!==d){qa._wD(q.id+": setPosition("+d+")");try{q._a.currentTime=d,(0===q.playState||q.paused)&&q._a.pause()}catch(a){qa._wD(q.id+": setPosition("+d+") failed: "+a.message,2)}}}else if(d)return qa._wD(q.id+": setPosition("+d+"): Cannot seek yet, sound not ready",2),q;q.paused&&q._onTimer(!0)}}else c=9===l?q.position:d,q.readyState&&2!==q.readyState&&sa._setPosition(q.id,c,q.paused||!q.playState,q._iO.multiShot);return q},this.pause=function(a){return q.paused||0===q.playState&&1!==q.readyState?q:(qa._wD(q.id+": pause()"),q.paused=!0,q.isHTML5?(q._setup_html5().pause(),f()):(a||a===b)&&sa._pause(q.id,q._iO.multiShot),q._iO.onpause&&q._iO.onpause.apply(q),q)},this.resume=function(){var a=q._iO;return q.paused?(qa._wD(q.id+": resume()"),q.paused=!1,q.playState=1,q.isHTML5?(q._setup_html5().play(),g()):(a.isMovieStar&&!a.serverURL&&q.setPosition(q.position),sa._pause(q.id,a.multiShot)),!r&&a.onplay?(a.onplay.apply(q),r=!0):a.onresume&&a.onresume.apply(q),q):q},this.togglePause=function(){return qa._wD(q.id+": togglePause()"),0===q.playState?(q.play({position:9!==l||q.isHTML5?q.position/fb:q.position}),q):(q.paused?q.resume():q.pause(),q)},this.setPan=function(a,c){return a===b&&(a=0),c===b&&(c=!1),q.isHTML5||sa._setPan(q.id,a),q._iO.pan=a,c||(q.pan=a,q.options.pan=a),q},this.setVolume=function(a,c){return a===b&&(a=100),c===b&&(c=!1),q.isHTML5?q._a&&(qa.muted&&!q.muted&&(q.muted=!0,q._a.muted=!0),q._a.volume=Math.max(0,Math.min(1,a/100))):sa._setVolume(q.id,qa.muted&&!q.muted||q.muted?0:a),q._iO.volume=a,c||(q.volume=a,q.options.volume=a),q},this.mute=function(){return q.muted=!0,q.isHTML5?q._a&&(q._a.muted=!0):sa._setVolume(q.id,0),q},this.unmute=function(){q.muted=!1;var a=q._iO.volume!==b;return q.isHTML5?q._a&&(q._a.muted=!1):sa._setVolume(q.id,a?q._iO.volume:q.options.volume),q},this.toggleMute=function(){return q.muted?q.unmute():q.mute()},this.onPosition=function(a,c,d){return s.push({position:parseInt(a,10),method:c,scope:d!==b?d:q,fired:!1}),q},this.onposition=this.onPosition,this.clearOnPosition=function(a,b){var c;if(a=parseInt(a,10),isNaN(a))return!1;for(c=0;c=c)return!1;for(a=c-1;a>=0;a--)b=s[a],!b.fired&&q.position>=b.position&&(b.fired=!0,t++,b.method.apply(b.scope,[b.position]),c=s.length);return!0},this._resetOnPosition=function(a){var b,c,d=s.length;if(!d)return!1;for(b=d-1;b>=0;b--)c=s[b],c.fired&&a<=c.position&&(c.fired=!1,t--);return!0},j=function(){var a,b,c=q._iO,d=c.from,e=c.to;return b=function(){qa._wD(q.id+': "To" time of '+e+" reached."),q.clearOnPosition(e,b),q.stop()},a=function(){qa._wD(q.id+': Playing "from" '+d),null===e||isNaN(e)||q.onPosition(e,b)},null===d||isNaN(d)||(c.position=d,c.multiShot=!1,a()),c},h=function(){var a,b=q._iO.onposition;if(b)for(a in b)b.hasOwnProperty(a)&&q.onPosition(parseInt(a,10),b[a])},i=function(){var a,b=q._iO.onposition;if(b)for(a in b)b.hasOwnProperty(a)&&q.clearOnPosition(parseInt(a,10))},g=function(){q.isHTML5&&X(q)},f=function(){q.isHTML5&&Y(q)},c=function(a){a||(s=[],t=0),r=!1,q._hasTimer=null,q._a=null,q._html5_canplay=!1,q.bytesLoaded=null,q.bytesTotal=null,q.duration=q._iO&&q._iO.duration?q._iO.duration:null,q.durationEstimate=null,q.buffered=[],q.eqData=[],q.eqData.left=[],q.eqData.right=[],q.failures=0,q.isBuffering=!1,q.instanceOptions={},q.instanceCount=0,q.loaded=!1,q.metadata={},q.readyState=0,q.muted=!1,q.paused=!1,q.peakData={left:0,right:0},q.waveformData={left:[],right:[]},q.playState=0,q.position=null,q.id3={}},c(),this._onTimer=function(a){var b,c,d=!1,e={};if(q._hasTimer||a)return q._a&&(a||(q.playState>0||1===q.readyState)&&!q.paused)&&(b=q._get_html5_duration(),b!==k.duration&&(k.duration=b,q.duration=b,d=!0),q.durationEstimate=q.duration,c=q._a.currentTime*fb||0,c!==k.time&&(k.time=c,d=!0),(d||a)&&q._whileplaying(c,e,e,e,e)),d},this._get_html5_duration=function(){var a=q._iO,b=q._a&&q._a.duration?q._a.duration*fb:a&&a.duration?a.duration:null;return b&&!isNaN(b)&&b!==1/0?b:null},this._apply_loop=function(a,b){!a.loop&&b>1&&qa._wD("Note: Native HTML5 looping is infinite.",1),a.loop=b>1?"loop":""},this._setup_html5=function(a){var b,e=p(q._iO,a),f=Sa?ra:q._a,g=decodeURI(e.url);if(Sa?g===decodeURI(ia)&&(b=!0):g===decodeURI(u)&&(b=!0),f){if(f._s)if(Sa)f._s&&f._s.playState&&!b&&f._s.stop();else if(!Sa&&g===decodeURI(u))return q._apply_loop(f,e.loops),f;b||(u&&c(!1),f.src=e.url,q.url=e.url,u=e.url,ia=e.url,f._called_load=!1)}else e.autoLoad||e.autoPlay?(q._a=new Audio(e.url),q._a.load()):q._a=Za&&opera.version()<10?new Audio(null):new Audio,f=q._a,f._called_load=!1,Sa&&(ra=f);return q.isHTML5=!0,q._a=f,f._s=q,d(),q._apply_loop(f,e.loops),e.autoLoad||e.autoPlay?q.load():(f.autobuffer=!1,f.preload="auto"),f},d=function(){function a(a,b,c){return q._a?q._a.addEventListener(a,b,c||!1):null}if(q._a._added_events)return!1;var b;q._a._added_events=!0;for(b in ma)ma.hasOwnProperty(b)&&a(b,ma[b]);return!0},e=function(){function a(a,b,c){return q._a?q._a.removeEventListener(a,b,c||!1):null}var b;qa._wD(q.id+": Removing event listeners"),q._a._added_events=!1;for(b in ma)ma.hasOwnProperty(b)&&a(b,ma[b])},this._onload=function(a){var b,c=!!a||!q.isHTML5&&8===l&&q.duration;return b=q.id+": ",qa._wD(b+(c?"onload()":"Failed to load / invalid sound?"+(q.duration?" -":" Zero-length duration reported.")+" ("+q.url+")"),c?1:2),c||q.isHTML5||(!0===qa.sandbox.noRemote&&qa._wD(b+O("noNet"),1),!0===qa.sandbox.noLocal&&qa._wD(b+O("noLocal"),1)),q.loaded=c,q.readyState=c?3:2,q._onbufferchange(0),q._iO.onload&&pa(q,function(){q._iO.onload.apply(q,[c])}),!0},this._onbufferchange=function(a){return!(0===q.playState||a&&q.isBuffering||!a&&!q.isBuffering||(q.isBuffering=1===a,q._iO.onbufferchange&&(qa._wD(q.id+": Buffer state change: "+a),q._iO.onbufferchange.apply(q,[a])),0))},this._onsuspend=function(){return q._iO.onsuspend&&(qa._wD(q.id+": Playback suspended"),q._iO.onsuspend.apply(q)),!0},this._onfailure=function(a,b,c){q.failures++,qa._wD(q.id+": Failure ("+q.failures+"): "+a),q._iO.onfailure&&1===q.failures?q._iO.onfailure(a,b,c):qa._wD(q.id+": Ignoring failure")},this._onwarning=function(a,b,c){q._iO.onwarning&&q._iO.onwarning(a,b,c)},this._onfinish=function(){var a=q._iO.onfinish;q._onbufferchange(0),q._resetOnPosition(0),q.instanceCount&&(q.instanceCount--,q.instanceCount||(i(),q.playState=0,q.paused=!1,q.instanceCount=0,q.instanceOptions={},q._iO={},f(),q.isHTML5&&(q.position=0)),q.instanceCount&&!q._iO.multiShotEvents||a&&(qa._wD(q.id+": onfinish()"),pa(q,function(){a.apply(q)})))},this._whileloading=function(a,b,c,d){var e=q._iO;q.bytesLoaded=a,q.bytesTotal=b,q.duration=Math.floor(c),q.bufferLength=d,q.isHTML5||e.isMovieStar?q.durationEstimate=q.duration:e.duration?q.durationEstimate=q.duration>e.duration?q.duration:e.duration:q.durationEstimate=parseInt(q.bytesTotal/q.bytesLoaded*q.duration,10),q.isHTML5||(q.buffered=[{start:0,end:q.duration}]),(3!==q.readyState||q.isHTML5)&&e.whileloading&&e.whileloading.apply(q)},this._whileplaying=function(a,c,d,e,f){var g,h=q._iO;return!isNaN(a)&&null!==a&&(q.position=Math.max(0,a),q._processOnPosition(),!q.isHTML5&&l>8&&(h.usePeakData&&c!==b&&c&&(q.peakData={left:c.leftPeak,right:c.rightPeak}),h.useWaveformData&&d!==b&&d&&(q.waveformData={left:d.split(","),right:e.split(",")}),h.useEQData&&f!==b&&f&&f.leftEQ&&(g=f.leftEQ.split(","),q.eqData=g,q.eqData.left=g,f.rightEQ!==b&&f.rightEQ&&(q.eqData.right=f.rightEQ.split(",")))),1===q.playState&&(q.isHTML5||8!==l||q.position||!q.isBuffering||q._onbufferchange(0),h.whileplaying&&h.whileplaying.apply(q)),!0)},this._oncaptiondata=function(a){qa._wD(q.id+": Caption data received."),q.captiondata=a,q._iO.oncaptiondata&&q._iO.oncaptiondata.apply(q,[a])},this._onmetadata=function(a,b){qa._wD(q.id+": Metadata received.");var c,d,e={};for(c=0,d=a.length;c0&&(qa._wD(q.id+": Data error: "+a),q._iO.ondataerror&&q._iO.ondataerror.apply(q))},this._debug()},G=function(){return ya.body||ya.getElementsByTagName("div")[0]},h=function(a){return ya.getElementById(a)},p=function(a,c){var d,e,f=a||{};d=c===b?qa.defaultOptions:c;for(e in d)d.hasOwnProperty(e)&&f[e]===b&&("object"!=typeof d[e]||null===d[e]?f[e]=d[e]:f[e]=p(f[e],d[e]));return f},pa=function(b,c){b.isHTML5||8!==l?c():a.setTimeout(c,0)},r={onready:1,ontimeout:1,defaultOptions:1,flash9Options:1,movieStarOptions:1},q=function(a,c){var d,e=!0,f=c!==b,g=qa.setupOptions,h=r;if(a===b){e=[];for(d in g)g.hasOwnProperty(d)&&e.push(d);for(d in h)h.hasOwnProperty(d)&&("object"==typeof qa[d]?e.push(d+": {...}"):qa[d]instanceof Function?e.push(d+": function() {...}"):e.push(d));return qa._wD(O("setup",e.join(", "))),!1}for(d in a)if(a.hasOwnProperty(d))if("object"!=typeof a[d]||null===a[d]||a[d]instanceof Array||a[d]instanceof RegExp)f&&h[c]!==b?qa[c][d]=a[d]:g[d]!==b?(qa.setupOptions[d]=a[d],qa[d]=a[d]):h[d]===b?(V(O(qa[d]===b?"setupUndef":"setupError",d),2),e=!1):qa[d]instanceof Function?qa[d].apply(qa,a[d]instanceof Array?a[d]:[a[d]]):qa[d]=a[d];else{if(h[d]!==b)return q(a[d],d);V(O(qa[d]===b?"setupUndef":"setupError",d),2),e=!1}return e},ha=function(){function b(a){var b=Ra.call(a),c=b.length;return f?(b[1]="on"+b[1],c>3&&b.pop()):3===c&&b.push(!1),b}function c(a,b){var c=a.shift(),d=[g[b]];f?c[d](a[0],a[1]):c[d].apply(c,a)}function d(){c(b(arguments),"add")}function e(){c(b(arguments),"remove")}var f=a.attachEvent,g={add:f?"attachEvent":"addEventListener",remove:f?"detachEvent":"removeEventListener"};return{add:d,remove:e}}(),ma={abort:f(function(){qa._wD(this._s.id+": abort")}),canplay:f(function(){var a,c=this._s;if(c._html5_canplay)return!0;if(c._html5_canplay=!0,qa._wD(c.id+": canplay"),c._onbufferchange(0),a=c._iO.position===b||isNaN(c._iO.position)?null:c._iO.position/fb,this.currentTime!==a){qa._wD(c.id+": canplay: Setting position to "+a);try{this.currentTime=a}catch(b){qa._wD(c.id+": canplay: Setting position of "+a+" failed: "+b.message,2)}}c._iO._oncanplay&&c._iO._oncanplay()}),canplaythrough:f(function(){var a=this._s;a.loaded||(a._onbufferchange(0),a._whileloading(a.bytesLoaded,a.bytesTotal,a._get_html5_duration()),a._onload(!0))}),durationchange:f(function(){var a,b=this._s;a=b._get_html5_duration(),isNaN(a)||a===b.duration||(qa._wD(this._s.id+": durationchange ("+a+")"+(b.duration?", previously "+b.duration:"")),b.durationEstimate=b.duration=a)}),ended:f(function(){var a=this._s;qa._wD(a.id+": ended"),a._onfinish()}),error:f(function(){qa._wD(this._s.id+": HTML5 error, code "+this.error.code),this._s._onload(!1)}),loadeddata:f(function(){var a=this._s;qa._wD(a.id+": loadeddata"),a._loaded||Ya||(a.duration=a._get_html5_duration())}),loadedmetadata:f(function(){qa._wD(this._s.id+": loadedmetadata")}),loadstart:f(function(){qa._wD(this._s.id+": loadstart"),this._s._onbufferchange(1)}),play:f(function(){this._s._onbufferchange(0)}),playing:f(function(){qa._wD(this._s.id+": playing "+String.fromCharCode(9835)),this._s._onbufferchange(0)}),progress:f(function(a){var b,c,d,e=this._s,f=0,g="progress"===a.type,h=a.target.buffered,i=a.loaded||0,j=a.total||1;if(e.buffered=[],h&&h.length){for(b=0,c=h.length;b1){for(d=[],c=h.length,b=0;b=0;f--)h["audio/"+e[c].related[f]]=h[c],qa.html5[e[c].related[f]]=h[c],qa.flash[e[c].related[f]]=h[c];return h.canPlayType=g?a:null,qa.html5=p(qa.html5,h),qa.html5.usingFlash=aa(),Qa=qa.html5.usingFlash,!0},A={notReady:"Unavailable - wait until onready() has fired.",notOK:"Audio support is not available.",domError:ta+"exception caught while appending SWF to DOM.",spcWmode:"Removing wmode, preventing known SWF loading issue(s)",swf404:ua+"Verify that %s is a valid path.",tryDebug:"Try "+ta+".debugFlash = true for more security details (output goes to SWF.)",checkSWF:"See SWF output for more debug info.",localFail:ua+"Non-HTTP page ("+ya.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:ua+"Special case: Waiting for SWF to load with window focus...",waitForever:ua+"Waiting indefinitely for Flash (will recover if unblocked)...",waitSWF:ua+"Waiting for 100% SWF load...",needFunction:ua+"Function object expected for %s",badID:'Sound ID "%s" should be a string, starting with a non-numeric character',currentObj:ua+"_debug(): Current sound objects",waitOnload:ua+"Waiting for window.onload()",docLoaded:ua+"Document already loaded",onload:ua+"initComplete(): calling soundManager.onload()",onloadOK:ta+".onload() complete",didInit:ua+"init(): Already called?",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",badRemove:ua+"Failed to remove Flash node.",shutdown:ta+".disable(): Shutting down",queue:ua+"Queueing %s handler",smError:"SMSound.load(): Exception: JS-Flash communication failed, or JS error.",fbTimeout:"No flash response, applying ."+R.swfTimedout+" CSS...",fbLoaded:"Flash loaded",fbHandler:ua+"flashBlockHandler()",manURL:"SMSound.load(): Using manually-assigned URL",onURL:ta+".load(): current URL already assigned.",badFV:ta+'.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",needFlash:ua+"Fatal error: Flash is needed to play some required formats, but is not available.",gotFocus:ua+"Got window focus.",policy:"Enabling usePolicyFile for data access",setup:ta+".setup(): allowed parameters: %s",setupError:ta+'.setup(): "%s" cannot be assigned with this method.',setupUndef:ta+'.setup(): Could not find option "%s"',setupLate:ta+".setup(): url, flashVersion and html5Test property changes will not take effect until reboot().",noURL:ua+"Flash URL required. Call soundManager.setup({url:...}) to get started.",sm2Loaded:"SoundManager 2: Ready. "+String.fromCharCode(10003),reset:ta+".reset(): Removing event callbacks",mobileUA:"Mobile UA detected, preferring HTML5 by default.",globalHTML5:"Using singleton HTML5 Audio() pattern for this device."},O=function(){var a,b,c,d,e;if(a=Ra.call(arguments),d=a.shift(),(e=A&&A[d]?A[d]:"")&&a&&a.length)for(b=0,c=a.length;b1&&a.stream&&(n("as2loop"),a.stream=!1),a},U=function(a,b){return a&&!a.usePolicyFile&&(a.onid3||a.usePeakData||a.useWaveformData||a.useEQData)&&(qa._wD((b||"")+O("policy")),a.usePolicyFile=!0),a},V=function(a){ab&&console.warn!==b?console.warn(a):qa._wD(a)},i=function(){return!1},L=function(a){var b;for(b in a)a.hasOwnProperty(b)&&"function"==typeof a[b]&&(a[b]=i);b=null},M=function(a){a===b&&(a=!1),(Ea||a)&&qa.disable(a)},N=function(a){var b;if(a)if(a.match(/\.swf(\?.*)?$/i)){if(a.substr(a.toLowerCase().lastIndexOf(".swf?")+4))return a}else a.lastIndexOf("/")!==a.length-1&&(a+="/");return b=(a&&-1!==a.lastIndexOf("/")?a.substr(0,a.lastIndexOf("/")+1):"./")+qa.movieURL,qa.noSWFCache&&(b+="?ts="+(new Date).getTime()),b},y=function(){8!==(l=parseInt(qa.flashVersion,10))&&9!==l&&(qa._wD(O("badFV",l,Ia)),qa.flashVersion=l=Ia);var a=qa.debugMode||qa.debugFlash?"_debug.swf":".swf";qa.useHTML5Audio&&!qa.html5Only&&qa.audioFormats.mp4.required&&l<9&&(qa._wD(O("needfl9")),qa.flashVersion=l=9),qa.version=qa.versionNumber+(qa.html5Only?" (HTML5-only mode)":9===l?" (AS3/Flash 9)":" (AS2/Flash 8)"),l>8?(qa.defaultOptions=p(qa.defaultOptions,qa.flash9Options),qa.features.buffering=!0,qa.defaultOptions=p(qa.defaultOptions,qa.movieStarOptions),qa.filePatterns.flash9=new RegExp("\\.(mp3|"+kb.join("|")+")(\\?.*)?$","i"),qa.features.movieStar=!0):qa.features.movieStar=!1,qa.filePattern=qa.filePatterns[8!==l?"flash9":"flash8"],qa.movieURL=(8===l?"soundmanager2.swf":"soundmanager2_flash9.swf").replace(".swf",a),qa.features.peakData=qa.features.waveformData=qa.features.eqData=l>8},J=function(a,b){if(!sa)return!1;sa._setPolling(a,b)},K=function(){if(qa.debugURLParam.test(xa)&&(qa.debugMode=!0),h(qa.debugID))return!1;var a,b,c,d,e;if(qa.debugMode&&!h(qa.debugID)&&(!ab||!qa.useConsole||!qa.consoleOnly)){a=ya.createElement("div"),a.id=qa.debugID+"-toggle",d={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},a.appendChild(ya.createTextNode("-")),a.onclick=S,a.title="Toggle SM2 debug console",wa.match(/msie 6/i)&&(a.style.position="absolute",a.style.cursor="hand");for(e in d)d.hasOwnProperty(e)&&(a.style[e]=d[e]);if(b=ya.createElement("div"),b.id=qa.debugID,b.style.display=qa.debugMode?"block":"none",qa.debugMode&&!h(a.id)){try{c=G(),c.appendChild(a)}catch(a){throw new Error(O("domError")+" \n"+a.toString())}c.appendChild(b)}}c=null},W=this.getSoundById,n=function(a,b){return a?qa._wD(O(a),b):""},S=function(){var a=h(qa.debugID),b=h(qa.debugID+"-toggle");if(!a)return!1;Aa?(b.innerHTML="+",a.style.display="none"):(b.innerHTML="-",a.style.display="block"),Aa=!Aa},m=function(c,d,e){if(a.sm2Debugger!==b)try{sm2Debugger.handleEvent(c,d,e)}catch(a){return!1}return!0},Q=function(){var a=[];return qa.debugMode&&a.push(R.sm2Debug),qa.debugFlash&&a.push(R.flashDebug),qa.useHighPerformance&&a.push(R.highPerf),a.join(" ")},P=function(){var a=O("fbHandler"),b=qa.getMoviePercent(),c=R,d={type:"FLASHBLOCK"};if(qa.html5Only)return!1;qa.ok()?(qa.didFlashBlock&&qa._wD(a+": Unblocked"),qa.oMC&&(qa.oMC.className=[Q(),c.swfDefault,c.swfLoaded+(qa.didFlashBlock?" "+c.swfUnblocked:"")].join(" "))):(Qa&&(qa.oMC.className=Q()+" "+c.swfDefault+" "+(null===b?c.swfTimedout:c.swfError),qa._wD(a+": "+O("fbTimeout")+(b?" ("+O("fbLoaded")+")":""))),qa.didFlashBlock=!0,t({type:"ontimeout",ignoreInit:!0,error:d}),I(d))},s=function(a,c,d){za[a]===b&&(za[a]=[]),za[a].push({method:c,scope:d||null,fired:!1})},t=function(a){if(a||(a={type:qa.ok()?"onready":"ontimeout"}),!Da&&a&&!a.ignoreInit)return!1;if("ontimeout"===a.type&&(qa.ok()||Ea&&!a.ignoreInit))return!1;var b,c,d={success:a&&a.ignoreInit?qa.ok():!Ea},e=a&&a.type?za[a.type]||[]:[],f=[],g=[d],h=Qa&&!qa.ok();for(a.error&&(g[0].error=a.error),b=0,c=e.length;b=0;a--)qa.sounds[qa.soundIDs[a]].isHTML5&&qa.sounds[qa.soundIDs[a]]._hasTimer&&qa.sounds[qa.soundIDs[a]]._onTimer()},I=function(c){c=c!==b?c:{},"function"==typeof qa.onerror&&qa.onerror.apply(a,[{type:c.type!==b?c.type:null}]),c.fatal!==b&&c.fatal&&qa.disable()},la=function(){if(!_a||!ka())return!1;var a,b,c=qa.audioFormats;for(b in c)if(c.hasOwnProperty(b)&&("mp3"===b||"mp4"===b)&&(qa._wD(ta+": Using flash fallback for "+b+" format"),qa.html5[b]=!1,c[b]&&c[b].related))for(a=c[b].related.length-1;a>=0;a--)qa.html5[c[b].related[a]]=!1},this._setSandboxType=function(a){var c=qa.sandbox;c.type=a,c.description=c.types[c.types[a]!==b?a:"unknown"],"localWithFile"===c.type?(c.noRemote=!0,c.noLocal=!1,n("secNote",2)):"localWithNetwork"===c.type?(c.noRemote=!1,c.noLocal=!0):"localTrusted"===c.type&&(c.noRemote=!1,c.noLocal=!1)},this._externalInterfaceOK=function(a){if(qa.swfLoaded)return!1;var b;if(m("swf",!0),m("flashtojs",!0),qa.swfLoaded=!0,cb=!1,_a&&la(),!a||a.replace(/\+dev/i,"")!==qa.versionNumber.replace(/\+dev/i,""))return b=ta+': Fatal: JavaScript file build "'+qa.versionNumber+'" does not match Flash SWF build "'+a+'" at '+qa.url+". Ensure both are up-to-date.",setTimeout(function(){throw new Error(b)},0),!1;setTimeout(k,Wa?100:1)},H=function(a,c){function d(){var a,b=[],c=[],d=" + ";a="SoundManager "+qa.version+(!qa.html5Only&&qa.useHTML5Audio?qa.hasHTML5?" + HTML5 audio":", no HTML5 audio support":""),qa.html5Only?qa.html5PollingInterval&&b.push("html5PollingInterval ("+qa.html5PollingInterval+"ms)"):(qa.preferFlash&&b.push("preferFlash"),qa.useHighPerformance&&b.push("useHighPerformance"),qa.flashPollingInterval&&b.push("flashPollingInterval ("+qa.flashPollingInterval+"ms)"),qa.html5PollingInterval&&b.push("html5PollingInterval ("+qa.html5PollingInterval+"ms)"),qa.wmode&&b.push("wmode ("+qa.wmode+")"),qa.debugFlash&&b.push("debugFlash"),qa.useFlashBlock&&b.push("flashBlock")),b.length&&(c=c.concat([b.join(d)])),qa._wD(a+(c.length?d+c.join(", "):""),1),na()}function e(a,b){return''}if(Ba&&Ca)return!1;if(qa.html5Only)return y(),d(),qa.oMC=h(qa.movieID),k(),Ba=!0,Ca=!0,!1;var f,g,i,j,l,m,n,o,p=c||qa.url,q=qa.altURL||p,r=G(),s=Q(),t=null,u=ya.getElementsByTagName("html")[0];if(t=u&&u.dir&&u.dir.match(/rtl/i),a=a===b?qa.id:a,y(),qa.url=N(hb?p:q),c=qa.url,qa.wmode=!qa.wmode&&qa.useHighPerformance?"transparent":qa.wmode,null!==qa.wmode&&(wa.match(/msie 8/i)||!Wa&&!qa.useHighPerformance)&&navigator.platform.match(/win32|win64/i)&&(Pa.push(A.spcWmode),qa.wmode=null),f={name:a,id:a,src:c,quality:"high",allowScriptAccess:qa.allowScriptAccess,bgcolor:qa.bgColor,pluginspage:ib+"www.macromedia.com/go/getflashplayer",title:"JS/Flash audio component (SoundManager 2)",type:"application/x-shockwave-flash",wmode:qa.wmode,hasPriority:"true"},qa.debugFlash&&(f.FlashVars="debug=1"),qa.wmode||delete f.wmode,Wa)g=ya.createElement("div"),j=['',e("movie",c),e("AllowScriptAccess",qa.allowScriptAccess),e("quality",f.quality),qa.wmode?e("wmode",qa.wmode):"",e("bgcolor",qa.bgColor),e("hasPriority","true"),qa.debugFlash?e("FlashVars",f.FlashVars):"",""].join("");else{g=ya.createElement("embed");for(i in f)f.hasOwnProperty(i)&&g.setAttribute(i,f[i])}if(K(),s=Q(),r=G())if(qa.oMC=h(qa.movieID)||ya.createElement("div"),qa.oMC.id)o=qa.oMC.className,qa.oMC.className=(o?o+" ":R.swfDefault)+(s?" "+s:""),qa.oMC.appendChild(g),Wa&&(l=qa.oMC.appendChild(ya.createElement("div")),l.className=R.swfBox,l.innerHTML=j),Ca=!0;else{if(qa.oMC.id=qa.movieID,qa.oMC.className=R.swfDefault+" "+s,m=null,l=null,qa.useFlashBlock||(qa.useHighPerformance?m={position:"fixed",width:"8px",height:"8px",bottom:"0px",left:"0px",overflow:"hidden"}:(m={position:"absolute",width:"6px",height:"6px",top:"-9999px",left:"-9999px"},t&&(m.left=Math.abs(parseInt(m.left,10))+"px"))),Xa&&(qa.oMC.style.zIndex=1e4),!qa.debugFlash)for(n in m)m.hasOwnProperty(n)&&(qa.oMC.style[n]=m[n]);try{Wa||qa.oMC.appendChild(g),r.appendChild(qa.oMC),Wa&&(l=qa.oMC.appendChild(ya.createElement("div")),l.className=R.swfBox,l.innerHTML=j),Ca=!0}catch(a){throw new Error(O("domError")+" \n"+a.toString())}}return Ba=!0,d(),!0},B=function(){return qa.html5Only?(H(),!1):!sa&&(qa.url?(sa=qa.getMovie(qa.id),sa||(Ja?(Wa?qa.oMC.innerHTML=Ka:qa.oMC.appendChild(Ja),Ja=null,Ba=!0):H(qa.id,qa.url),sa=qa.getMovie(qa.id)),"function"==typeof qa.oninitmovie&&setTimeout(qa.oninitmovie,1),oa(),!0):(n("noURL"),!1))},v=function(){setTimeout(w,1e3)},x=function(){a.setTimeout(function(){V(ua+"useFlashBlock is false, 100% HTML5 mode is possible. Rebooting with preferFlash: false..."),qa.setup({preferFlash:!1}).reboot(),qa.didFlashBlock=!0,qa.beginDelayedInit()},1)},w=function(){var b,c=!1;return!!qa.url&&!La&&(La=!0,ha.remove(a,"load",v),ja&&cb&&!bb?(n("waitFocus"),!1):(Da||(b=qa.getMoviePercent())>0&&b<100&&(c=!0),void setTimeout(function(){if(b=qa.getMoviePercent(),c)return La=!1,qa._wD(O("waitSWF")),a.setTimeout(v,1),!1;Da||(qa._wD(ta+": No Flash response within expected time. Likely causes: "+(0===b?"SWF load failed, ":"")+"Flash blocked or JS-Flash security error."+(qa.debugFlash?" "+O("checkSWF"):""),2),!hb&&b&&(n("localFail",2),qa.debugFlash||n("tryDebug",2)),0===b&&qa._wD(O("swf404",qa.url),1),m("flashtojs",!1," (Check flash security or flash blockers)")),!Da&&db&&(null===b?qa.useFlashBlock||0===qa.flashLoadTimeout?(qa.useFlashBlock&&P(),n("waitForever")):!qa.useFlashBlock&&_?x():(n("waitForever"),t({type:"ontimeout",ignoreInit:!0,error:{type:"INIT_FLASHBLOCK"}})):0===qa.flashLoadTimeout?n("waitForever"):!qa.useFlashBlock&&_?x():M(!0))},qa.flashLoadTimeout)))},z=function(){function b(){ha.remove(a,"focus",z)}return bb||!cb?(b(),!0):(db=!0,bb=!0,n("gotFocus"),La=!1,v(),b(),!0)},oa=function(){Pa.length&&(qa._wD("SoundManager 2: "+Pa.join(" "),1),Pa=[])},na=function(){oa();var a,b=[];if(qa.useHTML5Audio&&qa.hasHTML5){for(a in qa.audioFormats)qa.audioFormats.hasOwnProperty(a)&&b.push(a+" = "+qa.html5[a]+(!qa.html5[a]&&Qa&&qa.flash[a]?" (using flash)":qa.preferFlash&&qa.flash[a]&&Qa?" (preferring flash)":qa.html5[a]?"":" ("+(qa.audioFormats[a].required?"required, ":"")+"and no flash support)"));qa._wD("SoundManager 2 HTML5 support: "+b.join(", "),1)}},o=function(b){if(Da)return!1;if(qa.html5Only)return n("sm2Loaded",1),Da=!0,u(),m("onload",!0),!0;var c,d=qa.useFlashBlock&&qa.flashLoadTimeout&&!qa.getMoviePercent(),e=!0;return d||(Da=!0),c={type:!ja&&Qa?"NO_FLASH":"INIT_TIMEOUT"},qa._wD("SoundManager 2 "+(Ea?"failed to load":"loaded")+" ("+(Ea?"Flash security/load error":"OK")+") "+String.fromCharCode(Ea?10006:10003),Ea?2:1),Ea||b?(qa.useFlashBlock&&qa.oMC&&(qa.oMC.className=Q()+" "+(null===qa.getMoviePercent()?R.swfTimedout:R.swfError)),t({type:"ontimeout",error:c,ignoreInit:!0}),m("onload",!1),I(c),e=!1):m("onload",!0),Ea||(qa.waitForWindowLoad&&!Fa?(n("waitOnload"),ha.add(a,"load",u)):(qa.waitForWindowLoad&&Fa&&n("docLoaded"),u())),e},j=function(){var a,c=qa.setupOptions;for(a in c)c.hasOwnProperty(a)&&(qa[a]===b?qa[a]=c[a]:qa[a]!==c[a]&&(qa.setupOptions[a]=qa[a]))},k=function(){function b(){ha.remove(a,"load",qa.beginDelayedInit)}if(Da)return n("didInit"),!1;if(qa.html5Only)return Da||(b(),qa.enabled=!0,o()),!0;B();try{sa._externalInterfaceTest(!1),J(!0,qa.flashPollingInterval||(qa.useHighPerformance?10:50)),qa.debugMode||sa._disableDebug(),qa.enabled=!0,m("jstoflash",!0),qa.html5Only||ha.add(a,"unload",i)}catch(a){return qa._wD("js/flash exception: "+a.toString()),m("jstoflash",!1),I({type:"JS_TO_FLASH_EXCEPTION",fatal:!0}),M(!0),o(),!1}return o(),b(),!0},D=function(){return!F&&(F=!0,j(),K(),function(){var a="sm2-usehtml5audio=",b="sm2-preferflash=",c=null,d=null,e=xa.toLowerCase();-1!==e.indexOf(a)&&(c="1"===e.charAt(e.indexOf(a)+a.length),ab&&console.log((c?"Enabling ":"Disabling ")+"useHTML5Audio via URL parameter"),qa.setup({useHTML5Audio:c})),-1!==e.indexOf(b)&&(d="1"===e.charAt(e.indexOf(b)+b.length),ab&&console.log((d?"Enabling ":"Disabling ")+"preferFlash via URL parameter"),qa.setup({preferFlash:d}))}(),!ja&&qa.hasHTML5&&(qa._wD("SoundManager 2: No Flash detected"+(qa.useHTML5Audio?". Trying HTML5-only mode.":", enabling HTML5."),1),qa.setup({useHTML5Audio:!0,preferFlash:!1})),ga(),!ja&&Qa&&(Pa.push(A.needFlash),qa.setup({flashLoadTimeout:1})),ya.removeEventListener&&ya.removeEventListener("DOMContentLoaded",D,!1),B(),!0)},fa=function(){return"complete"===ya.readyState&&(D(),ya.detachEvent("onreadystatechange",fa)),!0},E=function(){Fa=!0,D(),ha.remove(a,"load",E)},C=function(){$a&&(qa.setupOptions.useHTML5Audio&&!qa.setupOptions.preferFlash||Pa.push(A.mobileUA),qa.setupOptions.useHTML5Audio=!0,qa.setupOptions.preferFlash=!1,(Ua||Va&&!wa.match(/android\s2\.3/i))&&(Pa.push(A.globalHTML5),Ua&&(qa.ignoreFlash=!0),Sa=!0))},C(),ka(),ha.add(a,"focus",z),ha.add(a,"load",v),ha.add(a,"load",E),ya.addEventListener?ya.addEventListener("DOMContentLoaded",D,!1):ya.attachEvent?ya.attachEvent("onreadystatechange",fa):(m("onload",!1),I({type:"NO_DOM2_EVENTS",fatal:!0}))}if(!a||!a.document)throw new Error("SoundManager requires a browser with window and document objects.");var d=null;void 0!==a.SM2_DEFER&&SM2_DEFER||(d=new c),"object"==typeof module&&module&&"object"==typeof module.exports?(a.soundManager=d,module.exports.SoundManager=c,module.exports.soundManager=d):"function"==typeof define&&define.amd?define("SoundManager",[],function(){return{SoundManager:c,soundManager:d}}):(a.SoundManager=c,a.soundManager=d)}(window);var ngSoundManager=angular.module("angularSoundManager",[]).config(["$logProvider",function(a){a.debugEnabled(!1)}]);ngSoundManager.filter("humanTime",function(){return function(a){function b(a){return a<10?"0"+a.toString():a.toString()}var c=a/1e3/60<<0,d=Math.round(a/1e3%60);return b(c)+":"+b(d)}}),ngSoundManager.factory("angularPlayer",["$rootScope","$log",function(a,b){var c=null,d=!1,e=!1,f=[],g=!1,h=90,i=0,j=[];return{init:function(){"undefined"==typeof soundManager&&alert("Please include SoundManager2 Library!"),soundManager.setup({preferFlash:!1,debugMode:!1,useHTML5Audio:!0,onready:function(){},ontimeout:function(){alert("SM2 failed to start. Flash missing, blocked or security error?"),alert("The status is "+status.success+", the error type is "+status.error.type)},defaultOptions:{autoLoad:!1,autoPlay:!1,from:null,loops:1,multiShot:!1,multiShotEvents:!1,onid3:null,onload:null,onstop:null,onfailure:"nextTrack",onpause:null,onplay:null,onresume:null,position:null,pan:0,stream:!0,to:null,type:"audio/mp3",usePolicyFile:!1,volume:h,whileloading:function(){var b=this.bytesLoaded/this.bytesTotal*100;a.$broadcast("track:loaded",b)},whileplaying:function(){c=this.id,i=this.position/this.duration*100,a.$broadcast("track:progress",i),a.$broadcast("currentTrack:position",this.position),a.$broadcast("currentTrack:duration",this.duration)},onfinish:function(){soundManager._writeDebug(this.id+" finished playing"),angular.element(document.querySelector("[ng-app]")).injector().get("angularPlayer").nextTrack(),a.$broadcast("track:id",c)}}}),soundManager.onready(function(){b.debug("song manager ready!");var c=soundManager.ok();b.debug("is supported: "+c),a.$broadcast("angularPlayer:ready",!0)})},isInArray:function(a,b){for(var c=0;c-1){if(void 0===a.url)return b.debug("invalid soundcloud track url"),!1}else if(!0!==soundManager.canPlayURL(a.url))return b.debug("invalid song url"),!1},addTrack:function(a){return this.isTrackValid?(!1===this.isInArray(this.getPlaylist(),a.id)&&(soundManager.createSound({id:a.id,url:a.url}),this.addToPlaylist(a)),a.id):null},removeSong:function(b,d){b===c&&this.stop(),soundManager.destroySound(b),j.splice(d,1),a.$broadcast("player:playlist",j)},initPlayTrack:function(b,c){!0!==c&&(this.stop(),this.setCurrentTrack(b)),soundManager.play(b),a.$broadcast("track:id",b),g=!0,a.$broadcast("music:isPlaying",g)},play:function(){var a=null;if(null===this.getCurrentTrack()){if(0===soundManager.soundIDs.length)return void b.debug("playlist is empty!");a=soundManager.soundIDs[0],this.initPlayTrack(a)}else a=this.getCurrentTrack(),this.initPlayTrack(a,!0)},pause:function(){soundManager.pause(this.getCurrentTrack()),g=!1,a.$broadcast("music:isPlaying",g)},stop:function(){this.pause(),this.resetProgress(),a.$broadcast("track:progress",i),a.$broadcast("currentTrack:position",0),a.$broadcast("currentTrack:duration",0),soundManager.stopAll(),soundManager.unload(this.getCurrentTrack())},playTrack:function(a){this.initPlayTrack(a)},nextTrack:function(){if(null===this.getCurrentTrack())return b.debug("Please click on Play before this action"),null;var c=angular.copy(soundManager.soundIDs);!0===e&&(c=f);var h=this.getIndexByValue(c,this.getCurrentTrack()),i=+h+1,j=c[i];void 0!==j?this.playTrack(j):(!0===e&&!0===g&&(f=angular.copy(soundManager.soundIDs),f=f.sort(function(){return.5-Math.random()}),a.$broadcast("music:tempTrack",f)),!0===d?this.playTrack(c[0]):(g=!1,a.$broadcast("music:isPlaying",g)))},prevTrack:function(){if(null===this.getCurrentTrack())return b.debug("Please click on Play before this action"),null;var a=angular.copy(soundManager.soundIDs);!0===e&&(a=f);var c=this.getIndexByValue(a,this.getCurrentTrack()),d=+c-1,g=a[d];void 0!==g?this.playTrack(g):b.debug("no prev track found!")},mute:function(){!0===soundManager.muted?soundManager.unmute():soundManager.mute(),a.$broadcast("music:mute",soundManager.muted)},getMuteStatus:function(){return soundManager.muted},repeatToggle:function(){d=!0!==d,a.$broadcast("music:repeat",d)},getRepeatStatus:function(){return d},shuffleToggle:function(){!0===e?(e=!1,f=angular.copy(soundManager.soundIDs)):(e=!0,f=angular.copy(soundManager.soundIDs),f=f.sort(function(){return.5-Math.random()})),a.$broadcast("music:shuffle",e),a.$broadcast("music:tempTrack",f)},getShuffleStatus:function(){return e},getVolume:function(){return h},adjustVolume:function(b){var c=function(b){for(var c=0;c0&&(h-=10,c(h))},adjustVolumeSlider:function(b){!function(b){for(var c=0;c Date: Wed, 12 Apr 2017 18:33:20 +0700 Subject: [PATCH 5/8] add playShuffle feature --- Gruntfile.js | 1 + dist/angular-soundmanager2.js | 39 +++++++++++++++++++++++------ dist/angular-soundmanager2.min.js | 2 +- examples/index.html | 2 ++ src/03-factory-angularPlayer.js | 19 ++++++++++++-- src/21-directive-shuffleMusic.js | 4 --- src/22-directive-shuffleAllMusic.js | 13 ++++++++++ 7 files changed, 66 insertions(+), 14 deletions(-) create mode 100644 src/22-directive-shuffleAllMusic.js diff --git a/Gruntfile.js b/Gruntfile.js index d165cb3..b2f35a3 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -30,6 +30,7 @@ module.exports = function (grunt) { 'src/19-directive-volumeBar.js', 'src/20-directive-playPauseToggle.js', 'src/21-directive-shuffleMusic.js', + 'src/22-directive-shuffleAllMusic.js' ], dest: 'dist/angular-soundmanager2.js' } diff --git a/dist/angular-soundmanager2.js b/dist/angular-soundmanager2.js index 1664fb7..aa4c8eb 100644 --- a/dist/angular-soundmanager2.js +++ b/dist/angular-soundmanager2.js @@ -4697,7 +4697,7 @@ ngSoundManager.factory('angularPlayer', ['$rootScope', '$log', // generate shuffle track list if(shuffle === true && isPlaying === true){ tempTrack = angular.copy(soundManager.soundIDs); - tempTrack = (tempTrack).sort(function() { return 0.5 - Math.random() }); + tempTrack = (tempTrack).sort(function() { return 0.5 - Math.random(); }); $rootScope.$broadcast('music:tempTrack', tempTrack); } @@ -4762,7 +4762,7 @@ ngSoundManager.factory('angularPlayer', ['$rootScope', '$log', } else { shuffle = true; tempTrack = angular.copy(soundManager.soundIDs); - tempTrack = (tempTrack).sort(function() { return 0.5 - Math.random() }); + tempTrack = (tempTrack).sort(function() { return 0.5 - Math.random(); }); } $rootScope.$broadcast('music:shuffle', shuffle); $rootScope.$broadcast('music:tempTrack', tempTrack); @@ -4770,6 +4770,21 @@ ngSoundManager.factory('angularPlayer', ['$rootScope', '$log', getShuffleStatus: function() { return shuffle; }, + playShuffle: function(){ + var trackToPlay = null; + shuffle = true; + tempTrack = angular.copy(soundManager.soundIDs); + tempTrack = (tempTrack).sort(function() { return 0.5 - Math.random(); }); + $rootScope.$broadcast('music:shuffle', shuffle); + $rootScope.$broadcast('music:tempTrack', tempTrack); + + if(tempTrack.length === 0) { + $log.debug('playlist is empty!'); + return; + } + trackToPlay = tempTrack[0]; + this.initPlayTrack(trackToPlay); + }, getVolume: function() { return volume; }, @@ -5228,11 +5243,21 @@ ngSoundManager.directive('shuffleMusic', ['angularPlayer', function (angularPlay scope.$apply(function () { scope.shuffle = data; }); - - if(!angularPlayer.isPlayingStatus() && scope.shuffle) { - angularPlayer.play(); - } }); } }; - }]); \ No newline at end of file + }]); + +ngSoundManager.directive('shuffleAllMusic', ['angularPlayer', function (angularPlayer) { + return { + restrict: "EA", + link: function (scope, element, attrs) { + + element.bind('click', function (event) { + angularPlayer.playShuffle(); + }); + + scope.shuffle = angularPlayer.getShuffleStatus(); + } + }; +}]); \ No newline at end of file diff --git a/dist/angular-soundmanager2.min.js b/dist/angular-soundmanager2.min.js index f77ab0b..db977ba 100644 --- a/dist/angular-soundmanager2.min.js +++ b/dist/angular-soundmanager2.min.js @@ -1,3 +1,3 @@ /*! angular-soundmanager2 12-04-2017 */ !function(a,b){"use strict";function c(c,d){function e(a){return qa.preferFlash&&ja&&!qa.ignoreFlash&&qa.flash[a]!==b&&qa.flash[a]}function f(a){return function(b){var c,d=this._s;return d&&d._a?c=a.call(this,b):(d&&d.id?qa._wD(d.id+": Ignoring "+b.type):qa._wD(va+"Ignoring "+b.type),c=null),c}}this.setupOptions={url:c||null,flashVersion:8,debugMode:!0,debugFlash:!1,useConsole:!0,consoleOnly:!0,waitForWindowLoad:!1,bgColor:"#ffffff",useHighPerformance:!1,flashPollingInterval:null,html5PollingInterval:null,flashLoadTimeout:1e3,wmode:null,allowScriptAccess:"always",useFlashBlock:!1,useHTML5Audio:!0,html5Test:/^(probably|maybe)$/i,preferFlash:!1,noSWFCache:!1,idPrefix:"sound"},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,duration:null},this.audioFormats={mp3:{type:['audio/mpeg; codecs="mp3"',"audio/mpeg","audio/mp3","audio/MPA","audio/mpa-robust"],required:!0},mp4:{related:["aac","m4a","m4b"],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},opus:{type:["audio/ogg; codecs=opus","audio/opus"],required:!1},wav:{type:['audio/wav; codecs="1"',"audio/wav","audio/wave","audio/x-wav"],required:!1}},this.movieID="sm2-container",this.id=d||"sm2movie",this.debugID="soundmanager-debug",this.debugURLParam=/([#?&])debug=1/i,this.versionNumber="V2.97a.20140901",this.version=null,this.movieURL=null,this.altURL=null,this.swfLoaded=!1,this.enabled=!1,this.oMC=null,this.sounds={},this.soundIDs=[],this.muted=!1,this.didFlashBlock=!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={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},this.html5={usingFlash:null},this.flash={},this.html5Only=!1,this.ignoreFlash=!1;var g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,$,_,aa,ba,ca,da,ea,fa,ga,ha,ia,ja,ka,la,ma,na,oa,pa,qa=this,ra=null,sa=null,ta="soundManager",ua=ta+": ",va="HTML5::",wa=navigator.userAgent,xa=a.location.href.toString(),ya=document,za=[],Aa=!0,Ba=!1,Ca=!1,Da=!1,Ea=!1,Fa=!1,Ga=0,Ha=["log","info","warn","error"],Ia=8,Ja=null,Ka=null,La=!1,Ma=!1,Na=0,Oa=null,Pa=[],Qa=null,Ra=Array.prototype.slice,Sa=!1,Ta=0,Ua=wa.match(/(ipad|iphone|ipod)/i),Va=wa.match(/android/i),Wa=wa.match(/msie/i),Xa=wa.match(/webkit/i),Ya=wa.match(/safari/i)&&!wa.match(/chrome/i),Za=wa.match(/opera/i),$a=wa.match(/(mobile|pre\/|xoom)/i)||Ua||Va,_a=!xa.match(/usehtml5audio/i)&&!xa.match(/sm2\-ignorebadua/i)&&Ya&&!wa.match(/silk/i)&&wa.match(/OS X 10_6_([3-7])/i),ab=a.console!==b&&console.log!==b,bb=ya.hasFocus!==b?ya.hasFocus():null,cb=Ya&&(ya.hasFocus===b||!ya.hasFocus()),db=!cb,eb=/(mp3|mp4|mpa|m4a|m4b)/i,fb=1e3,gb="about:blank",hb=ya.location?ya.location.protocol.match(/http/i):null,ib=hb?"":"http://",jb=/^\s*audio\/(?:x-)?(?:mpeg4|aac|flv|mov|mp4||m4v|m4a|m4b|mp4v|3gp|3g2)\s*(?:$|;)/i,kb=["mpeg4","aac","flv","mov","mp4","m4v","f4v","m4a","m4b","mp4v","3gp","3g2"],lb=new RegExp("\\.("+kb.join("|")+")(\\?.*)?$","i");this.mimePattern=/^\s*audio\/(?:x-)?(?:mp(?:eg|3))\s*(?:$|;)/i,this.useAltURL=!hb,R={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.hasHTML5=function(){try{return Audio!==b&&(Za&&opera!==b&&opera.version()<10?new Audio(null):new Audio).canPlayType!==b}catch(a){return!1}}(),this.setup=function(a){var c=!qa.url;return a!==b&&Da&&Qa&&qa.ok()&&(a.flashVersion!==b||a.url!==b||a.html5Test!==b)&&V(O("setupLate")),q(a),a&&(c&&F&&a.url!==b&&qa.beginDelayedInit(),F||a.url===b||"complete"!==ya.readyState||setTimeout(D,1)),qa},this.ok=function(){return Qa?Da&&!Ea:qa.useHTML5Audio&&qa.hasHTML5},this.supported=this.ok,this.getMovie=function(b){return h(b)||ya[b]||a[b]},this.createSound=function(a,c){function d(){return h=T(h),qa.sounds[h.id]=new g(h),qa.soundIDs.push(h.id),qa.sounds[h.id]}var e,f,h,i=null;if(e=ta+".createSound(): ",f=e+O(Da?"notOK":"notReady"),!Da||!qa.ok())return V(f),!1;if(c!==b&&(a={id:a,url:c}),h=p(a),h.url=$(h.url),void 0===h.id&&(h.id=qa.setupOptions.idPrefix+Ta++),h.id.toString().charAt(0).match(/^[0-9]$/)&&qa._wD(e+O("badID",h.id),2),qa._wD(e+h.id+(h.url?" ("+h.url+")":""),1),W(h.id,!0))return qa._wD(e+h.id+" exists",1),qa.sounds[h.id];if(ba(h))i=d(),qa._wD(h.id+": Using HTML5"),i._setup_html5(h);else{if(qa.html5Only)return qa._wD(h.id+": No HTML5 support for this sound, and no Flash. Exiting."),d();if(qa.html5.usingFlash&&h.url&&h.url.match(/data\:/i))return qa._wD(h.id+": data: URIs not supported via Flash. Exiting."),d();l>8&&(null===h.isMovieStar&&(h.isMovieStar=!!(h.serverURL||h.type&&h.type.match(jb)||h.url&&h.url.match(lb))),h.isMovieStar&&(qa._wD(e+"using MovieStar handling"),h.loops>1&&n("noNSLoop"))),h=U(h,e),i=d(),8===l?sa._createSound(h.id,h.loops||1,h.usePolicyFile):(sa._createSound(h.id,h.url,h.usePeakData,h.useWaveformData,h.useEQData,h.isMovieStar,!!h.isMovieStar&&h.bufferTime,h.loops||1,h.serverURL,h.duration||null,h.autoPlay,!0,h.autoLoad,h.usePolicyFile),h.serverURL||(i.connected=!0,h.onconnect&&h.onconnect.apply(i))),h.serverURL||!h.autoLoad&&!h.autoPlay||i.load(h)}return!h.serverURL&&h.autoPlay&&i.play(),i},this.destroySound=function(a,b){if(!W(a))return!1;var c,d=qa.sounds[a];for(d._iO={},d.stop(),d.unload(),c=0;c=0;a--)qa.sounds[qa.soundIDs[a]].pause()},this.resume=function(a){return!!W(a)&&qa.sounds[a].resume()},this.resumeAll=function(){var a;for(a=qa.soundIDs.length-1;a>=0;a--)qa.sounds[qa.soundIDs[a]].resume()},this.togglePause=function(a){return!!W(a)&&qa.sounds[a].togglePause()},this.setPan=function(a,b){return!!W(a)&&qa.sounds[a].setPan(b)},this.setVolume=function(a,b){return!!W(a)&&qa.sounds[a].setVolume(b)},this.mute=function(a){var b=0;if(a instanceof String&&(a=null),a)return!!W(a)&&(qa._wD(ta+'.mute(): Muting "'+a+'"'),qa.sounds[a].mute());for(qa._wD(ta+".mute(): Muting all sounds"),b=qa.soundIDs.length-1;b>=0;b--)qa.sounds[qa.soundIDs[b]].mute();return qa.muted=!0,!0},this.muteAll=function(){qa.mute()},this.unmute=function(a){var b;if(a instanceof String&&(a=null),a)return!!W(a)&&(qa._wD(ta+'.unmute(): Unmuting "'+a+'"'),qa.sounds[a].unmute());for(qa._wD(ta+".unmute(): Unmuting all sounds"),b=qa.soundIDs.length-1;b>=0;b--)qa.sounds[qa.soundIDs[b]].unmute();return qa.muted=!1,!0},this.unmuteAll=function(){qa.unmute()},this.toggleMute=function(a){return!!W(a)&&qa.sounds[a].toggleMute()},this.getMemoryUse=function(){var a=0;return sa&&8!==l&&(a=parseInt(sa._getMemoryUse(),10)),a},this.disable=function(c){var d;if(c===b&&(c=!1),Ea)return!1;for(Ea=!0,n("shutdown",1),d=qa.soundIDs.length-1;d>=0;d--)L(qa.sounds[qa.soundIDs[d]]);return o(c),ha.remove(a,"load",u),!0},this.canPlayMIME=function(a){var b;return qa.hasHTML5&&(b=ca({type:a})),!b&&Qa&&(b=a&&qa.ok()?!!((l>8?a.match(jb):null)||a.match(qa.mimePattern)):null),b},this.canPlayURL=function(a){var b;return qa.hasHTML5&&(b=ca({url:a})),!b&&Qa&&(b=a&&qa.ok()?!!a.match(qa.filePattern):null),b},this.canPlayLink=function(a){return!(a.type===b||!a.type||!qa.canPlayMIME(a.type))||qa.canPlayURL(a.href)},this.getSoundById=function(a,b){if(!a)return null;var c=qa.sounds[a];return c||b||qa._wD(ta+'.getSoundById(): Sound "'+a+'" not found.',2),c},this.onready=function(b,c){var d="onready";if("function"!=typeof b)throw O("needFunction",d);return Da&&qa._wD(O("queue",d)),c||(c=a),s(d,b,c),t(),!0},this.ontimeout=function(b,c){var d="ontimeout";if("function"!=typeof b)throw O("needFunction",d);return Da&&qa._wD(O("queue",d)),c||(c=a),s(d,b,c),t({type:d}),!0},this._writeDebug=function(a,c){var d,e;return!(!qa.debugMode||!(ab&&qa.useConsole&&(c&&"object"==typeof c?console.log(a,c):Ha[c]!==b?console[Ha[c]](a):console.log(a),qa.consoleOnly))&&(!(d=h("soundmanager-debug"))||(e=ya.createElement("div"),++Ga%2==0&&(e.className="sm2-alt"),c=c===b?0:parseInt(c,10),e.appendChild(ya.createTextNode(a)),c&&(c>=2&&(e.style.fontWeight="bold"),3===c&&(e.style.color="#ff3333")),d.insertBefore(e,d.firstChild),d=null,0)))},-1!==xa.indexOf("sm2-debug=alert")&&(this._writeDebug=function(b){a.alert(b)}),this._wD=this._writeDebug,this._debug=function(){var a,b;for(n("currentObj",1),a=0,b=qa.soundIDs.length;a=0;d--)qa.sounds[qa.soundIDs[d]].destruct();if(sa)try{Wa&&(Ka=sa.innerHTML),Ja=sa.parentNode.removeChild(sa)}catch(a){n("badRemove",2)}if(Ka=Ja=Qa=sa=null,qa.enabled=F=Da=La=Ma=Ba=Ca=Ea=Sa=qa.swfLoaded=!1,qa.soundIDs=[],qa.sounds={},Ta=0,b)za=[];else for(d in za)if(za.hasOwnProperty(d))for(e=0,f=za[d].length;e0&&q.position===q.duration&&(qa._wD(d+"Sound at end, resetting to position:0"),a.position=0),q.paused&&q.position>=0&&(!q._iO.serverURL||q.position>0))qa._wD(d+"Resuming from paused state",1),q.resume();else{if(q._iO=p(a,q._iO),(!q.isHTML5&&null!==q._iO.position&&q._iO.position>0||null!==q._iO.from&&q._iO.from>0||null!==q._iO.to)&&0===q.instanceCount&&0===q.playState&&!q._iO.serverURL){if(i=function(){q._iO=p(a,q._iO),q.play(q._iO)},q.isHTML5&&!q._html5_canplay?(qa._wD(d+"Beginning load for non-zero offset case"),q.load({_oncanplay:i}),t=!1):q.isHTML5||q.loaded||q.readyState&&2===q.readyState||(qa._wD(d+"Preloading for non-zero offset case"),q.load({onload:i}),t=!1),null!==t)return t;q._iO=j()}(!q.instanceCount||q._iO.multiShotEvents||q.isHTML5&&q._iO.multiShot&&!Sa||!q.isHTML5&&l>8&&!q.getAutoPlay())&&q.instanceCount++,q._iO.onposition&&0===q.playState&&h(q),q.playState=1,q.paused=!1,q.position=q._iO.position===b||isNaN(q._iO.position)?0:q._iO.position,q.isHTML5||(q._iO=U(T(q._iO))),q._iO.onplay&&c&&(q._iO.onplay.apply(q),r=!0),q.setVolume(q._iO.volume,!0),q.setPan(q._iO.pan,!0),q.isHTML5?q.instanceCount<2?(g(),f=q._setup_html5(),q.setPosition(q._iO.position),f.play()):(qa._wD(q.id+": Cloning Audio() for instance #"+q.instanceCount+"..."),k=new Audio(q._iO.url),m=function(){ha.remove(k,"ended",m),q._onfinish(q),ea(k),k=null},n=function(){ha.remove(k,"canplay",n);try{k.currentTime=q._iO.position/fb}catch(a){V(q.id+": multiShot play() failed to apply position of "+q._iO.position/fb)}k.play()},ha.add(k,"ended",m),void 0!==q._iO.volume&&(k.volume=Math.max(0,Math.min(1,q._iO.volume/100))),q.muted&&(k.muted=!0),q._iO.position?ha.add(k,"canplay",n):k.play()):(s=sa._start(q.id,q._iO.loops||1,9===l?q.position:q.position/fb,q._iO.multiShot||!1),9!==l||s||(qa._wD(d+"No sound hardware, or 32-sound ceiling hit",2),q._iO.onplayerror&&q._iO.onplayerror.apply(q)))}return q},this.start=this.play,this.stop=function(a){var b,c=q._iO;return 1===q.playState&&(qa._wD(q.id+": stop()"),q._onbufferchange(0),q._resetOnPosition(0),q.paused=!1,q.isHTML5||(q.playState=0),i(),c.to&&q.clearOnPosition(c.to),q.isHTML5?q._a&&(b=q.position,q.setPosition(0),q.position=b,q._a.pause(),q.playState=0,q._onTimer(),f()):(sa._stop(q.id,a),c.serverURL&&q.unload()),q.instanceCount=0,q._iO={},c.onstop&&c.onstop.apply(q)),q},this.setAutoPlay=function(a){qa._wD(q.id+": Autoplay turned "+(a?"on":"off")),q._iO.autoPlay=a,q.isHTML5||(sa._setAutoPlay(q.id,a),a&&(q.instanceCount||1!==q.readyState||(q.instanceCount++,qa._wD(q.id+": Incremented instance count to "+q.instanceCount))))},this.getAutoPlay=function(){return q._iO.autoPlay},this.setPosition=function(a){a===b&&(a=0);var c,d,e=q.isHTML5?Math.max(a,0):Math.min(q.duration||q._iO.duration,Math.max(a,0));if(q.position=e,d=q.position/fb,q._resetOnPosition(q.position),q._iO.position=e,q.isHTML5){if(q._a){if(q._html5_canplay){if(q._a.currentTime!==d){qa._wD(q.id+": setPosition("+d+")");try{q._a.currentTime=d,(0===q.playState||q.paused)&&q._a.pause()}catch(a){qa._wD(q.id+": setPosition("+d+") failed: "+a.message,2)}}}else if(d)return qa._wD(q.id+": setPosition("+d+"): Cannot seek yet, sound not ready",2),q;q.paused&&q._onTimer(!0)}}else c=9===l?q.position:d,q.readyState&&2!==q.readyState&&sa._setPosition(q.id,c,q.paused||!q.playState,q._iO.multiShot);return q},this.pause=function(a){return q.paused||0===q.playState&&1!==q.readyState?q:(qa._wD(q.id+": pause()"),q.paused=!0,q.isHTML5?(q._setup_html5().pause(),f()):(a||a===b)&&sa._pause(q.id,q._iO.multiShot),q._iO.onpause&&q._iO.onpause.apply(q),q)},this.resume=function(){var a=q._iO;return q.paused?(qa._wD(q.id+": resume()"),q.paused=!1,q.playState=1,q.isHTML5?(q._setup_html5().play(),g()):(a.isMovieStar&&!a.serverURL&&q.setPosition(q.position),sa._pause(q.id,a.multiShot)),!r&&a.onplay?(a.onplay.apply(q),r=!0):a.onresume&&a.onresume.apply(q),q):q},this.togglePause=function(){return qa._wD(q.id+": togglePause()"),0===q.playState?(q.play({position:9!==l||q.isHTML5?q.position/fb:q.position}),q):(q.paused?q.resume():q.pause(),q)},this.setPan=function(a,c){return a===b&&(a=0),c===b&&(c=!1),q.isHTML5||sa._setPan(q.id,a),q._iO.pan=a,c||(q.pan=a,q.options.pan=a),q},this.setVolume=function(a,c){return a===b&&(a=100),c===b&&(c=!1),q.isHTML5?q._a&&(qa.muted&&!q.muted&&(q.muted=!0,q._a.muted=!0),q._a.volume=Math.max(0,Math.min(1,a/100))):sa._setVolume(q.id,qa.muted&&!q.muted||q.muted?0:a),q._iO.volume=a,c||(q.volume=a,q.options.volume=a),q},this.mute=function(){return q.muted=!0,q.isHTML5?q._a&&(q._a.muted=!0):sa._setVolume(q.id,0),q},this.unmute=function(){q.muted=!1;var a=q._iO.volume!==b;return q.isHTML5?q._a&&(q._a.muted=!1):sa._setVolume(q.id,a?q._iO.volume:q.options.volume),q},this.toggleMute=function(){return q.muted?q.unmute():q.mute()},this.onPosition=function(a,c,d){return s.push({position:parseInt(a,10),method:c,scope:d!==b?d:q,fired:!1}),q},this.onposition=this.onPosition,this.clearOnPosition=function(a,b){var c;if(a=parseInt(a,10),isNaN(a))return!1;for(c=0;c=c)return!1;for(a=c-1;a>=0;a--)b=s[a],!b.fired&&q.position>=b.position&&(b.fired=!0,t++,b.method.apply(b.scope,[b.position]),c=s.length);return!0},this._resetOnPosition=function(a){var b,c,d=s.length;if(!d)return!1;for(b=d-1;b>=0;b--)c=s[b],c.fired&&a<=c.position&&(c.fired=!1,t--);return!0},j=function(){var a,b,c=q._iO,d=c.from,e=c.to;return b=function(){qa._wD(q.id+': "To" time of '+e+" reached."),q.clearOnPosition(e,b),q.stop()},a=function(){qa._wD(q.id+': Playing "from" '+d),null===e||isNaN(e)||q.onPosition(e,b)},null===d||isNaN(d)||(c.position=d,c.multiShot=!1,a()),c},h=function(){var a,b=q._iO.onposition;if(b)for(a in b)b.hasOwnProperty(a)&&q.onPosition(parseInt(a,10),b[a])},i=function(){var a,b=q._iO.onposition;if(b)for(a in b)b.hasOwnProperty(a)&&q.clearOnPosition(parseInt(a,10))},g=function(){q.isHTML5&&X(q)},f=function(){q.isHTML5&&Y(q)},c=function(a){a||(s=[],t=0),r=!1,q._hasTimer=null,q._a=null,q._html5_canplay=!1,q.bytesLoaded=null,q.bytesTotal=null,q.duration=q._iO&&q._iO.duration?q._iO.duration:null,q.durationEstimate=null,q.buffered=[],q.eqData=[],q.eqData.left=[],q.eqData.right=[],q.failures=0,q.isBuffering=!1,q.instanceOptions={},q.instanceCount=0,q.loaded=!1,q.metadata={},q.readyState=0,q.muted=!1,q.paused=!1,q.peakData={left:0,right:0},q.waveformData={left:[],right:[]},q.playState=0,q.position=null,q.id3={}},c(),this._onTimer=function(a){var b,c,d=!1,e={};if(q._hasTimer||a)return q._a&&(a||(q.playState>0||1===q.readyState)&&!q.paused)&&(b=q._get_html5_duration(),b!==k.duration&&(k.duration=b,q.duration=b,d=!0),q.durationEstimate=q.duration,c=q._a.currentTime*fb||0,c!==k.time&&(k.time=c,d=!0),(d||a)&&q._whileplaying(c,e,e,e,e)),d},this._get_html5_duration=function(){var a=q._iO,b=q._a&&q._a.duration?q._a.duration*fb:a&&a.duration?a.duration:null;return b&&!isNaN(b)&&b!==1/0?b:null},this._apply_loop=function(a,b){!a.loop&&b>1&&qa._wD("Note: Native HTML5 looping is infinite.",1),a.loop=b>1?"loop":""},this._setup_html5=function(a){var b,e=p(q._iO,a),f=Sa?ra:q._a,g=decodeURI(e.url);if(Sa?g===decodeURI(ia)&&(b=!0):g===decodeURI(u)&&(b=!0),f){if(f._s)if(Sa)f._s&&f._s.playState&&!b&&f._s.stop();else if(!Sa&&g===decodeURI(u))return q._apply_loop(f,e.loops),f;b||(u&&c(!1),f.src=e.url,q.url=e.url,u=e.url,ia=e.url,f._called_load=!1)}else e.autoLoad||e.autoPlay?(q._a=new Audio(e.url),q._a.load()):q._a=Za&&opera.version()<10?new Audio(null):new Audio,f=q._a,f._called_load=!1,Sa&&(ra=f);return q.isHTML5=!0,q._a=f,f._s=q,d(),q._apply_loop(f,e.loops),e.autoLoad||e.autoPlay?q.load():(f.autobuffer=!1,f.preload="auto"),f},d=function(){function a(a,b,c){return q._a?q._a.addEventListener(a,b,c||!1):null}if(q._a._added_events)return!1;var b;q._a._added_events=!0;for(b in ma)ma.hasOwnProperty(b)&&a(b,ma[b]);return!0},e=function(){function a(a,b,c){return q._a?q._a.removeEventListener(a,b,c||!1):null}var b;qa._wD(q.id+": Removing event listeners"),q._a._added_events=!1;for(b in ma)ma.hasOwnProperty(b)&&a(b,ma[b])},this._onload=function(a){var b,c=!!a||!q.isHTML5&&8===l&&q.duration;return b=q.id+": ",qa._wD(b+(c?"onload()":"Failed to load / invalid sound?"+(q.duration?" -":" Zero-length duration reported.")+" ("+q.url+")"),c?1:2),c||q.isHTML5||(!0===qa.sandbox.noRemote&&qa._wD(b+O("noNet"),1),!0===qa.sandbox.noLocal&&qa._wD(b+O("noLocal"),1)),q.loaded=c,q.readyState=c?3:2,q._onbufferchange(0),q._iO.onload&&pa(q,function(){q._iO.onload.apply(q,[c])}),!0},this._onbufferchange=function(a){return!(0===q.playState||a&&q.isBuffering||!a&&!q.isBuffering||(q.isBuffering=1===a,q._iO.onbufferchange&&(qa._wD(q.id+": Buffer state change: "+a),q._iO.onbufferchange.apply(q,[a])),0))},this._onsuspend=function(){return q._iO.onsuspend&&(qa._wD(q.id+": Playback suspended"),q._iO.onsuspend.apply(q)),!0},this._onfailure=function(a,b,c){q.failures++,qa._wD(q.id+": Failure ("+q.failures+"): "+a),q._iO.onfailure&&1===q.failures?q._iO.onfailure(a,b,c):qa._wD(q.id+": Ignoring failure")},this._onwarning=function(a,b,c){q._iO.onwarning&&q._iO.onwarning(a,b,c)},this._onfinish=function(){var a=q._iO.onfinish;q._onbufferchange(0),q._resetOnPosition(0),q.instanceCount&&(q.instanceCount--,q.instanceCount||(i(),q.playState=0,q.paused=!1,q.instanceCount=0,q.instanceOptions={},q._iO={},f(),q.isHTML5&&(q.position=0)),q.instanceCount&&!q._iO.multiShotEvents||a&&(qa._wD(q.id+": onfinish()"),pa(q,function(){a.apply(q)})))},this._whileloading=function(a,b,c,d){var e=q._iO;q.bytesLoaded=a,q.bytesTotal=b,q.duration=Math.floor(c),q.bufferLength=d,q.isHTML5||e.isMovieStar?q.durationEstimate=q.duration:e.duration?q.durationEstimate=q.duration>e.duration?q.duration:e.duration:q.durationEstimate=parseInt(q.bytesTotal/q.bytesLoaded*q.duration,10),q.isHTML5||(q.buffered=[{start:0,end:q.duration}]),(3!==q.readyState||q.isHTML5)&&e.whileloading&&e.whileloading.apply(q)},this._whileplaying=function(a,c,d,e,f){var g,h=q._iO;return!isNaN(a)&&null!==a&&(q.position=Math.max(0,a),q._processOnPosition(),!q.isHTML5&&l>8&&(h.usePeakData&&c!==b&&c&&(q.peakData={left:c.leftPeak,right:c.rightPeak}),h.useWaveformData&&d!==b&&d&&(q.waveformData={left:d.split(","),right:e.split(",")}),h.useEQData&&f!==b&&f&&f.leftEQ&&(g=f.leftEQ.split(","),q.eqData=g,q.eqData.left=g,f.rightEQ!==b&&f.rightEQ&&(q.eqData.right=f.rightEQ.split(",")))),1===q.playState&&(q.isHTML5||8!==l||q.position||!q.isBuffering||q._onbufferchange(0),h.whileplaying&&h.whileplaying.apply(q)),!0)},this._oncaptiondata=function(a){qa._wD(q.id+": Caption data received."),q.captiondata=a,q._iO.oncaptiondata&&q._iO.oncaptiondata.apply(q,[a])},this._onmetadata=function(a,b){qa._wD(q.id+": Metadata received.");var c,d,e={};for(c=0,d=a.length;c0&&(qa._wD(q.id+": Data error: "+a),q._iO.ondataerror&&q._iO.ondataerror.apply(q))},this._debug()},G=function(){return ya.body||ya.getElementsByTagName("div")[0]},h=function(a){return ya.getElementById(a)},p=function(a,c){var d,e,f=a||{};d=c===b?qa.defaultOptions:c;for(e in d)d.hasOwnProperty(e)&&f[e]===b&&("object"!=typeof d[e]||null===d[e]?f[e]=d[e]:f[e]=p(f[e],d[e]));return f},pa=function(b,c){b.isHTML5||8!==l?c():a.setTimeout(c,0)},r={onready:1,ontimeout:1,defaultOptions:1,flash9Options:1,movieStarOptions:1},q=function(a,c){var d,e=!0,f=c!==b,g=qa.setupOptions,h=r;if(a===b){e=[];for(d in g)g.hasOwnProperty(d)&&e.push(d);for(d in h)h.hasOwnProperty(d)&&("object"==typeof qa[d]?e.push(d+": {...}"):qa[d]instanceof Function?e.push(d+": function() {...}"):e.push(d));return qa._wD(O("setup",e.join(", "))),!1}for(d in a)if(a.hasOwnProperty(d))if("object"!=typeof a[d]||null===a[d]||a[d]instanceof Array||a[d]instanceof RegExp)f&&h[c]!==b?qa[c][d]=a[d]:g[d]!==b?(qa.setupOptions[d]=a[d],qa[d]=a[d]):h[d]===b?(V(O(qa[d]===b?"setupUndef":"setupError",d),2),e=!1):qa[d]instanceof Function?qa[d].apply(qa,a[d]instanceof Array?a[d]:[a[d]]):qa[d]=a[d];else{if(h[d]!==b)return q(a[d],d);V(O(qa[d]===b?"setupUndef":"setupError",d),2),e=!1}return e},ha=function(){function b(a){var b=Ra.call(a),c=b.length;return f?(b[1]="on"+b[1],c>3&&b.pop()):3===c&&b.push(!1),b}function c(a,b){var c=a.shift(),d=[g[b]];f?c[d](a[0],a[1]):c[d].apply(c,a)}function d(){c(b(arguments),"add")}function e(){c(b(arguments),"remove")}var f=a.attachEvent,g={add:f?"attachEvent":"addEventListener",remove:f?"detachEvent":"removeEventListener"};return{add:d,remove:e}}(),ma={abort:f(function(){qa._wD(this._s.id+": abort")}),canplay:f(function(){var a,c=this._s;if(c._html5_canplay)return!0;if(c._html5_canplay=!0,qa._wD(c.id+": canplay"),c._onbufferchange(0),a=c._iO.position===b||isNaN(c._iO.position)?null:c._iO.position/fb,this.currentTime!==a){qa._wD(c.id+": canplay: Setting position to "+a);try{this.currentTime=a}catch(b){qa._wD(c.id+": canplay: Setting position of "+a+" failed: "+b.message,2)}}c._iO._oncanplay&&c._iO._oncanplay()}),canplaythrough:f(function(){var a=this._s;a.loaded||(a._onbufferchange(0),a._whileloading(a.bytesLoaded,a.bytesTotal,a._get_html5_duration()),a._onload(!0))}),durationchange:f(function(){var a,b=this._s;a=b._get_html5_duration(),isNaN(a)||a===b.duration||(qa._wD(this._s.id+": durationchange ("+a+")"+(b.duration?", previously "+b.duration:"")),b.durationEstimate=b.duration=a)}),ended:f(function(){var a=this._s;qa._wD(a.id+": ended"),a._onfinish()}),error:f(function(){qa._wD(this._s.id+": HTML5 error, code "+this.error.code),this._s._onload(!1)}),loadeddata:f(function(){var a=this._s;qa._wD(a.id+": loadeddata"),a._loaded||Ya||(a.duration=a._get_html5_duration())}),loadedmetadata:f(function(){qa._wD(this._s.id+": loadedmetadata")}),loadstart:f(function(){qa._wD(this._s.id+": loadstart"),this._s._onbufferchange(1)}),play:f(function(){this._s._onbufferchange(0)}),playing:f(function(){qa._wD(this._s.id+": playing "+String.fromCharCode(9835)),this._s._onbufferchange(0)}),progress:f(function(a){var b,c,d,e=this._s,f=0,g="progress"===a.type,h=a.target.buffered,i=a.loaded||0,j=a.total||1;if(e.buffered=[],h&&h.length){for(b=0,c=h.length;b1){for(d=[],c=h.length,b=0;b=0;f--)h["audio/"+e[c].related[f]]=h[c],qa.html5[e[c].related[f]]=h[c],qa.flash[e[c].related[f]]=h[c];return h.canPlayType=g?a:null,qa.html5=p(qa.html5,h),qa.html5.usingFlash=aa(),Qa=qa.html5.usingFlash,!0},A={notReady:"Unavailable - wait until onready() has fired.",notOK:"Audio support is not available.",domError:ta+"exception caught while appending SWF to DOM.",spcWmode:"Removing wmode, preventing known SWF loading issue(s)",swf404:ua+"Verify that %s is a valid path.",tryDebug:"Try "+ta+".debugFlash = true for more security details (output goes to SWF.)",checkSWF:"See SWF output for more debug info.",localFail:ua+"Non-HTTP page ("+ya.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:ua+"Special case: Waiting for SWF to load with window focus...",waitForever:ua+"Waiting indefinitely for Flash (will recover if unblocked)...",waitSWF:ua+"Waiting for 100% SWF load...",needFunction:ua+"Function object expected for %s",badID:'Sound ID "%s" should be a string, starting with a non-numeric character',currentObj:ua+"_debug(): Current sound objects",waitOnload:ua+"Waiting for window.onload()",docLoaded:ua+"Document already loaded",onload:ua+"initComplete(): calling soundManager.onload()",onloadOK:ta+".onload() complete",didInit:ua+"init(): Already called?",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",badRemove:ua+"Failed to remove Flash node.",shutdown:ta+".disable(): Shutting down",queue:ua+"Queueing %s handler",smError:"SMSound.load(): Exception: JS-Flash communication failed, or JS error.",fbTimeout:"No flash response, applying ."+R.swfTimedout+" CSS...",fbLoaded:"Flash loaded",fbHandler:ua+"flashBlockHandler()",manURL:"SMSound.load(): Using manually-assigned URL",onURL:ta+".load(): current URL already assigned.",badFV:ta+'.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",needFlash:ua+"Fatal error: Flash is needed to play some required formats, but is not available.",gotFocus:ua+"Got window focus.",policy:"Enabling usePolicyFile for data access",setup:ta+".setup(): allowed parameters: %s",setupError:ta+'.setup(): "%s" cannot be assigned with this method.',setupUndef:ta+'.setup(): Could not find option "%s"',setupLate:ta+".setup(): url, flashVersion and html5Test property changes will not take effect until reboot().",noURL:ua+"Flash URL required. Call soundManager.setup({url:...}) to get started.",sm2Loaded:"SoundManager 2: Ready. "+String.fromCharCode(10003),reset:ta+".reset(): Removing event callbacks",mobileUA:"Mobile UA detected, preferring HTML5 by default.",globalHTML5:"Using singleton HTML5 Audio() pattern for this device."},O=function(){var a,b,c,d,e;if(a=Ra.call(arguments),d=a.shift(),(e=A&&A[d]?A[d]:"")&&a&&a.length)for(b=0,c=a.length;b1&&a.stream&&(n("as2loop"),a.stream=!1),a},U=function(a,b){return a&&!a.usePolicyFile&&(a.onid3||a.usePeakData||a.useWaveformData||a.useEQData)&&(qa._wD((b||"")+O("policy")),a.usePolicyFile=!0),a},V=function(a){ab&&console.warn!==b?console.warn(a):qa._wD(a)},i=function(){return!1},L=function(a){var b;for(b in a)a.hasOwnProperty(b)&&"function"==typeof a[b]&&(a[b]=i);b=null},M=function(a){a===b&&(a=!1),(Ea||a)&&qa.disable(a)},N=function(a){var b;if(a)if(a.match(/\.swf(\?.*)?$/i)){if(a.substr(a.toLowerCase().lastIndexOf(".swf?")+4))return a}else a.lastIndexOf("/")!==a.length-1&&(a+="/");return b=(a&&-1!==a.lastIndexOf("/")?a.substr(0,a.lastIndexOf("/")+1):"./")+qa.movieURL,qa.noSWFCache&&(b+="?ts="+(new Date).getTime()),b},y=function(){8!==(l=parseInt(qa.flashVersion,10))&&9!==l&&(qa._wD(O("badFV",l,Ia)),qa.flashVersion=l=Ia);var a=qa.debugMode||qa.debugFlash?"_debug.swf":".swf";qa.useHTML5Audio&&!qa.html5Only&&qa.audioFormats.mp4.required&&l<9&&(qa._wD(O("needfl9")),qa.flashVersion=l=9),qa.version=qa.versionNumber+(qa.html5Only?" (HTML5-only mode)":9===l?" (AS3/Flash 9)":" (AS2/Flash 8)"),l>8?(qa.defaultOptions=p(qa.defaultOptions,qa.flash9Options),qa.features.buffering=!0,qa.defaultOptions=p(qa.defaultOptions,qa.movieStarOptions),qa.filePatterns.flash9=new RegExp("\\.(mp3|"+kb.join("|")+")(\\?.*)?$","i"),qa.features.movieStar=!0):qa.features.movieStar=!1,qa.filePattern=qa.filePatterns[8!==l?"flash9":"flash8"],qa.movieURL=(8===l?"soundmanager2.swf":"soundmanager2_flash9.swf").replace(".swf",a),qa.features.peakData=qa.features.waveformData=qa.features.eqData=l>8},J=function(a,b){if(!sa)return!1;sa._setPolling(a,b)},K=function(){if(qa.debugURLParam.test(xa)&&(qa.debugMode=!0),h(qa.debugID))return!1;var a,b,c,d,e;if(qa.debugMode&&!h(qa.debugID)&&(!ab||!qa.useConsole||!qa.consoleOnly)){a=ya.createElement("div"),a.id=qa.debugID+"-toggle",d={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},a.appendChild(ya.createTextNode("-")),a.onclick=S,a.title="Toggle SM2 debug console",wa.match(/msie 6/i)&&(a.style.position="absolute",a.style.cursor="hand");for(e in d)d.hasOwnProperty(e)&&(a.style[e]=d[e]);if(b=ya.createElement("div"),b.id=qa.debugID,b.style.display=qa.debugMode?"block":"none",qa.debugMode&&!h(a.id)){try{c=G(),c.appendChild(a)}catch(a){throw new Error(O("domError")+" \n"+a.toString())}c.appendChild(b)}}c=null},W=this.getSoundById,n=function(a,b){return a?qa._wD(O(a),b):""},S=function(){var a=h(qa.debugID),b=h(qa.debugID+"-toggle");if(!a)return!1;Aa?(b.innerHTML="+",a.style.display="none"):(b.innerHTML="-",a.style.display="block"),Aa=!Aa},m=function(c,d,e){if(a.sm2Debugger!==b)try{sm2Debugger.handleEvent(c,d,e)}catch(a){return!1}return!0},Q=function(){var a=[];return qa.debugMode&&a.push(R.sm2Debug),qa.debugFlash&&a.push(R.flashDebug),qa.useHighPerformance&&a.push(R.highPerf),a.join(" ")},P=function(){var a=O("fbHandler"),b=qa.getMoviePercent(),c=R,d={type:"FLASHBLOCK"};if(qa.html5Only)return!1;qa.ok()?(qa.didFlashBlock&&qa._wD(a+": Unblocked"),qa.oMC&&(qa.oMC.className=[Q(),c.swfDefault,c.swfLoaded+(qa.didFlashBlock?" "+c.swfUnblocked:"")].join(" "))):(Qa&&(qa.oMC.className=Q()+" "+c.swfDefault+" "+(null===b?c.swfTimedout:c.swfError),qa._wD(a+": "+O("fbTimeout")+(b?" ("+O("fbLoaded")+")":""))),qa.didFlashBlock=!0,t({type:"ontimeout",ignoreInit:!0,error:d}),I(d))},s=function(a,c,d){za[a]===b&&(za[a]=[]),za[a].push({method:c,scope:d||null,fired:!1})},t=function(a){if(a||(a={type:qa.ok()?"onready":"ontimeout"}),!Da&&a&&!a.ignoreInit)return!1;if("ontimeout"===a.type&&(qa.ok()||Ea&&!a.ignoreInit))return!1;var b,c,d={success:a&&a.ignoreInit?qa.ok():!Ea},e=a&&a.type?za[a.type]||[]:[],f=[],g=[d],h=Qa&&!qa.ok();for(a.error&&(g[0].error=a.error),b=0,c=e.length;b=0;a--)qa.sounds[qa.soundIDs[a]].isHTML5&&qa.sounds[qa.soundIDs[a]]._hasTimer&&qa.sounds[qa.soundIDs[a]]._onTimer()},I=function(c){c=c!==b?c:{},"function"==typeof qa.onerror&&qa.onerror.apply(a,[{type:c.type!==b?c.type:null}]),c.fatal!==b&&c.fatal&&qa.disable()},la=function(){if(!_a||!ka())return!1;var a,b,c=qa.audioFormats;for(b in c)if(c.hasOwnProperty(b)&&("mp3"===b||"mp4"===b)&&(qa._wD(ta+": Using flash fallback for "+b+" format"),qa.html5[b]=!1,c[b]&&c[b].related))for(a=c[b].related.length-1;a>=0;a--)qa.html5[c[b].related[a]]=!1},this._setSandboxType=function(a){var c=qa.sandbox;c.type=a,c.description=c.types[c.types[a]!==b?a:"unknown"],"localWithFile"===c.type?(c.noRemote=!0,c.noLocal=!1,n("secNote",2)):"localWithNetwork"===c.type?(c.noRemote=!1,c.noLocal=!0):"localTrusted"===c.type&&(c.noRemote=!1,c.noLocal=!1)},this._externalInterfaceOK=function(a){if(qa.swfLoaded)return!1;var b;if(m("swf",!0),m("flashtojs",!0),qa.swfLoaded=!0,cb=!1,_a&&la(),!a||a.replace(/\+dev/i,"")!==qa.versionNumber.replace(/\+dev/i,""))return b=ta+': Fatal: JavaScript file build "'+qa.versionNumber+'" does not match Flash SWF build "'+a+'" at '+qa.url+". Ensure both are up-to-date.",setTimeout(function(){throw new Error(b)},0),!1;setTimeout(k,Wa?100:1)},H=function(a,c){function d(){var a,b=[],c=[],d=" + ";a="SoundManager "+qa.version+(!qa.html5Only&&qa.useHTML5Audio?qa.hasHTML5?" + HTML5 audio":", no HTML5 audio support":""),qa.html5Only?qa.html5PollingInterval&&b.push("html5PollingInterval ("+qa.html5PollingInterval+"ms)"):(qa.preferFlash&&b.push("preferFlash"),qa.useHighPerformance&&b.push("useHighPerformance"),qa.flashPollingInterval&&b.push("flashPollingInterval ("+qa.flashPollingInterval+"ms)"),qa.html5PollingInterval&&b.push("html5PollingInterval ("+qa.html5PollingInterval+"ms)"),qa.wmode&&b.push("wmode ("+qa.wmode+")"),qa.debugFlash&&b.push("debugFlash"),qa.useFlashBlock&&b.push("flashBlock")),b.length&&(c=c.concat([b.join(d)])),qa._wD(a+(c.length?d+c.join(", "):""),1),na()}function e(a,b){return''}if(Ba&&Ca)return!1;if(qa.html5Only)return y(),d(),qa.oMC=h(qa.movieID),k(),Ba=!0,Ca=!0,!1;var f,g,i,j,l,m,n,o,p=c||qa.url,q=qa.altURL||p,r=G(),s=Q(),t=null,u=ya.getElementsByTagName("html")[0];if(t=u&&u.dir&&u.dir.match(/rtl/i),a=a===b?qa.id:a,y(),qa.url=N(hb?p:q),c=qa.url,qa.wmode=!qa.wmode&&qa.useHighPerformance?"transparent":qa.wmode,null!==qa.wmode&&(wa.match(/msie 8/i)||!Wa&&!qa.useHighPerformance)&&navigator.platform.match(/win32|win64/i)&&(Pa.push(A.spcWmode),qa.wmode=null),f={name:a,id:a,src:c,quality:"high",allowScriptAccess:qa.allowScriptAccess,bgcolor:qa.bgColor,pluginspage:ib+"www.macromedia.com/go/getflashplayer",title:"JS/Flash audio component (SoundManager 2)",type:"application/x-shockwave-flash",wmode:qa.wmode,hasPriority:"true"},qa.debugFlash&&(f.FlashVars="debug=1"),qa.wmode||delete f.wmode,Wa)g=ya.createElement("div"),j=['',e("movie",c),e("AllowScriptAccess",qa.allowScriptAccess),e("quality",f.quality),qa.wmode?e("wmode",qa.wmode):"",e("bgcolor",qa.bgColor),e("hasPriority","true"),qa.debugFlash?e("FlashVars",f.FlashVars):"",""].join("");else{g=ya.createElement("embed");for(i in f)f.hasOwnProperty(i)&&g.setAttribute(i,f[i])}if(K(),s=Q(),r=G())if(qa.oMC=h(qa.movieID)||ya.createElement("div"),qa.oMC.id)o=qa.oMC.className,qa.oMC.className=(o?o+" ":R.swfDefault)+(s?" "+s:""),qa.oMC.appendChild(g),Wa&&(l=qa.oMC.appendChild(ya.createElement("div")),l.className=R.swfBox,l.innerHTML=j),Ca=!0;else{if(qa.oMC.id=qa.movieID,qa.oMC.className=R.swfDefault+" "+s,m=null,l=null,qa.useFlashBlock||(qa.useHighPerformance?m={position:"fixed",width:"8px",height:"8px",bottom:"0px",left:"0px",overflow:"hidden"}:(m={position:"absolute",width:"6px",height:"6px",top:"-9999px",left:"-9999px"},t&&(m.left=Math.abs(parseInt(m.left,10))+"px"))),Xa&&(qa.oMC.style.zIndex=1e4),!qa.debugFlash)for(n in m)m.hasOwnProperty(n)&&(qa.oMC.style[n]=m[n]);try{Wa||qa.oMC.appendChild(g),r.appendChild(qa.oMC),Wa&&(l=qa.oMC.appendChild(ya.createElement("div")),l.className=R.swfBox,l.innerHTML=j),Ca=!0}catch(a){throw new Error(O("domError")+" \n"+a.toString())}}return Ba=!0,d(),!0},B=function(){return qa.html5Only?(H(),!1):!sa&&(qa.url?(sa=qa.getMovie(qa.id),sa||(Ja?(Wa?qa.oMC.innerHTML=Ka:qa.oMC.appendChild(Ja),Ja=null,Ba=!0):H(qa.id,qa.url),sa=qa.getMovie(qa.id)),"function"==typeof qa.oninitmovie&&setTimeout(qa.oninitmovie,1),oa(),!0):(n("noURL"),!1))},v=function(){setTimeout(w,1e3)},x=function(){a.setTimeout(function(){V(ua+"useFlashBlock is false, 100% HTML5 mode is possible. Rebooting with preferFlash: false..."),qa.setup({preferFlash:!1}).reboot(),qa.didFlashBlock=!0,qa.beginDelayedInit()},1)},w=function(){var b,c=!1;return!!qa.url&&!La&&(La=!0,ha.remove(a,"load",v),ja&&cb&&!bb?(n("waitFocus"),!1):(Da||(b=qa.getMoviePercent())>0&&b<100&&(c=!0),void setTimeout(function(){if(b=qa.getMoviePercent(),c)return La=!1,qa._wD(O("waitSWF")),a.setTimeout(v,1),!1;Da||(qa._wD(ta+": No Flash response within expected time. Likely causes: "+(0===b?"SWF load failed, ":"")+"Flash blocked or JS-Flash security error."+(qa.debugFlash?" "+O("checkSWF"):""),2),!hb&&b&&(n("localFail",2),qa.debugFlash||n("tryDebug",2)),0===b&&qa._wD(O("swf404",qa.url),1),m("flashtojs",!1," (Check flash security or flash blockers)")),!Da&&db&&(null===b?qa.useFlashBlock||0===qa.flashLoadTimeout?(qa.useFlashBlock&&P(),n("waitForever")):!qa.useFlashBlock&&_?x():(n("waitForever"),t({type:"ontimeout",ignoreInit:!0,error:{type:"INIT_FLASHBLOCK"}})):0===qa.flashLoadTimeout?n("waitForever"):!qa.useFlashBlock&&_?x():M(!0))},qa.flashLoadTimeout)))},z=function(){function b(){ha.remove(a,"focus",z)}return bb||!cb?(b(),!0):(db=!0,bb=!0,n("gotFocus"),La=!1,v(),b(),!0)},oa=function(){Pa.length&&(qa._wD("SoundManager 2: "+Pa.join(" "),1),Pa=[])},na=function(){oa();var a,b=[];if(qa.useHTML5Audio&&qa.hasHTML5){for(a in qa.audioFormats)qa.audioFormats.hasOwnProperty(a)&&b.push(a+" = "+qa.html5[a]+(!qa.html5[a]&&Qa&&qa.flash[a]?" (using flash)":qa.preferFlash&&qa.flash[a]&&Qa?" (preferring flash)":qa.html5[a]?"":" ("+(qa.audioFormats[a].required?"required, ":"")+"and no flash support)"));qa._wD("SoundManager 2 HTML5 support: "+b.join(", "),1)}},o=function(b){if(Da)return!1;if(qa.html5Only)return n("sm2Loaded",1),Da=!0,u(),m("onload",!0),!0;var c,d=qa.useFlashBlock&&qa.flashLoadTimeout&&!qa.getMoviePercent(),e=!0;return d||(Da=!0),c={type:!ja&&Qa?"NO_FLASH":"INIT_TIMEOUT"},qa._wD("SoundManager 2 "+(Ea?"failed to load":"loaded")+" ("+(Ea?"Flash security/load error":"OK")+") "+String.fromCharCode(Ea?10006:10003),Ea?2:1),Ea||b?(qa.useFlashBlock&&qa.oMC&&(qa.oMC.className=Q()+" "+(null===qa.getMoviePercent()?R.swfTimedout:R.swfError)),t({type:"ontimeout",error:c,ignoreInit:!0}),m("onload",!1),I(c),e=!1):m("onload",!0),Ea||(qa.waitForWindowLoad&&!Fa?(n("waitOnload"),ha.add(a,"load",u)):(qa.waitForWindowLoad&&Fa&&n("docLoaded"),u())),e},j=function(){var a,c=qa.setupOptions;for(a in c)c.hasOwnProperty(a)&&(qa[a]===b?qa[a]=c[a]:qa[a]!==c[a]&&(qa.setupOptions[a]=qa[a]))},k=function(){function b(){ha.remove(a,"load",qa.beginDelayedInit)}if(Da)return n("didInit"),!1;if(qa.html5Only)return Da||(b(),qa.enabled=!0,o()),!0;B();try{sa._externalInterfaceTest(!1),J(!0,qa.flashPollingInterval||(qa.useHighPerformance?10:50)),qa.debugMode||sa._disableDebug(),qa.enabled=!0,m("jstoflash",!0),qa.html5Only||ha.add(a,"unload",i)}catch(a){return qa._wD("js/flash exception: "+a.toString()),m("jstoflash",!1),I({type:"JS_TO_FLASH_EXCEPTION",fatal:!0}),M(!0),o(),!1}return o(),b(),!0},D=function(){return!F&&(F=!0,j(),K(),function(){var a="sm2-usehtml5audio=",b="sm2-preferflash=",c=null,d=null,e=xa.toLowerCase();-1!==e.indexOf(a)&&(c="1"===e.charAt(e.indexOf(a)+a.length),ab&&console.log((c?"Enabling ":"Disabling ")+"useHTML5Audio via URL parameter"),qa.setup({useHTML5Audio:c})),-1!==e.indexOf(b)&&(d="1"===e.charAt(e.indexOf(b)+b.length),ab&&console.log((d?"Enabling ":"Disabling ")+"preferFlash via URL parameter"),qa.setup({preferFlash:d}))}(),!ja&&qa.hasHTML5&&(qa._wD("SoundManager 2: No Flash detected"+(qa.useHTML5Audio?". Trying HTML5-only mode.":", enabling HTML5."),1),qa.setup({useHTML5Audio:!0,preferFlash:!1})),ga(),!ja&&Qa&&(Pa.push(A.needFlash),qa.setup({flashLoadTimeout:1})),ya.removeEventListener&&ya.removeEventListener("DOMContentLoaded",D,!1),B(),!0)},fa=function(){return"complete"===ya.readyState&&(D(),ya.detachEvent("onreadystatechange",fa)),!0},E=function(){Fa=!0,D(),ha.remove(a,"load",E)},C=function(){$a&&(qa.setupOptions.useHTML5Audio&&!qa.setupOptions.preferFlash||Pa.push(A.mobileUA),qa.setupOptions.useHTML5Audio=!0,qa.setupOptions.preferFlash=!1,(Ua||Va&&!wa.match(/android\s2\.3/i))&&(Pa.push(A.globalHTML5),Ua&&(qa.ignoreFlash=!0),Sa=!0))},C(),ka(),ha.add(a,"focus",z),ha.add(a,"load",v),ha.add(a,"load",E),ya.addEventListener?ya.addEventListener("DOMContentLoaded",D,!1):ya.attachEvent?ya.attachEvent("onreadystatechange",fa):(m("onload",!1),I({type:"NO_DOM2_EVENTS",fatal:!0}))}if(!a||!a.document)throw new Error("SoundManager requires a browser with window and document objects.");var d=null;void 0!==a.SM2_DEFER&&SM2_DEFER||(d=new c),"object"==typeof module&&module&&"object"==typeof module.exports?(a.soundManager=d,module.exports.SoundManager=c,module.exports.soundManager=d):"function"==typeof define&&define.amd?define("SoundManager",[],function(){return{SoundManager:c,soundManager:d}}):(a.SoundManager=c,a.soundManager=d)}(window);var ngSoundManager=angular.module("angularSoundManager",[]).config(["$logProvider",function(a){a.debugEnabled(!1)}]);ngSoundManager.filter("humanTime",function(){return function(a){function b(a){return a<10?"0"+a.toString():a.toString()}var c=a/1e3/60<<0,d=Math.round(a/1e3%60);return b(c)+":"+b(d)}}),ngSoundManager.factory("angularPlayer",["$rootScope","$log",function(a,b){var c=null,d=!1,e=!1,f=[],g=!1,h=90,i=0,j=[];return{init:function(){"undefined"==typeof soundManager&&alert("Please include SoundManager2 Library!"),soundManager.setup({preferFlash:!1,debugMode:!1,useHTML5Audio:!0,onready:function(){},ontimeout:function(){alert("SM2 failed to start. Flash missing, blocked or security error?"),alert("The status is "+status.success+", the error type is "+status.error.type)},defaultOptions:{autoLoad:!1,autoPlay:!1,from:null,loops:1,multiShot:!1,multiShotEvents:!1,onid3:null,onload:null,onstop:null,onfailure:"nextTrack",onpause:null,onplay:null,onresume:null,position:null,pan:0,stream:!0,to:null,type:"audio/mp3",usePolicyFile:!1,volume:h,whileloading:function(){var b=this.bytesLoaded/this.bytesTotal*100;a.$broadcast("track:loaded",b)},whileplaying:function(){c=this.id,i=this.position/this.duration*100,a.$broadcast("track:progress",i),a.$broadcast("currentTrack:position",this.position),a.$broadcast("currentTrack:duration",this.duration)},onfinish:function(){soundManager._writeDebug(this.id+" finished playing"),angular.element(document.querySelector("[ng-app]")).injector().get("angularPlayer").nextTrack(),a.$broadcast("track:id",c)}}}),soundManager.onready(function(){b.debug("song manager ready!");var c=soundManager.ok();b.debug("is supported: "+c),a.$broadcast("angularPlayer:ready",!0)})},isInArray:function(a,b){for(var c=0;c-1){if(void 0===a.url)return b.debug("invalid soundcloud track url"),!1}else if(!0!==soundManager.canPlayURL(a.url))return b.debug("invalid song url"),!1},addTrack:function(a){return this.isTrackValid?(!1===this.isInArray(this.getPlaylist(),a.id)&&(soundManager.createSound({id:a.id,url:a.url}),this.addToPlaylist(a)),a.id):null},removeSong:function(b,d){b===c&&this.stop(),soundManager.destroySound(b),j.splice(d,1),a.$broadcast("player:playlist",j)},initPlayTrack:function(b,c){!0!==c&&(this.stop(),this.setCurrentTrack(b)),soundManager.play(b),a.$broadcast("track:id",b),g=!0,a.$broadcast("music:isPlaying",g)},play:function(){var a=null;if(null===this.getCurrentTrack()){if(0===soundManager.soundIDs.length)return void b.debug("playlist is empty!");a=soundManager.soundIDs[0],this.initPlayTrack(a)}else a=this.getCurrentTrack(),this.initPlayTrack(a,!0)},pause:function(){soundManager.pause(this.getCurrentTrack()),g=!1,a.$broadcast("music:isPlaying",g)},stop:function(){this.pause(),this.resetProgress(),a.$broadcast("track:progress",i),a.$broadcast("currentTrack:position",0),a.$broadcast("currentTrack:duration",0),soundManager.stopAll(),soundManager.unload(this.getCurrentTrack())},playTrack:function(a){this.initPlayTrack(a)},nextTrack:function(){if(null===this.getCurrentTrack())return b.debug("Please click on Play before this action"),null;var c=angular.copy(soundManager.soundIDs);!0===e&&(c=f);var h=this.getIndexByValue(c,this.getCurrentTrack()),i=+h+1,j=c[i];void 0!==j?this.playTrack(j):(!0===e&&!0===g&&(f=angular.copy(soundManager.soundIDs),f=f.sort(function(){return.5-Math.random()}),a.$broadcast("music:tempTrack",f)),!0===d?this.playTrack(c[0]):(g=!1,a.$broadcast("music:isPlaying",g)))},prevTrack:function(){if(null===this.getCurrentTrack())return b.debug("Please click on Play before this action"),null;var a=angular.copy(soundManager.soundIDs);!0===e&&(a=f);var c=this.getIndexByValue(a,this.getCurrentTrack()),d=+c-1,g=a[d];void 0!==g?this.playTrack(g):b.debug("no prev track found!")},mute:function(){!0===soundManager.muted?soundManager.unmute():soundManager.mute(),a.$broadcast("music:mute",soundManager.muted)},getMuteStatus:function(){return soundManager.muted},repeatToggle:function(){d=!0!==d,a.$broadcast("music:repeat",d)},getRepeatStatus:function(){return d},shuffleToggle:function(){!0===e?(e=!1,f=angular.copy(soundManager.soundIDs)):(e=!0,f=angular.copy(soundManager.soundIDs),f=f.sort(function(){return.5-Math.random()})),a.$broadcast("music:shuffle",e),a.$broadcast("music:tempTrack",f)},getShuffleStatus:function(){return e},getVolume:function(){return h},adjustVolume:function(b){var c=function(b){for(var c=0;c0&&(h-=10,c(h))},adjustVolumeSlider:function(b){!function(b){for(var c=0;c=0;f--)h["audio/"+e[c].related[f]]=h[c],qa.html5[e[c].related[f]]=h[c],qa.flash[e[c].related[f]]=h[c];return h.canPlayType=g?a:null,qa.html5=p(qa.html5,h),qa.html5.usingFlash=aa(),Qa=qa.html5.usingFlash,!0},A={notReady:"Unavailable - wait until onready() has fired.",notOK:"Audio support is not available.",domError:ta+"exception caught while appending SWF to DOM.",spcWmode:"Removing wmode, preventing known SWF loading issue(s)",swf404:ua+"Verify that %s is a valid path.",tryDebug:"Try "+ta+".debugFlash = true for more security details (output goes to SWF.)",checkSWF:"See SWF output for more debug info.",localFail:ua+"Non-HTTP page ("+ya.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:ua+"Special case: Waiting for SWF to load with window focus...",waitForever:ua+"Waiting indefinitely for Flash (will recover if unblocked)...",waitSWF:ua+"Waiting for 100% SWF load...",needFunction:ua+"Function object expected for %s",badID:'Sound ID "%s" should be a string, starting with a non-numeric character',currentObj:ua+"_debug(): Current sound objects",waitOnload:ua+"Waiting for window.onload()",docLoaded:ua+"Document already loaded",onload:ua+"initComplete(): calling soundManager.onload()",onloadOK:ta+".onload() complete",didInit:ua+"init(): Already called?",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",badRemove:ua+"Failed to remove Flash node.",shutdown:ta+".disable(): Shutting down",queue:ua+"Queueing %s handler",smError:"SMSound.load(): Exception: JS-Flash communication failed, or JS error.",fbTimeout:"No flash response, applying ."+R.swfTimedout+" CSS...",fbLoaded:"Flash loaded",fbHandler:ua+"flashBlockHandler()",manURL:"SMSound.load(): Using manually-assigned URL",onURL:ta+".load(): current URL already assigned.",badFV:ta+'.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",needFlash:ua+"Fatal error: Flash is needed to play some required formats, but is not available.",gotFocus:ua+"Got window focus.",policy:"Enabling usePolicyFile for data access",setup:ta+".setup(): allowed parameters: %s",setupError:ta+'.setup(): "%s" cannot be assigned with this method.',setupUndef:ta+'.setup(): Could not find option "%s"',setupLate:ta+".setup(): url, flashVersion and html5Test property changes will not take effect until reboot().",noURL:ua+"Flash URL required. Call soundManager.setup({url:...}) to get started.",sm2Loaded:"SoundManager 2: Ready. "+String.fromCharCode(10003),reset:ta+".reset(): Removing event callbacks",mobileUA:"Mobile UA detected, preferring HTML5 by default.",globalHTML5:"Using singleton HTML5 Audio() pattern for this device."},O=function(){var a,b,c,d,e;if(a=Ra.call(arguments),d=a.shift(),(e=A&&A[d]?A[d]:"")&&a&&a.length)for(b=0,c=a.length;b1&&a.stream&&(n("as2loop"),a.stream=!1),a},U=function(a,b){return a&&!a.usePolicyFile&&(a.onid3||a.usePeakData||a.useWaveformData||a.useEQData)&&(qa._wD((b||"")+O("policy")),a.usePolicyFile=!0),a},V=function(a){ab&&console.warn!==b?console.warn(a):qa._wD(a)},i=function(){return!1},L=function(a){var b;for(b in a)a.hasOwnProperty(b)&&"function"==typeof a[b]&&(a[b]=i);b=null},M=function(a){a===b&&(a=!1),(Ea||a)&&qa.disable(a)},N=function(a){var b;if(a)if(a.match(/\.swf(\?.*)?$/i)){if(a.substr(a.toLowerCase().lastIndexOf(".swf?")+4))return a}else a.lastIndexOf("/")!==a.length-1&&(a+="/");return b=(a&&-1!==a.lastIndexOf("/")?a.substr(0,a.lastIndexOf("/")+1):"./")+qa.movieURL,qa.noSWFCache&&(b+="?ts="+(new Date).getTime()),b},y=function(){8!==(l=parseInt(qa.flashVersion,10))&&9!==l&&(qa._wD(O("badFV",l,Ia)),qa.flashVersion=l=Ia);var a=qa.debugMode||qa.debugFlash?"_debug.swf":".swf";qa.useHTML5Audio&&!qa.html5Only&&qa.audioFormats.mp4.required&&l<9&&(qa._wD(O("needfl9")),qa.flashVersion=l=9),qa.version=qa.versionNumber+(qa.html5Only?" (HTML5-only mode)":9===l?" (AS3/Flash 9)":" (AS2/Flash 8)"),l>8?(qa.defaultOptions=p(qa.defaultOptions,qa.flash9Options),qa.features.buffering=!0,qa.defaultOptions=p(qa.defaultOptions,qa.movieStarOptions),qa.filePatterns.flash9=new RegExp("\\.(mp3|"+kb.join("|")+")(\\?.*)?$","i"),qa.features.movieStar=!0):qa.features.movieStar=!1,qa.filePattern=qa.filePatterns[8!==l?"flash9":"flash8"],qa.movieURL=(8===l?"soundmanager2.swf":"soundmanager2_flash9.swf").replace(".swf",a),qa.features.peakData=qa.features.waveformData=qa.features.eqData=l>8},J=function(a,b){if(!sa)return!1;sa._setPolling(a,b)},K=function(){if(qa.debugURLParam.test(xa)&&(qa.debugMode=!0),h(qa.debugID))return!1;var a,b,c,d,e;if(qa.debugMode&&!h(qa.debugID)&&(!ab||!qa.useConsole||!qa.consoleOnly)){a=ya.createElement("div"),a.id=qa.debugID+"-toggle",d={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},a.appendChild(ya.createTextNode("-")),a.onclick=S,a.title="Toggle SM2 debug console",wa.match(/msie 6/i)&&(a.style.position="absolute",a.style.cursor="hand");for(e in d)d.hasOwnProperty(e)&&(a.style[e]=d[e]);if(b=ya.createElement("div"),b.id=qa.debugID,b.style.display=qa.debugMode?"block":"none",qa.debugMode&&!h(a.id)){try{c=G(),c.appendChild(a)}catch(a){throw new Error(O("domError")+" \n"+a.toString())}c.appendChild(b)}}c=null},W=this.getSoundById,n=function(a,b){return a?qa._wD(O(a),b):""},S=function(){var a=h(qa.debugID),b=h(qa.debugID+"-toggle");if(!a)return!1;Aa?(b.innerHTML="+",a.style.display="none"):(b.innerHTML="-",a.style.display="block"),Aa=!Aa},m=function(c,d,e){if(a.sm2Debugger!==b)try{sm2Debugger.handleEvent(c,d,e)}catch(a){return!1}return!0},Q=function(){var a=[];return qa.debugMode&&a.push(R.sm2Debug),qa.debugFlash&&a.push(R.flashDebug),qa.useHighPerformance&&a.push(R.highPerf),a.join(" ")},P=function(){var a=O("fbHandler"),b=qa.getMoviePercent(),c=R,d={type:"FLASHBLOCK"};if(qa.html5Only)return!1;qa.ok()?(qa.didFlashBlock&&qa._wD(a+": Unblocked"),qa.oMC&&(qa.oMC.className=[Q(),c.swfDefault,c.swfLoaded+(qa.didFlashBlock?" "+c.swfUnblocked:"")].join(" "))):(Qa&&(qa.oMC.className=Q()+" "+c.swfDefault+" "+(null===b?c.swfTimedout:c.swfError),qa._wD(a+": "+O("fbTimeout")+(b?" ("+O("fbLoaded")+")":""))),qa.didFlashBlock=!0,t({type:"ontimeout",ignoreInit:!0,error:d}),I(d))},s=function(a,c,d){za[a]===b&&(za[a]=[]),za[a].push({method:c,scope:d||null,fired:!1})},t=function(a){if(a||(a={type:qa.ok()?"onready":"ontimeout"}),!Da&&a&&!a.ignoreInit)return!1;if("ontimeout"===a.type&&(qa.ok()||Ea&&!a.ignoreInit))return!1;var b,c,d={success:a&&a.ignoreInit?qa.ok():!Ea},e=a&&a.type?za[a.type]||[]:[],f=[],g=[d],h=Qa&&!qa.ok();for(a.error&&(g[0].error=a.error),b=0,c=e.length;b=0;a--)qa.sounds[qa.soundIDs[a]].isHTML5&&qa.sounds[qa.soundIDs[a]]._hasTimer&&qa.sounds[qa.soundIDs[a]]._onTimer()},I=function(c){c=c!==b?c:{},"function"==typeof qa.onerror&&qa.onerror.apply(a,[{type:c.type!==b?c.type:null}]),c.fatal!==b&&c.fatal&&qa.disable()},la=function(){if(!_a||!ka())return!1;var a,b,c=qa.audioFormats;for(b in c)if(c.hasOwnProperty(b)&&("mp3"===b||"mp4"===b)&&(qa._wD(ta+": Using flash fallback for "+b+" format"),qa.html5[b]=!1,c[b]&&c[b].related))for(a=c[b].related.length-1;a>=0;a--)qa.html5[c[b].related[a]]=!1},this._setSandboxType=function(a){var c=qa.sandbox;c.type=a,c.description=c.types[c.types[a]!==b?a:"unknown"],"localWithFile"===c.type?(c.noRemote=!0,c.noLocal=!1,n("secNote",2)):"localWithNetwork"===c.type?(c.noRemote=!1,c.noLocal=!0):"localTrusted"===c.type&&(c.noRemote=!1,c.noLocal=!1)},this._externalInterfaceOK=function(a){if(qa.swfLoaded)return!1;var b;if(m("swf",!0),m("flashtojs",!0),qa.swfLoaded=!0,cb=!1,_a&&la(),!a||a.replace(/\+dev/i,"")!==qa.versionNumber.replace(/\+dev/i,""))return b=ta+': Fatal: JavaScript file build "'+qa.versionNumber+'" does not match Flash SWF build "'+a+'" at '+qa.url+". Ensure both are up-to-date.",setTimeout(function(){throw new Error(b)},0),!1;setTimeout(k,Wa?100:1)},H=function(a,c){function d(){var a,b=[],c=[],d=" + ";a="SoundManager "+qa.version+(!qa.html5Only&&qa.useHTML5Audio?qa.hasHTML5?" + HTML5 audio":", no HTML5 audio support":""),qa.html5Only?qa.html5PollingInterval&&b.push("html5PollingInterval ("+qa.html5PollingInterval+"ms)"):(qa.preferFlash&&b.push("preferFlash"),qa.useHighPerformance&&b.push("useHighPerformance"),qa.flashPollingInterval&&b.push("flashPollingInterval ("+qa.flashPollingInterval+"ms)"),qa.html5PollingInterval&&b.push("html5PollingInterval ("+qa.html5PollingInterval+"ms)"),qa.wmode&&b.push("wmode ("+qa.wmode+")"),qa.debugFlash&&b.push("debugFlash"),qa.useFlashBlock&&b.push("flashBlock")),b.length&&(c=c.concat([b.join(d)])),qa._wD(a+(c.length?d+c.join(", "):""),1),na()}function e(a,b){return''}if(Ba&&Ca)return!1;if(qa.html5Only)return y(),d(),qa.oMC=h(qa.movieID),k(),Ba=!0,Ca=!0,!1;var f,g,i,j,l,m,n,o,p=c||qa.url,q=qa.altURL||p,r=G(),s=Q(),t=null,u=ya.getElementsByTagName("html")[0];if(t=u&&u.dir&&u.dir.match(/rtl/i),a=a===b?qa.id:a,y(),qa.url=N(hb?p:q),c=qa.url,qa.wmode=!qa.wmode&&qa.useHighPerformance?"transparent":qa.wmode,null!==qa.wmode&&(wa.match(/msie 8/i)||!Wa&&!qa.useHighPerformance)&&navigator.platform.match(/win32|win64/i)&&(Pa.push(A.spcWmode),qa.wmode=null),f={name:a,id:a,src:c,quality:"high",allowScriptAccess:qa.allowScriptAccess,bgcolor:qa.bgColor,pluginspage:ib+"www.macromedia.com/go/getflashplayer",title:"JS/Flash audio component (SoundManager 2)",type:"application/x-shockwave-flash",wmode:qa.wmode,hasPriority:"true"},qa.debugFlash&&(f.FlashVars="debug=1"),qa.wmode||delete f.wmode,Wa)g=ya.createElement("div"),j=['',e("movie",c),e("AllowScriptAccess",qa.allowScriptAccess),e("quality",f.quality),qa.wmode?e("wmode",qa.wmode):"",e("bgcolor",qa.bgColor),e("hasPriority","true"),qa.debugFlash?e("FlashVars",f.FlashVars):"",""].join("");else{g=ya.createElement("embed");for(i in f)f.hasOwnProperty(i)&&g.setAttribute(i,f[i])}if(K(),s=Q(),r=G())if(qa.oMC=h(qa.movieID)||ya.createElement("div"),qa.oMC.id)o=qa.oMC.className,qa.oMC.className=(o?o+" ":R.swfDefault)+(s?" "+s:""),qa.oMC.appendChild(g),Wa&&(l=qa.oMC.appendChild(ya.createElement("div")),l.className=R.swfBox,l.innerHTML=j),Ca=!0;else{if(qa.oMC.id=qa.movieID,qa.oMC.className=R.swfDefault+" "+s,m=null,l=null,qa.useFlashBlock||(qa.useHighPerformance?m={position:"fixed",width:"8px",height:"8px",bottom:"0px",left:"0px",overflow:"hidden"}:(m={position:"absolute",width:"6px",height:"6px",top:"-9999px",left:"-9999px"},t&&(m.left=Math.abs(parseInt(m.left,10))+"px"))),Xa&&(qa.oMC.style.zIndex=1e4),!qa.debugFlash)for(n in m)m.hasOwnProperty(n)&&(qa.oMC.style[n]=m[n]);try{Wa||qa.oMC.appendChild(g),r.appendChild(qa.oMC),Wa&&(l=qa.oMC.appendChild(ya.createElement("div")),l.className=R.swfBox,l.innerHTML=j),Ca=!0}catch(a){throw new Error(O("domError")+" \n"+a.toString())}}return Ba=!0,d(),!0},B=function(){return qa.html5Only?(H(),!1):!sa&&(qa.url?(sa=qa.getMovie(qa.id),sa||(Ja?(Wa?qa.oMC.innerHTML=Ka:qa.oMC.appendChild(Ja),Ja=null,Ba=!0):H(qa.id,qa.url),sa=qa.getMovie(qa.id)),"function"==typeof qa.oninitmovie&&setTimeout(qa.oninitmovie,1),oa(),!0):(n("noURL"),!1))},v=function(){setTimeout(w,1e3)},x=function(){a.setTimeout(function(){V(ua+"useFlashBlock is false, 100% HTML5 mode is possible. Rebooting with preferFlash: false..."),qa.setup({preferFlash:!1}).reboot(),qa.didFlashBlock=!0,qa.beginDelayedInit()},1)},w=function(){var b,c=!1;return!!qa.url&&!La&&(La=!0,ha.remove(a,"load",v),ja&&cb&&!bb?(n("waitFocus"),!1):(Da||(b=qa.getMoviePercent())>0&&b<100&&(c=!0),void setTimeout(function(){if(b=qa.getMoviePercent(),c)return La=!1,qa._wD(O("waitSWF")),a.setTimeout(v,1),!1;Da||(qa._wD(ta+": No Flash response within expected time. Likely causes: "+(0===b?"SWF load failed, ":"")+"Flash blocked or JS-Flash security error."+(qa.debugFlash?" "+O("checkSWF"):""),2),!hb&&b&&(n("localFail",2),qa.debugFlash||n("tryDebug",2)),0===b&&qa._wD(O("swf404",qa.url),1),m("flashtojs",!1," (Check flash security or flash blockers)")),!Da&&db&&(null===b?qa.useFlashBlock||0===qa.flashLoadTimeout?(qa.useFlashBlock&&P(),n("waitForever")):!qa.useFlashBlock&&_?x():(n("waitForever"),t({type:"ontimeout",ignoreInit:!0,error:{type:"INIT_FLASHBLOCK"}})):0===qa.flashLoadTimeout?n("waitForever"):!qa.useFlashBlock&&_?x():M(!0))},qa.flashLoadTimeout)))},z=function(){function b(){ha.remove(a,"focus",z)}return bb||!cb?(b(),!0):(db=!0,bb=!0,n("gotFocus"),La=!1,v(),b(),!0)},oa=function(){Pa.length&&(qa._wD("SoundManager 2: "+Pa.join(" "),1),Pa=[])},na=function(){oa();var a,b=[];if(qa.useHTML5Audio&&qa.hasHTML5){for(a in qa.audioFormats)qa.audioFormats.hasOwnProperty(a)&&b.push(a+" = "+qa.html5[a]+(!qa.html5[a]&&Qa&&qa.flash[a]?" (using flash)":qa.preferFlash&&qa.flash[a]&&Qa?" (preferring flash)":qa.html5[a]?"":" ("+(qa.audioFormats[a].required?"required, ":"")+"and no flash support)"));qa._wD("SoundManager 2 HTML5 support: "+b.join(", "),1)}},o=function(b){if(Da)return!1;if(qa.html5Only)return n("sm2Loaded",1),Da=!0,u(),m("onload",!0),!0;var c,d=qa.useFlashBlock&&qa.flashLoadTimeout&&!qa.getMoviePercent(),e=!0;return d||(Da=!0),c={type:!ja&&Qa?"NO_FLASH":"INIT_TIMEOUT"},qa._wD("SoundManager 2 "+(Ea?"failed to load":"loaded")+" ("+(Ea?"Flash security/load error":"OK")+") "+String.fromCharCode(Ea?10006:10003),Ea?2:1),Ea||b?(qa.useFlashBlock&&qa.oMC&&(qa.oMC.className=Q()+" "+(null===qa.getMoviePercent()?R.swfTimedout:R.swfError)),t({type:"ontimeout",error:c,ignoreInit:!0}),m("onload",!1),I(c),e=!1):m("onload",!0),Ea||(qa.waitForWindowLoad&&!Fa?(n("waitOnload"),ha.add(a,"load",u)):(qa.waitForWindowLoad&&Fa&&n("docLoaded"),u())),e},j=function(){var a,c=qa.setupOptions;for(a in c)c.hasOwnProperty(a)&&(qa[a]===b?qa[a]=c[a]:qa[a]!==c[a]&&(qa.setupOptions[a]=qa[a]))},k=function(){function b(){ha.remove(a,"load",qa.beginDelayedInit)}if(Da)return n("didInit"),!1;if(qa.html5Only)return Da||(b(),qa.enabled=!0,o()),!0;B();try{sa._externalInterfaceTest(!1),J(!0,qa.flashPollingInterval||(qa.useHighPerformance?10:50)),qa.debugMode||sa._disableDebug(),qa.enabled=!0,m("jstoflash",!0),qa.html5Only||ha.add(a,"unload",i)}catch(a){return qa._wD("js/flash exception: "+a.toString()),m("jstoflash",!1),I({type:"JS_TO_FLASH_EXCEPTION",fatal:!0}),M(!0),o(),!1}return o(),b(),!0},D=function(){return!F&&(F=!0,j(),K(),function(){var a="sm2-usehtml5audio=",b="sm2-preferflash=",c=null,d=null,e=xa.toLowerCase();-1!==e.indexOf(a)&&(c="1"===e.charAt(e.indexOf(a)+a.length),ab&&console.log((c?"Enabling ":"Disabling ")+"useHTML5Audio via URL parameter"),qa.setup({useHTML5Audio:c})),-1!==e.indexOf(b)&&(d="1"===e.charAt(e.indexOf(b)+b.length),ab&&console.log((d?"Enabling ":"Disabling ")+"preferFlash via URL parameter"),qa.setup({preferFlash:d}))}(),!ja&&qa.hasHTML5&&(qa._wD("SoundManager 2: No Flash detected"+(qa.useHTML5Audio?". Trying HTML5-only mode.":", enabling HTML5."),1),qa.setup({useHTML5Audio:!0,preferFlash:!1})),ga(),!ja&&Qa&&(Pa.push(A.needFlash),qa.setup({flashLoadTimeout:1})),ya.removeEventListener&&ya.removeEventListener("DOMContentLoaded",D,!1),B(),!0)},fa=function(){return"complete"===ya.readyState&&(D(),ya.detachEvent("onreadystatechange",fa)),!0},E=function(){Fa=!0,D(),ha.remove(a,"load",E)},C=function(){$a&&(qa.setupOptions.useHTML5Audio&&!qa.setupOptions.preferFlash||Pa.push(A.mobileUA),qa.setupOptions.useHTML5Audio=!0,qa.setupOptions.preferFlash=!1,(Ua||Va&&!wa.match(/android\s2\.3/i))&&(Pa.push(A.globalHTML5),Ua&&(qa.ignoreFlash=!0),Sa=!0))},C(),ka(),ha.add(a,"focus",z),ha.add(a,"load",v),ha.add(a,"load",E),ya.addEventListener?ya.addEventListener("DOMContentLoaded",D,!1):ya.attachEvent?ya.attachEvent("onreadystatechange",fa):(m("onload",!1),I({type:"NO_DOM2_EVENTS",fatal:!0}))}if(!a||!a.document)throw new Error("SoundManager requires a browser with window and document objects.");var d=null;void 0!==a.SM2_DEFER&&SM2_DEFER||(d=new c),"object"==typeof module&&module&&"object"==typeof module.exports?(a.soundManager=d,module.exports.SoundManager=c,module.exports.soundManager=d):"function"==typeof define&&define.amd?define("SoundManager",[],function(){return{SoundManager:c,soundManager:d}}):(a.SoundManager=c,a.soundManager=d)}(window);var ngSoundManager=angular.module("angularSoundManager",[]).config(["$logProvider",function(a){a.debugEnabled(!1)}]);ngSoundManager.filter("humanTime",function(){return function(a){function b(a){return a<10?"0"+a.toString():a.toString()}var c=a/1e3/60<<0,d=Math.round(a/1e3%60);return b(c)+":"+b(d)}}),ngSoundManager.factory("angularPlayer",["$rootScope","$log",function(a,b){var c=null,d=!1,e=!1,f=[],g=!1,h=90,i=0,j=[];return{init:function(){"undefined"==typeof soundManager&&alert("Please include SoundManager2 Library!"),soundManager.setup({preferFlash:!1,debugMode:!1,useHTML5Audio:!0,onready:function(){},ontimeout:function(){alert("SM2 failed to start. Flash missing, blocked or security error?"),alert("The status is "+status.success+", the error type is "+status.error.type)},defaultOptions:{autoLoad:!1,autoPlay:!1,from:null,loops:1,multiShot:!1,multiShotEvents:!1,onid3:null,onload:null,onstop:null,onfailure:"nextTrack",onpause:null,onplay:null,onresume:null,position:null,pan:0,stream:!0,to:null,type:"audio/mp3",usePolicyFile:!1,volume:h,whileloading:function(){var b=this.bytesLoaded/this.bytesTotal*100;a.$broadcast("track:loaded",b)},whileplaying:function(){c=this.id,i=this.position/this.duration*100,a.$broadcast("track:progress",i),a.$broadcast("currentTrack:position",this.position),a.$broadcast("currentTrack:duration",this.duration)},onfinish:function(){soundManager._writeDebug(this.id+" finished playing"),angular.element(document.querySelector("[ng-app]")).injector().get("angularPlayer").nextTrack(),a.$broadcast("track:id",c)}}}),soundManager.onready(function(){b.debug("song manager ready!");var c=soundManager.ok();b.debug("is supported: "+c),a.$broadcast("angularPlayer:ready",!0)})},isInArray:function(a,b){for(var c=0;c-1){if(void 0===a.url)return b.debug("invalid soundcloud track url"),!1}else if(!0!==soundManager.canPlayURL(a.url))return b.debug("invalid song url"),!1},addTrack:function(a){return this.isTrackValid?(!1===this.isInArray(this.getPlaylist(),a.id)&&(soundManager.createSound({id:a.id,url:a.url}),this.addToPlaylist(a)),a.id):null},removeSong:function(b,d){b===c&&this.stop(),soundManager.destroySound(b),j.splice(d,1),a.$broadcast("player:playlist",j)},initPlayTrack:function(b,c){!0!==c&&(this.stop(),this.setCurrentTrack(b)),soundManager.play(b),a.$broadcast("track:id",b),g=!0,a.$broadcast("music:isPlaying",g)},play:function(){var a=null;if(null===this.getCurrentTrack()){if(0===soundManager.soundIDs.length)return void b.debug("playlist is empty!");a=soundManager.soundIDs[0],this.initPlayTrack(a)}else a=this.getCurrentTrack(),this.initPlayTrack(a,!0)},pause:function(){soundManager.pause(this.getCurrentTrack()),g=!1,a.$broadcast("music:isPlaying",g)},stop:function(){this.pause(),this.resetProgress(),a.$broadcast("track:progress",i),a.$broadcast("currentTrack:position",0),a.$broadcast("currentTrack:duration",0),soundManager.stopAll(),soundManager.unload(this.getCurrentTrack())},playTrack:function(a){this.initPlayTrack(a)},nextTrack:function(){if(null===this.getCurrentTrack())return b.debug("Please click on Play before this action"),null;var c=angular.copy(soundManager.soundIDs);!0===e&&(c=f);var h=this.getIndexByValue(c,this.getCurrentTrack()),i=+h+1,j=c[i];void 0!==j?this.playTrack(j):(!0===e&&!0===g&&(f=angular.copy(soundManager.soundIDs),f=f.sort(function(){return.5-Math.random()}),a.$broadcast("music:tempTrack",f)),!0===d?this.playTrack(c[0]):(g=!1,a.$broadcast("music:isPlaying",g)))},prevTrack:function(){if(null===this.getCurrentTrack())return b.debug("Please click on Play before this action"),null;var a=angular.copy(soundManager.soundIDs);!0===e&&(a=f);var c=this.getIndexByValue(a,this.getCurrentTrack()),d=+c-1,g=a[d];void 0!==g?this.playTrack(g):b.debug("no prev track found!")},mute:function(){!0===soundManager.muted?soundManager.unmute():soundManager.mute(),a.$broadcast("music:mute",soundManager.muted)},getMuteStatus:function(){return soundManager.muted},repeatToggle:function(){d=!0!==d,a.$broadcast("music:repeat",d)},getRepeatStatus:function(){return d},shuffleToggle:function(){!0===e?(e=!1,f=angular.copy(soundManager.soundIDs)):(e=!0,f=angular.copy(soundManager.soundIDs),f=f.sort(function(){return.5-Math.random()})),a.$broadcast("music:shuffle",e),a.$broadcast("music:tempTrack",f)},getShuffleStatus:function(){return e},playShuffle:function(){var c=null;if(e=!0,f=angular.copy(soundManager.soundIDs),f=f.sort(function(){return.5-Math.random()}),a.$broadcast("music:shuffle",e),a.$broadcast("music:tempTrack",f),0===f.length)return void b.debug("playlist is empty!");c=f[0],this.initPlayTrack(c)},getVolume:function(){return h},adjustVolume:function(b){var c=function(b){for(var c=0;c0&&(h-=10,c(h))},adjustVolumeSlider:function(b){!function(b){for(var c=0;cSongs - - + + - Is Playing: {{ isPlaying }} diff --git a/src/03-factory-angularPlayer.js b/src/03-factory-angularPlayer.js index c66d417..8817ae0 100644 --- a/src/03-factory-angularPlayer.js +++ b/src/03-factory-angularPlayer.js @@ -278,7 +278,7 @@ ngSoundManager.factory('angularPlayer', ['$rootScope', '$log', // generate shuffle track list if(shuffle === true && isPlaying === true){ tempTrack = angular.copy(soundManager.soundIDs); - tempTrack = (tempTrack).sort(function() { return 0.5 - Math.random() }); + tempTrack = (tempTrack).sort(function() { return 0.5 - Math.random(); }); $rootScope.$broadcast('music:tempTrack', tempTrack); } @@ -343,7 +343,7 @@ ngSoundManager.factory('angularPlayer', ['$rootScope', '$log', } else { shuffle = true; tempTrack = angular.copy(soundManager.soundIDs); - tempTrack = (tempTrack).sort(function() { return 0.5 - Math.random() }); + tempTrack = (tempTrack).sort(function() { return 0.5 - Math.random(); }); } $rootScope.$broadcast('music:shuffle', shuffle); $rootScope.$broadcast('music:tempTrack', tempTrack); @@ -351,6 +351,21 @@ ngSoundManager.factory('angularPlayer', ['$rootScope', '$log', getShuffleStatus: function() { return shuffle; }, + playShuffle: function(){ + var trackToPlay = null; + shuffle = true; + tempTrack = angular.copy(soundManager.soundIDs); + tempTrack = (tempTrack).sort(function() { return 0.5 - Math.random(); }); + $rootScope.$broadcast('music:shuffle', shuffle); + $rootScope.$broadcast('music:tempTrack', tempTrack); + + if(tempTrack.length === 0) { + $log.debug('playlist is empty!'); + return; + } + trackToPlay = tempTrack[0]; + this.initPlayTrack(trackToPlay); + }, getVolume: function() { return volume; }, diff --git a/src/21-directive-shuffleMusic.js b/src/21-directive-shuffleMusic.js index 020bb82..5aab0ad 100644 --- a/src/21-directive-shuffleMusic.js +++ b/src/21-directive-shuffleMusic.js @@ -12,10 +12,6 @@ ngSoundManager.directive('shuffleMusic', ['angularPlayer', function (angularPlay scope.$apply(function () { scope.shuffle = data; }); - - if(!angularPlayer.isPlayingStatus() && scope.shuffle) { - angularPlayer.play(); - } }); } }; diff --git a/src/22-directive-shuffleAllMusic.js b/src/22-directive-shuffleAllMusic.js new file mode 100644 index 0000000..75a2dca --- /dev/null +++ b/src/22-directive-shuffleAllMusic.js @@ -0,0 +1,13 @@ +ngSoundManager.directive('shuffleAllMusic', ['angularPlayer', function (angularPlayer) { + return { + restrict: "EA", + link: function (scope, element, attrs) { + + element.bind('click', function (event) { + angularPlayer.playShuffle(); + }); + + scope.shuffle = angularPlayer.getShuffleStatus(); + } + }; +}]); \ No newline at end of file From 4d6c6ae054bee169f78ec14a2b69bb3637e6308c Mon Sep 17 00:00:00 2001 From: phalla Date: Fri, 21 Apr 2017 09:33:18 +0700 Subject: [PATCH 6/8] fix bug on playNext --- dist/angular-soundmanager2.js | 12 +++++++++--- dist/angular-soundmanager2.min.js | 4 ++-- src/03-factory-angularPlayer.js | 12 +++++++++--- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/dist/angular-soundmanager2.js b/dist/angular-soundmanager2.js index aa4c8eb..9a8c53c 100644 --- a/dist/angular-soundmanager2.js +++ b/dist/angular-soundmanager2.js @@ -4684,11 +4684,17 @@ ngSoundManager.factory('angularPlayer', ['$rootScope', '$log', // use shuffle track list if shuffle is true var useTrack = angular.copy(soundManager.soundIDs); - if(shuffle === true){ - useTrack = tempTrack; + var currentTrackKey = this.getIndexByValue(useTrack, this.getCurrentTrack()); + + if( !this.getRepeatStatus() && (this.getPlaylist()).length == currentTrackKey+1 ){ + $log.debug("Last track"); + return null; } - var currentTrackKey = this.getIndexByValue(useTrack, this.getCurrentTrack()); + if(shuffle === true){ + useTrack = tempTrack; + } + var nextTrackKey = +currentTrackKey + 1; var nextTrack = useTrack[nextTrackKey]; if(typeof nextTrack !== 'undefined') { diff --git a/dist/angular-soundmanager2.min.js b/dist/angular-soundmanager2.min.js index db977ba..6ed4a19 100644 --- a/dist/angular-soundmanager2.min.js +++ b/dist/angular-soundmanager2.min.js @@ -1,3 +1,3 @@ -/*! angular-soundmanager2 12-04-2017 */ +/*! angular-soundmanager2 21-04-2017 */ !function(a,b){"use strict";function c(c,d){function e(a){return qa.preferFlash&&ja&&!qa.ignoreFlash&&qa.flash[a]!==b&&qa.flash[a]}function f(a){return function(b){var c,d=this._s;return d&&d._a?c=a.call(this,b):(d&&d.id?qa._wD(d.id+": Ignoring "+b.type):qa._wD(va+"Ignoring "+b.type),c=null),c}}this.setupOptions={url:c||null,flashVersion:8,debugMode:!0,debugFlash:!1,useConsole:!0,consoleOnly:!0,waitForWindowLoad:!1,bgColor:"#ffffff",useHighPerformance:!1,flashPollingInterval:null,html5PollingInterval:null,flashLoadTimeout:1e3,wmode:null,allowScriptAccess:"always",useFlashBlock:!1,useHTML5Audio:!0,html5Test:/^(probably|maybe)$/i,preferFlash:!1,noSWFCache:!1,idPrefix:"sound"},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,duration:null},this.audioFormats={mp3:{type:['audio/mpeg; codecs="mp3"',"audio/mpeg","audio/mp3","audio/MPA","audio/mpa-robust"],required:!0},mp4:{related:["aac","m4a","m4b"],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},opus:{type:["audio/ogg; codecs=opus","audio/opus"],required:!1},wav:{type:['audio/wav; codecs="1"',"audio/wav","audio/wave","audio/x-wav"],required:!1}},this.movieID="sm2-container",this.id=d||"sm2movie",this.debugID="soundmanager-debug",this.debugURLParam=/([#?&])debug=1/i,this.versionNumber="V2.97a.20140901",this.version=null,this.movieURL=null,this.altURL=null,this.swfLoaded=!1,this.enabled=!1,this.oMC=null,this.sounds={},this.soundIDs=[],this.muted=!1,this.didFlashBlock=!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={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},this.html5={usingFlash:null},this.flash={},this.html5Only=!1,this.ignoreFlash=!1;var g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,$,_,aa,ba,ca,da,ea,fa,ga,ha,ia,ja,ka,la,ma,na,oa,pa,qa=this,ra=null,sa=null,ta="soundManager",ua=ta+": ",va="HTML5::",wa=navigator.userAgent,xa=a.location.href.toString(),ya=document,za=[],Aa=!0,Ba=!1,Ca=!1,Da=!1,Ea=!1,Fa=!1,Ga=0,Ha=["log","info","warn","error"],Ia=8,Ja=null,Ka=null,La=!1,Ma=!1,Na=0,Oa=null,Pa=[],Qa=null,Ra=Array.prototype.slice,Sa=!1,Ta=0,Ua=wa.match(/(ipad|iphone|ipod)/i),Va=wa.match(/android/i),Wa=wa.match(/msie/i),Xa=wa.match(/webkit/i),Ya=wa.match(/safari/i)&&!wa.match(/chrome/i),Za=wa.match(/opera/i),$a=wa.match(/(mobile|pre\/|xoom)/i)||Ua||Va,_a=!xa.match(/usehtml5audio/i)&&!xa.match(/sm2\-ignorebadua/i)&&Ya&&!wa.match(/silk/i)&&wa.match(/OS X 10_6_([3-7])/i),ab=a.console!==b&&console.log!==b,bb=ya.hasFocus!==b?ya.hasFocus():null,cb=Ya&&(ya.hasFocus===b||!ya.hasFocus()),db=!cb,eb=/(mp3|mp4|mpa|m4a|m4b)/i,fb=1e3,gb="about:blank",hb=ya.location?ya.location.protocol.match(/http/i):null,ib=hb?"":"http://",jb=/^\s*audio\/(?:x-)?(?:mpeg4|aac|flv|mov|mp4||m4v|m4a|m4b|mp4v|3gp|3g2)\s*(?:$|;)/i,kb=["mpeg4","aac","flv","mov","mp4","m4v","f4v","m4a","m4b","mp4v","3gp","3g2"],lb=new RegExp("\\.("+kb.join("|")+")(\\?.*)?$","i");this.mimePattern=/^\s*audio\/(?:x-)?(?:mp(?:eg|3))\s*(?:$|;)/i,this.useAltURL=!hb,R={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.hasHTML5=function(){try{return Audio!==b&&(Za&&opera!==b&&opera.version()<10?new Audio(null):new Audio).canPlayType!==b}catch(a){return!1}}(),this.setup=function(a){var c=!qa.url;return a!==b&&Da&&Qa&&qa.ok()&&(a.flashVersion!==b||a.url!==b||a.html5Test!==b)&&V(O("setupLate")),q(a),a&&(c&&F&&a.url!==b&&qa.beginDelayedInit(),F||a.url===b||"complete"!==ya.readyState||setTimeout(D,1)),qa},this.ok=function(){return Qa?Da&&!Ea:qa.useHTML5Audio&&qa.hasHTML5},this.supported=this.ok,this.getMovie=function(b){return h(b)||ya[b]||a[b]},this.createSound=function(a,c){function d(){return h=T(h),qa.sounds[h.id]=new g(h),qa.soundIDs.push(h.id),qa.sounds[h.id]}var e,f,h,i=null;if(e=ta+".createSound(): ",f=e+O(Da?"notOK":"notReady"),!Da||!qa.ok())return V(f),!1;if(c!==b&&(a={id:a,url:c}),h=p(a),h.url=$(h.url),void 0===h.id&&(h.id=qa.setupOptions.idPrefix+Ta++),h.id.toString().charAt(0).match(/^[0-9]$/)&&qa._wD(e+O("badID",h.id),2),qa._wD(e+h.id+(h.url?" ("+h.url+")":""),1),W(h.id,!0))return qa._wD(e+h.id+" exists",1),qa.sounds[h.id];if(ba(h))i=d(),qa._wD(h.id+": Using HTML5"),i._setup_html5(h);else{if(qa.html5Only)return qa._wD(h.id+": No HTML5 support for this sound, and no Flash. Exiting."),d();if(qa.html5.usingFlash&&h.url&&h.url.match(/data\:/i))return qa._wD(h.id+": data: URIs not supported via Flash. Exiting."),d();l>8&&(null===h.isMovieStar&&(h.isMovieStar=!!(h.serverURL||h.type&&h.type.match(jb)||h.url&&h.url.match(lb))),h.isMovieStar&&(qa._wD(e+"using MovieStar handling"),h.loops>1&&n("noNSLoop"))),h=U(h,e),i=d(),8===l?sa._createSound(h.id,h.loops||1,h.usePolicyFile):(sa._createSound(h.id,h.url,h.usePeakData,h.useWaveformData,h.useEQData,h.isMovieStar,!!h.isMovieStar&&h.bufferTime,h.loops||1,h.serverURL,h.duration||null,h.autoPlay,!0,h.autoLoad,h.usePolicyFile),h.serverURL||(i.connected=!0,h.onconnect&&h.onconnect.apply(i))),h.serverURL||!h.autoLoad&&!h.autoPlay||i.load(h)}return!h.serverURL&&h.autoPlay&&i.play(),i},this.destroySound=function(a,b){if(!W(a))return!1;var c,d=qa.sounds[a];for(d._iO={},d.stop(),d.unload(),c=0;c=0;a--)qa.sounds[qa.soundIDs[a]].pause()},this.resume=function(a){return!!W(a)&&qa.sounds[a].resume()},this.resumeAll=function(){var a;for(a=qa.soundIDs.length-1;a>=0;a--)qa.sounds[qa.soundIDs[a]].resume()},this.togglePause=function(a){return!!W(a)&&qa.sounds[a].togglePause()},this.setPan=function(a,b){return!!W(a)&&qa.sounds[a].setPan(b)},this.setVolume=function(a,b){return!!W(a)&&qa.sounds[a].setVolume(b)},this.mute=function(a){var b=0;if(a instanceof String&&(a=null),a)return!!W(a)&&(qa._wD(ta+'.mute(): Muting "'+a+'"'),qa.sounds[a].mute());for(qa._wD(ta+".mute(): Muting all sounds"),b=qa.soundIDs.length-1;b>=0;b--)qa.sounds[qa.soundIDs[b]].mute();return qa.muted=!0,!0},this.muteAll=function(){qa.mute()},this.unmute=function(a){var b;if(a instanceof String&&(a=null),a)return!!W(a)&&(qa._wD(ta+'.unmute(): Unmuting "'+a+'"'),qa.sounds[a].unmute());for(qa._wD(ta+".unmute(): Unmuting all sounds"),b=qa.soundIDs.length-1;b>=0;b--)qa.sounds[qa.soundIDs[b]].unmute();return qa.muted=!1,!0},this.unmuteAll=function(){qa.unmute()},this.toggleMute=function(a){return!!W(a)&&qa.sounds[a].toggleMute()},this.getMemoryUse=function(){var a=0;return sa&&8!==l&&(a=parseInt(sa._getMemoryUse(),10)),a},this.disable=function(c){var d;if(c===b&&(c=!1),Ea)return!1;for(Ea=!0,n("shutdown",1),d=qa.soundIDs.length-1;d>=0;d--)L(qa.sounds[qa.soundIDs[d]]);return o(c),ha.remove(a,"load",u),!0},this.canPlayMIME=function(a){var b;return qa.hasHTML5&&(b=ca({type:a})),!b&&Qa&&(b=a&&qa.ok()?!!((l>8?a.match(jb):null)||a.match(qa.mimePattern)):null),b},this.canPlayURL=function(a){var b;return qa.hasHTML5&&(b=ca({url:a})),!b&&Qa&&(b=a&&qa.ok()?!!a.match(qa.filePattern):null),b},this.canPlayLink=function(a){return!(a.type===b||!a.type||!qa.canPlayMIME(a.type))||qa.canPlayURL(a.href)},this.getSoundById=function(a,b){if(!a)return null;var c=qa.sounds[a];return c||b||qa._wD(ta+'.getSoundById(): Sound "'+a+'" not found.',2),c},this.onready=function(b,c){var d="onready";if("function"!=typeof b)throw O("needFunction",d);return Da&&qa._wD(O("queue",d)),c||(c=a),s(d,b,c),t(),!0},this.ontimeout=function(b,c){var d="ontimeout";if("function"!=typeof b)throw O("needFunction",d);return Da&&qa._wD(O("queue",d)),c||(c=a),s(d,b,c),t({type:d}),!0},this._writeDebug=function(a,c){var d,e;return!(!qa.debugMode||!(ab&&qa.useConsole&&(c&&"object"==typeof c?console.log(a,c):Ha[c]!==b?console[Ha[c]](a):console.log(a),qa.consoleOnly))&&(!(d=h("soundmanager-debug"))||(e=ya.createElement("div"),++Ga%2==0&&(e.className="sm2-alt"),c=c===b?0:parseInt(c,10),e.appendChild(ya.createTextNode(a)),c&&(c>=2&&(e.style.fontWeight="bold"),3===c&&(e.style.color="#ff3333")),d.insertBefore(e,d.firstChild),d=null,0)))},-1!==xa.indexOf("sm2-debug=alert")&&(this._writeDebug=function(b){a.alert(b)}),this._wD=this._writeDebug,this._debug=function(){var a,b;for(n("currentObj",1),a=0,b=qa.soundIDs.length;a=0;d--)qa.sounds[qa.soundIDs[d]].destruct();if(sa)try{Wa&&(Ka=sa.innerHTML),Ja=sa.parentNode.removeChild(sa)}catch(a){n("badRemove",2)}if(Ka=Ja=Qa=sa=null,qa.enabled=F=Da=La=Ma=Ba=Ca=Ea=Sa=qa.swfLoaded=!1,qa.soundIDs=[],qa.sounds={},Ta=0,b)za=[];else for(d in za)if(za.hasOwnProperty(d))for(e=0,f=za[d].length;e0&&q.position===q.duration&&(qa._wD(d+"Sound at end, resetting to position:0"),a.position=0),q.paused&&q.position>=0&&(!q._iO.serverURL||q.position>0))qa._wD(d+"Resuming from paused state",1),q.resume();else{if(q._iO=p(a,q._iO),(!q.isHTML5&&null!==q._iO.position&&q._iO.position>0||null!==q._iO.from&&q._iO.from>0||null!==q._iO.to)&&0===q.instanceCount&&0===q.playState&&!q._iO.serverURL){if(i=function(){q._iO=p(a,q._iO),q.play(q._iO)},q.isHTML5&&!q._html5_canplay?(qa._wD(d+"Beginning load for non-zero offset case"),q.load({_oncanplay:i}),t=!1):q.isHTML5||q.loaded||q.readyState&&2===q.readyState||(qa._wD(d+"Preloading for non-zero offset case"),q.load({onload:i}),t=!1),null!==t)return t;q._iO=j()}(!q.instanceCount||q._iO.multiShotEvents||q.isHTML5&&q._iO.multiShot&&!Sa||!q.isHTML5&&l>8&&!q.getAutoPlay())&&q.instanceCount++,q._iO.onposition&&0===q.playState&&h(q),q.playState=1,q.paused=!1,q.position=q._iO.position===b||isNaN(q._iO.position)?0:q._iO.position,q.isHTML5||(q._iO=U(T(q._iO))),q._iO.onplay&&c&&(q._iO.onplay.apply(q),r=!0),q.setVolume(q._iO.volume,!0),q.setPan(q._iO.pan,!0),q.isHTML5?q.instanceCount<2?(g(),f=q._setup_html5(),q.setPosition(q._iO.position),f.play()):(qa._wD(q.id+": Cloning Audio() for instance #"+q.instanceCount+"..."),k=new Audio(q._iO.url),m=function(){ha.remove(k,"ended",m),q._onfinish(q),ea(k),k=null},n=function(){ha.remove(k,"canplay",n);try{k.currentTime=q._iO.position/fb}catch(a){V(q.id+": multiShot play() failed to apply position of "+q._iO.position/fb)}k.play()},ha.add(k,"ended",m),void 0!==q._iO.volume&&(k.volume=Math.max(0,Math.min(1,q._iO.volume/100))),q.muted&&(k.muted=!0),q._iO.position?ha.add(k,"canplay",n):k.play()):(s=sa._start(q.id,q._iO.loops||1,9===l?q.position:q.position/fb,q._iO.multiShot||!1),9!==l||s||(qa._wD(d+"No sound hardware, or 32-sound ceiling hit",2),q._iO.onplayerror&&q._iO.onplayerror.apply(q)))}return q},this.start=this.play,this.stop=function(a){var b,c=q._iO;return 1===q.playState&&(qa._wD(q.id+": stop()"),q._onbufferchange(0),q._resetOnPosition(0),q.paused=!1,q.isHTML5||(q.playState=0),i(),c.to&&q.clearOnPosition(c.to),q.isHTML5?q._a&&(b=q.position,q.setPosition(0),q.position=b,q._a.pause(),q.playState=0,q._onTimer(),f()):(sa._stop(q.id,a),c.serverURL&&q.unload()),q.instanceCount=0,q._iO={},c.onstop&&c.onstop.apply(q)),q},this.setAutoPlay=function(a){qa._wD(q.id+": Autoplay turned "+(a?"on":"off")),q._iO.autoPlay=a,q.isHTML5||(sa._setAutoPlay(q.id,a),a&&(q.instanceCount||1!==q.readyState||(q.instanceCount++,qa._wD(q.id+": Incremented instance count to "+q.instanceCount))))},this.getAutoPlay=function(){return q._iO.autoPlay},this.setPosition=function(a){a===b&&(a=0);var c,d,e=q.isHTML5?Math.max(a,0):Math.min(q.duration||q._iO.duration,Math.max(a,0));if(q.position=e,d=q.position/fb,q._resetOnPosition(q.position),q._iO.position=e,q.isHTML5){if(q._a){if(q._html5_canplay){if(q._a.currentTime!==d){qa._wD(q.id+": setPosition("+d+")");try{q._a.currentTime=d,(0===q.playState||q.paused)&&q._a.pause()}catch(a){qa._wD(q.id+": setPosition("+d+") failed: "+a.message,2)}}}else if(d)return qa._wD(q.id+": setPosition("+d+"): Cannot seek yet, sound not ready",2),q;q.paused&&q._onTimer(!0)}}else c=9===l?q.position:d,q.readyState&&2!==q.readyState&&sa._setPosition(q.id,c,q.paused||!q.playState,q._iO.multiShot);return q},this.pause=function(a){return q.paused||0===q.playState&&1!==q.readyState?q:(qa._wD(q.id+": pause()"),q.paused=!0,q.isHTML5?(q._setup_html5().pause(),f()):(a||a===b)&&sa._pause(q.id,q._iO.multiShot),q._iO.onpause&&q._iO.onpause.apply(q),q)},this.resume=function(){var a=q._iO;return q.paused?(qa._wD(q.id+": resume()"),q.paused=!1,q.playState=1,q.isHTML5?(q._setup_html5().play(),g()):(a.isMovieStar&&!a.serverURL&&q.setPosition(q.position),sa._pause(q.id,a.multiShot)),!r&&a.onplay?(a.onplay.apply(q),r=!0):a.onresume&&a.onresume.apply(q),q):q},this.togglePause=function(){return qa._wD(q.id+": togglePause()"),0===q.playState?(q.play({position:9!==l||q.isHTML5?q.position/fb:q.position}),q):(q.paused?q.resume():q.pause(),q)},this.setPan=function(a,c){return a===b&&(a=0),c===b&&(c=!1),q.isHTML5||sa._setPan(q.id,a),q._iO.pan=a,c||(q.pan=a,q.options.pan=a),q},this.setVolume=function(a,c){return a===b&&(a=100),c===b&&(c=!1),q.isHTML5?q._a&&(qa.muted&&!q.muted&&(q.muted=!0,q._a.muted=!0),q._a.volume=Math.max(0,Math.min(1,a/100))):sa._setVolume(q.id,qa.muted&&!q.muted||q.muted?0:a),q._iO.volume=a,c||(q.volume=a,q.options.volume=a),q},this.mute=function(){return q.muted=!0,q.isHTML5?q._a&&(q._a.muted=!0):sa._setVolume(q.id,0),q},this.unmute=function(){q.muted=!1;var a=q._iO.volume!==b;return q.isHTML5?q._a&&(q._a.muted=!1):sa._setVolume(q.id,a?q._iO.volume:q.options.volume),q},this.toggleMute=function(){return q.muted?q.unmute():q.mute()},this.onPosition=function(a,c,d){return s.push({position:parseInt(a,10),method:c,scope:d!==b?d:q,fired:!1}),q},this.onposition=this.onPosition,this.clearOnPosition=function(a,b){var c;if(a=parseInt(a,10),isNaN(a))return!1;for(c=0;c=c)return!1;for(a=c-1;a>=0;a--)b=s[a],!b.fired&&q.position>=b.position&&(b.fired=!0,t++,b.method.apply(b.scope,[b.position]),c=s.length);return!0},this._resetOnPosition=function(a){var b,c,d=s.length;if(!d)return!1;for(b=d-1;b>=0;b--)c=s[b],c.fired&&a<=c.position&&(c.fired=!1,t--);return!0},j=function(){var a,b,c=q._iO,d=c.from,e=c.to;return b=function(){qa._wD(q.id+': "To" time of '+e+" reached."),q.clearOnPosition(e,b),q.stop()},a=function(){qa._wD(q.id+': Playing "from" '+d),null===e||isNaN(e)||q.onPosition(e,b)},null===d||isNaN(d)||(c.position=d,c.multiShot=!1,a()),c},h=function(){var a,b=q._iO.onposition;if(b)for(a in b)b.hasOwnProperty(a)&&q.onPosition(parseInt(a,10),b[a])},i=function(){var a,b=q._iO.onposition;if(b)for(a in b)b.hasOwnProperty(a)&&q.clearOnPosition(parseInt(a,10))},g=function(){q.isHTML5&&X(q)},f=function(){q.isHTML5&&Y(q)},c=function(a){a||(s=[],t=0),r=!1,q._hasTimer=null,q._a=null,q._html5_canplay=!1,q.bytesLoaded=null,q.bytesTotal=null,q.duration=q._iO&&q._iO.duration?q._iO.duration:null,q.durationEstimate=null,q.buffered=[],q.eqData=[],q.eqData.left=[],q.eqData.right=[],q.failures=0,q.isBuffering=!1,q.instanceOptions={},q.instanceCount=0,q.loaded=!1,q.metadata={},q.readyState=0,q.muted=!1,q.paused=!1,q.peakData={left:0,right:0},q.waveformData={left:[],right:[]},q.playState=0,q.position=null,q.id3={}},c(),this._onTimer=function(a){var b,c,d=!1,e={};if(q._hasTimer||a)return q._a&&(a||(q.playState>0||1===q.readyState)&&!q.paused)&&(b=q._get_html5_duration(),b!==k.duration&&(k.duration=b,q.duration=b,d=!0),q.durationEstimate=q.duration,c=q._a.currentTime*fb||0,c!==k.time&&(k.time=c,d=!0),(d||a)&&q._whileplaying(c,e,e,e,e)),d},this._get_html5_duration=function(){var a=q._iO,b=q._a&&q._a.duration?q._a.duration*fb:a&&a.duration?a.duration:null;return b&&!isNaN(b)&&b!==1/0?b:null},this._apply_loop=function(a,b){!a.loop&&b>1&&qa._wD("Note: Native HTML5 looping is infinite.",1),a.loop=b>1?"loop":""},this._setup_html5=function(a){var b,e=p(q._iO,a),f=Sa?ra:q._a,g=decodeURI(e.url);if(Sa?g===decodeURI(ia)&&(b=!0):g===decodeURI(u)&&(b=!0),f){if(f._s)if(Sa)f._s&&f._s.playState&&!b&&f._s.stop();else if(!Sa&&g===decodeURI(u))return q._apply_loop(f,e.loops),f;b||(u&&c(!1),f.src=e.url,q.url=e.url,u=e.url,ia=e.url,f._called_load=!1)}else e.autoLoad||e.autoPlay?(q._a=new Audio(e.url),q._a.load()):q._a=Za&&opera.version()<10?new Audio(null):new Audio,f=q._a,f._called_load=!1,Sa&&(ra=f);return q.isHTML5=!0,q._a=f,f._s=q,d(),q._apply_loop(f,e.loops),e.autoLoad||e.autoPlay?q.load():(f.autobuffer=!1,f.preload="auto"),f},d=function(){function a(a,b,c){return q._a?q._a.addEventListener(a,b,c||!1):null}if(q._a._added_events)return!1;var b;q._a._added_events=!0;for(b in ma)ma.hasOwnProperty(b)&&a(b,ma[b]);return!0},e=function(){function a(a,b,c){return q._a?q._a.removeEventListener(a,b,c||!1):null}var b;qa._wD(q.id+": Removing event listeners"),q._a._added_events=!1;for(b in ma)ma.hasOwnProperty(b)&&a(b,ma[b])},this._onload=function(a){var b,c=!!a||!q.isHTML5&&8===l&&q.duration;return b=q.id+": ",qa._wD(b+(c?"onload()":"Failed to load / invalid sound?"+(q.duration?" -":" Zero-length duration reported.")+" ("+q.url+")"),c?1:2),c||q.isHTML5||(!0===qa.sandbox.noRemote&&qa._wD(b+O("noNet"),1),!0===qa.sandbox.noLocal&&qa._wD(b+O("noLocal"),1)),q.loaded=c,q.readyState=c?3:2,q._onbufferchange(0),q._iO.onload&&pa(q,function(){q._iO.onload.apply(q,[c])}),!0},this._onbufferchange=function(a){return!(0===q.playState||a&&q.isBuffering||!a&&!q.isBuffering||(q.isBuffering=1===a,q._iO.onbufferchange&&(qa._wD(q.id+": Buffer state change: "+a),q._iO.onbufferchange.apply(q,[a])),0))},this._onsuspend=function(){return q._iO.onsuspend&&(qa._wD(q.id+": Playback suspended"),q._iO.onsuspend.apply(q)),!0},this._onfailure=function(a,b,c){q.failures++,qa._wD(q.id+": Failure ("+q.failures+"): "+a),q._iO.onfailure&&1===q.failures?q._iO.onfailure(a,b,c):qa._wD(q.id+": Ignoring failure")},this._onwarning=function(a,b,c){q._iO.onwarning&&q._iO.onwarning(a,b,c)},this._onfinish=function(){var a=q._iO.onfinish;q._onbufferchange(0),q._resetOnPosition(0),q.instanceCount&&(q.instanceCount--,q.instanceCount||(i(),q.playState=0,q.paused=!1,q.instanceCount=0,q.instanceOptions={},q._iO={},f(),q.isHTML5&&(q.position=0)),q.instanceCount&&!q._iO.multiShotEvents||a&&(qa._wD(q.id+": onfinish()"),pa(q,function(){a.apply(q)})))},this._whileloading=function(a,b,c,d){var e=q._iO;q.bytesLoaded=a,q.bytesTotal=b,q.duration=Math.floor(c),q.bufferLength=d,q.isHTML5||e.isMovieStar?q.durationEstimate=q.duration:e.duration?q.durationEstimate=q.duration>e.duration?q.duration:e.duration:q.durationEstimate=parseInt(q.bytesTotal/q.bytesLoaded*q.duration,10),q.isHTML5||(q.buffered=[{start:0,end:q.duration}]),(3!==q.readyState||q.isHTML5)&&e.whileloading&&e.whileloading.apply(q)},this._whileplaying=function(a,c,d,e,f){var g,h=q._iO;return!isNaN(a)&&null!==a&&(q.position=Math.max(0,a),q._processOnPosition(),!q.isHTML5&&l>8&&(h.usePeakData&&c!==b&&c&&(q.peakData={left:c.leftPeak,right:c.rightPeak}),h.useWaveformData&&d!==b&&d&&(q.waveformData={left:d.split(","),right:e.split(",")}),h.useEQData&&f!==b&&f&&f.leftEQ&&(g=f.leftEQ.split(","),q.eqData=g,q.eqData.left=g,f.rightEQ!==b&&f.rightEQ&&(q.eqData.right=f.rightEQ.split(",")))),1===q.playState&&(q.isHTML5||8!==l||q.position||!q.isBuffering||q._onbufferchange(0),h.whileplaying&&h.whileplaying.apply(q)),!0)},this._oncaptiondata=function(a){qa._wD(q.id+": Caption data received."),q.captiondata=a,q._iO.oncaptiondata&&q._iO.oncaptiondata.apply(q,[a])},this._onmetadata=function(a,b){qa._wD(q.id+": Metadata received.");var c,d,e={};for(c=0,d=a.length;c0&&(qa._wD(q.id+": Data error: "+a),q._iO.ondataerror&&q._iO.ondataerror.apply(q))},this._debug()},G=function(){return ya.body||ya.getElementsByTagName("div")[0]},h=function(a){return ya.getElementById(a)},p=function(a,c){var d,e,f=a||{};d=c===b?qa.defaultOptions:c;for(e in d)d.hasOwnProperty(e)&&f[e]===b&&("object"!=typeof d[e]||null===d[e]?f[e]=d[e]:f[e]=p(f[e],d[e]));return f},pa=function(b,c){b.isHTML5||8!==l?c():a.setTimeout(c,0)},r={onready:1,ontimeout:1,defaultOptions:1,flash9Options:1,movieStarOptions:1},q=function(a,c){var d,e=!0,f=c!==b,g=qa.setupOptions,h=r;if(a===b){e=[];for(d in g)g.hasOwnProperty(d)&&e.push(d);for(d in h)h.hasOwnProperty(d)&&("object"==typeof qa[d]?e.push(d+": {...}"):qa[d]instanceof Function?e.push(d+": function() {...}"):e.push(d));return qa._wD(O("setup",e.join(", "))),!1}for(d in a)if(a.hasOwnProperty(d))if("object"!=typeof a[d]||null===a[d]||a[d]instanceof Array||a[d]instanceof RegExp)f&&h[c]!==b?qa[c][d]=a[d]:g[d]!==b?(qa.setupOptions[d]=a[d],qa[d]=a[d]):h[d]===b?(V(O(qa[d]===b?"setupUndef":"setupError",d),2),e=!1):qa[d]instanceof Function?qa[d].apply(qa,a[d]instanceof Array?a[d]:[a[d]]):qa[d]=a[d];else{if(h[d]!==b)return q(a[d],d);V(O(qa[d]===b?"setupUndef":"setupError",d),2),e=!1}return e},ha=function(){function b(a){var b=Ra.call(a),c=b.length;return f?(b[1]="on"+b[1],c>3&&b.pop()):3===c&&b.push(!1),b}function c(a,b){var c=a.shift(),d=[g[b]];f?c[d](a[0],a[1]):c[d].apply(c,a)}function d(){c(b(arguments),"add")}function e(){c(b(arguments),"remove")}var f=a.attachEvent,g={add:f?"attachEvent":"addEventListener",remove:f?"detachEvent":"removeEventListener"};return{add:d,remove:e}}(),ma={abort:f(function(){qa._wD(this._s.id+": abort")}),canplay:f(function(){var a,c=this._s;if(c._html5_canplay)return!0;if(c._html5_canplay=!0,qa._wD(c.id+": canplay"),c._onbufferchange(0),a=c._iO.position===b||isNaN(c._iO.position)?null:c._iO.position/fb,this.currentTime!==a){qa._wD(c.id+": canplay: Setting position to "+a);try{this.currentTime=a}catch(b){qa._wD(c.id+": canplay: Setting position of "+a+" failed: "+b.message,2)}}c._iO._oncanplay&&c._iO._oncanplay()}),canplaythrough:f(function(){var a=this._s;a.loaded||(a._onbufferchange(0),a._whileloading(a.bytesLoaded,a.bytesTotal,a._get_html5_duration()),a._onload(!0))}),durationchange:f(function(){var a,b=this._s;a=b._get_html5_duration(),isNaN(a)||a===b.duration||(qa._wD(this._s.id+": durationchange ("+a+")"+(b.duration?", previously "+b.duration:"")),b.durationEstimate=b.duration=a)}),ended:f(function(){var a=this._s;qa._wD(a.id+": ended"),a._onfinish()}),error:f(function(){qa._wD(this._s.id+": HTML5 error, code "+this.error.code),this._s._onload(!1)}),loadeddata:f(function(){var a=this._s;qa._wD(a.id+": loadeddata"),a._loaded||Ya||(a.duration=a._get_html5_duration())}),loadedmetadata:f(function(){qa._wD(this._s.id+": loadedmetadata")}),loadstart:f(function(){qa._wD(this._s.id+": loadstart"),this._s._onbufferchange(1)}),play:f(function(){this._s._onbufferchange(0)}),playing:f(function(){qa._wD(this._s.id+": playing "+String.fromCharCode(9835)),this._s._onbufferchange(0)}),progress:f(function(a){var b,c,d,e=this._s,f=0,g="progress"===a.type,h=a.target.buffered,i=a.loaded||0,j=a.total||1;if(e.buffered=[],h&&h.length){for(b=0,c=h.length;b1){for(d=[],c=h.length,b=0;b=0;f--)h["audio/"+e[c].related[f]]=h[c],qa.html5[e[c].related[f]]=h[c],qa.flash[e[c].related[f]]=h[c];return h.canPlayType=g?a:null,qa.html5=p(qa.html5,h),qa.html5.usingFlash=aa(),Qa=qa.html5.usingFlash,!0},A={notReady:"Unavailable - wait until onready() has fired.",notOK:"Audio support is not available.",domError:ta+"exception caught while appending SWF to DOM.",spcWmode:"Removing wmode, preventing known SWF loading issue(s)",swf404:ua+"Verify that %s is a valid path.",tryDebug:"Try "+ta+".debugFlash = true for more security details (output goes to SWF.)",checkSWF:"See SWF output for more debug info.",localFail:ua+"Non-HTTP page ("+ya.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:ua+"Special case: Waiting for SWF to load with window focus...",waitForever:ua+"Waiting indefinitely for Flash (will recover if unblocked)...",waitSWF:ua+"Waiting for 100% SWF load...",needFunction:ua+"Function object expected for %s",badID:'Sound ID "%s" should be a string, starting with a non-numeric character',currentObj:ua+"_debug(): Current sound objects",waitOnload:ua+"Waiting for window.onload()",docLoaded:ua+"Document already loaded",onload:ua+"initComplete(): calling soundManager.onload()",onloadOK:ta+".onload() complete",didInit:ua+"init(): Already called?",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",badRemove:ua+"Failed to remove Flash node.",shutdown:ta+".disable(): Shutting down",queue:ua+"Queueing %s handler",smError:"SMSound.load(): Exception: JS-Flash communication failed, or JS error.",fbTimeout:"No flash response, applying ."+R.swfTimedout+" CSS...",fbLoaded:"Flash loaded",fbHandler:ua+"flashBlockHandler()",manURL:"SMSound.load(): Using manually-assigned URL",onURL:ta+".load(): current URL already assigned.",badFV:ta+'.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",needFlash:ua+"Fatal error: Flash is needed to play some required formats, but is not available.",gotFocus:ua+"Got window focus.",policy:"Enabling usePolicyFile for data access",setup:ta+".setup(): allowed parameters: %s",setupError:ta+'.setup(): "%s" cannot be assigned with this method.',setupUndef:ta+'.setup(): Could not find option "%s"',setupLate:ta+".setup(): url, flashVersion and html5Test property changes will not take effect until reboot().",noURL:ua+"Flash URL required. Call soundManager.setup({url:...}) to get started.",sm2Loaded:"SoundManager 2: Ready. "+String.fromCharCode(10003),reset:ta+".reset(): Removing event callbacks",mobileUA:"Mobile UA detected, preferring HTML5 by default.",globalHTML5:"Using singleton HTML5 Audio() pattern for this device."},O=function(){var a,b,c,d,e;if(a=Ra.call(arguments),d=a.shift(),(e=A&&A[d]?A[d]:"")&&a&&a.length)for(b=0,c=a.length;b1&&a.stream&&(n("as2loop"),a.stream=!1),a},U=function(a,b){return a&&!a.usePolicyFile&&(a.onid3||a.usePeakData||a.useWaveformData||a.useEQData)&&(qa._wD((b||"")+O("policy")),a.usePolicyFile=!0),a},V=function(a){ab&&console.warn!==b?console.warn(a):qa._wD(a)},i=function(){return!1},L=function(a){var b;for(b in a)a.hasOwnProperty(b)&&"function"==typeof a[b]&&(a[b]=i);b=null},M=function(a){a===b&&(a=!1),(Ea||a)&&qa.disable(a)},N=function(a){var b;if(a)if(a.match(/\.swf(\?.*)?$/i)){if(a.substr(a.toLowerCase().lastIndexOf(".swf?")+4))return a}else a.lastIndexOf("/")!==a.length-1&&(a+="/");return b=(a&&-1!==a.lastIndexOf("/")?a.substr(0,a.lastIndexOf("/")+1):"./")+qa.movieURL,qa.noSWFCache&&(b+="?ts="+(new Date).getTime()),b},y=function(){8!==(l=parseInt(qa.flashVersion,10))&&9!==l&&(qa._wD(O("badFV",l,Ia)),qa.flashVersion=l=Ia);var a=qa.debugMode||qa.debugFlash?"_debug.swf":".swf";qa.useHTML5Audio&&!qa.html5Only&&qa.audioFormats.mp4.required&&l<9&&(qa._wD(O("needfl9")),qa.flashVersion=l=9),qa.version=qa.versionNumber+(qa.html5Only?" (HTML5-only mode)":9===l?" (AS3/Flash 9)":" (AS2/Flash 8)"),l>8?(qa.defaultOptions=p(qa.defaultOptions,qa.flash9Options),qa.features.buffering=!0,qa.defaultOptions=p(qa.defaultOptions,qa.movieStarOptions),qa.filePatterns.flash9=new RegExp("\\.(mp3|"+kb.join("|")+")(\\?.*)?$","i"),qa.features.movieStar=!0):qa.features.movieStar=!1,qa.filePattern=qa.filePatterns[8!==l?"flash9":"flash8"],qa.movieURL=(8===l?"soundmanager2.swf":"soundmanager2_flash9.swf").replace(".swf",a),qa.features.peakData=qa.features.waveformData=qa.features.eqData=l>8},J=function(a,b){if(!sa)return!1;sa._setPolling(a,b)},K=function(){if(qa.debugURLParam.test(xa)&&(qa.debugMode=!0),h(qa.debugID))return!1;var a,b,c,d,e;if(qa.debugMode&&!h(qa.debugID)&&(!ab||!qa.useConsole||!qa.consoleOnly)){a=ya.createElement("div"),a.id=qa.debugID+"-toggle",d={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},a.appendChild(ya.createTextNode("-")),a.onclick=S,a.title="Toggle SM2 debug console",wa.match(/msie 6/i)&&(a.style.position="absolute",a.style.cursor="hand");for(e in d)d.hasOwnProperty(e)&&(a.style[e]=d[e]);if(b=ya.createElement("div"),b.id=qa.debugID,b.style.display=qa.debugMode?"block":"none",qa.debugMode&&!h(a.id)){try{c=G(),c.appendChild(a)}catch(a){throw new Error(O("domError")+" \n"+a.toString())}c.appendChild(b)}}c=null},W=this.getSoundById,n=function(a,b){return a?qa._wD(O(a),b):""},S=function(){var a=h(qa.debugID),b=h(qa.debugID+"-toggle");if(!a)return!1;Aa?(b.innerHTML="+",a.style.display="none"):(b.innerHTML="-",a.style.display="block"),Aa=!Aa},m=function(c,d,e){if(a.sm2Debugger!==b)try{sm2Debugger.handleEvent(c,d,e)}catch(a){return!1}return!0},Q=function(){var a=[];return qa.debugMode&&a.push(R.sm2Debug),qa.debugFlash&&a.push(R.flashDebug),qa.useHighPerformance&&a.push(R.highPerf),a.join(" ")},P=function(){var a=O("fbHandler"),b=qa.getMoviePercent(),c=R,d={type:"FLASHBLOCK"};if(qa.html5Only)return!1;qa.ok()?(qa.didFlashBlock&&qa._wD(a+": Unblocked"),qa.oMC&&(qa.oMC.className=[Q(),c.swfDefault,c.swfLoaded+(qa.didFlashBlock?" "+c.swfUnblocked:"")].join(" "))):(Qa&&(qa.oMC.className=Q()+" "+c.swfDefault+" "+(null===b?c.swfTimedout:c.swfError),qa._wD(a+": "+O("fbTimeout")+(b?" ("+O("fbLoaded")+")":""))),qa.didFlashBlock=!0,t({type:"ontimeout",ignoreInit:!0,error:d}),I(d))},s=function(a,c,d){za[a]===b&&(za[a]=[]),za[a].push({method:c,scope:d||null,fired:!1})},t=function(a){if(a||(a={type:qa.ok()?"onready":"ontimeout"}),!Da&&a&&!a.ignoreInit)return!1;if("ontimeout"===a.type&&(qa.ok()||Ea&&!a.ignoreInit))return!1;var b,c,d={success:a&&a.ignoreInit?qa.ok():!Ea},e=a&&a.type?za[a.type]||[]:[],f=[],g=[d],h=Qa&&!qa.ok();for(a.error&&(g[0].error=a.error),b=0,c=e.length;b=0;a--)qa.sounds[qa.soundIDs[a]].isHTML5&&qa.sounds[qa.soundIDs[a]]._hasTimer&&qa.sounds[qa.soundIDs[a]]._onTimer()},I=function(c){c=c!==b?c:{},"function"==typeof qa.onerror&&qa.onerror.apply(a,[{type:c.type!==b?c.type:null}]),c.fatal!==b&&c.fatal&&qa.disable()},la=function(){if(!_a||!ka())return!1;var a,b,c=qa.audioFormats;for(b in c)if(c.hasOwnProperty(b)&&("mp3"===b||"mp4"===b)&&(qa._wD(ta+": Using flash fallback for "+b+" format"),qa.html5[b]=!1,c[b]&&c[b].related))for(a=c[b].related.length-1;a>=0;a--)qa.html5[c[b].related[a]]=!1},this._setSandboxType=function(a){var c=qa.sandbox;c.type=a,c.description=c.types[c.types[a]!==b?a:"unknown"],"localWithFile"===c.type?(c.noRemote=!0,c.noLocal=!1,n("secNote",2)):"localWithNetwork"===c.type?(c.noRemote=!1,c.noLocal=!0):"localTrusted"===c.type&&(c.noRemote=!1,c.noLocal=!1)},this._externalInterfaceOK=function(a){if(qa.swfLoaded)return!1;var b;if(m("swf",!0),m("flashtojs",!0),qa.swfLoaded=!0,cb=!1,_a&&la(),!a||a.replace(/\+dev/i,"")!==qa.versionNumber.replace(/\+dev/i,""))return b=ta+': Fatal: JavaScript file build "'+qa.versionNumber+'" does not match Flash SWF build "'+a+'" at '+qa.url+". Ensure both are up-to-date.",setTimeout(function(){throw new Error(b)},0),!1;setTimeout(k,Wa?100:1)},H=function(a,c){function d(){var a,b=[],c=[],d=" + ";a="SoundManager "+qa.version+(!qa.html5Only&&qa.useHTML5Audio?qa.hasHTML5?" + HTML5 audio":", no HTML5 audio support":""),qa.html5Only?qa.html5PollingInterval&&b.push("html5PollingInterval ("+qa.html5PollingInterval+"ms)"):(qa.preferFlash&&b.push("preferFlash"),qa.useHighPerformance&&b.push("useHighPerformance"),qa.flashPollingInterval&&b.push("flashPollingInterval ("+qa.flashPollingInterval+"ms)"),qa.html5PollingInterval&&b.push("html5PollingInterval ("+qa.html5PollingInterval+"ms)"),qa.wmode&&b.push("wmode ("+qa.wmode+")"),qa.debugFlash&&b.push("debugFlash"),qa.useFlashBlock&&b.push("flashBlock")),b.length&&(c=c.concat([b.join(d)])),qa._wD(a+(c.length?d+c.join(", "):""),1),na()}function e(a,b){return''}if(Ba&&Ca)return!1;if(qa.html5Only)return y(),d(),qa.oMC=h(qa.movieID),k(),Ba=!0,Ca=!0,!1;var f,g,i,j,l,m,n,o,p=c||qa.url,q=qa.altURL||p,r=G(),s=Q(),t=null,u=ya.getElementsByTagName("html")[0];if(t=u&&u.dir&&u.dir.match(/rtl/i),a=a===b?qa.id:a,y(),qa.url=N(hb?p:q),c=qa.url,qa.wmode=!qa.wmode&&qa.useHighPerformance?"transparent":qa.wmode,null!==qa.wmode&&(wa.match(/msie 8/i)||!Wa&&!qa.useHighPerformance)&&navigator.platform.match(/win32|win64/i)&&(Pa.push(A.spcWmode),qa.wmode=null),f={name:a,id:a,src:c,quality:"high",allowScriptAccess:qa.allowScriptAccess,bgcolor:qa.bgColor,pluginspage:ib+"www.macromedia.com/go/getflashplayer",title:"JS/Flash audio component (SoundManager 2)",type:"application/x-shockwave-flash",wmode:qa.wmode,hasPriority:"true"},qa.debugFlash&&(f.FlashVars="debug=1"),qa.wmode||delete f.wmode,Wa)g=ya.createElement("div"),j=['',e("movie",c),e("AllowScriptAccess",qa.allowScriptAccess),e("quality",f.quality),qa.wmode?e("wmode",qa.wmode):"",e("bgcolor",qa.bgColor),e("hasPriority","true"),qa.debugFlash?e("FlashVars",f.FlashVars):"",""].join("");else{g=ya.createElement("embed");for(i in f)f.hasOwnProperty(i)&&g.setAttribute(i,f[i])}if(K(),s=Q(),r=G())if(qa.oMC=h(qa.movieID)||ya.createElement("div"),qa.oMC.id)o=qa.oMC.className,qa.oMC.className=(o?o+" ":R.swfDefault)+(s?" "+s:""),qa.oMC.appendChild(g),Wa&&(l=qa.oMC.appendChild(ya.createElement("div")),l.className=R.swfBox,l.innerHTML=j),Ca=!0;else{if(qa.oMC.id=qa.movieID,qa.oMC.className=R.swfDefault+" "+s,m=null,l=null,qa.useFlashBlock||(qa.useHighPerformance?m={position:"fixed",width:"8px",height:"8px",bottom:"0px",left:"0px",overflow:"hidden"}:(m={position:"absolute",width:"6px",height:"6px",top:"-9999px",left:"-9999px"},t&&(m.left=Math.abs(parseInt(m.left,10))+"px"))),Xa&&(qa.oMC.style.zIndex=1e4),!qa.debugFlash)for(n in m)m.hasOwnProperty(n)&&(qa.oMC.style[n]=m[n]);try{Wa||qa.oMC.appendChild(g),r.appendChild(qa.oMC),Wa&&(l=qa.oMC.appendChild(ya.createElement("div")),l.className=R.swfBox,l.innerHTML=j),Ca=!0}catch(a){throw new Error(O("domError")+" \n"+a.toString())}}return Ba=!0,d(),!0},B=function(){return qa.html5Only?(H(),!1):!sa&&(qa.url?(sa=qa.getMovie(qa.id),sa||(Ja?(Wa?qa.oMC.innerHTML=Ka:qa.oMC.appendChild(Ja),Ja=null,Ba=!0):H(qa.id,qa.url),sa=qa.getMovie(qa.id)),"function"==typeof qa.oninitmovie&&setTimeout(qa.oninitmovie,1),oa(),!0):(n("noURL"),!1))},v=function(){setTimeout(w,1e3)},x=function(){a.setTimeout(function(){V(ua+"useFlashBlock is false, 100% HTML5 mode is possible. Rebooting with preferFlash: false..."),qa.setup({preferFlash:!1}).reboot(),qa.didFlashBlock=!0,qa.beginDelayedInit()},1)},w=function(){var b,c=!1;return!!qa.url&&!La&&(La=!0,ha.remove(a,"load",v),ja&&cb&&!bb?(n("waitFocus"),!1):(Da||(b=qa.getMoviePercent())>0&&b<100&&(c=!0),void setTimeout(function(){if(b=qa.getMoviePercent(),c)return La=!1,qa._wD(O("waitSWF")),a.setTimeout(v,1),!1;Da||(qa._wD(ta+": No Flash response within expected time. Likely causes: "+(0===b?"SWF load failed, ":"")+"Flash blocked or JS-Flash security error."+(qa.debugFlash?" "+O("checkSWF"):""),2),!hb&&b&&(n("localFail",2),qa.debugFlash||n("tryDebug",2)),0===b&&qa._wD(O("swf404",qa.url),1),m("flashtojs",!1," (Check flash security or flash blockers)")),!Da&&db&&(null===b?qa.useFlashBlock||0===qa.flashLoadTimeout?(qa.useFlashBlock&&P(),n("waitForever")):!qa.useFlashBlock&&_?x():(n("waitForever"),t({type:"ontimeout",ignoreInit:!0,error:{type:"INIT_FLASHBLOCK"}})):0===qa.flashLoadTimeout?n("waitForever"):!qa.useFlashBlock&&_?x():M(!0))},qa.flashLoadTimeout)))},z=function(){function b(){ha.remove(a,"focus",z)}return bb||!cb?(b(),!0):(db=!0,bb=!0,n("gotFocus"),La=!1,v(),b(),!0)},oa=function(){Pa.length&&(qa._wD("SoundManager 2: "+Pa.join(" "),1),Pa=[])},na=function(){oa();var a,b=[];if(qa.useHTML5Audio&&qa.hasHTML5){for(a in qa.audioFormats)qa.audioFormats.hasOwnProperty(a)&&b.push(a+" = "+qa.html5[a]+(!qa.html5[a]&&Qa&&qa.flash[a]?" (using flash)":qa.preferFlash&&qa.flash[a]&&Qa?" (preferring flash)":qa.html5[a]?"":" ("+(qa.audioFormats[a].required?"required, ":"")+"and no flash support)"));qa._wD("SoundManager 2 HTML5 support: "+b.join(", "),1)}},o=function(b){if(Da)return!1;if(qa.html5Only)return n("sm2Loaded",1),Da=!0,u(),m("onload",!0),!0;var c,d=qa.useFlashBlock&&qa.flashLoadTimeout&&!qa.getMoviePercent(),e=!0;return d||(Da=!0),c={type:!ja&&Qa?"NO_FLASH":"INIT_TIMEOUT"},qa._wD("SoundManager 2 "+(Ea?"failed to load":"loaded")+" ("+(Ea?"Flash security/load error":"OK")+") "+String.fromCharCode(Ea?10006:10003),Ea?2:1),Ea||b?(qa.useFlashBlock&&qa.oMC&&(qa.oMC.className=Q()+" "+(null===qa.getMoviePercent()?R.swfTimedout:R.swfError)),t({type:"ontimeout",error:c,ignoreInit:!0}),m("onload",!1),I(c),e=!1):m("onload",!0),Ea||(qa.waitForWindowLoad&&!Fa?(n("waitOnload"),ha.add(a,"load",u)):(qa.waitForWindowLoad&&Fa&&n("docLoaded"),u())),e},j=function(){var a,c=qa.setupOptions;for(a in c)c.hasOwnProperty(a)&&(qa[a]===b?qa[a]=c[a]:qa[a]!==c[a]&&(qa.setupOptions[a]=qa[a]))},k=function(){function b(){ha.remove(a,"load",qa.beginDelayedInit)}if(Da)return n("didInit"),!1;if(qa.html5Only)return Da||(b(),qa.enabled=!0,o()),!0;B();try{sa._externalInterfaceTest(!1),J(!0,qa.flashPollingInterval||(qa.useHighPerformance?10:50)),qa.debugMode||sa._disableDebug(),qa.enabled=!0,m("jstoflash",!0),qa.html5Only||ha.add(a,"unload",i)}catch(a){return qa._wD("js/flash exception: "+a.toString()),m("jstoflash",!1),I({type:"JS_TO_FLASH_EXCEPTION",fatal:!0}),M(!0),o(),!1}return o(),b(),!0},D=function(){return!F&&(F=!0,j(),K(),function(){var a="sm2-usehtml5audio=",b="sm2-preferflash=",c=null,d=null,e=xa.toLowerCase();-1!==e.indexOf(a)&&(c="1"===e.charAt(e.indexOf(a)+a.length),ab&&console.log((c?"Enabling ":"Disabling ")+"useHTML5Audio via URL parameter"),qa.setup({useHTML5Audio:c})),-1!==e.indexOf(b)&&(d="1"===e.charAt(e.indexOf(b)+b.length),ab&&console.log((d?"Enabling ":"Disabling ")+"preferFlash via URL parameter"),qa.setup({preferFlash:d}))}(),!ja&&qa.hasHTML5&&(qa._wD("SoundManager 2: No Flash detected"+(qa.useHTML5Audio?". Trying HTML5-only mode.":", enabling HTML5."),1),qa.setup({useHTML5Audio:!0,preferFlash:!1})),ga(),!ja&&Qa&&(Pa.push(A.needFlash),qa.setup({flashLoadTimeout:1})),ya.removeEventListener&&ya.removeEventListener("DOMContentLoaded",D,!1),B(),!0)},fa=function(){return"complete"===ya.readyState&&(D(),ya.detachEvent("onreadystatechange",fa)),!0},E=function(){Fa=!0,D(),ha.remove(a,"load",E)},C=function(){$a&&(qa.setupOptions.useHTML5Audio&&!qa.setupOptions.preferFlash||Pa.push(A.mobileUA),qa.setupOptions.useHTML5Audio=!0,qa.setupOptions.preferFlash=!1,(Ua||Va&&!wa.match(/android\s2\.3/i))&&(Pa.push(A.globalHTML5),Ua&&(qa.ignoreFlash=!0),Sa=!0))},C(),ka(),ha.add(a,"focus",z),ha.add(a,"load",v),ha.add(a,"load",E),ya.addEventListener?ya.addEventListener("DOMContentLoaded",D,!1):ya.attachEvent?ya.attachEvent("onreadystatechange",fa):(m("onload",!1),I({type:"NO_DOM2_EVENTS",fatal:!0}))}if(!a||!a.document)throw new Error("SoundManager requires a browser with window and document objects.");var d=null;void 0!==a.SM2_DEFER&&SM2_DEFER||(d=new c),"object"==typeof module&&module&&"object"==typeof module.exports?(a.soundManager=d,module.exports.SoundManager=c,module.exports.soundManager=d):"function"==typeof define&&define.amd?define("SoundManager",[],function(){return{SoundManager:c,soundManager:d}}):(a.SoundManager=c,a.soundManager=d)}(window);var ngSoundManager=angular.module("angularSoundManager",[]).config(["$logProvider",function(a){a.debugEnabled(!1)}]);ngSoundManager.filter("humanTime",function(){return function(a){function b(a){return a<10?"0"+a.toString():a.toString()}var c=a/1e3/60<<0,d=Math.round(a/1e3%60);return b(c)+":"+b(d)}}),ngSoundManager.factory("angularPlayer",["$rootScope","$log",function(a,b){var c=null,d=!1,e=!1,f=[],g=!1,h=90,i=0,j=[];return{init:function(){"undefined"==typeof soundManager&&alert("Please include SoundManager2 Library!"),soundManager.setup({preferFlash:!1,debugMode:!1,useHTML5Audio:!0,onready:function(){},ontimeout:function(){alert("SM2 failed to start. Flash missing, blocked or security error?"),alert("The status is "+status.success+", the error type is "+status.error.type)},defaultOptions:{autoLoad:!1,autoPlay:!1,from:null,loops:1,multiShot:!1,multiShotEvents:!1,onid3:null,onload:null,onstop:null,onfailure:"nextTrack",onpause:null,onplay:null,onresume:null,position:null,pan:0,stream:!0,to:null,type:"audio/mp3",usePolicyFile:!1,volume:h,whileloading:function(){var b=this.bytesLoaded/this.bytesTotal*100;a.$broadcast("track:loaded",b)},whileplaying:function(){c=this.id,i=this.position/this.duration*100,a.$broadcast("track:progress",i),a.$broadcast("currentTrack:position",this.position),a.$broadcast("currentTrack:duration",this.duration)},onfinish:function(){soundManager._writeDebug(this.id+" finished playing"),angular.element(document.querySelector("[ng-app]")).injector().get("angularPlayer").nextTrack(),a.$broadcast("track:id",c)}}}),soundManager.onready(function(){b.debug("song manager ready!");var c=soundManager.ok();b.debug("is supported: "+c),a.$broadcast("angularPlayer:ready",!0)})},isInArray:function(a,b){for(var c=0;c-1){if(void 0===a.url)return b.debug("invalid soundcloud track url"),!1}else if(!0!==soundManager.canPlayURL(a.url))return b.debug("invalid song url"),!1},addTrack:function(a){return this.isTrackValid?(!1===this.isInArray(this.getPlaylist(),a.id)&&(soundManager.createSound({id:a.id,url:a.url}),this.addToPlaylist(a)),a.id):null},removeSong:function(b,d){b===c&&this.stop(),soundManager.destroySound(b),j.splice(d,1),a.$broadcast("player:playlist",j)},initPlayTrack:function(b,c){!0!==c&&(this.stop(),this.setCurrentTrack(b)),soundManager.play(b),a.$broadcast("track:id",b),g=!0,a.$broadcast("music:isPlaying",g)},play:function(){var a=null;if(null===this.getCurrentTrack()){if(0===soundManager.soundIDs.length)return void b.debug("playlist is empty!");a=soundManager.soundIDs[0],this.initPlayTrack(a)}else a=this.getCurrentTrack(),this.initPlayTrack(a,!0)},pause:function(){soundManager.pause(this.getCurrentTrack()),g=!1,a.$broadcast("music:isPlaying",g)},stop:function(){this.pause(),this.resetProgress(),a.$broadcast("track:progress",i),a.$broadcast("currentTrack:position",0),a.$broadcast("currentTrack:duration",0),soundManager.stopAll(),soundManager.unload(this.getCurrentTrack())},playTrack:function(a){this.initPlayTrack(a)},nextTrack:function(){if(null===this.getCurrentTrack())return b.debug("Please click on Play before this action"),null;var c=angular.copy(soundManager.soundIDs);!0===e&&(c=f);var h=this.getIndexByValue(c,this.getCurrentTrack()),i=+h+1,j=c[i];void 0!==j?this.playTrack(j):(!0===e&&!0===g&&(f=angular.copy(soundManager.soundIDs),f=f.sort(function(){return.5-Math.random()}),a.$broadcast("music:tempTrack",f)),!0===d?this.playTrack(c[0]):(g=!1,a.$broadcast("music:isPlaying",g)))},prevTrack:function(){if(null===this.getCurrentTrack())return b.debug("Please click on Play before this action"),null;var a=angular.copy(soundManager.soundIDs);!0===e&&(a=f);var c=this.getIndexByValue(a,this.getCurrentTrack()),d=+c-1,g=a[d];void 0!==g?this.playTrack(g):b.debug("no prev track found!")},mute:function(){!0===soundManager.muted?soundManager.unmute():soundManager.mute(),a.$broadcast("music:mute",soundManager.muted)},getMuteStatus:function(){return soundManager.muted},repeatToggle:function(){d=!0!==d,a.$broadcast("music:repeat",d)},getRepeatStatus:function(){return d},shuffleToggle:function(){!0===e?(e=!1,f=angular.copy(soundManager.soundIDs)):(e=!0,f=angular.copy(soundManager.soundIDs),f=f.sort(function(){return.5-Math.random()})),a.$broadcast("music:shuffle",e),a.$broadcast("music:tempTrack",f)},getShuffleStatus:function(){return e},playShuffle:function(){var c=null;if(e=!0,f=angular.copy(soundManager.soundIDs),f=f.sort(function(){return.5-Math.random()}),a.$broadcast("music:shuffle",e),a.$broadcast("music:tempTrack",f),0===f.length)return void b.debug("playlist is empty!");c=f[0],this.initPlayTrack(c)},getVolume:function(){return h},adjustVolume:function(b){var c=function(b){for(var c=0;c0&&(h-=10,c(h))},adjustVolumeSlider:function(b){!function(b){for(var c=0;c=0;f--)h["audio/"+e[c].related[f]]=h[c],qa.html5[e[c].related[f]]=h[c],qa.flash[e[c].related[f]]=h[c];return h.canPlayType=g?a:null,qa.html5=p(qa.html5,h),qa.html5.usingFlash=aa(),Qa=qa.html5.usingFlash,!0},A={notReady:"Unavailable - wait until onready() has fired.",notOK:"Audio support is not available.",domError:ta+"exception caught while appending SWF to DOM.",spcWmode:"Removing wmode, preventing known SWF loading issue(s)",swf404:ua+"Verify that %s is a valid path.",tryDebug:"Try "+ta+".debugFlash = true for more security details (output goes to SWF.)",checkSWF:"See SWF output for more debug info.",localFail:ua+"Non-HTTP page ("+ya.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:ua+"Special case: Waiting for SWF to load with window focus...",waitForever:ua+"Waiting indefinitely for Flash (will recover if unblocked)...",waitSWF:ua+"Waiting for 100% SWF load...",needFunction:ua+"Function object expected for %s",badID:'Sound ID "%s" should be a string, starting with a non-numeric character',currentObj:ua+"_debug(): Current sound objects",waitOnload:ua+"Waiting for window.onload()",docLoaded:ua+"Document already loaded",onload:ua+"initComplete(): calling soundManager.onload()",onloadOK:ta+".onload() complete",didInit:ua+"init(): Already called?",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",badRemove:ua+"Failed to remove Flash node.",shutdown:ta+".disable(): Shutting down",queue:ua+"Queueing %s handler",smError:"SMSound.load(): Exception: JS-Flash communication failed, or JS error.",fbTimeout:"No flash response, applying ."+R.swfTimedout+" CSS...",fbLoaded:"Flash loaded",fbHandler:ua+"flashBlockHandler()",manURL:"SMSound.load(): Using manually-assigned URL",onURL:ta+".load(): current URL already assigned.",badFV:ta+'.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",needFlash:ua+"Fatal error: Flash is needed to play some required formats, but is not available.",gotFocus:ua+"Got window focus.",policy:"Enabling usePolicyFile for data access",setup:ta+".setup(): allowed parameters: %s",setupError:ta+'.setup(): "%s" cannot be assigned with this method.',setupUndef:ta+'.setup(): Could not find option "%s"',setupLate:ta+".setup(): url, flashVersion and html5Test property changes will not take effect until reboot().",noURL:ua+"Flash URL required. Call soundManager.setup({url:...}) to get started.",sm2Loaded:"SoundManager 2: Ready. "+String.fromCharCode(10003),reset:ta+".reset(): Removing event callbacks",mobileUA:"Mobile UA detected, preferring HTML5 by default.",globalHTML5:"Using singleton HTML5 Audio() pattern for this device."},O=function(){var a,b,c,d,e;if(a=Ra.call(arguments),d=a.shift(),(e=A&&A[d]?A[d]:"")&&a&&a.length)for(b=0,c=a.length;b1&&a.stream&&(n("as2loop"),a.stream=!1),a},U=function(a,b){return a&&!a.usePolicyFile&&(a.onid3||a.usePeakData||a.useWaveformData||a.useEQData)&&(qa._wD((b||"")+O("policy")),a.usePolicyFile=!0),a},V=function(a){ab&&console.warn!==b?console.warn(a):qa._wD(a)},i=function(){return!1},L=function(a){var b;for(b in a)a.hasOwnProperty(b)&&"function"==typeof a[b]&&(a[b]=i);b=null},M=function(a){a===b&&(a=!1),(Ea||a)&&qa.disable(a)},N=function(a){var b;if(a)if(a.match(/\.swf(\?.*)?$/i)){if(a.substr(a.toLowerCase().lastIndexOf(".swf?")+4))return a}else a.lastIndexOf("/")!==a.length-1&&(a+="/");return b=(a&&-1!==a.lastIndexOf("/")?a.substr(0,a.lastIndexOf("/")+1):"./")+qa.movieURL,qa.noSWFCache&&(b+="?ts="+(new Date).getTime()),b},y=function(){8!==(l=parseInt(qa.flashVersion,10))&&9!==l&&(qa._wD(O("badFV",l,Ia)),qa.flashVersion=l=Ia);var a=qa.debugMode||qa.debugFlash?"_debug.swf":".swf";qa.useHTML5Audio&&!qa.html5Only&&qa.audioFormats.mp4.required&&l<9&&(qa._wD(O("needfl9")),qa.flashVersion=l=9),qa.version=qa.versionNumber+(qa.html5Only?" (HTML5-only mode)":9===l?" (AS3/Flash 9)":" (AS2/Flash 8)"),l>8?(qa.defaultOptions=p(qa.defaultOptions,qa.flash9Options),qa.features.buffering=!0,qa.defaultOptions=p(qa.defaultOptions,qa.movieStarOptions),qa.filePatterns.flash9=new RegExp("\\.(mp3|"+kb.join("|")+")(\\?.*)?$","i"),qa.features.movieStar=!0):qa.features.movieStar=!1,qa.filePattern=qa.filePatterns[8!==l?"flash9":"flash8"],qa.movieURL=(8===l?"soundmanager2.swf":"soundmanager2_flash9.swf").replace(".swf",a),qa.features.peakData=qa.features.waveformData=qa.features.eqData=l>8},J=function(a,b){if(!sa)return!1;sa._setPolling(a,b)},K=function(){if(qa.debugURLParam.test(xa)&&(qa.debugMode=!0),h(qa.debugID))return!1;var a,b,c,d,e;if(qa.debugMode&&!h(qa.debugID)&&(!ab||!qa.useConsole||!qa.consoleOnly)){a=ya.createElement("div"),a.id=qa.debugID+"-toggle",d={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},a.appendChild(ya.createTextNode("-")),a.onclick=S,a.title="Toggle SM2 debug console",wa.match(/msie 6/i)&&(a.style.position="absolute",a.style.cursor="hand");for(e in d)d.hasOwnProperty(e)&&(a.style[e]=d[e]);if(b=ya.createElement("div"),b.id=qa.debugID,b.style.display=qa.debugMode?"block":"none",qa.debugMode&&!h(a.id)){try{c=G(),c.appendChild(a)}catch(a){throw new Error(O("domError")+" \n"+a.toString())}c.appendChild(b)}}c=null},W=this.getSoundById,n=function(a,b){return a?qa._wD(O(a),b):""},S=function(){var a=h(qa.debugID),b=h(qa.debugID+"-toggle");if(!a)return!1;Aa?(b.innerHTML="+",a.style.display="none"):(b.innerHTML="-",a.style.display="block"),Aa=!Aa},m=function(c,d,e){if(a.sm2Debugger!==b)try{sm2Debugger.handleEvent(c,d,e)}catch(a){return!1}return!0},Q=function(){var a=[];return qa.debugMode&&a.push(R.sm2Debug),qa.debugFlash&&a.push(R.flashDebug),qa.useHighPerformance&&a.push(R.highPerf),a.join(" ")},P=function(){var a=O("fbHandler"),b=qa.getMoviePercent(),c=R,d={type:"FLASHBLOCK"};if(qa.html5Only)return!1;qa.ok()?(qa.didFlashBlock&&qa._wD(a+": Unblocked"),qa.oMC&&(qa.oMC.className=[Q(),c.swfDefault,c.swfLoaded+(qa.didFlashBlock?" "+c.swfUnblocked:"")].join(" "))):(Qa&&(qa.oMC.className=Q()+" "+c.swfDefault+" "+(null===b?c.swfTimedout:c.swfError),qa._wD(a+": "+O("fbTimeout")+(b?" ("+O("fbLoaded")+")":""))),qa.didFlashBlock=!0,t({type:"ontimeout",ignoreInit:!0,error:d}),I(d))},s=function(a,c,d){za[a]===b&&(za[a]=[]),za[a].push({method:c,scope:d||null,fired:!1})},t=function(a){if(a||(a={type:qa.ok()?"onready":"ontimeout"}),!Da&&a&&!a.ignoreInit)return!1;if("ontimeout"===a.type&&(qa.ok()||Ea&&!a.ignoreInit))return!1;var b,c,d={success:a&&a.ignoreInit?qa.ok():!Ea},e=a&&a.type?za[a.type]||[]:[],f=[],g=[d],h=Qa&&!qa.ok();for(a.error&&(g[0].error=a.error),b=0,c=e.length;b=0;a--)qa.sounds[qa.soundIDs[a]].isHTML5&&qa.sounds[qa.soundIDs[a]]._hasTimer&&qa.sounds[qa.soundIDs[a]]._onTimer()},I=function(c){c=c!==b?c:{},"function"==typeof qa.onerror&&qa.onerror.apply(a,[{type:c.type!==b?c.type:null}]),c.fatal!==b&&c.fatal&&qa.disable()},la=function(){if(!_a||!ka())return!1;var a,b,c=qa.audioFormats;for(b in c)if(c.hasOwnProperty(b)&&("mp3"===b||"mp4"===b)&&(qa._wD(ta+": Using flash fallback for "+b+" format"),qa.html5[b]=!1,c[b]&&c[b].related))for(a=c[b].related.length-1;a>=0;a--)qa.html5[c[b].related[a]]=!1},this._setSandboxType=function(a){var c=qa.sandbox;c.type=a,c.description=c.types[c.types[a]!==b?a:"unknown"],"localWithFile"===c.type?(c.noRemote=!0,c.noLocal=!1,n("secNote",2)):"localWithNetwork"===c.type?(c.noRemote=!1,c.noLocal=!0):"localTrusted"===c.type&&(c.noRemote=!1,c.noLocal=!1)},this._externalInterfaceOK=function(a){if(qa.swfLoaded)return!1;var b;if(m("swf",!0),m("flashtojs",!0),qa.swfLoaded=!0,cb=!1,_a&&la(),!a||a.replace(/\+dev/i,"")!==qa.versionNumber.replace(/\+dev/i,""))return b=ta+': Fatal: JavaScript file build "'+qa.versionNumber+'" does not match Flash SWF build "'+a+'" at '+qa.url+". Ensure both are up-to-date.",setTimeout(function(){throw new Error(b)},0),!1;setTimeout(k,Wa?100:1)},H=function(a,c){function d(){var a,b=[],c=[],d=" + ";a="SoundManager "+qa.version+(!qa.html5Only&&qa.useHTML5Audio?qa.hasHTML5?" + HTML5 audio":", no HTML5 audio support":""),qa.html5Only?qa.html5PollingInterval&&b.push("html5PollingInterval ("+qa.html5PollingInterval+"ms)"):(qa.preferFlash&&b.push("preferFlash"),qa.useHighPerformance&&b.push("useHighPerformance"),qa.flashPollingInterval&&b.push("flashPollingInterval ("+qa.flashPollingInterval+"ms)"),qa.html5PollingInterval&&b.push("html5PollingInterval ("+qa.html5PollingInterval+"ms)"),qa.wmode&&b.push("wmode ("+qa.wmode+")"),qa.debugFlash&&b.push("debugFlash"),qa.useFlashBlock&&b.push("flashBlock")),b.length&&(c=c.concat([b.join(d)])),qa._wD(a+(c.length?d+c.join(", "):""),1),na()}function e(a,b){return''}if(Ba&&Ca)return!1;if(qa.html5Only)return y(),d(),qa.oMC=h(qa.movieID),k(),Ba=!0,Ca=!0,!1;var f,g,i,j,l,m,n,o,p=c||qa.url,q=qa.altURL||p,r=G(),s=Q(),t=null,u=ya.getElementsByTagName("html")[0];if(t=u&&u.dir&&u.dir.match(/rtl/i),a=a===b?qa.id:a,y(),qa.url=N(hb?p:q),c=qa.url,qa.wmode=!qa.wmode&&qa.useHighPerformance?"transparent":qa.wmode,null!==qa.wmode&&(wa.match(/msie 8/i)||!Wa&&!qa.useHighPerformance)&&navigator.platform.match(/win32|win64/i)&&(Pa.push(A.spcWmode),qa.wmode=null),f={name:a,id:a,src:c,quality:"high",allowScriptAccess:qa.allowScriptAccess,bgcolor:qa.bgColor,pluginspage:ib+"www.macromedia.com/go/getflashplayer",title:"JS/Flash audio component (SoundManager 2)",type:"application/x-shockwave-flash",wmode:qa.wmode,hasPriority:"true"},qa.debugFlash&&(f.FlashVars="debug=1"),qa.wmode||delete f.wmode,Wa)g=ya.createElement("div"),j=['',e("movie",c),e("AllowScriptAccess",qa.allowScriptAccess),e("quality",f.quality),qa.wmode?e("wmode",qa.wmode):"",e("bgcolor",qa.bgColor),e("hasPriority","true"),qa.debugFlash?e("FlashVars",f.FlashVars):"",""].join("");else{g=ya.createElement("embed");for(i in f)f.hasOwnProperty(i)&&g.setAttribute(i,f[i])}if(K(),s=Q(),r=G())if(qa.oMC=h(qa.movieID)||ya.createElement("div"),qa.oMC.id)o=qa.oMC.className,qa.oMC.className=(o?o+" ":R.swfDefault)+(s?" "+s:""),qa.oMC.appendChild(g),Wa&&(l=qa.oMC.appendChild(ya.createElement("div")),l.className=R.swfBox,l.innerHTML=j),Ca=!0;else{if(qa.oMC.id=qa.movieID,qa.oMC.className=R.swfDefault+" "+s,m=null,l=null,qa.useFlashBlock||(qa.useHighPerformance?m={position:"fixed",width:"8px",height:"8px",bottom:"0px",left:"0px",overflow:"hidden"}:(m={position:"absolute",width:"6px",height:"6px",top:"-9999px",left:"-9999px"},t&&(m.left=Math.abs(parseInt(m.left,10))+"px"))),Xa&&(qa.oMC.style.zIndex=1e4),!qa.debugFlash)for(n in m)m.hasOwnProperty(n)&&(qa.oMC.style[n]=m[n]);try{Wa||qa.oMC.appendChild(g),r.appendChild(qa.oMC),Wa&&(l=qa.oMC.appendChild(ya.createElement("div")),l.className=R.swfBox,l.innerHTML=j),Ca=!0}catch(a){throw new Error(O("domError")+" \n"+a.toString())}}return Ba=!0,d(),!0},B=function(){return qa.html5Only?(H(),!1):!sa&&(qa.url?(sa=qa.getMovie(qa.id),sa||(Ja?(Wa?qa.oMC.innerHTML=Ka:qa.oMC.appendChild(Ja),Ja=null,Ba=!0):H(qa.id,qa.url),sa=qa.getMovie(qa.id)),"function"==typeof qa.oninitmovie&&setTimeout(qa.oninitmovie,1),oa(),!0):(n("noURL"),!1))},v=function(){setTimeout(w,1e3)},x=function(){a.setTimeout(function(){V(ua+"useFlashBlock is false, 100% HTML5 mode is possible. Rebooting with preferFlash: false..."),qa.setup({preferFlash:!1}).reboot(),qa.didFlashBlock=!0,qa.beginDelayedInit()},1)},w=function(){var b,c=!1;return!!qa.url&&!La&&(La=!0,ha.remove(a,"load",v),ja&&cb&&!bb?(n("waitFocus"),!1):(Da||(b=qa.getMoviePercent())>0&&b<100&&(c=!0),void setTimeout(function(){if(b=qa.getMoviePercent(),c)return La=!1,qa._wD(O("waitSWF")),a.setTimeout(v,1),!1;Da||(qa._wD(ta+": No Flash response within expected time. Likely causes: "+(0===b?"SWF load failed, ":"")+"Flash blocked or JS-Flash security error."+(qa.debugFlash?" "+O("checkSWF"):""),2),!hb&&b&&(n("localFail",2),qa.debugFlash||n("tryDebug",2)),0===b&&qa._wD(O("swf404",qa.url),1),m("flashtojs",!1," (Check flash security or flash blockers)")),!Da&&db&&(null===b?qa.useFlashBlock||0===qa.flashLoadTimeout?(qa.useFlashBlock&&P(),n("waitForever")):!qa.useFlashBlock&&_?x():(n("waitForever"),t({type:"ontimeout",ignoreInit:!0,error:{type:"INIT_FLASHBLOCK"}})):0===qa.flashLoadTimeout?n("waitForever"):!qa.useFlashBlock&&_?x():M(!0))},qa.flashLoadTimeout)))},z=function(){function b(){ha.remove(a,"focus",z)}return bb||!cb?(b(),!0):(db=!0,bb=!0,n("gotFocus"),La=!1,v(),b(),!0)},oa=function(){Pa.length&&(qa._wD("SoundManager 2: "+Pa.join(" "),1),Pa=[])},na=function(){oa();var a,b=[];if(qa.useHTML5Audio&&qa.hasHTML5){for(a in qa.audioFormats)qa.audioFormats.hasOwnProperty(a)&&b.push(a+" = "+qa.html5[a]+(!qa.html5[a]&&Qa&&qa.flash[a]?" (using flash)":qa.preferFlash&&qa.flash[a]&&Qa?" (preferring flash)":qa.html5[a]?"":" ("+(qa.audioFormats[a].required?"required, ":"")+"and no flash support)"));qa._wD("SoundManager 2 HTML5 support: "+b.join(", "),1)}},o=function(b){if(Da)return!1;if(qa.html5Only)return n("sm2Loaded",1),Da=!0,u(),m("onload",!0),!0;var c,d=qa.useFlashBlock&&qa.flashLoadTimeout&&!qa.getMoviePercent(),e=!0;return d||(Da=!0),c={type:!ja&&Qa?"NO_FLASH":"INIT_TIMEOUT"},qa._wD("SoundManager 2 "+(Ea?"failed to load":"loaded")+" ("+(Ea?"Flash security/load error":"OK")+") "+String.fromCharCode(Ea?10006:10003),Ea?2:1),Ea||b?(qa.useFlashBlock&&qa.oMC&&(qa.oMC.className=Q()+" "+(null===qa.getMoviePercent()?R.swfTimedout:R.swfError)),t({type:"ontimeout",error:c,ignoreInit:!0}),m("onload",!1),I(c),e=!1):m("onload",!0),Ea||(qa.waitForWindowLoad&&!Fa?(n("waitOnload"),ha.add(a,"load",u)):(qa.waitForWindowLoad&&Fa&&n("docLoaded"),u())),e},j=function(){var a,c=qa.setupOptions;for(a in c)c.hasOwnProperty(a)&&(qa[a]===b?qa[a]=c[a]:qa[a]!==c[a]&&(qa.setupOptions[a]=qa[a]))},k=function(){function b(){ha.remove(a,"load",qa.beginDelayedInit)}if(Da)return n("didInit"),!1;if(qa.html5Only)return Da||(b(),qa.enabled=!0,o()),!0;B();try{sa._externalInterfaceTest(!1),J(!0,qa.flashPollingInterval||(qa.useHighPerformance?10:50)),qa.debugMode||sa._disableDebug(),qa.enabled=!0,m("jstoflash",!0),qa.html5Only||ha.add(a,"unload",i)}catch(a){return qa._wD("js/flash exception: "+a.toString()),m("jstoflash",!1),I({type:"JS_TO_FLASH_EXCEPTION",fatal:!0}),M(!0),o(),!1}return o(),b(),!0},D=function(){return!F&&(F=!0,j(),K(),function(){var a="sm2-usehtml5audio=",b="sm2-preferflash=",c=null,d=null,e=xa.toLowerCase();-1!==e.indexOf(a)&&(c="1"===e.charAt(e.indexOf(a)+a.length),ab&&console.log((c?"Enabling ":"Disabling ")+"useHTML5Audio via URL parameter"),qa.setup({useHTML5Audio:c})),-1!==e.indexOf(b)&&(d="1"===e.charAt(e.indexOf(b)+b.length),ab&&console.log((d?"Enabling ":"Disabling ")+"preferFlash via URL parameter"),qa.setup({preferFlash:d}))}(),!ja&&qa.hasHTML5&&(qa._wD("SoundManager 2: No Flash detected"+(qa.useHTML5Audio?". Trying HTML5-only mode.":", enabling HTML5."),1),qa.setup({useHTML5Audio:!0,preferFlash:!1})),ga(),!ja&&Qa&&(Pa.push(A.needFlash),qa.setup({flashLoadTimeout:1})),ya.removeEventListener&&ya.removeEventListener("DOMContentLoaded",D,!1),B(),!0)},fa=function(){return"complete"===ya.readyState&&(D(),ya.detachEvent("onreadystatechange",fa)),!0},E=function(){Fa=!0,D(),ha.remove(a,"load",E)},C=function(){$a&&(qa.setupOptions.useHTML5Audio&&!qa.setupOptions.preferFlash||Pa.push(A.mobileUA),qa.setupOptions.useHTML5Audio=!0,qa.setupOptions.preferFlash=!1,(Ua||Va&&!wa.match(/android\s2\.3/i))&&(Pa.push(A.globalHTML5),Ua&&(qa.ignoreFlash=!0),Sa=!0))},C(),ka(),ha.add(a,"focus",z),ha.add(a,"load",v),ha.add(a,"load",E),ya.addEventListener?ya.addEventListener("DOMContentLoaded",D,!1):ya.attachEvent?ya.attachEvent("onreadystatechange",fa):(m("onload",!1),I({type:"NO_DOM2_EVENTS",fatal:!0}))}if(!a||!a.document)throw new Error("SoundManager requires a browser with window and document objects.");var d=null;void 0!==a.SM2_DEFER&&SM2_DEFER||(d=new c),"object"==typeof module&&module&&"object"==typeof module.exports?(a.soundManager=d,module.exports.SoundManager=c,module.exports.soundManager=d):"function"==typeof define&&define.amd?define("SoundManager",[],function(){return{SoundManager:c,soundManager:d}}):(a.SoundManager=c,a.soundManager=d)}(window);var ngSoundManager=angular.module("angularSoundManager",[]).config(["$logProvider",function(a){a.debugEnabled(!1)}]);ngSoundManager.filter("humanTime",function(){return function(a){function b(a){return a<10?"0"+a.toString():a.toString()}var c=a/1e3/60<<0,d=Math.round(a/1e3%60);return b(c)+":"+b(d)}}),ngSoundManager.factory("angularPlayer",["$rootScope","$log",function(a,b){var c=null,d=!1,e=!1,f=[],g=!1,h=90,i=0,j=[];return{init:function(){"undefined"==typeof soundManager&&alert("Please include SoundManager2 Library!"),soundManager.setup({preferFlash:!1,debugMode:!1,useHTML5Audio:!0,onready:function(){},ontimeout:function(){alert("SM2 failed to start. Flash missing, blocked or security error?"),alert("The status is "+status.success+", the error type is "+status.error.type)},defaultOptions:{autoLoad:!1,autoPlay:!1,from:null,loops:1,multiShot:!1,multiShotEvents:!1,onid3:null,onload:null,onstop:null,onfailure:"nextTrack",onpause:null,onplay:null,onresume:null,position:null,pan:0,stream:!0,to:null,type:"audio/mp3",usePolicyFile:!1,volume:h,whileloading:function(){var b=this.bytesLoaded/this.bytesTotal*100;a.$broadcast("track:loaded",b)},whileplaying:function(){c=this.id,i=this.position/this.duration*100,a.$broadcast("track:progress",i),a.$broadcast("currentTrack:position",this.position),a.$broadcast("currentTrack:duration",this.duration)},onfinish:function(){soundManager._writeDebug(this.id+" finished playing"),angular.element(document.querySelector("[ng-app]")).injector().get("angularPlayer").nextTrack(),a.$broadcast("track:id",c)}}}),soundManager.onready(function(){b.debug("song manager ready!");var c=soundManager.ok();b.debug("is supported: "+c),a.$broadcast("angularPlayer:ready",!0)})},isInArray:function(a,b){for(var c=0;c-1){if(void 0===a.url)return b.debug("invalid soundcloud track url"),!1}else if(!0!==soundManager.canPlayURL(a.url))return b.debug("invalid song url"),!1},addTrack:function(a){return this.isTrackValid?(!1===this.isInArray(this.getPlaylist(),a.id)&&(soundManager.createSound({id:a.id,url:a.url}),this.addToPlaylist(a)),a.id):null},removeSong:function(b,d){b===c&&this.stop(),soundManager.destroySound(b),j.splice(d,1),a.$broadcast("player:playlist",j)},initPlayTrack:function(b,c){!0!==c&&(this.stop(),this.setCurrentTrack(b)),soundManager.play(b),a.$broadcast("track:id",b),g=!0,a.$broadcast("music:isPlaying",g)},play:function(){var a=null;if(null===this.getCurrentTrack()){if(0===soundManager.soundIDs.length)return void b.debug("playlist is empty!");a=soundManager.soundIDs[0],this.initPlayTrack(a)}else a=this.getCurrentTrack(),this.initPlayTrack(a,!0)},pause:function(){soundManager.pause(this.getCurrentTrack()),g=!1,a.$broadcast("music:isPlaying",g)},stop:function(){this.pause(),this.resetProgress(),a.$broadcast("track:progress",i),a.$broadcast("currentTrack:position",0),a.$broadcast("currentTrack:duration",0),soundManager.stopAll(),soundManager.unload(this.getCurrentTrack())},playTrack:function(a){this.initPlayTrack(a)},nextTrack:function(){if(null===this.getCurrentTrack())return b.debug("Please click on Play before this action"),null;var c=angular.copy(soundManager.soundIDs),h=this.getIndexByValue(c,this.getCurrentTrack());if(!this.getRepeatStatus()&&this.getPlaylist().length==h+1)return b.debug("Last track"),null;!0===e&&(c=f);var i=+h+1,j=c[i];void 0!==j?this.playTrack(j):(!0===e&&!0===g&&(f=angular.copy(soundManager.soundIDs),f=f.sort(function(){return.5-Math.random()}),a.$broadcast("music:tempTrack",f)),!0===d?this.playTrack(c[0]):(g=!1,a.$broadcast("music:isPlaying",g)))},prevTrack:function(){if(null===this.getCurrentTrack())return b.debug("Please click on Play before this action"),null;var a=angular.copy(soundManager.soundIDs);!0===e&&(a=f);var c=this.getIndexByValue(a,this.getCurrentTrack()),d=+c-1,g=a[d];void 0!==g?this.playTrack(g):b.debug("no prev track found!")},mute:function(){!0===soundManager.muted?soundManager.unmute():soundManager.mute(),a.$broadcast("music:mute",soundManager.muted)},getMuteStatus:function(){return soundManager.muted},repeatToggle:function(){d=!0!==d,a.$broadcast("music:repeat",d)},getRepeatStatus:function(){return d},shuffleToggle:function(){!0===e?(e=!1,f=angular.copy(soundManager.soundIDs)):(e=!0,f=angular.copy(soundManager.soundIDs),f=f.sort(function(){return.5-Math.random()})),a.$broadcast("music:shuffle",e),a.$broadcast("music:tempTrack",f)},getShuffleStatus:function(){return e},playShuffle:function(){var c=null;if(e=!0,f=angular.copy(soundManager.soundIDs),f=f.sort(function(){return.5-Math.random()}),a.$broadcast("music:shuffle",e),a.$broadcast("music:tempTrack",f),0===f.length)return void b.debug("playlist is empty!");c=f[0],this.initPlayTrack(c)},getVolume:function(){return h},adjustVolume:function(b){var c=function(b){for(var c=0;c0&&(h-=10,c(h))},adjustVolumeSlider:function(b){!function(b){for(var c=0;c Date: Fri, 21 Apr 2017 11:22:10 +0700 Subject: [PATCH 7/8] correct on playNext --- dist/angular-soundmanager2.js | 27 ++++++++++++++++++--------- dist/angular-soundmanager2.min.js | 2 +- src/03-factory-angularPlayer.js | 24 +++++++++++++++--------- src/12-directive-nextTrack.js | 3 +++ 4 files changed, 37 insertions(+), 19 deletions(-) diff --git a/dist/angular-soundmanager2.js b/dist/angular-soundmanager2.js index 9a8c53c..6a64471 100644 --- a/dist/angular-soundmanager2.js +++ b/dist/angular-soundmanager2.js @@ -4683,18 +4683,12 @@ ngSoundManager.factory('angularPlayer', ['$rootScope', '$log', } // use shuffle track list if shuffle is true - var useTrack = angular.copy(soundManager.soundIDs); - var currentTrackKey = this.getIndexByValue(useTrack, this.getCurrentTrack()); - - if( !this.getRepeatStatus() && (this.getPlaylist()).length == currentTrackKey+1 ){ - $log.debug("Last track"); - return null; - } - + var useTrack = angular.copy(soundManager.soundIDs); if(shuffle === true){ useTrack = tempTrack; } - + + var currentTrackKey = this.getIndexByValue(useTrack, this.getCurrentTrack()); var nextTrackKey = +currentTrackKey + 1; var nextTrack = useTrack[nextTrackKey]; if(typeof nextTrack !== 'undefined') { @@ -4855,6 +4849,18 @@ ngSoundManager.factory('angularPlayer', ['$rootScope', '$log', }, isPlayingStatus: function() { return isPlaying; + }, + isLastTrack: function() { + // use shuffle track list if shuffle is true + var useTrack = angular.copy(soundManager.soundIDs); + if(shuffle === true){ + useTrack = tempTrack; + } + var currentTrackKey = this.getIndexByValue(useTrack, this.getCurrentTrack()); + if(repeat === false && (this.getPlaylist()).length == currentTrackKey+1 ) { + return true; + } + return false; } }; } @@ -5035,6 +5041,9 @@ ngSoundManager.directive('nextTrack', ['angularPlayer', function (angularPlayer) link: function (scope, element, attrs) { element.bind('click', function (event) { + if( angularPlayer.isLastTrack() && angularPlayer.isPlayingStatus() ){ + return false; + } angularPlayer.nextTrack(); }); diff --git a/dist/angular-soundmanager2.min.js b/dist/angular-soundmanager2.min.js index 6ed4a19..ed02d64 100644 --- a/dist/angular-soundmanager2.min.js +++ b/dist/angular-soundmanager2.min.js @@ -1,3 +1,3 @@ /*! angular-soundmanager2 21-04-2017 */ !function(a,b){"use strict";function c(c,d){function e(a){return qa.preferFlash&&ja&&!qa.ignoreFlash&&qa.flash[a]!==b&&qa.flash[a]}function f(a){return function(b){var c,d=this._s;return d&&d._a?c=a.call(this,b):(d&&d.id?qa._wD(d.id+": Ignoring "+b.type):qa._wD(va+"Ignoring "+b.type),c=null),c}}this.setupOptions={url:c||null,flashVersion:8,debugMode:!0,debugFlash:!1,useConsole:!0,consoleOnly:!0,waitForWindowLoad:!1,bgColor:"#ffffff",useHighPerformance:!1,flashPollingInterval:null,html5PollingInterval:null,flashLoadTimeout:1e3,wmode:null,allowScriptAccess:"always",useFlashBlock:!1,useHTML5Audio:!0,html5Test:/^(probably|maybe)$/i,preferFlash:!1,noSWFCache:!1,idPrefix:"sound"},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,duration:null},this.audioFormats={mp3:{type:['audio/mpeg; codecs="mp3"',"audio/mpeg","audio/mp3","audio/MPA","audio/mpa-robust"],required:!0},mp4:{related:["aac","m4a","m4b"],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},opus:{type:["audio/ogg; codecs=opus","audio/opus"],required:!1},wav:{type:['audio/wav; codecs="1"',"audio/wav","audio/wave","audio/x-wav"],required:!1}},this.movieID="sm2-container",this.id=d||"sm2movie",this.debugID="soundmanager-debug",this.debugURLParam=/([#?&])debug=1/i,this.versionNumber="V2.97a.20140901",this.version=null,this.movieURL=null,this.altURL=null,this.swfLoaded=!1,this.enabled=!1,this.oMC=null,this.sounds={},this.soundIDs=[],this.muted=!1,this.didFlashBlock=!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={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},this.html5={usingFlash:null},this.flash={},this.html5Only=!1,this.ignoreFlash=!1;var g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,$,_,aa,ba,ca,da,ea,fa,ga,ha,ia,ja,ka,la,ma,na,oa,pa,qa=this,ra=null,sa=null,ta="soundManager",ua=ta+": ",va="HTML5::",wa=navigator.userAgent,xa=a.location.href.toString(),ya=document,za=[],Aa=!0,Ba=!1,Ca=!1,Da=!1,Ea=!1,Fa=!1,Ga=0,Ha=["log","info","warn","error"],Ia=8,Ja=null,Ka=null,La=!1,Ma=!1,Na=0,Oa=null,Pa=[],Qa=null,Ra=Array.prototype.slice,Sa=!1,Ta=0,Ua=wa.match(/(ipad|iphone|ipod)/i),Va=wa.match(/android/i),Wa=wa.match(/msie/i),Xa=wa.match(/webkit/i),Ya=wa.match(/safari/i)&&!wa.match(/chrome/i),Za=wa.match(/opera/i),$a=wa.match(/(mobile|pre\/|xoom)/i)||Ua||Va,_a=!xa.match(/usehtml5audio/i)&&!xa.match(/sm2\-ignorebadua/i)&&Ya&&!wa.match(/silk/i)&&wa.match(/OS X 10_6_([3-7])/i),ab=a.console!==b&&console.log!==b,bb=ya.hasFocus!==b?ya.hasFocus():null,cb=Ya&&(ya.hasFocus===b||!ya.hasFocus()),db=!cb,eb=/(mp3|mp4|mpa|m4a|m4b)/i,fb=1e3,gb="about:blank",hb=ya.location?ya.location.protocol.match(/http/i):null,ib=hb?"":"http://",jb=/^\s*audio\/(?:x-)?(?:mpeg4|aac|flv|mov|mp4||m4v|m4a|m4b|mp4v|3gp|3g2)\s*(?:$|;)/i,kb=["mpeg4","aac","flv","mov","mp4","m4v","f4v","m4a","m4b","mp4v","3gp","3g2"],lb=new RegExp("\\.("+kb.join("|")+")(\\?.*)?$","i");this.mimePattern=/^\s*audio\/(?:x-)?(?:mp(?:eg|3))\s*(?:$|;)/i,this.useAltURL=!hb,R={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.hasHTML5=function(){try{return Audio!==b&&(Za&&opera!==b&&opera.version()<10?new Audio(null):new Audio).canPlayType!==b}catch(a){return!1}}(),this.setup=function(a){var c=!qa.url;return a!==b&&Da&&Qa&&qa.ok()&&(a.flashVersion!==b||a.url!==b||a.html5Test!==b)&&V(O("setupLate")),q(a),a&&(c&&F&&a.url!==b&&qa.beginDelayedInit(),F||a.url===b||"complete"!==ya.readyState||setTimeout(D,1)),qa},this.ok=function(){return Qa?Da&&!Ea:qa.useHTML5Audio&&qa.hasHTML5},this.supported=this.ok,this.getMovie=function(b){return h(b)||ya[b]||a[b]},this.createSound=function(a,c){function d(){return h=T(h),qa.sounds[h.id]=new g(h),qa.soundIDs.push(h.id),qa.sounds[h.id]}var e,f,h,i=null;if(e=ta+".createSound(): ",f=e+O(Da?"notOK":"notReady"),!Da||!qa.ok())return V(f),!1;if(c!==b&&(a={id:a,url:c}),h=p(a),h.url=$(h.url),void 0===h.id&&(h.id=qa.setupOptions.idPrefix+Ta++),h.id.toString().charAt(0).match(/^[0-9]$/)&&qa._wD(e+O("badID",h.id),2),qa._wD(e+h.id+(h.url?" ("+h.url+")":""),1),W(h.id,!0))return qa._wD(e+h.id+" exists",1),qa.sounds[h.id];if(ba(h))i=d(),qa._wD(h.id+": Using HTML5"),i._setup_html5(h);else{if(qa.html5Only)return qa._wD(h.id+": No HTML5 support for this sound, and no Flash. Exiting."),d();if(qa.html5.usingFlash&&h.url&&h.url.match(/data\:/i))return qa._wD(h.id+": data: URIs not supported via Flash. Exiting."),d();l>8&&(null===h.isMovieStar&&(h.isMovieStar=!!(h.serverURL||h.type&&h.type.match(jb)||h.url&&h.url.match(lb))),h.isMovieStar&&(qa._wD(e+"using MovieStar handling"),h.loops>1&&n("noNSLoop"))),h=U(h,e),i=d(),8===l?sa._createSound(h.id,h.loops||1,h.usePolicyFile):(sa._createSound(h.id,h.url,h.usePeakData,h.useWaveformData,h.useEQData,h.isMovieStar,!!h.isMovieStar&&h.bufferTime,h.loops||1,h.serverURL,h.duration||null,h.autoPlay,!0,h.autoLoad,h.usePolicyFile),h.serverURL||(i.connected=!0,h.onconnect&&h.onconnect.apply(i))),h.serverURL||!h.autoLoad&&!h.autoPlay||i.load(h)}return!h.serverURL&&h.autoPlay&&i.play(),i},this.destroySound=function(a,b){if(!W(a))return!1;var c,d=qa.sounds[a];for(d._iO={},d.stop(),d.unload(),c=0;c=0;a--)qa.sounds[qa.soundIDs[a]].pause()},this.resume=function(a){return!!W(a)&&qa.sounds[a].resume()},this.resumeAll=function(){var a;for(a=qa.soundIDs.length-1;a>=0;a--)qa.sounds[qa.soundIDs[a]].resume()},this.togglePause=function(a){return!!W(a)&&qa.sounds[a].togglePause()},this.setPan=function(a,b){return!!W(a)&&qa.sounds[a].setPan(b)},this.setVolume=function(a,b){return!!W(a)&&qa.sounds[a].setVolume(b)},this.mute=function(a){var b=0;if(a instanceof String&&(a=null),a)return!!W(a)&&(qa._wD(ta+'.mute(): Muting "'+a+'"'),qa.sounds[a].mute());for(qa._wD(ta+".mute(): Muting all sounds"),b=qa.soundIDs.length-1;b>=0;b--)qa.sounds[qa.soundIDs[b]].mute();return qa.muted=!0,!0},this.muteAll=function(){qa.mute()},this.unmute=function(a){var b;if(a instanceof String&&(a=null),a)return!!W(a)&&(qa._wD(ta+'.unmute(): Unmuting "'+a+'"'),qa.sounds[a].unmute());for(qa._wD(ta+".unmute(): Unmuting all sounds"),b=qa.soundIDs.length-1;b>=0;b--)qa.sounds[qa.soundIDs[b]].unmute();return qa.muted=!1,!0},this.unmuteAll=function(){qa.unmute()},this.toggleMute=function(a){return!!W(a)&&qa.sounds[a].toggleMute()},this.getMemoryUse=function(){var a=0;return sa&&8!==l&&(a=parseInt(sa._getMemoryUse(),10)),a},this.disable=function(c){var d;if(c===b&&(c=!1),Ea)return!1;for(Ea=!0,n("shutdown",1),d=qa.soundIDs.length-1;d>=0;d--)L(qa.sounds[qa.soundIDs[d]]);return o(c),ha.remove(a,"load",u),!0},this.canPlayMIME=function(a){var b;return qa.hasHTML5&&(b=ca({type:a})),!b&&Qa&&(b=a&&qa.ok()?!!((l>8?a.match(jb):null)||a.match(qa.mimePattern)):null),b},this.canPlayURL=function(a){var b;return qa.hasHTML5&&(b=ca({url:a})),!b&&Qa&&(b=a&&qa.ok()?!!a.match(qa.filePattern):null),b},this.canPlayLink=function(a){return!(a.type===b||!a.type||!qa.canPlayMIME(a.type))||qa.canPlayURL(a.href)},this.getSoundById=function(a,b){if(!a)return null;var c=qa.sounds[a];return c||b||qa._wD(ta+'.getSoundById(): Sound "'+a+'" not found.',2),c},this.onready=function(b,c){var d="onready";if("function"!=typeof b)throw O("needFunction",d);return Da&&qa._wD(O("queue",d)),c||(c=a),s(d,b,c),t(),!0},this.ontimeout=function(b,c){var d="ontimeout";if("function"!=typeof b)throw O("needFunction",d);return Da&&qa._wD(O("queue",d)),c||(c=a),s(d,b,c),t({type:d}),!0},this._writeDebug=function(a,c){var d,e;return!(!qa.debugMode||!(ab&&qa.useConsole&&(c&&"object"==typeof c?console.log(a,c):Ha[c]!==b?console[Ha[c]](a):console.log(a),qa.consoleOnly))&&(!(d=h("soundmanager-debug"))||(e=ya.createElement("div"),++Ga%2==0&&(e.className="sm2-alt"),c=c===b?0:parseInt(c,10),e.appendChild(ya.createTextNode(a)),c&&(c>=2&&(e.style.fontWeight="bold"),3===c&&(e.style.color="#ff3333")),d.insertBefore(e,d.firstChild),d=null,0)))},-1!==xa.indexOf("sm2-debug=alert")&&(this._writeDebug=function(b){a.alert(b)}),this._wD=this._writeDebug,this._debug=function(){var a,b;for(n("currentObj",1),a=0,b=qa.soundIDs.length;a=0;d--)qa.sounds[qa.soundIDs[d]].destruct();if(sa)try{Wa&&(Ka=sa.innerHTML),Ja=sa.parentNode.removeChild(sa)}catch(a){n("badRemove",2)}if(Ka=Ja=Qa=sa=null,qa.enabled=F=Da=La=Ma=Ba=Ca=Ea=Sa=qa.swfLoaded=!1,qa.soundIDs=[],qa.sounds={},Ta=0,b)za=[];else for(d in za)if(za.hasOwnProperty(d))for(e=0,f=za[d].length;e0&&q.position===q.duration&&(qa._wD(d+"Sound at end, resetting to position:0"),a.position=0),q.paused&&q.position>=0&&(!q._iO.serverURL||q.position>0))qa._wD(d+"Resuming from paused state",1),q.resume();else{if(q._iO=p(a,q._iO),(!q.isHTML5&&null!==q._iO.position&&q._iO.position>0||null!==q._iO.from&&q._iO.from>0||null!==q._iO.to)&&0===q.instanceCount&&0===q.playState&&!q._iO.serverURL){if(i=function(){q._iO=p(a,q._iO),q.play(q._iO)},q.isHTML5&&!q._html5_canplay?(qa._wD(d+"Beginning load for non-zero offset case"),q.load({_oncanplay:i}),t=!1):q.isHTML5||q.loaded||q.readyState&&2===q.readyState||(qa._wD(d+"Preloading for non-zero offset case"),q.load({onload:i}),t=!1),null!==t)return t;q._iO=j()}(!q.instanceCount||q._iO.multiShotEvents||q.isHTML5&&q._iO.multiShot&&!Sa||!q.isHTML5&&l>8&&!q.getAutoPlay())&&q.instanceCount++,q._iO.onposition&&0===q.playState&&h(q),q.playState=1,q.paused=!1,q.position=q._iO.position===b||isNaN(q._iO.position)?0:q._iO.position,q.isHTML5||(q._iO=U(T(q._iO))),q._iO.onplay&&c&&(q._iO.onplay.apply(q),r=!0),q.setVolume(q._iO.volume,!0),q.setPan(q._iO.pan,!0),q.isHTML5?q.instanceCount<2?(g(),f=q._setup_html5(),q.setPosition(q._iO.position),f.play()):(qa._wD(q.id+": Cloning Audio() for instance #"+q.instanceCount+"..."),k=new Audio(q._iO.url),m=function(){ha.remove(k,"ended",m),q._onfinish(q),ea(k),k=null},n=function(){ha.remove(k,"canplay",n);try{k.currentTime=q._iO.position/fb}catch(a){V(q.id+": multiShot play() failed to apply position of "+q._iO.position/fb)}k.play()},ha.add(k,"ended",m),void 0!==q._iO.volume&&(k.volume=Math.max(0,Math.min(1,q._iO.volume/100))),q.muted&&(k.muted=!0),q._iO.position?ha.add(k,"canplay",n):k.play()):(s=sa._start(q.id,q._iO.loops||1,9===l?q.position:q.position/fb,q._iO.multiShot||!1),9!==l||s||(qa._wD(d+"No sound hardware, or 32-sound ceiling hit",2),q._iO.onplayerror&&q._iO.onplayerror.apply(q)))}return q},this.start=this.play,this.stop=function(a){var b,c=q._iO;return 1===q.playState&&(qa._wD(q.id+": stop()"),q._onbufferchange(0),q._resetOnPosition(0),q.paused=!1,q.isHTML5||(q.playState=0),i(),c.to&&q.clearOnPosition(c.to),q.isHTML5?q._a&&(b=q.position,q.setPosition(0),q.position=b,q._a.pause(),q.playState=0,q._onTimer(),f()):(sa._stop(q.id,a),c.serverURL&&q.unload()),q.instanceCount=0,q._iO={},c.onstop&&c.onstop.apply(q)),q},this.setAutoPlay=function(a){qa._wD(q.id+": Autoplay turned "+(a?"on":"off")),q._iO.autoPlay=a,q.isHTML5||(sa._setAutoPlay(q.id,a),a&&(q.instanceCount||1!==q.readyState||(q.instanceCount++,qa._wD(q.id+": Incremented instance count to "+q.instanceCount))))},this.getAutoPlay=function(){return q._iO.autoPlay},this.setPosition=function(a){a===b&&(a=0);var c,d,e=q.isHTML5?Math.max(a,0):Math.min(q.duration||q._iO.duration,Math.max(a,0));if(q.position=e,d=q.position/fb,q._resetOnPosition(q.position),q._iO.position=e,q.isHTML5){if(q._a){if(q._html5_canplay){if(q._a.currentTime!==d){qa._wD(q.id+": setPosition("+d+")");try{q._a.currentTime=d,(0===q.playState||q.paused)&&q._a.pause()}catch(a){qa._wD(q.id+": setPosition("+d+") failed: "+a.message,2)}}}else if(d)return qa._wD(q.id+": setPosition("+d+"): Cannot seek yet, sound not ready",2),q;q.paused&&q._onTimer(!0)}}else c=9===l?q.position:d,q.readyState&&2!==q.readyState&&sa._setPosition(q.id,c,q.paused||!q.playState,q._iO.multiShot);return q},this.pause=function(a){return q.paused||0===q.playState&&1!==q.readyState?q:(qa._wD(q.id+": pause()"),q.paused=!0,q.isHTML5?(q._setup_html5().pause(),f()):(a||a===b)&&sa._pause(q.id,q._iO.multiShot),q._iO.onpause&&q._iO.onpause.apply(q),q)},this.resume=function(){var a=q._iO;return q.paused?(qa._wD(q.id+": resume()"),q.paused=!1,q.playState=1,q.isHTML5?(q._setup_html5().play(),g()):(a.isMovieStar&&!a.serverURL&&q.setPosition(q.position),sa._pause(q.id,a.multiShot)),!r&&a.onplay?(a.onplay.apply(q),r=!0):a.onresume&&a.onresume.apply(q),q):q},this.togglePause=function(){return qa._wD(q.id+": togglePause()"),0===q.playState?(q.play({position:9!==l||q.isHTML5?q.position/fb:q.position}),q):(q.paused?q.resume():q.pause(),q)},this.setPan=function(a,c){return a===b&&(a=0),c===b&&(c=!1),q.isHTML5||sa._setPan(q.id,a),q._iO.pan=a,c||(q.pan=a,q.options.pan=a),q},this.setVolume=function(a,c){return a===b&&(a=100),c===b&&(c=!1),q.isHTML5?q._a&&(qa.muted&&!q.muted&&(q.muted=!0,q._a.muted=!0),q._a.volume=Math.max(0,Math.min(1,a/100))):sa._setVolume(q.id,qa.muted&&!q.muted||q.muted?0:a),q._iO.volume=a,c||(q.volume=a,q.options.volume=a),q},this.mute=function(){return q.muted=!0,q.isHTML5?q._a&&(q._a.muted=!0):sa._setVolume(q.id,0),q},this.unmute=function(){q.muted=!1;var a=q._iO.volume!==b;return q.isHTML5?q._a&&(q._a.muted=!1):sa._setVolume(q.id,a?q._iO.volume:q.options.volume),q},this.toggleMute=function(){return q.muted?q.unmute():q.mute()},this.onPosition=function(a,c,d){return s.push({position:parseInt(a,10),method:c,scope:d!==b?d:q,fired:!1}),q},this.onposition=this.onPosition,this.clearOnPosition=function(a,b){var c;if(a=parseInt(a,10),isNaN(a))return!1;for(c=0;c=c)return!1;for(a=c-1;a>=0;a--)b=s[a],!b.fired&&q.position>=b.position&&(b.fired=!0,t++,b.method.apply(b.scope,[b.position]),c=s.length);return!0},this._resetOnPosition=function(a){var b,c,d=s.length;if(!d)return!1;for(b=d-1;b>=0;b--)c=s[b],c.fired&&a<=c.position&&(c.fired=!1,t--);return!0},j=function(){var a,b,c=q._iO,d=c.from,e=c.to;return b=function(){qa._wD(q.id+': "To" time of '+e+" reached."),q.clearOnPosition(e,b),q.stop()},a=function(){qa._wD(q.id+': Playing "from" '+d),null===e||isNaN(e)||q.onPosition(e,b)},null===d||isNaN(d)||(c.position=d,c.multiShot=!1,a()),c},h=function(){var a,b=q._iO.onposition;if(b)for(a in b)b.hasOwnProperty(a)&&q.onPosition(parseInt(a,10),b[a])},i=function(){var a,b=q._iO.onposition;if(b)for(a in b)b.hasOwnProperty(a)&&q.clearOnPosition(parseInt(a,10))},g=function(){q.isHTML5&&X(q)},f=function(){q.isHTML5&&Y(q)},c=function(a){a||(s=[],t=0),r=!1,q._hasTimer=null,q._a=null,q._html5_canplay=!1,q.bytesLoaded=null,q.bytesTotal=null,q.duration=q._iO&&q._iO.duration?q._iO.duration:null,q.durationEstimate=null,q.buffered=[],q.eqData=[],q.eqData.left=[],q.eqData.right=[],q.failures=0,q.isBuffering=!1,q.instanceOptions={},q.instanceCount=0,q.loaded=!1,q.metadata={},q.readyState=0,q.muted=!1,q.paused=!1,q.peakData={left:0,right:0},q.waveformData={left:[],right:[]},q.playState=0,q.position=null,q.id3={}},c(),this._onTimer=function(a){var b,c,d=!1,e={};if(q._hasTimer||a)return q._a&&(a||(q.playState>0||1===q.readyState)&&!q.paused)&&(b=q._get_html5_duration(),b!==k.duration&&(k.duration=b,q.duration=b,d=!0),q.durationEstimate=q.duration,c=q._a.currentTime*fb||0,c!==k.time&&(k.time=c,d=!0),(d||a)&&q._whileplaying(c,e,e,e,e)),d},this._get_html5_duration=function(){var a=q._iO,b=q._a&&q._a.duration?q._a.duration*fb:a&&a.duration?a.duration:null;return b&&!isNaN(b)&&b!==1/0?b:null},this._apply_loop=function(a,b){!a.loop&&b>1&&qa._wD("Note: Native HTML5 looping is infinite.",1),a.loop=b>1?"loop":""},this._setup_html5=function(a){var b,e=p(q._iO,a),f=Sa?ra:q._a,g=decodeURI(e.url);if(Sa?g===decodeURI(ia)&&(b=!0):g===decodeURI(u)&&(b=!0),f){if(f._s)if(Sa)f._s&&f._s.playState&&!b&&f._s.stop();else if(!Sa&&g===decodeURI(u))return q._apply_loop(f,e.loops),f;b||(u&&c(!1),f.src=e.url,q.url=e.url,u=e.url,ia=e.url,f._called_load=!1)}else e.autoLoad||e.autoPlay?(q._a=new Audio(e.url),q._a.load()):q._a=Za&&opera.version()<10?new Audio(null):new Audio,f=q._a,f._called_load=!1,Sa&&(ra=f);return q.isHTML5=!0,q._a=f,f._s=q,d(),q._apply_loop(f,e.loops),e.autoLoad||e.autoPlay?q.load():(f.autobuffer=!1,f.preload="auto"),f},d=function(){function a(a,b,c){return q._a?q._a.addEventListener(a,b,c||!1):null}if(q._a._added_events)return!1;var b;q._a._added_events=!0;for(b in ma)ma.hasOwnProperty(b)&&a(b,ma[b]);return!0},e=function(){function a(a,b,c){return q._a?q._a.removeEventListener(a,b,c||!1):null}var b;qa._wD(q.id+": Removing event listeners"),q._a._added_events=!1;for(b in ma)ma.hasOwnProperty(b)&&a(b,ma[b])},this._onload=function(a){var b,c=!!a||!q.isHTML5&&8===l&&q.duration;return b=q.id+": ",qa._wD(b+(c?"onload()":"Failed to load / invalid sound?"+(q.duration?" -":" Zero-length duration reported.")+" ("+q.url+")"),c?1:2),c||q.isHTML5||(!0===qa.sandbox.noRemote&&qa._wD(b+O("noNet"),1),!0===qa.sandbox.noLocal&&qa._wD(b+O("noLocal"),1)),q.loaded=c,q.readyState=c?3:2,q._onbufferchange(0),q._iO.onload&&pa(q,function(){q._iO.onload.apply(q,[c])}),!0},this._onbufferchange=function(a){return!(0===q.playState||a&&q.isBuffering||!a&&!q.isBuffering||(q.isBuffering=1===a,q._iO.onbufferchange&&(qa._wD(q.id+": Buffer state change: "+a),q._iO.onbufferchange.apply(q,[a])),0))},this._onsuspend=function(){return q._iO.onsuspend&&(qa._wD(q.id+": Playback suspended"),q._iO.onsuspend.apply(q)),!0},this._onfailure=function(a,b,c){q.failures++,qa._wD(q.id+": Failure ("+q.failures+"): "+a),q._iO.onfailure&&1===q.failures?q._iO.onfailure(a,b,c):qa._wD(q.id+": Ignoring failure")},this._onwarning=function(a,b,c){q._iO.onwarning&&q._iO.onwarning(a,b,c)},this._onfinish=function(){var a=q._iO.onfinish;q._onbufferchange(0),q._resetOnPosition(0),q.instanceCount&&(q.instanceCount--,q.instanceCount||(i(),q.playState=0,q.paused=!1,q.instanceCount=0,q.instanceOptions={},q._iO={},f(),q.isHTML5&&(q.position=0)),q.instanceCount&&!q._iO.multiShotEvents||a&&(qa._wD(q.id+": onfinish()"),pa(q,function(){a.apply(q)})))},this._whileloading=function(a,b,c,d){var e=q._iO;q.bytesLoaded=a,q.bytesTotal=b,q.duration=Math.floor(c),q.bufferLength=d,q.isHTML5||e.isMovieStar?q.durationEstimate=q.duration:e.duration?q.durationEstimate=q.duration>e.duration?q.duration:e.duration:q.durationEstimate=parseInt(q.bytesTotal/q.bytesLoaded*q.duration,10),q.isHTML5||(q.buffered=[{start:0,end:q.duration}]),(3!==q.readyState||q.isHTML5)&&e.whileloading&&e.whileloading.apply(q)},this._whileplaying=function(a,c,d,e,f){var g,h=q._iO;return!isNaN(a)&&null!==a&&(q.position=Math.max(0,a),q._processOnPosition(),!q.isHTML5&&l>8&&(h.usePeakData&&c!==b&&c&&(q.peakData={left:c.leftPeak,right:c.rightPeak}),h.useWaveformData&&d!==b&&d&&(q.waveformData={left:d.split(","),right:e.split(",")}),h.useEQData&&f!==b&&f&&f.leftEQ&&(g=f.leftEQ.split(","),q.eqData=g,q.eqData.left=g,f.rightEQ!==b&&f.rightEQ&&(q.eqData.right=f.rightEQ.split(",")))),1===q.playState&&(q.isHTML5||8!==l||q.position||!q.isBuffering||q._onbufferchange(0),h.whileplaying&&h.whileplaying.apply(q)),!0)},this._oncaptiondata=function(a){qa._wD(q.id+": Caption data received."),q.captiondata=a,q._iO.oncaptiondata&&q._iO.oncaptiondata.apply(q,[a])},this._onmetadata=function(a,b){qa._wD(q.id+": Metadata received.");var c,d,e={};for(c=0,d=a.length;c0&&(qa._wD(q.id+": Data error: "+a),q._iO.ondataerror&&q._iO.ondataerror.apply(q))},this._debug()},G=function(){return ya.body||ya.getElementsByTagName("div")[0]},h=function(a){return ya.getElementById(a)},p=function(a,c){var d,e,f=a||{};d=c===b?qa.defaultOptions:c;for(e in d)d.hasOwnProperty(e)&&f[e]===b&&("object"!=typeof d[e]||null===d[e]?f[e]=d[e]:f[e]=p(f[e],d[e]));return f},pa=function(b,c){b.isHTML5||8!==l?c():a.setTimeout(c,0)},r={onready:1,ontimeout:1,defaultOptions:1,flash9Options:1,movieStarOptions:1},q=function(a,c){var d,e=!0,f=c!==b,g=qa.setupOptions,h=r;if(a===b){e=[];for(d in g)g.hasOwnProperty(d)&&e.push(d);for(d in h)h.hasOwnProperty(d)&&("object"==typeof qa[d]?e.push(d+": {...}"):qa[d]instanceof Function?e.push(d+": function() {...}"):e.push(d));return qa._wD(O("setup",e.join(", "))),!1}for(d in a)if(a.hasOwnProperty(d))if("object"!=typeof a[d]||null===a[d]||a[d]instanceof Array||a[d]instanceof RegExp)f&&h[c]!==b?qa[c][d]=a[d]:g[d]!==b?(qa.setupOptions[d]=a[d],qa[d]=a[d]):h[d]===b?(V(O(qa[d]===b?"setupUndef":"setupError",d),2),e=!1):qa[d]instanceof Function?qa[d].apply(qa,a[d]instanceof Array?a[d]:[a[d]]):qa[d]=a[d];else{if(h[d]!==b)return q(a[d],d);V(O(qa[d]===b?"setupUndef":"setupError",d),2),e=!1}return e},ha=function(){function b(a){var b=Ra.call(a),c=b.length;return f?(b[1]="on"+b[1],c>3&&b.pop()):3===c&&b.push(!1),b}function c(a,b){var c=a.shift(),d=[g[b]];f?c[d](a[0],a[1]):c[d].apply(c,a)}function d(){c(b(arguments),"add")}function e(){c(b(arguments),"remove")}var f=a.attachEvent,g={add:f?"attachEvent":"addEventListener",remove:f?"detachEvent":"removeEventListener"};return{add:d,remove:e}}(),ma={abort:f(function(){qa._wD(this._s.id+": abort")}),canplay:f(function(){var a,c=this._s;if(c._html5_canplay)return!0;if(c._html5_canplay=!0,qa._wD(c.id+": canplay"),c._onbufferchange(0),a=c._iO.position===b||isNaN(c._iO.position)?null:c._iO.position/fb,this.currentTime!==a){qa._wD(c.id+": canplay: Setting position to "+a);try{this.currentTime=a}catch(b){qa._wD(c.id+": canplay: Setting position of "+a+" failed: "+b.message,2)}}c._iO._oncanplay&&c._iO._oncanplay()}),canplaythrough:f(function(){var a=this._s;a.loaded||(a._onbufferchange(0),a._whileloading(a.bytesLoaded,a.bytesTotal,a._get_html5_duration()),a._onload(!0))}),durationchange:f(function(){var a,b=this._s;a=b._get_html5_duration(),isNaN(a)||a===b.duration||(qa._wD(this._s.id+": durationchange ("+a+")"+(b.duration?", previously "+b.duration:"")),b.durationEstimate=b.duration=a)}),ended:f(function(){var a=this._s;qa._wD(a.id+": ended"),a._onfinish()}),error:f(function(){qa._wD(this._s.id+": HTML5 error, code "+this.error.code),this._s._onload(!1)}),loadeddata:f(function(){var a=this._s;qa._wD(a.id+": loadeddata"),a._loaded||Ya||(a.duration=a._get_html5_duration())}),loadedmetadata:f(function(){qa._wD(this._s.id+": loadedmetadata")}),loadstart:f(function(){qa._wD(this._s.id+": loadstart"),this._s._onbufferchange(1)}),play:f(function(){this._s._onbufferchange(0)}),playing:f(function(){qa._wD(this._s.id+": playing "+String.fromCharCode(9835)),this._s._onbufferchange(0)}),progress:f(function(a){var b,c,d,e=this._s,f=0,g="progress"===a.type,h=a.target.buffered,i=a.loaded||0,j=a.total||1;if(e.buffered=[],h&&h.length){for(b=0,c=h.length;b1){for(d=[],c=h.length,b=0;b=0;f--)h["audio/"+e[c].related[f]]=h[c],qa.html5[e[c].related[f]]=h[c],qa.flash[e[c].related[f]]=h[c];return h.canPlayType=g?a:null,qa.html5=p(qa.html5,h),qa.html5.usingFlash=aa(),Qa=qa.html5.usingFlash,!0},A={notReady:"Unavailable - wait until onready() has fired.",notOK:"Audio support is not available.",domError:ta+"exception caught while appending SWF to DOM.",spcWmode:"Removing wmode, preventing known SWF loading issue(s)",swf404:ua+"Verify that %s is a valid path.",tryDebug:"Try "+ta+".debugFlash = true for more security details (output goes to SWF.)",checkSWF:"See SWF output for more debug info.",localFail:ua+"Non-HTTP page ("+ya.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:ua+"Special case: Waiting for SWF to load with window focus...",waitForever:ua+"Waiting indefinitely for Flash (will recover if unblocked)...",waitSWF:ua+"Waiting for 100% SWF load...",needFunction:ua+"Function object expected for %s",badID:'Sound ID "%s" should be a string, starting with a non-numeric character',currentObj:ua+"_debug(): Current sound objects",waitOnload:ua+"Waiting for window.onload()",docLoaded:ua+"Document already loaded",onload:ua+"initComplete(): calling soundManager.onload()",onloadOK:ta+".onload() complete",didInit:ua+"init(): Already called?",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",badRemove:ua+"Failed to remove Flash node.",shutdown:ta+".disable(): Shutting down",queue:ua+"Queueing %s handler",smError:"SMSound.load(): Exception: JS-Flash communication failed, or JS error.",fbTimeout:"No flash response, applying ."+R.swfTimedout+" CSS...",fbLoaded:"Flash loaded",fbHandler:ua+"flashBlockHandler()",manURL:"SMSound.load(): Using manually-assigned URL",onURL:ta+".load(): current URL already assigned.",badFV:ta+'.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",needFlash:ua+"Fatal error: Flash is needed to play some required formats, but is not available.",gotFocus:ua+"Got window focus.",policy:"Enabling usePolicyFile for data access",setup:ta+".setup(): allowed parameters: %s",setupError:ta+'.setup(): "%s" cannot be assigned with this method.',setupUndef:ta+'.setup(): Could not find option "%s"',setupLate:ta+".setup(): url, flashVersion and html5Test property changes will not take effect until reboot().",noURL:ua+"Flash URL required. Call soundManager.setup({url:...}) to get started.",sm2Loaded:"SoundManager 2: Ready. "+String.fromCharCode(10003),reset:ta+".reset(): Removing event callbacks",mobileUA:"Mobile UA detected, preferring HTML5 by default.",globalHTML5:"Using singleton HTML5 Audio() pattern for this device."},O=function(){var a,b,c,d,e;if(a=Ra.call(arguments),d=a.shift(),(e=A&&A[d]?A[d]:"")&&a&&a.length)for(b=0,c=a.length;b1&&a.stream&&(n("as2loop"),a.stream=!1),a},U=function(a,b){return a&&!a.usePolicyFile&&(a.onid3||a.usePeakData||a.useWaveformData||a.useEQData)&&(qa._wD((b||"")+O("policy")),a.usePolicyFile=!0),a},V=function(a){ab&&console.warn!==b?console.warn(a):qa._wD(a)},i=function(){return!1},L=function(a){var b;for(b in a)a.hasOwnProperty(b)&&"function"==typeof a[b]&&(a[b]=i);b=null},M=function(a){a===b&&(a=!1),(Ea||a)&&qa.disable(a)},N=function(a){var b;if(a)if(a.match(/\.swf(\?.*)?$/i)){if(a.substr(a.toLowerCase().lastIndexOf(".swf?")+4))return a}else a.lastIndexOf("/")!==a.length-1&&(a+="/");return b=(a&&-1!==a.lastIndexOf("/")?a.substr(0,a.lastIndexOf("/")+1):"./")+qa.movieURL,qa.noSWFCache&&(b+="?ts="+(new Date).getTime()),b},y=function(){8!==(l=parseInt(qa.flashVersion,10))&&9!==l&&(qa._wD(O("badFV",l,Ia)),qa.flashVersion=l=Ia);var a=qa.debugMode||qa.debugFlash?"_debug.swf":".swf";qa.useHTML5Audio&&!qa.html5Only&&qa.audioFormats.mp4.required&&l<9&&(qa._wD(O("needfl9")),qa.flashVersion=l=9),qa.version=qa.versionNumber+(qa.html5Only?" (HTML5-only mode)":9===l?" (AS3/Flash 9)":" (AS2/Flash 8)"),l>8?(qa.defaultOptions=p(qa.defaultOptions,qa.flash9Options),qa.features.buffering=!0,qa.defaultOptions=p(qa.defaultOptions,qa.movieStarOptions),qa.filePatterns.flash9=new RegExp("\\.(mp3|"+kb.join("|")+")(\\?.*)?$","i"),qa.features.movieStar=!0):qa.features.movieStar=!1,qa.filePattern=qa.filePatterns[8!==l?"flash9":"flash8"],qa.movieURL=(8===l?"soundmanager2.swf":"soundmanager2_flash9.swf").replace(".swf",a),qa.features.peakData=qa.features.waveformData=qa.features.eqData=l>8},J=function(a,b){if(!sa)return!1;sa._setPolling(a,b)},K=function(){if(qa.debugURLParam.test(xa)&&(qa.debugMode=!0),h(qa.debugID))return!1;var a,b,c,d,e;if(qa.debugMode&&!h(qa.debugID)&&(!ab||!qa.useConsole||!qa.consoleOnly)){a=ya.createElement("div"),a.id=qa.debugID+"-toggle",d={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},a.appendChild(ya.createTextNode("-")),a.onclick=S,a.title="Toggle SM2 debug console",wa.match(/msie 6/i)&&(a.style.position="absolute",a.style.cursor="hand");for(e in d)d.hasOwnProperty(e)&&(a.style[e]=d[e]);if(b=ya.createElement("div"),b.id=qa.debugID,b.style.display=qa.debugMode?"block":"none",qa.debugMode&&!h(a.id)){try{c=G(),c.appendChild(a)}catch(a){throw new Error(O("domError")+" \n"+a.toString())}c.appendChild(b)}}c=null},W=this.getSoundById,n=function(a,b){return a?qa._wD(O(a),b):""},S=function(){var a=h(qa.debugID),b=h(qa.debugID+"-toggle");if(!a)return!1;Aa?(b.innerHTML="+",a.style.display="none"):(b.innerHTML="-",a.style.display="block"),Aa=!Aa},m=function(c,d,e){if(a.sm2Debugger!==b)try{sm2Debugger.handleEvent(c,d,e)}catch(a){return!1}return!0},Q=function(){var a=[];return qa.debugMode&&a.push(R.sm2Debug),qa.debugFlash&&a.push(R.flashDebug),qa.useHighPerformance&&a.push(R.highPerf),a.join(" ")},P=function(){var a=O("fbHandler"),b=qa.getMoviePercent(),c=R,d={type:"FLASHBLOCK"};if(qa.html5Only)return!1;qa.ok()?(qa.didFlashBlock&&qa._wD(a+": Unblocked"),qa.oMC&&(qa.oMC.className=[Q(),c.swfDefault,c.swfLoaded+(qa.didFlashBlock?" "+c.swfUnblocked:"")].join(" "))):(Qa&&(qa.oMC.className=Q()+" "+c.swfDefault+" "+(null===b?c.swfTimedout:c.swfError),qa._wD(a+": "+O("fbTimeout")+(b?" ("+O("fbLoaded")+")":""))),qa.didFlashBlock=!0,t({type:"ontimeout",ignoreInit:!0,error:d}),I(d))},s=function(a,c,d){za[a]===b&&(za[a]=[]),za[a].push({method:c,scope:d||null,fired:!1})},t=function(a){if(a||(a={type:qa.ok()?"onready":"ontimeout"}),!Da&&a&&!a.ignoreInit)return!1;if("ontimeout"===a.type&&(qa.ok()||Ea&&!a.ignoreInit))return!1;var b,c,d={success:a&&a.ignoreInit?qa.ok():!Ea},e=a&&a.type?za[a.type]||[]:[],f=[],g=[d],h=Qa&&!qa.ok();for(a.error&&(g[0].error=a.error),b=0,c=e.length;b=0;a--)qa.sounds[qa.soundIDs[a]].isHTML5&&qa.sounds[qa.soundIDs[a]]._hasTimer&&qa.sounds[qa.soundIDs[a]]._onTimer()},I=function(c){c=c!==b?c:{},"function"==typeof qa.onerror&&qa.onerror.apply(a,[{type:c.type!==b?c.type:null}]),c.fatal!==b&&c.fatal&&qa.disable()},la=function(){if(!_a||!ka())return!1;var a,b,c=qa.audioFormats;for(b in c)if(c.hasOwnProperty(b)&&("mp3"===b||"mp4"===b)&&(qa._wD(ta+": Using flash fallback for "+b+" format"),qa.html5[b]=!1,c[b]&&c[b].related))for(a=c[b].related.length-1;a>=0;a--)qa.html5[c[b].related[a]]=!1},this._setSandboxType=function(a){var c=qa.sandbox;c.type=a,c.description=c.types[c.types[a]!==b?a:"unknown"],"localWithFile"===c.type?(c.noRemote=!0,c.noLocal=!1,n("secNote",2)):"localWithNetwork"===c.type?(c.noRemote=!1,c.noLocal=!0):"localTrusted"===c.type&&(c.noRemote=!1,c.noLocal=!1)},this._externalInterfaceOK=function(a){if(qa.swfLoaded)return!1;var b;if(m("swf",!0),m("flashtojs",!0),qa.swfLoaded=!0,cb=!1,_a&&la(),!a||a.replace(/\+dev/i,"")!==qa.versionNumber.replace(/\+dev/i,""))return b=ta+': Fatal: JavaScript file build "'+qa.versionNumber+'" does not match Flash SWF build "'+a+'" at '+qa.url+". Ensure both are up-to-date.",setTimeout(function(){throw new Error(b)},0),!1;setTimeout(k,Wa?100:1)},H=function(a,c){function d(){var a,b=[],c=[],d=" + ";a="SoundManager "+qa.version+(!qa.html5Only&&qa.useHTML5Audio?qa.hasHTML5?" + HTML5 audio":", no HTML5 audio support":""),qa.html5Only?qa.html5PollingInterval&&b.push("html5PollingInterval ("+qa.html5PollingInterval+"ms)"):(qa.preferFlash&&b.push("preferFlash"),qa.useHighPerformance&&b.push("useHighPerformance"),qa.flashPollingInterval&&b.push("flashPollingInterval ("+qa.flashPollingInterval+"ms)"),qa.html5PollingInterval&&b.push("html5PollingInterval ("+qa.html5PollingInterval+"ms)"),qa.wmode&&b.push("wmode ("+qa.wmode+")"),qa.debugFlash&&b.push("debugFlash"),qa.useFlashBlock&&b.push("flashBlock")),b.length&&(c=c.concat([b.join(d)])),qa._wD(a+(c.length?d+c.join(", "):""),1),na()}function e(a,b){return''}if(Ba&&Ca)return!1;if(qa.html5Only)return y(),d(),qa.oMC=h(qa.movieID),k(),Ba=!0,Ca=!0,!1;var f,g,i,j,l,m,n,o,p=c||qa.url,q=qa.altURL||p,r=G(),s=Q(),t=null,u=ya.getElementsByTagName("html")[0];if(t=u&&u.dir&&u.dir.match(/rtl/i),a=a===b?qa.id:a,y(),qa.url=N(hb?p:q),c=qa.url,qa.wmode=!qa.wmode&&qa.useHighPerformance?"transparent":qa.wmode,null!==qa.wmode&&(wa.match(/msie 8/i)||!Wa&&!qa.useHighPerformance)&&navigator.platform.match(/win32|win64/i)&&(Pa.push(A.spcWmode),qa.wmode=null),f={name:a,id:a,src:c,quality:"high",allowScriptAccess:qa.allowScriptAccess,bgcolor:qa.bgColor,pluginspage:ib+"www.macromedia.com/go/getflashplayer",title:"JS/Flash audio component (SoundManager 2)",type:"application/x-shockwave-flash",wmode:qa.wmode,hasPriority:"true"},qa.debugFlash&&(f.FlashVars="debug=1"),qa.wmode||delete f.wmode,Wa)g=ya.createElement("div"),j=['',e("movie",c),e("AllowScriptAccess",qa.allowScriptAccess),e("quality",f.quality),qa.wmode?e("wmode",qa.wmode):"",e("bgcolor",qa.bgColor),e("hasPriority","true"),qa.debugFlash?e("FlashVars",f.FlashVars):"",""].join("");else{g=ya.createElement("embed");for(i in f)f.hasOwnProperty(i)&&g.setAttribute(i,f[i])}if(K(),s=Q(),r=G())if(qa.oMC=h(qa.movieID)||ya.createElement("div"),qa.oMC.id)o=qa.oMC.className,qa.oMC.className=(o?o+" ":R.swfDefault)+(s?" "+s:""),qa.oMC.appendChild(g),Wa&&(l=qa.oMC.appendChild(ya.createElement("div")),l.className=R.swfBox,l.innerHTML=j),Ca=!0;else{if(qa.oMC.id=qa.movieID,qa.oMC.className=R.swfDefault+" "+s,m=null,l=null,qa.useFlashBlock||(qa.useHighPerformance?m={position:"fixed",width:"8px",height:"8px",bottom:"0px",left:"0px",overflow:"hidden"}:(m={position:"absolute",width:"6px",height:"6px",top:"-9999px",left:"-9999px"},t&&(m.left=Math.abs(parseInt(m.left,10))+"px"))),Xa&&(qa.oMC.style.zIndex=1e4),!qa.debugFlash)for(n in m)m.hasOwnProperty(n)&&(qa.oMC.style[n]=m[n]);try{Wa||qa.oMC.appendChild(g),r.appendChild(qa.oMC),Wa&&(l=qa.oMC.appendChild(ya.createElement("div")),l.className=R.swfBox,l.innerHTML=j),Ca=!0}catch(a){throw new Error(O("domError")+" \n"+a.toString())}}return Ba=!0,d(),!0},B=function(){return qa.html5Only?(H(),!1):!sa&&(qa.url?(sa=qa.getMovie(qa.id),sa||(Ja?(Wa?qa.oMC.innerHTML=Ka:qa.oMC.appendChild(Ja),Ja=null,Ba=!0):H(qa.id,qa.url),sa=qa.getMovie(qa.id)),"function"==typeof qa.oninitmovie&&setTimeout(qa.oninitmovie,1),oa(),!0):(n("noURL"),!1))},v=function(){setTimeout(w,1e3)},x=function(){a.setTimeout(function(){V(ua+"useFlashBlock is false, 100% HTML5 mode is possible. Rebooting with preferFlash: false..."),qa.setup({preferFlash:!1}).reboot(),qa.didFlashBlock=!0,qa.beginDelayedInit()},1)},w=function(){var b,c=!1;return!!qa.url&&!La&&(La=!0,ha.remove(a,"load",v),ja&&cb&&!bb?(n("waitFocus"),!1):(Da||(b=qa.getMoviePercent())>0&&b<100&&(c=!0),void setTimeout(function(){if(b=qa.getMoviePercent(),c)return La=!1,qa._wD(O("waitSWF")),a.setTimeout(v,1),!1;Da||(qa._wD(ta+": No Flash response within expected time. Likely causes: "+(0===b?"SWF load failed, ":"")+"Flash blocked or JS-Flash security error."+(qa.debugFlash?" "+O("checkSWF"):""),2),!hb&&b&&(n("localFail",2),qa.debugFlash||n("tryDebug",2)),0===b&&qa._wD(O("swf404",qa.url),1),m("flashtojs",!1," (Check flash security or flash blockers)")),!Da&&db&&(null===b?qa.useFlashBlock||0===qa.flashLoadTimeout?(qa.useFlashBlock&&P(),n("waitForever")):!qa.useFlashBlock&&_?x():(n("waitForever"),t({type:"ontimeout",ignoreInit:!0,error:{type:"INIT_FLASHBLOCK"}})):0===qa.flashLoadTimeout?n("waitForever"):!qa.useFlashBlock&&_?x():M(!0))},qa.flashLoadTimeout)))},z=function(){function b(){ha.remove(a,"focus",z)}return bb||!cb?(b(),!0):(db=!0,bb=!0,n("gotFocus"),La=!1,v(),b(),!0)},oa=function(){Pa.length&&(qa._wD("SoundManager 2: "+Pa.join(" "),1),Pa=[])},na=function(){oa();var a,b=[];if(qa.useHTML5Audio&&qa.hasHTML5){for(a in qa.audioFormats)qa.audioFormats.hasOwnProperty(a)&&b.push(a+" = "+qa.html5[a]+(!qa.html5[a]&&Qa&&qa.flash[a]?" (using flash)":qa.preferFlash&&qa.flash[a]&&Qa?" (preferring flash)":qa.html5[a]?"":" ("+(qa.audioFormats[a].required?"required, ":"")+"and no flash support)"));qa._wD("SoundManager 2 HTML5 support: "+b.join(", "),1)}},o=function(b){if(Da)return!1;if(qa.html5Only)return n("sm2Loaded",1),Da=!0,u(),m("onload",!0),!0;var c,d=qa.useFlashBlock&&qa.flashLoadTimeout&&!qa.getMoviePercent(),e=!0;return d||(Da=!0),c={type:!ja&&Qa?"NO_FLASH":"INIT_TIMEOUT"},qa._wD("SoundManager 2 "+(Ea?"failed to load":"loaded")+" ("+(Ea?"Flash security/load error":"OK")+") "+String.fromCharCode(Ea?10006:10003),Ea?2:1),Ea||b?(qa.useFlashBlock&&qa.oMC&&(qa.oMC.className=Q()+" "+(null===qa.getMoviePercent()?R.swfTimedout:R.swfError)),t({type:"ontimeout",error:c,ignoreInit:!0}),m("onload",!1),I(c),e=!1):m("onload",!0),Ea||(qa.waitForWindowLoad&&!Fa?(n("waitOnload"),ha.add(a,"load",u)):(qa.waitForWindowLoad&&Fa&&n("docLoaded"),u())),e},j=function(){var a,c=qa.setupOptions;for(a in c)c.hasOwnProperty(a)&&(qa[a]===b?qa[a]=c[a]:qa[a]!==c[a]&&(qa.setupOptions[a]=qa[a]))},k=function(){function b(){ha.remove(a,"load",qa.beginDelayedInit)}if(Da)return n("didInit"),!1;if(qa.html5Only)return Da||(b(),qa.enabled=!0,o()),!0;B();try{sa._externalInterfaceTest(!1),J(!0,qa.flashPollingInterval||(qa.useHighPerformance?10:50)),qa.debugMode||sa._disableDebug(),qa.enabled=!0,m("jstoflash",!0),qa.html5Only||ha.add(a,"unload",i)}catch(a){return qa._wD("js/flash exception: "+a.toString()),m("jstoflash",!1),I({type:"JS_TO_FLASH_EXCEPTION",fatal:!0}),M(!0),o(),!1}return o(),b(),!0},D=function(){return!F&&(F=!0,j(),K(),function(){var a="sm2-usehtml5audio=",b="sm2-preferflash=",c=null,d=null,e=xa.toLowerCase();-1!==e.indexOf(a)&&(c="1"===e.charAt(e.indexOf(a)+a.length),ab&&console.log((c?"Enabling ":"Disabling ")+"useHTML5Audio via URL parameter"),qa.setup({useHTML5Audio:c})),-1!==e.indexOf(b)&&(d="1"===e.charAt(e.indexOf(b)+b.length),ab&&console.log((d?"Enabling ":"Disabling ")+"preferFlash via URL parameter"),qa.setup({preferFlash:d}))}(),!ja&&qa.hasHTML5&&(qa._wD("SoundManager 2: No Flash detected"+(qa.useHTML5Audio?". Trying HTML5-only mode.":", enabling HTML5."),1),qa.setup({useHTML5Audio:!0,preferFlash:!1})),ga(),!ja&&Qa&&(Pa.push(A.needFlash),qa.setup({flashLoadTimeout:1})),ya.removeEventListener&&ya.removeEventListener("DOMContentLoaded",D,!1),B(),!0)},fa=function(){return"complete"===ya.readyState&&(D(),ya.detachEvent("onreadystatechange",fa)),!0},E=function(){Fa=!0,D(),ha.remove(a,"load",E)},C=function(){$a&&(qa.setupOptions.useHTML5Audio&&!qa.setupOptions.preferFlash||Pa.push(A.mobileUA),qa.setupOptions.useHTML5Audio=!0,qa.setupOptions.preferFlash=!1,(Ua||Va&&!wa.match(/android\s2\.3/i))&&(Pa.push(A.globalHTML5),Ua&&(qa.ignoreFlash=!0),Sa=!0))},C(),ka(),ha.add(a,"focus",z),ha.add(a,"load",v),ha.add(a,"load",E),ya.addEventListener?ya.addEventListener("DOMContentLoaded",D,!1):ya.attachEvent?ya.attachEvent("onreadystatechange",fa):(m("onload",!1),I({type:"NO_DOM2_EVENTS",fatal:!0}))}if(!a||!a.document)throw new Error("SoundManager requires a browser with window and document objects.");var d=null;void 0!==a.SM2_DEFER&&SM2_DEFER||(d=new c),"object"==typeof module&&module&&"object"==typeof module.exports?(a.soundManager=d,module.exports.SoundManager=c,module.exports.soundManager=d):"function"==typeof define&&define.amd?define("SoundManager",[],function(){return{SoundManager:c,soundManager:d}}):(a.SoundManager=c,a.soundManager=d)}(window);var ngSoundManager=angular.module("angularSoundManager",[]).config(["$logProvider",function(a){a.debugEnabled(!1)}]);ngSoundManager.filter("humanTime",function(){return function(a){function b(a){return a<10?"0"+a.toString():a.toString()}var c=a/1e3/60<<0,d=Math.round(a/1e3%60);return b(c)+":"+b(d)}}),ngSoundManager.factory("angularPlayer",["$rootScope","$log",function(a,b){var c=null,d=!1,e=!1,f=[],g=!1,h=90,i=0,j=[];return{init:function(){"undefined"==typeof soundManager&&alert("Please include SoundManager2 Library!"),soundManager.setup({preferFlash:!1,debugMode:!1,useHTML5Audio:!0,onready:function(){},ontimeout:function(){alert("SM2 failed to start. Flash missing, blocked or security error?"),alert("The status is "+status.success+", the error type is "+status.error.type)},defaultOptions:{autoLoad:!1,autoPlay:!1,from:null,loops:1,multiShot:!1,multiShotEvents:!1,onid3:null,onload:null,onstop:null,onfailure:"nextTrack",onpause:null,onplay:null,onresume:null,position:null,pan:0,stream:!0,to:null,type:"audio/mp3",usePolicyFile:!1,volume:h,whileloading:function(){var b=this.bytesLoaded/this.bytesTotal*100;a.$broadcast("track:loaded",b)},whileplaying:function(){c=this.id,i=this.position/this.duration*100,a.$broadcast("track:progress",i),a.$broadcast("currentTrack:position",this.position),a.$broadcast("currentTrack:duration",this.duration)},onfinish:function(){soundManager._writeDebug(this.id+" finished playing"),angular.element(document.querySelector("[ng-app]")).injector().get("angularPlayer").nextTrack(),a.$broadcast("track:id",c)}}}),soundManager.onready(function(){b.debug("song manager ready!");var c=soundManager.ok();b.debug("is supported: "+c),a.$broadcast("angularPlayer:ready",!0)})},isInArray:function(a,b){for(var c=0;c-1){if(void 0===a.url)return b.debug("invalid soundcloud track url"),!1}else if(!0!==soundManager.canPlayURL(a.url))return b.debug("invalid song url"),!1},addTrack:function(a){return this.isTrackValid?(!1===this.isInArray(this.getPlaylist(),a.id)&&(soundManager.createSound({id:a.id,url:a.url}),this.addToPlaylist(a)),a.id):null},removeSong:function(b,d){b===c&&this.stop(),soundManager.destroySound(b),j.splice(d,1),a.$broadcast("player:playlist",j)},initPlayTrack:function(b,c){!0!==c&&(this.stop(),this.setCurrentTrack(b)),soundManager.play(b),a.$broadcast("track:id",b),g=!0,a.$broadcast("music:isPlaying",g)},play:function(){var a=null;if(null===this.getCurrentTrack()){if(0===soundManager.soundIDs.length)return void b.debug("playlist is empty!");a=soundManager.soundIDs[0],this.initPlayTrack(a)}else a=this.getCurrentTrack(),this.initPlayTrack(a,!0)},pause:function(){soundManager.pause(this.getCurrentTrack()),g=!1,a.$broadcast("music:isPlaying",g)},stop:function(){this.pause(),this.resetProgress(),a.$broadcast("track:progress",i),a.$broadcast("currentTrack:position",0),a.$broadcast("currentTrack:duration",0),soundManager.stopAll(),soundManager.unload(this.getCurrentTrack())},playTrack:function(a){this.initPlayTrack(a)},nextTrack:function(){if(null===this.getCurrentTrack())return b.debug("Please click on Play before this action"),null;var c=angular.copy(soundManager.soundIDs),h=this.getIndexByValue(c,this.getCurrentTrack());if(!this.getRepeatStatus()&&this.getPlaylist().length==h+1)return b.debug("Last track"),null;!0===e&&(c=f);var i=+h+1,j=c[i];void 0!==j?this.playTrack(j):(!0===e&&!0===g&&(f=angular.copy(soundManager.soundIDs),f=f.sort(function(){return.5-Math.random()}),a.$broadcast("music:tempTrack",f)),!0===d?this.playTrack(c[0]):(g=!1,a.$broadcast("music:isPlaying",g)))},prevTrack:function(){if(null===this.getCurrentTrack())return b.debug("Please click on Play before this action"),null;var a=angular.copy(soundManager.soundIDs);!0===e&&(a=f);var c=this.getIndexByValue(a,this.getCurrentTrack()),d=+c-1,g=a[d];void 0!==g?this.playTrack(g):b.debug("no prev track found!")},mute:function(){!0===soundManager.muted?soundManager.unmute():soundManager.mute(),a.$broadcast("music:mute",soundManager.muted)},getMuteStatus:function(){return soundManager.muted},repeatToggle:function(){d=!0!==d,a.$broadcast("music:repeat",d)},getRepeatStatus:function(){return d},shuffleToggle:function(){!0===e?(e=!1,f=angular.copy(soundManager.soundIDs)):(e=!0,f=angular.copy(soundManager.soundIDs),f=f.sort(function(){return.5-Math.random()})),a.$broadcast("music:shuffle",e),a.$broadcast("music:tempTrack",f)},getShuffleStatus:function(){return e},playShuffle:function(){var c=null;if(e=!0,f=angular.copy(soundManager.soundIDs),f=f.sort(function(){return.5-Math.random()}),a.$broadcast("music:shuffle",e),a.$broadcast("music:tempTrack",f),0===f.length)return void b.debug("playlist is empty!");c=f[0],this.initPlayTrack(c)},getVolume:function(){return h},adjustVolume:function(b){var c=function(b){for(var c=0;c0&&(h-=10,c(h))},adjustVolumeSlider:function(b){!function(b){for(var c=0;c=0;f--)h["audio/"+e[c].related[f]]=h[c],qa.html5[e[c].related[f]]=h[c],qa.flash[e[c].related[f]]=h[c];return h.canPlayType=g?a:null,qa.html5=p(qa.html5,h),qa.html5.usingFlash=aa(),Qa=qa.html5.usingFlash,!0},A={notReady:"Unavailable - wait until onready() has fired.",notOK:"Audio support is not available.",domError:ta+"exception caught while appending SWF to DOM.",spcWmode:"Removing wmode, preventing known SWF loading issue(s)",swf404:ua+"Verify that %s is a valid path.",tryDebug:"Try "+ta+".debugFlash = true for more security details (output goes to SWF.)",checkSWF:"See SWF output for more debug info.",localFail:ua+"Non-HTTP page ("+ya.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:ua+"Special case: Waiting for SWF to load with window focus...",waitForever:ua+"Waiting indefinitely for Flash (will recover if unblocked)...",waitSWF:ua+"Waiting for 100% SWF load...",needFunction:ua+"Function object expected for %s",badID:'Sound ID "%s" should be a string, starting with a non-numeric character',currentObj:ua+"_debug(): Current sound objects",waitOnload:ua+"Waiting for window.onload()",docLoaded:ua+"Document already loaded",onload:ua+"initComplete(): calling soundManager.onload()",onloadOK:ta+".onload() complete",didInit:ua+"init(): Already called?",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",badRemove:ua+"Failed to remove Flash node.",shutdown:ta+".disable(): Shutting down",queue:ua+"Queueing %s handler",smError:"SMSound.load(): Exception: JS-Flash communication failed, or JS error.",fbTimeout:"No flash response, applying ."+R.swfTimedout+" CSS...",fbLoaded:"Flash loaded",fbHandler:ua+"flashBlockHandler()",manURL:"SMSound.load(): Using manually-assigned URL",onURL:ta+".load(): current URL already assigned.",badFV:ta+'.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",needFlash:ua+"Fatal error: Flash is needed to play some required formats, but is not available.",gotFocus:ua+"Got window focus.",policy:"Enabling usePolicyFile for data access",setup:ta+".setup(): allowed parameters: %s",setupError:ta+'.setup(): "%s" cannot be assigned with this method.',setupUndef:ta+'.setup(): Could not find option "%s"',setupLate:ta+".setup(): url, flashVersion and html5Test property changes will not take effect until reboot().",noURL:ua+"Flash URL required. Call soundManager.setup({url:...}) to get started.",sm2Loaded:"SoundManager 2: Ready. "+String.fromCharCode(10003),reset:ta+".reset(): Removing event callbacks",mobileUA:"Mobile UA detected, preferring HTML5 by default.",globalHTML5:"Using singleton HTML5 Audio() pattern for this device."},O=function(){var a,b,c,d,e;if(a=Ra.call(arguments),d=a.shift(),(e=A&&A[d]?A[d]:"")&&a&&a.length)for(b=0,c=a.length;b1&&a.stream&&(n("as2loop"),a.stream=!1),a},U=function(a,b){return a&&!a.usePolicyFile&&(a.onid3||a.usePeakData||a.useWaveformData||a.useEQData)&&(qa._wD((b||"")+O("policy")),a.usePolicyFile=!0),a},V=function(a){ab&&console.warn!==b?console.warn(a):qa._wD(a)},i=function(){return!1},L=function(a){var b;for(b in a)a.hasOwnProperty(b)&&"function"==typeof a[b]&&(a[b]=i);b=null},M=function(a){a===b&&(a=!1),(Ea||a)&&qa.disable(a)},N=function(a){var b;if(a)if(a.match(/\.swf(\?.*)?$/i)){if(a.substr(a.toLowerCase().lastIndexOf(".swf?")+4))return a}else a.lastIndexOf("/")!==a.length-1&&(a+="/");return b=(a&&-1!==a.lastIndexOf("/")?a.substr(0,a.lastIndexOf("/")+1):"./")+qa.movieURL,qa.noSWFCache&&(b+="?ts="+(new Date).getTime()),b},y=function(){8!==(l=parseInt(qa.flashVersion,10))&&9!==l&&(qa._wD(O("badFV",l,Ia)),qa.flashVersion=l=Ia);var a=qa.debugMode||qa.debugFlash?"_debug.swf":".swf";qa.useHTML5Audio&&!qa.html5Only&&qa.audioFormats.mp4.required&&l<9&&(qa._wD(O("needfl9")),qa.flashVersion=l=9),qa.version=qa.versionNumber+(qa.html5Only?" (HTML5-only mode)":9===l?" (AS3/Flash 9)":" (AS2/Flash 8)"),l>8?(qa.defaultOptions=p(qa.defaultOptions,qa.flash9Options),qa.features.buffering=!0,qa.defaultOptions=p(qa.defaultOptions,qa.movieStarOptions),qa.filePatterns.flash9=new RegExp("\\.(mp3|"+kb.join("|")+")(\\?.*)?$","i"),qa.features.movieStar=!0):qa.features.movieStar=!1,qa.filePattern=qa.filePatterns[8!==l?"flash9":"flash8"],qa.movieURL=(8===l?"soundmanager2.swf":"soundmanager2_flash9.swf").replace(".swf",a),qa.features.peakData=qa.features.waveformData=qa.features.eqData=l>8},J=function(a,b){if(!sa)return!1;sa._setPolling(a,b)},K=function(){if(qa.debugURLParam.test(xa)&&(qa.debugMode=!0),h(qa.debugID))return!1;var a,b,c,d,e;if(qa.debugMode&&!h(qa.debugID)&&(!ab||!qa.useConsole||!qa.consoleOnly)){a=ya.createElement("div"),a.id=qa.debugID+"-toggle",d={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},a.appendChild(ya.createTextNode("-")),a.onclick=S,a.title="Toggle SM2 debug console",wa.match(/msie 6/i)&&(a.style.position="absolute",a.style.cursor="hand");for(e in d)d.hasOwnProperty(e)&&(a.style[e]=d[e]);if(b=ya.createElement("div"),b.id=qa.debugID,b.style.display=qa.debugMode?"block":"none",qa.debugMode&&!h(a.id)){try{c=G(),c.appendChild(a)}catch(a){throw new Error(O("domError")+" \n"+a.toString())}c.appendChild(b)}}c=null},W=this.getSoundById,n=function(a,b){return a?qa._wD(O(a),b):""},S=function(){var a=h(qa.debugID),b=h(qa.debugID+"-toggle");if(!a)return!1;Aa?(b.innerHTML="+",a.style.display="none"):(b.innerHTML="-",a.style.display="block"),Aa=!Aa},m=function(c,d,e){if(a.sm2Debugger!==b)try{sm2Debugger.handleEvent(c,d,e)}catch(a){return!1}return!0},Q=function(){var a=[];return qa.debugMode&&a.push(R.sm2Debug),qa.debugFlash&&a.push(R.flashDebug),qa.useHighPerformance&&a.push(R.highPerf),a.join(" ")},P=function(){var a=O("fbHandler"),b=qa.getMoviePercent(),c=R,d={type:"FLASHBLOCK"};if(qa.html5Only)return!1;qa.ok()?(qa.didFlashBlock&&qa._wD(a+": Unblocked"),qa.oMC&&(qa.oMC.className=[Q(),c.swfDefault,c.swfLoaded+(qa.didFlashBlock?" "+c.swfUnblocked:"")].join(" "))):(Qa&&(qa.oMC.className=Q()+" "+c.swfDefault+" "+(null===b?c.swfTimedout:c.swfError),qa._wD(a+": "+O("fbTimeout")+(b?" ("+O("fbLoaded")+")":""))),qa.didFlashBlock=!0,t({type:"ontimeout",ignoreInit:!0,error:d}),I(d))},s=function(a,c,d){za[a]===b&&(za[a]=[]),za[a].push({method:c,scope:d||null,fired:!1})},t=function(a){if(a||(a={type:qa.ok()?"onready":"ontimeout"}),!Da&&a&&!a.ignoreInit)return!1;if("ontimeout"===a.type&&(qa.ok()||Ea&&!a.ignoreInit))return!1;var b,c,d={success:a&&a.ignoreInit?qa.ok():!Ea},e=a&&a.type?za[a.type]||[]:[],f=[],g=[d],h=Qa&&!qa.ok();for(a.error&&(g[0].error=a.error),b=0,c=e.length;b=0;a--)qa.sounds[qa.soundIDs[a]].isHTML5&&qa.sounds[qa.soundIDs[a]]._hasTimer&&qa.sounds[qa.soundIDs[a]]._onTimer()},I=function(c){c=c!==b?c:{},"function"==typeof qa.onerror&&qa.onerror.apply(a,[{type:c.type!==b?c.type:null}]),c.fatal!==b&&c.fatal&&qa.disable()},la=function(){if(!_a||!ka())return!1;var a,b,c=qa.audioFormats;for(b in c)if(c.hasOwnProperty(b)&&("mp3"===b||"mp4"===b)&&(qa._wD(ta+": Using flash fallback for "+b+" format"),qa.html5[b]=!1,c[b]&&c[b].related))for(a=c[b].related.length-1;a>=0;a--)qa.html5[c[b].related[a]]=!1},this._setSandboxType=function(a){var c=qa.sandbox;c.type=a,c.description=c.types[c.types[a]!==b?a:"unknown"],"localWithFile"===c.type?(c.noRemote=!0,c.noLocal=!1,n("secNote",2)):"localWithNetwork"===c.type?(c.noRemote=!1,c.noLocal=!0):"localTrusted"===c.type&&(c.noRemote=!1,c.noLocal=!1)},this._externalInterfaceOK=function(a){if(qa.swfLoaded)return!1;var b;if(m("swf",!0),m("flashtojs",!0),qa.swfLoaded=!0,cb=!1,_a&&la(),!a||a.replace(/\+dev/i,"")!==qa.versionNumber.replace(/\+dev/i,""))return b=ta+': Fatal: JavaScript file build "'+qa.versionNumber+'" does not match Flash SWF build "'+a+'" at '+qa.url+". Ensure both are up-to-date.",setTimeout(function(){throw new Error(b)},0),!1;setTimeout(k,Wa?100:1)},H=function(a,c){function d(){var a,b=[],c=[],d=" + ";a="SoundManager "+qa.version+(!qa.html5Only&&qa.useHTML5Audio?qa.hasHTML5?" + HTML5 audio":", no HTML5 audio support":""),qa.html5Only?qa.html5PollingInterval&&b.push("html5PollingInterval ("+qa.html5PollingInterval+"ms)"):(qa.preferFlash&&b.push("preferFlash"),qa.useHighPerformance&&b.push("useHighPerformance"),qa.flashPollingInterval&&b.push("flashPollingInterval ("+qa.flashPollingInterval+"ms)"),qa.html5PollingInterval&&b.push("html5PollingInterval ("+qa.html5PollingInterval+"ms)"),qa.wmode&&b.push("wmode ("+qa.wmode+")"),qa.debugFlash&&b.push("debugFlash"),qa.useFlashBlock&&b.push("flashBlock")),b.length&&(c=c.concat([b.join(d)])),qa._wD(a+(c.length?d+c.join(", "):""),1),na()}function e(a,b){return''}if(Ba&&Ca)return!1;if(qa.html5Only)return y(),d(),qa.oMC=h(qa.movieID),k(),Ba=!0,Ca=!0,!1;var f,g,i,j,l,m,n,o,p=c||qa.url,q=qa.altURL||p,r=G(),s=Q(),t=null,u=ya.getElementsByTagName("html")[0];if(t=u&&u.dir&&u.dir.match(/rtl/i),a=a===b?qa.id:a,y(),qa.url=N(hb?p:q),c=qa.url,qa.wmode=!qa.wmode&&qa.useHighPerformance?"transparent":qa.wmode,null!==qa.wmode&&(wa.match(/msie 8/i)||!Wa&&!qa.useHighPerformance)&&navigator.platform.match(/win32|win64/i)&&(Pa.push(A.spcWmode),qa.wmode=null),f={name:a,id:a,src:c,quality:"high",allowScriptAccess:qa.allowScriptAccess,bgcolor:qa.bgColor,pluginspage:ib+"www.macromedia.com/go/getflashplayer",title:"JS/Flash audio component (SoundManager 2)",type:"application/x-shockwave-flash",wmode:qa.wmode,hasPriority:"true"},qa.debugFlash&&(f.FlashVars="debug=1"),qa.wmode||delete f.wmode,Wa)g=ya.createElement("div"),j=['',e("movie",c),e("AllowScriptAccess",qa.allowScriptAccess),e("quality",f.quality),qa.wmode?e("wmode",qa.wmode):"",e("bgcolor",qa.bgColor),e("hasPriority","true"),qa.debugFlash?e("FlashVars",f.FlashVars):"",""].join("");else{g=ya.createElement("embed");for(i in f)f.hasOwnProperty(i)&&g.setAttribute(i,f[i])}if(K(),s=Q(),r=G())if(qa.oMC=h(qa.movieID)||ya.createElement("div"),qa.oMC.id)o=qa.oMC.className,qa.oMC.className=(o?o+" ":R.swfDefault)+(s?" "+s:""),qa.oMC.appendChild(g),Wa&&(l=qa.oMC.appendChild(ya.createElement("div")),l.className=R.swfBox,l.innerHTML=j),Ca=!0;else{if(qa.oMC.id=qa.movieID,qa.oMC.className=R.swfDefault+" "+s,m=null,l=null,qa.useFlashBlock||(qa.useHighPerformance?m={position:"fixed",width:"8px",height:"8px",bottom:"0px",left:"0px",overflow:"hidden"}:(m={position:"absolute",width:"6px",height:"6px",top:"-9999px",left:"-9999px"},t&&(m.left=Math.abs(parseInt(m.left,10))+"px"))),Xa&&(qa.oMC.style.zIndex=1e4),!qa.debugFlash)for(n in m)m.hasOwnProperty(n)&&(qa.oMC.style[n]=m[n]);try{Wa||qa.oMC.appendChild(g),r.appendChild(qa.oMC),Wa&&(l=qa.oMC.appendChild(ya.createElement("div")),l.className=R.swfBox,l.innerHTML=j),Ca=!0}catch(a){throw new Error(O("domError")+" \n"+a.toString())}}return Ba=!0,d(),!0},B=function(){return qa.html5Only?(H(),!1):!sa&&(qa.url?(sa=qa.getMovie(qa.id),sa||(Ja?(Wa?qa.oMC.innerHTML=Ka:qa.oMC.appendChild(Ja),Ja=null,Ba=!0):H(qa.id,qa.url),sa=qa.getMovie(qa.id)),"function"==typeof qa.oninitmovie&&setTimeout(qa.oninitmovie,1),oa(),!0):(n("noURL"),!1))},v=function(){setTimeout(w,1e3)},x=function(){a.setTimeout(function(){V(ua+"useFlashBlock is false, 100% HTML5 mode is possible. Rebooting with preferFlash: false..."),qa.setup({preferFlash:!1}).reboot(),qa.didFlashBlock=!0,qa.beginDelayedInit()},1)},w=function(){var b,c=!1;return!!qa.url&&!La&&(La=!0,ha.remove(a,"load",v),ja&&cb&&!bb?(n("waitFocus"),!1):(Da||(b=qa.getMoviePercent())>0&&b<100&&(c=!0),void setTimeout(function(){if(b=qa.getMoviePercent(),c)return La=!1,qa._wD(O("waitSWF")),a.setTimeout(v,1),!1;Da||(qa._wD(ta+": No Flash response within expected time. Likely causes: "+(0===b?"SWF load failed, ":"")+"Flash blocked or JS-Flash security error."+(qa.debugFlash?" "+O("checkSWF"):""),2),!hb&&b&&(n("localFail",2),qa.debugFlash||n("tryDebug",2)),0===b&&qa._wD(O("swf404",qa.url),1),m("flashtojs",!1," (Check flash security or flash blockers)")),!Da&&db&&(null===b?qa.useFlashBlock||0===qa.flashLoadTimeout?(qa.useFlashBlock&&P(),n("waitForever")):!qa.useFlashBlock&&_?x():(n("waitForever"),t({type:"ontimeout",ignoreInit:!0,error:{type:"INIT_FLASHBLOCK"}})):0===qa.flashLoadTimeout?n("waitForever"):!qa.useFlashBlock&&_?x():M(!0))},qa.flashLoadTimeout)))},z=function(){function b(){ha.remove(a,"focus",z)}return bb||!cb?(b(),!0):(db=!0,bb=!0,n("gotFocus"),La=!1,v(),b(),!0)},oa=function(){Pa.length&&(qa._wD("SoundManager 2: "+Pa.join(" "),1),Pa=[])},na=function(){oa();var a,b=[];if(qa.useHTML5Audio&&qa.hasHTML5){for(a in qa.audioFormats)qa.audioFormats.hasOwnProperty(a)&&b.push(a+" = "+qa.html5[a]+(!qa.html5[a]&&Qa&&qa.flash[a]?" (using flash)":qa.preferFlash&&qa.flash[a]&&Qa?" (preferring flash)":qa.html5[a]?"":" ("+(qa.audioFormats[a].required?"required, ":"")+"and no flash support)"));qa._wD("SoundManager 2 HTML5 support: "+b.join(", "),1)}},o=function(b){if(Da)return!1;if(qa.html5Only)return n("sm2Loaded",1),Da=!0,u(),m("onload",!0),!0;var c,d=qa.useFlashBlock&&qa.flashLoadTimeout&&!qa.getMoviePercent(),e=!0;return d||(Da=!0),c={type:!ja&&Qa?"NO_FLASH":"INIT_TIMEOUT"},qa._wD("SoundManager 2 "+(Ea?"failed to load":"loaded")+" ("+(Ea?"Flash security/load error":"OK")+") "+String.fromCharCode(Ea?10006:10003),Ea?2:1),Ea||b?(qa.useFlashBlock&&qa.oMC&&(qa.oMC.className=Q()+" "+(null===qa.getMoviePercent()?R.swfTimedout:R.swfError)),t({type:"ontimeout",error:c,ignoreInit:!0}),m("onload",!1),I(c),e=!1):m("onload",!0),Ea||(qa.waitForWindowLoad&&!Fa?(n("waitOnload"),ha.add(a,"load",u)):(qa.waitForWindowLoad&&Fa&&n("docLoaded"),u())),e},j=function(){var a,c=qa.setupOptions;for(a in c)c.hasOwnProperty(a)&&(qa[a]===b?qa[a]=c[a]:qa[a]!==c[a]&&(qa.setupOptions[a]=qa[a]))},k=function(){function b(){ha.remove(a,"load",qa.beginDelayedInit)}if(Da)return n("didInit"),!1;if(qa.html5Only)return Da||(b(),qa.enabled=!0,o()),!0;B();try{sa._externalInterfaceTest(!1),J(!0,qa.flashPollingInterval||(qa.useHighPerformance?10:50)),qa.debugMode||sa._disableDebug(),qa.enabled=!0,m("jstoflash",!0),qa.html5Only||ha.add(a,"unload",i)}catch(a){return qa._wD("js/flash exception: "+a.toString()),m("jstoflash",!1),I({type:"JS_TO_FLASH_EXCEPTION",fatal:!0}),M(!0),o(),!1}return o(),b(),!0},D=function(){return!F&&(F=!0,j(),K(),function(){var a="sm2-usehtml5audio=",b="sm2-preferflash=",c=null,d=null,e=xa.toLowerCase();-1!==e.indexOf(a)&&(c="1"===e.charAt(e.indexOf(a)+a.length),ab&&console.log((c?"Enabling ":"Disabling ")+"useHTML5Audio via URL parameter"),qa.setup({useHTML5Audio:c})),-1!==e.indexOf(b)&&(d="1"===e.charAt(e.indexOf(b)+b.length),ab&&console.log((d?"Enabling ":"Disabling ")+"preferFlash via URL parameter"),qa.setup({preferFlash:d}))}(),!ja&&qa.hasHTML5&&(qa._wD("SoundManager 2: No Flash detected"+(qa.useHTML5Audio?". Trying HTML5-only mode.":", enabling HTML5."),1),qa.setup({useHTML5Audio:!0,preferFlash:!1})),ga(),!ja&&Qa&&(Pa.push(A.needFlash),qa.setup({flashLoadTimeout:1})),ya.removeEventListener&&ya.removeEventListener("DOMContentLoaded",D,!1),B(),!0)},fa=function(){return"complete"===ya.readyState&&(D(),ya.detachEvent("onreadystatechange",fa)),!0},E=function(){Fa=!0,D(),ha.remove(a,"load",E)},C=function(){$a&&(qa.setupOptions.useHTML5Audio&&!qa.setupOptions.preferFlash||Pa.push(A.mobileUA),qa.setupOptions.useHTML5Audio=!0,qa.setupOptions.preferFlash=!1,(Ua||Va&&!wa.match(/android\s2\.3/i))&&(Pa.push(A.globalHTML5),Ua&&(qa.ignoreFlash=!0),Sa=!0))},C(),ka(),ha.add(a,"focus",z),ha.add(a,"load",v),ha.add(a,"load",E),ya.addEventListener?ya.addEventListener("DOMContentLoaded",D,!1):ya.attachEvent?ya.attachEvent("onreadystatechange",fa):(m("onload",!1),I({type:"NO_DOM2_EVENTS",fatal:!0}))}if(!a||!a.document)throw new Error("SoundManager requires a browser with window and document objects.");var d=null;void 0!==a.SM2_DEFER&&SM2_DEFER||(d=new c),"object"==typeof module&&module&&"object"==typeof module.exports?(a.soundManager=d,module.exports.SoundManager=c,module.exports.soundManager=d):"function"==typeof define&&define.amd?define("SoundManager",[],function(){return{SoundManager:c,soundManager:d}}):(a.SoundManager=c,a.soundManager=d)}(window);var ngSoundManager=angular.module("angularSoundManager",[]).config(["$logProvider",function(a){a.debugEnabled(!1)}]);ngSoundManager.filter("humanTime",function(){return function(a){function b(a){return a<10?"0"+a.toString():a.toString()}var c=a/1e3/60<<0,d=Math.round(a/1e3%60);return b(c)+":"+b(d)}}),ngSoundManager.factory("angularPlayer",["$rootScope","$log",function(a,b){var c=null,d=!1,e=!1,f=[],g=!1,h=90,i=0,j=[];return{init:function(){"undefined"==typeof soundManager&&alert("Please include SoundManager2 Library!"),soundManager.setup({preferFlash:!1,debugMode:!1,useHTML5Audio:!0,onready:function(){},ontimeout:function(){alert("SM2 failed to start. Flash missing, blocked or security error?"),alert("The status is "+status.success+", the error type is "+status.error.type)},defaultOptions:{autoLoad:!1,autoPlay:!1,from:null,loops:1,multiShot:!1,multiShotEvents:!1,onid3:null,onload:null,onstop:null,onfailure:"nextTrack",onpause:null,onplay:null,onresume:null,position:null,pan:0,stream:!0,to:null,type:"audio/mp3",usePolicyFile:!1,volume:h,whileloading:function(){var b=this.bytesLoaded/this.bytesTotal*100;a.$broadcast("track:loaded",b)},whileplaying:function(){c=this.id,i=this.position/this.duration*100,a.$broadcast("track:progress",i),a.$broadcast("currentTrack:position",this.position),a.$broadcast("currentTrack:duration",this.duration)},onfinish:function(){soundManager._writeDebug(this.id+" finished playing"),angular.element(document.querySelector("[ng-app]")).injector().get("angularPlayer").nextTrack(),a.$broadcast("track:id",c)}}}),soundManager.onready(function(){b.debug("song manager ready!");var c=soundManager.ok();b.debug("is supported: "+c),a.$broadcast("angularPlayer:ready",!0)})},isInArray:function(a,b){for(var c=0;c-1){if(void 0===a.url)return b.debug("invalid soundcloud track url"),!1}else if(!0!==soundManager.canPlayURL(a.url))return b.debug("invalid song url"),!1},addTrack:function(a){return this.isTrackValid?(!1===this.isInArray(this.getPlaylist(),a.id)&&(soundManager.createSound({id:a.id,url:a.url}),this.addToPlaylist(a)),a.id):null},removeSong:function(b,d){b===c&&this.stop(),soundManager.destroySound(b),j.splice(d,1),a.$broadcast("player:playlist",j)},initPlayTrack:function(b,c){!0!==c&&(this.stop(),this.setCurrentTrack(b)),soundManager.play(b),a.$broadcast("track:id",b),g=!0,a.$broadcast("music:isPlaying",g)},play:function(){var a=null;if(null===this.getCurrentTrack()){if(0===soundManager.soundIDs.length)return void b.debug("playlist is empty!");a=soundManager.soundIDs[0],this.initPlayTrack(a)}else a=this.getCurrentTrack(),this.initPlayTrack(a,!0)},pause:function(){soundManager.pause(this.getCurrentTrack()),g=!1,a.$broadcast("music:isPlaying",g)},stop:function(){this.pause(),this.resetProgress(),a.$broadcast("track:progress",i),a.$broadcast("currentTrack:position",0),a.$broadcast("currentTrack:duration",0),soundManager.stopAll(),soundManager.unload(this.getCurrentTrack())},playTrack:function(a){this.initPlayTrack(a)},nextTrack:function(){if(null===this.getCurrentTrack())return b.debug("Please click on Play before this action"),null;var c=angular.copy(soundManager.soundIDs);!0===e&&(c=f);var h=this.getIndexByValue(c,this.getCurrentTrack()),i=+h+1,j=c[i];void 0!==j?this.playTrack(j):(!0===e&&!0===g&&(f=angular.copy(soundManager.soundIDs),f=f.sort(function(){return.5-Math.random()}),a.$broadcast("music:tempTrack",f)),!0===d?this.playTrack(c[0]):(g=!1,a.$broadcast("music:isPlaying",g)))},prevTrack:function(){if(null===this.getCurrentTrack())return b.debug("Please click on Play before this action"),null;var a=angular.copy(soundManager.soundIDs);!0===e&&(a=f);var c=this.getIndexByValue(a,this.getCurrentTrack()),d=+c-1,g=a[d];void 0!==g?this.playTrack(g):b.debug("no prev track found!")},mute:function(){!0===soundManager.muted?soundManager.unmute():soundManager.mute(),a.$broadcast("music:mute",soundManager.muted)},getMuteStatus:function(){return soundManager.muted},repeatToggle:function(){d=!0!==d,a.$broadcast("music:repeat",d)},getRepeatStatus:function(){return d},shuffleToggle:function(){!0===e?(e=!1,f=angular.copy(soundManager.soundIDs)):(e=!0,f=angular.copy(soundManager.soundIDs),f=f.sort(function(){return.5-Math.random()})),a.$broadcast("music:shuffle",e),a.$broadcast("music:tempTrack",f)},getShuffleStatus:function(){return e},playShuffle:function(){var c=null;if(e=!0,f=angular.copy(soundManager.soundIDs),f=f.sort(function(){return.5-Math.random()}),a.$broadcast("music:shuffle",e),a.$broadcast("music:tempTrack",f),0===f.length)return void b.debug("playlist is empty!");c=f[0],this.initPlayTrack(c)},getVolume:function(){return h},adjustVolume:function(b){var c=function(b){for(var c=0;c0&&(h-=10,c(h))},adjustVolumeSlider:function(b){!function(b){for(var c=0;c Date: Fri, 21 Apr 2017 15:01:28 +0700 Subject: [PATCH 8/8] add feature repeatTrack --- Gruntfile.js | 3 ++- dist/angular-soundmanager2.js | 41 +++++++++++++++++++++++++++++-- dist/angular-soundmanager2.min.js | 2 +- examples/index.html | 2 ++ src/03-factory-angularPlayer.js | 20 ++++++++++++++- src/23-directive-repeatTrack.js | 18 ++++++++++++++ 6 files changed, 81 insertions(+), 5 deletions(-) create mode 100644 src/23-directive-repeatTrack.js diff --git a/Gruntfile.js b/Gruntfile.js index b2f35a3..fb2a805 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -30,7 +30,8 @@ module.exports = function (grunt) { 'src/19-directive-volumeBar.js', 'src/20-directive-playPauseToggle.js', 'src/21-directive-shuffleMusic.js', - 'src/22-directive-shuffleAllMusic.js' + 'src/22-directive-shuffleAllMusic.js', + 'src/23-directive-repeatTrack.js' ], dest: 'dist/angular-soundmanager2.js' } diff --git a/dist/angular-soundmanager2.js b/dist/angular-soundmanager2.js index 6a64471..319a92c 100644 --- a/dist/angular-soundmanager2.js +++ b/dist/angular-soundmanager2.js @@ -4422,6 +4422,7 @@ ngSoundManager.factory('angularPlayer', ['$rootScope', '$log', var currentTrack = null, repeat = false, + repeatTrack = false, shuffle = false, tempTrack = [], autoPlay = true, @@ -4691,7 +4692,9 @@ ngSoundManager.factory('angularPlayer', ['$rootScope', '$log', var currentTrackKey = this.getIndexByValue(useTrack, this.getCurrentTrack()); var nextTrackKey = +currentTrackKey + 1; var nextTrack = useTrack[nextTrackKey]; - if(typeof nextTrack !== 'undefined') { + if(repeatTrack === true) { + this.playTrack(useTrack[currentTrackKey]); + } else if(typeof nextTrack !== 'undefined') { this.playTrack(nextTrack); } else { // generate shuffle track list @@ -4749,12 +4752,27 @@ ngSoundManager.factory('angularPlayer', ['$rootScope', '$log', repeat = false; } else { repeat = true; + repeatTrack = false; + $rootScope.$broadcast('music:repeatTrack', repeatTrack); } $rootScope.$broadcast('music:repeat', repeat); }, getRepeatStatus: function() { return repeat; }, + repeatTrackToggle: function() { + if(repeatTrack === true) { + repeatTrack = false; + } else { + repeatTrack = true; + repeat = false; + $rootScope.$broadcast('music:repeat', repeat); + } + $rootScope.$broadcast('music:repeatTrack', repeatTrack); + }, + getRepeatTrackStatus: function() { + return repeatTrack; + }, shuffleToggle: function() { if(shuffle === true) { shuffle = false; @@ -5275,4 +5293,23 @@ ngSoundManager.directive('shuffleAllMusic', ['angularPlayer', function (angularP scope.shuffle = angularPlayer.getShuffleStatus(); } }; -}]); \ No newline at end of file +}]); + +ngSoundManager.directive('repeatTrack', ['angularPlayer', function (angularPlayer) { + return { + restrict: "EA", + link: function (scope, element, attrs) { + + element.bind('click', function (event) { + angularPlayer.repeatTrackToggle(); + }); + + scope.repeatTrack = angularPlayer.getRepeatTrackStatus(); + scope.$on('music:repeatTrack', function (event, data) { + scope.$apply(function () { + scope.repeatTrack = data; + }); + }); + } + }; + }]); \ No newline at end of file diff --git a/dist/angular-soundmanager2.min.js b/dist/angular-soundmanager2.min.js index ed02d64..b7f373b 100644 --- a/dist/angular-soundmanager2.min.js +++ b/dist/angular-soundmanager2.min.js @@ -1,3 +1,3 @@ /*! angular-soundmanager2 21-04-2017 */ !function(a,b){"use strict";function c(c,d){function e(a){return qa.preferFlash&&ja&&!qa.ignoreFlash&&qa.flash[a]!==b&&qa.flash[a]}function f(a){return function(b){var c,d=this._s;return d&&d._a?c=a.call(this,b):(d&&d.id?qa._wD(d.id+": Ignoring "+b.type):qa._wD(va+"Ignoring "+b.type),c=null),c}}this.setupOptions={url:c||null,flashVersion:8,debugMode:!0,debugFlash:!1,useConsole:!0,consoleOnly:!0,waitForWindowLoad:!1,bgColor:"#ffffff",useHighPerformance:!1,flashPollingInterval:null,html5PollingInterval:null,flashLoadTimeout:1e3,wmode:null,allowScriptAccess:"always",useFlashBlock:!1,useHTML5Audio:!0,html5Test:/^(probably|maybe)$/i,preferFlash:!1,noSWFCache:!1,idPrefix:"sound"},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,duration:null},this.audioFormats={mp3:{type:['audio/mpeg; codecs="mp3"',"audio/mpeg","audio/mp3","audio/MPA","audio/mpa-robust"],required:!0},mp4:{related:["aac","m4a","m4b"],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},opus:{type:["audio/ogg; codecs=opus","audio/opus"],required:!1},wav:{type:['audio/wav; codecs="1"',"audio/wav","audio/wave","audio/x-wav"],required:!1}},this.movieID="sm2-container",this.id=d||"sm2movie",this.debugID="soundmanager-debug",this.debugURLParam=/([#?&])debug=1/i,this.versionNumber="V2.97a.20140901",this.version=null,this.movieURL=null,this.altURL=null,this.swfLoaded=!1,this.enabled=!1,this.oMC=null,this.sounds={},this.soundIDs=[],this.muted=!1,this.didFlashBlock=!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={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},this.html5={usingFlash:null},this.flash={},this.html5Only=!1,this.ignoreFlash=!1;var g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,$,_,aa,ba,ca,da,ea,fa,ga,ha,ia,ja,ka,la,ma,na,oa,pa,qa=this,ra=null,sa=null,ta="soundManager",ua=ta+": ",va="HTML5::",wa=navigator.userAgent,xa=a.location.href.toString(),ya=document,za=[],Aa=!0,Ba=!1,Ca=!1,Da=!1,Ea=!1,Fa=!1,Ga=0,Ha=["log","info","warn","error"],Ia=8,Ja=null,Ka=null,La=!1,Ma=!1,Na=0,Oa=null,Pa=[],Qa=null,Ra=Array.prototype.slice,Sa=!1,Ta=0,Ua=wa.match(/(ipad|iphone|ipod)/i),Va=wa.match(/android/i),Wa=wa.match(/msie/i),Xa=wa.match(/webkit/i),Ya=wa.match(/safari/i)&&!wa.match(/chrome/i),Za=wa.match(/opera/i),$a=wa.match(/(mobile|pre\/|xoom)/i)||Ua||Va,_a=!xa.match(/usehtml5audio/i)&&!xa.match(/sm2\-ignorebadua/i)&&Ya&&!wa.match(/silk/i)&&wa.match(/OS X 10_6_([3-7])/i),ab=a.console!==b&&console.log!==b,bb=ya.hasFocus!==b?ya.hasFocus():null,cb=Ya&&(ya.hasFocus===b||!ya.hasFocus()),db=!cb,eb=/(mp3|mp4|mpa|m4a|m4b)/i,fb=1e3,gb="about:blank",hb=ya.location?ya.location.protocol.match(/http/i):null,ib=hb?"":"http://",jb=/^\s*audio\/(?:x-)?(?:mpeg4|aac|flv|mov|mp4||m4v|m4a|m4b|mp4v|3gp|3g2)\s*(?:$|;)/i,kb=["mpeg4","aac","flv","mov","mp4","m4v","f4v","m4a","m4b","mp4v","3gp","3g2"],lb=new RegExp("\\.("+kb.join("|")+")(\\?.*)?$","i");this.mimePattern=/^\s*audio\/(?:x-)?(?:mp(?:eg|3))\s*(?:$|;)/i,this.useAltURL=!hb,R={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.hasHTML5=function(){try{return Audio!==b&&(Za&&opera!==b&&opera.version()<10?new Audio(null):new Audio).canPlayType!==b}catch(a){return!1}}(),this.setup=function(a){var c=!qa.url;return a!==b&&Da&&Qa&&qa.ok()&&(a.flashVersion!==b||a.url!==b||a.html5Test!==b)&&V(O("setupLate")),q(a),a&&(c&&F&&a.url!==b&&qa.beginDelayedInit(),F||a.url===b||"complete"!==ya.readyState||setTimeout(D,1)),qa},this.ok=function(){return Qa?Da&&!Ea:qa.useHTML5Audio&&qa.hasHTML5},this.supported=this.ok,this.getMovie=function(b){return h(b)||ya[b]||a[b]},this.createSound=function(a,c){function d(){return h=T(h),qa.sounds[h.id]=new g(h),qa.soundIDs.push(h.id),qa.sounds[h.id]}var e,f,h,i=null;if(e=ta+".createSound(): ",f=e+O(Da?"notOK":"notReady"),!Da||!qa.ok())return V(f),!1;if(c!==b&&(a={id:a,url:c}),h=p(a),h.url=$(h.url),void 0===h.id&&(h.id=qa.setupOptions.idPrefix+Ta++),h.id.toString().charAt(0).match(/^[0-9]$/)&&qa._wD(e+O("badID",h.id),2),qa._wD(e+h.id+(h.url?" ("+h.url+")":""),1),W(h.id,!0))return qa._wD(e+h.id+" exists",1),qa.sounds[h.id];if(ba(h))i=d(),qa._wD(h.id+": Using HTML5"),i._setup_html5(h);else{if(qa.html5Only)return qa._wD(h.id+": No HTML5 support for this sound, and no Flash. Exiting."),d();if(qa.html5.usingFlash&&h.url&&h.url.match(/data\:/i))return qa._wD(h.id+": data: URIs not supported via Flash. Exiting."),d();l>8&&(null===h.isMovieStar&&(h.isMovieStar=!!(h.serverURL||h.type&&h.type.match(jb)||h.url&&h.url.match(lb))),h.isMovieStar&&(qa._wD(e+"using MovieStar handling"),h.loops>1&&n("noNSLoop"))),h=U(h,e),i=d(),8===l?sa._createSound(h.id,h.loops||1,h.usePolicyFile):(sa._createSound(h.id,h.url,h.usePeakData,h.useWaveformData,h.useEQData,h.isMovieStar,!!h.isMovieStar&&h.bufferTime,h.loops||1,h.serverURL,h.duration||null,h.autoPlay,!0,h.autoLoad,h.usePolicyFile),h.serverURL||(i.connected=!0,h.onconnect&&h.onconnect.apply(i))),h.serverURL||!h.autoLoad&&!h.autoPlay||i.load(h)}return!h.serverURL&&h.autoPlay&&i.play(),i},this.destroySound=function(a,b){if(!W(a))return!1;var c,d=qa.sounds[a];for(d._iO={},d.stop(),d.unload(),c=0;c=0;a--)qa.sounds[qa.soundIDs[a]].pause()},this.resume=function(a){return!!W(a)&&qa.sounds[a].resume()},this.resumeAll=function(){var a;for(a=qa.soundIDs.length-1;a>=0;a--)qa.sounds[qa.soundIDs[a]].resume()},this.togglePause=function(a){return!!W(a)&&qa.sounds[a].togglePause()},this.setPan=function(a,b){return!!W(a)&&qa.sounds[a].setPan(b)},this.setVolume=function(a,b){return!!W(a)&&qa.sounds[a].setVolume(b)},this.mute=function(a){var b=0;if(a instanceof String&&(a=null),a)return!!W(a)&&(qa._wD(ta+'.mute(): Muting "'+a+'"'),qa.sounds[a].mute());for(qa._wD(ta+".mute(): Muting all sounds"),b=qa.soundIDs.length-1;b>=0;b--)qa.sounds[qa.soundIDs[b]].mute();return qa.muted=!0,!0},this.muteAll=function(){qa.mute()},this.unmute=function(a){var b;if(a instanceof String&&(a=null),a)return!!W(a)&&(qa._wD(ta+'.unmute(): Unmuting "'+a+'"'),qa.sounds[a].unmute());for(qa._wD(ta+".unmute(): Unmuting all sounds"),b=qa.soundIDs.length-1;b>=0;b--)qa.sounds[qa.soundIDs[b]].unmute();return qa.muted=!1,!0},this.unmuteAll=function(){qa.unmute()},this.toggleMute=function(a){return!!W(a)&&qa.sounds[a].toggleMute()},this.getMemoryUse=function(){var a=0;return sa&&8!==l&&(a=parseInt(sa._getMemoryUse(),10)),a},this.disable=function(c){var d;if(c===b&&(c=!1),Ea)return!1;for(Ea=!0,n("shutdown",1),d=qa.soundIDs.length-1;d>=0;d--)L(qa.sounds[qa.soundIDs[d]]);return o(c),ha.remove(a,"load",u),!0},this.canPlayMIME=function(a){var b;return qa.hasHTML5&&(b=ca({type:a})),!b&&Qa&&(b=a&&qa.ok()?!!((l>8?a.match(jb):null)||a.match(qa.mimePattern)):null),b},this.canPlayURL=function(a){var b;return qa.hasHTML5&&(b=ca({url:a})),!b&&Qa&&(b=a&&qa.ok()?!!a.match(qa.filePattern):null),b},this.canPlayLink=function(a){return!(a.type===b||!a.type||!qa.canPlayMIME(a.type))||qa.canPlayURL(a.href)},this.getSoundById=function(a,b){if(!a)return null;var c=qa.sounds[a];return c||b||qa._wD(ta+'.getSoundById(): Sound "'+a+'" not found.',2),c},this.onready=function(b,c){var d="onready";if("function"!=typeof b)throw O("needFunction",d);return Da&&qa._wD(O("queue",d)),c||(c=a),s(d,b,c),t(),!0},this.ontimeout=function(b,c){var d="ontimeout";if("function"!=typeof b)throw O("needFunction",d);return Da&&qa._wD(O("queue",d)),c||(c=a),s(d,b,c),t({type:d}),!0},this._writeDebug=function(a,c){var d,e;return!(!qa.debugMode||!(ab&&qa.useConsole&&(c&&"object"==typeof c?console.log(a,c):Ha[c]!==b?console[Ha[c]](a):console.log(a),qa.consoleOnly))&&(!(d=h("soundmanager-debug"))||(e=ya.createElement("div"),++Ga%2==0&&(e.className="sm2-alt"),c=c===b?0:parseInt(c,10),e.appendChild(ya.createTextNode(a)),c&&(c>=2&&(e.style.fontWeight="bold"),3===c&&(e.style.color="#ff3333")),d.insertBefore(e,d.firstChild),d=null,0)))},-1!==xa.indexOf("sm2-debug=alert")&&(this._writeDebug=function(b){a.alert(b)}),this._wD=this._writeDebug,this._debug=function(){var a,b;for(n("currentObj",1),a=0,b=qa.soundIDs.length;a=0;d--)qa.sounds[qa.soundIDs[d]].destruct();if(sa)try{Wa&&(Ka=sa.innerHTML),Ja=sa.parentNode.removeChild(sa)}catch(a){n("badRemove",2)}if(Ka=Ja=Qa=sa=null,qa.enabled=F=Da=La=Ma=Ba=Ca=Ea=Sa=qa.swfLoaded=!1,qa.soundIDs=[],qa.sounds={},Ta=0,b)za=[];else for(d in za)if(za.hasOwnProperty(d))for(e=0,f=za[d].length;e0&&q.position===q.duration&&(qa._wD(d+"Sound at end, resetting to position:0"),a.position=0),q.paused&&q.position>=0&&(!q._iO.serverURL||q.position>0))qa._wD(d+"Resuming from paused state",1),q.resume();else{if(q._iO=p(a,q._iO),(!q.isHTML5&&null!==q._iO.position&&q._iO.position>0||null!==q._iO.from&&q._iO.from>0||null!==q._iO.to)&&0===q.instanceCount&&0===q.playState&&!q._iO.serverURL){if(i=function(){q._iO=p(a,q._iO),q.play(q._iO)},q.isHTML5&&!q._html5_canplay?(qa._wD(d+"Beginning load for non-zero offset case"),q.load({_oncanplay:i}),t=!1):q.isHTML5||q.loaded||q.readyState&&2===q.readyState||(qa._wD(d+"Preloading for non-zero offset case"),q.load({onload:i}),t=!1),null!==t)return t;q._iO=j()}(!q.instanceCount||q._iO.multiShotEvents||q.isHTML5&&q._iO.multiShot&&!Sa||!q.isHTML5&&l>8&&!q.getAutoPlay())&&q.instanceCount++,q._iO.onposition&&0===q.playState&&h(q),q.playState=1,q.paused=!1,q.position=q._iO.position===b||isNaN(q._iO.position)?0:q._iO.position,q.isHTML5||(q._iO=U(T(q._iO))),q._iO.onplay&&c&&(q._iO.onplay.apply(q),r=!0),q.setVolume(q._iO.volume,!0),q.setPan(q._iO.pan,!0),q.isHTML5?q.instanceCount<2?(g(),f=q._setup_html5(),q.setPosition(q._iO.position),f.play()):(qa._wD(q.id+": Cloning Audio() for instance #"+q.instanceCount+"..."),k=new Audio(q._iO.url),m=function(){ha.remove(k,"ended",m),q._onfinish(q),ea(k),k=null},n=function(){ha.remove(k,"canplay",n);try{k.currentTime=q._iO.position/fb}catch(a){V(q.id+": multiShot play() failed to apply position of "+q._iO.position/fb)}k.play()},ha.add(k,"ended",m),void 0!==q._iO.volume&&(k.volume=Math.max(0,Math.min(1,q._iO.volume/100))),q.muted&&(k.muted=!0),q._iO.position?ha.add(k,"canplay",n):k.play()):(s=sa._start(q.id,q._iO.loops||1,9===l?q.position:q.position/fb,q._iO.multiShot||!1),9!==l||s||(qa._wD(d+"No sound hardware, or 32-sound ceiling hit",2),q._iO.onplayerror&&q._iO.onplayerror.apply(q)))}return q},this.start=this.play,this.stop=function(a){var b,c=q._iO;return 1===q.playState&&(qa._wD(q.id+": stop()"),q._onbufferchange(0),q._resetOnPosition(0),q.paused=!1,q.isHTML5||(q.playState=0),i(),c.to&&q.clearOnPosition(c.to),q.isHTML5?q._a&&(b=q.position,q.setPosition(0),q.position=b,q._a.pause(),q.playState=0,q._onTimer(),f()):(sa._stop(q.id,a),c.serverURL&&q.unload()),q.instanceCount=0,q._iO={},c.onstop&&c.onstop.apply(q)),q},this.setAutoPlay=function(a){qa._wD(q.id+": Autoplay turned "+(a?"on":"off")),q._iO.autoPlay=a,q.isHTML5||(sa._setAutoPlay(q.id,a),a&&(q.instanceCount||1!==q.readyState||(q.instanceCount++,qa._wD(q.id+": Incremented instance count to "+q.instanceCount))))},this.getAutoPlay=function(){return q._iO.autoPlay},this.setPosition=function(a){a===b&&(a=0);var c,d,e=q.isHTML5?Math.max(a,0):Math.min(q.duration||q._iO.duration,Math.max(a,0));if(q.position=e,d=q.position/fb,q._resetOnPosition(q.position),q._iO.position=e,q.isHTML5){if(q._a){if(q._html5_canplay){if(q._a.currentTime!==d){qa._wD(q.id+": setPosition("+d+")");try{q._a.currentTime=d,(0===q.playState||q.paused)&&q._a.pause()}catch(a){qa._wD(q.id+": setPosition("+d+") failed: "+a.message,2)}}}else if(d)return qa._wD(q.id+": setPosition("+d+"): Cannot seek yet, sound not ready",2),q;q.paused&&q._onTimer(!0)}}else c=9===l?q.position:d,q.readyState&&2!==q.readyState&&sa._setPosition(q.id,c,q.paused||!q.playState,q._iO.multiShot);return q},this.pause=function(a){return q.paused||0===q.playState&&1!==q.readyState?q:(qa._wD(q.id+": pause()"),q.paused=!0,q.isHTML5?(q._setup_html5().pause(),f()):(a||a===b)&&sa._pause(q.id,q._iO.multiShot),q._iO.onpause&&q._iO.onpause.apply(q),q)},this.resume=function(){var a=q._iO;return q.paused?(qa._wD(q.id+": resume()"),q.paused=!1,q.playState=1,q.isHTML5?(q._setup_html5().play(),g()):(a.isMovieStar&&!a.serverURL&&q.setPosition(q.position),sa._pause(q.id,a.multiShot)),!r&&a.onplay?(a.onplay.apply(q),r=!0):a.onresume&&a.onresume.apply(q),q):q},this.togglePause=function(){return qa._wD(q.id+": togglePause()"),0===q.playState?(q.play({position:9!==l||q.isHTML5?q.position/fb:q.position}),q):(q.paused?q.resume():q.pause(),q)},this.setPan=function(a,c){return a===b&&(a=0),c===b&&(c=!1),q.isHTML5||sa._setPan(q.id,a),q._iO.pan=a,c||(q.pan=a,q.options.pan=a),q},this.setVolume=function(a,c){return a===b&&(a=100),c===b&&(c=!1),q.isHTML5?q._a&&(qa.muted&&!q.muted&&(q.muted=!0,q._a.muted=!0),q._a.volume=Math.max(0,Math.min(1,a/100))):sa._setVolume(q.id,qa.muted&&!q.muted||q.muted?0:a),q._iO.volume=a,c||(q.volume=a,q.options.volume=a),q},this.mute=function(){return q.muted=!0,q.isHTML5?q._a&&(q._a.muted=!0):sa._setVolume(q.id,0),q},this.unmute=function(){q.muted=!1;var a=q._iO.volume!==b;return q.isHTML5?q._a&&(q._a.muted=!1):sa._setVolume(q.id,a?q._iO.volume:q.options.volume),q},this.toggleMute=function(){return q.muted?q.unmute():q.mute()},this.onPosition=function(a,c,d){return s.push({position:parseInt(a,10),method:c,scope:d!==b?d:q,fired:!1}),q},this.onposition=this.onPosition,this.clearOnPosition=function(a,b){var c;if(a=parseInt(a,10),isNaN(a))return!1;for(c=0;c=c)return!1;for(a=c-1;a>=0;a--)b=s[a],!b.fired&&q.position>=b.position&&(b.fired=!0,t++,b.method.apply(b.scope,[b.position]),c=s.length);return!0},this._resetOnPosition=function(a){var b,c,d=s.length;if(!d)return!1;for(b=d-1;b>=0;b--)c=s[b],c.fired&&a<=c.position&&(c.fired=!1,t--);return!0},j=function(){var a,b,c=q._iO,d=c.from,e=c.to;return b=function(){qa._wD(q.id+': "To" time of '+e+" reached."),q.clearOnPosition(e,b),q.stop()},a=function(){qa._wD(q.id+': Playing "from" '+d),null===e||isNaN(e)||q.onPosition(e,b)},null===d||isNaN(d)||(c.position=d,c.multiShot=!1,a()),c},h=function(){var a,b=q._iO.onposition;if(b)for(a in b)b.hasOwnProperty(a)&&q.onPosition(parseInt(a,10),b[a])},i=function(){var a,b=q._iO.onposition;if(b)for(a in b)b.hasOwnProperty(a)&&q.clearOnPosition(parseInt(a,10))},g=function(){q.isHTML5&&X(q)},f=function(){q.isHTML5&&Y(q)},c=function(a){a||(s=[],t=0),r=!1,q._hasTimer=null,q._a=null,q._html5_canplay=!1,q.bytesLoaded=null,q.bytesTotal=null,q.duration=q._iO&&q._iO.duration?q._iO.duration:null,q.durationEstimate=null,q.buffered=[],q.eqData=[],q.eqData.left=[],q.eqData.right=[],q.failures=0,q.isBuffering=!1,q.instanceOptions={},q.instanceCount=0,q.loaded=!1,q.metadata={},q.readyState=0,q.muted=!1,q.paused=!1,q.peakData={left:0,right:0},q.waveformData={left:[],right:[]},q.playState=0,q.position=null,q.id3={}},c(),this._onTimer=function(a){var b,c,d=!1,e={};if(q._hasTimer||a)return q._a&&(a||(q.playState>0||1===q.readyState)&&!q.paused)&&(b=q._get_html5_duration(),b!==k.duration&&(k.duration=b,q.duration=b,d=!0),q.durationEstimate=q.duration,c=q._a.currentTime*fb||0,c!==k.time&&(k.time=c,d=!0),(d||a)&&q._whileplaying(c,e,e,e,e)),d},this._get_html5_duration=function(){var a=q._iO,b=q._a&&q._a.duration?q._a.duration*fb:a&&a.duration?a.duration:null;return b&&!isNaN(b)&&b!==1/0?b:null},this._apply_loop=function(a,b){!a.loop&&b>1&&qa._wD("Note: Native HTML5 looping is infinite.",1),a.loop=b>1?"loop":""},this._setup_html5=function(a){var b,e=p(q._iO,a),f=Sa?ra:q._a,g=decodeURI(e.url);if(Sa?g===decodeURI(ia)&&(b=!0):g===decodeURI(u)&&(b=!0),f){if(f._s)if(Sa)f._s&&f._s.playState&&!b&&f._s.stop();else if(!Sa&&g===decodeURI(u))return q._apply_loop(f,e.loops),f;b||(u&&c(!1),f.src=e.url,q.url=e.url,u=e.url,ia=e.url,f._called_load=!1)}else e.autoLoad||e.autoPlay?(q._a=new Audio(e.url),q._a.load()):q._a=Za&&opera.version()<10?new Audio(null):new Audio,f=q._a,f._called_load=!1,Sa&&(ra=f);return q.isHTML5=!0,q._a=f,f._s=q,d(),q._apply_loop(f,e.loops),e.autoLoad||e.autoPlay?q.load():(f.autobuffer=!1,f.preload="auto"),f},d=function(){function a(a,b,c){return q._a?q._a.addEventListener(a,b,c||!1):null}if(q._a._added_events)return!1;var b;q._a._added_events=!0;for(b in ma)ma.hasOwnProperty(b)&&a(b,ma[b]);return!0},e=function(){function a(a,b,c){return q._a?q._a.removeEventListener(a,b,c||!1):null}var b;qa._wD(q.id+": Removing event listeners"),q._a._added_events=!1;for(b in ma)ma.hasOwnProperty(b)&&a(b,ma[b])},this._onload=function(a){var b,c=!!a||!q.isHTML5&&8===l&&q.duration;return b=q.id+": ",qa._wD(b+(c?"onload()":"Failed to load / invalid sound?"+(q.duration?" -":" Zero-length duration reported.")+" ("+q.url+")"),c?1:2),c||q.isHTML5||(!0===qa.sandbox.noRemote&&qa._wD(b+O("noNet"),1),!0===qa.sandbox.noLocal&&qa._wD(b+O("noLocal"),1)),q.loaded=c,q.readyState=c?3:2,q._onbufferchange(0),q._iO.onload&&pa(q,function(){q._iO.onload.apply(q,[c])}),!0},this._onbufferchange=function(a){return!(0===q.playState||a&&q.isBuffering||!a&&!q.isBuffering||(q.isBuffering=1===a,q._iO.onbufferchange&&(qa._wD(q.id+": Buffer state change: "+a),q._iO.onbufferchange.apply(q,[a])),0))},this._onsuspend=function(){return q._iO.onsuspend&&(qa._wD(q.id+": Playback suspended"),q._iO.onsuspend.apply(q)),!0},this._onfailure=function(a,b,c){q.failures++,qa._wD(q.id+": Failure ("+q.failures+"): "+a),q._iO.onfailure&&1===q.failures?q._iO.onfailure(a,b,c):qa._wD(q.id+": Ignoring failure")},this._onwarning=function(a,b,c){q._iO.onwarning&&q._iO.onwarning(a,b,c)},this._onfinish=function(){var a=q._iO.onfinish;q._onbufferchange(0),q._resetOnPosition(0),q.instanceCount&&(q.instanceCount--,q.instanceCount||(i(),q.playState=0,q.paused=!1,q.instanceCount=0,q.instanceOptions={},q._iO={},f(),q.isHTML5&&(q.position=0)),q.instanceCount&&!q._iO.multiShotEvents||a&&(qa._wD(q.id+": onfinish()"),pa(q,function(){a.apply(q)})))},this._whileloading=function(a,b,c,d){var e=q._iO;q.bytesLoaded=a,q.bytesTotal=b,q.duration=Math.floor(c),q.bufferLength=d,q.isHTML5||e.isMovieStar?q.durationEstimate=q.duration:e.duration?q.durationEstimate=q.duration>e.duration?q.duration:e.duration:q.durationEstimate=parseInt(q.bytesTotal/q.bytesLoaded*q.duration,10),q.isHTML5||(q.buffered=[{start:0,end:q.duration}]),(3!==q.readyState||q.isHTML5)&&e.whileloading&&e.whileloading.apply(q)},this._whileplaying=function(a,c,d,e,f){var g,h=q._iO;return!isNaN(a)&&null!==a&&(q.position=Math.max(0,a),q._processOnPosition(),!q.isHTML5&&l>8&&(h.usePeakData&&c!==b&&c&&(q.peakData={left:c.leftPeak,right:c.rightPeak}),h.useWaveformData&&d!==b&&d&&(q.waveformData={left:d.split(","),right:e.split(",")}),h.useEQData&&f!==b&&f&&f.leftEQ&&(g=f.leftEQ.split(","),q.eqData=g,q.eqData.left=g,f.rightEQ!==b&&f.rightEQ&&(q.eqData.right=f.rightEQ.split(",")))),1===q.playState&&(q.isHTML5||8!==l||q.position||!q.isBuffering||q._onbufferchange(0),h.whileplaying&&h.whileplaying.apply(q)),!0)},this._oncaptiondata=function(a){qa._wD(q.id+": Caption data received."),q.captiondata=a,q._iO.oncaptiondata&&q._iO.oncaptiondata.apply(q,[a])},this._onmetadata=function(a,b){qa._wD(q.id+": Metadata received.");var c,d,e={};for(c=0,d=a.length;c0&&(qa._wD(q.id+": Data error: "+a),q._iO.ondataerror&&q._iO.ondataerror.apply(q))},this._debug()},G=function(){return ya.body||ya.getElementsByTagName("div")[0]},h=function(a){return ya.getElementById(a)},p=function(a,c){var d,e,f=a||{};d=c===b?qa.defaultOptions:c;for(e in d)d.hasOwnProperty(e)&&f[e]===b&&("object"!=typeof d[e]||null===d[e]?f[e]=d[e]:f[e]=p(f[e],d[e]));return f},pa=function(b,c){b.isHTML5||8!==l?c():a.setTimeout(c,0)},r={onready:1,ontimeout:1,defaultOptions:1,flash9Options:1,movieStarOptions:1},q=function(a,c){var d,e=!0,f=c!==b,g=qa.setupOptions,h=r;if(a===b){e=[];for(d in g)g.hasOwnProperty(d)&&e.push(d);for(d in h)h.hasOwnProperty(d)&&("object"==typeof qa[d]?e.push(d+": {...}"):qa[d]instanceof Function?e.push(d+": function() {...}"):e.push(d));return qa._wD(O("setup",e.join(", "))),!1}for(d in a)if(a.hasOwnProperty(d))if("object"!=typeof a[d]||null===a[d]||a[d]instanceof Array||a[d]instanceof RegExp)f&&h[c]!==b?qa[c][d]=a[d]:g[d]!==b?(qa.setupOptions[d]=a[d],qa[d]=a[d]):h[d]===b?(V(O(qa[d]===b?"setupUndef":"setupError",d),2),e=!1):qa[d]instanceof Function?qa[d].apply(qa,a[d]instanceof Array?a[d]:[a[d]]):qa[d]=a[d];else{if(h[d]!==b)return q(a[d],d);V(O(qa[d]===b?"setupUndef":"setupError",d),2),e=!1}return e},ha=function(){function b(a){var b=Ra.call(a),c=b.length;return f?(b[1]="on"+b[1],c>3&&b.pop()):3===c&&b.push(!1),b}function c(a,b){var c=a.shift(),d=[g[b]];f?c[d](a[0],a[1]):c[d].apply(c,a)}function d(){c(b(arguments),"add")}function e(){c(b(arguments),"remove")}var f=a.attachEvent,g={add:f?"attachEvent":"addEventListener",remove:f?"detachEvent":"removeEventListener"};return{add:d,remove:e}}(),ma={abort:f(function(){qa._wD(this._s.id+": abort")}),canplay:f(function(){var a,c=this._s;if(c._html5_canplay)return!0;if(c._html5_canplay=!0,qa._wD(c.id+": canplay"),c._onbufferchange(0),a=c._iO.position===b||isNaN(c._iO.position)?null:c._iO.position/fb,this.currentTime!==a){qa._wD(c.id+": canplay: Setting position to "+a);try{this.currentTime=a}catch(b){qa._wD(c.id+": canplay: Setting position of "+a+" failed: "+b.message,2)}}c._iO._oncanplay&&c._iO._oncanplay()}),canplaythrough:f(function(){var a=this._s;a.loaded||(a._onbufferchange(0),a._whileloading(a.bytesLoaded,a.bytesTotal,a._get_html5_duration()),a._onload(!0))}),durationchange:f(function(){var a,b=this._s;a=b._get_html5_duration(),isNaN(a)||a===b.duration||(qa._wD(this._s.id+": durationchange ("+a+")"+(b.duration?", previously "+b.duration:"")),b.durationEstimate=b.duration=a)}),ended:f(function(){var a=this._s;qa._wD(a.id+": ended"),a._onfinish()}),error:f(function(){qa._wD(this._s.id+": HTML5 error, code "+this.error.code),this._s._onload(!1)}),loadeddata:f(function(){var a=this._s;qa._wD(a.id+": loadeddata"),a._loaded||Ya||(a.duration=a._get_html5_duration())}),loadedmetadata:f(function(){qa._wD(this._s.id+": loadedmetadata")}),loadstart:f(function(){qa._wD(this._s.id+": loadstart"),this._s._onbufferchange(1)}),play:f(function(){this._s._onbufferchange(0)}),playing:f(function(){qa._wD(this._s.id+": playing "+String.fromCharCode(9835)),this._s._onbufferchange(0)}),progress:f(function(a){var b,c,d,e=this._s,f=0,g="progress"===a.type,h=a.target.buffered,i=a.loaded||0,j=a.total||1;if(e.buffered=[],h&&h.length){for(b=0,c=h.length;b1){for(d=[],c=h.length,b=0;b=0;f--)h["audio/"+e[c].related[f]]=h[c],qa.html5[e[c].related[f]]=h[c],qa.flash[e[c].related[f]]=h[c];return h.canPlayType=g?a:null,qa.html5=p(qa.html5,h),qa.html5.usingFlash=aa(),Qa=qa.html5.usingFlash,!0},A={notReady:"Unavailable - wait until onready() has fired.",notOK:"Audio support is not available.",domError:ta+"exception caught while appending SWF to DOM.",spcWmode:"Removing wmode, preventing known SWF loading issue(s)",swf404:ua+"Verify that %s is a valid path.",tryDebug:"Try "+ta+".debugFlash = true for more security details (output goes to SWF.)",checkSWF:"See SWF output for more debug info.",localFail:ua+"Non-HTTP page ("+ya.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:ua+"Special case: Waiting for SWF to load with window focus...",waitForever:ua+"Waiting indefinitely for Flash (will recover if unblocked)...",waitSWF:ua+"Waiting for 100% SWF load...",needFunction:ua+"Function object expected for %s",badID:'Sound ID "%s" should be a string, starting with a non-numeric character',currentObj:ua+"_debug(): Current sound objects",waitOnload:ua+"Waiting for window.onload()",docLoaded:ua+"Document already loaded",onload:ua+"initComplete(): calling soundManager.onload()",onloadOK:ta+".onload() complete",didInit:ua+"init(): Already called?",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",badRemove:ua+"Failed to remove Flash node.",shutdown:ta+".disable(): Shutting down",queue:ua+"Queueing %s handler",smError:"SMSound.load(): Exception: JS-Flash communication failed, or JS error.",fbTimeout:"No flash response, applying ."+R.swfTimedout+" CSS...",fbLoaded:"Flash loaded",fbHandler:ua+"flashBlockHandler()",manURL:"SMSound.load(): Using manually-assigned URL",onURL:ta+".load(): current URL already assigned.",badFV:ta+'.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",needFlash:ua+"Fatal error: Flash is needed to play some required formats, but is not available.",gotFocus:ua+"Got window focus.",policy:"Enabling usePolicyFile for data access",setup:ta+".setup(): allowed parameters: %s",setupError:ta+'.setup(): "%s" cannot be assigned with this method.',setupUndef:ta+'.setup(): Could not find option "%s"',setupLate:ta+".setup(): url, flashVersion and html5Test property changes will not take effect until reboot().",noURL:ua+"Flash URL required. Call soundManager.setup({url:...}) to get started.",sm2Loaded:"SoundManager 2: Ready. "+String.fromCharCode(10003),reset:ta+".reset(): Removing event callbacks",mobileUA:"Mobile UA detected, preferring HTML5 by default.",globalHTML5:"Using singleton HTML5 Audio() pattern for this device."},O=function(){var a,b,c,d,e;if(a=Ra.call(arguments),d=a.shift(),(e=A&&A[d]?A[d]:"")&&a&&a.length)for(b=0,c=a.length;b1&&a.stream&&(n("as2loop"),a.stream=!1),a},U=function(a,b){return a&&!a.usePolicyFile&&(a.onid3||a.usePeakData||a.useWaveformData||a.useEQData)&&(qa._wD((b||"")+O("policy")),a.usePolicyFile=!0),a},V=function(a){ab&&console.warn!==b?console.warn(a):qa._wD(a)},i=function(){return!1},L=function(a){var b;for(b in a)a.hasOwnProperty(b)&&"function"==typeof a[b]&&(a[b]=i);b=null},M=function(a){a===b&&(a=!1),(Ea||a)&&qa.disable(a)},N=function(a){var b;if(a)if(a.match(/\.swf(\?.*)?$/i)){if(a.substr(a.toLowerCase().lastIndexOf(".swf?")+4))return a}else a.lastIndexOf("/")!==a.length-1&&(a+="/");return b=(a&&-1!==a.lastIndexOf("/")?a.substr(0,a.lastIndexOf("/")+1):"./")+qa.movieURL,qa.noSWFCache&&(b+="?ts="+(new Date).getTime()),b},y=function(){8!==(l=parseInt(qa.flashVersion,10))&&9!==l&&(qa._wD(O("badFV",l,Ia)),qa.flashVersion=l=Ia);var a=qa.debugMode||qa.debugFlash?"_debug.swf":".swf";qa.useHTML5Audio&&!qa.html5Only&&qa.audioFormats.mp4.required&&l<9&&(qa._wD(O("needfl9")),qa.flashVersion=l=9),qa.version=qa.versionNumber+(qa.html5Only?" (HTML5-only mode)":9===l?" (AS3/Flash 9)":" (AS2/Flash 8)"),l>8?(qa.defaultOptions=p(qa.defaultOptions,qa.flash9Options),qa.features.buffering=!0,qa.defaultOptions=p(qa.defaultOptions,qa.movieStarOptions),qa.filePatterns.flash9=new RegExp("\\.(mp3|"+kb.join("|")+")(\\?.*)?$","i"),qa.features.movieStar=!0):qa.features.movieStar=!1,qa.filePattern=qa.filePatterns[8!==l?"flash9":"flash8"],qa.movieURL=(8===l?"soundmanager2.swf":"soundmanager2_flash9.swf").replace(".swf",a),qa.features.peakData=qa.features.waveformData=qa.features.eqData=l>8},J=function(a,b){if(!sa)return!1;sa._setPolling(a,b)},K=function(){if(qa.debugURLParam.test(xa)&&(qa.debugMode=!0),h(qa.debugID))return!1;var a,b,c,d,e;if(qa.debugMode&&!h(qa.debugID)&&(!ab||!qa.useConsole||!qa.consoleOnly)){a=ya.createElement("div"),a.id=qa.debugID+"-toggle",d={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},a.appendChild(ya.createTextNode("-")),a.onclick=S,a.title="Toggle SM2 debug console",wa.match(/msie 6/i)&&(a.style.position="absolute",a.style.cursor="hand");for(e in d)d.hasOwnProperty(e)&&(a.style[e]=d[e]);if(b=ya.createElement("div"),b.id=qa.debugID,b.style.display=qa.debugMode?"block":"none",qa.debugMode&&!h(a.id)){try{c=G(),c.appendChild(a)}catch(a){throw new Error(O("domError")+" \n"+a.toString())}c.appendChild(b)}}c=null},W=this.getSoundById,n=function(a,b){return a?qa._wD(O(a),b):""},S=function(){var a=h(qa.debugID),b=h(qa.debugID+"-toggle");if(!a)return!1;Aa?(b.innerHTML="+",a.style.display="none"):(b.innerHTML="-",a.style.display="block"),Aa=!Aa},m=function(c,d,e){if(a.sm2Debugger!==b)try{sm2Debugger.handleEvent(c,d,e)}catch(a){return!1}return!0},Q=function(){var a=[];return qa.debugMode&&a.push(R.sm2Debug),qa.debugFlash&&a.push(R.flashDebug),qa.useHighPerformance&&a.push(R.highPerf),a.join(" ")},P=function(){var a=O("fbHandler"),b=qa.getMoviePercent(),c=R,d={type:"FLASHBLOCK"};if(qa.html5Only)return!1;qa.ok()?(qa.didFlashBlock&&qa._wD(a+": Unblocked"),qa.oMC&&(qa.oMC.className=[Q(),c.swfDefault,c.swfLoaded+(qa.didFlashBlock?" "+c.swfUnblocked:"")].join(" "))):(Qa&&(qa.oMC.className=Q()+" "+c.swfDefault+" "+(null===b?c.swfTimedout:c.swfError),qa._wD(a+": "+O("fbTimeout")+(b?" ("+O("fbLoaded")+")":""))),qa.didFlashBlock=!0,t({type:"ontimeout",ignoreInit:!0,error:d}),I(d))},s=function(a,c,d){za[a]===b&&(za[a]=[]),za[a].push({method:c,scope:d||null,fired:!1})},t=function(a){if(a||(a={type:qa.ok()?"onready":"ontimeout"}),!Da&&a&&!a.ignoreInit)return!1;if("ontimeout"===a.type&&(qa.ok()||Ea&&!a.ignoreInit))return!1;var b,c,d={success:a&&a.ignoreInit?qa.ok():!Ea},e=a&&a.type?za[a.type]||[]:[],f=[],g=[d],h=Qa&&!qa.ok();for(a.error&&(g[0].error=a.error),b=0,c=e.length;b=0;a--)qa.sounds[qa.soundIDs[a]].isHTML5&&qa.sounds[qa.soundIDs[a]]._hasTimer&&qa.sounds[qa.soundIDs[a]]._onTimer()},I=function(c){c=c!==b?c:{},"function"==typeof qa.onerror&&qa.onerror.apply(a,[{type:c.type!==b?c.type:null}]),c.fatal!==b&&c.fatal&&qa.disable()},la=function(){if(!_a||!ka())return!1;var a,b,c=qa.audioFormats;for(b in c)if(c.hasOwnProperty(b)&&("mp3"===b||"mp4"===b)&&(qa._wD(ta+": Using flash fallback for "+b+" format"),qa.html5[b]=!1,c[b]&&c[b].related))for(a=c[b].related.length-1;a>=0;a--)qa.html5[c[b].related[a]]=!1},this._setSandboxType=function(a){var c=qa.sandbox;c.type=a,c.description=c.types[c.types[a]!==b?a:"unknown"],"localWithFile"===c.type?(c.noRemote=!0,c.noLocal=!1,n("secNote",2)):"localWithNetwork"===c.type?(c.noRemote=!1,c.noLocal=!0):"localTrusted"===c.type&&(c.noRemote=!1,c.noLocal=!1)},this._externalInterfaceOK=function(a){if(qa.swfLoaded)return!1;var b;if(m("swf",!0),m("flashtojs",!0),qa.swfLoaded=!0,cb=!1,_a&&la(),!a||a.replace(/\+dev/i,"")!==qa.versionNumber.replace(/\+dev/i,""))return b=ta+': Fatal: JavaScript file build "'+qa.versionNumber+'" does not match Flash SWF build "'+a+'" at '+qa.url+". Ensure both are up-to-date.",setTimeout(function(){throw new Error(b)},0),!1;setTimeout(k,Wa?100:1)},H=function(a,c){function d(){var a,b=[],c=[],d=" + ";a="SoundManager "+qa.version+(!qa.html5Only&&qa.useHTML5Audio?qa.hasHTML5?" + HTML5 audio":", no HTML5 audio support":""),qa.html5Only?qa.html5PollingInterval&&b.push("html5PollingInterval ("+qa.html5PollingInterval+"ms)"):(qa.preferFlash&&b.push("preferFlash"),qa.useHighPerformance&&b.push("useHighPerformance"),qa.flashPollingInterval&&b.push("flashPollingInterval ("+qa.flashPollingInterval+"ms)"),qa.html5PollingInterval&&b.push("html5PollingInterval ("+qa.html5PollingInterval+"ms)"),qa.wmode&&b.push("wmode ("+qa.wmode+")"),qa.debugFlash&&b.push("debugFlash"),qa.useFlashBlock&&b.push("flashBlock")),b.length&&(c=c.concat([b.join(d)])),qa._wD(a+(c.length?d+c.join(", "):""),1),na()}function e(a,b){return''}if(Ba&&Ca)return!1;if(qa.html5Only)return y(),d(),qa.oMC=h(qa.movieID),k(),Ba=!0,Ca=!0,!1;var f,g,i,j,l,m,n,o,p=c||qa.url,q=qa.altURL||p,r=G(),s=Q(),t=null,u=ya.getElementsByTagName("html")[0];if(t=u&&u.dir&&u.dir.match(/rtl/i),a=a===b?qa.id:a,y(),qa.url=N(hb?p:q),c=qa.url,qa.wmode=!qa.wmode&&qa.useHighPerformance?"transparent":qa.wmode,null!==qa.wmode&&(wa.match(/msie 8/i)||!Wa&&!qa.useHighPerformance)&&navigator.platform.match(/win32|win64/i)&&(Pa.push(A.spcWmode),qa.wmode=null),f={name:a,id:a,src:c,quality:"high",allowScriptAccess:qa.allowScriptAccess,bgcolor:qa.bgColor,pluginspage:ib+"www.macromedia.com/go/getflashplayer",title:"JS/Flash audio component (SoundManager 2)",type:"application/x-shockwave-flash",wmode:qa.wmode,hasPriority:"true"},qa.debugFlash&&(f.FlashVars="debug=1"),qa.wmode||delete f.wmode,Wa)g=ya.createElement("div"),j=['',e("movie",c),e("AllowScriptAccess",qa.allowScriptAccess),e("quality",f.quality),qa.wmode?e("wmode",qa.wmode):"",e("bgcolor",qa.bgColor),e("hasPriority","true"),qa.debugFlash?e("FlashVars",f.FlashVars):"",""].join("");else{g=ya.createElement("embed");for(i in f)f.hasOwnProperty(i)&&g.setAttribute(i,f[i])}if(K(),s=Q(),r=G())if(qa.oMC=h(qa.movieID)||ya.createElement("div"),qa.oMC.id)o=qa.oMC.className,qa.oMC.className=(o?o+" ":R.swfDefault)+(s?" "+s:""),qa.oMC.appendChild(g),Wa&&(l=qa.oMC.appendChild(ya.createElement("div")),l.className=R.swfBox,l.innerHTML=j),Ca=!0;else{if(qa.oMC.id=qa.movieID,qa.oMC.className=R.swfDefault+" "+s,m=null,l=null,qa.useFlashBlock||(qa.useHighPerformance?m={position:"fixed",width:"8px",height:"8px",bottom:"0px",left:"0px",overflow:"hidden"}:(m={position:"absolute",width:"6px",height:"6px",top:"-9999px",left:"-9999px"},t&&(m.left=Math.abs(parseInt(m.left,10))+"px"))),Xa&&(qa.oMC.style.zIndex=1e4),!qa.debugFlash)for(n in m)m.hasOwnProperty(n)&&(qa.oMC.style[n]=m[n]);try{Wa||qa.oMC.appendChild(g),r.appendChild(qa.oMC),Wa&&(l=qa.oMC.appendChild(ya.createElement("div")),l.className=R.swfBox,l.innerHTML=j),Ca=!0}catch(a){throw new Error(O("domError")+" \n"+a.toString())}}return Ba=!0,d(),!0},B=function(){return qa.html5Only?(H(),!1):!sa&&(qa.url?(sa=qa.getMovie(qa.id),sa||(Ja?(Wa?qa.oMC.innerHTML=Ka:qa.oMC.appendChild(Ja),Ja=null,Ba=!0):H(qa.id,qa.url),sa=qa.getMovie(qa.id)),"function"==typeof qa.oninitmovie&&setTimeout(qa.oninitmovie,1),oa(),!0):(n("noURL"),!1))},v=function(){setTimeout(w,1e3)},x=function(){a.setTimeout(function(){V(ua+"useFlashBlock is false, 100% HTML5 mode is possible. Rebooting with preferFlash: false..."),qa.setup({preferFlash:!1}).reboot(),qa.didFlashBlock=!0,qa.beginDelayedInit()},1)},w=function(){var b,c=!1;return!!qa.url&&!La&&(La=!0,ha.remove(a,"load",v),ja&&cb&&!bb?(n("waitFocus"),!1):(Da||(b=qa.getMoviePercent())>0&&b<100&&(c=!0),void setTimeout(function(){if(b=qa.getMoviePercent(),c)return La=!1,qa._wD(O("waitSWF")),a.setTimeout(v,1),!1;Da||(qa._wD(ta+": No Flash response within expected time. Likely causes: "+(0===b?"SWF load failed, ":"")+"Flash blocked or JS-Flash security error."+(qa.debugFlash?" "+O("checkSWF"):""),2),!hb&&b&&(n("localFail",2),qa.debugFlash||n("tryDebug",2)),0===b&&qa._wD(O("swf404",qa.url),1),m("flashtojs",!1," (Check flash security or flash blockers)")),!Da&&db&&(null===b?qa.useFlashBlock||0===qa.flashLoadTimeout?(qa.useFlashBlock&&P(),n("waitForever")):!qa.useFlashBlock&&_?x():(n("waitForever"),t({type:"ontimeout",ignoreInit:!0,error:{type:"INIT_FLASHBLOCK"}})):0===qa.flashLoadTimeout?n("waitForever"):!qa.useFlashBlock&&_?x():M(!0))},qa.flashLoadTimeout)))},z=function(){function b(){ha.remove(a,"focus",z)}return bb||!cb?(b(),!0):(db=!0,bb=!0,n("gotFocus"),La=!1,v(),b(),!0)},oa=function(){Pa.length&&(qa._wD("SoundManager 2: "+Pa.join(" "),1),Pa=[])},na=function(){oa();var a,b=[];if(qa.useHTML5Audio&&qa.hasHTML5){for(a in qa.audioFormats)qa.audioFormats.hasOwnProperty(a)&&b.push(a+" = "+qa.html5[a]+(!qa.html5[a]&&Qa&&qa.flash[a]?" (using flash)":qa.preferFlash&&qa.flash[a]&&Qa?" (preferring flash)":qa.html5[a]?"":" ("+(qa.audioFormats[a].required?"required, ":"")+"and no flash support)"));qa._wD("SoundManager 2 HTML5 support: "+b.join(", "),1)}},o=function(b){if(Da)return!1;if(qa.html5Only)return n("sm2Loaded",1),Da=!0,u(),m("onload",!0),!0;var c,d=qa.useFlashBlock&&qa.flashLoadTimeout&&!qa.getMoviePercent(),e=!0;return d||(Da=!0),c={type:!ja&&Qa?"NO_FLASH":"INIT_TIMEOUT"},qa._wD("SoundManager 2 "+(Ea?"failed to load":"loaded")+" ("+(Ea?"Flash security/load error":"OK")+") "+String.fromCharCode(Ea?10006:10003),Ea?2:1),Ea||b?(qa.useFlashBlock&&qa.oMC&&(qa.oMC.className=Q()+" "+(null===qa.getMoviePercent()?R.swfTimedout:R.swfError)),t({type:"ontimeout",error:c,ignoreInit:!0}),m("onload",!1),I(c),e=!1):m("onload",!0),Ea||(qa.waitForWindowLoad&&!Fa?(n("waitOnload"),ha.add(a,"load",u)):(qa.waitForWindowLoad&&Fa&&n("docLoaded"),u())),e},j=function(){var a,c=qa.setupOptions;for(a in c)c.hasOwnProperty(a)&&(qa[a]===b?qa[a]=c[a]:qa[a]!==c[a]&&(qa.setupOptions[a]=qa[a]))},k=function(){function b(){ha.remove(a,"load",qa.beginDelayedInit)}if(Da)return n("didInit"),!1;if(qa.html5Only)return Da||(b(),qa.enabled=!0,o()),!0;B();try{sa._externalInterfaceTest(!1),J(!0,qa.flashPollingInterval||(qa.useHighPerformance?10:50)),qa.debugMode||sa._disableDebug(),qa.enabled=!0,m("jstoflash",!0),qa.html5Only||ha.add(a,"unload",i)}catch(a){return qa._wD("js/flash exception: "+a.toString()),m("jstoflash",!1),I({type:"JS_TO_FLASH_EXCEPTION",fatal:!0}),M(!0),o(),!1}return o(),b(),!0},D=function(){return!F&&(F=!0,j(),K(),function(){var a="sm2-usehtml5audio=",b="sm2-preferflash=",c=null,d=null,e=xa.toLowerCase();-1!==e.indexOf(a)&&(c="1"===e.charAt(e.indexOf(a)+a.length),ab&&console.log((c?"Enabling ":"Disabling ")+"useHTML5Audio via URL parameter"),qa.setup({useHTML5Audio:c})),-1!==e.indexOf(b)&&(d="1"===e.charAt(e.indexOf(b)+b.length),ab&&console.log((d?"Enabling ":"Disabling ")+"preferFlash via URL parameter"),qa.setup({preferFlash:d}))}(),!ja&&qa.hasHTML5&&(qa._wD("SoundManager 2: No Flash detected"+(qa.useHTML5Audio?". Trying HTML5-only mode.":", enabling HTML5."),1),qa.setup({useHTML5Audio:!0,preferFlash:!1})),ga(),!ja&&Qa&&(Pa.push(A.needFlash),qa.setup({flashLoadTimeout:1})),ya.removeEventListener&&ya.removeEventListener("DOMContentLoaded",D,!1),B(),!0)},fa=function(){return"complete"===ya.readyState&&(D(),ya.detachEvent("onreadystatechange",fa)),!0},E=function(){Fa=!0,D(),ha.remove(a,"load",E)},C=function(){$a&&(qa.setupOptions.useHTML5Audio&&!qa.setupOptions.preferFlash||Pa.push(A.mobileUA),qa.setupOptions.useHTML5Audio=!0,qa.setupOptions.preferFlash=!1,(Ua||Va&&!wa.match(/android\s2\.3/i))&&(Pa.push(A.globalHTML5),Ua&&(qa.ignoreFlash=!0),Sa=!0))},C(),ka(),ha.add(a,"focus",z),ha.add(a,"load",v),ha.add(a,"load",E),ya.addEventListener?ya.addEventListener("DOMContentLoaded",D,!1):ya.attachEvent?ya.attachEvent("onreadystatechange",fa):(m("onload",!1),I({type:"NO_DOM2_EVENTS",fatal:!0}))}if(!a||!a.document)throw new Error("SoundManager requires a browser with window and document objects.");var d=null;void 0!==a.SM2_DEFER&&SM2_DEFER||(d=new c),"object"==typeof module&&module&&"object"==typeof module.exports?(a.soundManager=d,module.exports.SoundManager=c,module.exports.soundManager=d):"function"==typeof define&&define.amd?define("SoundManager",[],function(){return{SoundManager:c,soundManager:d}}):(a.SoundManager=c,a.soundManager=d)}(window);var ngSoundManager=angular.module("angularSoundManager",[]).config(["$logProvider",function(a){a.debugEnabled(!1)}]);ngSoundManager.filter("humanTime",function(){return function(a){function b(a){return a<10?"0"+a.toString():a.toString()}var c=a/1e3/60<<0,d=Math.round(a/1e3%60);return b(c)+":"+b(d)}}),ngSoundManager.factory("angularPlayer",["$rootScope","$log",function(a,b){var c=null,d=!1,e=!1,f=[],g=!1,h=90,i=0,j=[];return{init:function(){"undefined"==typeof soundManager&&alert("Please include SoundManager2 Library!"),soundManager.setup({preferFlash:!1,debugMode:!1,useHTML5Audio:!0,onready:function(){},ontimeout:function(){alert("SM2 failed to start. Flash missing, blocked or security error?"),alert("The status is "+status.success+", the error type is "+status.error.type)},defaultOptions:{autoLoad:!1,autoPlay:!1,from:null,loops:1,multiShot:!1,multiShotEvents:!1,onid3:null,onload:null,onstop:null,onfailure:"nextTrack",onpause:null,onplay:null,onresume:null,position:null,pan:0,stream:!0,to:null,type:"audio/mp3",usePolicyFile:!1,volume:h,whileloading:function(){var b=this.bytesLoaded/this.bytesTotal*100;a.$broadcast("track:loaded",b)},whileplaying:function(){c=this.id,i=this.position/this.duration*100,a.$broadcast("track:progress",i),a.$broadcast("currentTrack:position",this.position),a.$broadcast("currentTrack:duration",this.duration)},onfinish:function(){soundManager._writeDebug(this.id+" finished playing"),angular.element(document.querySelector("[ng-app]")).injector().get("angularPlayer").nextTrack(),a.$broadcast("track:id",c)}}}),soundManager.onready(function(){b.debug("song manager ready!");var c=soundManager.ok();b.debug("is supported: "+c),a.$broadcast("angularPlayer:ready",!0)})},isInArray:function(a,b){for(var c=0;c-1){if(void 0===a.url)return b.debug("invalid soundcloud track url"),!1}else if(!0!==soundManager.canPlayURL(a.url))return b.debug("invalid song url"),!1},addTrack:function(a){return this.isTrackValid?(!1===this.isInArray(this.getPlaylist(),a.id)&&(soundManager.createSound({id:a.id,url:a.url}),this.addToPlaylist(a)),a.id):null},removeSong:function(b,d){b===c&&this.stop(),soundManager.destroySound(b),j.splice(d,1),a.$broadcast("player:playlist",j)},initPlayTrack:function(b,c){!0!==c&&(this.stop(),this.setCurrentTrack(b)),soundManager.play(b),a.$broadcast("track:id",b),g=!0,a.$broadcast("music:isPlaying",g)},play:function(){var a=null;if(null===this.getCurrentTrack()){if(0===soundManager.soundIDs.length)return void b.debug("playlist is empty!");a=soundManager.soundIDs[0],this.initPlayTrack(a)}else a=this.getCurrentTrack(),this.initPlayTrack(a,!0)},pause:function(){soundManager.pause(this.getCurrentTrack()),g=!1,a.$broadcast("music:isPlaying",g)},stop:function(){this.pause(),this.resetProgress(),a.$broadcast("track:progress",i),a.$broadcast("currentTrack:position",0),a.$broadcast("currentTrack:duration",0),soundManager.stopAll(),soundManager.unload(this.getCurrentTrack())},playTrack:function(a){this.initPlayTrack(a)},nextTrack:function(){if(null===this.getCurrentTrack())return b.debug("Please click on Play before this action"),null;var c=angular.copy(soundManager.soundIDs);!0===e&&(c=f);var h=this.getIndexByValue(c,this.getCurrentTrack()),i=+h+1,j=c[i];void 0!==j?this.playTrack(j):(!0===e&&!0===g&&(f=angular.copy(soundManager.soundIDs),f=f.sort(function(){return.5-Math.random()}),a.$broadcast("music:tempTrack",f)),!0===d?this.playTrack(c[0]):(g=!1,a.$broadcast("music:isPlaying",g)))},prevTrack:function(){if(null===this.getCurrentTrack())return b.debug("Please click on Play before this action"),null;var a=angular.copy(soundManager.soundIDs);!0===e&&(a=f);var c=this.getIndexByValue(a,this.getCurrentTrack()),d=+c-1,g=a[d];void 0!==g?this.playTrack(g):b.debug("no prev track found!")},mute:function(){!0===soundManager.muted?soundManager.unmute():soundManager.mute(),a.$broadcast("music:mute",soundManager.muted)},getMuteStatus:function(){return soundManager.muted},repeatToggle:function(){d=!0!==d,a.$broadcast("music:repeat",d)},getRepeatStatus:function(){return d},shuffleToggle:function(){!0===e?(e=!1,f=angular.copy(soundManager.soundIDs)):(e=!0,f=angular.copy(soundManager.soundIDs),f=f.sort(function(){return.5-Math.random()})),a.$broadcast("music:shuffle",e),a.$broadcast("music:tempTrack",f)},getShuffleStatus:function(){return e},playShuffle:function(){var c=null;if(e=!0,f=angular.copy(soundManager.soundIDs),f=f.sort(function(){return.5-Math.random()}),a.$broadcast("music:shuffle",e),a.$broadcast("music:tempTrack",f),0===f.length)return void b.debug("playlist is empty!");c=f[0],this.initPlayTrack(c)},getVolume:function(){return h},adjustVolume:function(b){var c=function(b){for(var c=0;c0&&(h-=10,c(h))},adjustVolumeSlider:function(b){!function(b){for(var c=0;c=0;f--)h["audio/"+e[c].related[f]]=h[c],qa.html5[e[c].related[f]]=h[c],qa.flash[e[c].related[f]]=h[c];return h.canPlayType=g?a:null,qa.html5=p(qa.html5,h),qa.html5.usingFlash=aa(),Qa=qa.html5.usingFlash,!0},A={notReady:"Unavailable - wait until onready() has fired.",notOK:"Audio support is not available.",domError:ta+"exception caught while appending SWF to DOM.",spcWmode:"Removing wmode, preventing known SWF loading issue(s)",swf404:ua+"Verify that %s is a valid path.",tryDebug:"Try "+ta+".debugFlash = true for more security details (output goes to SWF.)",checkSWF:"See SWF output for more debug info.",localFail:ua+"Non-HTTP page ("+ya.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:ua+"Special case: Waiting for SWF to load with window focus...",waitForever:ua+"Waiting indefinitely for Flash (will recover if unblocked)...",waitSWF:ua+"Waiting for 100% SWF load...",needFunction:ua+"Function object expected for %s",badID:'Sound ID "%s" should be a string, starting with a non-numeric character',currentObj:ua+"_debug(): Current sound objects",waitOnload:ua+"Waiting for window.onload()",docLoaded:ua+"Document already loaded",onload:ua+"initComplete(): calling soundManager.onload()",onloadOK:ta+".onload() complete",didInit:ua+"init(): Already called?",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",badRemove:ua+"Failed to remove Flash node.",shutdown:ta+".disable(): Shutting down",queue:ua+"Queueing %s handler",smError:"SMSound.load(): Exception: JS-Flash communication failed, or JS error.",fbTimeout:"No flash response, applying ."+R.swfTimedout+" CSS...",fbLoaded:"Flash loaded",fbHandler:ua+"flashBlockHandler()",manURL:"SMSound.load(): Using manually-assigned URL",onURL:ta+".load(): current URL already assigned.",badFV:ta+'.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",needFlash:ua+"Fatal error: Flash is needed to play some required formats, but is not available.",gotFocus:ua+"Got window focus.",policy:"Enabling usePolicyFile for data access",setup:ta+".setup(): allowed parameters: %s",setupError:ta+'.setup(): "%s" cannot be assigned with this method.',setupUndef:ta+'.setup(): Could not find option "%s"',setupLate:ta+".setup(): url, flashVersion and html5Test property changes will not take effect until reboot().",noURL:ua+"Flash URL required. Call soundManager.setup({url:...}) to get started.",sm2Loaded:"SoundManager 2: Ready. "+String.fromCharCode(10003),reset:ta+".reset(): Removing event callbacks",mobileUA:"Mobile UA detected, preferring HTML5 by default.",globalHTML5:"Using singleton HTML5 Audio() pattern for this device."},O=function(){var a,b,c,d,e;if(a=Ra.call(arguments),d=a.shift(),(e=A&&A[d]?A[d]:"")&&a&&a.length)for(b=0,c=a.length;b1&&a.stream&&(n("as2loop"),a.stream=!1),a},U=function(a,b){return a&&!a.usePolicyFile&&(a.onid3||a.usePeakData||a.useWaveformData||a.useEQData)&&(qa._wD((b||"")+O("policy")),a.usePolicyFile=!0),a},V=function(a){ab&&console.warn!==b?console.warn(a):qa._wD(a)},i=function(){return!1},L=function(a){var b;for(b in a)a.hasOwnProperty(b)&&"function"==typeof a[b]&&(a[b]=i);b=null},M=function(a){a===b&&(a=!1),(Ea||a)&&qa.disable(a)},N=function(a){var b;if(a)if(a.match(/\.swf(\?.*)?$/i)){if(a.substr(a.toLowerCase().lastIndexOf(".swf?")+4))return a}else a.lastIndexOf("/")!==a.length-1&&(a+="/");return b=(a&&-1!==a.lastIndexOf("/")?a.substr(0,a.lastIndexOf("/")+1):"./")+qa.movieURL,qa.noSWFCache&&(b+="?ts="+(new Date).getTime()),b},y=function(){8!==(l=parseInt(qa.flashVersion,10))&&9!==l&&(qa._wD(O("badFV",l,Ia)),qa.flashVersion=l=Ia);var a=qa.debugMode||qa.debugFlash?"_debug.swf":".swf";qa.useHTML5Audio&&!qa.html5Only&&qa.audioFormats.mp4.required&&l<9&&(qa._wD(O("needfl9")),qa.flashVersion=l=9),qa.version=qa.versionNumber+(qa.html5Only?" (HTML5-only mode)":9===l?" (AS3/Flash 9)":" (AS2/Flash 8)"),l>8?(qa.defaultOptions=p(qa.defaultOptions,qa.flash9Options),qa.features.buffering=!0,qa.defaultOptions=p(qa.defaultOptions,qa.movieStarOptions),qa.filePatterns.flash9=new RegExp("\\.(mp3|"+kb.join("|")+")(\\?.*)?$","i"),qa.features.movieStar=!0):qa.features.movieStar=!1,qa.filePattern=qa.filePatterns[8!==l?"flash9":"flash8"],qa.movieURL=(8===l?"soundmanager2.swf":"soundmanager2_flash9.swf").replace(".swf",a),qa.features.peakData=qa.features.waveformData=qa.features.eqData=l>8},J=function(a,b){if(!sa)return!1;sa._setPolling(a,b)},K=function(){if(qa.debugURLParam.test(xa)&&(qa.debugMode=!0),h(qa.debugID))return!1;var a,b,c,d,e;if(qa.debugMode&&!h(qa.debugID)&&(!ab||!qa.useConsole||!qa.consoleOnly)){a=ya.createElement("div"),a.id=qa.debugID+"-toggle",d={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},a.appendChild(ya.createTextNode("-")),a.onclick=S,a.title="Toggle SM2 debug console",wa.match(/msie 6/i)&&(a.style.position="absolute",a.style.cursor="hand");for(e in d)d.hasOwnProperty(e)&&(a.style[e]=d[e]);if(b=ya.createElement("div"),b.id=qa.debugID,b.style.display=qa.debugMode?"block":"none",qa.debugMode&&!h(a.id)){try{c=G(),c.appendChild(a)}catch(a){throw new Error(O("domError")+" \n"+a.toString())}c.appendChild(b)}}c=null},W=this.getSoundById,n=function(a,b){return a?qa._wD(O(a),b):""},S=function(){var a=h(qa.debugID),b=h(qa.debugID+"-toggle");if(!a)return!1;Aa?(b.innerHTML="+",a.style.display="none"):(b.innerHTML="-",a.style.display="block"),Aa=!Aa},m=function(c,d,e){if(a.sm2Debugger!==b)try{sm2Debugger.handleEvent(c,d,e)}catch(a){return!1}return!0},Q=function(){var a=[];return qa.debugMode&&a.push(R.sm2Debug),qa.debugFlash&&a.push(R.flashDebug),qa.useHighPerformance&&a.push(R.highPerf),a.join(" ")},P=function(){var a=O("fbHandler"),b=qa.getMoviePercent(),c=R,d={type:"FLASHBLOCK"};if(qa.html5Only)return!1;qa.ok()?(qa.didFlashBlock&&qa._wD(a+": Unblocked"),qa.oMC&&(qa.oMC.className=[Q(),c.swfDefault,c.swfLoaded+(qa.didFlashBlock?" "+c.swfUnblocked:"")].join(" "))):(Qa&&(qa.oMC.className=Q()+" "+c.swfDefault+" "+(null===b?c.swfTimedout:c.swfError),qa._wD(a+": "+O("fbTimeout")+(b?" ("+O("fbLoaded")+")":""))),qa.didFlashBlock=!0,t({type:"ontimeout",ignoreInit:!0,error:d}),I(d))},s=function(a,c,d){za[a]===b&&(za[a]=[]),za[a].push({method:c,scope:d||null,fired:!1})},t=function(a){if(a||(a={type:qa.ok()?"onready":"ontimeout"}),!Da&&a&&!a.ignoreInit)return!1;if("ontimeout"===a.type&&(qa.ok()||Ea&&!a.ignoreInit))return!1;var b,c,d={success:a&&a.ignoreInit?qa.ok():!Ea},e=a&&a.type?za[a.type]||[]:[],f=[],g=[d],h=Qa&&!qa.ok();for(a.error&&(g[0].error=a.error),b=0,c=e.length;b=0;a--)qa.sounds[qa.soundIDs[a]].isHTML5&&qa.sounds[qa.soundIDs[a]]._hasTimer&&qa.sounds[qa.soundIDs[a]]._onTimer()},I=function(c){c=c!==b?c:{},"function"==typeof qa.onerror&&qa.onerror.apply(a,[{type:c.type!==b?c.type:null}]),c.fatal!==b&&c.fatal&&qa.disable()},la=function(){if(!_a||!ka())return!1;var a,b,c=qa.audioFormats;for(b in c)if(c.hasOwnProperty(b)&&("mp3"===b||"mp4"===b)&&(qa._wD(ta+": Using flash fallback for "+b+" format"),qa.html5[b]=!1,c[b]&&c[b].related))for(a=c[b].related.length-1;a>=0;a--)qa.html5[c[b].related[a]]=!1},this._setSandboxType=function(a){var c=qa.sandbox;c.type=a,c.description=c.types[c.types[a]!==b?a:"unknown"],"localWithFile"===c.type?(c.noRemote=!0,c.noLocal=!1,n("secNote",2)):"localWithNetwork"===c.type?(c.noRemote=!1,c.noLocal=!0):"localTrusted"===c.type&&(c.noRemote=!1,c.noLocal=!1)},this._externalInterfaceOK=function(a){if(qa.swfLoaded)return!1;var b;if(m("swf",!0),m("flashtojs",!0),qa.swfLoaded=!0,cb=!1,_a&&la(),!a||a.replace(/\+dev/i,"")!==qa.versionNumber.replace(/\+dev/i,""))return b=ta+': Fatal: JavaScript file build "'+qa.versionNumber+'" does not match Flash SWF build "'+a+'" at '+qa.url+". Ensure both are up-to-date.",setTimeout(function(){throw new Error(b)},0),!1;setTimeout(k,Wa?100:1)},H=function(a,c){function d(){var a,b=[],c=[],d=" + ";a="SoundManager "+qa.version+(!qa.html5Only&&qa.useHTML5Audio?qa.hasHTML5?" + HTML5 audio":", no HTML5 audio support":""),qa.html5Only?qa.html5PollingInterval&&b.push("html5PollingInterval ("+qa.html5PollingInterval+"ms)"):(qa.preferFlash&&b.push("preferFlash"),qa.useHighPerformance&&b.push("useHighPerformance"),qa.flashPollingInterval&&b.push("flashPollingInterval ("+qa.flashPollingInterval+"ms)"),qa.html5PollingInterval&&b.push("html5PollingInterval ("+qa.html5PollingInterval+"ms)"),qa.wmode&&b.push("wmode ("+qa.wmode+")"),qa.debugFlash&&b.push("debugFlash"),qa.useFlashBlock&&b.push("flashBlock")),b.length&&(c=c.concat([b.join(d)])),qa._wD(a+(c.length?d+c.join(", "):""),1),na()}function e(a,b){return''}if(Ba&&Ca)return!1;if(qa.html5Only)return y(),d(),qa.oMC=h(qa.movieID),k(),Ba=!0,Ca=!0,!1;var f,g,i,j,l,m,n,o,p=c||qa.url,q=qa.altURL||p,r=G(),s=Q(),t=null,u=ya.getElementsByTagName("html")[0];if(t=u&&u.dir&&u.dir.match(/rtl/i),a=a===b?qa.id:a,y(),qa.url=N(hb?p:q),c=qa.url,qa.wmode=!qa.wmode&&qa.useHighPerformance?"transparent":qa.wmode,null!==qa.wmode&&(wa.match(/msie 8/i)||!Wa&&!qa.useHighPerformance)&&navigator.platform.match(/win32|win64/i)&&(Pa.push(A.spcWmode),qa.wmode=null),f={name:a,id:a,src:c,quality:"high",allowScriptAccess:qa.allowScriptAccess,bgcolor:qa.bgColor,pluginspage:ib+"www.macromedia.com/go/getflashplayer",title:"JS/Flash audio component (SoundManager 2)",type:"application/x-shockwave-flash",wmode:qa.wmode,hasPriority:"true"},qa.debugFlash&&(f.FlashVars="debug=1"),qa.wmode||delete f.wmode,Wa)g=ya.createElement("div"),j=['',e("movie",c),e("AllowScriptAccess",qa.allowScriptAccess),e("quality",f.quality),qa.wmode?e("wmode",qa.wmode):"",e("bgcolor",qa.bgColor),e("hasPriority","true"),qa.debugFlash?e("FlashVars",f.FlashVars):"",""].join("");else{g=ya.createElement("embed");for(i in f)f.hasOwnProperty(i)&&g.setAttribute(i,f[i])}if(K(),s=Q(),r=G())if(qa.oMC=h(qa.movieID)||ya.createElement("div"),qa.oMC.id)o=qa.oMC.className,qa.oMC.className=(o?o+" ":R.swfDefault)+(s?" "+s:""),qa.oMC.appendChild(g),Wa&&(l=qa.oMC.appendChild(ya.createElement("div")),l.className=R.swfBox,l.innerHTML=j),Ca=!0;else{if(qa.oMC.id=qa.movieID,qa.oMC.className=R.swfDefault+" "+s,m=null,l=null,qa.useFlashBlock||(qa.useHighPerformance?m={position:"fixed",width:"8px",height:"8px",bottom:"0px",left:"0px",overflow:"hidden"}:(m={position:"absolute",width:"6px",height:"6px",top:"-9999px",left:"-9999px"},t&&(m.left=Math.abs(parseInt(m.left,10))+"px"))),Xa&&(qa.oMC.style.zIndex=1e4),!qa.debugFlash)for(n in m)m.hasOwnProperty(n)&&(qa.oMC.style[n]=m[n]);try{Wa||qa.oMC.appendChild(g),r.appendChild(qa.oMC),Wa&&(l=qa.oMC.appendChild(ya.createElement("div")),l.className=R.swfBox,l.innerHTML=j),Ca=!0}catch(a){throw new Error(O("domError")+" \n"+a.toString())}}return Ba=!0,d(),!0},B=function(){return qa.html5Only?(H(),!1):!sa&&(qa.url?(sa=qa.getMovie(qa.id),sa||(Ja?(Wa?qa.oMC.innerHTML=Ka:qa.oMC.appendChild(Ja),Ja=null,Ba=!0):H(qa.id,qa.url),sa=qa.getMovie(qa.id)),"function"==typeof qa.oninitmovie&&setTimeout(qa.oninitmovie,1),oa(),!0):(n("noURL"),!1))},v=function(){setTimeout(w,1e3)},x=function(){a.setTimeout(function(){V(ua+"useFlashBlock is false, 100% HTML5 mode is possible. Rebooting with preferFlash: false..."),qa.setup({preferFlash:!1}).reboot(),qa.didFlashBlock=!0,qa.beginDelayedInit()},1)},w=function(){var b,c=!1;return!!qa.url&&!La&&(La=!0,ha.remove(a,"load",v),ja&&cb&&!bb?(n("waitFocus"),!1):(Da||(b=qa.getMoviePercent())>0&&b<100&&(c=!0),void setTimeout(function(){if(b=qa.getMoviePercent(),c)return La=!1,qa._wD(O("waitSWF")),a.setTimeout(v,1),!1;Da||(qa._wD(ta+": No Flash response within expected time. Likely causes: "+(0===b?"SWF load failed, ":"")+"Flash blocked or JS-Flash security error."+(qa.debugFlash?" "+O("checkSWF"):""),2),!hb&&b&&(n("localFail",2),qa.debugFlash||n("tryDebug",2)),0===b&&qa._wD(O("swf404",qa.url),1),m("flashtojs",!1," (Check flash security or flash blockers)")),!Da&&db&&(null===b?qa.useFlashBlock||0===qa.flashLoadTimeout?(qa.useFlashBlock&&P(),n("waitForever")):!qa.useFlashBlock&&_?x():(n("waitForever"),t({type:"ontimeout",ignoreInit:!0,error:{type:"INIT_FLASHBLOCK"}})):0===qa.flashLoadTimeout?n("waitForever"):!qa.useFlashBlock&&_?x():M(!0))},qa.flashLoadTimeout)))},z=function(){function b(){ha.remove(a,"focus",z)}return bb||!cb?(b(),!0):(db=!0,bb=!0,n("gotFocus"),La=!1,v(),b(),!0)},oa=function(){Pa.length&&(qa._wD("SoundManager 2: "+Pa.join(" "),1),Pa=[])},na=function(){oa();var a,b=[];if(qa.useHTML5Audio&&qa.hasHTML5){for(a in qa.audioFormats)qa.audioFormats.hasOwnProperty(a)&&b.push(a+" = "+qa.html5[a]+(!qa.html5[a]&&Qa&&qa.flash[a]?" (using flash)":qa.preferFlash&&qa.flash[a]&&Qa?" (preferring flash)":qa.html5[a]?"":" ("+(qa.audioFormats[a].required?"required, ":"")+"and no flash support)"));qa._wD("SoundManager 2 HTML5 support: "+b.join(", "),1)}},o=function(b){if(Da)return!1;if(qa.html5Only)return n("sm2Loaded",1),Da=!0,u(),m("onload",!0),!0;var c,d=qa.useFlashBlock&&qa.flashLoadTimeout&&!qa.getMoviePercent(),e=!0;return d||(Da=!0),c={type:!ja&&Qa?"NO_FLASH":"INIT_TIMEOUT"},qa._wD("SoundManager 2 "+(Ea?"failed to load":"loaded")+" ("+(Ea?"Flash security/load error":"OK")+") "+String.fromCharCode(Ea?10006:10003),Ea?2:1),Ea||b?(qa.useFlashBlock&&qa.oMC&&(qa.oMC.className=Q()+" "+(null===qa.getMoviePercent()?R.swfTimedout:R.swfError)),t({type:"ontimeout",error:c,ignoreInit:!0}),m("onload",!1),I(c),e=!1):m("onload",!0),Ea||(qa.waitForWindowLoad&&!Fa?(n("waitOnload"),ha.add(a,"load",u)):(qa.waitForWindowLoad&&Fa&&n("docLoaded"),u())),e},j=function(){var a,c=qa.setupOptions;for(a in c)c.hasOwnProperty(a)&&(qa[a]===b?qa[a]=c[a]:qa[a]!==c[a]&&(qa.setupOptions[a]=qa[a]))},k=function(){function b(){ha.remove(a,"load",qa.beginDelayedInit)}if(Da)return n("didInit"),!1;if(qa.html5Only)return Da||(b(),qa.enabled=!0,o()),!0;B();try{sa._externalInterfaceTest(!1),J(!0,qa.flashPollingInterval||(qa.useHighPerformance?10:50)),qa.debugMode||sa._disableDebug(),qa.enabled=!0,m("jstoflash",!0),qa.html5Only||ha.add(a,"unload",i)}catch(a){return qa._wD("js/flash exception: "+a.toString()),m("jstoflash",!1),I({type:"JS_TO_FLASH_EXCEPTION",fatal:!0}),M(!0),o(),!1}return o(),b(),!0},D=function(){return!F&&(F=!0,j(),K(),function(){var a="sm2-usehtml5audio=",b="sm2-preferflash=",c=null,d=null,e=xa.toLowerCase();-1!==e.indexOf(a)&&(c="1"===e.charAt(e.indexOf(a)+a.length),ab&&console.log((c?"Enabling ":"Disabling ")+"useHTML5Audio via URL parameter"),qa.setup({useHTML5Audio:c})),-1!==e.indexOf(b)&&(d="1"===e.charAt(e.indexOf(b)+b.length),ab&&console.log((d?"Enabling ":"Disabling ")+"preferFlash via URL parameter"),qa.setup({preferFlash:d}))}(),!ja&&qa.hasHTML5&&(qa._wD("SoundManager 2: No Flash detected"+(qa.useHTML5Audio?". Trying HTML5-only mode.":", enabling HTML5."),1),qa.setup({useHTML5Audio:!0,preferFlash:!1})),ga(),!ja&&Qa&&(Pa.push(A.needFlash),qa.setup({flashLoadTimeout:1})),ya.removeEventListener&&ya.removeEventListener("DOMContentLoaded",D,!1),B(),!0)},fa=function(){return"complete"===ya.readyState&&(D(),ya.detachEvent("onreadystatechange",fa)),!0},E=function(){Fa=!0,D(),ha.remove(a,"load",E)},C=function(){$a&&(qa.setupOptions.useHTML5Audio&&!qa.setupOptions.preferFlash||Pa.push(A.mobileUA),qa.setupOptions.useHTML5Audio=!0,qa.setupOptions.preferFlash=!1,(Ua||Va&&!wa.match(/android\s2\.3/i))&&(Pa.push(A.globalHTML5),Ua&&(qa.ignoreFlash=!0),Sa=!0))},C(),ka(),ha.add(a,"focus",z),ha.add(a,"load",v),ha.add(a,"load",E),ya.addEventListener?ya.addEventListener("DOMContentLoaded",D,!1):ya.attachEvent?ya.attachEvent("onreadystatechange",fa):(m("onload",!1),I({type:"NO_DOM2_EVENTS",fatal:!0}))}if(!a||!a.document)throw new Error("SoundManager requires a browser with window and document objects.");var d=null;void 0!==a.SM2_DEFER&&SM2_DEFER||(d=new c),"object"==typeof module&&module&&"object"==typeof module.exports?(a.soundManager=d,module.exports.SoundManager=c,module.exports.soundManager=d):"function"==typeof define&&define.amd?define("SoundManager",[],function(){return{SoundManager:c,soundManager:d}}):(a.SoundManager=c,a.soundManager=d)}(window);var ngSoundManager=angular.module("angularSoundManager",[]).config(["$logProvider",function(a){a.debugEnabled(!1)}]);ngSoundManager.filter("humanTime",function(){return function(a){function b(a){return a<10?"0"+a.toString():a.toString()}var c=a/1e3/60<<0,d=Math.round(a/1e3%60);return b(c)+":"+b(d)}}),ngSoundManager.factory("angularPlayer",["$rootScope","$log",function(a,b){var c=null,d=!1,e=!1,f=!1,g=[],h=!1,i=90,j=0,k=[];return{init:function(){"undefined"==typeof soundManager&&alert("Please include SoundManager2 Library!"),soundManager.setup({preferFlash:!1,debugMode:!1,useHTML5Audio:!0,onready:function(){},ontimeout:function(){alert("SM2 failed to start. Flash missing, blocked or security error?"),alert("The status is "+status.success+", the error type is "+status.error.type)},defaultOptions:{autoLoad:!1,autoPlay:!1,from:null,loops:1,multiShot:!1,multiShotEvents:!1,onid3:null,onload:null,onstop:null,onfailure:"nextTrack",onpause:null,onplay:null,onresume:null,position:null,pan:0,stream:!0,to:null,type:"audio/mp3",usePolicyFile:!1,volume:i,whileloading:function(){var b=this.bytesLoaded/this.bytesTotal*100;a.$broadcast("track:loaded",b)},whileplaying:function(){c=this.id,j=this.position/this.duration*100,a.$broadcast("track:progress",j),a.$broadcast("currentTrack:position",this.position),a.$broadcast("currentTrack:duration",this.duration)},onfinish:function(){soundManager._writeDebug(this.id+" finished playing"),angular.element(document.querySelector("[ng-app]")).injector().get("angularPlayer").nextTrack(),a.$broadcast("track:id",c)}}}),soundManager.onready(function(){b.debug("song manager ready!");var c=soundManager.ok();b.debug("is supported: "+c),a.$broadcast("angularPlayer:ready",!0)})},isInArray:function(a,b){for(var c=0;c-1){if(void 0===a.url)return b.debug("invalid soundcloud track url"),!1}else if(!0!==soundManager.canPlayURL(a.url))return b.debug("invalid song url"),!1},addTrack:function(a){return this.isTrackValid?(!1===this.isInArray(this.getPlaylist(),a.id)&&(soundManager.createSound({id:a.id,url:a.url}),this.addToPlaylist(a)),a.id):null},removeSong:function(b,d){b===c&&this.stop(),soundManager.destroySound(b),k.splice(d,1),a.$broadcast("player:playlist",k)},initPlayTrack:function(b,c){!0!==c&&(this.stop(),this.setCurrentTrack(b)),soundManager.play(b),a.$broadcast("track:id",b),h=!0,a.$broadcast("music:isPlaying",h)},play:function(){var a=null;if(null===this.getCurrentTrack()){if(0===soundManager.soundIDs.length)return void b.debug("playlist is empty!");a=soundManager.soundIDs[0],this.initPlayTrack(a)}else a=this.getCurrentTrack(),this.initPlayTrack(a,!0)},pause:function(){soundManager.pause(this.getCurrentTrack()),h=!1,a.$broadcast("music:isPlaying",h)},stop:function(){this.pause(),this.resetProgress(),a.$broadcast("track:progress",j),a.$broadcast("currentTrack:position",0),a.$broadcast("currentTrack:duration",0),soundManager.stopAll(),soundManager.unload(this.getCurrentTrack())},playTrack:function(a){this.initPlayTrack(a)},nextTrack:function(){if(null===this.getCurrentTrack())return b.debug("Please click on Play before this action"),null;var c=angular.copy(soundManager.soundIDs);!0===f&&(c=g);var i=this.getIndexByValue(c,this.getCurrentTrack()),j=+i+1,k=c[j];!0===e?this.playTrack(c[i]):void 0!==k?this.playTrack(k):(!0===f&&!0===h&&(g=angular.copy(soundManager.soundIDs),g=g.sort(function(){return.5-Math.random()}),a.$broadcast("music:tempTrack",g)),!0===d?this.playTrack(c[0]):(h=!1,a.$broadcast("music:isPlaying",h)))},prevTrack:function(){if(null===this.getCurrentTrack())return b.debug("Please click on Play before this action"),null;var a=angular.copy(soundManager.soundIDs);!0===f&&(a=g);var c=this.getIndexByValue(a,this.getCurrentTrack()),d=+c-1,e=a[d];void 0!==e?this.playTrack(e):b.debug("no prev track found!")},mute:function(){!0===soundManager.muted?soundManager.unmute():soundManager.mute(),a.$broadcast("music:mute",soundManager.muted)},getMuteStatus:function(){return soundManager.muted},repeatToggle:function(){!0===d?d=!1:(d=!0,e=!1,a.$broadcast("music:repeatTrack",e)),a.$broadcast("music:repeat",d)},getRepeatStatus:function(){return d},repeatTrackToggle:function(){!0===e?e=!1:(e=!0,d=!1,a.$broadcast("music:repeat",d)),a.$broadcast("music:repeatTrack",e)},getRepeatTrackStatus:function(){return e},shuffleToggle:function(){!0===f?(f=!1,g=angular.copy(soundManager.soundIDs)):(f=!0,g=angular.copy(soundManager.soundIDs),g=g.sort(function(){return.5-Math.random()})),a.$broadcast("music:shuffle",f),a.$broadcast("music:tempTrack",g)},getShuffleStatus:function(){return f},playShuffle:function(){var c=null;if(f=!0,g=angular.copy(soundManager.soundIDs),g=g.sort(function(){return.5-Math.random()}),a.$broadcast("music:shuffle",f),a.$broadcast("music:tempTrack",g),0===g.length)return void b.debug("playlist is empty!");c=g[0],this.initPlayTrack(c)},getVolume:function(){return i},adjustVolume:function(b){var c=function(b){for(var c=0;c0&&(i-=10,c(i))},adjustVolumeSlider:function(b){!function(b){for(var c=0;cSongs - - + + - - diff --git a/src/03-factory-angularPlayer.js b/src/03-factory-angularPlayer.js index 2ecf2d2..18c6857 100644 --- a/src/03-factory-angularPlayer.js +++ b/src/03-factory-angularPlayer.js @@ -3,6 +3,7 @@ ngSoundManager.factory('angularPlayer', ['$rootScope', '$log', var currentTrack = null, repeat = false, + repeatTrack = false, shuffle = false, tempTrack = [], autoPlay = true, @@ -272,7 +273,9 @@ ngSoundManager.factory('angularPlayer', ['$rootScope', '$log', var currentTrackKey = this.getIndexByValue(useTrack, this.getCurrentTrack()); var nextTrackKey = +currentTrackKey + 1; var nextTrack = useTrack[nextTrackKey]; - if(typeof nextTrack !== 'undefined') { + if(repeatTrack === true) { + this.playTrack(useTrack[currentTrackKey]); + } else if(typeof nextTrack !== 'undefined') { this.playTrack(nextTrack); } else { // generate shuffle track list @@ -330,12 +333,27 @@ ngSoundManager.factory('angularPlayer', ['$rootScope', '$log', repeat = false; } else { repeat = true; + repeatTrack = false; + $rootScope.$broadcast('music:repeatTrack', repeatTrack); } $rootScope.$broadcast('music:repeat', repeat); }, getRepeatStatus: function() { return repeat; }, + repeatTrackToggle: function() { + if(repeatTrack === true) { + repeatTrack = false; + } else { + repeatTrack = true; + repeat = false; + $rootScope.$broadcast('music:repeat', repeat); + } + $rootScope.$broadcast('music:repeatTrack', repeatTrack); + }, + getRepeatTrackStatus: function() { + return repeatTrack; + }, shuffleToggle: function() { if(shuffle === true) { shuffle = false; diff --git a/src/23-directive-repeatTrack.js b/src/23-directive-repeatTrack.js new file mode 100644 index 0000000..ac558a1 --- /dev/null +++ b/src/23-directive-repeatTrack.js @@ -0,0 +1,18 @@ +ngSoundManager.directive('repeatTrack', ['angularPlayer', function (angularPlayer) { + return { + restrict: "EA", + link: function (scope, element, attrs) { + + element.bind('click', function (event) { + angularPlayer.repeatTrackToggle(); + }); + + scope.repeatTrack = angularPlayer.getRepeatTrackStatus(); + scope.$on('music:repeatTrack', function (event, data) { + scope.$apply(function () { + scope.repeatTrack = data; + }); + }); + } + }; + }]); \ No newline at end of file