Creating a Scene From an Initial Video URL
In this example, we will show you how to initialize the CreativeEditor SDK with an initial video.
Explore a full code sample on Stackblitz or view the code on Github.
Starting from an existing video allows you to use the editor for customizing individual assets.
This is done by using engine.scene.createFromVideo(url: string): Promise<number>
and passing a URL as argument.
Specify the source to use for the initial video. This can be a relative path or a remote URL.
We can retrieve the graphic block id of this initial video using cesdk.engine.block.findByType(type: ObjectType): number[]
.
Note that that function returns an array.
Since there's only a single graphic block in the scene, the block is at index 0
.
We can then manipulate and modify this block.
Here we modify its opacity with cesdk.engine.block.setOpacity(id: number, opacity: number): void
.
See Modifying Scenes for more details.
When starting with an initial video, the scene's page dimensions match the given resource and the scene is configured to be in pixel design units.
To later save your scene, see Saving Scenes.