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);

规范

规范版本 状态 备注
HTML Living Standard
HTMLMediaElement.currentTime
Living Standard No change from HTML5
HTML5
HTMLMediaElement.currentTime
Recommendation Initial definition.

浏览器兼容性

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari
Basic support (Yes) (Yes) 3.5 (1.9.1) [1] 9 ? ?
Feature Android Edge Firefox Mobile (Gecko) Firefox OS (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support (Yes) (Yes) (Yes) (Yes) ? (Yes) (Yes)

相关链接

文档标签和贡献者

此页面的贡献者: newming
最后编辑者: newming,