用Web Audio API替换HTML5音频 [英] Replace HTML5 audio with Web Audio API

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

问题描述

移动设备上的HTML5音频有很多限制,实际上我将它们称为错误.

HTML5 audio on mobile devices has many limitations and actually I would call them bugs.

我的应用实现了音频播放器之类的功能.

My app implementing something like audio player.

实际上,所有功能都适用于台式机,但是在移动版本中,我遇到了许多错误,并且必须针对不同的浏览器和操作系统执行许多不同的解决方法,以使其正常运行,但仍然很糟糕.

Actually all it works fine for desktop but in mobile version I encounter many bugs and have to do many workarounds different for different browsers and os to get it work, and still it sucks.

我还没有深入研究网络音频API,但它似乎是为稍有不同的任务而设计的.

I haven't dived into web audio api, but it seems to be designed for slightly different tasks.

所以我的问题是,如果只需要加载文件并播放它们(部分是sprites),以避免限制和错误,那么用Web Audio API替换HTML5音频是否有意义(并且有可能吗?) HTML5音频?

So my question is, is it make sense (and is it possible?) to replace HTML5 audio with Web Audio API, if I need just to load files and play them (partly, sprites) just to avoid limitations and bugs of HTML5 audio?

推荐答案

我认为您可能会发现,至少与使用<audio>元素看到的移动音频上的Web音频一样多的bug或边缘情况.另外,在移动平台上对Web Audio的支持也不是很好.如果是我,除非您有只能通过Web Audio API解决的特定用例,否则我会坚持使用<audio>.

I think you're probably going to find at least as many bugs or edge cases with Web Audio on mobile as you're seeing using the <audio> element. Plus, support for Web Audio on mobile platforms isn't great. If it were me, I'd be inclined to stick with <audio> unless you have a specific use-case that can only be addressed by the Web Audio API.

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

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