<!DOCTYPE html>
<html>
<body>
<video id="myVideo" width="640" height="360" controls>
<source src="/i/video/shanghai.mp4" type="video/mp4">
<source src="/i/video/shanghai.ogg" type="video/ogg">
您的浏览器不支持 video 标签。
</video>
<p>单击按钮可获取视频的以秒为单位的第一个播放范围(部分)。</p>
<button onclick="myFunction()">试一试</button>
<p id="demo"></p>
<script>
function myFunction() {
var x = document.getElementById("myVideo");
document.getElementById("demo").innerHTML = "开始:" + x.played.start(0) + " 结束: " + x.played.end(0);
}
</script>
</body>
</html>