HTML5视频能否在ontimeupdate事件中触发jQuery函数?

3

我可以在HTML5视频标签的ontimeupdate运行时触发JavaScript函数(我相信这会在视频播放时每250毫秒运行一次)。以下是代码片段:

<video src="men-2.mp4"  ontimeupdate="createThumbs()" width="640" height="480" controls="controls" id="myVideo">

function createThumbs(){
    //Stuff is happening here...
}

我遇到的问题是我无法弄清楚如何在这个事件上触发jQuery脚本。据我所知,jQuery没有ontimeupdate事件。有什么想法吗?

1个回答

3
$("#myVideo").bind('timeupdate', createThumbs);

太棒了,谢谢!我不知道timeupdate事件类型会起作用。 - gravyfries
更新后的代码将是 $('#myVideo').on('timeupdate', createThumbs); - Mr Rogers

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接