Fix erroneous seeks when joining an active room
This commit is contained in:
parent
fea3432dd5
commit
7d1fda5521
@ -78,6 +78,7 @@ class SyncplayClient(object):
|
||||
self.lastRewindTime = None
|
||||
self.lastAdvanceTime = None
|
||||
self.lastConnectTime = None
|
||||
self.lastSetRoomTime = None
|
||||
self.lastLeftTime = 0
|
||||
self.lastPausedOnLeaveTime = None
|
||||
self.lastLeftUser = ""
|
||||
@ -185,7 +186,7 @@ class SyncplayClient(object):
|
||||
pauseChange = self.getPlayerPaused() != paused and self.getGlobalPaused() != paused
|
||||
_playerDiff = abs(self.getPlayerPosition() - position)
|
||||
_globalDiff = abs(self.getGlobalPosition() - position)
|
||||
seeked = _playerDiff > constants.SEEK_THRESHOLD and _globalDiff > constants.SEEK_THRESHOLD
|
||||
seeked = _playerDiff > constants.SEEK_THRESHOLD and _globalDiff > constants.SEEK_THRESHOLD and not self.recentlySetRoom()
|
||||
return pauseChange, seeked
|
||||
|
||||
def rewindFile(self):
|
||||
@ -258,6 +259,11 @@ class SyncplayClient(object):
|
||||
if connectDiff is None or connectDiff < constants.LAST_PAUSED_DIFF_THRESHOLD:
|
||||
return True
|
||||
|
||||
def recentlySetRoom(self):
|
||||
setroomDiff = time.time() - self.lastSetRoomTime if self.lastSetRoomTime else None
|
||||
if setroomDiff is None or setroomDiff < constants.LAST_PAUSED_DIFF_THRESHOLD:
|
||||
return True
|
||||
|
||||
def _toggleReady(self, pauseChange, paused):
|
||||
if not self.userlist.currentUser.canControl():
|
||||
self._player.setPaused(self._globalPaused)
|
||||
@ -661,6 +667,7 @@ class SyncplayClient(object):
|
||||
return features
|
||||
|
||||
def setRoom(self, roomName, resetAutoplay=False):
|
||||
self.lastSetRoomTime = time.time()
|
||||
roomSplit = roomName.split(":")
|
||||
if roomName.startswith("+") and len(roomSplit) > 2:
|
||||
roomName = roomSplit[0] + ":" + roomSplit[1]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user