immersive-web / webxr-samples

Samples to demonstrate use of the WebXR Device API
https://immersive-web.github.io/webxr-samples/
MIT License
995 stars 479 forks source link

WebXR samples not working with Oculus or Vive in Chrome 77 #43

Closed phtaylor closed 4 years ago

phtaylor commented 4 years ago

This year the WebXR API in Chrome has been going through a lot of changes and that is fine. However, I am starting to wonder if I have something incorrectly setup. I have been unable to get WebXR going on my desktop HMDs since Chrome 74.

We just get an exception when 'requestSession' is called with 'immersive-vr'. Note: I am only interested in desktop VR, not mobile, which seems to be more common.

  navigator.xr.requestSession('immersive-vr').then(onSessionStarted);

image

Version 77.0.3865.90 (Official Build) (64-bit)

All I need is a sample that works on a current build of Chrome with Oculus Rift or Vive. Is it possible I have flags not configured correctly? I have tried enabling/disabling everything and various combinations, and to no avail. Always the Uncaught DOMException before any client code is called.

My current solution is to downgrade to Chrome 74, but there must be a reason nothing is working.

Please mr @toji , any tips would save me right now.

toji commented 4 years ago

I'll take a look and see if I can figure out what's going on. There are some differences between Chrome 77's implementation and the version of the API that the samples use, but the Polyfill should be patching those up.

phtaylor commented 4 years ago

Some more details on my testing

If you are able to get a Vive or Oculus working, then I must have something incorrectly setup. However, for now I am moving all work to WMR. (we have a presentation on Wednesday am)

Thanks!

phtaylor commented 4 years ago

Any update on this @toji ? Does anyone else have Vive or Oculus working on WebXR?

klausw commented 4 years ago

Please see the "State of WebXR" document which has implementation notes: https://docs.google.com/document/d/1R8Bz0_vK9YmY5-ZhsbLtZ9-DDJpTOgNeibFD4SdUnbw/edit

Specifically, Vive and Oculus support requires disabling "XR device sandboxing" in chrome://flags . If that's not the issue, can you please post your flags settings?

klausw commented 4 years ago

Also, apologies that this is all still rather complicated and not documented well. My previous post wasn't intended to imply that this should have been obvious, it definitely isn't working as intended.

Hopefully it will be easier as things move closer to a stable release.

phtaylor commented 4 years ago

bingo! its working again. Phew! Thanks. Yes I had read through the doc and missed the comment explaining the importance of the sandboxing flag. I was sure it must have been on my side.

jespertheend commented 4 years ago

@klausw it seems like the "XR device sandboxing" flag has disappeared. What are the current required flags to make WebXR work on SteamVR?

toji commented 4 years ago

As we gain better compatibility with other runtimes (such as OpenXR) we're trying to discourage casual disabling of the sandbox in the interest of user security. You can still achieve the same thing by passing command line flags, though, as described here.

We know that this is a pain, but given that bot Oculus and Valve are working on OpenXR runtimes and Microsoft already has one that's fully compatible with Chrome's WebXR implementation we're focusing our efforts on making that path as pain-free as possible.

jespertheend commented 4 years ago

@toji ah cool, thanks for the info! That's understandable. And thanks for the link, VR on the web has gone through quite some changes and I've always found it difficult to get it working in Chrome whenever there was an update. That document sure is helpful.

sjpt commented 4 years ago

The problem seems to have come back with Canary 87, and the command line flags in https://immersiveweb.dev/chrome-support.html no longer seem to work either.

toji commented 4 years ago

Since both Oculus and SteamVR now have OpenXR runtimes that are available to developers, and OpenXR is the better supported path in Chrome, we've recently removed the proprietary API support in favor of using OpenXR across the board. (https://immersiveweb.dev/chrome-support.html needs to be updated to reflect this.)

For details about how to get the OpenXR runtime associated with your device, see the following:

sjpt commented 4 years ago

Thank you for the quick reply. Things now working. In case it helps others ...

I have installed the Steam openVR beta (beta 1.14.10) as described in your SteamVR reference above, and set SteamVR/Settings/Developer/CurrentOpenXR runtime to SteamVR (nb SteamVR/Settings/Developer, not SteamVR/Developer Settings)

Testing using [https://immersive-web.github.io/webxr-samples/immersive-vr-session.html] (https://immersive-web.github.io/webxr-samples/immersive-vr-session.html)

Command line flags that work on Chrome 85/86 are --enable-features=OpenVR --disable-features=XRSandbox --user-data-dir="%LOCALAPPDATA%\canaryvrZ" These flags work with or without the SteamVR/OpenXR settings above. Without those settings and with SteamVR/OpenXR settings above 85 and 86 fail in different ways.

Chrome 87 works with SteamVR/OpenXR settings above; regardless of whether the Chrome flags are set. (Things are clearly moving in the correct direction despite the boulders on the way.)

NOTE: user-data-dir needed to keep a separate Chrome instance from the 'main' one; otherwise if you have a 'normal' Chrome running tests launch a clone of the main one ignoring other flags.

blairmacintyre commented 3 years ago

I'm running into this issue and it's driving me nuts 😄

Trying to get WebXR working across a variety of devices (Oculus, Steam, Windows MR) and browsers since I'm teaching with it. Firefox works fine.

The above helped a bit. Chrome Canary and Edge Dev both now offer WebXR and seem to think they are running. Steam even thinks they are running. Since I'm (currently) using a Cosmos, when I hit "enter VR" it transitions from Steam Home to the Vive void with "Vive" and "This is real" showing, and Steam VR says "Now Playing chrome". The perf monitor is showing frames submitted at ~2ms. But I'm not seeing the VR content.

Current SteamVR beta is 1.14.14. I'm wondering if they broke something between 1.14.10 (mentioned above) and 1.14.14?

klausw commented 3 years ago

FWIW, the samples are working for me on SteamVR beta 1.14.14 and Chrome Canary 87.0.4265.0 (Official Build) canary (64-bit) (cohort: Clang-64) on a Valve Index, with no Chrome flags set:

"C:\Users\...\AppData\Local\Google\Chrome SxS\Application\chrome.exe --flag-switches-begin --flag-switches-end

OS version is Windows 10 Home 10.0.18363 Build 18363

@blairmacintyre , did you get a prompt from SteamVR to enable the new permissions needed for App Container usage? That's a one-time thing, but it didn't work for me until I spotted and confirmed that prompt. It showed up above the SteamVR status window after I dismissed some other messages such as the beta update notification.

The OpenXR runtime was already set to SteamVR for me without having to change the SteamVR/Settings/Developer/Current OpenXR runtime setting.

blairmacintyre commented 3 years ago

OpenXR is set, yes. I did get that prompt.

same Canary Version 87.0.4265.0 (Official Build) canary (64-bit). I never set flags so I'm not sure how I'd check if any are set.

Windows 10 Home, latest update. Build 19041.508, so new than yours?

klausw commented 3 years ago

On Wed, Sep 16, 2020, 16:23 Blair MacIntyre notifications@github.com wrote:

OpenXR is set, yes. I did get that prompt.

same Canary Version 87.0.4265.0 (Official Build) canary (64-bit). I never set flags so I'm not sure how I'd check if any are set.

chrome://version shows the effective command line. That's in addition to chrome://flags which shows the internal (non command line) flags.

(It actually took me a few tries to get a clean run, Windows was quite insistent on using my old shortcuts with flags. I ended up setting up an additional "Canary with no flags" shortcut.)

blairmacintyre commented 3 years ago

Thanks for the help, @klausw.

chrome://version shows ""C:\Users\blair\AppData\Local\Google\Chrome SxS\Application\chrome.exe" --flag-switches-begin --flag-switches-end"

This is a fresh install of canary.

klausw commented 3 years ago

I filed https://bugs.chromium.org/p/chromium/issues/detail?id=1129495 , can we move this discussion there? Please add additional details in case you have them.