Closing WebXR session minimizes browser on Quest2

Hello,
I’m having an issue with XR sessionson Meta Quest2.
In my project the user can start a XR session by clicking a button that launches this line:

mainCamera.camera.startXr(pc.XRTYPE_VR, pc.XRSPACE_LOCALFLOOR);

In certain conditions I need to force the session to end and I’m using this command:

this.app.xr.end();

Now the XR session is correctly ending but the browser’s window is minimized to traskbar.
How can I prevent this behaviour?

Thanks in advance.

hoping @moka might know

I’m afraid that would be the implementation of Meta’s OS, and how it handles closing of WebXR session.

Hi @moka,
that’s what I was thinking.
Since we obviously cannot change meta’s behavior, can you please link me an example where an XR session is carried between scenes?
What happens in out project is that the XR session starts correctly when the proper button is pressed but when the scene changes the camera seems to “lose” the XR mode so we have the world rotating along with head movement.
To change the scene we use these snippets:

var rootChildren = this.app.root.children;
        for(let i = 0; i < rootChildren.length; i++) {
            if(rootChildren[i].name !== 'CameraOffset') { //same problem without this filter
                rootChildren[i--].destroy();
            }
        }

and then

this.app.scenes.loadSceneSettings(nextScene.url, function (ex) {
        if(ex) {
            console.error(ex.message);
        } else {}
    });

    this.app.scenes.loadSceneHierarchy(nextScene.url, (ex, entity) => {
        if(ex) {
            console.error(ex.message);
        } else {}
    });

Thanks.

As long as the camera is not destroyed / new one created, the XR should not be interrupted I think. XR does not care if you remove / load some new meshes only.

Hi,
I’m attaching two pictures of what’s the result I see in the headset.
The first one is the main scene once XR is activated, the second one is how the camera looks after the new scene is loaded with the script I posted before. It seems that each half is locked on its “partial view” and rotates with the head.


Do you have any hint or useful link?
Thanks again.