From 85b0e9b5b09bb8cf9e40f089ef4edc341098e42a Mon Sep 17 00:00:00 2001 From: Greg Fodor <gfodor@gmail.com> Date: Tue, 13 Nov 2018 20:53:02 +0000 Subject: [PATCH] Apply fix in oculus browser only --- src/hub.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/hub.js b/src/hub.js index e3f759cfd..a9ac40c32 100644 --- a/src/hub.js +++ b/src/hub.js @@ -389,12 +389,13 @@ document.addEventListener("DOMContentLoaded", async () => { if (availableVREntryTypes.isInHMD) { remountUI({ availableVREntryTypes, forcedVREntryType: "vr" }); - // HACK - The polyfill reports Cardboard as the primary VR display on startup - // out ahead of Oculus Go on Oculus Browser 5.5.0. This display is cached by A-Frame, - // so we need to resolve that and get the real VRDisplay before entering as well. - const displays = await navigator.getVRDisplays(); - const vrDisplay = displays.length && displays[0]; - AFRAME.utils.device.getVRDisplay = () => vrDisplay; + if (/Oculus/.test(navigator.userAgent)) { + // HACK - The polyfill reports Cardboard as the primary VR display on startup out ahead of Oculus Go on Oculus Browser 5.5.0 beta. This display is cached by A-Frame, + // so we need to resolve that and get the real VRDisplay before entering as well. + const displays = await navigator.getVRDisplays(); + const vrDisplay = displays.length && displays[0]; + AFRAME.utils.device.getVRDisplay = () => vrDisplay; + } } else { remountUI({ availableVREntryTypes }); } -- GitLab