The video frame producer became inactive before any data was received.

776 views
Skip to first unread message

Jakub Sieprawski

unread,
Dec 29, 2021, 3:44:22 AM12/29/21
to Android CameraX Discussion Group
Hey,
I am trying to develop kotlin application with video capture using CameraX. I am trying to configure recording following instructions on: https://developer.android.com/training/camerax/video-capture but when I am starting recording camera closes immediately after with exception:
Recording was started when the Recorder had encountered error java.lang.RuntimeException: The video frame producer became inactive before any data was received.

What could be reason for this behaviour?

Jakub Sieprawski

unread,
Dec 29, 2021, 6:26:42 AM12/29/21
to Android CameraX Discussion Group, Jakub Sieprawski
Update:
First photo shows way of creating preview, camera selector, recorder, video capture object and binding it to lifecycle. Already checked that filtered qualities are not empty and there is available camera for defined selector.

Screenshot 2021-12-29 at 12.12.06.png

Second photo shows the way of configuring recording by adding media output to it and enabling audio (permissions are checked). Just after start i am getting VideoRecordEvent.Finalize with error code = 4 and message same as in topic when 0 bytes are received.
Screenshot 2021-12-29 at 12.13.51.png

Tested on android 8,9,10 and with different types of camera (front, back), every time same result.

Scott Nien

unread,
Dec 29, 2021, 8:56:22 PM12/29/21
to Jakub Sieprawski, Android CameraX Discussion Group
Hi Jakub, 
What's the device you were running ?  Is it a physical device or an emulator ?

--
You received this message because you are subscribed to the Google Groups "Android CameraX Discussion Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to camerax-develop...@android.com.
To view this discussion on the web visit https://groups.google.com/a/android.com/d/msgid/camerax-developers/c9058a5f-be4f-4b24-a096-690f754955f1n%40android.com.

Jakub Sieprawski

unread,
Dec 30, 2021, 3:19:16 PM12/30/21
to Android CameraX Discussion Group, Scott Nien, Android CameraX Discussion Group, Jakub Sieprawski
I was testing it on physical device: samsung galaxy s8, huawei p20 pro. I found camerax video capture sample project https://github.com/android/camera-samples, I ran it on my phones and it was working okay, without error. Tried to find the difference between my code and sample but to be honest could not. The only difference between those implementations was that sample used fragment and mine was fully in activity. I changed it in my implementation and it started running, error disappeared.

Scott Nien

unread,
Jan 2, 2022, 9:50:39 PM1/2/22
to Android CameraX Discussion Group, Jakub Sieprawski
Hi Jakub 
Is it possible that the issue happens only in 1.1.0-alpha10 which is the version used in  https://developer.android.com/training/camerax/video-capture ?
And the video capture sample in https://github.com/android/camera-samples uses a newer version 1.1.0-alpha12 so that the issue disappeared. 

Scott

Jakub Sieprawski

unread,
Jan 3, 2022, 6:37:36 AM1/3/22
to Android CameraX Discussion Group, Scott Nien, Android CameraX Discussion Group, Jakub Sieprawski
Hey, 
I found the issue. It wasn't related to package version. The error was due to the use of the camera preview in two cases simultaneously. Using it with mlkit face detection and with camerax video capture at the same time. I checked case when I add video capture and preview to lifecycle after stoping face detection - calling cameraSource.stop() video capture will work correctly but it will take about 3-4 seconds before bound preview will load and at that time user will see black screen. It is possible to bind android camera preview output frames to multiple sources at the same time? 
Screenshot 2022-01-03 at 11.10.14.png
photo1 (preview declaration in view)
Screenshot 2022-01-03 at 11.11.32.png photo2 (configuring face detection with mlkit)
Screenshot 2022-01-03 at 11.56.22.png
photo3 (configuration order)
Reply all
Reply to author
Forward
0 new messages