가로 세로 또는 세로로 비디오 전체 화면을 재생하는 MPMoviePlayerController
개체가 있습니다. 비디오가 재생되는 동안 방향을 회전시키고 비디오 재생이 시작되고 비디오 상태 표시 줄이 보이면 몇 초 이내에 회전을 수행하면 비디오가 내 탐색 막대를 끝낼 때 완벽합니다. 그러나 비디오 상태 표시 줄이 몇 초 동안 비디오가 재생 될 때까지 기다렸다가 방향을 회전하면 비디오가 끝날 때 navigationBar
이 부분적으로 상태 표시 줄 뒤에 숨겨집니다.navigationBar 및 MPMoviePlayerController의 동작이 매우 이상합니다. IOS 또는 내 오류의 버그?
이런 것을 본 적이 있습니까?
이 버그를 쉽게 다시 만들 수 있습니다. 새로운 Single View App을 만들고 버튼과 탐색 바를 추가했습니다. 비디오가 재생되는 동안 방향을 돌리면 전체 화면을 활성화하고 동영상 상태 표시 줄은 비디오가 끝나면 여전히 볼 수 있습니다. 모두 훌륭합니다. 그러나 비디오 상태 표시 줄이 사라진 후 회전하기를 기다리면 회전하고 비디오가 끝나면 탐색 모음이 상태 표시 줄 아래에 있습니다. 이미지보기 : 여기
내가 사용하고있는 간단한 코드입니다 : 나는 아래의 제안에 현재 어딘지 다음- (void) playMovie {
NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource: @"movie" ofType: @"mov"]];
moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL: url];
[[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector(moviePlayBackDidFinish:)
name: MPMoviePlayerPlaybackDidFinishNotification
object: moviePlayer];
moviePlayer.controlStyle = MPMovieControlStyleDefault;
moviePlayer.shouldAutoplay = YES;
[self.view addSubview: moviePlayer.view];
[moviePlayer setFullscreen: YES animated: YES];
- (void) moviePlayBackDidFinish: (NSNotification *) notification
MPMoviePlayerController *player = [notification object];
[[NSNotificationCenter defaultCenter] removeObserver: self
name: MPMoviePlayerPlaybackDidFinishNotification
object: player];
if ([player respondsToSelector: @selector(setFullscreen:animated:)])
{
[player.view removeFromSuperview];
}
입니다. 불행히도 나는 여전히 같은 문제가 있기 때문에 나는 틀린 것이있을 것입니다. 여기
는 방법onPlayerWillExitFullScreen
UIView *view = [[[UIApplication sharedApplication] delegate].window.subviews lastObject];
if (view) {
[view removeFromSuperview];
[[[UIApplication sharedApplication] delegate].window addSubview:view];
}
MPMoviePlayerController *player = [aNotification object];
[[NSNotificationCenter defaultCenter] removeObserver: self
name: MPMoviePlayerWillExitFullscreenNotification
object: player];
이며, 여기에 내 현재 playMovie
방법 : 당신이 MPMoviePlayerWillExitFullscreenNotification 알림을 수신하는 경우
NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource: @"movie" ofType: @"mov"]];
moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL: url];
[[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector(moviePlayBackDidFinish:)
name: MPMoviePlayerPlaybackDidFinishNotification
object: moviePlayer];
[[NSNotificationCenter defaultCenter]addObserver: self
selector: @selector(onPlayerWillExitFullScreen:)
name: MPMoviePlayerWillExitFullscreenNotification
object: self.moviePlayer];
moviePlayer.controlStyle = MPMovieControlStyleDefault;
moviePlayer.shouldAutoplay = YES;
[self.view addSubview: moviePlayer.view];
[moviePlayer setFullscreen: YES animated: YES];
스크린 샷 또는 두 개를 포함 할 수 있습니다. –
Jeff에게 제안을 주셔서 감사합니다. –
스크린 샷에 대한 링크가 끊어졌습니다. – JonasCz