javascriptmobileaframewebxr

Call XRSystem.isSessionSupported return true, but Failed to execute 'requestSession' on 'XRSystem'


I'm trying to make a webXR application with A-Frame. I want to detect whether user device(usally mobile) is support AR or not, So I follow this instruction.

    navigator.xr.isSessionSupported("immersive-ar").then((allow) => {
      if (allow === false) {
        message.innerHTML = `AR not supported`;      
      }
    });

    if (navigator.xr === undefined) {
      message.innerHTML = `XR not supported`;
    }

The problem is that Even the paramter allow is return true, but when user touch the button at bottom right(Enter AR), It's throw an error of Could not create a session because: The runtime for this configuration could not be installed.

I can run my application on some mobile, but when the device not support, It will stuck.

Am I wrong? Is there another way to detect supported status?

navigator.xr.isSessionSupported("immersive-ar").then((allow) => {
      if (allow === false) {
        // Expect: When EnterAR(true) wont working, show this. 
        message.innerHTML = `AR not supported`;
      }
    });

    if (navigator.xr === undefined) {
       // Expect: When EnterAR(true) wont working, or show this.
      message.innerHTML = `XR not supported`;
    }

Solution

  • Looks like this issue. a-frame uses navigator.xr.supportsSession('immersive-ar') for support detection, but since you have the option to press the AR button, the browser is providing invalid info.

    Since the detection can be faulty, You could