Skip to content
Snippets Groups Projects
Unverified Commit fbfdc568 authored by Robert Long's avatar Robert Long Committed by GitHub
Browse files

Merge pull request #371 from mozilla/feature/oculus-go-support

Fix Oculus Browser timeout occuring in setup UI.
parents 60e2f2bf 58e3a28b
No related branches found
No related tags found
No related merge requests found
......@@ -3,11 +3,14 @@ AFRAME.registerSystem("exit-on-blur", {
this.onBlur = this.onBlur.bind(this);
this.onFocus = this.onFocus.bind(this);
this.onTimeout = this.onTimeout.bind(this);
this.onEnterVR = this.onEnterVR.bind(this);
this.isOculusBrowser = navigator.userAgent.match(/Oculus/);
this.enteredVR = false;
window.addEventListener("blur", this.onBlur);
window.addEventListener("focus", this.onFocus);
this.el.addEventListener("enter-vr", this.onEnterVR);
this.exitTimeout = null;
},
......@@ -17,12 +20,17 @@ AFRAME.registerSystem("exit-on-blur", {
// 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) {
// We also check that you have entered VR so that this timeout does not occur in the setup UI.
if (this.isOculusBrowser && this.enteredVR) {
clearTimeout(this.exitTimeout);
this.exitTimeout = setTimeout(this.onTimeout, 15 * 1000);
}
},
onEnterVR() {
this.enteredVR = true;
},
onBlur() {
if (this.el.isMobile) {
clearTimeout(this.exitTimeout);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment