Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-3362] iOS: showCamera does not work on iPad2 if running iPad app

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionFixed
Resolution Date2011-05-11T14:46:40.000+0000
Affected Version/sn/a
Fix Version/sRelease 1.7.0, Sprint 2011-12
ComponentsiOS
Labelsdefect, ios, ipad2, klist, release-1.7.0, reported-1.6.1, rplist
ReporterJon Alter
AssigneeReggie Seagraves
Created2011-04-15T03:43:15.000+0000
Updated2011-05-11T14:46:40.000+0000

Description

If you run an iPad application on the iPad Titanium.Media.showCamera doesn't work.
If you run an iPhone application on the iPad, Titanium.Media.showCamera camera works properly.

-fail with iPad app Step 1: make an app for 'iPad' and paste in the code below.
step 2: run the app on an iPad 2
Step 3: click the 'camera' button
Step 4: notice the camera overlay fly out the top of the page

-pass with iPhone app Step 1: make an application for 'iPhone' and paste in the code below
step 2: run the app on an iPad 2
Step 3: click the 'camera' button
Step 4: notice the camera works properly

Titanium.UI.setBackgroundColor('#000');

var win1 = Titanium.UI.createWindow({  
    title:'Tab 1',
    backgroundColor:'#fff'
});

var camera_button = Titanium.UI.createButton ({
    title:'Camera',
    height:60,
    bottom: 10,
    width:160
});
camera_button.addEventListener ('click', function(e) {  
    
    Titanium.Media.showCamera ({
        
        saveToPhotoGallery: true,
        allowEditing: true,
        // top:100,
        // width:'auto',
        
        success: function(event){
            var a = Titanium.UI.createAlertDialog({
                title: 'You did it!'
            });
            a.show();
        },
        
        error: function(error){
            var a = Titanium.UI.createAlertDialog({
                title: 'Uh Oh...'
            });
            if (error.code == Titanium.Media.NO_CAMERA || error.code == Titanium.Media.NO_VIDEO) {
                a.setMessage('Sorry, this device does not have a camera. You knew that, right?');
            }
            else {
                a.setMessage('Unexpected error: ' + error.code);
            }
            a.show();
        }
                
    });

});

win1.add(camera_button);
win1.open();

Resources

ScreenShot and Video attached

Tested With

TiSDK 1.6.1, iPad 2, iOS 4.3

Associated Helpdesk Ticket

http://developer.appcelerator.com/helpdesk/view/76504">http://developer.appcelerator.com/helpdesk/view/76504

Attachments

FileDateSize
bad_ipad_camera.png2011-04-15T03:43:16.000+000049809
ipad_camera_problem.mov2011-04-15T03:43:16.000+0000344362

Comments

  1. Jeff Haynie 2011-04-15

    (from [47df9dd21bf4febfde5e2a17c946bb9c7a590d62]) [#3362 status:fixed-in-qa] Implement displayCamera:, fix up closeModalPicker: and properly track lifetime of popover so that showCamera will work on iPad2 and no longer be in a popover https://github.com/appcelerator/titanium_mobile/commit/47df9dd21bf4febfde5e2a17c946bb9c7a590d62"> https://github.com/appcelerator/titanium_mobile/commit/47df9dd21bf4...

  2. Natalie Huynh 2011-05-11

    Tested with 1.7.0.879871b...(05/10/11 19:34) on iPad 2 (4.3.3)

JSON Source