Find out if MPMoviePlayerController is currently playing

user464193 picture user464193 · Apr 26, 2011 · Viewed 11.2k times · Source

I have one small problem regarding MPMoviePlayerController, i have a link that play movie when i click on that movie button, however when i click on another button the application gets crashed, i need to find how to identify that movie is playing or getting any kind of response

Answer

visakh7 picture visakh7 · Apr 26, 2011

To expand on @Saurabh's answer you can check if the video is playing by

if(player.playbackState == MPMoviePlaybackStatePlaying)
{
// is Playing
}

where MPMoviePlaybackState is defined as

enum {
   MPMoviePlaybackStateStopped,
   MPMoviePlaybackStatePlaying,
   MPMoviePlaybackStatePaused,
   MPMoviePlaybackStateInterrupted,
   MPMoviePlaybackStateSeekingForward,
   MPMoviePlaybackStateSeekingBackward
};
typedef NSInteger MPMoviePlaybackState;