user1658259
user1658259

Reputation: 1

Monotouch - MoviePlayer never gets beyond "loading..."

I downloaded the MonoTouch example 'PlayMovieRecipe' and it runs perfectly.

I then created a small app (using Storyboard) with a 'MoviePlayer' page. I copied the example code from the sample application but when I run it, it appears to start the movieplayer but never gets beyond 'Loading...'. The sample file (sample.m4v) is in the root of the app. This is the code I used:

namespace test { public partial class DetailViewController : UIViewController { MPMoviePlayerController moviePlayer; public DetailViewController (IntPtr handle) : base (handle) { }

    public override void ViewDidLoad ()
    {
        base.ViewDidLoad ();
        this.btnPlayMovie.TouchUpInside += delegate {
            moviePlayer = new MPMoviePlayerController (NSUrl.FromFilename ("sample.m4v"));
            View.AddSubview (moviePlayer.View);
            moviePlayer.SetFullscreen (true, true);
            moviePlayer.Play ();
        } ;
    }

}

}

Upvotes: 0

Views: 95

Answers (1)

GeeMan
GeeMan

Reputation: 1

Try explicitly setting the filetype (moviePlayer.SourceType = MPMovieSourceType.File;) right before you add the subview. I also use a frame for the player which gives a little more control on display height, width etc. since the video can be pinched/zoomed to full screen. Also, make sure your video is set to "content" in it's settings (right-click Build Action). Cheers!

Upvotes: 0

Related Questions