Switch between foreground / background video recording on the fly

85 views
Skip to first unread message
Assigned to leoh...@google.com by wuj...@google.com

Tomáš Válek

unread,
Nov 22, 2021, 5:44:48 PM11/22/21
to Android CameraX Discussion Group
Hello all CameraX heads!

Is it possible to start foreground recording with preview -> minimize app -> recording will continue on the background without preview -> switch back to foreground recording with preview?

Thank you.

Leo Huang

unread,
Nov 23, 2021, 3:08:13 AM11/23/21
to Android CameraX Discussion Group, Tomáš Válek
Hi,
This is currently impossible by using Activity lifecyle since CameraX will stop camera stream and recording when lifecycle goes to STOP. We are planning to support pause/resume recording while lifecycle goes to STOP/START, but this maybe still different from what you want.

Tomáš Válek 在 2021年11月23日 星期二上午6:44:48 [UTC+8] 的信中寫道:

Leo Huang

unread,
Nov 23, 2021, 4:36:13 AM11/23/21
to Android CameraX Discussion Group, Tomáš Válek
There is a possible way by using foreground Service + LifecycleService, you can bind Preview and VideoCapture to the LifecycleService, then the recording will not stop when activity goes to background.

Leo Huang <leoh...@google.com> 於 2021年11月23日 週二 下午4:08寫道:

Tomáš Válek

unread,
Jan 31, 2022, 8:53:16 AM1/31/22
to Android CameraX Discussion Group, leoh...@google.com, Tomáš Válek
I am using Foreground service + LifecycleService (extends LifecycleService), but I do not understand what do you mean: "bind Preview and VideoCapture to the LifecycleService"?

Dne úterý 23. listopadu 2021 v 10:36:13 UTC+1 uživatel leoh...@google.com napsal:

Android CameraX Discussion Group

unread,
Jan 31, 2022, 5:07:04 PM1/31/22
to Android CameraX Discussion Group, Tomáš Válek, Leo Huang
Hi there,

Some of our team is out for the lunar new year, we should be able to get back to you in a couple of weeks. Thanks!

Leo Huang

unread,
Feb 7, 2022, 9:23:32 PM2/7/22
to Android CameraX Discussion Group, Android CameraX Discussion Group, Tomáš Válek, Leo Huang
Hi,
I mean use the API cameraProvider.bindToLifecycle(LifeCycleOwner, CameraSelector, UseCase...) to bind LifeCycleService (which is a LifeCycleOwner) and UseCases.

Android CameraX Discussion Group 在 2022年2月1日 星期二上午6:07:04 [UTC+8] 的信中寫道:
Reply all
Reply to author
Forward
0 new messages