Language:
From Camera Roll
VideoEditor SDK supports importing videos from the camera roll.
Select a video#
In this example, we are using the expo-image-picker
module to select a video from the camera roll.
Open the editor#
When a video has been selected we pass the local URI to the openEditor
method to load the video into the editor and open it.
Once the video has been exported, we handle the result and possible occurring errors.
File:
import { VESDK } from "react-native-videoeditorsdk";import * as ImagePicker from "expo-image-picker";export const openVideoFromCameraRollExample = async (): Promise<void> => {try {// Select a video from the camera roll.let pickerResult = await ImagePicker.launchImageLibraryAsync({mediaTypes: ImagePicker.MediaTypeOptions.Videos,});// Return if the video selection has been cancelled.if (pickerResult.cancelled) {return;}// Open the video editor and handle the export as well as any occuring errors.const result = await VESDK.openEditor(pickerResult.uri);if (result != null) {// The user exported a new video successfully and the newly generated video is located at `result.video`.console.log(result?.video);} else {// The user tapped on the cancel button within the editor.return;}} catch (error) {console.log(error);}};