Audio.js
1.33 KB
//>>built
define(["dojo/_base/declare","dojo/dom-construct","dojo/sniff","dijit/_Contained","dijit/_WidgetBase"],function(f,d,e,g,h){return f("dojox.mobile.Audio",[h,g],{source:null,width:"200px",height:"15px",_playable:!1,_tag:"audio",constructor:function(){this.source=[]},buildRendering:function(){this.domNode=this.srcNodeRef||d.create(this._tag)},_getEmbedRegExp:function(){return/audio\/mpeg/i},startup:function(){if(!this._started){this.inherited(arguments);var a,c,b;if(this.domNode.canPlayType)if(0<this.source.length)for(a=
0,c=this.source.length;a<c;a++)d.create("source",{src:this.source[a].src,type:this.source[a].type},this.domNode),this._playable=this._playable||!!this.domNode.canPlayType(this.source[a].type);else for(a=0,c=this.domNode.childNodes.length;a<c;a++)b=this.domNode.childNodes[a],1===b.nodeType&&"SOURCE"===b.nodeName&&(this.source.push({src:b.src,type:b.type}),this._playable=this._playable||!!this.domNode.canPlayType(b.type));e.add("mobile-embed-audio-video-support",!0);if(e("mobile-embed-audio-video-support")&&
!this._playable)for(a=0,c=this.source.length,b=this._getEmbedRegExp();a<c;a++)if(this.source[a].type.match(b)){a=d.create("embed",{src:this.source[0].src,type:this.source[0].type,width:this.width,height:this.height});this.domNode.parentNode.replaceChild(a,this.domNode);this.domNode=a;this._playable=!0;break}}}})});