From 9295157c996ebe82e932fdb98dff16d3190520a7 Mon Sep 17 00:00:00 2001
From: Greg Fodor <gfodor@gmail.com>
Date: Tue, 13 Nov 2018 19:34:51 +0000
Subject: [PATCH] Add oculus go hack

---
 src/hub.js | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/hub.js b/src/hub.js
index de5406105..a0de8cd65 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 });
   }
-- 
GitLab