tonyt...@google.com
unread,Jun 22, 2022, 6:20:34 AM6/22/22Sign 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, Scott Nien, Android CameraX Discussion Group, Leo Huang, Tomáš Válek
Hi,
While we are looking into auto file switching feature, could you try to start a new file when it reaches the limit? You may use
setFileSizeLimit to assign a file size limit to a recording. When the specified limit is reached, the recording will be automatically finalized with
ERROR_FILE_SIZE_LIMIT_REACHED. Then in the VideoRecordEvent listener set at
start, you may start a new recording when receive this error. The code would be like:
```
val outputOptions = FileOutputOptions.Builder(file)
.setFileSizeLimit(limit)
.build()
recording = recorder.prepareRecording(this, outputOptions)
.start(executor) { recordEvent ->
when(recordEvent) {
is VideoRecordEvent.Finalize -> {
if (recordEvent.error == ERROR_FILE_SIZE_LIMIT_REACHED) {
// Start a new recording
}
}
}
}
```