2010-04-02 58 views
4

我在Ipad应用程序中使用MPMoviePlayerController。视频没有显示,但音频将是,同样的代码为iPhone在iPad应用程序中使用MPMoviePlayerController的一些问题

运作良好
NSBundle *bundle = [NSBundle mainBundle]; 
NSString *moviePath = [bundle pathForResource:@"video" ofType:@"mp4"]; 

movieURL = [NSURL fileURLWithPath:moviePath]; 
MPMoviePlayerController *IntroMovie = [[MPMoviePlayerController alloc] initWithContentURL:movieURL]; 
    [IntroMovie play]; 

[[NSNotificationCenter defaultCenter] addObserver:self 
             selector:@selector(moviePlaybackDidFinish:) 
              name:MPMoviePlayerPlaybackDidFinishNotification 
              object:nil]; 

请建议我

感谢 Miraaj

回答

3

您必须视图控制器内的影片视图添加到现有的观点是这样对于样本:

[self.view addSubview:IntroMovie.view]

1

是您的iPad应用从iPhone应用程序的独立目标?

如果是这样,您是否记得将视频添加到复制到iPad应用程序包的资源中?

如果没有,请将其拖入iPad应用程序目标中的“Copy Bundle Resources”构建阶段。

1

在你需要使用一个MPMoviePlayerViewController呈现视频,而不是新的SDK 只是一个的MPMoviePlayerController:

iPhone Dev Center

相关问题