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

having this as a request on an open session may cause extra dialogs to user #3

Closed
blairmacintyre opened this issue Apr 18, 2019 · 4 comments

Comments

@blairmacintyre
Copy link

blairmacintyre commented Apr 18, 2019

Having the configuration of world tracking that this be a call on the session will allow it to be updated while the session is running, which is good

 planeDetectionState : {
   enabled : true
 }

BUT, it also means that the call may happen after a UA has asked the user if they will approve WebXR starting, which may require another dialog.

Can we change this to add something like:

navigator.xr.requestSession('immersive-ar', {worldKnowledge: true})
      .then(onSessionStarted)
      .catch(err => {
        // May fail for a variety of reasons. Probably just want to
        // render the scene normally without any tracking at this point.
        window.requestAnimationFrame(onDrawFrame);
      });

We could still support popping up permissions if sensing state is called when permissions haven't been requested. So

function onSessionStarted(session) {
  // Store the session for use later.
  xrSession = session;
  xrSession.updateWorldSensingState({
      planeDetectionState : {
         enabled : true
     })

could pop up permissions if worldKnowledge hasn't been requested. This would, however, that updateWorldSensingState is a Promise, since it could fail:

xrSession.updateWorldSensingState({
      planeDetectionState : {
         enabled : true
     }).then(stateUpdated)
      .catch(err => {
        // May fail for a variety of reasons, depending on the implementation and the 
        // permissions granted by the user, or the capabilities of the platform
      });

Also, two other things here:

  1. for the option for requestSession, I suggest worldKnowledge, meaning "this page has access to world knowledge". The sensing and tracking will happen regardless, in the platform, even if it's not available to this app.

  2. I change updateWorldTrackingState to updateWorldSensingState because tracking is about "tracking changes and motion", while sensing is broader (e.g., detecting static structure, etc).

UPDATE: Changed a bit of the text above for clarity. This is also discussed in #7

@blairmacintyre
Copy link
Author

hey @toji look, another candidate for requestSession options! 😎

@blairmacintyre
Copy link
Author

@johnpallett @bialpio comments welcome. I am probably going to start fiddling with an implementation later today (I hope)

@bialpio
Copy link
Contributor

bialpio commented Jun 24, 2019

Link to PR: immersive-web/webxr#689.

@bialpio
Copy link
Contributor

bialpio commented Feb 25, 2021

Closing this issue, I will be reworking the explainer to address this concern. The core API seems to be moving away from configuring the session at run-time, so this proposal makes sense.

@bialpio bialpio closed this as completed Feb 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants