164
rated 0 times
[
165]
[
1]
/ answers: 1 / hits: 38410
/ 13 Years ago, thu, november 24, 2011, 12:00:00
I made a javascript audio test. All the function works in Opera FF and Chrome, except audio.oncanplaythrough, and audio.onended (this 2function dont work on Chrome).
<!DOCTYPE html>
<html>
<body>
<script>
var audio = new Audio(http://www.w3schools.com/html5/song.ogg);
audio.oncanplaythrough = function(){
audio.play();
}
audio.onended = function(){
alert('ended');
}
</script>
<a href=# onclick=audio.play();>start</a><br/>
<a href=# onclick=audio.pause();>pause</a><br/>
<a href=# onclick=audio.volume=prompt('from 0 to 1',0.7)>volume</a><br/>
<a href=# onclick=audio.currentTime = 3;>jump</a><br/>
</body>
</html>
More From » html