New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 343894 link

Starred by 20 users

Issue metadata

Status: Fixed
Closed: Sep 2016
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: Feature

Blocked on:
issue 518807

Sign in to add a comment

Enable focus within getUserMedia()

Reported by, Feb 14 2014

Issue description

UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/31.0.1650.63 Chrome/31.0.1650.63 Safari/537.36

Example URL:

Steps to reproduce the problem:
1. Setup a video stream with getUserMedia()
2. Place camera really close to something
3. See blurriness

What is the expected behavior?
Like in native mobile Apps it should be possible to trigger the autofocus for given coordinates, e.g. on touch.

What went wrong?
The ability to trigger the autofocus is missing.

Did this work before? No 

Is it a problem with Flash or HTML5? HTML5

Does this work in other browsers? N/A 

Chrome version: 31.0.1650.63  Channel: stable
OS Version: ubuntu0.13.04.1~20131204.1
Flash Version: Shockwave Flash 11.0 r1

Tested with Lenovo X220 and Samsung Galaxy S3.

Usecase: A QR-code scanner, trying to scan e.g. 10x10mm codes.
Labels: Cr-Blink-WebRTC
Labels: -Cr-Internals-Media
Labels: -Type-Bug Type-Feature
Status: Available

Comment 4 by, Feb 27 2014

See for an example of a Chrome App that could really stand to benefit from this enhancement.

Comment 5 by, Sep 24 2014

Labels: Cr-UI
I'm assuming that adding support for custom focus areas would require changes to the media capture spec. Does the current implementation of media capture in Chrome for Android at least properly trigger the auto-focus feature of the camera on the device? I'm not finding any focus related settings in the video  source code ( 

Comment 7 by, Nov 13 2014

Labels: -Cr-UI OS-Chrome OS-Android
a) the current WebRTC JS API is quite bare-bones when it comes to Camera control features. Moreover, the underlying signalling flow from Renderer to Browser side is reduced to operational start/stop like commands, essentially. (NB: there's new code under review for picture taking).

b) Android Video Capture does not implement auto focus. IIRC, AutoFocus is continuously doing so while on Preview. Btw Camera2 code is in the making [1], so this is the perfect time for suggestions :)

c) The App in #4 refers to a CrOs, in this case the cameras follow UVC model and should be on continuous auto focus. I'd recommend trying with an external USB camera; perhaps the internals do not have the good parameters for macro. 

PS: I see in #1: "Chrome version: 31.0.1650.63" <-- it needs update.

[1] f.i.
a) Suggesting a spec update :) Actually tried already to get some spec people onto the topic… There are more related ideas, like controlling the flash, when available.

b) The issue is not Android specific. I would like to be able to use the camera of my laptop to scan bar/qr codes as well.

Unfortunately I cannot update my own issues o.O But the issue still exists in 40.0.2209.0
mcasas@, regarding (b) as far as I can tell from the documentation ( even the now deprecated Camera API on Android supports auto-focus (via Parameters.FOCUS_MODE_CONTINUOUS_VIDEO).  Could it be as easy as adding that param somewhere near: ? 
Status: Assigned
Regarding #9: It seems that adding the focus mode does the trick for Android.
Sorry, I jumped ahead of myself, seems like ToT and stable 39 focus fine. 
This is what I tried:

- Vanilla Clankium on my N5 Android-L, it focuses correctly to very close characters (~2cm) and then farther objects.

- Stock Cr 39.0.2171.59 on a N4 JB, same results.

For testing I used peerconnection page [1], click on "getDevices", select second
source, then click on "Request GetUserMedia", then "Resize: To stream size" and
just get real close to some printed out paper, then focus on some farther objects.

Project Member

Comment 12 by, Nov 19 2014

The following revision refers to this bug:

commit 667e79783dd2bbd413b165abfd7fae2bfa3210d5
Author: mcasas <>
Date: Wed Nov 19 22:42:29 2014

Android Video Capture: Set continuous focus mode on in cam parameters.

This is, apparently, needed for macro modes, although
autofocus seems to work ok in general.

BUG= 343894 
TEST=Please refer to the bug, basically a gUM() + close QR codes focus test.

Review URL:

Cr-Commit-Position: refs/heads/master@{#304909}


Labels: M-41
mcasas@ - can this be considered fixed with r304909?

Comment 14 by, Nov 20 2014

I'd rather it not be marked fixed if that means that Chrome OS behavior won't improve. If you'd prefer to focus on the Android-only elements of the original issue, then a separate bug to track other host OSes might make sense.
Status: Started
Agree with #14. This bug is for all platforms ergo stays open. If other platforms
prove too complex to address we'll shift this to Android only, mark as Fixed and
make daughter Issues. So far I haven't tried reproing with CrOs/Linux.
Project Member

Comment 16 by, Nov 20 2014

The following revision refers to this bug:

commit ee8c7cac097f864b19d69dcabd6782e4d8c793dd
Author: tommi <>
Date: Thu Nov 20 14:17:07 2014

Revert of Set camera parameters continuous focus mode on (patchset #1 id:1 of

Reason for revert:
Looks like this is causing MANUAL_CanAcquireVgaOnRealWebcam to fail.

Original issue's description:
> Android Video Capture: Set continuous focus mode on in cam parameters.
> This is, apparently, needed for macro modes, although
> autofocus seems to work ok in general.
> BUG= 343894 
> TEST=Please refer to the bug, basically a gUM() + close QR codes focus test.
> Committed:
> Cr-Commit-Position: refs/heads/master@{#304909},
BUG= 343894 

Review URL:

Cr-Commit-Position: refs/heads/master@{#305009}


Project Member

Comment 17 by, Nov 21 2014

The following revision refers to this bug:

commit 0910435eba14f433438ed2e448a67e799e851bdd
Author: mcasas <>
Date: Fri Nov 21 00:10:59 2014

Android video capture: Set camera parameters continuous focus mode on, where supported

This is, apparently, needed for macro modes, although autofocus seems to
work ok in general.

A similar CL was landed and reverted ( This CL
is an alternative where the supported focus modes are tested before being
set in the Camera.Parameters.

BUG= 343894 
TEST=Please refer to the bug, basically a gUM() + close text or QR codes focus test.

Review URL:

Cr-Commit-Position: refs/heads/master@{#305117}


Project Member

Comment 18 by, Nov 24 2014

The following revision refers to this bug:

commit d4bc57e27767335584181a8ec7918f9f19ff72e0
Author: mcasas <>
Date: Mon Nov 24 23:37:44 2014

Android Video Capture: Rename L with LOLLIPOP in Version check.

BUG= 343894,

Review URL:

Cr-Commit-Position: refs/heads/master@{#305520}


Labels: -M-41 M-42 MovedFrom-41
Moving all non essential bugs to the next Milestone.
Labels: -M-42 MovedFrom-42
[AUTO] This issue has already been moved once and is lower than Priority 1,therefore removing mstone.

Comment 21 Deleted

I am building a PDF417 scanner based on getUserMedia() however have found noise to be an issue and having the ability to focus or set focal point would likely enable this solution to work but without it I fear it wont. Please consider providing a way to do this with getUserMedia also.
Blockedon: 518807
Components: -Blink>WebRTC Blink>ImageCapture Blink>GetUserMedia>Webcam
Labels: -OS-Linux -OS-Chrome
Components: -Blink>ImageCapture Blink>MediaStream>ImageCapture
Renaming Blink>ImageCapture to Blink>MediaStream>ImageCapture. Moving these bugs to the new component. was a 
first step for this to happen.
Project Member

Comment 26 by, Aug 23 2016

The following revision refers to this bug:

commit 0e630cf2c14d1e0c815c95a8710e4d6eb5e09736
Author: mcasas <>
Date: Tue Aug 23 05:56:38 2016

ImageCapture: add sequence<Point2D> pointsOfInterest and wire for Android

This CL:
- adds a Point2D.idl to describe a coordinate [1] and
- adds a sequence<Point2D> to describe a series of
 points of interest [2]
- adds the correspondents to image_capture.mojom
 (note that I'd rather reuse gfx::mojom::PointF but a
 WebKit presumit prevents me from doing it).
- extends the Java_VideoCapture_setPhotoOptions to
 accept the said list of points of interest
- implements the points of interest for (Auto)Focus,
 limitation: only one such is actually used
 (enforced by assert).


BUG= 343894 ,  518807 

Cr-Commit-Position: refs/heads/master@{#413675}


Status: Fixed (was: Started)
Components: -Blink>MediaStream>ImageCapture Blink>ImageCapture
mcasas@ can you confirm that this is fixed for Android only? The reason I ask is that Comment #15 states that it should remain open until its fixed for all platforms yet the only OS box ticked is Android.
#30 you're right. However, per-platform implementations might 
be quite different, e.g. this feature is:
- implemented for Android,
- not available in the OS API in Mac, 
- not scheduled for working on it any time soon for Linux/CrOs
- not scheduled for working on it any time soon for Windows, 
with the added complication that most of the infra is also not
available for this platform.

With that, jansson@, should we split this bug...?
Labels: M-54

Sign in to add a comment