Javascript examples for DOM Event:oncanplay
Execute a JavaScript when an audio is ready to start playing:
<!DOCTYPE html> <html> <body> <audio controls oncanplay="myFunction()"> <source src="your.ogg" type="audio/ogg"> <source src="your.mp3" type="audio/mpeg"> Your browser does not support the audio element. </audio>//w ww .j a v a 2 s . c om <script> function myFunction() { console.log("Can start playing audio"); } </script> </body> </html>