[TIMOB-3364] How to open front camera first in iphone4 instead of backside camera?
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Duplicate |
Resolution Date | 2011-11-03T15:19:03.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | iOS |
Labels | n/a |
Reporter | bhavyahmehta |
Assignee | Reggie Seagraves |
Created | 2011-04-15T03:43:18.000+0000 |
Updated | 2017-03-09T22:49:18.000+0000 |
Description
I use following code:
Ti.Media.switchCamera(Ti.Media.CAMERA_REAR);
if (Ti.Media.camera == Ti.Media.CAMERA_REAR)
{
Ti.Media.switchCamera(Ti.Media.CAMERA_FRONT);
}
but it does not help me to open front camera first instead of back camera.
I get -- [ERROR] invalid state. in -[MediaModule switchCamera:] (MediaModule.m:644)
please help me to solve this issue.
I believe the "invalid state" error only happens in the simulator, since there is no camera to switch. However, I can confirm that switchCamera does nothing on the device either.
So, a couple of bugs lead to switchCamera not working quite right.
One, the constants for CAMERA_FRONT and CAMERA_REAR are flipped (so FRONT refers to Rear, and REAR refers to FRONT).
Lines 451-452 of MediaModule.m should be:
Also, the code calls a setCameraDevice function, which does not exist. Instead I think you need to set the cameraDevice property of the picker.
So, line 669 of MediaModule.m should be:
Hopefully easy fixes! Hope to see them in soon.
Duplicates. The root issue is front and back are switched in the module.
Closing ticket as duplicate.