private void exitPlayback(PlaybackExitReason reason)
        {
            Logger.Log("UIChaptersEnabledVideoView.exitPlayback: reason = " + reason);

            var vv = videoView;

            if (vv != null)
            {
                Device.BeginInvokeOnMainThread(() =>
                {
                    //XXX: Giant hack to force us back to portrait mode on phones upon exiting the video player that might have been in landscape
                    //alternatives - https://forums.xamarin.com/discussion/comment/142012/#Comment_142012 - https://forums.xamarin.com/discussion/42849/fix-orientation-for-one-page-in-the-app-is-it-possible-with-xamarin-forms
                    if (Device.Idiom == TargetIdiom.Phone)
                    {
                        UIDevice.CurrentDevice.SetValueForKey(new NSNumber((int)UIInterfaceOrientation.Portrait), new NSString("orientation"));
                    }

                    vv.ExitPlayback(video, reason);

                    if (Device.Idiom == TargetIdiom.Phone)
                    {
                        UIDevice.CurrentDevice.SetValueForKey(new NSNumber((int)UIInterfaceOrientation.Unknown), new NSString("orientation"));
                    }
                });
            }
        }
        private void playBackFinishedHandler(object sender, MPMoviePlayerFinishedEventArgs mpMoviePlayerFinishedEventArgs)
        {
            PlaybackExitReason reason = (PlaybackExitReason)mpMoviePlayerFinishedEventArgs.FinishReason;

            if (reason == PlaybackExitReason.Ended)
            {
                video.BookmarkTime = -2;
            }
            else
            {
                video.BookmarkTime = moviePlayer.MoviePlayer.CurrentPlaybackTime;
            }

            exitPlayback(reason);
        }
 public void ExitPlayback(LibraryItem video, PlaybackExitReason reason)
 {
     OnPlaybackComplete?.Invoke(this, new PlaybackExitEventArgs(reason, video));
 }
 public PlaybackExitEventArgs(PlaybackExitReason reason, LibraryItem video)
 {
     this.Reason = reason;
     this.Video  = video;
 }