【发布时间】:2012-11-24 09:54:53
【问题描述】:
我正在下载一个 aac 文件并使用以下代码在 MPMoviePlayerController 中播放它
movieController = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath:self.filePath]];
[self.view addSubview:movieController.view];
CGRect screenBound = [[UIScreen mainScreen] bounds];
CGSize screenSize = screenBound.size;
movieController.view.frame = CGRectMake(0,0,screenSize.width, screenSize.height);
[movieController setFullscreen:YES];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(doneBtnMediaPlayer:) name:MPMoviePlayerWillExitFullscreenNotification object:nil];
movieController 是(非原子,强)类属性
这适用于除 iOS 5(和 iOS 5 模拟器)之外的所有 iOS。 在 iOS 5 中它显示黑屏并在后台播放文件。
我注意到的另一件事是,当我在现有应用程序上运行应用程序时,它在 iOS5 上也可以正常工作。但是当我从设备中删除应用程序然后运行它时,它只是显示黑屏。
【问题讨论】:
-
2013 年 12 月 .. 提示 - 关于文件扩展名(文件来自网络)非常不稳定。在我的应用程序中,.MOV 有效,.mov 使 iPhone 严重崩溃。奇怪。模拟器也根本不起作用,它完全没用,只会崩溃。最后,在 MPMoviePlayerViewController 方法有效时,MPMoviePlayerController 无用且损坏。
标签: iphone ios ios5 ios-simulator mpmovieplayercontroller