Fixed unpause bug when VLC reaches EOF

This commit is contained in:
alby128 2017-11-01 18:20:43 +01:00
parent f064c0dd68
commit fe6873d58b
2 changed files with 8 additions and 2 deletions

View File

@ -193,6 +193,8 @@ UNPAUSE_IFOTHERSREADY_MODE = "IfOthersReady"
UNPAUSE_IFMINUSERSREADY_MODE = "IfMinUsersReady"
UNPAUSE_ALWAYS_MODE = "Always"
VLC_EOF_DURATION_THRESHOLD = 2.0
PRIVACY_HIDDENFILENAME = "**Hidden filename**"
INVERTED_STATE_MARKER = "*"
ERROR_MESSAGE_MARKER = "*"

8
syncplay/players/vlc.py Normal file → Executable file
View File

@ -208,18 +208,22 @@ class VlcPlayer(BasePlayer):
self._durationAsk.set()
elif name == "playstate":
self._paused = bool(value != 'playing') if(value != "no-input" and self._filechanged == False) else self._client.getGlobalPaused()
diff = time.time() - self._lastVLCPositionUpdate if self._lastVLCPositionUpdate else 0
if self._paused == False \
and self._position == self._previousPreviousPosition \
and self._previousPosition == self._position \
and self._duration > constants.PLAYLIST_LOAD_NEXT_FILE_MINIMUM_LENGTH \
and self._position == self._duration:
self._paused = True
and (self._duration - self._position) < constants.VLC_EOF_DURATION_THRESHOLD \
and diff > constants.VLC_LATENCY_ERROR_THRESHOLD:
self._client.ui.showDebugMessage("Treating 'playing' response as 'paused' due to VLC EOF bug")
self.setPaused(True)
self._pausedAsk.set()
elif name == "position":
newPosition = float(value.replace(",", ".")) if (value != "no-input" and self._filechanged == False) else self._client.getGlobalPosition()
if newPosition == self._previousPosition and newPosition <> self._duration and not self._paused:
self._client.ui.showDebugMessage("Not considering position {} duplicate as new time because of VLC time precision bug".format(newPosition))
self._previousPreviousPosition = self._previousPosition
self._previousPosition = self._position
self._positionAsk.set()
return
self._previousPreviousPosition = self._previousPosition