Skip to content

Commit 1da8187

Browse files
committed
Apply @k15z fix in issue #498
1 parent 719c636 commit 1da8187

12 files changed

+30
-12
lines changed

aframe/build/aframe-ar-location-only.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

aframe/build/aframe-ar-location-only.mjs

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

aframe/build/aframe-ar-new-location-only.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

aframe/build/aframe-ar-new-location-only.mjs

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

aframe/build/aframe-ar-nft.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

aframe/build/aframe-ar-nft.mjs

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

aframe/build/aframe-ar.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

aframe/build/aframe-ar.mjs

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

aframe/src/location-based/arjs-webcam-texture.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,18 @@ AFRAME.registerComponent("arjs-webcam-texture", {
2222

2323
play: function () {
2424
if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
25+
let idealWidth = window.innerWidth;
26+
let idealHeight = window.innerHeight;
27+
const isPortrait = screen.availHeight > screen.availWidth;
28+
if (isPortrait) {
29+
idealWidth = window.innerHeight;
30+
idealHeight = window.innerWidth;
31+
}
2532
const constraints = {
2633
video: {
2734
facingMode: "environment",
35+
width: { ideal: idealWidth },
36+
height: { ideal: idealHeight },
2837
},
2938
};
3039
navigator.mediaDevices

three.js/build/ar-threex-location-only.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

three.js/build/ar-threex-location-only.mjs

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

three.js/src/location-based/js/webcam-renderer.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,20 @@ class WebcamRenderer {
2828
0,
2929
10,
3030
);
31+
// fix provided by @k15z in #498
32+
let idealWidth = window.innerWidth;
33+
let idealHeight = window.innerHeight;
34+
const isPortrait = screen.availHeight > screen.availWidth;
35+
if (isPortrait) {
36+
idealWidth = window.innerHeight;
37+
idealHeight = window.innerWidth;
38+
}
39+
3140
if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
3241
const constraints = {
3342
video: {
34-
width: 1280,
35-
height: 720,
43+
width: { ideal: idealWidth },
44+
height: { ideal: idealHeight },
3645
facingMode: "environment",
3746
},
3847
};

0 commit comments

Comments
 (0)