2012-07-16 86 views

回答

1
MPMoviePlayerController *player = [[MPMoviePlayerController alloc]initWithContentURL:[NSURL fileURLWithPath:@"yourVideoPath"]]; 
player.shouldAutoplay=YES; 
player.view.frame = CGRectMake(0.0, 0.0, 480.0, 320.0); 
player.movieSourceType = MPMovieSourceTypeFile;  
player.controlStyle = MPMovieControlStyleEmbedded; 

[self.view addSubview:player.view]; 

這應該可以解決您的問題。嘗試和測試

+0

這讓我玩,但不會自動播放。是否可以打開應用程序並開始播放而不必按播放按鈕? – zhikeong 2012-07-18 01:31:13

+0

您是否閱讀過有關MPMoviePlayerController的文檔?你需要知道的一切都在那裏。 – Dancreek 2012-07-19 12:59:48

+0

Nvm我剛找到答案。 – zhikeong 2012-07-20 05:28:34

相關問題