更新时间:2023-09-22 07:57:16
如果您进行了更改:
soundPlayer = new Audio(soundName).play();
为此:
soundPlayer = new Audio(soundName);
soundPlayer.play();
您的暂停将会起作用.问题是您为soundPlayer分配了播放"功能. SoundPlayer现在不是音频对象.
Your pause will be working. The problem is that you assigned "play" function to soundPlayer. SoundPlayer isnt an Audio object now.
代替stop()使用:
Instead of stop() use:
soundPlayer.pause();
soundPlayer.currentTime = 0;
它的工作原理与我猜想的一样.
It works the same I guess.