Electron 通知 - 自定义 Windows 通知音频
根据电子文档[https://www.electronjs.org/docs/latest/latest/nopification#playing-sounds],在显示通知时,可以通过macOS播放自定义声音。我的工作很好。但是,使用Windows时,自定义声音似乎无法正常工作。搜索互联网一段时间后,当显示烤面包通知时,我没有发现播放自定义音频的确定解决方案。
看来这应该有可能。松弛做得很好。我唯一的想法是,Slack正在按照...通知显示时做的事情,最终使渲染过程通过常规new Audio(...)。play()。
任何非本机解决方案的缺点是,您最终可能无法正确地遵守用户设置OS级别通知。
这里的任何帮助将不胜感激。
According to the Electron Docs[https://www.electronjs.org/docs/latest/api/notification#playing-sounds] it is possible to play custom sounds through MacOS when displaying notifications. I've got that working pretty well. However, when working with windows, custom sounds don't seem to work the same. After searching the internet for a while, I've found no definitive solution for playing custom audio when toast notifications are shown.
It seems like this should be possible. Slack does this well. My only thought is that slack is doing something along the lines of... when the notification shows, they ultimately have the render process play the sound through a regular new Audio(...).play()
.
The downside of any non native solution is that you may end up not properly adhering to how the user has setup OS level notifications.
Any help here would be greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论