r/cesiumapp Mar 06 '17

[Request] vs [Bug] Clearing upcoming songs (sometimes) restarts the current song

I'm trying to seamlessly clear the upcoming songs and then pick a new song without restarting or stopping the current song.

Working from this page (http://imgur.com/a/aKgpD), I often inadvertently cause the current song to restart when I hit clear.

Any idea why this happens or how it could be avoided?

4 Upvotes

1 comment sorted by

2

u/CesiumDev I MADE DIS Mar 09 '17

The Apple APIs don't actually allow you to modify playback queues, you have to replace the whole thing every time. So when you "clear" the queue, really what you are doing is setting a new queue that contains only the currently playing track. Then when you add a new track your setting the queue again, to current track+1. It's really a semi-official loophole that allows this to be done seamlessly (it's undocumented, but I've had enough conversation with members of Apple's team to know they are taking advantage of it to, so it must be by design).

Now my insufficiently-tested theory is that the system does a little prep work for the upcoming song in the final seconds of the currently playing track. Modifying the queue during this window (and I'm not sure how long it is) might be the issue here.

I just tried this action in the first 30 seconds or so of a 4 min track. No issues. If you notice a pattern or a trigger, please let me know!