Update player location on server seek.

This commit is contained in:
Peter Marheine 2015-10-22 19:54:14 -06:00
parent 4c7c526b8d
commit 094a204d9e

View File

@ -175,10 +175,15 @@ class SyncplayClient(object):
seeked = _playerDiff > constants.SEEK_THRESHOLD and _globalDiff > constants.SEEK_THRESHOLD
return pauseChange, seeked
def _ignoringPlayerStatus(self, cookie=None):
if cookie is None:
cookie = time.time()
return cookie < self._lastPlayerCommand + self._config['playerCommandDelay']
def updatePlayerStatus(self, paused, position, cookie=None):
# Ignore status report if the cookie is stale
if cookie is not None and \
cookie < self._lastPlayerCommand + self._config['playerCommandDelay']:
if self._ignoringPlayerStatus(cookie):
self.ui.showDebugMessage('Ignoring stale player status with cookie {}'.format(cookie))
return
position -= self.getUserOffset()
@ -515,6 +520,7 @@ class SyncplayClient(object):
def setPosition(self, position):
if self._lastPlayerUpdate:
self._lastPlayerUpdate = time.time()
self._playerPosition = position
position += self.getUserOffset()
if self._player and self.userlist.currentUser.file:
if position < 0: