Merged requested to merge neobrain/funkwhale:fix_resume_on_sleep into develop
MediaSession pause requests may happen even when Funkwhale is already in a paused state. Previously FW would flip between play/pause without consideration for the current state instead of doing nothing when the playback state matches the requested one.
Notably, this made Funkwhale resume audio playback when entering sleep mode on my system.
NOTE: My first attempt at fixing this used the
navigator.mediaSession.playbackState property to read the requested from within
togglePlay. That doesn't seem to work though, since at least on my browser (Firefox), that property is always
None (perhaps for fingerprinting protection).
Pause/Play button in the UI works as expected
Going to sleep pauses a playing track
Going to sleep does not resume a paused track
Pressing "p" toggles pause/play