Beispiel #1
0
        public static void PlayVideo(string path, bool local)
        {
            NSUrl url = null;

            if (local)
            {
                url = NSUrl.FromFilename(path);
            }
            else
            {
                url = NSUrl.FromString(path);
            }

            MPMoviePlayerViewController movieController = new MPMoviePlayerViewController(url);
            UIViewController            controller      = AppMain.Current.Services.GetService(typeof(UIViewController)) as UIViewController;

            movieController.MoviePlayer.SetFullscreen(true, false);
            controller.PresentMoviePlayerViewController(movieController);
            movieController.MoviePlayer.Play();

            NSNotificationCenter.DefaultCenter.AddObserver(new NSString("MPMoviePlayerDidExitFullscreenNotification"), (not) =>
            {
                controller.DismissMoviePlayerViewController();
            });
        }