开发者

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

开发者 https://www.devze.com 2023-01-06 17:42 出处:网络
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.

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

精彩评论

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