Simple question I can\'t seem to find an answer to for some reason.
How do you loop AVPlayer in Swift?
numberOfLoops = -1 only works for AVAudioPlayer
<
Starting from iOS 10, there's no need to use notifications to loop a video, simply use a AVPlayerLooper, just like this:
let asset = AVAsset(url: videoURL)
let item = AVPlayerItem(asset: asset)
let player = AVQueuePlayer(playerItem: item)
videoLooper = AVPlayerLooper(player: player, templateItem: item)
make sure this looper is created outside of a function scope, in case it stops when function returns.