2012-09-28 3 views
0
내가 동영상을 재생하려면 다음 코드를 사용하고

에 어떤 그림이 작동MPMoviePlayerController : 사운드하지만 아이 패드 1을 실행 iOS6의에서 전체 화면 모드

NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"myMovie.mov" ofType:@""]]; 
    self.moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url]; 

    // Register to receive a notification when the movie has finished playing. 
    [[NSNotificationCenter defaultCenter] addObserver:self 
              selector:@selector(moviePlayBackDidFinish:) 
               name:MPMoviePlayerPlaybackDidFinishNotification 
               object:self.moviePlayer]; 

    // Use the new 3.2 style API 
    self.moviePlayer.controlStyle = MPMovieControlStyleDefault; 

    [self.moviePlayer prepareToPlay]; 

    self.moviePlayer.view.frame = CGRectMake(0, 0, 1024, 768); 

    [self.uiView addSubview:self.moviePlayer.view]; 

    //[self.moviePlayer setFullscreen:YES animated:YES]; 

    [self.moviePlayer play]; 

.

그러나 setFullscreen의 줄의 주석 처리를 제거하면 영화 오디오는 나오지만 완전히 검은 색 화면이 나타나며 그림이 표시되지 않습니다.

몇 줄의 순서를 변경하려고 시도했습니다. 특히 play 호출과 setFullscreen 호출은 효과가 없습니다.

업데이트

이 질문에 직접 관련이 나타납니다
[[NSBundle mainBundle] pathForResource:@"myMovie.mov" ofType:@""]에 : 모든

MPMoviePlayerController in full screen issue (showing blank black screen)

+0

질문에 대한 답변이 아니지만 MPMoviePlayerViewController로 전환했습니다. 전체 화면 비디오에서 잘 작동합니다. – occulus

답변

0

첫 번째는이 라인 변경
[[NSBundle mainBundle] pathForResource:@"myMovie" ofType:@"mov"]을이

+0

아무런 변화가 없지만 이것이 영향을 주면 놀랄 것입니다. 당신이 가진 문제로 도움이 되었습니까? – occulus

0

를 사용하여 다시 시도 나를 위해 일하는 것처럼 :

NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"myMovie" ofType:@"mov"]]; 
MPMoviePlayerViewController *movieView = [[MPMoviePlayerViewController alloc]initWithContentURL:url]; 
movieView.moviePlayer.scalingMode = MPMovieScalingModeFill; 
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) 
     [movieView.moviePlayer.view setFrame:CGRectMake(0,0,480,320)]; 
else 
     [movieView.moviePlayer.view setFrame:CGRectMake(0,0,1024,768)]; 
movieView.moviePlayer.view.userInteractionEnabled = FALSE; 
movieView.moviePlayer.controlStyle=0; 
[movieView setFullscreen:YES]; 
self.view=movieView.view; 
+0

고마워요! 흥미 롭 군. 나는 당신에게 코드를 시도해 보았고, 차이를 만드는 비트가 마지막 줄이었다. 현재 뷰를 대체하기 위해 직접 영화 플레이어 뷰를 설정하여 비디오를 볼 수있게했다. 불행하게도 영화 플레이어는 영화를 옆에 보여줍니다! – occulus