0
我正在開發iOS應用程序,並且我想在用戶按下按鈕時播放視頻。 我已經開發了這個,用戶按下按鈕並播放視頻,但是當視頻結束時,視頻的視圖仍然存在,並且視頻的最後一幀被凍結。iOS-Xcode:在最後一幀中凍結的視頻複製
我已經搜索在谷歌,我發現這樣一個問題:
iOS 6, Xcode 4.5 video not exiting when done playing
我用代碼編寫的有,但我還沒有固定它。 這是我的代碼:
-(IBAction)reproducirVideo:(id)sender
{
NSURL *url5 = [NSURL fileURLWithPath:[[NSBundle mainBundle]
pathForResource:@"instrucciones" ofType:@"mp4"]];
_moviePlayer = [[MPMoviePlayerController alloc]
initWithContentURL:url5];
_moviePlayer.controlStyle = MPMovieControlStyleDefault;
_moviePlayer.shouldAutoplay = YES;
[self.view addSubview:_moviePlayer.view];
[_moviePlayer setFullscreen:YES animated:YES];
}
-(void) moviePlayBackDidFinish:(NSNotification *)aNotification{
[_moviePlayer.view removeFromSuperview];
_moviePlayer = nil;
}
- (void)moviePlayerWillExitFullscreen:(NSNotification*) aNotification {
[_moviePlayer stop];
[_moviePlayer.view removeFromSuperview];
_moviePlayer = nil;
}