Javascript examples for DOM Event:onplay
Execute a JavaScript when an audio has started to play:
<!DOCTYPE html> <html> <body> <audio controls onplay="myFunction()"> <source src="your.ogg" type="audio/ogg"> <source src="your.mp3" type="audio/mpeg"> Your browser does not support the audio element. </audio>/*from w w w .ja v a 2 s . c o m*/ <script> function myFunction() { console.log("The audio started to play"); } </script> </body> </html>