navigator.xr.requestDevice is not a function

I’m trying to replicate https://github.com/mrdoob/three.js/blob/master/examples/webvr_cubes.html in my https localhost environment but get an error navigator.xr.requestDevice is not a function on line 141 in https://github.com/mrdoob/three.js/tree/dev/examples/js/vr/WebVR.js when i enable WebXR Device API in my chrome browser (latest available–73).
Also none of the threejs webvr examples work after enabling WebXR Device API. They’re all black screen.
–THREE.WebGLRenderer 103

Author: Fantashit

2 thoughts on “navigator.xr.requestDevice is not a function

  1. I think this is a straight bug in Chrome which does not implement any version of XR correctly; it implements just enough to fool three.js WebVR into trying to use it. It could usefully be sidestepped in WebXR.js by replacing
    if ( ‘xr’ in navigator ) {
    with
    if ( ‘xr’ in navigator && navigator.xr.requestDevice ) {
    or similar.

    Even though the bug is Chrome’s, I suspect it has tricked enough people that it would be worth putting that extra code into three.js.

    Related: I think there are enough differences between WebGL and WebXR that even where WebXR is working properly there should be some way explicitly to force WebGL and override automatic detection.
    
  2. I’m currently getting this error on:

    • Chrome Version 79.0.3941.4 (Official Build) dev (64-bit)
    • Mac OS X 10.15

Comments are closed.