catch any error
This commit is contained in:
@@ -165,12 +165,16 @@ let app = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
playRandomSound() {
|
playRandomSound() {
|
||||||
const sound = random.element(this.sounds.filter(sound => sound.active));
|
try {
|
||||||
if (sound !== null) {
|
const sound = random.element(this.sounds.filter(sound => sound.active));
|
||||||
console.log(`Playing ${sound.id}`);
|
if (sound !== null) {
|
||||||
sound.audio.playbackRate = this.randomPitch ? random.float(0.8, 1.2) : 1;
|
console.log(`Playing ${sound.id}`);
|
||||||
sound.audio.volume = this.volume / 100;
|
sound.audio.playbackRate = this.randomPitch ? random.float(0.8, 1.2) : 1;
|
||||||
sound.audio.play();
|
sound.audio.volume = this.volume / 100;
|
||||||
|
sound.audio.play();
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
}
|
}
|
||||||
this.trigger();
|
this.trigger();
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user