eshaz / wasm-audio-decoders

Browser and NodeJS Web Assembly audio decoder libraries that are highly optimized for size and performance.
399 stars 23 forks source link

[ogg-opus-decoder] compile error in Safari 16 #66

Closed canove closed 1 year ago

canove commented 1 year ago

Hello and thanks for this awesome lib!

ogg-opus-decoder works fine in Chrome and Firefox, but not in Safari. It throws a CompileError: WebAssembly.Module doesn't parse at byte 0

Is there anything I can do to get around this, or is it really a Safari limitation?

Thanks anyway!

image

eshaz commented 1 year ago

I'm not able to reproduce this on my side. Are you using some minifier that's doing something different for Safari?

Could you try playing an Opus file back on your test device through the demo page and let me know if that works?

canove commented 1 year ago

It's a React app that uses VITE to build.

Indeed, demo page works normally.

I will try to get more information, thanks!

canove commented 1 year ago

Just figured it out. My page was missing <meta charset="UTF-8" /> on index.html

I think it was messing up with your WASM string or something! Every other browser works great, just Safari broke!

Thanks anyway.

eshaz commented 1 year ago

Great find! That one probably wouldn't have occurred to me.

The WASM string uses simple-yenc to encode the binary, which is more efficient than base64. This would definitely cause issues if the browser's character set was doing something different than utf-8.

I'll add a note in the documentation about this.