Skip to content

Commit

Permalink
Never slowdown/rewind/fastforward due to time difference with yourself
Browse files Browse the repository at this point in the history
  • Loading branch information
Et0h committed Apr 6, 2015
1 parent 2f78748 commit c8912d1
Showing 1 changed file with 25 additions and 12 deletions.
37 changes: 25 additions & 12 deletions syncplay/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,17 +206,25 @@ def _initPlayerState(self, position, paused):
return madeChangeOnPlayer

def _rewindPlayerDueToTimeDifference(self, position, setBy):
hideFromOSD = not constants.SHOW_SAME_ROOM_OSD
self.setPosition(position)
self.ui.showMessage(getMessage("rewind-notification").format(setBy), hideFromOSD)
madeChangeOnPlayer = True
madeChangeOnPlayer = False
if self.getUsername() == setBy:
self.ui.showDebugMessage("Caught attempt to rewind due to time difference with self")
else:
hideFromOSD = not constants.SHOW_SAME_ROOM_OSD
self.setPosition(position)
self.ui.showMessage(getMessage("rewind-notification").format(setBy), hideFromOSD)
madeChangeOnPlayer = True
return madeChangeOnPlayer

def _fastforwardPlayerDueToTimeDifference(self, position, setBy):
hideFromOSD = not constants.SHOW_SAME_ROOM_OSD
self.setPosition(position + constants.FASTFORWARD_EXTRA_TIME)
self.ui.showMessage(getMessage("fastforward-notification").format(setBy), hideFromOSD)
madeChangeOnPlayer = True
madeChangeOnPlayer = False
if self.getUsername() == setBy:
self.ui.showDebugMessage("Caught attempt to fastforward due to time difference with self")
else:
hideFromOSD = not constants.SHOW_SAME_ROOM_OSD
self.setPosition(position + constants.FASTFORWARD_EXTRA_TIME)
self.ui.showMessage(getMessage("fastforward-notification").format(setBy), hideFromOSD)
madeChangeOnPlayer = True
return madeChangeOnPlayer

def _serverUnpaused(self, setBy):
Expand Down Expand Up @@ -252,15 +260,20 @@ def _serverSeeked(self, position, setBy):

def _slowDownToCoverTimeDifference(self, diff, setBy):
hideFromOSD = not constants.SHOW_SLOWDOWN_OSD
madeChangeOnPlayer = False
if self._config['slowdownThreshold'] < diff and not self._speedChanged:
self._player.setSpeed(constants.SLOWDOWN_RATE)
self._speedChanged = True
self.ui.showMessage(getMessage("slowdown-notification").format(setBy), hideFromOSD)
if self.getUsername() == setBy:
self.ui.showDebugMessage("Caught attempt to slow down due to time difference with self")
else:
self._player.setSpeed(constants.SLOWDOWN_RATE)
self._speedChanged = True
self.ui.showMessage(getMessage("slowdown-notification").format(setBy), hideFromOSD)
madeChangeOnPlayer = True
elif self._speedChanged and diff < constants.SLOWDOWN_RESET_THRESHOLD:
self._player.setSpeed(1.00)
self._speedChanged = False
self.ui.showMessage(getMessage("revert-notification"), hideFromOSD)
madeChangeOnPlayer = True
madeChangeOnPlayer = True
return madeChangeOnPlayer

def _changePlayerStateAccordingToGlobalState(self, position, paused, doSeek, setBy):
Expand Down

0 comments on commit c8912d1

Please sign in to comment.