4

皆さんにとって奇妙な問題があります。

MPMoviePlayerControllerはビデオを正常に再生しており、オーディオはヘッドフォンでのみ再生されます。

本当のドラッグは、これが一部のiPad と iPhone でのみ発生することです。

ここに簡単な失敗例を作成しました。

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

iPhone 4S、iPhone 4、および iPad 2 で正常に動作し、失敗するのを見てきました。

これが最も関連性の高いコードです。洞察に感謝します。Apple にもバグを送信します。

(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];
}
4

2 に答える 2

5

これは古い質問ですが、誰かの助けになるかもしれません。同じ問題に遭遇し、電話がサイレント モードのときにのみ発生していることがわかりました。

解決策は、プレーヤーの useApplicationAudioSession プロパティを false に設定することです。

[theMoviePlayer setUseApplicationAudioSession:NO];
于 2012-09-30T00:59:33.557 に答える
0

この問題は、mpMoviePlayer を使用して iPad 2 でビデオを再生したときに発生しました。ビデオは完全に再生されましたが、オーディオはイヤホンを接続したときにしか聞こえません。

問題を解決するための解決策:

[theMoviePlayer setUseApplicationAudioSession:NO];
于 2013-03-21T07:37:28.450 に答える