Fix VLC "say it is playing when it is actually EOF" bug introduced by use of playlists
This commit is contained in:
parent
009f651773
commit
df071bf2a6
@ -35,6 +35,9 @@ class VlcPlayer(BasePlayer):
|
|||||||
self._filechanged = False
|
self._filechanged = False
|
||||||
self._lastVLCPositionUpdate = None
|
self._lastVLCPositionUpdate = None
|
||||||
self.shownVLCLatencyError = False
|
self.shownVLCLatencyError = False
|
||||||
|
self._previousPreviousPosition = -2
|
||||||
|
self._previousPosition = -1
|
||||||
|
self._position = 0
|
||||||
try: # Hack to fix locale issue without importing locale library
|
try: # Hack to fix locale issue without importing locale library
|
||||||
self.radixChar = "{:n}".format(1.5)[1:2]
|
self.radixChar = "{:n}".format(1.5)[1:2]
|
||||||
if self.radixChar == "" or self.radixChar == "1" or self.radixChar == "5":
|
if self.radixChar == "" or self.radixChar == "1" or self.radixChar == "5":
|
||||||
@ -192,8 +195,17 @@ 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()
|
||||||
|
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 abs(self._position - self._duration) < constants.PLAYLIST_LOAD_NEXT_FILE_TIME_FROM_END_THRESHOLD:
|
||||||
|
self._paused = True
|
||||||
|
self._client.ui.showDebugMessage("Treating 'playing' response as 'paused' due to VLC EOF bug")
|
||||||
self._pausedAsk.set()
|
self._pausedAsk.set()
|
||||||
elif name == "position":
|
elif name == "position":
|
||||||
|
self._previousPreviousPosition = self._previousPosition
|
||||||
|
self._previousPosition = self._position
|
||||||
self._position = float(value.replace(",", ".")) if (value != "no-input" and self._filechanged == False) else self._client.getGlobalPosition()
|
self._position = float(value.replace(",", ".")) if (value != "no-input" and self._filechanged == False) else self._client.getGlobalPosition()
|
||||||
self._lastVLCPositionUpdate = time.time()
|
self._lastVLCPositionUpdate = time.time()
|
||||||
self._positionAsk.set()
|
self._positionAsk.set()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user