I need to play a video in my UIViewcontroller using MPMoviePlayerController. So before playing the video i need to show an activity Indicator View before the video is buffered. Once the video starts playing i need to remove the Activity Indicator. I am not able to find out on how to get notified as soon as the video starts playing. Any suggestion on this would be of great help. Thanks.
Your probably looking for something like this:
- (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];
}
}
I also found that from this link which may help you out too: http://www.sdkboy.com/?p=48