我想用 MPMoviePlayerViewController 播放视频。所以在我的视图控制器中,我注册为MPMoviePlayerLoadStateDidChangeNotification
.
然后我初始化 MPMoviePlayerViewController:
self.mPlayerVC = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL URLWithString:@"<videoURL>"]];
并等待通知到达。当它执行此代码时:
MPMoviePlayerController* playerController = notification.object;
if ([playerController loadState] & MPMovieLoadStatePlayable) {
if (self.mPlayerVC) {
[self presentMoviePlayerViewControllerAnimated:self.mPlayerVC];
}
}
任何人都知道为什么这适用于 iOS 5 但不适用于 iOS 6?谢谢