Beispiel #1
0
        /// <summary>
        /// Plays the streaming fullscreen movie.
        /// </summary>
        /// <param name="url">URL.</param>
        /// <param name="autoPlay">If set to <c>true</c> auto play.</param>
        /// <param name="style">Style.</param>
        public static void PlayStreamingFullscreenMovie(string url,
		                                                bool autoPlay = true, 
		                                                MPMovieControlStyle style=MPMovieControlStyle.Fullscreen)
        {
            contentURL = new NSURL(url);

            if (_playerVC == null) {
                _playerVC = new MPMoviePlayerViewController();

                _playerVC.moviePlayer.movieSourceType = MPMovieSourceType.Streaming;
                _playerVC.moviePlayer.contentURL = contentURL;
            //		_playerVC.moviePlayer.SetFullscreen(true, false);
                _playerVC.moviePlayer.shouldAutoplay = autoPlay;

                _playerVC.moviePlayer.controlStyle = style;

                _playerVC.moviePlayer.LoadStateDidChange += _defaultMoviePlayerNotificationHandler;
                _playerVC.moviePlayer.DidExitFullscreen += _defaultMoviePlayerExitFullscreen;
                _playerVC.moviePlayer.PlaybackDidFinish += _defaultMoviePlayerFinishHandler;

                _playerVC.moviePlayer.PrepareToPlay();

            } else {
                _playerVC.moviePlayer.contentURL = contentURL;
                _playerVC.moviePlayer.PrepareToPlay();
            }

            //			UIApplication.deviceRootViewController.AddChildViewController(_playerVC);
            UIApplication.deviceRootViewController.PresentViewController(_playerVC, false, null);
        }
Beispiel #2
0
        /// <summary>
        /// Plays the streaming fullscreen movie.
        /// </summary>
        /// <param name="url">URL.</param>
        /// <param name="autoPlay">If set to <c>true</c> auto play.</param>
        /// <param name="style">Style.</param>
        public static void PlayStreamingFullscreenMovie(string url,
                                                        bool autoPlay             = true,
                                                        MPMovieControlStyle style = MPMovieControlStyle.Fullscreen)
        {
            contentURL = new NSURL(url);

            if (_playerVC == null)
            {
                _playerVC = new MPMoviePlayerViewController();

                _playerVC.moviePlayer.movieSourceType = MPMovieSourceType.Streaming;
                _playerVC.moviePlayer.contentURL      = contentURL;
                //		_playerVC.moviePlayer.SetFullscreen(true, false);
                _playerVC.moviePlayer.shouldAutoplay = autoPlay;


                _playerVC.moviePlayer.controlStyle = style;


                _playerVC.moviePlayer.LoadStateDidChange += _defaultMoviePlayerNotificationHandler;
                _playerVC.moviePlayer.DidExitFullscreen  += _defaultMoviePlayerExitFullscreen;
                _playerVC.moviePlayer.PlaybackDidFinish  += _defaultMoviePlayerFinishHandler;


                _playerVC.moviePlayer.PrepareToPlay();
            }
            else
            {
                _playerVC.moviePlayer.contentURL = contentURL;
                _playerVC.moviePlayer.PrepareToPlay();
            }

//			UIApplication.deviceRootViewController.AddChildViewController(_playerVC);
            UIApplication.deviceRootViewController.PresentViewController(_playerVC, false, null);
        }