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

threw this one in quickly. Let me know if you need more details

jphilipstevens avatar May 28 '21 11:05 jphilipstevens

I believe videos are always mov on iOS and mp4 on Android, but that's a good feature request - I'll take a look when I can 👍

mrousavy avatar May 28 '21 12:05 mrousavy

@mrousavy point me to the native code where I set this and I can code it locally. We use patch-project so I think I could make some tweaks on 1.x and experiment. After a few weeks of making sleep optional, I may finally have some time to experiment hahahaha

jphilipstevens avatar Jun 03 '21 11:06 jphilipstevens

@mrousavy can we add this feature?

erennyuksell avatar Aug 28 '23 09:08 erennyuksell

@erennyuksell you can add this feature if you want yes

mrousavy avatar Aug 28 '23 10:08 mrousavy

Hey @jphilipstevens - what approach did you go for? I'm not sure how I would get the mime-type, but effectively it just always is video/${codec}, where codec is either mp4 or mov, right?

mrousavy avatar Jan 30 '24 16:01 mrousavy

Came across this looking into something unrelated, but wanted to note the mime-type for mov is video/quicktime, not video/mov. So for iOS it would be video/quicktime and Android video/mp4

maxbbb avatar Mar 22 '24 16:03 maxbbb