HTML 音频/视频 DOM startDate 属性
获得视频的当前时间线偏移:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<button onclick="getTimeOffset()" type="button">获得视频的当前时间线偏移</button>
<br>
<video id="video1" controls="controls">
<source src="/examples/mov_bbb.mp4" type="video/mp4">
<source src="/examples/mov_bbb.ogg" type="video/ogg">
您的浏览器不支持 HTML5 video 标签。
</video>
<script>
myVid = document.getElementById("video1");
function getTimeOffset() {
alert(myVid.startDate);
}
</script>
<p>Video courtesy of <a href="http://www.bigbuckbunny.org/" target="_blank">Big Buck Bunny</a>.</p>
</body>
</html>
定义和用法
startDate 属性返回 Date 对象,表示音频/视频的当前时间线偏移。
startDate 属性用于获得经由因特网的精确的音频/视频流同步。
浏览器支持
![]()
![]()
![]()
![]()
![]()
所有主流浏览器都不支持 startDate 属性。
语法
audio|video.startDate
技术细节
| 返回值: | 一个 Date 对象,表示当前的时间线偏移。 |
|---|
HTML 音频/视频 DOM 参考手册