Skip to main content
Language

From Multiple Videos

VideoEditor SDK supports loading multiple videos from the local file system such as the documents or a temporary directory, as well as the application resources.

Load Videos#

Create an array of AssetURIs containing all of the video files you want to load into the editor. For this example, we are using two local videos.

Open the editor#

This array of video URIs can now be loaded into the editor while handling the result as well as any possible occurring errors.

import { AssetURI, VESDK } from "react-native-videoeditorsdk";
export const openVideoFromMultipleVideosExample = async (): Promise<void> => {
try {
// Add videos from the assets directory.
const firstVideo = require("../../../../../assets/vesdk/Skater.mp4");
const secondVideo = require("../../../../../assets/vesdk/rollerskates.mp4");
const videos: AssetURI[] = [firstVideo, secondVideo];
// Open the video editor and handle the export as well as any occuring errors.
const result = await VESDK.openEditor(videos);
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) {
// There was an error generating the video.
console.log(error);
}
};