Quick tip: Looping movie in iOS 5.1 on iPad1

Strange thing happens on iPad 1 – seems that using just:

moviePlayer.repeatMode = MPMovieRepeatModeOne;

is not enough, movie loops on simulator, as on iPad 2 and above, but not on iPad 1. To solve this issue, you have to subscribe to MPMoviePlayerPlaybackStateDidChangeNotification and inside do anything, so first:

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(movieStateDidChange:) name:MPMoviePlayerPlaybackStateDidChangeNotification object:moviePlayer];

then create method:

-(void)movieStateDidChange:(NSNotification *)notification{
    int i = 0;
}

Leave a Reply