How can playerStateDidChange tell that a song is changing?
Right now, I am using the incoming playerstate uri to check if a new song has started playing. But if a user has the same song played twice, there is no way to tell that the queue has been popped from.
The only alternative I can think of is checking if the playback position of the incoming playerState is less than a second. But that could cause unexpected behavior.
When a song changes, a SPTAppRemoteSubscriptionEvent is logged in the console. Is there a way to parse what event its reporting?
This could be especially useful, considering events such as an enqueue trigger a change of playerstate as well. But all the developer is notified of is an updated playback position.
I'm having this same issue as well. Being able to tell when a song is changing is basically a necessity to creating an app that plays more than one song via the app remote. @rolflocher if you found any workaround in the past couple of months, would you mind pointing to an example?
@ChopinDavid I haven't found a workaround other than considering checking the playback position and crossing my fingers." Instead of doing that, we try to forbid having the same song twice in a row.
@rolflocher I just ended up giving up on the project just due to the difficulty. But yes, preventing the same song being queued twice was my initial only work around I could think of.
@kkarayannis playerStateDidChange is called 3-4 times when a song changes, within one second. Often the third call has a lesser playback position. Even for apps only using the Spotify SDK to reflect player state in UI, this is not expected behavior.
#248