Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix motion events detection for iOS 13.4, which are broken #42

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/sensor-fusion/fusion-pose-sensor.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ function FusionPoseSensor(kFilter, predictionTime, yawOnly, isDebug) {
// https://github.com/immersive-web/cardboard-vr-display/issues/18
let chromeVersion = Util.getChromeVersion();
this.isDeviceMotionInRadians = !this.isIOS && chromeVersion && chromeVersion < 66;
// In Chrome m65 there's a regression of devicemotion events. Fallback
// In Chrome m65 and Safari 13.4 there's a regression of devicemotion events. Fallback
// to using deviceorientation for these specific builds. More information
// at `Util.isChromeWithoutDeviceMotion`.
this.isWithoutDeviceMotion = Util.isChromeWithoutDeviceMotion();
this.isWithoutDeviceMotion = Util.isChromeWithoutDeviceMotion() || Util.isSafariWithoutDeviceMotion();

this.filterToWorldQ = new MathUtil.Quaternion();

Expand Down
11 changes: 11 additions & 0 deletions src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,17 @@ export const getChromeVersion = (function() {
};
})();

/**
* In Safari 13.4 for iOS `devicemotion` events are broken
*/
export const isSafariWithoutDeviceMotion = (function() {
let value = false;
value = isIOS() && isSafari() && navigator.userAgent.indexOf('13_4') !== -1;
return function () {
return value;
};
})();

/**
* In Chrome m65, `devicemotion` events are broken but subsequently fixed
* in 65.0.3325.148. Since many browsers use Chromium, ensure that
Expand Down