Create a Composition
The Composition API is Editframe's core and most powerful offering. You can think of a composition as the blueprint of a video, consisting of an unlimited number of layers. Each element in your eventual video is represented by an individual layer in the composition. The order in which layers are added to the composition is the order in which they will be stacked in the video.
Here's an example composition creation using all arguments and options:
const composition = await editframe.videos.new(
// options
{
// Hexadecimal color
backgroundColor: "#c400ac",
dimensions: {
// Height in pixels
height: 1080,
// Width in pixels
width: 1920,
},
// Duration in seconds
duration: 60,
// Arbitrary metadata for your convenience
metadata: {
myId: "1",
},
},
// videoFile
"https://example.com/video.mp4"
);
editframe.videos.new()
arguments
options
The options
argument is optional. All properties in options
are optional.
Argument | Type | Default | Description |
---|---|---|---|
backgroundColor | string | '#000000' | Valid color values: 'transparent' , or a hexadecimal color, e.g. #0099cc |
dimensions | object | ||
dimensions.height | number | Video height in pixels | |
dimensions.width | number | Video width in pixels | |
duration | number | Video duration in seconds | |
metadata | object | Arbitrary metadata for your convenience. Store whatever you want. Editframe doesn't use this data. |
videoFile
If you have an existing video file that you would like to use to automatically set the dimensions
and duration
attributes for your composition, you can provide it as the second argument. The videoFile
must be a CompositionFile
.