单击播放按钮时捕获事件

Catch the event when play button clicked

我正在使用 html 视频标签播放 website.i 中的视频 我想在用户单击 video.how 中的播放按钮时更新数据库 我可以捕捉到该事件吗? 有人可以帮忙 me.Advance 谢谢。

playing 视频第一次开始播放、暂停后或重新开始播放时触发事件。
假设您的视频元素的 ID 是 videoclip

var videoElement = document.getElementById('videoclip');
var videoController = videoElement.controller;
if (videoController) {
  videoController.addEventListener("playing", playHandler, false);
}
else {
  videoElement.addEventListener("playing", playHandler, false);
}

function playHandler(e) {
  // This handler will be called when the video starts playing, for the first time, after being paused or when restarting.
}

这篇 HTML5Rocks article 介绍了视频元素的事件。
w3 demo 现场演示动作。单击视频上的播放按钮,查看 playing 事件计数器如何每次递增。