WebXRExperienceHelper.CreateAsync does not return value in the hololens 2 emulator

I’m building application for the hololens 2 and using emulator for development.

I hosted an example on the github because playground does not loading in the emulator browser. https://naumovevgeniy.github.io/babylon-xr-test/. You can see index.html file with example.

Behaviour on regular computer:

  • executed alert(1)
  • console writes: “WebXR not available” (obviosly)

Behaviour in the hololens 2 emulator:

  • executed alert(1)
  • nothing else

After 83 line code is not executed. Error messages are not appearing. It looks like the method BABYLON.WebXRExperienceHelper.CreateAsync fell asleep

Pinging @RaananW

Hi and welcome!

Would be great to know with what browser you are testing your XR experience so I can take it from there.


BTW, you can load playgrounds in the emulator, if you use frame.html#CODE instead of the index

Thanks for reply!

I’m testing in the edge. I know, this page says to install chrome canary browser, but emulator does not have ability to do it (or I dont know how to do it).

I forget to say, I’m using version 4.1.0-beta.22

Edge does not support WebXR, so it won’t work for sure. it probably fails somewhere along the way. My assumption is that it happens when trying to access the navigator.xr , but I need to check.

I do agree, however, that an error should be thrown, and it shouldn’t hang with no reason. Want to create a ticket for me on github?

Sorry, just realized what the problem is.

As I am writing the documentation right now I can’t reference it yet, but the basic experience helper ( the one you are trying to use instead of the default experience helper) does not fail silently. If you use async await you will need to wrap the CreateAsync call with try-catch, or use promises with then and catch. Otherwise, an exception will be thrown and the rest of the code will not be executed.

No need for a github issue, this is working as expected.