meta-quest / immersive-web-emulator

Browser extension that emulates Meta Quest devices for WebXR development. Lead: Felix Zhang (fe1ix@meta.com)
https://developer.oculus.com/blog/webxr-development-immersive-web-emulator/
MIT License
297 stars 34 forks source link

Emulator not working with three.js and A-Frame samples #11

Closed FireDragonGameStudio closed 1 year ago

FireDragonGameStudio commented 1 year ago

Hi, unfortunately the emulator is not working for me, with either three.js or A-Frame samples (pls see attached screenshots, tested in Edge). It does work with the babylon.js samples and the immersive-web samples. Have I done smth wrong, with the the setup, or any ideas what might be the problem here?

best regards :)

image image

felixtrz commented 1 year ago

Hi, unfortunately the emulator is not working for me, with either three.js or A-Frame samples (pls see attached screenshots, tested in Edge). It does work with the babylon.js samples and the immersive-web samples. Have I done smth wrong, with the the setup, or any ideas what might be the problem here?

best regards :)

image image

Hey there!

Thanks for bringing this to my attention, this is indeed a strange problem, one that I haven't seen before.. I tested the emulator with the most barebone example of WebXR: https://immersive-web.github.io/webxr-samples/immersive-vr-session.html, and it worked as expected.

And then I discovered this: when I go to https://threejs.org/examples/?q=vr#webxr_vr_ballshooter, which is the example you are showing in this example side bar view, the button indeed shows VR NOT SUPPORTED, but if I go straight to https://threejs.org/examples/webxr_vr_ballshooter, without the examples side bar, the VR button is back and it works as expected.

Same story with A-Frame, I was able to find the hellovr main page, but similarly https://aframe.io/examples/showcase/a-painter/ did not work and https://aframe.io/a-painter/ worked.

I highly suspect that it has something to do with iframe, the non-working versions of the experiences you mentioned are all in iframes, go to their main page without the iframe, and it works again.

felixtrz commented 1 year ago

UPDATE: there indeed is a problem with the emulator, during migration to MV3, the way that the custom WebXR Polyfill is injected has changed. I can no longer inject it correctly in the experience via the "content_scripts" property of manifest.json. Instead I have to do so programmatically via the service worker of the extension, via chrome.scripting.registerContentScripts. In order to inject this into both the main page and its iframes, I had to specify all_frames: true prior to MV3 in "content_scripts", but with the new registerContentScripts method, this property was no longer accepted, and instead they renamed it to allFrames. And I forgot to add it in, lol.

I will submit a new version to Chrome Web Store by EOD