In this page, we have discussed Description, Usage, Attributes, Example and Result, compatibility of HTML5 audio element.
HTML5 audio element embeds an audio in an HTML or XHTML web page.
HTML5 audio element supports ogg Vorbis, MP3 and WAV audio formats.
<audio src="example.ogg" autoplay></audio>
Using the autoplay attribute, you can play the audio automatically.
Both start and end tag are required.
Contains an src attribute or one or more source element, which may be followed by either text or embedded content or text content enclosed by markup.
Any element which can contain text or embedded content or any element which can contain text content enclosed by markup.
audio element supports global attributes (accesskey, class, contenteditable, contextmenu, dir, draggable, dropzone, hidden, id, lang, spellcheck, style. tabindex, title).
If specified, browser will start playing associated audio as soon as it can. It will not stop for when the page loading is finished. This is a boolean attribute (having true or false values, but even if the value is false behavior will not change).
If specified, the user will be allowed to control audio playback, including volume, seeking, and pause/resume playback by the browser.
if specified, the audio will automatically be played from the start after reaching the end. This is a boolean attribute.
Using this attribute, author can leave a hint to the browser about loading the associated audio file. Three different values can be used :
none : No preloading is done.
metadata : leaving a hint to preload metadata (information about the audio) only.
auto : leaving a hint to preload audio automatically.
The value of this attribute holds the location of the audio file.
An enumerated attribute used for media elements.
Is used to link multiple media elements together by the generation of a mediacontroller.
<!DOCTYPE HTML> <html lang="en"> <head> <meta charset=utf-8> <title>HTML5 audio example</title> </head> <body> <audio controls="controls" autoplay="autoplay"> <source src="example.mp3" type="audio/mpeg" /> Your browser does not support the audio element. </audio> </body> </html>
We have successfully tested the above example with following browser versions.
|Feature||Chrome||Firefox (Gecko)||Internet Explorer||Opera||Safari|
Solve these problems: