Hello, I'm making a QR scanner application. I'm testing my application on the Motorola Droid 2, which has an auto focus camera. For some reason, no matter what I do, the camera won't re-focus after focusing for the first time. I can force it to focus by doing a Camera.setMode call, but that causes the application to hang for about half a second. I have not had this problem when testing it with an iPhone 4. Does anyone know how I can remedy this situation?
Thank you in advance!
P.S. I also noticed that when I first initialize the camera/video, the autofocus happens twice. (The camera makes some sort of noise when it autofocuses, and it does it twice when I first open my app.)
The focus is dependent on the system camera hardware/software. If the camera doesn't support continuous autofocus, then AIR triggers the focus when you call setMode() and when you attach to a NetStream. You could try reattaching the Netstream to trigger the autofocus instead of setMode. If that isn't faster, I don't know what you could do.
Autofocus is supposed to happen with Netastream.attachCamera(), but now that I think about it, that isn't appropriate for your use case.
Please file a bug at https://bugbase.adobe.com/ about continuos autofocus not working.
Thanks,
Joe
Sadly, I have to say that I kind of forgot to raise a bug request... I'll go ahead and do that now.
Here we are: https://bugbase.adobe.com/index.cfm?event=bug&id=2921514
Please vote it up.
In the absence of a bug, I logged one myself (although only mentioned HTC Desire HD)
https://bugs.adobe.com/jira/browse/SDK-30820
Regards,
Scott.
Hi Valentin,
As far as I’m aware there’s no solution for this as of yet. I’m hoping it gets fixed in a later release.
To workaround the issue I’ve added a ‘focus’ button click handler that calls setMode on the camera object rather than calling it periodically. Repeatedly calling setmode was too painful in terms of performance as you point out. Interestingly I only have the issue with Android devices, seems to not be an issue on iPhone.
If I do find a solution in the mean time I will let you know.
Hope this helps…
Regards,
Scott.
Is anyone still looking at this? I read the self closed bug report that was raised and it didn't seem to make any sense based on what I'm seeing.
I am using the Camera class on Android to view the live stream using a Samsung Galaxy S2. The focus received at the point of calling setMode is retained throughout the life of the application. If I call setMode again, as others have reported, the focus will update but with an unacceptable lag.
Now, I know that people keep referring to continuous auto-focus and whether or not a particular device supports it, if I use the CameraUI class, that does continuously autofocus, so I'm assuming my device does support it.
Is there a reason that CameraUI and Camera respond differently? Is there a way I can capture the stream from CameraUI if so?
Hello, I sadly did not close the bug report, the Adobe guys did. I still have not figured out how to solve the problem in Adobe AIR; the guy never got back to me with the information I needed.
The thing I understand as far as CameraUI vs Camera goes is that one uses the native api of the device while the other reacts similar to a webcam in Flash. I don't think you can capture anything from CameraUI (they have to actually take the photos, I believe) so that wasn't a solution. My team ended up just implementing everything in PhoneGap and got a super fast QR scanner (given the ZXing library).
Bug https://bugs.adobe.com/jira/browse/SDK-30820 is still open i believe, although has no votes to date so will probably not get looked into.
Vote up this is still an issue for you!
Hi All,
Can anyone confirm if they have actually seen continuous autofocus working on an Android device using the Flex SDK.
I have added the following to my manifest file… (myproject-app.xml) as described in the Android documentation:
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
And am accessing the raw camera using Camera.getCamera();
I have so far tested on HTC Desire HD and Samsung Galaxy S2 without any joy, would be curious to know if this fails for all devices.
Many Thanks,
Scott.
It's very interesting that you managed to get continuous autofocus working on the Galaxy S2. I just went to double check whether or not Droid 2 actually supports continuous autofocus and I do get some youtube videos demonstrating this feature, so I'm going to assume it does. However, this is not reflected in the AIR application, sadly.
Recently, my team migrated our application over to PhoneGap to test how things would work there. The continuous autofocus seems to work properly for the Droid 2 using PhoneGap (uses native library, I assume). Also, the QR scanner is extraordinarily fast compared to the AIR implementation.
I'd be happy to switch to PhoneGap but I need to stream the video from the handset, something which is trivial using ActionScript but not possible as far as I can see with PhoneGap.
It's irritiating, as we do have native code for both Androad and iOS that does what we need, but I'd rather not have two separate code bases and this seemed like it would be an ideal way to do it, but not being able to have the focus update is something of a show stopper for us. We'd even be happy if we knew of certain Android devices that are supported as we have a certain amount of control over the deployment devices . . . if anyone does know of any Android handsets where continuous focus using ActionScript is supported on the read camera I'd love to know!
Guys,
Just to let you know, I've had some colleagues in Asia test various handsets they have for me and have reports of the following devices all corretly auto-focusing:
- Glaxy Nexus (ICS)
- HTC Sensation XE (ICS)
- Galaxy Note (GB)
- Galaxy Cooper (GB)
Haven't seen it first hand yet, but will be ordering a Nexus to test it.
North America
Europe, Middle East and Africa
Asia Pacific