Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-17712] iOS8: if the user rotates the device when exiting image capture the orientation of the device is in the opposite orientation it should be in

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2014-10-13T18:19:02.000+0000
Affected Version/sRelease 3.4.0
Fix Version/sRelease 3.4.2, Release 3.5.0, Release 4.0.0
ComponentsiOS
LabelsiOS8, module_media
ReporterRadamantis Torres-Lechuga
AssigneeVishal Duggal
Created2014-09-16T23:07:38.000+0000
Updated2014-11-21T19:53:39.000+0000

Description

I have already consumed the change from TIMOB-17662 by setting autorotate to false in CameraDevice.js and this issue is still present. I initially mentioned this issue in Case 2640 which has been closed so that we can focus on this specific case. I have uploaded an app called 9-16-OppositeOrientationTest.zip and screenshots which illustrate this issue. CASE 1 (landscape window in portrait mode)

Launch the app in Landscape mode with the Home button on the right

Rotate the app around, notice the UI changes to reflect the orientation correctly.

Get it back into landscape mode (Home button on right).

Click Launch Camera

Click the (X) button and then immediately rotate the tablet to portrait up or portrait down.

Notice that the image capture view will close and the app then rotates into landscape orientation. It should rotate to portrait orientation.

See screenshot Home On Bottom.png CASE 2 (portrait window in landscape)

Kill the app

Launch the app in Landscape mode with the Home button on the right

Rotate the app around, notice the UI changes to reflect the orientation correctly.

Rotate the app to portrait mode (Home button on bottom).

Click Launch Camera

Click the (X) button and then immediately rotate the tablet to landscape left up or landscape right.

Notice that the image capture view will close and the app then rotates into portrait orientation. It should rotate to landscape orientation.

See screenshot Home On Right.png

Issue reproducible with the following code

var win = Ti.UI.createWindow({
    backgroundColor: 'white'
});
var button = Ti.UI.createButton({
    title: 'Open',
    top: 50,
    left: 10,
    right: 10,
    height: 50
});
win.add(button);
win.open();
 
button.addEventListener('click', function() {
    Ti.API.info('click');
    Ti.Media.showCamera({
        success: success,
        error: error,
        saveToPhotoGallery: false,
        allowEditing: false,
        mediaTypes: [Ti.Media.MEDIA_TYPE_PHOTO],
        showControls: true,
        autohide: false
    });
 
    function success(e) {
        Ti.API.info('Success');
    }
    function error(e) {
        Ti.API.info('Success');
    }
});

Attachments

FileDateSize
9-16-OppositeOrientationTest.zip2014-09-16T23:07:38.000+00007593486

Comments

  1. Ingo Muschenetz 2014-09-18

    Resolving on hold, similar to TIMOB-17698 and TIMOB-17609.
  2. Vishal Duggal 2014-09-18

    Use this as a JS workaround for now
       function isIOS8()
       {
           //replace with correct function
           return true;
       }
       
       var win = Ti.UI.createWindow({
           backgroundColor: 'white'
       });
       var button = Ti.UI.createButton({
           title: 'Open With Dummy',
           top: 50,
           left: 10,
           right: 10,
           height: 50
       });
       win.add(button);
       win.open();
       
       
       function showCamera()
       {
           Ti.Media.showCamera({
               success: success,
               error: error,
               saveToPhotoGallery: false,
               allowEditing: false,
               mediaTypes: [Ti.Media.MEDIA_TYPE_PHOTO],
               showControls: true,
               autohide: false
           });
         
           function success(e) {
               Ti.API.info('Success');
           }
           function error(e) {
               Ti.API.info('Success');
           }
       }
       
       var cameraShown = false;
       
       function showDummy(bgImage)
       {
           cameraShown = false;
       
           var dwin = Ti.UI.createWindow({backgroundImage:bgImage});
           dwin.orientationModes = [win.orientation];
           dwin.addEventListener('focus',function(){
               if(cameraShown === false) {
                   cameraShown = true;
                   Ti.API.info('SHOWING CAMERA')
                   showCamera();
               } else {
                   Ti.API.info('CLOSING')
                   dwin.close({animated:false});
               }
           });
       
           dwin.open({modal:true,animated:false})
       
       }
         
       button.addEventListener('click', function() {
           Ti.API.info('click');
           if (isIOS8() == true) {
               Ti.API.info('TAKING SCREEN SHOT')
               Ti.Media.takeScreenshot(function(e){
                   Ti.API.info('SHOWING DUMMY')
                   showDummy(e.media);
               })
           } else {
               showCamera();
           }
       
       });
       
  3. Vishal Duggal 2014-10-07

    Reopening to find a code fix
  4. Vishal Duggal 2014-10-07

    Pull pending master - https://github.com/appcelerator/titanium_mobile/pull/6204 3_4_X - https://github.com/appcelerator/titanium_mobile/pull/6205
  5. Olga Romero 2014-10-07

    Tested the provided code using Mac osx 10.9.5 Mavericks Appcelerator Studio, build: 3.4.0.201409261245 Titanium SDK, build: 3.4.1.v20141007092513 acs@1.0.18 alloy 1.5.1 install@0.1.7 npm@1.4.23 sudo@1.0.3 titanium 3.4.0 titanium-code-processor@1.1.1 Xcode6.1GM Devices: iPad mini iOS 8.1b iPhone 6 iOS 8.1b Verified as fixed

JSON Source