fix: fix audio.play() error throw which will marked as Unhandled

pull/100/head
moonrailgun 2 years ago
parent ee3e6f45d5
commit 741e9f7983

@ -89,6 +89,7 @@ export function initNotify() {
incBubble();
}
tryPlayNotificationSound(); // 不管当前是不是处于活跃状态,都发出提示音
});
}
@ -132,7 +133,7 @@ sharedEvent.on('userSettingsUpdate', (settings) => {
/**
*
*/
function tryPlayNotificationSound() {
async function tryPlayNotificationSound() {
if (_get(userSettings, PLUGIN_SYSTEM_SETTINGS_DISABLED_SOUND) === true) {
// 消息提示音被禁用
return;
@ -142,7 +143,7 @@ function tryPlayNotificationSound() {
const audio = new Audio(
'/plugins/com.msgbyte.notify/assets/sounds_bing.mp3'
);
audio.play();
await audio.play();
} catch (err) {
console.error(err);
}

Loading…
Cancel
Save