【问题标题】:Starting an AudioContext in an iframe在 iframe 中启动 AudioContext
【发布时间】:2022-01-14 09:59:28
【问题描述】:

我正在开发一个网络音频 SDK,并考虑在 iframe 中仅嵌入音频(而不是 UI 元素)。我收到以下错误:

The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page.

我想知道是否有一种方法可以在 iframe 上创建用户手势,即使它是隐藏的且仅音频?原始手势在父组件上,但似乎没有向下传播到框架。谢谢!

【问题讨论】:

    标签: iframe web-audio-api


    【解决方案1】:

    为了获得更好的用户体验 (UX),浏览器不允许自动播放音频,除非用户通过点击/轻敲等手势明确“请求”音频。 iFrame 必须可见且可交互才能接收用户手势,否则会绕过 UX 保护措施。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-10-21
      • 1970-01-01
      • 2021-01-29
      • 2017-09-21
      • 1970-01-01
      • 2016-08-14
      • 2022-01-09
      • 2015-11-27
      相关资源
      最近更新 更多