-
-
Notifications
You must be signed in to change notification settings - Fork 483
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stopping the audio doesnt remove the notification #1082
Comments
Your code is not pertinent to the bug report because your bug report submits the "official example: example_playlist.dart" as the minimal reproduction project. Note that there are several examples demonstrating different features of audio_service. If you want to see an example that demonstrates how to close the notification, see |
Same and I've done some debugging. |
Got the same issue |
Facing the same issue here. But, this only happens when But, this results in an issue where user pauses for momentarily and the OS kills the whole app for memory which is not ideal. This is espeically bad in Chinese android skins. Those OEM skins are too much aggressive One cheeky way to get around this is while keeping both class MyAudioService extends BaseAudioHandler {
// ... other stuff
@override
Future<void> onTaskRemoved() async {
await myAudioPlayer.stop();
if(Platform.isAndroid) exit(0);
}
// ... other stuff
} Caution This can get the app rejected on AppStore. Usually, programmatic process termination is somehow against their policy. |
This behaviour can be controlled through controlled state transitions although I will also investigate @XuanTung4195 's note above as this may help it to work more robustly. |
facing the same issue. the behavior is inconsistent. sometimes the notification gets removed but sometimes it just stays. |
I have the same problem. I wrote my own audio service on media3. The notification deletion works. It's all about the removeSession method, maybe it's worth going this way too. If necessary, I can send a code with how to use my service.
|
Documented behaviour
stop() → Future
Stop playback and release resources.
I have used both for dismissing the notification
await audioHandler?.stop();
await BaseAudioHandler().stop();
Actual behaviour
The notification doesn't get dismissed
Minimal reproduction project
Official example: example_playlist.dart
Reproduction steps
Output of flutter doctor
The text was updated successfully, but these errors were encountered: