2011-07-06 6 views
0

を見たされていないonly.video、ビデオはiphone:ビデオこれは私がそれだけでサウンドを再生私のvideo.butをプレイしています、それを通して機能です

-(void)playMovieAtURL:(NSString *)moviePath 
    { 
     NSURL *movieURL=[NSURL URLWithString:moviePath]; 

     MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContentURL:movieURL]; 

     NSLog(@"url : %@",movieURL); 

     [player setControlStyle:MPMovieControlStyleDefault]; 

     [player setScalingMode:MPMovieScalingModeAspectFit]; 

     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(movieDidExitFullscreen:) name:MPMoviePlayerPlaybackDidFinishNotification object:player]; 

     [[player view]setFrame:[[self view]bounds]]; 
     [[self view] addSubview:[player view]]; 

     [player play]; 

    } 

答えて

0

MPMoviePlayerControllerを見たされていない音で遊んでは、単にありますそれが理にかなっていれば、実際に映画を表示することはできません。独自のビュー階層にビデオを埋め込む必要がある場合のみ、MPMoviePlayerControllerを使用してください。これは、フルスクリーンで再生していて、カスタムコントロールについて言及したので、あなたがそれを行う必要があるようには聞こえません。代わりに、MPMoviePlayerViewControllerを試してみてください。 URLからムービーをロードし、ネイティブコントロールでビデオを表示するのに必要なすべてを行います。 URLを使用してMPMoviePlayerViewControllerをインスタンス化し、それをモーダルビューとして表示するだけです。つまり、

MPMoviePlayerViewController *player = [[MPMoviePlayerViewController alloc]initWithContentURL:[NSURL urlWithString:moviePath]]; 
[self presentModalViewController:player]; 
[player release]; 
関連する問題