我如何在文档准备就绪MVC5应用程序上播放音频

发布于 2025-02-06 18:07:06 字数 379 浏览 3 评论 0原文

当我在按钮上播放音频时,此代码无法工作会生成错误,但它在文档就绪事件上给出了错误,

”

enter image description here

This Code not working its generate an error when i play audio on button click its working but its gives error on document ready event

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

木格 2025-02-13 18:07:06

您可能无法做到。 Web浏览器明确阻止了此行为,因为用户不会期望它并发现它很烦人。

请参阅Google的 Chrome博客文章,Mozilla的 firefox文档和苹果的<​​a href =“ https://webkit.org/blog/77734/auto-play-play-play-play-play-play-play-play-play-play-play-play-play-play-play--策略 - 更改-macos/“ rel =“ nofollow noreferrer”> webkit/safari博客文章关于这些规则。

如果您将在对Web浏览器控制的公司环境中部署应用程序,则可以在计算机上配置浏览器以允许您的网站自动播放。有关详细信息,请参见上面的链接。

You probably can't do it. Web browsers explicitly block this behavior because users don't expect it and find it annoying.

See Google's Chrome blog post, Mozilla's Firefox documentation, and Apple's WebKit/Safari blog post about these rules.

If you will be deploying your app in a corporate environment where you have control over the web browsers, you can probably configure the browsers on the computers to allow autoplay for your site. See the links above for details.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文