Check if a HTML5 video element is playing

和自甴很熟 提交于 2019-12-12 07:57:54

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/14331670/check-if-a-html5-video-element-is-playing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!