ImagePicker.launchCameraAsync on IOS - selecting video

#1

When using the ImagePicker module on IOS (haven’t tested android) - I prompt the Camera with launchCameraAsync and it opens just fine. If i take a photo - this also works just fine. The problem arises when I prompt the Camera, and select the video recording option on the IOS device. After recording the video - it crashes the app. How do I disable the video option to ensure users can only take photos.

#2

What kind of crash do you mean? Like a low level crash in the native code or a JavaScript level exception (which you can catch)

#3

It must be a low level crash. On my device, the app just closes and I see nothing in my development logs. My code is sitting in a try catch block as well - so no exceptions were caught. I simply used the code from the docs as follows:

export const takePhoto = async () => {
try {
result = await ImagePicker.launchCameraAsync({
allowsEditing: true
})

} catch(e){
result = e
}

return result
}

#4

What version of the SDK are you on?

Can you check the logs again? Assuming real device, can connect to MacBook and check the console app for the logs of the device.

#5

I’m using version 23 on a real device(iphone 6s). I have my logs up and running and nothing is being printed. Strangely enough, if I use the ImagePicker.launchImageLibraryAsync and select an existing video, it works fine.

#6

Can you try 24 on a real device? So the app just exits normally?

#7

The app exits normally, but if I reopen it, it reboots. I’ll try 24 and report back - thanks.

1 Like
#8

I get the same result in expo 24. Photos work fine - but the Video boots me out of the app after I finish recording and press the ‘Use Video’ button.

#10

Ok So I finally got it to a working state. Version 23 allows both Video and Photo options (but for some reason bugs out whenever you record the video), whereas Version 24 does not even offer the video option. I thought it was just a matter of updating my expo package, but you’ve got to follow the upgrade instructions listed @ the bottom of the article here: https://blog.expo.io/expo-sdk-v24-0-0-is-now-available-bfcac3b50d51. Thanks for pointing me in the right direction.

closed #11

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