Add process check before terminating audio playback in play_audio function
This commit is contained in:
@@ -61,6 +61,7 @@ def play_audio(file_path: str, loop: bool = False) -> Callable[[], None]:
|
|||||||
)
|
)
|
||||||
|
|
||||||
def stop():
|
def stop():
|
||||||
|
if process.poll() is None: # Check if the process is still running
|
||||||
process.terminate()
|
process.terminate()
|
||||||
|
|
||||||
return stop
|
return stop
|
||||||
|
|||||||
Reference in New Issue
Block a user