I have implemented picker for camera recordings and video picking. I want the feature in which the camera records no more than 30 seconds. If user wishes then he/she can stop recording before 30 seconds but if they don't then after reaching 30 seconds of recording the camera stops itself and media is picked. I tried to use durationLimit: 30, prop but this isn't helping.
return new Promise((resolve) => {
Alert.alert(
"Capture Media",
"Choose what to capture",
[
{
text: "Photo",
onPress: async () => {
const img = await ImageCropPicker.openCamera({
cropping: true,
compressImageQuality: 0.8,
mediaType: "photo",
});
resolve(img);
},
},
{
text: "Video",
onPress: async () => {
const video = await ImageCropPicker.openCamera({
mediaType: "video",
compressVideoPreset: "MediumQuality",
durationLimit: 30,
});
resolve(video);
},
},
{ text: "Cancel", style: "cancel", onPress: () => resolve(null) },
]
);
});
} catch (err: any) {
if (err?.code !== "E_PICKER_CANCELLED") Alert.alert("Error", err.message);
return null;
}
I have implemented picker for camera recordings and video picking. I want the feature in which the camera records no more than 30 seconds. If user wishes then he/she can stop recording before 30 seconds but if they don't then after reaching 30 seconds of recording the camera stops itself and media is picked. I tried to use durationLimit: 30, prop but this isn't helping.
captureFromCamera: async (): Promise<MediaResult | null> => {
try {
const cameraPermission = await PermissionUtils.checkAndRequestPermission("camera");
if (!cameraPermission) return null;
},