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

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

问题描述

如何在 HTML5 Audio 元素中跳转到某些时间偏移?

他们说你可以简单地设置它们的 currentTime property a>(强调我的):


currentTime 返回当前的
播放位置,以秒表示。 设置时,如果媒体
元素具有当前的媒体控制器,则必须抛出
INVALID_STATE_ERR异常;否则,用户代理必须寻求
新值
(这可能会引发异常)。





虽然没有答案,但也有类似的问题。

$唉,它似乎并没有工作(我需要它在Chrome中)。 b $ b

解决方案

适用于我的Chrome 。 .. $ / $ $ $ $ $ $ $ $ $ $ $''$'$'$'$'$。$'$'$。 currentTime = 29; //跳到第29秒
});


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

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

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

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

There are similar questions, although, no answers.

解决方案

Works on my chrome...

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

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

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