0

OSX でゲームを開始する前に紹介ビデオを再生したいと考えています。AVPlayer をセットアップしてビデオを再生する最も簡単な方法は何ですか? ゲームが先に進む前に、ビデオを完全に再生したいと思います。

Mac 開発者ライブラリで AVPlayer のドキュメントを確認しましたが、OSX アプリで次の問題が発生しました: AVPlayer でビデオが表示されない

助けてください!

4

1 に答える 1

0

したがって、スプラッシュ スクリーンの後、最初のビュー コントローラーは次のようになります。

-(void) playMovieAtURL: (NSURL*) theURL {





 MPMoviePlayerController* theMovie =

                [[MPMoviePlayerController alloc] initWithContentURL: theURL];



    theMovie.scalingMode = MPMovieScalingModeAspectFill;

    theMovie.movieControlMode = MPMovieControlModeHidden;



    // Register for the playback finished notification

    [[NSNotificationCenter defaultCenter]

                    addObserver: self

                       selector: @selector(myMovieFinishedCallback:)

                           name: MPMoviePlayerPlaybackDidFinishNotification

                         object: theMovie];



    // Movie playback is asynchronous, so this method returns immediately.

    [theMovie play];

}



// When the movie is done, release the controller.

-(void) myMovieFinishedCallback: (NSNotification*) aNotification

{

    MPMoviePlayerController* theMovie = [aNotification object];



    [[NSNotificationCenter defaultCenter]

                    removeObserver: self

                              name: MPMoviePlayerPlaybackDidFinishNotification

                            object: theMovie];



    // Release the movie instance created in playMovieAtURL:

    [theMovie release];

}

詳細: https://developer.apple.com/library/ios/documentation/audiovideo/conceptual/multimediapg/UsingVideo/UsingVideo.html

myMovieFinishedCallback で、ゲームのメニューを表示できます。

お役に立てば幸いです:)

于 2014-07-16T07:41:30.233 に答える