我需要使用 MPMoviePlayerController 在 UIViewcontroller 中播放视频。因此,在播放视频之前,我需要在视频缓冲之前显示事件指示器 View 。视频开始播放后,我需要删除事件指示器。我无法找到如何在视频开始播放后立即收到通知。对此的任何建议都会有很大帮助。谢谢。
最佳答案
您可能正在寻找这样的东西:
- (void)viewDidAppear:(BOOL)animated {
NSLog(@"VIEW DID LOAD");
// Register to receive a notification that the movie is now in memory and ready to play
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(movieLoadStateDidChange:)
name:MPMoviePlayerLoadStateDidChangeNotification
object:nil];
}
-(void)movieLoadStateDidChange:(id)sender{
NSLog(@"STATE CHANGED");
if(MPMovieLoadStatePlaythroughOK ) {
NSLog(@"State is Playable OK");
NSLog(@"Enough data has been buffered for playback to continue uninterrupted..");
aiv.hidden = YES;
[aiv stopAnimating];
}
}
我还发现这个链接也可能对您有帮助:http://www.sdkboy.com/?p=48
关于iphone - 如何使用 MPMoviePlayerController 在视频开始播放之前使用事件指示器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10999019/