Stop all sounds for all targets

This commit is contained in:
Eric Rosenbaum 2017-12-20 14:00:23 -05:00
parent 967169c714
commit a6d17fcba3

View file

@ -167,9 +167,17 @@ class Scratch3SoundBlocks {
return -1; return -1;
} }
stopAllSounds (args, util) { stopAllSounds () {
if (util.target.audioPlayer === null) return; if (this.runtime.targets === null) return;
util.target.audioPlayer.stopAllSounds(); const allTargets = this.runtime.targets;
for (let i = 0; i < allTargets.length; i++) {
this._stopAllSoundsForTarget(allTargets[i]);
}
}
_stopAllSoundsForTarget (target) {
if (target.audioPlayer === null) return;
target.audioPlayer.stopAllSounds();
} }
setEffect (args, util) { setEffect (args, util) {