设置 HTML5 音频位置 [英] Setting HTML5 audio position

查看:101
本文介绍了设置 HTML5 音频位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何跳转到 HTML5 Audio 元素中的特定时间偏移?

How to jump to certain time offsets in HTML5 Audio elements?

他们说你可以简单地设置他们的currentTime 属性(强调我的):

They say you can simply set their currentTime property (emphasis mine):

currentTime 属性必须在获取时返回当前播放位置,以秒表示.关于设置,如果媒体元素有一个当前的媒体控制器,那么它必须抛出一个INVALID_STATE_ERR 异常;否则,用户代理必须寻求新值(可能会引发异常).

The currentTime attribute must, on getting, return the current playback position, expressed in seconds. On setting, if the media element has a current media controller, then it must throw an INVALID_STATE_ERR exception; otherwise, the user agent must seek to the new value (which might raise an exception).

唉,它似乎不起作用(我需要在 Chrome 中使用它).

Alas, it doesn't seem to work (I need it in Chrome).

有类似的问题,但没有答案.

There are similar questions, although, no answers.

推荐答案

适用于 我的 chrome...

$('#audio').bind('canplay', function() {
  this.currentTime = 29; // jumps to 29th secs
});

这篇关于设置 HTML5 音频位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆