fix: [web] NoSuchMethodError _isInited on iOS safari <16.4
Hi,
first of all, thanks for the package!
Description
On relatively old non-updated iPhone 11 (which I happen to have) soloud (3.2.4) fails to initialize on web in Safari prior to 16.4. Tested on iOS Safari 16.3.
SoLoud.instance.init fails with the following error:
NoSuchMethodError: method not found: '_isInited' (t2.Module_soloud._isInited is not a function. (In
12.Module_soloud._isInited), t2.Module_soloud._isInited' is undefined))
Steps To Reproduce
- build the following code to the web target
void main() async {
try {
await SoLoud.instance.init();
} catch (e) {
return runApp(MaterialApp(home: Scaffold(body: Text(e.toString()))));
}
return runApp(MaterialApp(home: Scaffold(body: Text("ok"))));
}
- serve the build/web and open in Safari on iOS
- init fails with NoSuchMethodError
Expected Behavior
SoLoud initializes, or a least provides a more descriptive error.
Additional Context
I've done some research and found that the problem occurs because safari on iOS does not support wasm SIMD before 16.4 (https://caniuse.com/wasm-simd). I've tried to recompile wasm module without -msimd128 -msse3 flags (with opus) and soloud initialized successfully (slowly, however). Not sure if this is a bug or the behavior should be just mentioned somewhere for someone who want to support older browsers on web.
I had the same problem with "flutter run -d chrome"
I am still trying to manage this issue, but @yeyuchen198, can you please check if you configured the web environment? Here the ref: https://docs.page/alnitak/flutter_soloud_docs/get_started/web_notes