Is there a relatively easy way of looping a video in AVFoundation?
I've created my AVPlayer and AVPlayerLayer like so:
avPlayer = [[AVPlayer playerWithURL:videoUrl] retain];
avPlayerLayer = [[AVPlayerLayer playerLayerWithPlayer:avPlayer] retain];
avPlayerLayer.frame = contentView.layer.bounds;
[contentView.layer addSublayer: avPlayerLayer];
and then I play my video with:
[avPlayer play];
The video plays fine but stops at the end. With the MPMoviePlayerController all you have to do is set its repeatMode
property to the right value. There doesn't appear to be a similar property on AVPlayer. There also doesn't seem to be a callback that will tell me when the movie has finished so I can seek to the beginning and play it again.
I'm not using MPMoviePlayerController because it has some serious limitations. I want to be able to play back multiple video streams at once.