Copy link to clipboard
Copied
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.)
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Thanks for the reply. The problem is, though, the camera does do continuous focus when I'm using a native QR code scanner.
When I do
Video.attachCamera(null);
Video.attachCamera(Camera);
nothing seems to happen. Does the camera only refocus with Netstream.attachCamera?
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
I'm also having the same problem with the Android HTC Desire HD
in that camera focus only occurs after a call to camera.setmode()
Did this ever get raised as a bug?
Note: Autofocus appears to work fine on the iPhone 3GS using the raw camera.
Thanks,
Scott.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Hi, are there some news about that topic or did you find a work arround yet? I have the same problem and i can't find a solution except for calling a endless time the setMode method which is really dirty and the performance sucks...
Regards Valentin
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Hi Scott,
thats similar to my temporary solution.
I hope Adobe will take care of this problem soon.
Thank you for your ideas.
Regards Valentin
Copy link to clipboard
Copied
Same problem. Android HTC Desire. Unfortunately setMode blanks the screen while it does it's thing...
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
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).
Copy link to clipboard
Copied
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!
Copy link to clipboard
Copied
Hi,
Have you tried setting the following tag in your -app.xml file?
Within the <android> <manisfestAdditions> tag:
<uses-feature android:name="android.hardware.camera.autofocus"/>
In my app descriptor file I have that line right below the CAMERA permission tag.
iBrent
Copy link to clipboard
Copied
I have tried the app descriptors and all that but it still didn't work. On my bug request page, the Adobe guy kept saying that the Android phone I had didn't support "continuous autofocus" although I think it does since the iPhone one does work as expected.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
I've been working on something else, so haven't looked at this for a while, but had a chance to take a look this morning.
Interestingly, continuous focus works on the S2 is you select the forward rather than read facing camera, which would tend to suggest this is device related??
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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!
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Update: I have now seen continuous focus working on the HTC Sensation XE. I don't understand what the hardware differences with the S2 are, as it clearly is capable of continuous auto-focus, but Air certainly can work correctly on with the camera on some Android handsets.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now