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

Camera stream rotated 90 degrees when landscape #567

Open
Platform-Group opened this issue Sep 11, 2023 · 1 comment
Open

Camera stream rotated 90 degrees when landscape #567

Platform-Group opened this issue Sep 11, 2023 · 1 comment

Comments

@Platform-Group
Copy link

Platform-Group commented Sep 11, 2023

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.

@Platform-Group
Copy link
Author

Perhaps a non-embedded scene highlights the problem better

MicrosoftTeams-image (6)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant