Everything works fine with Android, and older IOS-versions, but when using IOS version 13.5, the video crashes when switched to fullscreen. The app doesn't crash, there is no exception, and i can restart the video by exiting fullscreen and press play again. Tested with different devices and IOS versions, on IPhoneSimulator and on real devices. Also tried to hide navigationbar and tried different orientations.
// ViewModel
private async void PlayVideo(object parameter)
{
PageManager.NavigateTo(typeof(VideoViewerPage));
CrossMediaManager.Current.MediaPlayer.VideoAspect = MediaManager.Video.VideoAspectMode.AspectFit;
CrossMediaManager.Current.MediaPlayer.ShowPlaybackControls = true;
if (Device.RuntimePlatform == Device.iOS)
{
await CrossMediaManager.Current.PlayFromResource(parameter.ToString());
}
else if(Device.RuntimePlatform == Device.Android)
{
Stream stream = DependencyService.Get<IReadFile>().Open(parameter.ToString());
await CrossMediaManager.Current.Play(stream, "Video");
}
}
// View
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:d="http://xamarin.com/schemas/2014/forms/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:mm="clr-namespace:MediaManager.Forms;assembly=MediaManager.Forms"
mc:Ignorable="d"
x:Class="SharedProject.Views.VideoViewerPage"
NavigationPage.HasNavigationBar="True">
<mm:VideoView VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand"/>
</ContentPage>
// Codebehind of View
public VideoViewerPage()
{
InitializeComponent();
if (Device.RuntimePlatform == Device.Android)
{
NavigationPage.SetHasNavigationBar(this, false);
}
}
protected override void OnAppearing()
{
MessagingCenter.Send(this, "allowLandScapePortrait");
base.OnAppearing();
}
protected override void OnDisappearing()
{
MediaManager.CrossMediaManager.Current.Stop();
MessagingCenter.Send(this, "preventLandScape");
base.OnDisappearing();
}