emscripten-core / emscripten-core/emscripten
Work when AudioContext is not supported
- Dominant language
- C++
- Stars
- 27.6k
- Forks
- 3.6k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 105
Description
Many online games use emscripten to run in the browser, but most will crash if AudioContext is not supported.
This includes most Unity and SDL games.
These crashes are preventable if emscripten would have audio playback be a no-op when AudioContext is not supported (and still init). For programs/emscripten using AudioContext for compute, a shim/polyfill of either AudioContext or OfflineAudioContext would work.
Example rust shim: https://crates.io/crates/web-audio-api
Example node.js shim: https://github.com/ircam-ismm/node-web-audio-api
Example SDL reproduce error: `Could not initialize SDL2, No audio context available`
https://github.com/DustinBrett/daedalOS/issues/500
Example Unity reproduce error: `Web Audio API is not supported in this browser`
https://purejamgames.itch.io/artificer
The easiest way to test this is to use the Tor browser or in `about:config` set `dom.webaudio.enabled` to false.
This is NOT a crash you can expect every downstream Dev to manually fix.
Contributor guide
Assessment
This issue has not been assessed yet.