我試圖從iPhone設備上的服務器上播放視頻。我使用下面的方法來實現,但是,它只能在模擬器中使用;和我的iPhone 4上。它不適用於iPhone 3G?MPMoviePlayerViewController意外退出
如果我在iPhone 3G上調用此方法,它會打開視頻模式屏幕,開始加載視頻,然後突然關閉模式屏幕。在控制檯中不顯示錯誤。
iPhone 3G已安裝4.0版本。我的iPhone 4有4.1版本。
有沒有其他人經歷過這個?
-(IBAction)playMedia{
NSString* url = [self.data objectForKey:@"url"];
//initialize the movie player
self.moviePlayerViewController = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL URLWithString:url]];
//show a background image while the user waits
moviePlayerViewController.view.backgroundColor = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"background.png"]];
moviePlayerViewController.moviePlayer.movieSourceType = MPMovieSourceTypeFile;
//show the movie
[self presentMoviePlayerViewControllerAnimated:moviePlayerViewController];
[moviePlayerViewController release];
}
您是否可以通過iOS 4獲得iPhone 3G以通過其他應用播放遠程視頻?一些人(包括我自己)在3G設備上運行iOS 4時遇到了很多問題。如果您在其他應用中遇到穩定性問題,請嘗試重新啓動設備,然後重試? – pix0r 2010-09-13 22:26:03