Gapless playback not working on latest dev code
See original GitHub issueDescribe the bug
There is a very noticeable gap of 0.2 to 1 second between tracks when playing Spotify music through librespot-java. I checked out the code and see two potential sources of the problem. 1. we call state.updated()
before trackHandler.pushToMixer(reason)
when about to play the next preloaded track. This invokes a network call that can take a long time to run. 2. we call trackHandler.seek(state.getPosition())
somewhat pointlessly when crossfading is not enabled.
To Reproduce Check out latest dev code on OS X, run librespot-java with no config changes (e.g. Zeroconf and no crossfade), then play something gapless. Examples tested - Dark Side of the Moon and Plastic Beach.
Expected behavior I expect to hear 0 gaps between the first and second tracks of the two example albums.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top GitHub Comments
This is an issue I’ve been putting aside for a while, but I guess it is time to move the state update calls to another thread. It is important to keep them in order so a queue is the more appropriate method. Will work on it.
It’s almost perfect now. I think there is an issue around the next track being seeked a couple of milliseconds - but we should track it separately.