[英]How to use playsound() in python Asynchronously
i know that if i do我知道如果我这样做
playsound("filepath.mp3" , block = False)
that it is supposed to run asynchronously.它应该异步运行。
But when i try it the mp3 file doesn't play, when i set it to True(Default) the mp3 file plays but the program halts for the mp3 file to finish playing.但是当我尝试它时,mp3 文件不播放,当我将它设置为 True(默认)时,mp3 文件播放但程序停止播放 mp3 文件以完成播放。
Also trying to run playsound on a different thread just result in an Error还尝试在不同的线程上运行 playsound 只会导致错误
TypeError: 'module' object is not callable
Thanks in advance!提前致谢!
Did you import playsound like this你有没有像这样导入播放声音
import playsound
or或者
from playsound import playsound
Because i found that unless you import it from playsound it does not work因为我发现除非你从 playsound 中导入它,否则它不起作用
我知道这是很晚的反应,但只需这样做:
playsound("filepath.mp3" , 0)
with execstring in maXbox:在 maXbox 中使用 execstring:
eng.Execstring('from playsound import playsound')
eng.Execstring('playsound(r"C:\Program
Files\Streaming\maxbox4\maxbox4\airmaxloop3.mp3",0)')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.