-
-
Notifications
You must be signed in to change notification settings - Fork 306
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
MediaManager stops after locking screen #911
Comments
Adding some info, i'm streaming a audio file with .m3u8 extension, and i was looking into the logs and found the following error:
|
I found the same problem with MediaManager while using it in a Maui Android app. The player stops few minutes after the application is minimized or after the screen of the device is locked. |
If it helps, I managed to make it work by creating a foreground service that starts when I play a stream URL and stop when I pause or stop the stream. This service does nothing but the fact that it exists prevents the OS from killing the app. |
Yes, thanks; that's what I was going to do. In Windows the app runs fine when minimized or when the screen is locked. It seems that MediaManager uses different libraries for Windows. |
Android devices has battery optimization settings for the apps. Could you try to get this permission and see that's work for you. Also add this to manifest |
I disabled the battery optimization on the device for the application which I deployed to the device. Android is ignoring that option. Where do I add the code which you suggested? Do I add that to the constructor of the MainPage? Do I need to stop and destroy the service when the application ends? |
I added that part into my HomeViewModel. Just asked the permission and that's it. Some android devices have own restrictions, it could be that as well |
The suggested solution did not work. The application is still stopped if it loses focus. |
🐛 Bug Report
I'm working on a Radio App using .NET MAUI (this plugin is working quite fine in MAUI), but I'm facing an issue where the audio player stops after a few seconds when the phone is locked (I'm playing live audio). Has anyone else encountered this problem?
I've tested this on Android, but I haven't had the chance to test it on iOS yet.
Version: 1.x
Platform:
The text was updated successfully, but these errors were encountered: