2013-10-11 62 views
2

我有一個iOS的7前工作一碼,經過更新的電影不是在玩:MPMoviePlayerViewController不工作在iOS 7

-(void)setMovie:(NSURL *)newMovie autoPlay:(BOOL)autoPlay 
{ 
    movieView_ = [[MPMoviePlayerViewController alloc] initWithContentURL:newMovie]; 
    [movieView_.view setContentMode:UIViewContentModeScaleAspectFit]; 
    [movieView_.moviePlayer setShouldAutoplay:NO]; 
    movieView_.moviePlayer.view.frame=self.view.frame; 
    [movieView_.moviePlayer setControlStyle:MPMovieControlStyleFullscreen]; 
    [movieView_.moviePlayer setMovieSourceType:MPMovieSourceTypeFile ];  
    [movieView_.moviePlayer prepareToPlay]; 
    id currentPhotoView = [photoViews_ objectAtIndex:currentIndex_]; 
    [currentPhotoView addSubview:movieView_.moviePlayer.view]; 
    [movieView_.moviePlayer play];  
} 

不知道是什麼問題,並且應用程序不崩潰。

+0

你想從YouTube或其他來源播放視頻,請在這裏顯示任何鏈接,這樣我就可以嘗試給你正確的建議。 – Pratik

+0

感謝Pratik,我從文檔目錄播放電影,並且我在scrollView控制器中顯示了movieView。 – ANeme

+0

url值:file://localhost/var/mobile/Applications/C4FF3792-E70E-4540-8C03-0B86830E05A5/Documents/Main%20Album/images/picture-10112013-00000.MOV – ANeme

回答

0

你實際上需要出示MPMoviePlayerViewController:

[self presentViewController: _movieView_ animated: YES completion: nil]; 

使用的MPMoviePlayerController如果你想在屏幕的一部分播放。

+0

謝謝dorada,我無法呈現movieView,我將它添加到scrollView中。 – ANeme

+0

MPMoviePlayerController是爲你準備的。 –