为什么我的HTML5音频循环? [英] Why won't my HTML5 audio loop?

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

问题描述

该网站是安装在: http://ajf.me/stuff/eva 当时写作。该人士$ ​​C $ C是这样的:

The site is up at: http://ajf.me/stuff/eva at the time of writing. The source code is this:

<!DOCTYPE html>
<html style="height: 100%;">
<head>
<title>eva</title>
</head>
<body style="background-color: black; background-image: url('eva.png'); background-repeat: no-repeat; background-position: center center; height: 100%; margin: 0px; padding: 0px;">
<audio autoplay loop>
    <source src="eva.mp3" type="audio/mpeg" />
    <source src="eva.ogg" type="audio/ogg" />
    <source src="eva.wav" type="audio/wav" />
</audio>
</body>
</html>

在音频播放在Chrome,IE9和Firefox罚款,但不会循环后者。音频文件不能被畸形的,因为它是由无畏生产。是否有它为什么不循环?

The audio plays fine in Chrome, IE9, and Firefox, but does not loop in the latter. The audio file can't be malformed, as it was produced by Audacity. Is there any other explanation for why it doesn't loop?

推荐答案

您只需做到这一点。

&LT;音响自动播放循环&GT;

属性不需要别的东西。

修改

根据这一点,Firefox不喜欢循环。它表明一个JS的解决方案:

According to this, Firefox doesn't like loop. It suggests a js solution:

document.getElementById('audio_2').addEventListener('ended', function(){
    this.currentTime = 0;
}, false);

<一个href=\"http://forestmist.org/2010/04/html5-audio-loops/\">http://forestmist.org/2010/04/html5-audio-loops/

修改

HTML5音频回路现在与Firefox浏览器。在26.0版本确认(可能前面已)

HTML5 audio loop now works with firefox. Confirmed in version 26.0 (might have been earlier)

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

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