diff --git a/package.json b/package.json index bc24c957737d5c979511498f0fcb3a0713b71abe..699e7ba220a97740b45ad59063c4ce3c6d345708 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,7 @@ "react-intl": "^2.4.0", "react-router-dom": "^4.2.2", "screenfull": "^3.3.2", - "super-hands": "https://github.com/infinitelee/aframe-super-hands-component#mr-social-client/master", + "super-hands": "https://github.com/mozillareality/aframe-super-hands-component#hubs/master", "uuid": "^3.2.1", "webrtc-adapter": "^6.0.2" }, diff --git a/src/systems/exit-on-blur.js b/src/systems/exit-on-blur.js index f3b3979aa29ae52e924370f7cc1f87a3b20c119d..c6820a4016cbd3440bab91997e19741b006b6b29 100644 --- a/src/systems/exit-on-blur.js +++ b/src/systems/exit-on-blur.js @@ -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); diff --git a/yarn.lock b/yarn.lock index 4cda32f1367a73148e1b847051739c0c1246b7df..3c775445afbb49ed48e927430f2decd0ce5dfc09 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8095,9 +8095,9 @@ subarg@^1.0.0: dependencies: minimist "^1.1.0" -"super-hands@https://github.com/infinitelee/aframe-super-hands-component#mr-social-client/master": +"super-hands@https://github.com/mozillareality/aframe-super-hands-component#hubs/master": version "2.1.0" - resolved "https://github.com/infinitelee/aframe-super-hands-component#e4d91f4b9bc91a57f35aa9d43f3e797ebfc5477d" + resolved "https://github.com/mozillareality/aframe-super-hands-component#579024a260f8b9821cf1cbabd403055116bc2eb9" supports-color@1.3.1: version "1.3.1"