Quantcast
Viewing all articles
Browse latest Browse all 8068

Cannot Recording Video and take photo using overlay

Hi Guys, I have been struggling with this issue for a long time now and its driving me absolutely crazy. i cannot switch between record video and capture photo using overlay, If i set show control to true i can swipe left and right to active camera or video record but the default camera UI shows which i do not want and to make matters worse once you have captured the image or video it then shows the use image option which i also do not want. I want to be able to close the camera after capture. Titanium.Media.startVideoCapture() does not work if i use overlay it only works when i set show control to true and then swipe left, but when i do this Titanium.Media.takePicture() doesn't work. here is a sample of my code i really need help resolving this issue. Thanks for your help in advance :)

Here is a sample of my code, I am developing for IPhone, iOS 6 and 7 using Titanium SDK version 3.1.3 GA (CLI version 3.1.2)
 
var overlay = Titanium.UI.createView({top:60});
var videoButton = Titanium.UI.createButton({
color:'#fff',
top : 36.5,
height:39,
width:142,
right:10,
backgroundImage:'../images/newImages/button.png'
});
 
var videoimg = Titanium.UI.createImageView({
image:'../images/video.png',
textAlign:'center',
top:7,
height:25,
width:30,
});
 
videoButton.add(videoimg);
 
var cameraButton = Titanium.UI.createButton({
backgroundImage:'../images/newImages/button.png',
color:'#fff',
top: 36.5,
height:39,
width:142,
left:10 
});
 
var cameraimg = Titanium.UI.createImageView({
image:'../images/camera.png',
textAlign:'center',
top:7,
height:25,
width:30,
});
 
cameraButton.add(cameraimg);
videoButton.addEventListener('click', function(data){ 
Titanium.Media.startVideoCapture(); 
});
 
cameraButton.addEventListener('click', function(data){ 
Titanium.Media.takePicture(); 
});
 
var toolbar = Ti.UI.createView({ bottom:0, 
    backgroundColor:'black', 
    height:100, 
    width:'100%'
 });
 
toolbar.add(cameraButton); 
toolbar.add(videoButton); 
overlay.add(toolbar);
 
var cameraTransform = Ti.UI.create2DMatrix(); 
cameraTransform = cameraTransform.scale(1);
 
Ti.Media.showCamera({ 
success:function(event){ 
    Titanium.Media.hideCamera();
    if(event.mediaType === Ti.Media.MEDIA_TYPE_PHOTO){
    alert('image'); 
    }else if(event.mediaType === Ti.Media.MEDIA_TYPE_VIDEO){ 
    alert('video'); 
    } 
}, 
overlay:overlay, 
animated:false, 
allowImageEditing:false, 
showControls:false, 
saveToPhotoGallery:false, 
autohide:false, 
allowEditing:false, 
transform:cameraTransform, 
videoQuality:Ti.Media.QUALITY_MEDIUM, 
mediaTypes:[Titanium.Media.MEDIA_TYPE_VIDEO, Titanium.Media.MEDIA_TYPE_PHOTO] 
});

Viewing all articles
Browse latest Browse all 8068

Trending Articles