Audio is a bit of a mess on the web: different browsers on different platforms support different formats (mp3, ogg, aac...).
Right now, if you care about compatibility, you have to use one asset for each audio format you care about, download all of them on when the game starts (because that's how SP works), and then use feature detection with the DOM (not great) to play the right one.
I was thinking maybe the audio asset could host a variable number of formats (instead of one) and automatically pick and load the first one that's adequate for you. Instead of having a Buffer, it could have an array of {id, buffer, mimeType}. It would need to keep its own nextId and increment it.
At first glance, the scope of files to edit would be:
Audio is a bit of a mess on the web: different browsers on different platforms support different formats (mp3, ogg, aac...).
Right now, if you care about compatibility, you have to use one asset for each audio format you care about, download all of them on when the game starts (because that's how SP works), and then use feature detection with the DOM (not great) to play the right one.
I was thinking maybe the audio asset could host a variable number of formats (instead of one) and automatically pick and load the first one that's adequate for you. Instead of having a
Buffer
, it could have an array of{id, buffer, mimeType}
. It would need to keep its ownnextId
and increment it.At first glance, the scope of files to edit would be:
Does that sound like the right approach to you? Or would you rather not do it this way?