Hosting Solutions
mobile_logo Table of Contents


The <audio> element is used to play audio files and optionally offer stock control components. JavaScript is used to customize the features of this element and provides access to properties/methods/events used for custom audio player development and much more.

Code Example

<audio src="Scurvy_Pirate.mp3" controls autoplay> Fallback embed or object tags go here </audio> Alternately you can supply the audio tag with <source> tags in place of using the "src" attribute and specify alternative audio file formats for different environments. <audio controls autoplay> <source src="Scurvy_Pirate.mp3" type='audio/mpeg'> <source src="Scurvy_Pirate.mp4" type='audio/mp4'> <source src="Scurvy_Pirate.wav" type='audio/wav'> <source src="Scurvy_Pirate.ogg" type='audio/ogg'> Fallback embed or object tags go here </audio>


globals - the global attributes common to all elements possible values: see global attribute list src - path to the media resource possible values: "path/to/filename" crossorigin - specify how the element handles crossorigin requests possible values: "anonymous", "use-credentials" preload - Hints how much buffering the media resource will likely need possible values: "none", "metadata", "auto" none - video not expected to render, spend no resources fetching data metadata - video not expected to render, but fetch the metadata for it auto - optimized downloading set for entire video resource autoplay - specify if the audio should auto play when the audio file is buffered enough possible values: value not required mediagroup - group media elements together possible values: MediaController name loop - specify if the audio should play again when it ends possible values: value not required muted - specify if the audio should be muted by default possible values: value not required controls - provide browser dependent stock audio player controls possible values: value not required

Audio Programming Training Course

Learn to program the audio object in JavaScript. The audio element is seen as an object in JavaScript that is able to access all of the multimedia properties and methods in JavaScript for controlling the element and its features.


TIP: The stock control components look different in all browser software. You can overcome that by customizing the controls and functionality so that it looks and operates virtually the same in all browser software.

About audio file formats: Check to make sure the audio file type(.mp3, .ogg, etc...) you are using plays in all popular browsers. You may need to use multiple file formats to satisfy all of the different browser software like Firefox, Chrome, IE, Safari, Etc....



aabbraddressareaasidearticleaudiobbasebdobdiblockquotebodybrbuttoncanvascaptioncitecodecolcolgroupdatadatalistdddeldetailsdfndialogdivdldtemembedfieldsetfigcaptionfigurefooterformh1 h2 h3 h4 h5 h6headheaderhrhtmliiframeimginputinskbdkeygenlabellegendlilinkmainmapmarkmetameternavnoscriptobjectoloptgroupoptionoutputpparampreprogressqrb rp rt rtc rubyssampscriptsectionselectsmallsourcespanstrongstylesub supsummarytabletbodytdtemplatetextareatfootththeadtimetitletrtrackuulvarvideowbr