Skip to content
This repository has been archived by the owner on Mar 5, 2021. It is now read-only.

[feature] Allow the audio asset to host multiple formats (same as audio tag) #164

Open
Ikalou opened this issue Nov 1, 2016 · 0 comments

Comments

@Ikalou
Copy link
Contributor

Ikalou commented Nov 1, 2016

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:

plugins/default/sound/data/SoundAsset.ts
plugins/default/sound/editors/sound/index.jade
plugins/default/sound/editors/sound/index.ts
plugins/default/sound/editors/sound/index.styl
plugins/default/sound/runtime/sound.ts

Does that sound like the right approach to you? Or would you rather not do it this way?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant