Execute a JavaScript when a video has been paused: - Javascript DOM Event

Javascript examples for DOM Event:onpause

Description

Execute a JavaScript when a video has been paused:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<video width="320" height="240" controls onpause="myFunction()">
  <source src="your.mp4" type="video/mp4">
  <source src="your.ogg" type="video/ogg">
  Your browser does not support the video tag.
</video>/* w  ww. j a v a  2  s .co m*/

<script>
function myFunction() {
    console.log("The video was paused.");
}
</script>

</body>
</html>

Related Tutorials