My problem is: I am trying to do seamless looping (I intend to make my AVPlayer or AVPlayerQueue, loop without any delay between playbacks). So for example, if I do a video and go to the playback, it should be looping endlessly without any blips in between or delays in the looping.
I have written the code below (its straight from example code too):
var playerQQ: AVQueuePlayer!
var playerLayur: AVPlayerLayer!
var playerEyetem: AVPlayerItem!
var playerLooper: AVPlayerLooper!
func playRecordedVideo(videoURL: URL) {
playerQQ = AVQueuePlayer()
playerLayur = AVPlayerLayer(player: playerQQ)
playerLayur.frame = (camBaseLayer?.bounds)!
camBaseLayer?.layer.insertSublayer(playerLayur, above: previewLayer)
playerEyetem = AVPlayerItem(url: videoURL)
playerLooper = AVPlayerLooper(player: playerQQ, templateItem: playerEyetem)
playerQQ.play()
}
The code above does not loop seamlessly; it has blips in-between the end of the current Player and the next one. I have tried a lot to find the problem and searched it online and have not found a solution. Also, I've been trying NSNotifications and other methods including setting Player.seek(to: zero) when the player finishes playback. But nothing has worked at all.
Any help would be appreciated :)