MPMoviePlaybackState
Constants describing the current playback state of the movie player.
enum {
MPMoviePlaybackStateStopped,
MPMoviePlaybackStatePlaying,
MPMoviePlaybackStatePaused,
MPMoviePlaybackStateInterrupted,
MPMoviePlaybackStateSeekingForward,
MPMoviePlaybackStateSeekingBackward
};
typedef NSInteger MPMoviePlaybackState;
注册MPMoviePlayerPlaybackStateDidChangeNotification通知
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(MPMoviePlayerPlaybackStateDidChange:)
name:MPMoviePlayerPlaybackStateDidChangeNotification
object:nil]
检查此函数中的MPMoviePlaybackState
- (void)MPMoviePlayerPlaybackStateDidChange:(NSNotification *)notification
{
if (player.playbackState == MPMoviePlaybackStatePlaying)
{
}
if (player.playbackState == MPMoviePlaybackStateStopped)
{
}if (player.playbackState == MPMoviePlaybackStatePaused)
{
}if (player.playbackState == MPMoviePlaybackStateInterrupted)
{
}if (player.playbackState == MPMoviePlaybackStateSeekingForward)
{
}if (player.playbackState == MPMoviePlaybackStateSeekingBackward)
{
}
}
通过以下方式移除通知:
[[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerPlaybackDidFinishNotification object:nil]
参考:MPMoviePlaybackState