2012-02-09 5 views
4

나는 모두 이상한 문제가 있습니다.MPMoviePlayerController가있는 특정 장치에서 헤드폰을 통해서만 소리가납니다.

MPMoviePlayerController은 비디오를 잘 재생하고 있으며 오디오는 헤드폰을 통해서만 재생됩니다.

진짜 끌림은 일부 iPad와 iPhone에서 발생합니다. 동일한 실제 시스템도 동일한 실제 시스템 !

여기 간단한 실패 예를 만들었습니다 : 나는 아이 패드 다음은 2

을 잘 실행하고 아이폰 4S, 아이폰 4와 실패 본 적이

http://www.porcaro.org/MPMoviePlayerController/TestMovie.zip

가장입니다 관련 코드.

(void)viewDidAppear:(BOOL)animated 
{ 
    [super viewDidAppear:animated]; 


    moviePath = [NSString stringWithFormat:@"%@/intro.m4v", [[NSBundle mainBundle] bundlePath]]; 
    NSURL *movieURL = [NSURL fileURLWithPath:moviePath]; 
    theMoviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:movieURL]; 

    controlStyle = MPMovieControlStyleEmbedded; 
    movieView = [self view]; 
    movieRect = [[self view] frame]; 
    controlStyle = MPMovieControlStyleFullscreen; 

    theMoviePlayer.controlStyle = controlStyle; 
    theMoviePlayer.view.userInteractionEnabled = YES; 

    if (1) { 
     NSLog(@"Created theMoviePlayer: %@. Playing: %@", theMoviePlayer, moviePath); 
    } 

    [[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerPlaybackStateDidChangeNotification object:nil]; 
    [[NSNotificationCenter defaultCenter] addObserver:self 
              selector:@selector(checkForEndOfMovie:) 
              name:MPMoviePlayerPlaybackStateDidChangeNotification 
              object:theMoviePlayer]; 

    // this line doesn't fix the problem                          
    //[theMoviePlayer prepareToPlay];                           
    [[theMoviePlayer view] setFrame:movieRect]; 
    [movieView addSubview: [theMoviePlayer view]]; 
    [theMoviePlayer play]; 
} 

답변

5

이 오래된 질문이다하지만 어쩌면 누군가를 도울 수 있습니다 : 덕분에 어떤 통찰력을 위해, 나뿐만 아니라 애플에 버그를 제출하겠습니다. 나는 똑같은 문제를 겪었고 전화가 조용한 모드에서만 일어난다는 것을 알았다.

해결 방법은 플레이어의 useApplicationAudioSession 속성을 false로 설정하는 것입니다.

[theMoviePlayer setUseApplicationAudioSession:NO]; 
0

이 문제는 iPad 2에서 mpMoviePlayer를 사용하여 비디오를 재생할 때 발생했습니다. 동영상은 완벽하게 재생되었지만 이어폰이 연결된 경우에만 오디오가 재생됩니다.

[theMoviePlayer setUseApplicationAudioSession:NO]; 
:

해결 방법이 문제를 해결하기 위해

관련 문제