代码编辑器:
x
1
<p>该范例中,我们为 video 元素添加了 "seeked" 事件。 currentTime 属性返回当前的播放位置。</p>
2
3
<p>Move to a new position in the video.</p>
4
5
<video id="myVideo" width="320" height="176" controls>
6
<source src="/static/i/html/html_video_1.mp4" type="video/mp4">
7
<source src="/static/i/html/html_video_1.ogg" type="video/ogg">
8
您的浏览器不支持 HTML5 video 标签。
9
</video>
10
11
<p>寻址位置: <span id="demo"></span></p>
12
13
<script>
14
// 获取 id="myVideo" 的 video
15
var vid = document.getElementById("myVideo");
16
17
// 为video 添加 seeked 事件, 在寻址操作完成后执行函数
18
vid.addEventListener("seeked", myFunction);