2010-10-04 101 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]; 
相關問題