-
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
Fix IOS crash when entering Full Screen #1755
Fix IOS crash when entering Full Screen #1755
Conversation
…Unloaded` method and the `Unloaded` event handler from the `MediaElementPage.xaml.cs` and `MediaElementPage.xaml` files respectively. These were previously used to disconnect the handler when the media element was unloaded. Additionally, the `OnNavigatedFrom` method in the `MediaElementPage.xaml.cs` file was updated to stop the media element from playing when navigation away from the page occurs. List of changes: 1. Removal of the `MediaElementUnloaded` method from the `MediaElementPage.xaml.cs` file. This method was previously used to disconnect the handler when the media element was unloaded. 2. Update to the `OnNavigatedFrom` method in the `MediaElementPage.xaml.cs` file to include a call to `MediaElement.Stop()`. This stops the media element from playing when navigation away from the page occurs. 3. Removal of the `Unloaded` event handler from the `MediaElementPage.xaml` file. This event handler was previously used to call the `MediaElementUnloaded` method when the media element was unloaded.
Hello @ne0rrmatrix , on this PR there is only changes on the sample application of the Community Toolkit Media Element. Per what I understand the issue is on the sample only? 🤔 @briankanelson, could you please confirm, if the changes applied by James at the XAML page help you the fix the issue on your project: #1110 (comment) ? |
Yes @vhugogarcia it is only a fix to sample app. |
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.
I have tested these changes and I can confirm, it fixes the iOS crash on the Media Element sample when entering full screen. Thanks @ne0rrmatrix for the help!
Description of Change
The most significant changes involve the removal of the
MediaElementUnloaded
method and theUnloaded
event handler from theMediaElementPage.xaml.cs
andMediaElementPage.xaml
files respectively. These were previously used to disconnect the handler when the media element was unloaded. Additionally, theOnNavigatedFrom
method in theMediaElementPage.xaml.cs
file was updated to stop the media element from playing when navigation away from the page occurs.List of changes:
MediaElementUnloaded
method from theMediaElementPage.xaml.cs
file. This method was previously used to disconnect the handler when the media element was unloaded.OnNavigatedFrom
method in theMediaElementPage.xaml.cs
file to include a call toMediaElement.Stop()
. This stops the media element from playing when navigation away from the page occurs.Unloaded
event handler from theMediaElementPage.xaml
file. This event handler was previously used to call theMediaElementUnloaded
method when the media element was unloaded.Linked Issues
PR Checklist
approved
(bug) orChampioned
(feature/proposal)main
at time of PRAdditional information
While adding Full Screen controls an
unloaded
event was added that calledMediaElement.Handler?.Disconnect();
When entering full screen on IOS this event was called. I do not know why IOS calls unload event for switching to or from full screen it just does. This issue is an IOS only issue. It does not affect Mac.I have tested this PR against Windows, Mac Catalyst, IOS and Android with almost no issues. For unknown reasons when returning to normal mode from full screen on IOS it pauses playback. This does not happen in Mac Catalyst. This is the only issue with this PR atm. I have no idea why IOS pauses upon returning from full screen.