librespot icon indicating copy to clipboard operation
librespot copied to clipboard

[connect] Transferring from librespot to other device resets position

Open FabioGNR opened this issue 11 months ago • 10 comments

Description

When I am playing a track on a librespot instance and want to transfer it to another device (e.g. desktop client) the track starts playing from the beginning again, instead of resuming at same position.

Version

librespot 0.6.0-dev 98e9703 (Built on 2025-01-25, Build ID: 3SEKFch1, Profile: debug)

How to reproduce

  1. Start playing a song on a librespot instance
  2. Wait a few seconds/minutes or seek to a position
  3. Transfer playback to a standard Spotify device (such as desktop client or mobile app)
  4. Notice that song restarts from beginning

Log

https://logpaste.com/SfhbnW4p

Host (what you are running librespot on):

  • OS: Linux
  • Platform: x86

FabioGNR avatar Jan 25 '25 11:01 FabioGNR

Something I just found out, after transferring back to desktop client and waiting for song to complete the next song will start at the intended timestamp.

So playing song $1 on librespot, transfer to desktop, song $1 plays from beginning. Song $2 loads and starts playing at the original position of song $1.

FabioGNR avatar Jan 25 '25 11:01 FabioGNR

Did you check against the official clients how they behave on transfer? That might be a limitation from the clients, even tho the later described behavior is quite weird.

photovoltex avatar Jan 25 '25 11:01 photovoltex

Yes, the official apps resume at the same position. I only have this issue when transferring from librespot, so maybe some information isn't correctly synced to other clients.

FabioGNR avatar Jan 25 '25 11:01 FabioGNR

Okay, good to know. I think I quickly tried to do it from the web player to the desktop client and it didn't seem to work. So maybe that was just a coincidence, or maybe the web player behave different again.

Anyhow, can you try to update the volume (wait around 2-3s) before transferring to an official client? That should definitely update the position. So maybe it's just missing the position update after 30 seconds that is usually send by the official clients.

photovoltex avatar Jan 25 '25 12:01 photovoltex

Hmm yeah this is strange. I tried the web player and first time it worked fine, but afterwards I have the same issue for all devices. To clarify, I was using Desktop client (linux) and Android client before.

After this any combination of devices restarted the song, however then I skipped to the next song and it works properly again, even on the web player.

However, going from librespot back to another client still resets the song.

With the volume trick it seems to still be resetting, even though I did see the "update position to 2:02.." message.

FabioGNR avatar Jan 25 '25 14:01 FabioGNR

Here's a recording showing the reset:

https://github.com/user-attachments/assets/3e44d805-6f56-4208-b7f3-b90b5b4c75a6

Here's a recording showing proper resume:

https://github.com/user-attachments/assets/0349dbf2-c446-47be-9389-4ddb127d8686

FabioGNR avatar Jan 25 '25 14:01 FabioGNR

Thanks for all the additional info :). To fix this we might probably need some tinkering with the data send to the server. So might take a while until this gets fixed.

photovoltex avatar Jan 25 '25 15:01 photovoltex

Just looked into this issue again. I usually test with the web-player and when transferring from librespot to the web-player it transfers correct, but when transferring to the desktop or mobile client it does seem to transfer with an incorrect state.

photovoltex avatar May 04 '25 18:05 photovoltex

Additionally it seems to only affect the liked songs? I couldn't reproduce the issue with the reset of the position in a playlist (had 3 tracks for easier inspection of the send state)

photovoltex avatar May 04 '25 18:05 photovoltex

So I did try to adjust some metrics and parameters that didn't quite match the state that the web or desktop player send, but it didn't seem to fix the issue.

Additionally I also noticed that it seems to not only affect the position, but also the index. The currently played track carries over correctly (except the position), but the next track will be the first track of the liked songs instead of the expected following track.

I currently don't have the time to look much further into the topic. Will try to do so if the time gives a bit more room :)

photovoltex avatar May 04 '25 19:05 photovoltex