define(["base/BaseCtrl","Marionette"],function(a,b){var c=b.Controller.extend({initialize:function(){a.applyMixin.call(this),_.bindAll(this,"clearTimeout","play","getPosition","getDuration","pause","stop","onDestroy","onSuccessCallback","onErrorCallback","onStatusCallback"),this.my_media=null,this.srcCons="/android_asset/www/"},clearTimeout:function(){clearTimeout(this.timeout),this.timeout=null},onSuccessCallback:function(){this.onStop&&this.onStop(),this.onFinish&&this.onFinish()},onErrorCallback:function(){this.onStop&&this.onStop()},onStatusCallback:function(a){a===Media.MEDIA_STARTING?this.onPlay&&this.onPlay():a===Media.MEDIA_STOPPED&&this.onStop&&this.onStop()},play:function(a,b,c,d,e){this.stop(),this.onPlay=c||this.onPlay,this.onStop=d||this.onStop,this.onFinish=e||this.onFinish,this.src=a||this.src,a&&(this.my_media&&this.my_media.release&&this.my_media.release(),this.my_media=new Media(this.srcCons+a,this.onSuccessCallback,this.onErrorCallback,this.onStatusCallback)),this.my_media&&this.my_media.play&&(this.timeout=setTimeout(_.bind(function(){this.isClosed?this.stop&&this.stop():this.my_media&&this.my_media.play&&this.my_media.play()},this),b||0))},getPosition:function(a,b){this.my_media.getCurrentPosition(_.bind(function(c){if(c>-1){var d=this.getDuration();if(this.my_media&&_.isNumber(c)&&_.isNumber(d))return void a(c,d);b()}},this),_.bind(function(){b&&b()},this))},getDuration:function(){return this.my_media&&this.my_media.getDuration?this.my_media.getDuration():null},pause:function(){this.my_media&&this.my_media.pause&&this.my_media.pause()},stop:function(){this.clearTimeout(),this.my_media&&this.my_media.stop&&this.my_media.stop()},onDestroy:function(){this.stop(),this.my_media&&this.my_media.release&&this.my_media.release(),this.my_media=null}});return _.extend(c.prototype,a),c});