[BUG]: MissingPluginException on Flutter Web Release Build when calling openPlayer()
Flutter Sound Version :
-
FULL or LITE flavor ? FULL
-
Important: Result of the command :
flutter pub deps | grep flutter_sound
├── flutter_sound 9.28.0
│ ├── flutter_sound_platform_interface 9.28.0
│ ├── flutter_sound_web 9.28.0
│ │ ├── flutter_sound_platform_interface...
Severity
- Crash
- Result is not what expected
Platforms you faced the error
-
iOS N/D
-
Android N/D
-
Flutter Web Yes
-
Emulator N/D
-
Real device N/D
Describe the bug
When using flutter_sound on Flutter Web, the player works correctly in debug mode (e.g., flutter run -d chrome), but fails in release mode (e.g., when deployed to Firebase Hosting). Specifically, attempting to call openPlayer() results in a MissingPluginException, and audio playback does not start.
To Reproduce Steps to reproduce the behavior:
- Call openPlayer() and startPlayer(fromURI: ...) with a valid public audio file (e.g., .mp3 or .webm).
- Run the app in debug mode (flutter run -d chrome) — audio plays correctly.
- Build for release: flutter build web and host on Firebase or any static web server.
- Open the hosted app and attempt to play audio.
- Observe a MissingPluginException in the browser console:
MissingPluginException(No implementation found for method openPlayer on channel xyz.canardoux.flutter_sound_player)
Logs!!!!
Logs from Chrome devTools
main.dart.js:7116 Uncaught Error: MissingPluginException(No implementation found for method openPlayer on channel xyz.canardoux.flutter_sound_player)
at Object.e (main.dart.js:4128:19)
at main.dart.js:147696:15
at cri.a (main.dart.js:5583:63)
at cri.$2 (main.dart.js:73634:14)
at cpD.$1 (main.dart.js:73628:21)
at aZI.a3f (main.dart.js:75082:34)
at c9E.$0 (main.dart.js:74162:11)
at Object.a_t (main.dart.js:5746:40)
at av.xt (main.dart.js:74084:3)
at c9x.$0 (main.dart.js:74132:13)
@yagoquesadafloriach : I don't explain why you have a crash on a release product and not on debug. Could you try to upgrade to Taudio 10.3.2? I changed the init() on Flutter Sound on Web 10.1.0 some weeks ago and it's possible that this will fix your issue.
Upgrade to 10.x is very simple. Just 5 minutes! Just follow this guide
10.1.0 Web : the scripts are now loaded during open(). We will not anymore have problems with scripts not loaded in time.
Also happens on macOS, junk. Whatever the hell taudio is other than a direct copy of this project, 10.3.2 also has the same issue.
flutter: ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
flutter: │ #0 new FlutterSoundPlayer (package:taudio/public/fs/flutter_sound_player.dart:200:13)
flutter: │ #1 new LoopBack (package:caremap/feature/call/agent_call.dart:51:14)
flutter: ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
flutter: │ 🐛 ctor: FlutterSoundPlayer()
flutter: └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
flutter: STARTING LOOPBACK LoopBack
flutter: ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
flutter: │ #0 FlutterSoundPlayer._openPlayer (package:taudio/public/fs/flutter_sound_player.dart:727:13)
flutter: │ #1 FlutterSoundPlayer.openPlayer.<anonymous closure> (package:taudio/public/fs/flutter_sound_player.dart:721:11)
flutter: ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
flutter: │ 🐛 FS:---> _openPlayer
flutter: └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
flutter: ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
flutter: │ #0 FlutterSoundPlayer._openPlayer (package:taudio/public/fs/flutter_sound_player.dart:740:15)
flutter: │ #1 FlutterSoundPlayer.openPlayer.<anonymous closure> (package:taudio/public/fs/flutter_sound_player.dart:721:11)
flutter: ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
flutter: │ 🐛 Resetting flutter_sound Player Plugin
flutter: └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
[ERROR:flutter/runtime/dart_vm_initializer.cc(40)] Unhandled Exception: MissingPluginException(No implementation found for method resetPlugin on channel xyz.canardoux.flutter_sound_player)
#0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:368:7)
<asynchronous suspension>
#1 FlutterSoundPlayer._openPlayer (package:taudio/public/fs/flutter_sound_player.dart:742:7)
<asynchronous suspension>
#2 LoopBack.start (package:caremap/feature/call/agent_call.dart:71:5)
<asynchronous suspension>
getting the same issue after deploying the web app:
so guys i am using firebase to deploy the web app.
I just did the following:
- flutter clean
- firebase deploy
the flutter sound player now works fine, perhaps need to debug why the build web does not include the class plugins when deploying immediatly after debug sessions (witout running flutter clean)