【发布时间】:2011-11-30 12:47:13
【问题描述】:
我在 Xcode 4 中使用基本 SDK 4.3 创建了我的 iPhone 应用
在我的 iPhone 应用程序中,我使用了 MPMovieplayercontroller 并使用它播放视频
它正在使用 IOS 4.3 在我的 iPod Touch 中播放我的视频文件,但如果我在装有 iOS 5 的 iPad 上安装相同的项目,它只显示黑屏但不播放视频。
可能出了什么问题?
这里是代码 在 .h 文件中
MPMoviePlayerController *moviePlayer;
在 .m 文件中
-(void)playVideo{
NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"testbild1" ofType:@"m4v"]];
moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url];
UIView *testview = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 200, 200)];
[testview addSubview:moviePlayer.view];
[self.view addSubview:testview];
}
- (void)moviePlaybackComplete:(NSNotification *)notification
{
MPMoviePlayerController *moviePlayerController = [notification object];
[[NSNotificationCenter defaultCenter] removeObserver:self
name:MPMoviePlayerPlaybackDidFinishNotification
object:moviePlayerController];
[moviePlayerController.view removeFromSuperview];
}
【问题讨论】:
标签: iphone objective-c ios4 ios5 mpmovieplayercontroller