The SoundComponent stop() method should stop all slots.
https://developer.playcanvas.com/en/api/pc.SoundComponent.html#stop
It does stop if the audio asset is set to preload.
However if the audio asset is not set to preload the sound doesn’t stop.
Here is a test project
https://playcanvas.com/project/767340/overview/sounddoesntstop
will
February 21, 2021, 9:02pm
#2
Hey @vaios - I think this is the problem I was facing with the mute button in the Star-Lord demo.
yaustar
February 21, 2021, 9:19pm
#3
There’s a fix for this due next patch release.
playcanvas:master
← playcanvas:fix-loading-sounds-play-stop
opened 05:24PM - 10 Feb 21 UTC
2 Likes
In my test project the audio asset is about 30 seconds long and set to autoplay and loop. If I call stop after about 1 minute the audio doesn’t stop. Load must have finished, so I wondered if your fix will also fix this test case?
will
February 21, 2021, 10:08pm
#5
It’s easy to verify. Just run your scene with the latest ‘dev’ build of the engine:
https://launch.playcanvas.com/1095813?use_local_engine=https://code.playcanvas.com/playcanvas-latest.js
Seems to have resolved it. We’ll deploy the patch within the next 48 hours (assuming we don’t uncover any issues during testing).
3 Likes
will
February 21, 2021, 10:19pm
#7