I am using an AVQueuePlayer in my app. I have a two swipe gestures to skip to next and skip to previous avplayeritems. Right now to do skip to next I am just ca
You can replace your current item with the previous and add the item, that was replaced:
let previousItem = AVPlayerItem(url: url )
let currentItem = AVPlayerItem(url: currentUrl)
player.replaceCurrentItem(with: previousItem)
if player.canInsert(currentItem, after: previousItem) {
player.insert(currentItem, after: previousItem)
}
// OR like this
let previousItem = AVPlayerItem(url: url )
if let currentItem = player.currentItem {
player.replaceCurrentItem(with: previousItem)
if player.canInsert(currentItem, after: previousItem) {
player.insert(currentItem, after: previousItem)
}
}