define(["base/BaseCtrl","Marionette"],function(a,b){var c=b.Controller.extend({initialize:function(){a.applyMixin.call(this),this.my_media=document.createElement("audio"),this.timeout=null,_.bindAll(this,"clearTimeout","play","getPosition","pause","stop","seekTo","setVolume","onDestroy")},clearTimeout:function(){clearTimeout(this.timeout),this.timeout=null},play:function(a,b,c,d,e){this.stop(),this.onPlay=c||this.onPlay,this.onStop=d||this.onStop,this.onFinish=e||this.onFinish,_.isElement(this.my_media)&&a&&(this.my_media.src=a),_.isElement(this.my_media)&&this.my_media.play?this.timeout=setTimeout(_.bind(function(){this.isClosed?this.stop&&this.stop():(this.my_media.play(),this.onPlay&&this.onPlay())},this),b||0):this.onStop&&this.onStop()},getPosition:function(a,b){return _.isElement(this.my_media)?void a(this.my_media.currentTime,this.my_media.duration):void b()},pause:function(){_.isElement(this.my_media)&&this.my_media.pause&&this.my_media.pause()},stop:function(){this.clearTimeout(),_.isElement(this.my_media)&&this.my_media.pause&&this.my_media.pause()},seekTo:function(a){_.isElement(this.my_media)&&(this.my_media.currentTime=a)},setVolume:function(a){_.isElement(this.my_media)&&(this.my_media.volume=a)},onDestroy:function(){this.stop()}});return _.extend(c.prototype,a),c});