无缝循环音频 html5 [英] gapless looping audio html5

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

问题描述

有人知道如何实现音频标签的无缝循环吗?我在想一些基于 javascript 的东西..

anyone have any idea how to accomplish gapless looping for the audio tag? I'm thinking something javascript based..

我有一个循环说 1 小节,我希望它循环并保持节奏.所以我需要循环平滑/无间隙.当我简单地将loop"设置为 true 时,它​​会滞后并且不会保持节奏.

I have a loop say 1 measure and I want it to loop and stay in tempo. So I need the loop to be smooth/gapless. When i simply set "loop" to true it will lag and does not stay in tempo.

推荐答案

不幸的是,这是 HTML5 元素的弱点之一.无法保证音频会在您想要或没有延迟的情况下播放.

Unfortunately this is one of the weaknesses of the HTML5 element. There is no guarantee that audio will play when you want it to or without delay.

有两个选项值得研究:

  1. SoundManager2 - 一个很棒的库,在这里可能会有所帮助在这种情况下,它将使用 Flash 播放音频;

  1. SoundManager2 - a great library that would probably be helpful here, though it'll use Flash to play the audio in this case;

Web Audio API 在 Chrome 中或 Audio Data API 在 Firefox 中 - 两者都是非常新的,还没有真正准备好迎接黄金时段,但允许您执行诸如预定音频播放、循环播放等操作.

Web Audio API in Chrome or the Audio Data API in Firefox - both are really new, and not really ready for prime time yet, but allow you to do things like scheduled audio playback, looping and a whole lot more.

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

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