Skip to content

[BUG] Mediaelement distorting app view after full screen on Android #2571

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

Open
2 tasks done
KasperSommer opened this issue Mar 7, 2025 · 17 comments · May be fixed by #2587
Open
2 tasks done

[BUG] Mediaelement distorting app view after full screen on Android #2571

KasperSommer opened this issue Mar 7, 2025 · 17 comments · May be fixed by #2587
Labels
bug Something isn't working 📽️ MediaElement Issue/PR that has to do with MediaElement

Comments

@KasperSommer
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Did you read the "Reporting a bug" section on Contributing file?

Current Behavior

On Android the view of the app is distorted or offset after the Mediaelement has been in full screen mode.

Before full screen:
Image

After full screen mode:
Image

Expected Behavior

App should look the same after exiting full screen mode.

Steps To Reproduce

  1. Create a .NET Hello World
  2. Install MediaElement
  3. Play a file - go to full screen - exit full screen

Link to public reproduction project repository

https://github.com/KasperSommer/MediaElementIssue2

Environment

- .NET MAUI CommunityToolkit MediaElement: 6.0.1 
- .NET MAUI: 9.0.40

Anything else?

No response

@KasperSommer KasperSommer added bug Something isn't working unverified labels Mar 7, 2025
@KasperSommer
Copy link
Author

KasperSommer commented Mar 7, 2025

I just verified that it happens in the CommunityToolkit sample app as well:

Before:
Image

After:
Image

@ne0rrmatrix
Copy link
Contributor

Have u tested with a physical device? I have noticed differences in behaviour for simulator vs an actual hardware device. Also depending on whether you have bottom nav buttons enabled.

@KasperSommer
Copy link
Author

@ne0rrmatrix - Yes, I have tested on two physical devices. On a Lenovo Tab I got the spacing in top and bottom. On another device we also got white spacing on the right side of the screen.

Image

@ne0rrmatrix
Copy link
Contributor

ne0rrmatrix commented Mar 15, 2025

Which version of Android is affected? I just loaded the sample you provided in android 15 on emulator and was unable to replicate the issue. I am not doubting this is happening I just would like to replicate it so I can fix it. I don't have access to those models of phones so knowing which specific emulator or emulator config causes this would be helpful.

edit: I checked the toolkit sample app and the sample provided. I was unable to replicate the issue. I saw above that the user had enabled 3 button support and thought maybe that could be it. Unfortunately it was not. I have tried android 34 and 35. If you can provide more info it would be much appreciated.

@KasperSommer
Copy link
Author

KasperSommer commented Mar 15, 2025

I have seen the issue on physical devices with Android API versions 33 and 34. And my emulator version 34 on MacOS does it too. I do not know if it is related to the screen ratio or something. My emulator is Pixel 9.

I really hope it helps.

It happens as soon as we minimize from full screen. The OnSizeAllocated is triggered.

@ne0rrmatrix
Copy link
Contributor

Thank you. Yes that is very helpful. I am was testing on windows using pixel 7 and a Samsung tab s8 plus. I will switch to my mac mini and try on a pixel 9. That should get me started. I am going to go test on my mac now.

@ne0rrmatrix
Copy link
Contributor

I was able to replicate the issue using android 34 on my mac mini m2. It appears to be an issue when building using a mac. I tested again using windows for android 33,34, and 35 with zero issues on both toolkit sample and your sample. I also saw that the behaviour does not replicate with android 35 on my mac.

My suggestion is try and help me out is if you have access to a windows pc can you try building on it and see if you can replicate issue? if you can do that and verify that issue is not present that would be helpful. If it is a device type specific build issue I can try and figure out what is going on.

@ne0rrmatrix ne0rrmatrix added 📽️ MediaElement Issue/PR that has to do with MediaElement and removed unverified labels Mar 15, 2025
@KasperSommer
Copy link
Author

Of course, however, I will only have access to a Windows machine by Tuesday. But I will get back asap.

@ne0rrmatrix
Copy link
Contributor

I opened an issue on Dotnet Android github as it looks like the issue is possibly not an issue with media element. dotnet/android#9923

@KasperSommer
Copy link
Author

@ne0rrmatrix, I just managed to build my app on a Windows machine. Unfortunately, the result is exactly the same. I am still getting the white spaces - top + bottom on one device, top + bottom + right on the other device.

@ne0rrmatrix
Copy link
Contributor

I have done further testing. Issue can now be replicated in windows using toolkit sample on emulator for android 34. But I cannot replicate it all on any phone or tablet I have. I have tested it on 3 samsung phones. 2 running android 14. One running android 11. The table is running android 14 and shows zero issues. I do not have access to other devices atm. I am not sure how to proceed as this seems to be either an emulator issue or an edge case issue with some devices.

@KasperSommer
Copy link
Author

@ne0rrmatrix, that's weird. I have tested physically on Lenovo Tab M8 and Samsung A15 - it happens on both devices. Unfortunately, I also don't have access to other physical devices atm.

@ne0rrmatrix
Copy link
Contributor

I switched device theme to light mode and I can replicate it 100 percent now. I will work on a fix now.

@ne0rrmatrix ne0rrmatrix linked a pull request Mar 17, 2025 that will close this issue
6 tasks
@ne0rrmatrix
Copy link
Contributor

Can you test this PR? #2587 Please report if it fixes your issue.

@KasperSommer
Copy link
Author

KasperSommer commented Mar 18, 2025

I am sorry, I am really no expert on this. I have tried to reference the package locally but not been able to make it work.

@KasperSommer
Copy link
Author

@ne0rrmatrix - I have managed to build the package on Windows and I can confirm that it works on all my devices. Very nice, thank you very mcuh for the effort.

@ZivFarin
Copy link

Having the problem as well which prevents us from showing native media controls on android...
@ne0rrmatrix Seems like this is solved.. Is there anything that can be done in order to push this forward?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working 📽️ MediaElement Issue/PR that has to do with MediaElement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants