HTML5 video tag, javascript to detect playing status?

前端 未结 1 845
予麋鹿
予麋鹿 2021-01-06 13:18

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条回答
  • 2021-01-06 13:38

    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."

    0 讨论(0)
提交回复
热议问题