Safer AudioContext access
This commit is contained in:
parent
a55b4b2b49
commit
be2fc0c026
|
@ -969,11 +969,14 @@ const app = Vue.createApp({
|
||||||
*/
|
*/
|
||||||
|
|
||||||
setupSounds() {
|
setupSounds() {
|
||||||
if (AudioContext) {
|
try {
|
||||||
this.config.sounds.audioContext = new AudioContext();
|
if (AudioContext) {
|
||||||
} else {
|
this.config.sounds.audioContext = new AudioContext();
|
||||||
this.config.sounds.audioContext = window.AudioContext || window.webkitAudioContext;
|
} else {
|
||||||
}
|
this.config.sounds.audioContext = window.AudioContext || window.webkitAudioContext;
|
||||||
|
}
|
||||||
|
} catch {}
|
||||||
|
|
||||||
if (!this.config.sounds.audioContext) {
|
if (!this.config.sounds.audioContext) {
|
||||||
console.error("Couldn't set up AudioContext! No sound effects will be supported.");
|
console.error("Couldn't set up AudioContext! No sound effects will be supported.");
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user