我下載了MonoTouch示例「PlayMovieRecipe」,它運行完美。Monotouch - MoviePlayer永遠不會超越「加載...」
然後我創建了一個帶有'MoviePlayer'頁面的小應用程序(使用Storyboard)。我從示例應用程序中複製了示例代碼,但是當我運行它時,它似乎啓動了movieplayer,但從未超出「正在加載...」。示例文件(sample.m4v)位於應用程序的根目錄中。這是我所使用的代碼:
命名空間測試 { 公共部分類DetailViewController:UIViewController的 { 的MPMoviePlayerController moviePlayer; 公共DetailViewController(IntPtr的手柄):基地(句柄) {}
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();
} ;
}
}
}
嗨GeeMan,謝謝你的幫助。電影的內容類型被設置爲「無」。當我將它設置爲「內容」時,它現在可以工作。我忘了內容類型,所以再次感謝。 – user1658259