17

How can I check status of a HTML5 vide element? I need to toggle play/pause the video element.

1
  • a reference video for trying in browser: video
    – Mohsen
    Commented Jan 15, 2013 at 5:31

1 Answer 1

32

There are few methods like below,

var myVideo=document.getElementById("video1"); 
if (myVideo.paused) {
  myVideo.play(); 
}
else { 
  myVideo.pause(); 
} 

have a look at complete working example here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.