开发者

Getting EXC_BAD_ACCESS if I press Home Button in Video Player

I have an application where I need to play a video. I used following code. There is a problem with Home button, if I press the Home button during video playing I'm getting EXC_BAD_ACCESS. I even have no idea why it may happens. Please help.



    NSString * videoString = [[NSBundle mainBundle] pathForResource:@"video.mp4" ofType:nil]开发者_如何学运维;
    NSURL * url = [NSURL fileURLWithPath:videoString];
    MPMoviePlayerController * videoPlayer = [[MPMoviePlayerController alloc] initWithContentURL:url];
    [self.view addSubview:videoPlayer.view];
    videoPlayer.view.frame = CGRectMake(0, 0,768, 1024);  
    [videoPlayer play];


In your application controller's applicationWillResignActive method, call [videoPlayer stop].

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜