(function(){function e(b,a){b._isUnbinded?f(b,a):setTimeout(function(){f(b,a)},200)}function f(b,a){if(b=b.$n())try{if("stop"===a)b.pause(),b.currentTime=0;else b[a]()}catch(c){zk.debugLog(c.message||c)}}var g=zul.med.Audio=zk.$extends(zul.Widget,{$define:{src:function(){this.rerender()},autoplay:function(b){var a=this.$n();a&&(a.autoplay=b)},preload:function(b){var a=this.$n();a&&void 0!==b&&(a.preload=b)},controls:function(b){var a=this.$n();a&&(a.controls=b)},loop:function(b){var a=this.$n();a&&
(a.loop=b)},muted:function(b){var a=this.$n();a&&(a.muted=b)}},play:function(){e(this,"play")},stop:function(){e(this,"stop")},pause:function(){e(this,"pause")},unbind_:function(){this._isUnbinded=!0;this.stop();this.$supers(g,"unbind_",arguments)},domAttrs_:function(b){var a=this.$supers("domAttrs_",arguments);this._autoplay&&(a+=" autoplay");void 0!==this._preload&&(a+=' preload="'+this._preload+'"');this._controls&&(a+=" controls");this._loop&&(a+=" loop");this._muted&&(a+=" muted");return a},
domContent_:function(){for(var b=this._src,a=b.length,c="",d=0;d<a;d++)c+='<source src="'+b[d]+'" type="'+this._MIMEtype(b[d])+'">';return c},_MIMEtype:function(b){var a=b.lastIndexOf("."),c="wav";-1!==a&&(b=b.substring(a+1).toLowerCase(),"mp3"===b?c="mpeg":"ogg"===b&&(c="ogg"));return"audio/"+c}})})();
