Bugfix: music.playing() sometimes wrongly returned False
This commit is contained in:
parent
bb4d1d466c
commit
c5917b9df4
@ -33,6 +33,8 @@ class Music:
|
|||||||
if not self.playing():
|
if not self.playing():
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
self.fading = True
|
||||||
|
|
||||||
position = self.player.get_position()
|
position = self.player.get_position()
|
||||||
|
|
||||||
thread = threading.Thread(target=self._fade)
|
thread = threading.Thread(target=self._fade)
|
||||||
@ -60,6 +62,7 @@ class Music:
|
|||||||
|
|
||||||
p.pause()
|
p.pause()
|
||||||
p.release()
|
p.release()
|
||||||
|
self.fading = False
|
||||||
|
|
||||||
def get_playtime(self):
|
def get_playtime(self):
|
||||||
"Return elapsed play time"
|
"Return elapsed play time"
|
||||||
@ -97,7 +100,9 @@ class Music:
|
|||||||
if self.player.get_position() > 0 and self.player.is_playing():
|
if self.player.get_position() > 0 and self.player.is_playing():
|
||||||
return True
|
return True
|
||||||
|
|
||||||
return False
|
# We take a copy of the player when fading, so we could be
|
||||||
|
# playing in a fade nowFalse
|
||||||
|
return self.fading
|
||||||
|
|
||||||
def set_position(self, ms):
|
def set_position(self, ms):
|
||||||
"Set current play time in milliseconds from start"
|
"Set current play time in milliseconds from start"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user