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

fix(android): optimize cameraX rotation after camera is active #14139

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

m1ga
Copy link
Contributor

@m1ga m1ga commented Oct 24, 2024

When you use cameraX and rotate the camera AFTER opening it in portrait mode it won't update the target rotation and the image had the wrong orientation.

Test

var win = Ti.UI.createWindow();
var img = Ti.UI.createImageView();
win.addEventListener("click", function() {
	Ti.Media.requestCameraPermissions(function(e) {
		if (e.success) {
			var overlay = Ti.UI.createView();
			var btn = Ti.UI.createButton({
				bottom: 0,
				title: "take"
			})
			overlay.add(btn);
			Ti.Media.showCamera({
				overlay: overlay,
				useCameraX: true,
				success: function(e){
					img.image = e.media;
				}
			});

			btn.addEventListener("click", function() {
				Ti.Media.takePicture();
			})
		}
	});
})
win.add(img);
win.open();

Run the app and click on the screen to open the camera.

  • Hold it in Portrait mode
  • click the screen
  • rotate it horizontally
  • take a picture
  • rotate it back to portrait and look at the imageview
  • it should have the correct orientation

Test 2:

  • start in landscape and take a picture

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

Successfully merging this pull request may close these issues.

1 participant