html源码里面写current,HTML Video currentTime用法及代码示例

Video currentTime属性用于设置或返回视频播放的当前位置。 Video currentTime属性以秒的形式返回视频播放位置。设置此属性后,播放跳至指定位置。

用法:

返回currentTime属性:videoObject.currentTime

设置currentTime属性:videoObject.currentTime = seconds

属性值:

seconds:用于以秒为单位指定视频播放的位置。

以下示例程序旨在说明video currentTime属性:

例:将时间位置设置为50秒。

HTML | DOM Video currentTime Property

h1 {

color:green;

}

h2 {

font-family:Impact;

}

body {

text-align:center;

}

GeeksforGeeks

Video currentTime Property

width="360"

height="240"

controls>

type="video/mp4">

type="video/ogg">

For setting the current video playback position,

double click the "Change Position" button.

type="button">

Change Position

var v = document.getElementById("Test_Video");

function My_Video() {

v.currentTime = 50;

}

输出:

在单击按钮之前:

0ff73130caf8428ff1f73a9eb1924c92.png

单击按钮后:

f78bba72ccd456eb2138eb58c165b9b3.png

支持的浏览器:HTML | DOM Video currentTime属性在下面列出:

谷歌浏览器

IE浏览器

Firefox

Opera

苹果Safari

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值