【发布时间】:2011-06-27 10:46:56
【问题描述】:
我已经实现了 MPMoviePlayerController,它在 ios 3.2 和 4.0 中完美运行,但在 iOS 4.2 中却没有。
我的代码有什么问题
- (void)viewDidLoad {
NSLog(@"videoSubView viewDidLoad");
moviePlayerController =[[MPMoviePlayerController alloc]initWithContentURL:videoURL];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePreloadDidFinish:)
name:MPMoviePlayerLoadStateDidChangeNotification
object:moviePlayerController];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlaybackComplete:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:moviePlayerController];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlayerPlaybackStateDidChange:)
name:MPMoviePlayerPlaybackStateDidChangeNotification
object:moviePlayerController];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(exitedFullscreen:)
name:MPMoviePlayerDidExitFullscreenNotification
object:moviePlayerController];
moviePlayerController.view.frame = CGRectMake(0,0,320,460);
[self.view addSubview:moviePlayerController.view];
[moviePlayerController play];
[super viewDidLoad];
}
添加了 MediaPlayer.framework 并 #import 将媒体播放器导入到 .h 文件中
请帮帮我。
谢谢
【问题讨论】:
-
到底是什么问题?播放器窗口中显示什么?
-
@Till:它连播放器窗口都没有显示,我面临同样的问题!
-
将
[super viewDidLoad]移到顶部。
标签: iphone mpmovieplayercontroller