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():
|
||||
if process.poll() is None: # Check if the process is still running
|
||||
process.terminate()
|
||||
|
||||
return stop
|
||||
|
||||
Reference in New Issue
Block a user