How can I use VR in an Ionic app?

Hello everybody!

I try to integrate a playcanvas project into a ionic application. I am using a iframe to show the playcanvas project and this run ok. But, when you try to click on the VR icon to change the view to stereoscopic, it’s doesn’t run

I thinks it’s append because ionic don’t run a native mobile browser.
What do you thing?


That’s possible. WebVR in PlayCanvas works in two ways:

  • If the browser supports WebVR, we use the native interfaces. Currently this is only Chrome on Android with Origin Trial enabled

  • If the browser doesn’t we use the webvr-polyfill library to provide a shim for the API.

The polyfill should work in most locations, but it maybe the polyfill doesn’t know which platform it is running on (mobile or desktop). I suggested stepping through the debugger when you call enableVr and see what happens.

The problem is on the iframe. When I put playcanvas project into iframe WebVR doesn’t run, maybe, it doesn’t find the platform.
So I am working to run the playcanvas project direct to a ionic page without iframe, and it runs good!
When I’ll finish the work, I’ll write the answer on the forum.


Did you ever manage to complete your project ?