bluefireteam / audioplayers

A Flutter package to play multiple audio files simultaneously (Android/iOS/web/Linux/Windows/macOS)
https://pub.dartlang.org/packages/audioplayers
MIT License
1.98k stars 843 forks source link

Tried to send a platform message to Flutter, but FlutterJNI was detached from native C++. Could not send. Channel: xyz.luan/audioplayers. Response ID: 0 #680

Open adem74 opened 3 years ago

adem74 commented 3 years ago

Hello, when I close my application music does not stop, I don't lose my connection with my phone. and I got this error. "Tried to send a platform message to Flutter, but FlutterJNI was detached from native C++. Could not send. Channel: xyz.luan/audioplayers. Response ID: 0" I tried what came my mind, but I could not get something

//1. @override didChangeAppLifecycleState(AppLifecycleState state) { if (AppLifecycleState.detached == state) { print("detached"); // it is working I can see this write on console. audio.player.dispose(); } } @override void initState() { super.initState(); WidgetsBinding.instance.addObserver(this);}

//2 I wrote on dispose() method but it also did not work.

//3 I wrapped my build function with "WillPopScope" but it didn't show me even print

//4 I wrote dispose method of my player page, but that too didn't show me print

//5 I added this code in initstate but it didn't show print audio.player.onPlayerError.listen((event) { print(event.toString()); print("balblalba"); }); //6 I changed code blocs with such. audioplayers-0.16.2>android>src>main>java>xyz>luan>audioplayers>AudioPlayersPlugin.java public void handleError(Player player, String message) { channel.invokeMethod("audio.onComplete", buildArguments(player.getPlayerId(), true)); // channel.invokeMethod("audio.onError", buildArguments(player.getPlayerId(), message)); }

zekkontro commented 3 years ago

I have the same problem, I need urgent help

adem74 commented 3 years ago

I found the solution. could you sent your wp number to ademunal741@gmail.com solution is basic but explain is hard

zekkontro commented 3 years ago

Telefon numaramı yolladım adem beycevap verirseniz sevinirim,çok teşekkürler

adem74 commented 3 years ago

hocam mail gelmedi 0506 385 52 74 bana mesaj atar mısınız

zekkontro commented 3 years ago

Mesaj Attım hocam

beerline commented 3 years ago

@adem74 it will be nice to share solution with community!

FelipeUbatuba commented 3 months ago

I have the same problem in 2024,I've been trying to find a solution for days

adem74 commented 3 months ago

it has been 4 years and still they did not solve, it is awkward. solution is as i remember adding dispose to native side of audioplayers. it took me a month to solve it.