WebXR on Oculus Quest

Thanks to some help on previous questions in this forum I was able to get a Babylon (preview) scene working in WebXR on Chrome Canary in the Rift. Awesome, yes…but of course I’m always going to want more.
I totally understand that WebXR is a moving target right now, but I’m also seeing some older posts from this year with Babylon scenes working on the Quest.

Is this because those folks targeted WebVR with an older version of Babylon? If so, is it possible to swap out the default XR helper I’m using with an older VR helper (maybe using the same Babylon v4.1.0 a13)?

Ultimately, which is out of date? Is it that Babylon isn’t targeting the same WebXR as the Quest (both stock browser and FF Reality)? Or is it that those browsers are still on WebVR?

Despite all the questions, I’m psyched I can do this at all right now, anywhere - so THANKS!

Without digging too much, it seems to me like the browsers are not catching up. In this article - Firefox Reality for Oculus Quest , firefox are saying that they are planning a WebXR rollout in “a few months” (the paragraph before last), so I assume the browser still supports the “older” WebVR specs. And Stock browsers are never truly updated.

I dont have a quest, so I can’t really test that, but a quick check will be to use an older stable version of Babylon (like the latest 3.x) and see if it works. If it does, it’s the browsers who implemented older specs. If it doesn’t, it must be us.

You can still use pure webVR (not XR) with the WebVRCamera (instead of WebXRCamera):

1 Like

That’d be great - esp if I can use the same Babylon version and just set a flag in my code to switch off. I’ll check it out now that I have a bit of confidence it’ll work.

If it doesn’t I’ll try rolling back to 3.x as RaananW says.
Thanks both!

This should work with 4.1-a13 :slight_smile:

Indeed it does, thank you!

Just to contribute back if anyone is wondering - I have both WebXR and VR working - I check XR first, and if that mode isn’t available, I start the VR helper.

        // Check XR support
    const xrHelper = await scene.createDefaultXRExperienceAsync({floorMeshes: [environment.ground]});
    if(!await xrHelper.baseExperience.sessionManager.supportsSessionAsync("immersive-vr")){
        // do WebVR instead
        const vrHelper = scene.createDefaultVRExperience();
    } else {
        // do some WebXR stuff

Happy that it worked ;D

Just wanted to update regarding webXR and the oculus quest
The oculus quest browser does support webXR (if turned on) BUT!! a very old version. The “hack” to make it work (somehow) is to add this code to your main .js file (warning, global namespace manipulations!)

// missing function?
f(navigator.xr && !navigator.xr.supportsSession) {
    navigator.xr.supportsSession = navigator.xr.supportsSessionMode;
    let originalRequestSession = navigator.xr.requestSession;
      // change signature
      navigator.xr.requestSession = function(mode, options) {
        return originalRequestSession.call(this, {mode: mode}, options).then((session) => {
          let requestReferenceSpace = session.requestReferenceSpace;
          // change signature
          session.requestReferenceSpace = function(type) {
              return requestReferenceSpace.call(this, {type: "identity"});
          return session;

As you can see, most (if not all) of the webxr functions in the oculus browser (current version of the browser, i must say) have a different signature than what it is supposed to be. AND, the only mode it supports is identity (which is not even documented on MDN).
So, long story short - i wouldn’t try using webxr on the oculus quest, until they update their browser with the newest API. then there is no reason for it to not work.

Awesome, thanks! Even if it is a bit of a hack, it seems cleaner than switching between WebVR and XR like I did.

Oh, and you can always use the webxr polyfill - GitHub - immersive-web/webxr-polyfill: Use the WebXR Device API today, providing fallbacks to native WebVR 1.1 and Cardboard . I tested it with Edge, it seems to be stable enough to use. There was an issue with the tracking from time to time (single frames dropped) but i think it is related to the scene I was testing, as I was experimenting with practically everything I could :wink:

A small hint, the CDN does NOT have the latest version, so if you really want to use this, download it and integrate it yourself.

1 Like

The cdn for preview is preview.babylonjs.com

Awesome, thanks again! This is all perfect timing, I had a POC before that I was working on when I initially asked this question. Now I’m formalizing it a bit and redoing - so this latest advice will definitely influence

1 Like

Oh, I meant the CDN for the polyfill on their github. I know babylon’s CDN is always updated :slight_smile:

1 Like

Sorry I’m getting old :wink:

Just like wine :slight_smile:

1 Like