Immediately update local player state on server change

If status replies are ignored, the result of a server play/pause command
could be ignored as well (since the old playing status would end up
being seen as a local restart), so set it immediately on dispatching
the player command.
This commit is contained in:
Peter Marheine 2015-10-15 17:35:05 -06:00
parent e9d25a69a0
commit d2ce799bfe

View File

@ -258,6 +258,10 @@ class SyncplayClient(object):
def _serverUnpaused(self, setBy):
hideFromOSD = not constants.SHOW_SAME_ROOM_OSD
# In high-player-latency situations we might report our state back to
# the server before any player status is accepted as fresh. Override
# the locally-stored playback state.
self._playerPaused = False
self._playerCommand(self._player.setPaused, False)
madeChangeOnPlayer = True
self.ui.showMessage(getMessage("unpause-notification").format(setBy), hideFromOSD)
@ -265,6 +269,7 @@ class SyncplayClient(object):
def _serverPaused(self, setBy):
hideFromOSD = not constants.SHOW_SAME_ROOM_OSD
self._playerPaused = True
if constants.SYNC_ON_PAUSE and self.getUsername() <> setBy:
self.setPosition(self.getGlobalPosition())
self._playerCommand(self._player.setPaused, True)