This commit is contained in:
yumoqing 2020-04-30 17:27:38 +08:00
parent 4e8eff8c45
commit 545d7336d6

View File

@ -26,11 +26,11 @@ class APlayer(BoxLayout):
self.ap = None
def on_source(self,o,s):
if self.ap:
self.ap.stop()
self.ap = SoundFFPy(source=self.source)
if not self.ap:
return
self.ap.bind(on_play=self.begin_play)
self.ap.bind(on_stop=self.end_play)
self.play()
def __del__(self):
@ -45,11 +45,9 @@ class APlayer(BoxLayout):
def play(self):
if not self.ap:
return
self.ap.bind(on_stop=self.end_play)
self.ap.play()
def begin_play(self,obj):
pass
def end_play(self,obj):
self.ap = None