1
votes

I am creating a Monotouch iPhone app that will display streaming videos. I have been able to get the MPMoviePlayerController working with a local file (NSUrl FromFile), but have not been able to get videos streamed from a media server.

Here is the code I am using to play the video:

                string url = @"http://testhost.com/test.mp4";
                var nsurl = NSUrl.FromString(url);
                mp = new MPMoviePlayerController(nsurl);
                mp.SourceType = MPMovieSourceType.Streaming;

                //enable AirPlay
                //mp.AllowsAirPlay = true;

                //Add the MPMoviePlayerController View
                this.View.AddSubview(mp.View);

                //set the view to be full screen and show animated
                mp.SetFullscreen(true, true);

                //MPMoviePlayer must be set to PrepareToPlay before playback
                mp.PrepareToPlay();

                //Play Movie
                mp.Play();

Is there something else in implementing the MPMoviePlayerController for video streaming that I am missing? I also read that videos for iOS should be streamed using Apple's HTTP Live Streaming on the media server, is that a requirement? I have never worked with video streaming on an iOS device before so I am not sure if there is something lacking in my code or the media server setup or a combination.

1

1 Answers

0
votes

I'm pretty sure you need a streaming server to use a video file from an HTTP url. However it's a requirement for applications (on the AppStore) to do so:

Important iPhone and iPad apps that send large amounts of audio or video data over cellular networks are required to use HTTP Live Streaming. See “Requirements for Apps.”

The good news is that your existing code should not have to be changed to handle this (it's server, not client side).