Skip to content
Snippets Groups Projects
Commit 2c0c4fe1 authored by Robert Long's avatar Robert Long
Browse files

Added comment to explain Oculus Go hack and additional clearTimeout.

parent 7f1b7745
No related branches found
No related tags found
No related merge requests found
...@@ -13,6 +13,10 @@ AFRAME.registerSystem("exit-on-blur", { ...@@ -13,6 +13,10 @@ AFRAME.registerSystem("exit-on-blur", {
}, },
tick() { 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) { if (this.isOculusBrowser) {
clearTimeout(this.exitTimeout); clearTimeout(this.exitTimeout);
this.exitTimeout = setTimeout(this.onTimeout, 15 * 1000); this.exitTimeout = setTimeout(this.onTimeout, 15 * 1000);
...@@ -21,6 +25,7 @@ AFRAME.registerSystem("exit-on-blur", { ...@@ -21,6 +25,7 @@ AFRAME.registerSystem("exit-on-blur", {
onBlur() { onBlur() {
if (this.el.isMobile) { if (this.el.isMobile) {
clearTimeout(this.exitTimeout);
this.exitTimeout = setTimeout(this.onTimeout, 30 * 1000); this.exitTimeout = setTimeout(this.onTimeout, 30 * 1000);
} }
}, },
......
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