视频事件 HTML5 jQuery

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13557306/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 12:44:33  来源:igfitidea点击:

Video events HTML5 jQuery

jqueryhtmljquery-mobile

提问by jamcoder

Is it possible to get the video events using HTML5 and jQuery?

是否可以使用 HTML5 和 jQuery 获取视频事件?

Events like:

事件如:

  1. When the user start the video, get that event.
  2. When the user paused/stopped the video, get the time of the played video and remaining time to be played.
  3. When the video is played or not or not played because of error.
  1. 当用户开始播放视频时,获取该事件。
  2. 当用户暂停/停止视频时,获取播放视频的时间和剩余时间。
  3. 当视频因错误播放或未播放或未播放时。

回答by macool

You can find the events here: http://www.w3.org/2010/05/video/mediaevents.html

您可以在此处找到活动:http: //www.w3.org/2010/05/video/mediaevents.html

Example:

例子:

$("video").on("pause", function (e) {
  console.debug("Video paused. Current time of videoplay: " + e.target.currentTime );
});