Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Android Camera Zoom with overlay in Titanium

$
0
0

I am trying to add an overlay for android camera using Titanium SDK. Everything is fine. But, zoom is not working. Is there a way to implement that in titanium?I am using the latest Titanium SDK 3.2.1GA Here's my code:

// Containing window
var win = Ti.UI.createWindow({
    navBarHidden : true,
    backgroundColor : "#ffffff",
    height : Ti.UI.FILL,
    width : Ti.UI.FILL
});
 
// Blue button that opens the camera
var open_camera = Ti.UI.createButton({
    height : Ti.UI.SIZE,
    width : Ti.UI.SIZE,
    bottom : 50,
    title : 'Camera'
});
// Adding the "open camera" button
win.add(open_camera);
 
// Function to show the camera
function openCamera() {
    alert('opening');
    open_camera.backgroundColor = "#00ff00";
    // Just checking if we got here
 
    // The camera overlay I want displayed over the camera
    var camera_overlay = Ti.UI.createView({
        top : 0,
        left : 0,
        height : Ti.UI.FILL,
        width : Ti.UI.FILL
    });
 
    var take_picture = Ti.UI.createButton({
        height : Ti.UI.SIZE,
        width : Ti.UI.SIZE,
        bottom : 50,
        title : 'Take Picture'
    });
    take_picture.addEventListener('click', function() {
        Ti.Media.takePicture();
    });
    camera_overlay.add(take_picture);
 
    // The actual show camera part
    Ti.Media.showCamera({
        success : function(e) {
            alert('success');
            // I want this!
        },
        cancel : function(e) {
        },
        error : function(error) {
        },
        autohide : false,
        showControls : false,
        mediaTypes : [Ti.Media.MEDIA_TYPE_PHOTO],
        overlay : camera_overlay // The camera overlay being added to camera view
    });
};
 
// Click event to show the camera
open_camera.addEventListener("click", function(e) {
    openCamera();
});
 
// Open the window
win.open();

Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>