Javascript examples for DOM HTML Element:Video
The ended property returns whether the play of the video has ended.
This property is read-only.
A Boolean, returns true if the playback has ended, otherwise it returns false
The following code shows how to check if the video has ended:
<!DOCTYPE html> <html> <body> <video id="myVideo" width="320" height="240" controls> <source src="your.mp4" type="video/mp4"> <source src="your.ogg" type="video/ogg"> Your browser does not support the video tag. </video>/*from w w w.j a v a 2 s . co m*/ <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() { var x = document.getElementById("myVideo").ended; document.getElementById("demo").innerHTML = x; } </script> </body> </html>