How to immediately stop video recording?

64 views
Skip to first unread message
Assigned to leoh...@google.com by tah...@google.com

Eugene B

unread,
Nov 27, 2025, 10:49:38 AMNov 27
to Android CameraX Discussion Group
Hello,

We are facing an issue where our Camera app's process is being killed by Android when a user ejects the SD card from the system settings. This occurs if the app has files open on that card.

Specifically, if a user is recording a video to the SD card and initiates an "Eject" action, Android forcefully terminates our Camera app. According to our logs, the app has approximately 150-200 ms before the system sends a termination signal.

Our question is: Is there a way to immediately stop the video recording and release the acquired file on the SD card within this short window? We need a very fast method to do this, even if it means the last video buffer is not completely written.

Leo Huang

unread,
Nov 28, 2025, 1:13:01 AMNov 28
to Eugene B, Android CameraX Discussion Group
Hi,

We have a ticket https://issuetracker.google.com/264812009 to trace this requirement and we have a solution for it.

The solution ensures that even if the application is killed during video recording, the partially saved video file will remain playable without requiring an explicit stop command.

Please monitor the provided link for further updates.


Eugene B <eugeneb...@gmail.com> 於 2025年11月27日 週四 下午11:49寫道:
--
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 visit https://groups.google.com/a/android.com/d/msgid/camerax-developers/b96ed3b1-f8ed-4445-90fe-bf1c53398cf9n%40android.com.

Eugene B

unread,
Nov 28, 2025, 4:35:47 AMNov 28
to Android CameraX Discussion Group, leoh...@google.com, Android CameraX Discussion Group, Eugene B
Hi,
It seems this ticket is about a different issue.
From a UX perspective, we don't want the Camera app to close. We only need to immediately release the resources it has opened on the SD card to prevent the OS from killing our app.

пятница, 28 ноября 2025 г. в 09:13:01 UTC+3, leoh...@google.com:

Leo Huang

unread,
Nov 28, 2025, 6:07:27 AMNov 28
to Eugene B, Android CameraX Discussion Group
I see. Thanks for the clarification. Honestly, I don't have an answer for this scenario. Even if you can trigger the recording stop while receiving the event, it may not complete within the short timeframe. Maybe you can mitigate this via UX, such as giving a proactive warning to the user for the SD card usage.

Eugene B <eugeneb...@gmail.com> 於 2025年11月28日 週五 下午5:35寫道:

Eugene B

unread,
Dec 1, 2025, 4:11:56 AMDec 1
to Android CameraX Discussion Group, leoh...@google.com, Android CameraX Discussion Group, Eugene B
Hi,
Is it possible to schedule the implementation of an API for immediate video recording stop?
The purpose of this API is to immediately stop the video and release the open resources on the media, regardless of data loss and the file being unreadable.


пятница, 28 ноября 2025 г. в 14:07:27 UTC+3, leoh...@google.com:

Leo Huang

unread,
Dec 1, 2025, 10:39:08 AMDec 1
to Android CameraX Discussion Group, eugeneb...@gmail.com, Leo Huang, Android CameraX Discussion Group
Hi,

Thanks for the suggestion. I've created a feature request for an immediate stop API. While it might still have a race condition with the Android system, it should help mitigate the issue.

Feature request: https://issuetracker.google.com/465099154

eugeneb...@gmail.com 在 2025年12月1日 星期一下午5:11:56 [UTC+8] 的信中寫道:

Eugene B

unread,
Dec 1, 2025, 10:50:42 AMDec 1
to Leo Huang, Android CameraX Discussion Group
Thank you very much!
Reply all
Reply to author
Forward
0 new messages