问题描述
目前我正在开发一些通知系统,我让它一切正常,但我遇到的唯一问题是声音。关于确认或设置允许选项..
我目前的代码是:
const notificationSound = () => {
const sound = new Howl({
src: [`${process.env.PUBLIC_URL}/notificationsound.mp3`],onplayerror: function() {
sound.once('unlock',function() {
sound.play();
});
}
});
sound.play();
};
if(notificationCount > 0) notificationSound()
我在 console.log 中得到的错误是 (x3):
The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page
这里我也没有任何按钮点击触发器之类的?是否有针对此的解决方案,或者其他一些库或其他解决方案?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)