Added async function.:

This commit is contained in:
retoor 2025-01-18 15:38:02 +01:00
parent 309c5f815a
commit 71cc3955f1

View File

@ -33,6 +33,13 @@ import pygame
async def play_audio_async(filename)
pygame.mixer.init()
pygame.mixer.music.load(filename)
pygame.mixer.music.play()
while pygame.mixer.music.get_busy():
await asyncio.sleep(0.1)
yield
def play_audio(filename): def play_audio(filename):