Fix Kodi playback jumping to the beginning of a video that just started

This commit is contained in:
croneter 2019-11-06 18:39:19 +01:00
parent c7da016c85
commit 4f59a1e2a9

View file

@ -28,6 +28,7 @@ LOG = getLogger('PLEX.playback')
# Do we need to return ultimately with a setResolvedUrl?
RESOLVE = True
TRY_TO_SEEK_FOR = 300 # =30 seconds
IGNORE_SECONDS_AT_START = 15
###############################################################################
@ -590,6 +591,13 @@ def threaded_playback(kodi_playlist, startpos, offset):
if i > TRY_TO_SEEK_FOR:
LOG.error('Could not seek to %s', offset)
return
try:
if offset == 0 and app.APP.player.getTime() < IGNORE_SECONDS_AT_START:
LOG.debug('Avoiding small jump to the very start of the video')
return
except RuntimeError:
# RuntimeError: XBMC is not playing any media file
pass
i = 0
answ = js.seek_to(offset * 1000)
while 'error' in answ: