Comments (2)
It seems that the firefox camera is zoomed in which accounts for this discrepancy, I'm just unsure of why the firefox camera is zoomed.
from ar.js.
I noticed from arjs-webcam-texture.js that if I look at the stream's settings firefox doesn't have the "zoom" parameter while chrome does. And changing the deviceId seems to break it or have no effect. However chrome allows for the zoom parameter. So rather than trying to zoom firefox out which seems to be impossible, I decided to just zoom chrome in to match it for now
So I added zoom to the constraints
video: {
facingMode: "environment",
zoom: 2
},
Added zoom to the 3d environment via the camera
<a-camera
fov-change
id="camera"
gps-new-camera="gpsMinDistance: 5; simulateLatitude: 1; simulateLongitude: 1; simulateAltitude: 400;"
far="1000000"
look-controls-enabled="true"
look-controls="enabled: true; magicWindowTrackingEnabled: true; touchEnabled: true; mouseEnabled: true"
zoom="2"
>
And set the fov to be dependent on the browser
AFRAME.registerComponent("fov-change", {
init: function () {
// grab the camera
const cam = document.querySelector("[camera]");
// this.el should also work for this as long as your fov-change component is on the camera
// grab the current FOV, this will be 80 as that's the default for aframe
const fov = cam.getAttribute("camera").fov;
console.log("Wow, fov is ", fov);
// update the camera with the new FOV
// if holding portrait use 61:
// cam.setAttribute("camera", "fov", 61)
// For whatever weird reason it seems that chrome and firefox use different fov values?
if (navigator.userAgent.indexOf("Chrome") != -1) {
cam.setAttribute("camera", "fov", 87);
} else if (navigator.userAgent.indexOf("Firefox") != -1) {
// For landscape, 45 on the ipad, 52.75 for the samsung
cam.setAttribute("camera", "fov", 52.75);
} else {
// Don't really know what other browsers use, but most will be chromium I suppose?
cam.setAttribute("camera", "fov", 87);
}
console.log("Wow, fov is now", document.querySelector("[camera]").getAttribute("camera").fov);
},
});
It's an ugly workaround but I don't think there's another option as I can't seem to get a better stream from firefox at all.
from ar.js.
Related Issues (20)
- Image tracking AR.js with React stuck on loading screen , please help! HOT 2
- Help please! image tracking work but 3d model and video not showing
- change "Twitter" to "𝕏 (Twitter)" in README.md HOT 3
- The camera cannot be controlled by external parameters, especially on phones with multiple cameras,help me please!
- Why the camera fails to be used now?
- Seems like the version is Updated but not the docs and example
- Document is so misleading HOT 2
- Module Import fails in Nuxt3 --- ar-threex-location-only.js --- Cannot read properties of undefined (reading 'THREE') HOT 2
- 将ar.js引入three.js 请求一个功能
- Location based compass orientation is incorrect. It always says North is direction when starting up. HOT 3
- Location Base - Entity is following HOT 3
- Event fired when user "see" an object (location based) HOT 1
- "click" events are not emitted on Android when scene is loaded dynamically HOT 1
- Replacing a building?
- Need help implementing AR.js
- New-location-based entity position problem HOT 1
- Location Based AR.JS project mixed with AFRAME Hit Test
- Place to list device models / OS versions which cause the "content sticking to camera" problem (#278)
- Raycaster intersects invisible marker roots. Is there any landmark to distinguish between displayed and hidden elements? (marker-based)
- node_modules animation-mixer not working HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ar.js.