2010-10-04 142 views
2

我使用下面的代码来播放url的视频,但是当视频加载时只播放音频并且没有视频显示在模拟器上..现在我无法在iphone 4.0设备上测试它...有没有与模拟器的问题或者是MPMoviePlayerViewController是不是正确的方法?MPMoviePlayerViewController只在模拟器上播放音频没有视频?

NSString *videoFilepath = @"http://www.migital.com/Hemant/1.3gp"; 
NSURL *videoURL = [NSURL URLWithString:videoFilepath ]; 

MPMoviePlayerViewController *movie = [[MPMoviePlayerViewController alloc] initWithContentURL:videoURL]; 


[[NSNotificationCenter defaultCenter] addObserver:self 
             selector:@selector(playbackFinishedCallback:) 
              name:MPMoviePlayerPlaybackDidFinishNotification 
              object:movie]; 

[self presentMoviePlayerViewControllerAnimated:movie]; 

回答

0

试试这个

NSString *videoFilepath = @"http://www.migital.com/Hemant/1.3gp"; 
NSURL *videoURL = [NSURL URLWithString:videoFilepath ]; 

MPMoviePlayerViewController *movie = [[MPMoviePlayerViewController alloc] initWithContentURL:videoURL]; 


[[NSNotificationCenter defaultCenter] addObserver:self 
             selector:@selector(playbackFinishedCallback:) 
              name:MPMoviePlayerPlaybackDidFinishNotification 
              object:[movie moviePlayer]]; 

[self presentMoviePlayerViewControllerAnimated:movie]; 
movie.moviePlayer.movieSourceType = MPMovieSourceTypeStreaming; 
[movie.moviePlayer play]; 
相关问题