Safer AudioContext access
This commit is contained in:
parent
a55b4b2b49
commit
be2fc0c026
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue
Block a user