Skip to content

Commit

Permalink
Merge pull request #470 from kdvalin/flying-control-fixes
Browse files Browse the repository at this point in the history
Flying Control Fixes
  • Loading branch information
kdvalin authored Apr 10, 2021
2 parents cad7960 + 6ba4a4b commit 0e520a5
Showing 1 changed file with 6 additions and 19 deletions.
25 changes: 6 additions & 19 deletions src/utils/browserType.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,12 @@
import { UAParser } from "ua-parser-js";

const MOBILE_TYPES = [
"mobile",
"tablet",
"wearable"
];
import AFRAME from "aframe";

export const browserType = () => {
let parser = new UAParser();
const device = parser.getDevice();
const device = AFRAME.utils.device;

if("xr" in navigator) {
return "vr";
}
else if("getVRDisplays" in navigator && navigator.getVRDisplays().length > 0) {
return "vr";
}
else if(MOBILE_TYPES.indexOf(device.type) === -1) {
return "desktop";
}
else {
if(device.isMobile()) {
return "mobile";
}else if(device.getVRDisplay() && device.getVRDisplay().length >= 0) {
return "vr";
}
return "desktop";
};

0 comments on commit 0e520a5

Please sign in to comment.