[TIMOB-23910] iOS 10: 2D transforms not applied in Ti.Media.showCamera
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Not Our Bug |
Resolution Date | 2017-01-01T19:35:01.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | iOS |
Labels | ios10, native_issue, showcamera, uiimagepickercontroller |
Reporter | Richard Lustemberg |
Assignee | Hans Knöchel |
Created | 2016-09-15T15:15:15.000+0000 |
Updated | 2017-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]
Forgot to add the transform on showCamera, but of course that's what I'm doing on my tests
And this is the correct SO link [http://stackoverflow.com/questions/39124794/uiimagepickercontrollers-cameraviewtransform-is-ignoring-scaling-and-transla/39342257#39342257]
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.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
The Obj C code in the second example is an excerpt from MediaModule.m
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?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
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!
Apple resolved this issue in iOS 10.2. Demo-code to test:
Closing ticket with reference to the previous comments.