-
Notifications
You must be signed in to change notification settings - Fork 397
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 Android crashes when OnFullscreenButtonClick #2044
Comments
There is a PR that came out last night that will add support for full screen event handling. #2041 |
I tested against current main repo for MediaElement and toolkit. Could not reproduce issue. Will keep this open till #2041 is merged. |
Can you try the latest version? 4.1.0 Came out last week. |
After updating to MediaElement Version 4.1.0, I can confirm the error
has stopped occurring. However, I have encountered a new issue introduced in 4.1.0:
I noticed that your team closed issue #2163 with a similar stack trace. Therefore, I will reopen the bug and try to provide steps to reproduce the issue. |
Can u test against this PR: #2076 and check and see if it fixes your issue. Based on what you have posted without testing it is the service crashing. That issue has been addressed in current PR listed above. That is waiting on review. If I can have you check that bug and verify it is fixed that would be helpful. |
@vikher Would you please open a new Bug Report Issue for this? We'll need you to provide us a reproduction sample to help us narrow down the problem and solve it.
@ne0rrmatrix PR #2076 does not solve it because it does not remove The Let's leverage @vikher's reproduction sample to help us understand when + why Android is passing in a Here's what the Android docs say about https://developer.android.com/develop/background-work/services
|
You get a null intent when you do not have permission to post notifications. It can be revoked or never authorized. This code addresses that issue. async Task CheckAndRequestForegroundPermission(CancellationToken cancellationToken = default)
{
var status = await Permissions.CheckStatusAsync<AndroidMediaPermissions>().WaitAsync(cancellationToken);
if (status is PermissionStatus.Granted)
{
StartConnection();
return;
}
status = await Permissions.RequestAsync<AndroidMediaPermissions>().WaitAsync(cancellationToken).ConfigureAwait(false);
if (status is PermissionStatus.Granted)
{
StartConnection();
}
} That is the only place that service can be started now. It does get called in more than one place. But it will always check to see if it has authorization first now. So no null intent. Only way that could happen is if notification permission were revoked while it was playing video. I believe that would close the notification too. |
The key part we've overlooked is that the Android Operating System can start the
Let's pause the discussion since it is unrelated to this Issue and continue the discussion once @vikher has opened a new Bug Report Issue. |
Is there an existing issue for this?
Did you read the "Reporting a bug" section on Contributing file?
Current Behavior
The Android app crashes when the fullscreen button is clicked.
Expected Behavior
The app should not crash when the fullscreen button is clicked.
Steps To Reproduce
Use MediaElement version 3.1.0.
Click the fullscreen button mainly on a Galaxy S23 Ultra, Galaxy S22 Ultra, or Pixel 8 Pro.
Link to public reproduction project repository
https://github.com/vikher/testmedia
Environment
Anything else?
Error Details:
Error: System.ObjectDisposedException
Message: ObjectDisposed_Generic ObjectDisposed_ObjectName_Name, CommunityToolkit.Maui.Core.Views.MauiMediaElement
Code Context:
I'm using DisconnectMediaElementHandler method to dispose the media element, based on this discussion:
The DisconnectMediaElementHandler method is executed when the page disappears, not when the fullscreen button is clicked, at least on Android.
I'm not using ContentPage_Unloaded because, on iOS, when the fullscreen button is clicked and it enters fullscreen mode, CnkContentPage_Unloaded gets called and disposes of the media element view.
Additional Information:
There is no current way to trigger a specialized event in Maui when the fullscreen button is clicked.
The following screenshot from the app center
The text was updated successfully, but these errors were encountered: