Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Check if a HTML5 video element is playing

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

like image 909
Mohsen Avatar asked Jan 15 '13 05:01

Mohsen


People also ask

Does HTML5 play video?

As of 2020, HTML5 video is the only widely supported video playback technology in modern browsers, with the Flash plugin being phased out.

What is the correct HTML5 element for playing video?

<video>: The Video Embed element. The <video> HTML element embeds a media player which supports video playback into the document.

How do I know if my video is playing jquery?

click(function() { var video = $("#myvideo"). get(0); video. play(); $(".


1 Answers

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.

like image 106
Vinay Avatar answered Oct 11 '22 12:10

Vinay