AR-js-org / AR.js

Image tracking, Location Based AR, Marker tracking. All on the Web.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Camera stream rotated 90 degrees when landscape

Platform-Group opened this issue · comments

Do you want to request a feature or report a bug?

Bug

What is the current behavior?

Portrait orientation has correct camera feed orientation
MicrosoftTeams-image (5)

Landscape orientation has camera feed rotated 90 degrees
MicrosoftTeams-image (4)

If the current behavior is a bug, please provide the steps to reproduce.

<!DOCTYPE html>
<html>
<head>
    <meta charset='utf-8'>
    <meta http-equiv='X-UA-Compatible' content='IE=edge'>
    <title>GeoAR.js demo</title>
    <script
      type="text/javascript"
      src="https://aframe.io/releases/1.4.2/aframe.min.js"
    ></script>
    <script
      type="text/javascript"
      src="/arjs/aframe/build/aframe-ar.js"
    ></script>
</head>
<body style='margin: 0; overflow: hidden;'>
    <a-scene vr-mode-ui="enabled: false" embedded
        arjs='sourceType: webcam; sourceWidth:400; sourceHeight:300; displayWidth: 400; displayHeight: 300; debugUIEnabled: false;videoTexture: true'>

        <a-camera>
        </a-camera>
    </a-scene>
</body>

Please mention other relevant information such as the browser version, Operating System and Device Name

Only reproduced on Poco F5 using Firefox, I realise this makes it hard to debug. I'm happy to do it myself if someone can point me to the relevant files, I've tried going through the source code myself and couldn't find anything in use which is related to the camera feed orientation. I did fix a bug in gps-camera.js though if you want that:

if (!onError) {
      const that = this
      onError = function (err) {
        console.warn("ERROR(" + err.code + "): " + err.message);

        if (err.code === 1) {
          // User denied GeoLocation, let their know that
          that.el.sceneEl.systems["arjs"]._displayErrorPopup(
            "Please activate Geolocation and refresh the page. If it is already active, please check permissions for this website."
          );
          return;
        }

        if (err.code === 3) {
          that.el.sceneEl.systems["arjs"]._displayErrorPopup(
            "Cannot retrieve GPS position. Signal is absent."
          );
          return;
        }
      };
    }

Previously this was undefined due to the inline function missing the context, so I replaced this usage with that.

What is the expected behavior?

The camera orientation should remain correct (relative to real world) regardless of device orientation.

Perhaps a non-embedded scene highlights the problem better

MicrosoftTeams-image (6)