Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-23910] iOS 10: 2D transforms not applied in Ti.Media.showCamera

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionNot Our Bug
Resolution Date2017-01-01T19:35:01.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsiOS
Labelsios10, native_issue, showcamera, uiimagepickercontroller
ReporterRichard Lustemberg
AssigneeHans Knöchel
Created2016-09-15T15:15:15.000+0000
Updated2017-03-24T18:59:41.000+0000

Description

When adding a transform to on Ti.Media.showCamera, the transform is not applied.
var cameraTransform = Ti.UI.create2DMatrix().scale(1.5,1.5);
Ti.Media.showCamera({
            showControls: false,
            autohide: false,
            animated: true,
            overlay: cameraControls.getView(),
            success: function (e) {
                //do something
            },
            error: function (e) {
                Ti.API.error(JSON.stringify(e));
            }
        });
Also applying the trasform directly on the sdk is ignored.
            float cameraAspectRatio = 4.0 / 3.0;//whatever values you set here are ignored when built on iOS10
            float camViewHeight = screenSize.width * cameraAspectRatio;
            float scale = screenSize.height/camViewHeight;
            
            CGAffineTransform translate = CGAffineTransformMakeTranslation(0, (screenSize.height - camViewHeight) / 2.0);
            picker.cameraViewTransform = CGAffineTransformScale(translate, scale, scale);
It's probably related to this: [http://stackoverflow.duapp.com/questions/39124794/uiimagepickercontrollers-cameraviewtransform-is-ignoring-scaling-and-transla/39342257#39342257]

Comments

  1. Richard Lustemberg 2016-09-15

    Forgot to add the transform on showCamera, but of course that's what I'm doing on my tests
  2. Richard Lustemberg 2016-09-15

    And this is the correct SO link [http://stackoverflow.com/questions/39124794/uiimagepickercontrollers-cameraviewtransform-is-ignoring-scaling-and-transla/39342257#39342257]
  3. Hans Knöchel 2016-09-17

    Well, the second one is obviously failing because of some more configuration and graphics-context being required. If the first one works with iOS 9.3, I will investigate it. But not that your demo-code is still invalid, since you don't even use the cameraTransform after it's creation.
  4. Richard Lustemberg 2016-09-17

    In the example code I've forgot to add the transform, but it really doesn't work (I already pointed that out in a previous comment) In MediaModule.m , doesn't matter what aspect ratio you set, the values are ignored on iOS 10, although they work as expected on 9.3.5
  5. Richard Lustemberg 2016-09-17

    The Obj C code in the second example is an excerpt from MediaModule.m
  6. Hans Knöchel 2016-09-17

    Yes, but the snippet alone won't help to reproduce it. I have a valid test-case now, but as many native devs run into the same issue with iOS 10 GM, hopefully Apple comes with a fix for this soon. There is a workaround that I will test as well. And does it work without the overlay property supplied?
  7. Richard Lustemberg 2016-09-17

    I tested many cases, I think also without the overlay, but I'll confirm asap. I couldn't edit the Jira ticket description, that's why you have the test case without the transform property set. It's indeed an iOS 10 issue, I also made a ticket at Apple's. I have to make a custom camera to capture LivePhoto's so I'll eventually stop using UIImagePicker. I'll do a full native test to confirm. Almost sure it's an Apple bug, but I thought it was worth letting you guys know
  8. Hans Knöchel 2016-09-17

    Yep, very thankful for that. I will file a [bug report at Apple|bugreport.apple.com] next week as well. For now, I updated [the docs](https://github.com/appcelerator/titanium_mobile/blob/master/apidoc/Titanium/Media/Media.yml#L1660) so people are aware of the issue. Thanks again!
  9. Hans Knöchel 2017-01-01

    Apple resolved this issue in iOS 10.2. Demo-code to test:
       var win = Ti.UI.createWindow({
           backgroundColor: '#fff'
       });
       
       var btn = Ti.UI.createButton({
           title: 'Trigger'
       });
       
       btn.addEventListener('click', function() {
       	var cameraTransform = Ti.UI.create2DMatrix().scale(3, 3);
       	Ti.Media.showCamera({
               transform: cameraTransform,
               success: function (e) {
                   //do something
               },
               error: function (e) {
                   Ti.API.error(JSON.stringify(e));
               }
           });	
       });
       
       win.add(btn);
       win.open();
       
  10. Lee Morris 2017-03-24

    Closing ticket with reference to the previous comments.

JSON Source