Skip to content

Conversation

josephrocca
Copy link
Contributor

Description:

The double-negative here is unfortunate, but session.enabledFeatures is currently only available in Chromium-based browsers, so we can't always 'positively' know that the feature is supported.

Another approach would be to wrap session.requestLightProbe in try/catch, or add .catch after the .then, but for whatever reason, those don't seem to actually catch the DOMException error for me.

Related: immersive-web/webxr#1296

Motivation:

The thrown error doesn't cause any serious problem - it just errors and fails. But it is annoying when using the "Pause on uncaught exceptions" feature of Chrome DevTools.

…sion.requestLightProbe`

The double-negative here is unfortunate, but currently `session.enabledFeatures` is only available in Chromium-based browsers, so we can't always *positively* know that the feature is supported.

Another approach would be to wrap `session.requestLightProbe` in try/catch, or add `.catch` after the `.then`, but for whatever reason, those don't seem to actually catch the error for me.

Related: immersive-web/webxr#1296
@josephrocca
Copy link
Contributor Author

josephrocca commented Mar 11, 2024

On second thought, I think Chromium is the only browser that implements much of anything WebXR-wise (in stable release) right now. Let me know if I should just assume existence of session.enabledFeatures and change it to featureIsEnabled - in which case I assume we could remove 'requestLightProbe' in session.

@Mugen87
Copy link
Collaborator

Mugen87 commented Mar 11, 2024

Do you mind explaining in more detail why the current implementation causes issues for you? I mean what device and browser are you using?

Right now XREstimatedLight just assumes light-estimation has been requested as a session feature. Considering our current policy, there is no need for an additional validation check.

@josephrocca
Copy link
Contributor Author

josephrocca commented Mar 11, 2024

Ah, right, in my case I am requesting the permission, and also adding XREstimatedLight to the scene (before session has started), and it has no effect on lighting if their browser doesn't support the feature, but I think you're right, I should really just be using something like:

// wait for session to start, then:
if(session.enabledFeatures.includes('light-estimation')) {
  // add XREstimatedLight to scene
}

I think that's what you mean - and agreed - this does make more sense.

I'll close this - sorry for the noise!

@Mugen87 Mugen87 added this to the r163 milestone Mar 11, 2024
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

Successfully merging this pull request may close these issues.

2 participants