[TIMOB-17662] iOS8: Feature Request to do not allow the CameraPreview to rotate
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2015-01-23T19:28:04.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 3.4.0, Release 3.5.0 |
Components | iOS |
Labels | module_media, usability |
Reporter | Eduardo Gomez |
Assignee | Jon Alter |
Created | 2014-09-09T20:13:50.000+0000 |
Updated | 2015-01-26T17:36:13.000+0000 |
Description
Feature Request
Feature Request to do not allow the CameraPreview to rotate. Add the following method inside @implementation TiImagePickerController
- (BOOL)shouldAutorotate
{
return NO;
}
- https://github.com/appcelerator/titanium_mobile/blob/master/iphone/Classes/MediaModule.m#L65
Sample 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('Error');
}
});
FYI [~aleard].
I think we want this to be added as a boolean property so the developer can set the property to yes or no at their discretion.
PRs merged
Tested environment Mac osx 10.9.4 Maverics Appcelerator Studio, build: 3.4.0.201409112242 Titanium SDK, build: 3.4.0.v20140912120914 acs@1.0.16 alloy 1.5.0-rc install@0.1.7 npm@1.4.23 sudo@1.0.3 titanium 3.4.0-rc2 titanium-code-processor@1.1.1 Xcode6 Device: iPad Air iOS8 The camera opens in the current orientation but does not once it is open
Using the iOS 8 GM, iOS 8 GM SDK, and the 3.4.0.v20140916131632 TiSDK if you leave the iPad flat on the desk and click launch camera, it shows rotated sideways with the black bars present. Steps to reproduce: 1. Build app with iOS8 SDK & TiSDK 3.4.0.v20140916131632, install on iOS 8 device. 2. Pick up the device and rotate it to landscape orientation (Home button on Right) <- This is key, it seems in portrait this issue does not occur 3. Lay the device flat on the desk 4. Launch the app, then launch image capture by clicking the image capture button. 5. Notice that the image shown is sideways and there are black bars present. If this does not occur close the image capture and repeat steps 3-4 leaving the device flat on the desk. 6. Close the camera viewfinder 7. Pick the ipad up off your desk 8. Click the image capture button. 9. Notice that the viewfinder appears correctly. It should appear like this when its flat on the desk.
On an iPhone 5 with *iOS 8.1.1* using the *3.4.0.GA* Titanium SDK and the following code :
It seems that the camera still rotates because the icons (flash and front/rear camera) rotate. When debugging the objective-c code in XCode, the
shouldAutoRotate
method fromTiImagePickerController
is called and the autorotate property value is *NO*. Is there anything wrong with the code or is the feature correctly working ?Hi [~itsbrnrd], The behavior you are seeing is expected. Apple does not allow us to control the icons rotating.
Reopening to fix typo
Hi [~jalter] and thanks for your quick answer. I understand that the icons cannot be controlled by the
autorotate
property. However, I don't see any difference in the code I wrote above with theautorotate
property set totrue
orfalse
. What I'm trying to achieve is to force the camera in portait (only) and I thought this property would help me do that. Am I wrong ?[~itsbrnrd] This property is for iPad apps only. Changing this on an iphone app will have no affect. See the documentation here: http://docs.appcelerator.com/titanium/latest/#!/api/CameraOptionsType-property-autorotate