HTML audio: Difference between revisions

Content deleted Content added
No edit summary
Tags: Reverted section blanking Visual edit Mobile edit Mobile web edit
Restored revision 1304676518 by 2001:910:1410:600:0:0:0:1 (talk): Unexplained removal
Tags: Twinkle Undo Mobile edit Mobile web edit Advanced mobile edit
Line 1:
{{Short description|HTML element}}
'''HTML audio''' is a subject of the HTML specification, incorporating audio, including speech to text, all in the browser.
 
== <audio> element ==
The {{tag|audio|o}} element represents a sound, or an audio stream. It is commonly used to play back a single audio file within a web page, showing a GUI widget with play/pause/volume controls.
 
The {{tag|audio|o}} element has these attributes: the music
* global attributes (accesskey; class; contenteditable; contextmenu; dir; draggable; dropzone; hidden; id; lang; spellcheck; style; tabindex; title; translate)
* autoplay = "autoplay" or "" (empty string) or empty<br />Instructs the User-Agent to automatically begin playback of the audio stream as soon as it can do so without stopping.
* preload = "none" or "metadata" or "auto" or "" (empty string) or empty<br />Represents a hint to the User-Agent about whether optimistic downloading of the audio stream itself or its metadata is considered worthwhile.
** "none": Hints to the User-Agent that the user is not expected to need the audio stream, or that minimizing unnecessary traffic is desirable.
** "metadata": Hints to the User-Agent that the user is not expected to need the audio stream, but that fetching its metadata (duration and so on) is desirable.
** "auto": Hints to the User-Agent that optimistically downloading the entire audio stream is considered desirable.
* controls = "controls" or "" (empty string) or empty<br />Instructs the User-Agent to expose a user interface for controlling playback of the audio stream.
* loop = "loop" or "" (empty string) or empty<br />Instructs the User-Agent to seek back to the start of the audio stream upon reaching the end.
* mediagroup = string<br />Instructs the User-Agent to link multiple videos and/or audio streams together.
* muted = "muted" or "" (empty string) or empty<br />Represents the default state of the audio stream, potentially overriding user preferences.
* src = non-empty [URL] potentially surrounded by spaces<br />The URL for the audio stream.
 
Example:
 
=== Supporting browsers ===
On PC:
* Google Chrome
* Internet Explorer 9
* Firefox 3.5
* Opera 10.5
* Safari 3.1
On mobile devices:
* Android Browser 2.3
*
* Google Chrome
* Internet Explorer Mobile 9
* Safari 4
* Firefox
* Opera Mobile 11
 
== Supported audio coding formats ==