use vlc again for audio

main
vitrinekast 5 months ago
parent 91c238eca6
commit 93751abb10

@ -3,7 +3,7 @@ import cv2
import numpy as np import numpy as np
import os import os
import random import random
import simpleaudio as sa import vlc
import time import time
import board import board
import busio import busio
@ -95,10 +95,13 @@ def showImage(file):
def play_audio(file): def play_audio(file):
clear_frame() 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 # Add a small delay to prevent high CPU usage
time.sleep(0.1) time.sleep(0.1)

Loading…
Cancel
Save