use MP3Decoder.open()
This commit is contained in:
parent
e8a2a77ac6
commit
b4f18f7d8f
1 changed files with 8 additions and 9 deletions
|
|
@ -256,13 +256,12 @@ class Peripherals:
|
|||
self.wavfile.close()
|
||||
|
||||
def play_mp3_file(self, filename):
|
||||
with open(filename, "rb") as f:
|
||||
if self._mp3_decoder is None:
|
||||
from audiomp3 import MP3Decoder # noqa: PLC0415, import outside top-level
|
||||
|
||||
self._mp3_decoder = MP3Decoder(f)
|
||||
self._mp3_decoder = MP3Decoder(filename)
|
||||
else:
|
||||
self._mp3_decoder.file = f
|
||||
self._mp3_decoder.open(filename)
|
||||
|
||||
self.audio.play(self._mp3_decoder)
|
||||
while self.audio.playing:
|
||||
|
|
|
|||
Loading…
Reference in a new issue