Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: WebXR API not working #35011

Open
3 tasks done
acceleratxr opened this issue Jul 21, 2022 · 17 comments
Open
3 tasks done

[Bug]: WebXR API not working #35011

acceleratxr opened this issue Jul 21, 2022 · 17 comments
Labels
blocked/need-info ❌ Cannot proceed without more information bug 🪲

Comments

@acceleratxr
Copy link

Preflight Checklist

Electron Version

19.0.8

What operating system are you using?

Windows

Operating System Version

Windows 11 Pro 22000.795

What arch are you using?

x64

Last Known Working Electron version

No response

Expected Behavior

Using the WebXR API successfully detects 'immersive-vr' as being supported.

The following is our react-based application running in Chrome version 103.

image

Actual Behavior

Using the WebXR API does not detect 'immersive-vr' as being supported.

image

Testcase Gist URL

No response

Additional Information

I was able to reproduce this behavior using Electron v19.0.8, v20.0.0-beta10, and a custom v21 nightly build with checkout_openxr explicitly set to True. I have also tried explicitly disabling the sandbox mode for the browser window as shown in the example below...

mainWindow = new BrowserWindow({
            backgroundColor: "#000",
            frame: false,
            width: Store.has("win.width") ? Store.get("win.width") : MIN_WIN_WIDTH,
            height: Store.has("win.height") ? Store.get("win.height") : MIN_WIN_HEIGHT,
            x: Store.has("win.x") ? Store.get("win.x") : undefined,
            y: Store.has("win.y") ? Store.get("win.y") : undefined,
            minWidth: MIN_WIN_WIDTH,
            minHeight: MIN_WIN_HEIGHT,
            webPreferences: {
                contextIsolation: false,
                nodeIntegration: false,
                preload: __dirname + "/preload.js",
                sandbox: false
            },
        });

Test code for detecting the VR support is as follows...

const [vrSupported, setVRSupported] = useState(true);

    useEffect(() => {
        if ("xr" in navigator) {
            //@ts-ignore
            navigator.xr.isSessionSupported('immersive-vr')
                .then((isSupported: boolean) => {
                    setVRSupported(isSupported);
                });
        }
    }, []);
@acceleratxr acceleratxr changed the title [Bug]: WebXR not working [Bug]: WebXR API not working Jul 21, 2022
@MarshallOfSound
Copy link
Member

Per https://releases.electronjs.org/ Electron 19 is based on M102, can you try Electron 20 beta which is based on M104 and therefore will more likely align with your testcase of Chrome M103

@MarshallOfSound MarshallOfSound added the blocked/need-info ❌ Cannot proceed without more information label Jul 23, 2022
@acceleratxr
Copy link
Author

Per https://releases.electronjs.org/ Electron 19 is based on M102, can you try Electron 20 beta which is based on M104 and therefore will more likely align with your testcase of Chrome M103

As already noted in the additional information.

"I was able to reproduce this behavior using Electron v19.0.8, v20.0.0-beta10, and a custom v21 nightly build with checkout_openxr explicitly set to True."

@rdumouchelle
Copy link

@MarshallOfSound Per above, this isn't blocked. Can the tags be updated accordingly? Thank you.

@github-actions
Copy link
Contributor

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!

@github-actions github-actions bot added the stale label Nov 13, 2022
@rdumouchelle
Copy link

This is still occurring and needs support

@github-actions github-actions bot removed the stale label Nov 14, 2022
@github-actions
Copy link
Contributor

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!

@github-actions github-actions bot added the stale label Feb 13, 2023
@rdumouchelle
Copy link

rdumouchelle commented Feb 13, 2023

Still occurring.

@MarshallOfSound as described in original comment: #35011 (comment) -- the repro is described here. The blocked/need more info label should be able to be removed; if not please comment on the ticket what more is needed.

@github-actions github-actions bot removed the stale label Feb 14, 2023
@samrun0
Copy link

samrun0 commented Mar 23, 2023

Any updates on this issue, and in order to enable webXR for ElectronJS?

@cyberneticocult
Copy link

cyberneticocult commented Apr 9, 2023

Pretty good blog post about this topic. https://bai.dev/projects/webxr-electron-apr2021.html

The main point being OpenXR is not included in the build of Electron so the WebXR api is disabled.
Electron DEPS File

You can either make a local build of Electron like in the post or use NW.js which has WebXR enabled.
NW.js DEPS File

@github-actions
Copy link
Contributor

github-actions bot commented Jul 9, 2023

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!

@github-actions github-actions bot added the stale label Jul 9, 2023
@rdumouchelle
Copy link

Still occurring.

@github-actions github-actions bot removed the stale label Jul 11, 2023
@alexpineda
Copy link

alexpineda commented Aug 7, 2023

I'm not having any luck either. Working on a 3d renderer for the original StarCraft and my dream is to have VR work with it. The devices aren't being found, even with the same example working in Chrome. I'm using the ThreeJS VRButton, who's examples can be seen here: https://threejs.org/examples/?q=vr#webxr_vr_handinput

I'm using Oculus 2 with link cable. SteamVR works, other browser examples work, electron doesn't :( Any pointers would be great. I did try adding the ACLs on the executable directory.

The default DEPS build should work since I'm on windows:

  # By default checkout the OpenXR loader library only on Windows and Android.
  # The OpenXR backend for VR in Chromium is currently only supported for these
  # platforms, but support for other platforms may be added in the future.
  'checkout_openxr' : 'checkout_win or checkout_android'

I also tried hardcoding it in my own build but no luck

'checkout_openxr' : True,

I've validated that I'm running in a secure context:

isSecureContext === true

and navigator.xr is present

@cyberneticocult
Copy link

@alexpineda You're probably running into the same issue that @jbaicoianu did with the access control lists (ACLs).
I would give the blog post a read through, it's pretty detailed. https://bai.dev/projects/webxr-electron-apr2021.html

@electron-issue-triage
Copy link

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!

@yuripourre
Copy link

Bump

@electron-issue-triage
Copy link

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!

@yuripourre
Copy link

bump

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked/need-info ❌ Cannot proceed without more information bug 🪲
Projects
None yet
Development

No branches or pull requests

8 participants
@alexpineda @rdumouchelle @yuripourre @MarshallOfSound @samrun0 @cyberneticocult @acceleratxr and others