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

device:error WebXR session support error: sceneEl is null #4373

Closed
mkungla opened this issue Dec 24, 2019 · 3 comments
Closed

device:error WebXR session support error: sceneEl is null #4373

mkungla opened this issue Dec 24, 2019 · 3 comments

Comments

@mkungla
Copy link
Contributor

mkungla commented Dec 24, 2019

Description:

Everything here needs DOMContentLoaded before right?

if (isWebXRAvailable) {

  • A-Frame Version: 1.0.2
  • Platform / Device: Firefox/WebXR API Emulator
  • Reproducible Code Snippet or URL:
@dmarcos
Copy link
Member

dmarcos commented Dec 24, 2019

What URL, browser, headset?

@mkungla
Copy link
Contributor Author

mkungla commented Dec 25, 2019

Firefox/WebXR API Emulator, haven't seen it with devices yet.

So I wrapped src/utils/device.js if (isWebXRAvailable) with document.addEventListener('DOMContentLoaded', () =>

if (isWebXRAvailable) {
var updateEnterInterfaces = function () {
var sceneEl = document.querySelector('a-scene');
if (sceneEl.hasLoaded) {
sceneEl.components['vr-mode-ui'].updateEnterInterfaces();
} else {
sceneEl.addEventListener('loaded', updateEnterInterfaces);
}
};
var errorHandler = function (err) {
error('WebXR session support error: ' + err.message);
};
if (navigator.xr.isSessionSupported) {
// Current WebXR spec uses a boolean-returning isSessionSupported promise
navigator.xr.isSessionSupported('immersive-vr').then(function (supported) {
supportsVRSession = supported;
updateEnterInterfaces();
}).catch(errorHandler);
navigator.xr.isSessionSupported('immersive-ar').then(function (supported) {
supportsARSession = supported;
updateEnterInterfaces();
}).catch(function () {});
} else if (navigator.xr.supportsSession) {
// Fallback for implementations that haven't updated to the new spec yet,
// the old version used supportsSession which is rejected for missing
// support.
navigator.xr.supportsSession('immersive-vr').then(function () {
supportsVRSession = true;
updateEnterInterfaces();
}).catch(errorHandler);
navigator.xr.supportsSession('immersive-ar').then(function () {
supportsARSession = true;
updateEnterInterfaces();
}).catch(function () {});
} else {
error('WebXR has neither isSessionSupported or supportsSession?!');
}
} else {
if (navigator.getVRDisplays) {
navigator.getVRDisplays().then(function (displays) {
var sceneEl = document.querySelector('a-scene');
vrDisplay = displays.length && displays[0];
if (sceneEl) { sceneEl.emit('displayconnected', {vrDisplay: vrDisplay}); }
});
}
}

and src/utils/tracked-controls.js

for (j = 0; j < profiles.length; j++) {
controllerMatch = profiles[j].startsWith(idPrefix);

between these lines there is no error checking if controller.profiles[n] is undefined which is currently case with WebXR API Emulator

e.g.

if (!profiles[j]) { profiles[j] = 'oculus-touch' }

after adding these dirty fixes emulator works fine - almost.

@dmarcos
Copy link
Member

dmarcos commented Dec 25, 2019

I fixed the first issue on 7f017a3

Issue with controllers is something different. controller.profiles should be an array of strings. I believe existing entries with undefined values shouldn't happen. It looks like a bug in the WebXR implementation of the emulator.

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