def load_audio_file(self, path):
from kivy.core.audio import SoundLoader
sound = SoundLoader.load(path)
self._sound = sound
if sound:
update_bar_schedule = Clock.schedule_interval(self.update_bar, 1)
self._update_bar_schedule = update_bar_schedule
self.ids.p_bar.max = sound.length
sound.volume = self.ids.volume_slider.value
sound.play()
else:
print('Cannot play the file %s.' % path)
error_msg = 'Cannot play the file %s.' % (path) if path else 'No file selected.'
popup = Popup(title='Audio Error.',
content=Label(text= error_msg),
size_hint = (0.3, 0.3))
popup.open()
评论列表
文章目录