Help Wizard

Step 1

NEXT STEP

Tracking Position in Playlist

Solved!

Tracking Position in Playlist

My Question or Issue

I am attempting to get the current position in a playlist as the playlist is played. I have ran into 2 issues.

Issue #1: I get all of the playlist's track URI's and I get the URI of the current track. The issue is that the current track's URI doesn't exist in the playlist's URI list. This is apparently due to the song being released on a different playlist/album so it has more than one URI. 

Issue #2: In an attempt to solve the first issue, I decided to try to find the position using the song title(not ideal). This doesn't work because I have found songs that have a different name in the playlist than when I fetch the current track name(ie "- Acoustic" is added to the end).

 

My big question is: Is there a method of tracking the position in a playlist the user is currently listening to? Maybe a unique track identifier that I don't know about?

Reply

Accepted Solutions
Marked as solution

For Future Developers:
I managed to find a method of doing this properly. Using the 'play_state_changed' listener, the correct way to get the track uri is to use the 'linked_from' property that is returned when the state is changed. If this property is return null, then you should use the normal uri it provides. This will use the origin uri of the track rather than the second or third hand uri.

View solution in original post

1 Reply
Marked as solution

For Future Developers:
I managed to find a method of doing this properly. Using the 'play_state_changed' listener, the correct way to get the track uri is to use the 'linked_from' property that is returned when the state is changed. If this property is return null, then you should use the normal uri it provides. This will use the origin uri of the track rather than the second or third hand uri.

Suggested posts