-
Notifications
You must be signed in to change notification settings - Fork 6
检查页面中视频是否处于播放状态 #52
Copy link
Copy link
Closed
Labels
Description
需求描述
自己写代码需要实现视频的播放、暂停功能,要实现暂停功能,就需要检查视频当前是否处于播放状态。
方案调研
调研过程
Google:js check if video playing,第一个结果就是 Stack Overflow 的,亲测靠谱!
入选方案
以列表形式记录入选的方案。
应用过程
关键的就是下面代码中 if 语句的判断条件:
var video = document.querySelector('video');
if (video.currentTime > 0 && !video.paused && !video.ended && video.readyState > 2) {
video.pause();
}要点总结
无。
Reactions are currently unavailable