You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Devs should definetly check that the URL provided when creating an AudioItem is valid and can be played. But there remains a case where the url can be broken later on, or it was never available. When this happens in a QueuedAudioPlayer it stops playing, I think a better solution is to skip to the next AudioItem in the queue.
Describe the solution or feature you would like
I've been playing around with a solution for this, and came up with the following code. I placed it inside the handleAudioPlayerPlaybackEnd handler, but I'm not sure if that's the right approach.
if let currentItem = audioManager.player.currentItem {
let currentPath = URL(string: currentItem.getSourceUrl())!.path()
let doesNotExist = !FileManager.default.fileExists(atPath: currentPath)
if doesNotExist {
print("File DOES NOT EXIST")
switch data {
case .failed:
let newIndex = audioManager.player.currentIndex + 1
try? audioManager.player.jumpToItem(atIndex: newIndex)
case .skippedToPrevious:
let newIndex = audioManager.player.currentIndex - 1
try? audioManager.player.jumpToItem(atIndex: newIndex)
default: break
}
}
}
Describe alternatives you've considered
I have not thought of any alternatives, but any feedback on this is welcomed.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
Devs should definetly check that the URL provided when creating an AudioItem is valid and can be played. But there remains a case where the url can be broken later on, or it was never available. When this happens in a QueuedAudioPlayer it stops playing, I think a better solution is to skip to the next AudioItem in the queue.
Describe the solution or feature you would like
I've been playing around with a solution for this, and came up with the following code. I placed it inside the
handleAudioPlayerPlaybackEnd
handler, but I'm not sure if that's the right approach.Describe alternatives you've considered
I have not thought of any alternatives, but any feedback on this is welcomed.
The text was updated successfully, but these errors were encountered: