Closed 0xacdc closed 1 year ago
Hi @0xacdc
Have you found a solution to replace playing items in the end?
HI @yoheimuta,
a solution may be:
/**
Clear player datasource
*/
public func clearPlayingItems() {
player?.pause()
masterQueuedItems.removeAll()
queuedItems.removeAll()
}
but after it will need:
private func play(atIndex index: Int) -> Observable<()> {
if player != nil && playIndex == index && status == .paused {
return resume()
}
player?.pause()
guard queuedItems.indices.contains(index) else {
return .just(())
}
...
but because of return of empty Observable, there is no way to notify about what happened, and this is not the perfect solution
@0xacdc Thanks for getting back to me. So, just to clarify, you haven't found a workaround yet, is that correct? And you closed the issue because a fix is no longer needed?
Yes, for the moment I switched to high priority tasks. But I think It is a important and obvious feature for any player, how to play a list of tracks, and when user is selecting another track from another playlist replace entire queue ?
If I need to completely replace playing items, the only way to do this seems to be:
But this does not work. The
remove
will throw error when index will matchplayIndex
, so if I'd like to callplay(at: index_from_the_new_items)
it will not be the one I want.So, what is the solution to stop the player, replaces all items. add new ones and play from desired index ?