fix: Catch audio context errors (#5051)
Prevent errors in decoding and playing sounds from propagating by catching them in the promise chain. Fixes #4281.
This commit is contained in:
parent
1dc7ce526e
commit
558e3c7499
@ -16,7 +16,6 @@ export const getAlertAudio = async (baseUrl = '', type = 'dashboard') => {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
|
||||||
const resourceUrl = `${baseUrl}/audio/${type}/ding.mp3`;
|
const resourceUrl = `${baseUrl}/audio/${type}/ding.mp3`;
|
||||||
const audioRequest = new Request(resourceUrl);
|
const audioRequest = new Request(resourceUrl);
|
||||||
|
|
||||||
@ -25,10 +24,10 @@ export const getAlertAudio = async (baseUrl = '', type = 'dashboard') => {
|
|||||||
.then(buffer => {
|
.then(buffer => {
|
||||||
audioCtx.decodeAudioData(buffer).then(playsound);
|
audioCtx.decodeAudioData(buffer).then(playsound);
|
||||||
return new Promise(res => res());
|
return new Promise(res => res());
|
||||||
});
|
})
|
||||||
} catch (error) {
|
.catch(() => {
|
||||||
// error
|
// error
|
||||||
}
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const notificationEnabled = (enableAudioAlerts, id, userId) => {
|
export const notificationEnabled = (enableAudioAlerts, id, userId) => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user