Javascript examples for DOM Event:onplay
Execute a JavaScript when a video has started to play:
<!DOCTYPE html> <html> <body> <p>Press play.</p> <video controls onplay="myFunction()"> <source src="your.mp4" type="video/mp4"> <source src="your.ogg" type="video/ogg"> Your browser does not support HTML5 video. </video>/*from ww w .j ava 2 s.c o m*/ <script> function myFunction() { console.log("The video has started to play"); } </script> </body> </html>