Safer AudioContext access
This commit is contained in:
parent
a55b4b2b49
commit
be2fc0c026
|
@ -969,11 +969,14 @@ const app = Vue.createApp({
|
||||||
*/
|
*/
|
||||||
|
|
||||||
setupSounds() {
|
setupSounds() {
|
||||||
|
try {
|
||||||
if (AudioContext) {
|
if (AudioContext) {
|
||||||
this.config.sounds.audioContext = new AudioContext();
|
this.config.sounds.audioContext = new AudioContext();
|
||||||
} else {
|
} else {
|
||||||
this.config.sounds.audioContext = window.AudioContext || window.webkitAudioContext;
|
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