clementine-player / Clementine

:tangerine: Clementine Music Player
https://www.clementine-player.org/
GNU General Public License v3.0
3.72k stars 671 forks source link

Resume playback on startup - playback_state and playback_position not written to registry on exit #4560

Open sestras opened 9 years ago

sestras commented 9 years ago

Platform: Windows 7 Home Premium SP1 x64 (all current updates installed) Version: Clementine 1.2.3

The "resume playback on startup" feature is supposed to write two registry entries "playback_state" and "playback_position" in "HKEY_CURRENT_USER\Software\Clementine\Clementine\MainWindow" when exiting the program. It only does so if you exit via the "Exit" menu entry (or Ctrl-Q), but not when closing the program via the top right window X button.

This can cause problems if you close the program via "Exit" while playing a track f.e. at time 4:30 and this gets written to the registry. If you start again, it resumes as intended, but then if you switch to another track that is f.e. only 3:00 long and close the program via X, the new position does not get written to the registry, but the program remembers the currently playing song. At the next startup, it tries to resume the 3:00 song at time 4:30, which causes the program to freeze for some time.

I've currently avoided the issue by saving the position to 0:05 in the registry, because every track in my playlist is at least 5 seconds long, so the above freeze doesn't happen. But I guess that's not working as the feature was intended.

My guess is that the registry entries are only written in the "Exit" menu item event handler and not in the on_close event handler (or however they are called in Qt).

ppkt commented 9 years ago

Yes, this problem is still present - at least first part, about not storing playback state / position, after clicking [X] button. It seems like "Exit" and [X] are complete different actions from Clementine's point of view, but, to be honest, I have no clue why. I'll take a look on this issue and I'll propose a fix, but I'm not sure if it'll be accepted :)

ghost commented 8 years ago

1.3.1 stable and latest builds forget position, doesnt resume playback after restart. Switching back to ClementineSetup-1.2.2-549-g8919b73 which only has occasional errors.

ghost commented 7 years ago

Using ClementineSetup-1.3.1-267-g265f27a now. Please implement this. It is very much needed when listening to big sets/mixes. Clementine remembers position for a short period, but after longer time or after sleep/restart it start the track from the beginning.