-
Notifications
You must be signed in to change notification settings - Fork 412
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
[BUG] MediaElement Crash Android #2423
Comments
Hi @Pmr-precure! We have added the
needs reproduction
label to this issue, which indicates that we are unable to take further action until you provide a reproduction sample that we can use to reproduce + fix your bug. In accordance with the |
Only way i have been able to fix this issue is to add GC.SupressFinalize(this) in the dispose method of the MediaControlService. And then call dispose(true) from the onDestroy() method. No idea if this is the fix or not. Or simply just remove the mediaSession.Release() and Dispose since it seems like its already disposed from somewhere else. :) |
I am having a very similar issue. I was disposing of the media element myself as well to avoid memory leaks in IOS; however, on Android, I get this very same crash regardless of whether I dispose of it or not. When I leave the page where MediaElement lives, all seems fine, but if I call EDIT: 4.1.2 on .NET 9 doesn't have this issue. Something in 5.0.0 could be introducing this problem. |
Yes i can confirm the crash doesnt happen on 4.1.2. |
Can you test the sample app with current main branch. The media 3 PR was just merged a few hours ago. It should solve most issues. |
Is there an existing issue for this?
Did you read the "Reporting a bug" section on Contributing file?
Current Behavior
Hi,
I have a weird issue, I dispose my mediaelements manually because of other issues.
But now im starting to get this crash:
This is the dispose method of the MediaControlService.Android. It doesnt get called by the DisconnectHandler method, but seems to get randomly called. Since it seems to happen random i havnt been able to replicate. But it causes a lot of crashes in our app.
**
EDIT**
I finally managed to replicate the issue, and it seems to be because of the Garbage Collector.
Our App is using Bluetooth and doing a lot of data processing, so the GC is working hard.
And at somepoint the GC apparently "kills" the MediaSession which leads to this crash ( Eventhough the media service should have been disposed already) .
In this repo https://github.com/Pmr-precure/MauiTestProject/tree/Audio_And_Session_Dispose_Bug
i added a "MemoryFiller" so after starting the video by pressing "Click me", then go back to the homepage and start the memory filler. The crash will happen seconds later.
I think this issue could be the same? #2359
Expected Behavior
Not randomly crash.
Steps To Reproduce
Git clone
Run project
Press the button, and see it crash.
Link to public reproduction project repository
Git repo
Environment
Anything else?
No response
The text was updated successfully, but these errors were encountered: