Electron 通知 - 自定义 Windows 通知音频

发布于 2025-01-21 01:22:49 字数 356 浏览 2 评论 0原文

根据电子文档[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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文