-
Notifications
You must be signed in to change notification settings - Fork 1.8k
[Android] Allow full screen videos from WebView #15472
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
Conversation
Hello @jsuarezruiz, Thanks for adding this new feature to .NET MAUI Webviews on Android. I would like to share some ideas here. On this method, we need to return to the original orientation of the device. However, there are some points we need to cover and validate:
How this can be solved? well, if it is possible to know the orientation supported by the app then we can just add a validation for it, otherwise, we need to think how to validate that for the second scenario. |
Also, we need to validate which is the status of the current SystemBars settings are on the app, because for example, I may have an application that only shows the StatusBar and not the navigation bar, so by doing this, we are showing status and navigation bar which may not be the expected result.
So, we may need to validate if the user has StatusBarVisible and NavigationBar visible before enter full screen save it on a variable or somewhere, and then when returning we show only what was visible. :) What do you think @jsuarezruiz ? |
Good point. Agree. I will review it shortly. Thanks for all the feedback. |
Updated adding more validations etc. |
Hello @jsuarezruiz , is this going to be available in .NET MAUI 8 GA? 🙂👍🏻 |
@jfversluis, @tj-devel709 Added you as reviewers. Could you take a look when you can? Thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
D:\a_work\1\s\src\Core\src\Platform\Android\MauiWebChromeClient.cs(147,5): error CA1422: This call site is reachable on: 'Android' 21.0 and later. 'Window.SetDecorFitsSystemWindows(bool)' is obsoleted on: 'android' 35.0 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422) [D:\a_work\1\s\src\Core\src\Core.csproj::TargetFramework=net9.0-android35.0]
D:\a_work\1\s\src\Core\src\Platform\Android\MauiWebChromeClient.cs(108,5): error CA1422: This call site is reachable on: 'Android' 21.0 and later. 'Window.SetDecorFitsSystemWindows(bool)' is obsoleted on: 'android' 35.0 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422) [D:\a_work\1\s\src\Core\src\Core.csproj::TargetFramework=net9.0-android35.0]
If you're looking to implement full-screen functionality for Android WebView video playback, you can use the following workaround. This approach involves creating a custom handler that extends MauiWebChromeClient to support full-screen video features. Steps to Implement:
Add a handler to enable video features:
Register the handler in MauiProgram.cs:
This code sets up the necessary functionality to manage full-screen video playback by handling OnShowCustomView and OnHideCustomView. It also ensures compatibility with both tablets and phones, supporting immersive mode on Android devices. |
This PR is from... 2023! It requires changes from the original implementation due to using deprecated APIs. I just rebased, but it would require a change in implementation. I'm moving it to Draft until we have the changes. |
...amples/Controls.Sample/Pages/Controls/WebViewGalleries/WebViewFullScreenVideoGallery.xaml.cs
Outdated
Show resolved
Hide resolved
Updated implementation without use obsolete APIs. |
Retarget to .NET 10. |
Description of Change
Allow full screen videos from WebView.
To validate the changes can use the new added sample to the WebView galleries in the .NET MAUI Gallery App.
Issues Fixed
Fixes #8030
Fixes #7720