【问题标题】:how to enable gyroscope in iframe如何在 iframe 中启用陀螺仪
【发布时间】:2021-04-05 06:28:27
【问题描述】:

我在链接上制作并托管了 playcanvas 体验。它使用陀螺仪进行虚拟现实体验。如果我直接在 android 设备中打开链接。它适用于陀螺仪和所有功能。 但是当我将链接嵌入 iframe 并在移动设备中打开该页面时。陀螺仪不工作。 我用于嵌入 iframe 的代码是:

<iframe id="the_iframe" class="bg" allowvr="yes" allow="vr; xr; accelerometer; magnetometer; gyroscope; autoplay;"
    allowfullscreen mozallowfullscreen="true" webkitallowfullscreen="true" frameborder="0"></iframe>

【问题讨论】:

    标签: iframe virtual-reality gyroscope webvr


    【解决方案1】:

    对我有用的是将“webxr”添加到允许列表。

    <iframe id="the_iframe" class="bg" allowvr="yes" allow="vr; xr; accelerometer; magnetometer; gyroscope; webvr;webxr;"
        allowfullscreen mozallowfullscreen="true" webkitallowfullscreen="true" frameborder="0"></iframe>
    

    虽然它适用于安卓系统。无法在 ios 设备中使用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-10-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多