Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I run WebVR content within in an iframe?

Tags:

aframe

webvr

I have an A-Frame WebVR scene. I am trying to put it in an iframe.

<iframe src="https://aframe.io/aframe/examples/boilerplate/hello-world/"></iframe>

But when I Enter VR, it does not go full screen and render to the VR headset. How can I enable stereoscopic VR in an iframe?

like image 476
ngokevin Avatar asked Nov 17 '16 10:11

ngokevin


Video Answer


2 Answers

You must set allowvr="yes" on the iframe. If you go to https://aframe.io, you'll see that all the examples are iframed, so you can follow their example.

<iframe allowvr="yes" src="https://aframe.io/aframe/examples/boilerplate/hello-world/"></iframe>

Note that this does not work well for mobile smartphones yet because mobile browsers like iOS Safari do not allow iframe's access to device orientation and device motion sensors. This could be worked around by post messaging device orientation data to the iframe. This is filed at https://github.com/googlevr/webvr-polyfill/issues/173

like image 182
ngokevin Avatar answered Oct 15 '22 00:10

ngokevin


Only one <a-scene> can exist on a page. Alternatively, we can use an <iframe> with allowfullscreen="yes" and allowvr="yes":

<iframe allowvr="yes" allowfullscreen="yes" src="https://aframe.io/aframe/examples/boilerplate/hello-world/"></iframe>
like image 43
Steve Avatar answered Oct 15 '22 00:10

Steve