Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

recording video from a service with Camera2 API

I have issues on some phones that I can't test on (that's the first problem) I'm trying to build a service that can record from camera2 API. But when I send the app to the background, on some phone it appears to have issues that I am failing to solve at the moment. I only have logs and cannot figure out the main reason for the app not working.

Thank you for helping

Edit:

You'll find the actual source code that solved my problem here: https://bitbucket.org/dreamappsfr/kinghul

This was a POC that has been stopped. I honestly don't remember how I overcome this specifical issue at that time.

like image 652
Astyan Avatar asked Feb 08 '18 08:02

Astyan


People also ask

What is the use of Camera2 API?

Camera2 is the latest low-level Android camera package and replaces the deprecated Camera class. Camera2 provides in-depth controls for complex use cases, but requires you to manage device-specific configurations. You can read about specific Camera2 classes and functions in the reference documentation.

What is Level 3 Camera2 API?

Level_3: These devices support YUV reprocessing and RAW image capture, along with additional output stream configurations on top of full Camera2 API support. External: Similar to LIMITED devices with some exceptions (e.g. some sensor or lens information may not be reported or have less stable frame rates).

How do I know if my camera API is enabled?

In order to use the most recent version of GCam (7.0), your Android device will need to support the Camera2API. Check for app compatibility by installing and then launching the free Camera2 API Probe app. If it reads “LEVEL 3,” “FULL,” or “LIMITED,” you should be fine.


1 Answers

You would try with:

Camera2-Video

Basically it is a wrapper for the video capture using Camera2.

Add you your build.gradle file:

compile 'com.wesleyelliott:camera2-video:0.0.2'

and create a Fragment extended from com.wesley.camera2.fragment.Camera2Fragment and override the methods getTextureResource and getVideoFile.

To start recording, you must use the method: startRecordingVideo(), to stop it stopRecordingVideo and to check if the app is currently recording a video or not, a method isRecording().

I already used it and is the simpler way to record a video with Camera2

like image 61
Benjamin RD Avatar answered Oct 24 '22 00:10

Benjamin RD