AudioStreaming
AudioStreaming copied to clipboard
Remove from queue
Thanks for this project it looks really promising! I want to use this for my audio playback application, but while it is possible to enqueue tracks it is not possible, at least using the public api, to dequeue them. Making this part of the public api would be great
Hey, thanks for raising this.
Could you provide a set of possible methods you'd like to see? The simplest case would be to only dequeue the last item added, but perhaps there may be more cases.
This will also be a good stress test for this library queue mechanism
I would love to use this library for my music streaming app. Naturally the user has quite a lot of control over the queue, so some methods are essential.
Right now I am using AVQueuePlayer
, it has only a few methods, but they provide great functionality.
- A
insert(url, at)
index function would be great, it would be useful if a user wants to modify the queue or play a track right after the current one, skipping the queue - A method to clear the queue would be nice, although not required
- Some way to get the amount of tracks in the queue, either by returning all urls or just the count
- Something like
remove(at)
to dequeue a track at a specific index, for example when a track is moved around
Thanks for the fast response!
I think providing methods with index
might complicate things, as you would have to have access to more underlying logic. This is why AVQueuePlayer handles everything with AVPlayerItem
We could almost create the same methods as AVQueuePlayer
but instead of AVPlayerItem
it will be URL
or can make a somewhat breaking change and introduce a AudioPlayerItem
that wraps a URL
var currentQueue: [URL] // or as a method
func queue(url: URL, after: URL?)
func remove(url: URL)
func playNextInQueue() // advanceToNextItem()
func stop(clearsQueue: Bool) // removeAllItems()
I literally had linked lists and queues / stacks as a topic in school about a year ago and my finals will also contain questions about them, so this is a certified smooth brain moment. I thought using the index would be simpler...
These methods would be awesome, as they would enable this library to be a more or less drop in replacement for AVQueuePlayer
. Thanks a lot!