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

Restrictions on an immersive session #469

Closed
AdaRoseCannon opened this issue Jan 10, 2019 · 4 comments · Fixed by #709
Closed

Restrictions on an immersive session #469

AdaRoseCannon opened this issue Jan 10, 2019 · 4 comments · Fixed by #709
Assignees
Labels
fixed by pending PR A PR that is in review will resolve this issue. help wanted This is a good issue for anyone to pick up and work on filing a PR for.
Milestone

Comments

@AdaRoseCannon
Copy link
Member

BS Issue: https://immersive-web.github.io/webxr/#issue-7782964d

Immersive sessions have exclusive access to the hardware so that other applications do not interfere.

Additionally, Immersive sessions MUST be given exclusive access to the XR device, meaning that while the immersive session is not blurred the HTML document is not shown on the XR device's display, nor is content from other applications shown on the XR device's display.
https://immersive-web.github.io/webxr/#immersive-session

Whilst this enables great performance it also may result in some restrictions in implementation and what can be built using the API. Which may need to be expanded upon such as:

What does this mean re: Browser and Operating System user interfaces, how much content can the user agent overlay on the render to assist the user or enable normal browsing?

Does this limit the possibility of layered AR apps? I.e. leaving a website as a virtual object in a room to come back and interact with later. Or a weather AR web page to easily check the weather whilst working on other things.

@NellWaliczek NellWaliczek added this to the CR for 1.0 milestone Jan 14, 2019
@dozenit
Copy link

dozenit commented Feb 12, 2019

Is this the reason why immersive sessions are not available anymore since the change of requesting them directly via navigator.xr.requestSession, instead of requesting an object instance representing the XR device?

As the page currently states itself, the ar-with-webxr codelabs example does not work anymore.

Since then, even when adapting the respective lines of code that have been altered with the latest API changes, entering an immersive session with an active camera won't work anymore:
webxr_immersivearsessionnotavailable_chrome_2019-02-12_14-55-12

Only the session mode 'inline' will be accepted. (IIRC, that actually always had been be the case; however it was seemingly ignored, as it did not prevent the camera from working for the Google Pixel.)
As this is not an immersive session, the session.environmentBlendMode is set to 'opaque'. The device orientation is still tracked to update the camera position and thus look around in the rendered scene. But the environment itself won't be visible, and session.requestHitTest() will also be rejected.

@alon-grinshpoon appears to have the same issue.

Whilst this enables great performance it also may result in some restrictions in implementation and what can be built using the API.

You are on point. I did indeed have quite the performance issues with my Google Pixel, where the plane detection features turned out to be the culprit. (Covering the camera fixed the bad framerate.)
However, webapps are now rendered useless for smartphones that used to be able to get immersive sessions with the WebXR Device API.

I thought yesterday's update might fix that issue, but that doesn't appear to be the case unfortunately.
Since the session's attributes are writeOnly, there is also no hacky workaround that I know of.

Is there currently another workaround to get these apps working with the latest Chrome Build, or will a fallback to an earlier version (e.g. Canary 72.0.3592.2) be necessary?

@erikriverson
Copy link

@DoDecaDence I realize this is the wrong forum for support on this issue, but I've been trying very hard for the last week to get my WebXR AR hit test demo running again, after it stopped working in Canary at the beginning of January. After reading this issue, it sounds like a previous version of Canary is the only route that will work for me, so if you have any insight into how to get a functioning previous version of Canary going on Android, it would be appreciated. Every APK of Canary I find on APK download sites crashes on launch on all my test devices, so I abandoned that approach. Thank you!

@klausw
Copy link
Contributor

klausw commented Feb 20, 2019

Current Chrome Canary does not support 'immersive-ar' mode yet, that's still in development. As an unsupported stopgap, you could try something similar to the following to fall back to the nonstandard legacy-inline-ar mode based on a separately created fullscreen canvas:

      function onRequestSession() {
        navigator.xr.requestSession({ mode: 'immersive-ar' }).then((session) => {
            onSessionStarted(session);
        }).catch(() => {
            let legacyCanvas = makeCanvas();
            let legacyCtx = legacyCanvas.getContext('xrpresent');
            navigator.xr.requestSession({ mode: 'legacy-inline-ar',
                                          outputContext: legacyCtx
                                        }).then((session) => {
                document.body.appendChild(legacyCanvas);
                onSessionStarted(session);
            });
        });
      }

      function makeCanvas() {
          // Create a fullscreen canvas element for use with legacy AR mode.
          let canvas = document.createElement('canvas');
          canvas.style.width = '100%';
          canvas.style.height = '100%';
          canvas.style.left = 0;
          canvas.style.top = 0;
          canvas.style.right = 0;
          canvas.style.bottom = 0;
          canvas.style.margin = 0;
          canvas.id = 'legacy-canvas';
          return canvas;
      }

+@alon-grinshpoon FYI.

@NellWaliczek NellWaliczek added the help wanted This is a good issue for anyone to pick up and work on filing a PR for. label May 28, 2019
@Manishearth Manishearth self-assigned this Jun 17, 2019
@Manishearth
Copy link
Contributor

#709

@Manishearth Manishearth added the fixed by pending PR A PR that is in review will resolve this issue. label Jun 17, 2019
@toji toji closed this as completed in #709 Jun 17, 2019
@toji toji modified the milestones: July 2019, June 2019 Jun 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed by pending PR A PR that is in review will resolve this issue. help wanted This is a good issue for anyone to pick up and work on filing a PR for.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants