I was trying to play music from music stored in Firebase Storage using vlc packages. However, when using this packages, we need to define the duration of the time sleep. Error occured when I used urllib.request and mutagen library to retrieve it.
Error
can't sync to MPEG frame
try:
filename, headers = urlretrieve(musicURL)
audio = MP3(filename)
print(audio.info.length)
self.mediaPlayer = vlc.MediaPlayer(musicURL)
self.mediaPlayer.play()
time.sleep(180)
print("Music " + musicName + " is playing")
# I not yet find ways to determine music duration from url
except Exception as e:
print(e)
pass
So, from the comments: instead of trying to use Mutagen, just ask VLC for the duration.