spotify / android-sdk

Spotify SDK for Android
https://developer.spotify.com/documentation/android/
Apache License 2.0
473 stars 120 forks source link

Jump to track in the context of an album #11

Open FlorianLoch opened 6 years ago

FlorianLoch commented 6 years ago

This is not a bug, it's more a feature request - but perhaps this is already possible and I just didn't see how to do it.

I want to store the current position in a track to be able to lateron resume at the same position. Getting information about position and current track is easy, the same is resuming. The problem which I am currently are unable to solve is that I want the context of the track to stay the same so that the subsequent track played is the same as it would have been when playing without interruption.

Is there any way to do this with the current SDK?

I am using version 0.4.0 on Android 8 with the most recent version of the Spotify app for Android.

Thanks for your help!

FlorianLoch commented 6 years ago

This is possible via the Web API via the "context" option in combination with the "offset" property (https://developer.spotify.com/console/put-play/) - so it should not be impossible to provide the same feature with this SDK I guess... any chance implementing this will be considered in the near future?

FlorianLoch commented 5 years ago

Any updates or official statement on this? I currently implemented my poc with the Web API - but this has severe drawbacks so I am still wondering whether this gap between native and web API might be tackled at some point? Would be awesome if this could be considered!

FlorianLoch commented 4 years ago

I would like to reopen this issue as I am not sure I actually has been resolved - at least I don't see. I was very excited when I got the notification that something was going on in this thread and finally found the time to have a look at what has been added. If I got it right the skipToIndex() method has been added. And it would solve my issue of being unable to restore the playback state within a given context IF (and I don't see how to efficiently do this especially offline) I would be able to get the index of the currently playing track withing its context, i.e. the current album or playlist. To me it seems we are now able to skip to an index, which is pretty neat, but as we cannot retrieve the index from the player state I have no idea to which index I actually want to jump. Could you please clarify on this? Probably I just missed something or got it all wrong ;)

Thanks a lot in advance!

mdelolmo commented 4 years ago

Hi @FlorianLoch I don't think you missed anything. The feature we developed doesn't seem to suit your needs. To solve your use-case, we either need to support "skip to track-uri" or provide the index in the player state.

I will bring it up to the team, because I think it makes sense.

Best, Manuel

FlorianLoch commented 4 years ago

Any news on this? I am currently working on the topic again, still using the workaround via the Web API (which is not really a workaround as controlling the phone via the Web API for all of my phones only works while Spotify is actually playing... so I can't start playback that way...) so I thought I might ask again ;)

FlorianLoch commented 3 years ago

Just stumpled over my project leading to this question again - so might I ask one more time whether there is any update on this? ;)

tobika commented 3 years ago

As you wrote in one of your previous messages I'm using skipToIndex() and I calculate the offset myself with the album information I downloaded before.

FlorianLoch commented 3 years ago

You mean by looping through the tracks contained in the album and checking for a match with the current tracks identifier? A good workaround, still, I think it's a pitty that this is possible with the Web API but not with the one for Android and the one for iOS. Do you know whether this works out offline? Assuming I have to album downloaded? If so this might be a viable approach for me :)

tobika commented 3 years ago

Yes exactly, agree that it's a pitty that we can't use the id.

Offline, personally I have the problem that I can't start playback when offline, but if I switch to airplane mode afterwards the next/prev function calls work. (if album downloaded)

FlorianLoch commented 1 year ago

Coming back to this 5 years later and actually still keen on developing the app I wanted to build back then... So, most likely there has been no update that would allow to play a track in a given context (like one can via the Web SDK)?