开发者

Video with iPhone 3.0 OS application getting crash while running in iphone 4.0 OS

I am having a crash issue while playing video in iphone 4.0 OS. Actually, I have created application with base SDK 3.0 and now i am just installing application to 4.0 OS device.

It is not working in that... I have debugged that issue and found that in 4.0 OS, apple change the framework and methods to play the video.

Any one help me how to overcome this issue.

Here is my code which is running fine in 3.0 OS.

-(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:MPMoviePlay开发者_C百科erPlaybackDidFinishNotification 
                  object:moviePlayer];
     moviePlayer.movieControlMode = MPMovieControlModeHidden;
     [moviePlayer play];
    }

Thanks in advance, Pragnesh


With iOS4, you need to use the MPMoviePlayerViewController. I posted my working code sample here.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜