Autofocus is not available to unpriviledged / 3rd Party applications

RESOLVED FIXED in Firefox 38

Status

()

RESOLVED FIXED
4 years ago
4 years ago

People

(Reporter: pierre.slamich, Assigned: mikeh)

Tracking

({regression})

unspecified
mozilla38
regression
Points:
---

Firefox Tracking Flags

(firefox36 wontfix, firefox37 wontfix, firefox38 fixed, b2g-v2.2 fixed, b2g-master fixed)

Details

Attachments

(3 attachments, 1 obsolete attachment)

(Reporter)

Description

4 years ago
Continuous Autofocus or Manual Autofocus seems available to System Apps such as Gaia. 
However, 3rd party applications can't access the API although autofocus is a much needed feature for many use cases (barcode scanner, barcode enabled apps, 3rd party photo apps...)

It doesn't look like a privacy related issue, the only issue that I could imagine being hardware support or battery issues.

We've started today a port of an application to Firefox OS during a Mozilla sponsored hackathon and this is a showstopper for us.
All other major platform do support this feature, and it's the last thing barring us from deploying reliably on FFOS.
Mike, was this made only for certified apps for a reason?
Flags: needinfo?(mhabicher)
Component: Certification Suite → DOM: Device Interfaces
Product: Firefox OS → Core
In order to build photo applications with better image quality, access to this autofocus methods is a must have.
The getUserMedia does not give this kind of quality, or methods.

Comment 3

4 years ago
There's a related discussion in bug 749886.
(In reply to Alexandre LISSY :gerard-majax from comment #1)

> Mike, was this made only for certified apps for a reason?

b2g's CameraControl is available to certified and privileged apps.

getUserMedia is available to all content, though I don't think it's currently hooked up to the auto-focus API. The simplest solution would be to have gUM set the focus mode to either 'continuous-video' or 'continuous-picture' (the former autofocuses more slowly/smoothly). Provided gUM doesn't try to call autoFocus() or takePicture(), that should be enough to keep the stream in focus.
Flags: needinfo?(mhabicher) → needinfo?(rjesup)
continuous-video, please.  For now that should do until the image capture stuff gets done.
Flags: needinfo?(rjesup)
(In reply to Randell Jesup [:jesup] from comment #5)

> continuous-video, please.  For now that should do until the image capture
> stuff gets done.

By default, the auto-focus area will be the centre of the frame. Will that be okay?
Assignee: nobody → mhabicher
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Flags: needinfo?(rjesup)
(In reply to Mike Habicher [:mikeh] from comment #6)
> (In reply to Randell Jesup [:jesup] from comment #5)
> 
> > continuous-video, please.  For now that should do until the image capture
> > stuff gets done.
> 
> By default, the auto-focus area will be the centre of the frame. Will that
> be okay?

Yes
Flags: needinfo?(rjesup)
Created attachment 8529217 [details] [diff] [review]
Enable autofocus in WebRTC, v1

try: https://treeherder.mozilla.org/ui/#/jobs?repo=try&revision=1d2d7576534e
Attachment #8529217 - Flags: review?(rjesup)
Attachment #8529217 - Flags: review?(aosmond)
Comment on attachment 8529217 [details] [diff] [review]
Enable autofocus in WebRTC, v1

Review of attachment 8529217 [details] [diff] [review]:
-----------------------------------------------------------------

LGTM.
Attachment #8529217 - Flags: review?(aosmond) → review+
jesup: review ping?
Flags: needinfo?(rjesup)
Attachment #8529217 - Flags: review?(rjesup) → review+
Created attachment 8531789 [details] [diff] [review]
Enable autofocus in WebRTC, v2 r=aosmond,jesup

Carrying r+ on landable patch.
Attachment #8529217 - Attachment is obsolete: true
Attachment #8531789 - Flags: review+
Flags: needinfo?(rjesup)
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/9acf6e3a887a
Status: ASSIGNED → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla37
Hi Mike! I've been trying the autofocus with Firefox OS in my Flame device (just flashed with m-c and Gaia master), and it seems not to be working (and it's working within Camera app with Camera API). Is there any specific param in order to enable the autofocus when requesting gUM? Thanks!
Flags: needinfo?(mhabicher)
Created attachment 8555899 [details]
gdb bt (and bt full) of crash

Trying to reproduce on Flame, I seem to be hitting a crash after the "can I use the camera?" permission dialog.
Flags: needinfo?(mhabicher)
At some point the patch above stopped working.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Keywords: regression
Created attachment 8556038 [details] [diff] [review]
Enable autofocus in WebRTC, v3

Borja, can you build gecko with this patch applied? I've verified that it restores autofocus functionality.
Attachment #8556038 - Flags: review?(aosmond)
Attachment #8556038 - Flags: feedback?(borja.bugzilla)
Autofocus seems to be working properly with your patch! Now we have the other thing related with the 'distorted' image after landing https://bugzilla.mozilla.org/show_bug.cgi?id=1104913, should we file a new bug? Thanks!
Flags: needinfo?(mhabicher)
(In reply to Borja Salguero [:borjasalguero] from comment #18)

> Autofocus seems to be working properly with your patch! Now we have the
> other thing related with the 'distorted' image after landing
> https://bugzilla.mozilla.org/show_bug.cgi?id=1104913, should we file a new
> bug? Thanks!

Yes please, and CC myself and aosmond on it.
Flags: needinfo?(mhabicher)
Comment on attachment 8556038 [details] [diff] [review]
Enable autofocus in WebRTC, v3

Per comment 18.
Attachment #8556038 - Flags: feedback?(borja.bugzilla) → feedback+
Comment on attachment 8556038 [details] [diff] [review]
Enable autofocus in WebRTC, v3

Review of attachment 8556038 [details] [diff] [review]:
-----------------------------------------------------------------

LGTM.
Attachment #8556038 - Flags: review?(aosmond) → review+
Borja, does this affect v2.2? If so, we'll need to get b2g32+ approval for this patch as well.
Flags: needinfo?(borja.bugzilla)
(Er, that should probably say b2g37 approval.)
https://hg.mozilla.org/mozilla-central/rev/d3d2d29f0f7c
Status: REOPENED → RESOLVED
Last Resolved: 4 years ago4 years ago
Resolution: --- → FIXED
Hi Mike! This is failing as well in 2.2 (just tried and it's not working properly). Could you ask for the approval? Thanks!
Flags: needinfo?(borja.bugzilla) → needinfo?(mhabicher)
Comment on attachment 8556038 [details] [diff] [review]
Enable autofocus in WebRTC, v3

NOTE: Please see https://wiki.mozilla.org/Release_Management/B2G_Landing to better understand the B2G approval process and landings.

[Approval Request Comment]
Bug caused by (feature/regressing bug #): bug 1104913, bug 1103400
User impact if declined: autofocus doesn't work in getUserMedia()
Testing completed: manual testing
Risk to taking this patch (and alternatives if risky): minimal
String or UUID changes made by this patch: none
Flags: needinfo?(mhabicher)
Attachment #8556038 - Flags: approval-mozilla-b2g37?
Attachment #8556038 - Flags: approval-mozilla-b2g37? → approval-mozilla-b2g37+
https://hg.mozilla.org/releases/mozilla-b2g37_v2_2/rev/f48ca0f73cdd
status-b2g-v2.2: --- → fixed
status-b2g-master: --- → fixed
status-firefox36: --- → wontfix
status-firefox37: --- → wontfix
status-firefox38: --- → fixed
Target Milestone: mozilla37 → mozilla38
You need to log in before you can comment on or make changes to this bug.