player: restart playback when eof reached#17934
Conversation
|
What is wrong with |
Some use cases of SMTC control is when the user does not have immediate access to the keyboard or the mpv window is minimized to background, using smtc buttons will be more convenient. Also if --keep-open=yes is set, pressing play via SMTC at EOF simply clears the pause state but does nothing else, pressing Play at the end of a track should restart it. |
This is how |
This comment was marked as resolved.
This comment was marked as resolved.
06197e2 to
0feabf1
Compare
0feabf1 to
80d632e
Compare
|
I've moved EOF restart logic to common player path, tested locally without issues. sorry if I missed something |
the context has been set to KEEP_PLAYING in handle_keep_open, assuming there's no need to set again
|
After moving changes into common player path, seems related to #11183 now; the keybind solution works in most cases, but not suitable for SMTC control. SMTC media controls issue an unpause request, keybinds did not cover this path. |
Description
When playback reaches EOF with--keep-open=yesand loop file is disabled, mpv keeps the file open and sets eof-reached. Pressing Play in SMTC currently only clears pause, but does not restart playback.This PR seeks to the beginning first ifeof-reachedis true, then unpause. Pressing Play while paused before EOF continues to behave as before.When playback reaches EOF with
--keep-open=yesand loop file is disabled, mpv keeps the file open and enters the EOF state. Since--keep-opennormally acts likeset pause yeson EOF, pressing Play or any other stuff that settingpause=noonly clears the pause state, but does not restart playback.This PR handles the EOF restart, when unpausing from a keep-open EOF state, mpv seeks back to the file start position before resuming playback.
This makes the behavior consistent across SMTC, osc display, keyboard bindings unpause.
Testing