Maui: [BUG] MediaElement full-screen doesn't rotate video horizontally when Android is locked in Portrait orientation
Is there an existing issue for this?
- I have searched the existing issues
Did you read the “Reporting a bug” section on Contributing file?
- I have read the “Reporting a bug” section on Contributing file: https://github.com/CommunityToolkit/Maui/blob/main/CONTRIBUTING.md#reporting-a-bug
Current Behavior
If Android is locked in Portrait mode, MediaElement full-screen won’t rotate the video horizontally. See example video
Expected Behavior
Regardless of orientation lock, a video should follow the screen orientation when full-screen.
Steps To Reproduce
With ScreenOrientation = ScreenOrientation.Portrait
- Open video in fullscreen
- Rotate the device into landscape mode
Link to public reproduction project repository
https://github.com/armanimichael/MediaElementFullScreen
Environment
- .NET MAUI CommunityToolkit.Maui.MediaElement: 3.1.0
- .NET MAUI CommunityToolkit: 8.0.0
- OS: Android 14
- .NET MAUI: 8.0.14
Anything else?
No response
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 15 (7 by maintainers)
I just checked both my phone and android tablet. The behavior of the device is not as you describe. If I turn on auto rotation in settings it will auto rotate based on orientation in YouTube. This is default behavior of most video apps on Samsung devices. This works for both full screen and not full screen.
I am going to start working on suggested change to allow developers a choice to lock this behavior based on choice. It will be a developer option and not a default behavior.
Edit: I will create a discussion to have the team and community discuss it. I have not yet started working on it.
Ok. That wouuld be easy to implement as I already have an idea how to do that. Sorry about the confusion. I would be happy to submit a proposal to add the ability to do force rotation like that as an option for developers. I will talk to a team member this morning.
I just double-checked and when screen rotation is locked the video does not rotate in Android in a video player by default. I loaded the sample app from repo in portrait mode in both android and iOS. Both exhibit the same behavior. If I lock rotation from the menu it stays in that rotation for the whole time screen rotation is locked.
edit for clarity: I opened the sample app from the Maui Community toolkit. Not the provided sample. Sorry about the any possible confusion. I am now going to do further testing with the provided sample to see the behavior.
Thanks for the response @ne0rrmatrix.
I think there’s some confusion here, I don’t see any issue with this if the device rotation is being disabled by the user.
What looks wrong to me here is preventing the video from adapting to the rotation when I (as a developer) lock the Application to portrait mode (for instance because landscape is not supported for my use-case / UI).
I checked Youtube and Prime Video from your examples, and those applications do support both portrait and landscape mode.
On IOS for instance,
MediaElementhandles this scenario perfectly (if the application is locked to portrait mode, the video still adapts to landscape)