Fixed unpause bug when VLC reaches EOF
This commit is contained in:
parent
d875db78d9
commit
570f49c5fe
@ -193,6 +193,8 @@ UNPAUSE_IFOTHERSREADY_MODE = "IfOthersReady"
|
|||||||
UNPAUSE_IFMINUSERSREADY_MODE = "IfMinUsersReady"
|
UNPAUSE_IFMINUSERSREADY_MODE = "IfMinUsersReady"
|
||||||
UNPAUSE_ALWAYS_MODE = "Always"
|
UNPAUSE_ALWAYS_MODE = "Always"
|
||||||
|
|
||||||
|
VLC_EOF_DURATION_THRESHOLD = 2.0
|
||||||
|
|
||||||
PRIVACY_HIDDENFILENAME = "**Hidden filename**"
|
PRIVACY_HIDDENFILENAME = "**Hidden filename**"
|
||||||
INVERTED_STATE_MARKER = "*"
|
INVERTED_STATE_MARKER = "*"
|
||||||
ERROR_MESSAGE_MARKER = "*"
|
ERROR_MESSAGE_MARKER = "*"
|
||||||
|
|||||||
8
syncplay/players/vlc.py
Normal file → Executable file
8
syncplay/players/vlc.py
Normal file → Executable file
@ -208,18 +208,22 @@ class VlcPlayer(BasePlayer):
|
|||||||
self._durationAsk.set()
|
self._durationAsk.set()
|
||||||
elif name == "playstate":
|
elif name == "playstate":
|
||||||
self._paused = bool(value != 'playing') if(value != "no-input" and self._filechanged == False) else self._client.getGlobalPaused()
|
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 \
|
if self._paused == False \
|
||||||
and self._position == self._previousPreviousPosition \
|
and self._position == self._previousPreviousPosition \
|
||||||
and self._previousPosition == self._position \
|
and self._previousPosition == self._position \
|
||||||
and self._duration > constants.PLAYLIST_LOAD_NEXT_FILE_MINIMUM_LENGTH \
|
and self._duration > constants.PLAYLIST_LOAD_NEXT_FILE_MINIMUM_LENGTH \
|
||||||
and self._position == self._duration:
|
and (self._duration - self._position) < constants.VLC_EOF_DURATION_THRESHOLD \
|
||||||
self._paused = True
|
and diff > constants.VLC_LATENCY_ERROR_THRESHOLD:
|
||||||
self._client.ui.showDebugMessage("Treating 'playing' response as 'paused' due to VLC EOF bug")
|
self._client.ui.showDebugMessage("Treating 'playing' response as 'paused' due to VLC EOF bug")
|
||||||
|
self.setPaused(True)
|
||||||
self._pausedAsk.set()
|
self._pausedAsk.set()
|
||||||
elif name == "position":
|
elif name == "position":
|
||||||
newPosition = float(value.replace(",", ".")) if (value != "no-input" and self._filechanged == False) else self._client.getGlobalPosition()
|
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:
|
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._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()
|
self._positionAsk.set()
|
||||||
return
|
return
|
||||||
self._previousPreviousPosition = self._previousPosition
|
self._previousPreviousPosition = self._previousPosition
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user