HTML5 video tag, javascript to detect playing status?

浪尽此生 提交于 2019-12-30 07:11:22

问题


Can you use javascript to detect if the video is playing? paused? or stopped?

I know VLC under browsers can do this, but don't know how to do it without VLC?


回答1:


You can query the media object to get the playback state:

http://www.w3.org/TR/2011/WD-html5-20110113/video.html#playing-the-media-resource

"A media element is said to be potentially playing when its paused attribute is false, the element has not ended playback, playback has not stopped due to errors, the element either has no current media controller or has a current media controller but is not blocked on its media controller, and the element is not a blocked media element."



来源:https://stackoverflow.com/questions/6647168/html5-video-tag-javascript-to-detect-playing-status

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