0

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();
        }
  • I test the plugin in my project with remote url and it works fine on my iPhone(13.x) . So you could share your sample so that I can test it on my side directly . – Lucas Zhang Jun 22 '20 at 12:15
  • By the way , if you want to implement a video player in Forms . You could use `Custom Renderer` .Check https://learn.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/custom-renderer/video-player/player-creation . – Lucas Zhang Jun 22 '20 at 12:16
  • MediaElement is really limited and very buggy at the moment. – Jammer Apr 21 '21 at 07:56

0 Answers0