Fix seek/cue point jumping.
This commit is contained in:
parent
c0d8247dfa
commit
150880028b
1 changed files with 8 additions and 10 deletions
18
player.py
18
player.py
|
@ -226,9 +226,7 @@ class Player:
|
||||||
self.seek(self.state.get()["loaded_item"].cue)
|
self.seek(self.state.get()["loaded_item"].cue)
|
||||||
else:
|
else:
|
||||||
# Otherwise, let's go to 0.
|
# Otherwise, let's go to 0.
|
||||||
self.state.update("pos", 0)
|
self.seek(0)
|
||||||
self.state.update("pos_offset", 0)
|
|
||||||
self.state.update("pos_true", 0)
|
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -242,7 +240,8 @@ class Player:
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
self.stopped_manually = True # Don't trigger _ended() on seeking.
|
self.stopped_manually = True # Don't trigger _ended() on seeking.
|
||||||
self.state.update("paused", True)
|
if pos > 0:
|
||||||
|
self.state.update("paused", True)
|
||||||
self._updateState(pos=pos)
|
self._updateState(pos=pos)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -605,15 +604,14 @@ class Player:
|
||||||
|
|
||||||
self.state.update("initialised", self.isInit)
|
self.state.update("initialised", self.isInit)
|
||||||
if self.isInit:
|
if self.isInit:
|
||||||
if pos:
|
if pos is not None:
|
||||||
self.state.update("pos", max(0, pos))
|
#self.state.update("pos_true", max(0, pos))
|
||||||
|
self.state.update("pos", pos) # Reset back to 0 if stopped.
|
||||||
|
self.state.update("pos_offset", 0)
|
||||||
elif self.isPlaying:
|
elif self.isPlaying:
|
||||||
|
# This is the bit that makes the time actually progress during playback.
|
||||||
# Get one last update in, incase we're about to pause/stop it.
|
# Get one last update in, incase we're about to pause/stop it.
|
||||||
self.state.update("pos", max(0, mixer.music.get_pos() / 1000))
|
self.state.update("pos", max(0, mixer.music.get_pos() / 1000))
|
||||||
# TODO this is wrong now we don't pause the mixer.
|
|
||||||
elif not self.isPaused:
|
|
||||||
self.state.update("pos", 0) # Reset back to 0 if stopped.
|
|
||||||
self.state.update("pos_offset", 0)
|
|
||||||
|
|
||||||
# If the state is changing from playing to not playing, and the user didn't stop it, the item must have ended.
|
# If the state is changing from playing to not playing, and the user didn't stop it, the item must have ended.
|
||||||
if (
|
if (
|
||||||
|
|
Loading…
Reference in a new issue