HTMLMediaElement.currentTime
HTMLMediaElement.currentTime
属性会以秒为单位返回当前媒体元素的播放时间。设置这个属性会改变媒体元素当前播放位置。
备注: 该处原文:The HTMLMediaElement.currentTime
property gives the current playback time in seconds. Setting this value seeks the media to the new time.
语法
var cTime = video.currentTime;
video.currentTime = 35;
返回值
一个 double
双精度浮点数。
示例
var obj = document.createElement('video');
console.log(obj.currentTime);
规范
Specification |
---|
HTML Standard # dom-media-currenttime-dev |
浏览器兼容性
BCD tables only load in the browser
相关链接
- The interface defining it,
HTMLMediaElement
. HTMLMediaElement.fastSeek()
(en-US) for another method of setting the time