2012-02-09 5 views
4

私はあなたにとって奇妙な問題があります。MPMoviePlayerControllerで特定のデバイスのヘッドフォンでのみ音が鳴る

MPMoviePlayerControllerはビデオをうまく再生しており、音声はヘッドフォンでのみ再生されます。

のiPadsとiPhoneで実際に同じことが起こるのは、同じ正確なモデル 同等のシステムを実行していることです。

私はここに簡単な失敗例を作成しました:ここ

を、私はそれが正常に動作し、iPhone 4Sに失敗見てきました

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

iPhone 4とiPad 2は、ほとんどです関連するコード。おかげで任意の洞察力のために、私もアップルにバグを提出するつもりです:

(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

この問題は、一度mpMoviePlayerを使用してのiPad 2上で動画を再生する私に起こるでした。ビデオは完全に再生されていましたが、オーディオはイヤホンが接続されているときにのみ発生この問題を解決するために

ソリューション:

[theMoviePlayer setUseApplicationAudioSession:NO]; 
関連する問題