Smooth video looping in iOS
avplayer, ios, ios5, movie, mpmovieplayercontroller
Solution
I can concur @SamBrodkin's findings.
[[NSNotificationCenter defaultCenter]
addObserver: self
selector: @selector(myMovieFinishedCallback:)
name: MPMoviePlayerPlaybackStateDidChangeNotification
object: m_player];
and
-(void) myMovieFinishedCallback: (NSNotification*) aNotification
{
NSLog( @"myMovieFinishedCallback: %@", aNotification );
MPMoviePlayerController *movieController = aNotification.object;
NSLog( @"player.playbackState = %d", movieController.playbackState );
}
fixed the non-looping issue on iOS 5 for me too.
Problem
Can anyone suggest a method by which you can achieve a completely smooth and seamless looping of a video clip in iOS? I have tried two methods, both of which produce a small pause when the video loops 1) AVPlayerLayer with the playerItemDidReachEnd notification setting off seekToTime:kCMTimeZero I prefer to use an AVPlayerLayer (for other reasons), but this method produces a noticeable pause of around a second between loops. 2) MPMoviePlayerController with setRepeatMode:MPMovieRepeatModeOne This results in a smaller pause, but it is still not perfect. I'm not sure where to go from here. Can anyone suggest a soultion?