use vlc again for audio

main
vitrinekast 6 months ago
parent 91c238eca6
commit 93751abb10

@ -3,7 +3,7 @@ import cv2
import numpy as np
import os
import random
import simpleaudio as sa
import vlc
import time
import board
import busio
@ -95,10 +95,13 @@ def showImage(file):
def play_audio(file):
clear_frame()
sound = sa.WaveObject.from_wave_file(file)
play_obj = sound.play()
while play_obj.is_playing():
p = vlc.MediaPlayer(file)
p.play()
time.sleep(.1)
while p.is_playing():
# Add a small delay to prevent high CPU usage
time.sleep(0.1)

Loading…
Cancel
Save