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 |
|