HTML教程
HTML5教程
HTML参考手册

HTML 音频/视频 DOM currentTime 属性

将时间位置设置为 5 秒:
myVid=document.getElementById("video1");
myVid.currentTime=5;

定义和用法

currentTime 属性设置或返回音频/视频播放的当前位置(以秒计)。
当设置该属性时,播放会跳跃到指定的位置。

浏览器支持

Internet Explorer Firefox Opera Google Chrome Safari
所有主流浏览器都支持 currentTime 属性。
注意:Internet Explorer 8 及之前的版本不支持该属性。

语法

设置 currentTime 属性:
audio|video.currentTime=" seconds"
audio|video.currentTime

属性值

描述
seconds 指示音频/视频播放的当前位置,以秒计。

技术细节

返回值: 数字值,表示秒
昵称: 邮箱:
Copyright © 2022 立地货 All Rights Reserved.
备案号:京ICP备14037608号-4