如何重复html5音频 [英] How to repeat html5 audio
本文介绍了如何重复html5音频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在回答之前,请仔细阅读(谢谢):
Please read fully before answering (thank you):
我想通过以下方式无缝平滑地重复曲目(例如10秒)给定次数(例如3次):
I am wanting to seamlessly repeat a track (say 10secs) a given number of times (say 3 times) smoothly by:
- 从给定的音频播放器中提取音频-不需要,从服务器加载.wav等很好
- 将音频串联n次(将音轨添加到其末尾)
- 在新播放器中播放结果
- Extracting the audio from a given audio player - not required, loaded a .wav from a server etc is fine
- Concatenating the audio n times (adding the track onto the end of itself)
- Playing the result in a new player
如何完成2个?一个例子很棒,但2是最令人困惑的.
How could 2 be done? An example would be great but 2 is the most puzzling.
注意:不能将原始播放器设置为重复播放等,因为在大多数浏览器中它都不流畅.
Note: Setting the original player to repeat itself etc is not an option as it's not smooth on most browsers.
推荐答案
loop属性是一个布尔属性.
The loop attribute is a boolean attribute.
当存在时,它指定音频将在每次结束时重新从头开始.
When present, it specifies that the audio will start over again, every time it is finished.
<!DOCTYPE html>
<html>
<body>
<audio controls loop>
<source src="horse.ogg" type="audio/ogg">
<source src="horse.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
<p><strong>Note:</strong> The audio tag is not supported in Internet Explorer 8 and earlier versions.</p>
</body>
</html>
https://www.w3schools.com/tags/tryit.asp ?filename = tryhtml5_audio_loop
这篇关于如何重复html5音频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文