/*1357554818,173217321*/

if (self.CavalryLogger) { CavalryLogger.start_js(["C6NER"]); }

__d("MercuryAudioPlayer",["Event","Arbiter","DOM","Flash","copyProperties"],function(a,b,c,d,e,f){var g=b('Event'),h=b('Arbiter'),i=b('DOM'),j=b('Flash'),k=b('copyProperties'),l=200;function m(){var v=i.create('audio'),w=false;try{if(!!v.canPlayType)if(v.canPlayType('video/mp4;').replace(/^no$/,''))w=true;}finally{return w;}}function n(){return j.isAvailable();}var o=function(){this.interval=null;this.arbiterInstance=null;this.audio=i.create('audio');g.listen(this.audio,'playing',function(){this.informAttachment('playing',this.audio.currentTime);this.interval=setInterval(function(){this.informAttachment('playing',this.audio.currentTime);}.bind(this),l);}.bind(this));g.listen(this.audio,'ended',function(){clearInterval(this.interval);this.informAttachment('finished');}.bind(this));};k(o.prototype,{setAudio:function(v,w){this.audio.setAttribute('src',v);this.arbiterInstance=w;},informAttachment:function(v,w){if(this.arbiterInstance)this.arbiterInstance.inform(v,w);},play:function(){this.audio.play();this.informAttachment('played');},resume:function(){this.audio.play();this.informAttachment('played');},pause:function(){this.audio.pause();clearInterval(this.interval);this.informAttachment('paused');},getType:function(){return 'html5';}});var p=function(){this.src=null;this.arbiterInstance=null;var v=i.create('div');document.body.appendChild(v);this.swf=j.embed('/swf/SoundStreamPlayer.swf',v,null,{});this.interval=null;h.subscribe('soundstream/finished',function(){clearInterval(this.interval);this.informAttachment('finished');}.bind(this));};k(p.prototype,{setAudio:function(v,w){this.src=v;this.arbiterInstance=w;},informAttachment:function(v,w){if(this.arbiterInstance)this.arbiterInstance.inform(v,w);},play:function(){this.swf.playSound(this.src);this.interval=setInterval(function(){var v=this.swf.getCurrentTime();this.informAttachment('playing',v);}.bind(this),l);this.informAttachment('played');},resume:function(){this.swf.resume();this.informAttachment('played');},pause:function(){clearInterval(this.interval);this.swf.pause();this.informAttachment('paused');},getType:function(){return 'flash';}});function q(){if(m()){return new o();}else if(n())return new p();return false;}var r=null,s=null,t=0;function u(v,w){this.src=v;this.arbiterInstance=w;this.audio_id=++t;r!==null||(r=q());if(!r)return false;}k(u.prototype,{getType:function(){if(!r){return false;}else return r.getType();},play:function(){if(s==this.audio_id){r.resume();}else{this.pause();s=this.audio_id;r.setAudio(this.src,this.arbiterInstance);r.play();}},pause:function(){r.pause();}});e.exports=u;});