The Android framework supports capturing images and video through the android.hardware.camera2 API or camera Intent. Use this tags for questions about accessing camera of getting a camera preview or accessing specific features like recording, auto-focus, time lapse etc.
Questions tagged [camera-api]
54 questions
11
votes
0 answers
How to stop camera flash when triggering autofocus?
In my camera app, I'm triggering an autofocus when the user taps the screen, using this code:
mCamera.autoFocus(null);
I'm also allowing the user to set the camera flash mode in an options screen. The problem is that when triggering an autofocus…

samgak
- 23,944
- 4
- 60
- 82
8
votes
2 answers
MediaRecorder gives start error or IllegalStateException
I am using MediaRecorder for recording a video through Camera API of android. I am stucked with a very strange problem.
private void startRecordingVideo() {
recorder = new MediaRecorder();
…

Megha Maniar
- 444
- 5
- 22
5
votes
2 answers
Camera 2 : Unable to record video in full screen?
I'm using google official sample to work around video recording by using Camera API 2 . but the problem is I'm not able to make it full screen as I limited the screen orientation only to portrait.Here the xml I edited and the official xml.

Stella
- 1,817
- 6
- 30
- 55
4
votes
1 answer
HTML Camera API in Android webview
I'm using the following html code. I'm able to get a video stream on my desktop, but I'm getting a grey play button in the android webView app. I'm serving this over a https connection.
Please guide me as Im new to both of these code snippets.
HTML…

Sarabjit
- 129
- 3
- 13
3
votes
0 answers
Continuously taking pictures using Camera2 API
I'm working on a project where I need to constantly take pictures with some defined resolution, quality and waiting period. The user is able to start/stop the capturing of pictures, the user can also run it with a preview or without a preview (as to…

113408
- 3,364
- 6
- 27
- 54
3
votes
1 answer
Android Camera API 2 Auto Focus on Front Camera
I am working with Camera API 2 in Android and trying to apply the auto focus feature. The auto focus is working fine with back camera but not the front camera.
(I am using Android 5.1 and 6.0 devices)
Detail:
This is the trigger to start auto…

An Quoc Duy Nguyen
- 197
- 1
- 15
3
votes
0 answers
Android Camera2 API RAW capture with flash
I tried to take flashed images and RAW with camera2 API and save JPEG and DNG files. When I make first shoot, the result image (jpeg) is black. On second shot everything is fine! I make photos in completely dark room. Flash fires for both shots. And…

Maxim Metelskiy
- 1,389
- 14
- 29
2
votes
0 answers
Android CameraApi2 BLASTBufferQueue
I am working on a android app with the cameraApi2. It is working fine which means I see a preview of the camera and I can take pictures.
The only problem I have is the logs getting flooded with the following error message:
E/BLASTBufferQueue:…

Paul Franken
- 43
- 4
2
votes
2 answers
Capacitor Camera API throws error when running on web
I am following the instructions for Capacitor Camera APi https://capacitor.ionicframework.com/docs/guides/ionic-framework-app
The plugin works fine when running the application on an android device ionic capacitor run android -l but when serving…

Hassan Al Bourji
- 185
- 1
- 13
2
votes
1 answer
How to select rear-facing camera on a progressive web application?
I have a camera PWA, it's working fine with taking photos and uploading them, but I want to use the rear-facing camera instead of the front facing cam. How do I proceed on doing this?
This is the current lines of coenter code heredes I'm using for…

AdoboEater415
- 21
- 1
2
votes
1 answer
Android camera fails on APi 22(Lollipop) but work on all other versions
I Created a Custom Camera and it keeps failing at on Api 22 but works on all other versions. I have tried it on. Am using the depreciated Camera API because the minver is API 19. Been trying to fix the issue but can't seem to solve it. Kindly help…

Qwaiks
- 79
- 5
2
votes
1 answer
Android Camera2 - Callback to Intercept E/Camera Error When It Becomes Unavailable (i.e. User Takes Selfie)
In my application I am using the Camera2 API to do some processing in the background. I am using the well known Camera2Basic (albeit now heavily modified). Everything runs great, but there is an obvious issue - when the user requests the camera for…

Matt from vision.app
- 478
- 4
- 14
2
votes
0 answers
How to control exposure time with camera API in some Android phones
I use camera.getParameters() to get all camera parameters of the smart phone, and camera.getParameters.set(key, value) to control the target parameters.
When I choose MX4 as my test phone, the parameters contain two parameters as follows:…

koma
- 21
- 2
2
votes
1 answer
java.lang.RuntimeException: takePicture failed in lollipop and marshmallow
I am trying to make an app which takes front image then back image on a single activity intent, my front camera code is same as below and works perfectly fine i even call a finish to destroy the surface and inside onSurfaceDestroy() i call…

Elathan
- 31
- 1
- 6
2
votes
0 answers
Is Camera.stopPreview() and Camera.startPreview() methods necessary for setting camera flash modes in Android?
I was recently trying to develop a flashlight application using the older Camera API. I get the Camera object by
camera = Camera.open();
p = camera.getParameters();
This is enclosed in try-catch block.The code I am using to turn on camera flash…

Vivek Sasidharan
- 1,265
- 3
- 17
- 34