ImagePicker selecting both photos and videos

Hello, I am using ImagePicker and would like to select both photos and videos from the phone’s gallery. I’m able to successfully select photos and save them in base64 format. See my current code below:

Is there a way to also properly save videos in base64? So a user has the option of uploading both a photo or a video? Any help would be appreciated!

onImageButtonPress = async () => {
    const { status } = await Permissions.askAsync(Permissions.CAMERA_ROLL);
    if (status === 'granted') {
        const result = await ImagePicker.launchImageLibraryAsync({
            allowsEditing: true,
            base64: true,
            mediaTypes: 'All',
            aspect: [4, 3]

        if (!result.cancelled) {
            const img = result.base64;
                prop: 'photo',
                value: `data:image/jpeg;base64,${img}`

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.