diff --git a/src/systems/exit-on-blur.js b/src/systems/exit-on-blur.js index e0ab0f436af6acc8bae5972460b62aadb3bdbcc4..f3b3979aa29ae52e924370f7cc1f87a3b20c119d 100644 --- a/src/systems/exit-on-blur.js +++ b/src/systems/exit-on-blur.js @@ -13,6 +13,10 @@ AFRAME.registerSystem("exit-on-blur", { }, tick() { + // This is a hack to detect when an Oculus Go user has taken off the headset and the headset has + // entered standby mode. Currently Oculus Browser is not emitting a blur, vrdisplaydeactivate, + // vrdisplayblur, visibilitychange, or vrdisplaypresentchange event, so we wait 15 seconds after + // the last requestAnimationFrame callback to determine if the headset has gone into standby mode. if (this.isOculusBrowser) { clearTimeout(this.exitTimeout); this.exitTimeout = setTimeout(this.onTimeout, 15 * 1000); @@ -21,6 +25,7 @@ AFRAME.registerSystem("exit-on-blur", { onBlur() { if (this.el.isMobile) { + clearTimeout(this.exitTimeout); this.exitTimeout = setTimeout(this.onTimeout, 30 * 1000); } },