0
스트리밍 비디오를 전체 화면으로 시작하고 사용자가 "완료"버튼을 누르는 간단한 방법을 쓰고 있습니다. 문제는 MPMediaPlayerController 뷰를 제거 할 수 없거나 잘못된 방법으로 처리하고있는 것입니다.MPMediaPlayerController보기 종료
- (IBAction)playVideoButtonPressed:(id)sender {
NSURL *url = [NSURL URLWithString:@"http://mysite.com/video.mov"];
mp = [[MPMoviePlayerController alloc] initWithContentURL: url];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlayerPlaybackDidFinish:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:nil];
if ([mp respondsToSelector:@selector(setFullscreen:animated:)]) {
mp.controlStyle = MPMovieControlStyleFullscreen;
mp.shouldAutoplay = YES;
[self.view addSubview:mp.view];
[mp.view setTag:3];
[mp setFullscreen:YES animated:YES];
}
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlayBackDidFinish:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:mp];
[mp play];
}
- (void)moviePlayBackDidFinish:(id)sender {
NSLog(@"Quitting MoviePlayer");
[mp.view removeFromSuperview];
}
아이디어는 MPMediaPlayerController보기는 응용 프로그램에서 버튼을 클릭라는 것을, 그리고 그것은 "완료"비디오를 클릭하거나 비디오가 끝으로 그라운드를 떠납니다.