我在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