react-native-vision-camera icon indicating copy to clipboard operation
react-native-vision-camera copied to clipboard

✨ maxDuration and maxFileSize

Open joebochill opened this issue 1 year ago • 4 comments

What feature or enhancement are you suggesting?

Extend RecordVideoOptions to include properties for maxDuration and maxFileSize.

Related questions around duration here and here.

I am migrating an app from using react-native-camera (now deprecated) to this library. One of the nice things about react-native-camera was the ability to set a file size/duration limit, after which the video recording is stopped automatically and the file returned as normal. This is especially useful in my app as users are recording themselves while the camera is on a tripod / otherwise not in their hand to stop the recording.

What Platforms whould this feature/enhancement affect?

iOS, Android

Alternatives/Workarounds

maxDuration is easy enough to work around using a timer (would still be nice to have the option built-in though).

maxFileSize requires post-processing after the video is recorded — as far as I can tell there's not a straightforward way to do this except to guess and check with trimming / compression settings until the video size is below the maximum.

Additional information

joebochill avatar Feb 03 '24 15:02 joebochill

Good feature request, thanks! 👍

mrousavy avatar Feb 05 '24 11:02 mrousavy

I was opening a new issue with similar request. the expo camera have this features though:

https://docs.expo.dev/versions/latest/sdk/camera/#camerarecordingoptions

As for the max duration:

We can achieve this programmatically by using the stop recording function: https://react-native-vision-camera.com/docs/api/classes/Camera#stoprecording

but I am not sure about the maxFileSize yet.

a0m0rajab avatar Jun 21 '24 09:06 a0m0rajab