我正在使用MPMoviePlayerViewController播放来自服务器的视频。
@property (strong, nonatomic) MPMoviePlayerViewController *videoPlayer;
当我重新启动视频时,我得到EXC_BAD_ACCESS
(代码= 1,地址= 0xc000000c)...
_videoPlayer = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL URLWithString:[NSString ... ]]];
[self presentMoviePlayerViewControllerAnimated:_videoPlayer];
我该如何解决?
经过3天的搜索答案,得到了解决方案!!!
-(void)viewWillAppear:(BOOL)animated{
// just add observer
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(movieEventFullscreenHandler:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:nil];
}
我需要停止播放器,然后用户按“完成”:
- (IBAction) movieEventFullscreenHandler:(NSNotification*)notification{
[self.player.moviePlayer stop];
[self.player.moviePlayer setFullscreen:NO animated:NO];
}
就这样!
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句