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

Merged
merged 3 commits into from
Nov 29, 2024

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

@hansemannn hansemannn merged commit 69b645f into master Nov 29, 2024
6 checks passed
@m1ga m1ga deleted the androidCameraXParameter branch December 16, 2024 10:46
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.

2 participants