Picking video files in ImagePicker

Expo.ImagePicker.launchImageLibraryAsync works great for selecting images but doesn’t seem to include saved video files. Is there an expo alternative that I’m missing or should I build a non-native picker such as by using react-native-camera-roll-picker?

Hey! If you give mediaType: 'video' in the arguments on iOS it lets you pick videos. This is a hidden feature haha. And you can use the resultant URL with the Expo.Components.Video component! Can’t do this on Android though. We’re planning to improve add to the media APIs in coming times and this is definitely a feature we want to add.

3 Likes

That’s great, thanks.

Regarding passing the resulting URL to the expo video component, when I try that the expo app crashes on my device (minimizes from my screen).

source: ‘file:///var/mobile/Containers/Data/Application/3DE2F359-06BA-431A-9BA2-B05150A971E4/tmp/trim.E721344C-28C6-44E3-BED7-358BDFF3C205.MOV’

doesn’t work.

If I replace the ‘source’ value with
require(‘…/…/assets/lights.mp4’);

It works.

It is not working for me. Even after adding mediaType: 'video' it is showing only images for me. Do I need to add any permissions? I am building a standalone iOS app using Expo

Hey @lawry – we removed this feature recently to make the ImagePicker APIs on both platforms be the same. We are planning to add video picking options in the future.

@nikki We are close to replacing our old swift/native app in the App Store with one completely built in expo/React. However, not being able to pick a video is preventing this. We have tried out DocumentPicker, but that is not going to work for us (its probably good enough on Android). Are there any alternatives? We have avoided ejecting up to this point using all Expo, however, we have a launch timeline of mid Oct. Any chance this will be added back in SDK v22?

It would be awesome to get video support added to Expo’s ImagePicker. For the time being, we managed to get by using a combination of DocumentPicker.getDocumentAsync({ type: 'video/*' }) for Android and ImagePickerIOS.openSelectDialog({ showVideos: true }, success, cancel) for iOS.

2 Likes

Is there any update on this? I would love to have something equivalent to the ImagePicker for videos.

Hello Guys

Any update on this topic please?

Thanks

Yanis

You can use the DocumentPicker with MIME type “video/*” (at least on Android).

1 Like