Tobias Tharaldsen
unread,Aug 18, 2025, 9:53:14 AMAug 18Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Android CameraX Discussion Group, leoh...@google.com, Android CameraX Discussion Group, Tobias Tharaldsen
Hi.
Thanks for answering, then it sounds like an even better solution is on its way that you mentioned about saving recordings being stopped abruptly, which is great! :)
Of course, what I used for testing was:
- CameraX version: 1.5.0-rc01
- SD card filesystem: FAT16
Testing reaching full storage on SD card was not an important test for me, since I use internal storage (and is why I didn't set up any handling of observing the remaining available space on the SD card), but I quickly got to test it by getting some help from AI to set it up like this:
val resolver = application.contentResolver
val volumes = MediaStore.getExternalVolumeNames(application)
val sdCardVolume = volumes.find { it != "external_primary" }
val targetUri = if (sdCardVolume != null) {
MediaStore.Video.Media.getContentUri(sdCardVolume)
} else {
MediaStore.Video.Media.EXTERNAL_CONTENT_URI
}
val filename = "VID_${System.currentTimeMillis()}"
val contentValues = ContentValues().apply {
put(MediaStore.Video.Media.DISPLAY_NAME, filename)
put(MediaStore.Video.Media.MIME_TYPE, "video/mp4")
}
val outputOptions = MediaStoreOutputOptions.Builder(resolver, targetUri)
.setContentValues(contentValues)
.build()
activeRecording = videoCapture?.output
?.prepareRecording(application, outputOptions)
?.withAudioEnabled()
?.start(ContextCompat.getMainExecutor(application)) { event ->