Fix IOS crash when entering Full Screen#1755
Fix IOS crash when entering Full Screen#1755TheCodeTraveler merged 8 commits intoCommunityToolkit:mainfrom
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. |
vhugogarcia
left a comment
There was a problem hiding this comment.
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
MediaElementUnloadedmethod and theUnloadedevent handler from theMediaElementPage.xaml.csandMediaElementPage.xamlfiles respectively. These were previously used to disconnect the handler when the media element was unloaded. Additionally, theOnNavigatedFrommethod in theMediaElementPage.xaml.csfile was updated to stop the media element from playing when navigation away from the page occurs.List of changes:
MediaElementUnloadedmethod from theMediaElementPage.xaml.csfile. This method was previously used to disconnect the handler when the media element was unloaded.OnNavigatedFrommethod in theMediaElementPage.xaml.csfile to include a call toMediaElement.Stop(). This stops the media element from playing when navigation away from the page occurs.Unloadedevent handler from theMediaElementPage.xamlfile. This event handler was previously used to call theMediaElementUnloadedmethod when the media element was unloaded.Linked Issues
PR Checklist
approved(bug) orChampioned(feature/proposal)mainat time of PRAdditional information
While adding Full Screen controls an
unloadedevent 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.