SquareCamera
SquareCamera copied to clipboard
No camera preview or image
OK, probably a dumb error on my part. But I don't get a camera preview, just a black view. And pictures I take are all black.
Module version 0.8, SDK 5.5.1.GA, iOS 10.1 on an iPhone 5, NSCamera*
keys are included in tiapp (plus the app previously used Ti.Media so camera permissions have been granted)
var camera = SquareCamera.createView({
top: 0,
left: 0,
height: Alloy.Globals.deviceWidth,
width: Alloy.Globals.deviceWidth,
detectCodes: false,
backgroundColor: "#000",
backQuality: SquareCamera.QUALITY_HD, // Optional Defaults to QUALITY_HD
camera: "back",
transform: Ti.UI.create2DMatrix().scale(1)
});
camera.addEventListener('success', saveImage);
$.cameraPreviewView.add(camera); // just a <View/>
I see [INFO] [object ComMfoggSquarecameraModule] loaded
in the console, but no errors. When I tap my custom shutter / take picture button, I get an all black image.
It was not clear to me from the docs that you cannot add the camera view to another view. You have to add it to the window. When I add it to the window, I see the preview. The resulting photos are horribly distorted in aspect ratio and zoom, but that's a different issue.
It would be great if I could add to a view. But, short of that, would you please at least make sure to clearly call out in the docs that you have to add to the window? Thanks.