YAL-Haxe / openfl-bitfive

Alternative blitting-targeted HTML5 backend for OpenFL.
103 stars 19 forks source link

Suggestion: Using Web Audio API to manage all sounds / music #26

Open cauli opened 10 years ago

cauli commented 10 years ago

I've spent most of yesterday trying to understand the current state of audio on HTML5.

What I've found out:

On mobile, HTML5

But since iOS 6 there is what seems to be a better alternative (Android Chrome and Firefox also support it, not stock Browser it seems) that is Web Audio API.

Something to read: http://www.html5rocks.com/en/tutorials/webaudio/intro/

It is supported by all major browsers except IE and allows more control over sounds. That is a solution that really seems to work.

http://caniuse.com/audio-api

Here's a really good example example that I've tested on iPad and an Android MotoG and works really well

http://labs.dinahmoe.com/plink/

Cons (no practical experience whatsoever, from what I've read):

cauli commented 10 years ago

https://github.com/goldfire/howler.js

This looks pretty mature, and now includes an auto-unlock on iOS feature (see their issue #163)

YellowAfterlife commented 10 years ago

I know about Audio API, and that is on plans somewhere, but that will take a fair amount of effort to get right (need to account different browser behaviours, as long as regular Audio fallback), so is currently waiting.

If needed, you can use various external audio libraries with bitfive though. There's CreateJS Audio, which is one of the best out there. There's mentioned Howler, for which there are externs already ~ http://insweater.net/haxe-flavored-howler-js/ Basically anything can be used as long as you can find or write externs.

cauli commented 10 years ago

Savior! Thanks for your help, sorry to bother that much (: