Content deleted Content added
No edit summary Tags: Reverted section blanking Visual edit Mobile edit Mobile web edit |
m Reverted 1 edit by 178.240.56.119 (talk) to last revision by 96.40.152.201 |
||
(3 intermediate revisions by 3 users not shown) | |||
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 ==
Line 88 ⟶ 122:
Google integrated this feature into Google Chrome in March 2011.<ref>{{Cite web | url=http://chrome.blogspot.com/2011/03/talking-to-your-computer-with-html5.html | title=Talking to your computer | access-date=January 28, 2012}}</ref> Letting its users search the web with their voice with code like:
<syntaxhighlight lang="html">
<script type="application/javascript">
function startSearch(event) {
event.target.form.submit();
}
</script>
<form action="http://www.google.com/search">
<input type="search" name="q" speech required onspeechchange="startSearch">
</form>
</syntaxhighlight>
=== Supporting browsers ===
|