0

此代码在非故事板环境中工作,但仅在故事板 ViewController 上运行时显示黑屏。不知道会有什么不同。欢迎提出建议

public partial class videoVC : UIViewController
{

    MPMoviePlayerController mp = new MPMoviePlayerController();

    public videoVC (IntPtr handle) : base (handle)
    {
    }

    public override void ViewDidLoad ()
    {
        base.ViewDidLoad ();
        this.buttonPlay.TouchUpInside += delegate {
        try{

            mp = new MPMoviePlayerController(NSUrl.FromFilename("videos/file.m4v"));
            mp.AllowsAirPlay = true;
            this.View.AddSubview(mp.View);
            mp.SetFullscreen(true,true);
            mp.PrepareToPlay();
            mp.Play();

            }catch{

            Console.WriteLine("There was a problem playing back Video");

            }       

        };
4

1 回答 1

0

您是否将 file.m4v 的 Build Action 属性设置为 Content?

于 2012-09-14T14:35:10.457 回答