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

Issue 698853 link

Starred by 4 users

Issue metadata

Status: Fixed
Owner:
Closed: May 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 3
Type: Feature

Blocking:
issue 674593


Show other hotlists

Hotlists containing this issue:
Non-Standard-IDL


Sign in to add a comment

Update HTML Media Capture implementation.

Project Member Reported by rijubrat...@intel.com, Mar 6 2017

Issue description

Chrome Version: 58.0.3015
OS: android

What steps will reproduce the problem?
The current implementation in Blink reflects an old version of the spec and needs to be updated.
@capture attribute was a boolean, now it is an enum.

Spec changes: https://github.com/w3c/html-media-capture/issues/4

What is the expected result?
-

What happens instead?
-


 
Components: Blink>ImageCapture
I am putting up a WIP CL full of Logs here (https://codereview.chromium.org/2735633004).

adb logcat output is here(https://gist.github.com/riju/4138c153ab54e9a6c3c9cff892bb0dd1) and a shorter one here(https://gist.github.com/riju/569b238223e20a02be32a1c72086f7fb).

My device is running "android version release = 6.0; sdkVersion: 23"

camera.putExtra("android.intent.extra.USE_FRONT_CAMERA", true);
or
camera.putExtra("android.intent.extras.LENS_FACING_FRONT", 1);
or
camera.putExtra("android.intent.extras.CAMERA_FACING", Camera.CameraInfo.CAMERA_FACING_FRONT);

did not have the desired effect, so tried to loop through all cameras and find the front facing one, and open the camera using -> manager.openCamera(mCameraId, mStateCallback, null)
I get that Front camera is cameraID=1, still Camera always opens facing that side it was facing, when it was closed last time.

Is there is a preferred way to open the camera facing front ?

Cc: -miguelg@chromium.org mcasas@chromium.org
Blocking: 674593
Cc: foolip@chromium.org
Project Member

Comment 7 by bugdroid1@chromium.org, Mar 10 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/97065e3acc9aed6ed78628114d19d327431f6b6e

commit 97065e3acc9aed6ed78628114d19d327431f6b6e
Author: Philip Jägenstedt <foolip@chromium.org>
Date: Fri Mar 10 05:55:45 2017

Link to the new input.capture spec and add a TODO to reconcile

BUG= 698853 
R=mcasas@chromium.org

Change-Id: I5d9b9e4f1dc7e985fe48a2392afb24eedae45b59
Reviewed-on: https://chromium-review.googlesource.com/452138
Reviewed-by: Miguel Casas-Sanchez <mcasas@chromium.org>
Commit-Queue: Philip Jägenstedt <foolip@chromium.org>
Cr-Commit-Position: refs/heads/master@{#456005}
[modify] https://crrev.com/97065e3acc9aed6ed78628114d19d327431f6b6e/third_party/WebKit/Source/core/html/HTMLInputElement.idl

Comment 8 by foolip@chromium.org, Mar 10 2017

Components: -Blink>HTML

Comment 9 Deleted

Hi Miguel and qinmin,

Last few days, I prototyped a native Android app for Basic Camera operations.
camera.open(front_id) works, but it needs a surface for preview.
I decided against going that route for this bug, as even if I get the preview working, all the controls user expect(from camera) in the interface will be hard to add.
So intent and then launch the camera app should be the way to do.
Uploaded a WIP patchset to the CL

summary ->
====
Intent camera = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
            camera.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION
                    | Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
            camera.putExtra(MediaStore.EXTRA_OUTPUT, mCameraOutputUri);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
                    camera.putExtra("android.intent.extras.LENS_FACING_FRONT", 1);
                } else {
                    camera.putExtra("android.intent.extras.CAMERA_FACING",
                            Camera.CameraInfo.CAMERA_FACING_FRONT);
                }

====
Output:
I see intent as => #Intent;action=android.media.action.IMAGE_CAPTURE;launchFlags=0x3;i.android.intent.extras.LENS_FACING_FRONT=1;end
=====

But still camera opens with "last opened facing mode".

Any suggestions ?
There is no standard, documented intent extra for the camera facing, when using ACTION_IMAGE_CAPTURE; only what's documented in the reference can be counted to be tested:

https://developer.android.com/reference/android/provider/MediaStore.html#ACTION_IMAGE_CAPTURE

Various Android OEMs may respect some kind of extra for this, but there's likely a variety of names for it; and if a user has set some other camera application (from the Play Store) as the default camera, that application may not respect that extra (or any other). 

So a facing field cannot be relied upon, unless you know exactly what camera app will be receiving the intent.

Cc: finnur@chromium.org
thanks @etalvala for the information.

Looks like iOS has some UIImagePickerController where you can specify to open the camera (UIImagePickerControllerSourceTypeCamera) and specify that you want front facing (UIImagePickerControllerCameraDeviceFront).

I was expecting something similar in Android.

@finnur is working on a File/Photo picker (https://bugs.chromium.org/p/chromium/issues/detail?id=656015)
and I wanted to use the "LAUNCH_CAMERA" part for this bug, but if the underlying Android API is not supported, let's see how far we can progress.





Yes, I am working on a File/Photo picker, and although the user will be able to launch the camera from it, the functionality around the camera intent should remain the same as it does in the current Chromium codebase. I don't think you have/should have much of a dependency on my work.
@finnur: Yes right, just wanted to keep in the loop.
Labels: ExternalContributor
Project Member

Comment 16 by bugdroid1@chromium.org, Apr 27 2017

Status: Fixed (was: Started)
The CL for implementing the HTML Media Capture spec change has landed. https://chromium.googlesource.com/chromium/src/+/08c2a170239dae6559f696d033fa1baf8bbef4ac


Cc: paulkinlan@chromium.org
 Issue 772905  has been merged into this issue.

Sign in to add a comment