提问人:Keval Rana 提问时间:11/17/2023 更新时间:11/17/2023 访问量:19
在下一个js中出现新订单时,在浏览器中播放mp3时面临问题
Facing issue play mp3 in browser when new order comming time in next js
问:
现在我需要在没有用户反应的情况下在浏览器中播放 mp3。
当前代码:
const audio = new Audio(newOrderRing);
audio.play().catch((error) =\> {
// eslint-disable-next-line no-console
console.error('Error playing audio:', error);
});
在Safari浏览器中面临自动播放权限问题。
错误:
NotAllowedError:在当前上下文中,用户代理或平台不允许该请求,可能是因为用户拒绝了权限。
NotAllowedError:play() 失败,因为用户没有先与文档交互。
在 safari 中,我需要手动添加权限才能在站点中播放 mp3。 网址: https://memrise.zendesk.com/hc/en-us/articles/360015889117-How-can-I-allow-audio-to-auto-play-on-Safari-
答: 暂无答案
评论