in Controller.h add
AVPlayer *myplayer;
in Controller.m add
#import <CoreMedia/CoreMedia.h>
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(playerItemDidReachEnd:)
name:AVPlayerItemDidPlayToEndTimeNotification
object:[myplayer currentItem]];
[myplayer play];
and add function from selector
- (void)playerItemDidReachEnd:(NSNotification *)notification {
AVPlayerItem *playerItem = [notification object];
[playerItem seekToTime:kCMTimeZero];
[myplayer play];
}
This helps me iterate over the video, but you need to cache it somehow (for a smooth loop)
source
share