-
Notifications
You must be signed in to change notification settings - Fork 338
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
Media Element Full Screen Support for Android and Windows #1692
Conversation
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.
Great work guys! This looks great and the community will be very happy when this get merged. I've some suggestions for you
src/CommunityToolkit.Maui.MediaElement/CommunityToolkit.Maui.MediaElement.csproj
Outdated
Show resolved
Hide resolved
src/CommunityToolkit.Maui.MediaElement/CommunityToolkit.Maui.MediaElement.csproj
Outdated
Show resolved
Hide resolved
samples/CommunityToolkit.Maui.Sample/Platforms/Android/MainActivity.cs
Outdated
Show resolved
Hide resolved
src/CommunityToolkit.Maui.MediaElement/Views/MauiMediaElement.android.cs
Outdated
Show resolved
Hide resolved
src/CommunityToolkit.Maui.MediaElement/Views/MauiMediaElement.android.cs
Outdated
Show resolved
Hide resolved
src/CommunityToolkit.Maui.MediaElement/Views/MauiMediaElement.windows.cs
Outdated
Show resolved
Hide resolved
src/CommunityToolkit.Maui.MediaElement/Views/MauiMediaElement.windows.cs
Outdated
Show resolved
Hide resolved
src/CommunityToolkit.Maui.MediaElement/Views/MauiMediaElement.windows.cs
Outdated
Show resolved
Hide resolved
src/CommunityToolkit.Maui.MediaElement/Views/MauiMediaElement.windows.cs
Outdated
Show resolved
Hide resolved
src/CommunityToolkit.Maui.MediaElement/Views/MauiMediaElement.windows.cs
Outdated
Show resolved
Hide resolved
src/CommunityToolkit.Maui.MediaElement/Views/MauiMediaElement.windows.cs
Outdated
Show resolved
Hide resolved
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.
Just some potentially minor comments that you may just be able to ignore but I seem to recall we had some issues around Popups where it was messing with the system bar settings on Android
src/CommunityToolkit.Maui.MediaElement/Views/MauiMediaElement.android.cs
Outdated
Show resolved
Hide resolved
src/CommunityToolkit.Maui.MediaElement/Views/MauiMediaElement.android.cs
Outdated
Show resolved
Hide resolved
src/CommunityToolkit.Maui.MediaElement/CommunityToolkit.Maui.MediaElement.csproj
Outdated
Show resolved
Hide resolved
src/CommunityToolkit.Maui.MediaElement/Extensions/PageExtensions.cs
Outdated
Show resolved
Hide resolved
@pictos and @ne0rrmatrix I couldn't get this into the Discord channel for some reason but this is my initial attempt at docs page for the background Android application exception. Let me know what you think |
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.
Thanks @pictos for sharing the tests. This happens specifically on the emulator when you rotate it under a specific side, because the emulator does not know if you are trying to see the video upside/down. However, if you keep rotating the device you will see how it works. You can actually see it on the video demo @ne0rrmatrix shared with us on the initial description of the PR. In any cases, James is currently trying to run the Sample app on a physical Android phone to get more information. 😃 |
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.
For me, after the last request, it looks good to go!
src/CommunityToolkit.Maui.MediaElement/Views/MauiMediaElement.windows.cs
Outdated
Show resolved
Hide resolved
…tering full screen.
@pictos the last commit improves the rotation issue you were facing on Android. James and I ran some tests to confirm. Thanks again for testing. Let us know if approved, so we can proceed with the next steps. |
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.
Hey Gang! This is looking really good and I know many many devs are super excited for this 💯
On Android, the full-screen buttons overlap the built-in software nav buttons at the bottom. The Android bottom navigation button bar blocks me from tapping on the MediaElement full-screen buttons.
In this screen capture, I am trying to click the button on the bottom-right to close the full screen, but the Android navigation buttons on the bottom are blocking me from clicking it.
👆 This screen capture is from a Android Pixel 7 emulator running Android API 29
Align to StyleCop SA1201
Great work guys! For the documentation, do we have any behavioral changes? If not then we might not need to add anything. |
Yes the |
Is that in addition to this change MicrosoftDocs/CommunityToolkit#370 or is the crash you are referring to the one mentioned in that PR? |
Yes it should be added. It is separate and is required. If you do not put that in it will not work when returning from background. It will result in bug reports. |
@ne0rrmatrix and @vhugogarcia I can add some detail to the docs PR that we have open. Do we have anything more specific than "The app might behave incorrectly unless that is set." is there a common way in which the application won't behave? Or is this statement sufficient? |
@bijington The app will crash if returning from background process if this is not set. I would phrase it differently but I lack the proper language to describe it. |
Hello @bijington I believe,it can be also something like this wording:
|
That sounds perfect. I feel that is a great explanation and resolves all issues I have. Thank you. |
@ne0rrmatrix and @vhugogarcia how does this look: MicrosoftDocs/CommunityToolkit@44bc859 |
Looks great @bijington thanks for updating the docs 😃 |
Looks great. I think that is written very well and provide the needed info to developers. Thank you for updating the docs :) |
Added WindowCompat to prevent the blank space to be inserted between the bar title and the status bar when returning from fullscreen.
Confirmed by PureWeen, we don't need to override the OnPostCreate event and just set the LaunchMode to SingleTask. I applied the changes and it worked as expected. dotnet/maui#18692 (comment)
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.
Thanks @vhugogarcia and @ne0rrmatrix. I just added a question around the nullable warning that we have suppressed but the rest of the changes look good to me
src/CommunityToolkit.Maui.MediaElement/Views/MauiMediaElement.android.cs
Show resolved
Hide resolved
Ensures app does not crash when playerView has already been disposed and its parent class is disposed by the OS
This will throw an exception if MediaElement is improperly used instead of failing silently
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.
Great work guys!!
I'm good merging this, pending @bijington's review comment on the additional constructor.
I can see why an empty constructor can happen here. But I though setting Single Instance prevented this? I believe constructor gets called a second time when returning from background which crashes the app. But with single instance set it will not call constructor. I use that specifically to solve issues like this. If it does not get called a second time which it should not be when returning from background this is is unnecessary? Or am I wrong? |
I wish I knew the answer to this. My vote is to keep the constructor; the code includes a link to the discussion we've had around it. We can always remove it in a future PR. |
Thanks all for the detail and effort. This looks great! |
Description of Change
@ne0rrmatrix and myself have been working very closely to have the full screen feature for Android and Windows implemented on the media element. It has been an amazing team work with collaborative meetings, etc. Implements probably one of the most wanted features from developers on which apps a media element is required.
Linked Issues/Discussions
PR Checklist
approved
(bug) orChampioned
(feature/proposal)main
at time of PRAdditional information
MacOS and iOS already integrate the full screen feature, so no additional work is needed for those platforms. Please find below a couple of videos demoing the full screen on Android and Windows.
Windows Sample
MediaElement-Windows.mp4
Android Sample
MediaElement-Android.1.mp4