0

我叫lebron.mp4在我的資源文件夾中的MP4文件:如何使用MPMoviePlayerViewController在本地播放電影?

-(IBAction)videoButtonClicked:(id)sender{ 
    NSString *url = [[NSBundle mainBundle] 
        pathForResource:@"lebron" 
        ofType:@"mp4"]; 

    MPMoviePlayerViewController* moviePlayerViewController = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL URLWithString:url]]; 

    moviePlayerViewController.view.backgroundColor = [UIColor blackColor]; 
    [self presentMoviePlayerViewControllerAnimated:moviePlayerViewController]; 

    [moviePlayerViewController release];  
} 

顯示的電影播放,但電影不播放。爲什麼?

回答

0

你嘗試像這樣顯示的:

[moviePlayerViewController play]; 
[window addSubview: MPMoviePlayerViewController.view]; 

相關問題