[AC-846] Ti.Media.openPhotoGallery is not working on iPad when using Camera Overlay but fine on iPhone
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Closed |
Resolution | Duplicate |
Resolution Date | 2015-04-22T07:04:02.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Documentation |
Labels | ios |
Reporter | Silambarasan Raman |
Assignee | Shuo Liang |
Created | 2015-04-22T07:01:32.000+0000 |
Updated | 2016-03-08T07:37:08.000+0000 |
Description
Titanium.Media.openPhotoGallery is not working for iPads.
Steps to reproduce:
1. Create an app using the code below.
2. Launch the test app.
Actual:
No photo gallery is invoked on iPads whereas photo gallery is successfully invoked on iPhones.
Expected:
Photo gallery should be invoked on iPads as well.
// ########## CODE STARTS HERE ########
var self = Titanium.UI.createWindow({
top : 0,
navBarHidden : true,
backgroundColor : "#FFF",
exitOnClose : false
});
var leftView = Titanium.UI.createLabel({
text : Click for Gallery",
width : 80,
height : 80,
left : 40,
top : 30,
zIndex : 2
});
self.add(leftView);
leftView.addEventListener('click', OpenPhoneGallery);
function OpenPhoneGallery(){
Ti.Media.openPhotoGallery({
success : function(ev) {
SharePageCallFunc(ev);
},
cancel : function(){
alert("Gallery is not opened");
},
error : function(err){
var a = Titanium.UI.createAlertDialog({
title : 'Gallery'
});
a.setMessage('Unexpected error: ' + err.code);
a.show();
},
showControls : false,
mediaTypes : Ti.Media.MEDIA_TYPE_PHOTO,
autohide : true
});
}
function SharePageCallFunc(eve,hidecam){
var shareImageView = Ti.UI.createImageView({
width : Ti.UI.SIZE,
height: Ti.UI.SIZE,
image : eve.media,
left : 0,
top : 0,
bottom : 0,
autorotate:true,
top : 100
});
self.add(shareImageView);
}
self.open();
Hi Team, I assume an issue happening because of opening GALLERY from OVERLAY of Camera, Can you please try to open the camera on overlay and then Add one Label/button there, And call the Ti.Media.openPhotoGallery on that click event, And test with the iPad 7.1 and then let me know the status, Still can't find a solution for this issue, So i need your help here, I posted my code below for your reference // ########## CODE STARTS HERE ######## var self = Titanium.UI.createWindow( { top : 0, navBarHidden : true, backgroundColor : "#FFF", exitOnClose : false } ); // ############ Bottom VIEW WHICH SHOWS Controller Options ################### // var CustomControllerView = Titanium.UI.createView( { width : Ti.UI.FILL,height : 140,backgroundColor : "#666666",bottom : 0,layout : "horizontal" } ); // ############ WHOLE PAGE WHICH SHOWS CAMERA ################### // var overlayView = Titanium.UI.createView(); overlayView.add(CustomControllerView); CustomControllerView.add(leftView); var leftView = Titanium.UI.createLabel( { text : Click for Gallery", width : 80, height : 80, left : 40, top : 30, zIndex : 2 } ); CustomControllerView.add(leftView); // ############ Function for Take Picture ################### // function takePictureViaCamera() { Ti.Media.takePicture(); } leftView.addEventListener('click', OpenPhoneGallery); function OpenPhoneGallery(){ Ti.Media.hideCamera(); // Hiding the camera which is showing in overlay Ti.Media.openPhotoGallery({ success : function(ev) { SharePageCallFunc(ev); } , cancel : function() { alert("Gallery is not opened"); } , error : function(err){ var a = Titanium.UI.createAlertDialog( { title : 'Gallery' } ); a.setMessage('Unexpected error: ' + err.code); a.show(); }, showControls : false, mediaTypes : Ti.Media.MEDIA_TYPE_PHOTO, autohide : true }); } // ######### CAMERA OPEN FUNC ########## // function CameraOpenFunc() { Titanium.Media.showCamera({ saveToPhotoGallery : false, success : function(ev) { Ti.API.info(JSON.stringify(ev)); SharePageCallFunc(ev, true); } , cancel : function() { }, error : function(error) { var a = Titanium.UI.createAlertDialog( { title : 'Camera' } ); if (error.code == Titanium.Media.NO_CAMERA) { a.setMessage('Please run this test on device'); } else { a.setMessage('Unexpected error: ' + error.code); } a.show(); }, overlay : overlayView, transform : Ti.UI.create2DMatrix().scale(1), showControls : false, // don't show system controls mediaTypes : [Ti.Media.MEDIA_TYPE_PHOTO], autohide : false // tell the system not to auto-hide and we'll do it ourself, So we should handle // hide by Ti.Media.hideCamera(); }); } function SharePageCallFunc(eve,hidecam){ if (hidecam) { Ti.Media.hideCamera(); } var shareImageView = Ti.UI.createImageView( { width : Ti.UI.SIZE, height: Ti.UI.SIZE, image : eve.media, left : 0, top : 0, bottom : 0, autorotate:true, top : 100 } ); self.add(shareImageView); } self.addEventListener("open", CameraOpenFunc); self.open();
The old one has been re-open. Close this one as duplicate.