HTML 5 Audio

Source: Internet
Author: User

In the HTML5 standard page, we are able to use the audio tag to complete our call and playback of the sound.

The following are the most commonly seen use of HTML5 three basic formats:

1. Minimal code

<audio src= "Song.ogg" controls= "Controls" ></audio>

2. Code with an incompatible reminder

<audio src= "Song.ogg" controls= "controls" >your browser does not support the audio tag.</audio>


3. Try to be compatible with the browser

<audio controls= "Controls" ><source src= "Song.ogg" type= "Audio/ogg" ><source src= "Song.mp3" type= " Audio/mpeg ">your Browser does not support the audio tag.</audio>

HTML5 Audio Format

Currently, the HTML5 audio tag supports three formats, each of which is WAV MP3 and ogg format.

And now the mainstream browser supports them such as the following:

IE 9 Firefox 3.5 Opera 10.5 Chrome 3.0 Safari 3.0
Ogg Vorbis
MP3
Wav

HTML5 audio tags are not supported under IE8 and IE8.

HTML 5 Audio Properties

    1. AutoPlay: The only selectable value is autoplay. When the AutoPlay attribute is present and the exact value is assigned, the audio will play itself actively
    2. CONTROLS: The only selectable value is controls. When the controls property is displayed and is accurately assigned, the audio playback controls will appear, including: Play, pause, position, volume, full screen toggle, subtitle (assuming available), audio track (assuming available).
    3. Loop: The only selectable value is loop. When the loop attribute is present and the exact value is assigned, the audio is looped back.
    4. Preload: The optional value is auto (load the entire audio when the page loads), meta (just load the metadata when the page loads) and none (when the page loads without audio) assuming that the preceding AutoPlay attribute is set, then preload will be ignored.
    5. SRC: Specifies the audio URL address. The ability to be a relative URL can also be an absolute URL, and of course, like the 2nd and 3rd examples, the source tag is used to specify the origin.

HTML 5 Audio

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.