【发布时间】:2016-11-17 10:36:42
【问题描述】:
我有一个 A-Frame WebVR 场景。我正在尝试将其放入 iframe 中。
<iframe src="https://aframe.io/aframe/examples/boilerplate/hello-world/"></iframe>
但是当我进入 VR 时,它不会全屏并渲染到 VR 耳机。如何在 iframe 中启用立体 VR?
【问题讨论】:
我有一个 A-Frame WebVR 场景。我正在尝试将其放入 iframe 中。
<iframe src="https://aframe.io/aframe/examples/boilerplate/hello-world/"></iframe>
但是当我进入 VR 时,它不会全屏并渲染到 VR 耳机。如何在 iframe 中启用立体 VR?
【问题讨论】:
您必须在 iframe 上设置 allowvr="yes"。如果你去https://aframe.io,你会看到所有的例子都是iframed,所以你可以按照他们的例子。
<iframe allowvr="yes" src="https://aframe.io/aframe/examples/boilerplate/hello-world/"></iframe>
请注意,这不适用于移动智能手机,因为 iOS Safari 等移动浏览器不允许 iframe 访问设备方向和设备运动传感器。这可以通过将消息设备方向数据发布到 iframe 来解决。这是在https://github.com/googlevr/webvr-polyfill/issues/173
提交的【讨论】:
一个页面上只能存在一个<a-scene>。或者,我们可以将<iframe> 与allowfullscreen="yes" 和allowvr="yes" 一起使用:
<iframe allowvr="yes" allowfullscreen="yes" src="https://aframe.io/aframe/examples/boilerplate/hello-world/"></iframe>
【讨论】: