diff --git a/src/hub.js b/src/hub.js index de5406105b7508fc5ed9291d6f47aebf669a4e68..a0de8cd657126afd8966321f01ead778f7f82da7 100644 --- a/src/hub.js +++ b/src/hub.js @@ -388,6 +388,14 @@ document.addEventListener("DOMContentLoaded", async () => { if (availableVREntryTypes.isInHMD) { remountUI({ availableVREntryTypes, forcedVREntryType: "vr" }); + + if (AFRAME.utils.device.getVRDisplay().displayName.indexOf("Cardboard") >= 0) { + // HACK - Oculus Go sometimes reports Cardboard as the primary VR display on startup + // and that is cached by A-Frame, so we need to resolve that before entering as well. + const displays = await navigator.getVRDisplays(); + const vrDisplay = displays.length && displays[0]; + AFRAME.utils.device.getVRDisplay = () => vrDisplay; + } } else { remountUI({ availableVREntryTypes }); }