Added async function.:
This commit is contained in:
parent
309c5f815a
commit
71cc3955f1
@ -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):
|
||||||
|
Loading…
Reference in New Issue
Block a user