在 iphone 4.0 操作系统中播放视频时出现崩溃问题。实际上,我已经使用基本 SDK 3.0 创建了应用程序,现在我只是将应用程序安装到 4.0 OS 设备。
它不起作用......我已经调试了这个问题,发现在 4.0 操作系统中,苹果更改了播放视频的框架和方法。
任何人都可以帮助我如何克服这个问题。
这是我在 3.0 操作系统中运行良好的代码。
-(void)play
{
NSBundle *bundle = [NSBundle mainBundle];
//NSString *path = [bundle pathForResource:@"Icon" ofType:@"png"];
NSString *path = [bundle pathForResource:@"loader" ofType:@"m4v"];
NSURL *url = [NSURL fileURLWithPath:path];
moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url];
moviePlayer.scalingMode = MPMovieScalingModeAspectFill;
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlayBackDidFinish:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:moviePlayer];
moviePlayer.movieControlMode = MPMovieControlModeHidden;
[moviePlayer play];
}
提前致谢, Pragnesh