spotify / android-sdk

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

Error trying to seek, cannot seek song #158

Closed sarahsnow1 closed 4 years ago

sarahsnow1 commented 4 years ago

Issue found on 11/3/19.

SDK Version: spotify-app-remote-release-0.6.3

OS Version: Pixel 2, Android 10

Scope(s): PlayerApi

Steps to reproduce:

  1. Connect Spotify:

    
    SpotifyAppRemote.connect(context, connectionParams,
                object : Connector.ConnectionListener {
                    override fun onConnected(spotifyAppRemote: SpotifyAppRemote) {
                         playTrack(spotifyAppRemote)
                    }
    
                    override fun onFailure(throwable: Throwable) {
                        Timber.e(throwable.message, throwable)
                    }
                })

fun playTrack(spotifyAppRemote: SpotifyAppRemote) { spotifyAppRemote?.playerApi?.play("spotify:track:3igFZtMWk9d0s6w8D9lwxT")?.setResultCallback { spotifyAppRemote?.playerApi?.seekTo(30000)?.setResultCallback { }?.setErrorCallback { Timber.d("Error trying to seek ${it.localizedMessage}") } }?.setErrorCallback { Timber.d("Error trying to play ${it.localizedMessage}") } }


2. See that Spotify connects and that `playTrack(spotifyAppRemote)` is called
3. See that track starts to play but that track is not seeked to given position
4. See that error is logged when trying to seek track: `Error trying to seek {"message":"Cannot seek in song: [UNKNOWN]"}`

#### Expected behaviour:
Track starts playing and is seeked to 30 seconds

#### Actual behaviour:
Track starts playing but is not seeked

Why can't this track be seeked? Are there known tracks which are seekable? Not sure if this is relevant but I'm playing around with developing an app to share tracks between friends. Thanks for your help!
anscash commented 4 years ago

I also have this error. @Spotify: A "play track from any starting position", like in the WEB API would be nice

anscash commented 4 years ago

@mdelolmo Hi Manuel! Is this bug also fixed in 0.7? Anyway, are there any bugs fixed in 0.7 beside the new feautres written in the changelog?

mdelolmo commented 4 years ago

@anscash Are you describing the functionality to start a track at a given offset/timestamp? We don't have that functionality on the SDK, but I will add it to the backlog if that is what you are asking.

anscash commented 4 years ago

@mdelolmo Thanks for your reply. Start a track at a given offset is exactly my goal. I would REALLY appreciate if this feature would be added to the SDK. But in the meanwhile, i thought i could realize this "feature" by play & seekTo immediately afterwards. Here is where the error comes in. I remember, back in the days of v.0.5, this error didnt occure, i was able to play&seekTo to realize thia functionality...

With kind regards anscash

mdelolmo commented 4 years ago

@anscash Yes, that makes sense. But just to answer your question, first we will six the synchronicity issue on the Spotify client (no new SDK version required) and in addition I will add your feature request to our backlog.

veronikapetruskova commented 4 years ago

Hi @anscash @sarahlensing This issue should be fixed in Spotify app version 8.5.35 once it's out. Please let us know in case you would still have problems.

rohit-ganapathy commented 4 years ago

Hi @mdelolmo I as well was wondering when the play track from anywhere functionality would go live

SajWorks commented 2 years ago

Hello, I'm still experiencing this exact same error in 2022 when trying to use seekTo() immediately after calling play(). I'm running version 8.7.58.461 of the Spotify app. Any word on adding the ability to start a track at a specific playback position to the SDK? Thank you!

i-jared commented 1 year ago

I'm having to put in a 0.5 second delay before attempting to seek to avoid the error