Video composition

Adding Layers

Layer Types

Editframe currently supports the following layer types:


You can add any of these layer types to a composition by calling it's associated add<LayerType> method. Each one of these methods interfaces adhere to the same rules:


If the layer type involves a file, the first argument will be a file, which must be a CompositionFile.


If the layer type has layer-specific options, the next argument will be options, an object containing those attributes.


If the layer type allows you to set layer configuration options, the next argument will be an optional layerConfig object containing those attributes.

Layer Classes

Every add<LayerType> method returns an instantiated class representing the type of layer you've added. This class has getter and chainable setter methods for all of the attributes that you can provide in the options and layerConfig arguments. For example, a call to composition.addAudio will return an instance of the Audio class.

Configuring a layer

These two examples are equivalent:

const audio = await composition.addAudio(
  { volume: 0.5 },
    timeline: { start: 3 },
    trim: { start: 2, end: 6 },

const audio = await composition.addAudio("path/to/audio.mp3");

audio.setVolume(0.5).setStart(3).setTrim(2, 6);

Reading layer option and configuration attributes

audio.volume; // 0.5
audio.start; // 3
audio.trim; // { start: 2, end: 6 }
Create a composition