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

✨ Return mime (content type) from video recordings

Open jphilipstevens opened this issue 3 years ago • 7 comments

What

I noticed that the Video File object does not include the mime type. Including it in the VideFile would benefit those using the video to send over networks.

Alternatives/Workarounds

I am going to use https://www.npmjs.com/package/react-native-mime-types in order to get the mime from the file

import * as mime from "react-native-mime-types";

camera.current.startRecording({
    flash: flash,
    onRecordingError: (error) => {
        onStoppedRecording();
    },
    onRecordingFinished: (video) => {
        const videoSource = {
            path: video.path,
            mimeType: mime.lookup(video.path),
        };
        onMediaCaptured(video, "video");
        onStoppedRecording();
    },
});

jphilipstevens avatar May 28 '21 11:05 jphilipstevens