Safer AudioContext access

This commit is contained in:
Noah 2023-02-08 21:23:08 -08:00
parent a55b4b2b49
commit be2fc0c026

View File

@ -969,11 +969,14 @@ const app = Vue.createApp({
*/
setupSounds() {
if (AudioContext) {
this.config.sounds.audioContext = new AudioContext();
} else {
this.config.sounds.audioContext = window.AudioContext || window.webkitAudioContext;
}
try {
if (AudioContext) {
this.config.sounds.audioContext = new AudioContext();
} else {
this.config.sounds.audioContext = window.AudioContext || window.webkitAudioContext;
}
} catch {}
if (!this.config.sounds.audioContext) {
console.error("Couldn't set up AudioContext! No sound effects will be supported.");
return;