2012-06-27 88 views
0

我在使用MPMoviePlayerController時遇到問題。它不工作在ios 5只是一個黑屏顯示。甚至不會引發任何異常或任何錯誤。 這裏是我的代碼:MPMoviePlayerController無法在ios 5中工作

NSString *path = [[NSBundle mainBundle] pathForResource:@"cavity" ofType:@"mov"]; 
NSLog(@"%@",path); 
_movieController = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:path]]; 
[_movieController prepareToPlay]; 
[_movieController setFullscreen:NO]; 
[_movieController.view setFrame:CGRectMake(10, 25, 287, 213)]; 
[_movieController setControlStyle:MPMovieControlStyleEmbedded]; 

[_movieView addSubview:_movieController.view]; 
[_movieController play]; 

的_movieController對象已在.h文件中已宣告但仍然沒有在工作狀態。

回答

0

試試這個

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

[[mp moviePlayer] prepareToPlay]; 
[[mp moviePlayer] setUseApplicationAudioSession:NO]; 
[[mp moviePlayer] setShouldAutoplay:YES]; 
[[mp moviePlayer] setControlStyle:2]; 
[[mp moviePlayer] setRepeatMode:MPMovieRepeatModeOne]; 
[self presentMoviePlayerViewControllerAnimated:mp]; 
+0

這是行不通的。它繼續顯示負載和活動指標。仍然沒有播放電影。 – SunnyChattha

+0

你是否在瀏覽器中檢查該網址?它的一個文件是 – freelancer

+0

。我給出了該文件的路徑。 NSString * path = [[NSBundle mainBundle] pathForResource:@「cavity」ofType:@「mov」]; 但它只是顯示加載視圖 – SunnyChattha

相關問題