If you find this helpful, please click the Google Button to the left, if it is white, to make it turn blue or red. Thank you! (It also helps find this page again more easily.) |
The <audio> Tag in HTML 5
<audio> Tag Syntax
Rules for coding HTML audio
elements
<audio> Tag Attributes
Attributes of the <audio> tag
global attributes | In addition to the personal attributes of the <audio> tag below, any of the common HTML attributes can also be coded |
src | a URI reference that resolves to the URL of the audio resource Use percent escape codes as explained in the URL Encoding Tutorial for any special characters in the URI reference. If the value of the
If the protocol scheme, username, host name/IP address and port number are omitted the default is the current host - the same server as the base of the current document. If the path starts with a slash |
autoplay="autoplay" | |
controls="controls" | |
loop="loop" | |
preload="none" preload="metadata" preload="auto" |
HTML Media Events
oncanplay | |
oncanplaythrough | |
onemptied | |
onended | |
onerror | |
onloadeddata | |
onloadedmetadata | |
onloadstart | |
onpause | |
onplaying | |
onprogress | |
onratechange | |
onreadystatechange | |
onseeked | |
onseeking | |
onstalled | |
onsuspend | |
ontimeupdate | |
onvolumechange | |
onwaiting |
<audio> Tag Examples
Examples of the audio
tag in HTML 5
<form> <input type="button" value="‖" onclick=" var audio = document.getElementsByTagName('audio')[0]; if (audio.paused) audio.play(); else audio.pause(); return false; "/> </form>
Changes in HTML 5 - <audio> Tag
What's new in HTML 5
The <audio> tag is one of the new elements in HTML 5.
Differences between HTML 5 and earlier versions of HTML
The <audio> tag did not exist in older versions of HTML.
The 2000-2010 Recommendations from the W3C HTML Working Group defined the HTML namespace for the names of all HTML element types, which now includes the audio element name. In older (pre-2000) versions of HTML, element type names were not associated with a namespace.