我非常高興地看到,當升級到Xcode 4.5時,現在我的應用程序中沒有任何視頻可以播放。已安裝Xcode 4.5,MPMoviePlayerController不再工作
一般來說,我做這樣的事情:
self.moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:[self getBundleClip:@"theVideo"]];
self.moviePlayer.controlStyle = MPMovieControlStyleNone;
self.moviePlayer.shouldAutoplay = YES;
self.moviePlayer.repeatMode = MPMovieRepeatModeOne;
self.moviePlayer.view.frame = self.container.frame;
self.moviePlayer.view.userInteractionEnabled = NO;
[self.container addSubview:self.moviePlayer.view];
- (NSURL*)getBundleClip:(NSString*)clip
{
NSBundle *bundle = [NSBundle mainBundle];
NSString *moviePath = [bundle pathForResource:clip ofType:@"mp4"];
return [NSURL fileURLWithPath:moviePath];
}
再次,一切都完美地發揮我Xcode更新到4.5了。任何人都有這個問題?
我也得到這樣的輸出:
[MPAVController] Autoplay: Disabling autoplay for pause
[MPAVController] Autoplay: Disabling autoplay
This Works。如果shouldAutoPlay設置爲YES,放置prepareToPlay的最佳位置在哪裏?換句話說,如果你沒有明確地調用「play」,你怎麼能知道你在prepareToPlay實際開始播放前呢? – soleil
@soleil我不確定。該文檔沒有指定有關'shouldAutoPlay'行爲的詳細信息。嘗試嘗試交換調用兩種方法的順序,看看它是否有所作爲。 – ThomasW