Activate iPhone 4 LED Light
I know this is extremely far fetched haha, but would anyone be willing to explain how to active the iPhone 4's LED. Any advice or help would be appreciated. Thanks!
4 Answers
-
Sorry about that. I should have followed up, since I was looking at the source code, not the documentation. If you compile for iOS 4.0 and above, there's a number of useful things.
Ti.Media has 3 constants regarding the flash:
- Ti.Media.CAMERA_FLASH_OFF
- Ti.Media.CAMERA_FLASH_ON
- Ti.Media.CAMERA_FLASH_AUTO
Use these with the Ti.Media.CameraFlashMode property, which is readable and writable.
There are also 2 constants and an array regarding which camera:
- Ti.Media.CAMERA_FRONT
- Ti.Media.CAMERA_REAR
Additionally, the Ti.Media.availableCameras property is a read-only array listing what cameras the device has.
To determine which camera is currently chosen, use the read-only Ti.Media.Camera property. Use the Ti.Media.switchCamera function to switch cameras.
-
http://www.iphonedevsdk.com/forum/iphone-sdk-development/51651-access-camera-flash-2.html
Here is the code to make it work from Xcode. A build and run from xcode and the light turns on, but I have no idea how to get this to work from Titanium.
Someone please help!
-
I have asked this on webinar presented by Kevin W. a week ago and they said the front-facing camera and led flash is supported under 1.4 Titanium Mobile. I looked at the 1.4 API ( https://developer.appcelerator.com/apidoc/mobile/1.4 ) but cant find any reference to front-facing cam or the led flash properties.
-
Hey guys!
For the flash stuff you have to check the property:
Ti.Media.cameraFlashMode (case sensitive)To change it you can use Ti.Media.setCameraFlashMode(PARAM) .
PARAM could be:
Ti.Media.CAMERA_FLASH_OFF , Ti.Media.CAMERA_FLASH_ON, Ti.Media.CAMERA_FLASH_AUTOUnfortunately you can't start the led and use it as a torch, you can only control the camera flash handling (on, off, auto) while taking a photo.