我下载了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