Examples of using Html5-audio audio tags

Source: Internet
Author: User
Tags current time error code rewind

Example

The code is as follows Copy Code


<audio autoplay= "AutoPlay" controls= "Controls" >
<source src= "File.ogg"/>
<source src= "File.mp3"/>
<a href= "File.mp3" >download this file.</a>
</audio>


Audio.play (); play
Audio.pause (); pause
Audio.volume Volume (sound value can be taken between 0-1)

Audio.currenttime > 10; current time to 10 seconds (available to control forward rewind)

function Go () {//forward
Audio.currenttime + 10;
Audio.play ();
}
function back () {//Rewind
Audio.currenttime-= 10;
Audio.play ();;
}

CONTROLS://Show or hide user control interface
AutoPlay://Media is automatically played
Loop://Media loop playback
CurrentTime://start to play the time now spent
Duration://Media total time (read only)
Volume://0.0-1.0 Volume relative value
Muted://Is Mute
Autobuffer://At the beginning of the buffer loading, autoplay, ignore this property

Paused://Media is paused (read only)
Ended://media playback completed (read only)
Error:///error code returned (read only) when the media has been wrong
CURRENTSRC://Returns the media address as a string (read only)

Play ()://media playback
Pause ()://Media paused
Load ()://Reload Media

The current HTML5 audio label supports only 3 audio formats, as shown in the following table:

IE9

FireFox 5.0

Safari 5.5

Chrome 12

Opera 11.5

Mp3

X

X

Ogg

X

X

Wav

X

X


the properties of the audio label are:

Properties

value (can be omitted) p>

description

src

url

controls

controls

loop

loop

preload

preload

autoplay

autoplay

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.