1

アプリケーションの起動時にビデオを再生する必要がある

私のコードは Iphone Ipad Simulator で完全に動作します

しかし、デバイス上では物理的に Ipad ではありません

どうしたの??

- (void)viewDidLoad
    {

         if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {

            NSURL* url = [[NSBundle mainBundle] URLForResource:@"Intro3" withExtension:@"mp4"];

            m_player = [[MPMoviePlayerController alloc] initWithContentURL:url];
            [m_player.backgroundView setBackgroundColor:[UIColor blackColor]];
            [m_player.view setBackgroundColor:[UIColor blackColor]];
            [m_player setControlStyle:MPMovieControlStyleNone];
            [[m_player view] setFrame:[self.view bounds]];

            [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlayBackDidFinish:) name:MPMoviePlayerPlaybackDidFinishNotification object:nil];
            [m_player play];
            [self.view addSubview:[m_player view]];

            }
            else{
               ---play video in iphone---
            }

    }
4

2 に答える 2

2

コードは完全に機能します!!!

問題は、ビデオの解像度が大きすぎることでした。

サイズを変更して機能しました=)

于 2012-11-11T19:47:33.650 に答える
0

代わりにMPMoviePlayerViewControllerを使用することをお勧めします。

 if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {

            NSURL* url = [[NSBundle mainBundle] URLForResource:@"Intro3" withExtension:@"mp4"];

            MPMoviePlayerViewController * controller = [[MPMoviePlayerViewController alloc]initWithContentURL:url];
            [self  presentMoviePlayerViewControllerAnimated:controller];
            [controller release];
}
于 2012-11-11T19:05:32.727 に答える