Search Docs
Loading...
Skip to content

Create From Video

Open CE.SDK with a video as the starting point for editing. The scene’s page dimensions match the video resolution and the scene is set up for time-based content.

3 mins
estimated time
GitHub

Starting from an existing video lets you build editors for customizing video content — trimmers, overlay editors, or upload-and-edit flows. Create a scene from a single video with engine.scene.create(fromVideo:).

This guide covers creating a scene from a video and reaching the video block to adjust its properties.

Create a Scene From a Video URL#

Pass a video URL to engine.scene.create(fromVideo:). The URL can point to a local file or a remote resource. The call loads the video and returns a handle to the new scene.

try await engine.scene.create(fromVideo: videoURL)

When you start from a video, the scene’s page dimensions match the resource, the scene uses pixel design units, and it is set up for time-based editing.

Work With the Video Block#

CE.SDK places the video inside a graphic block that carries a video fill. Retrieve it with engine.block.find(byType:), which returns every block of a given DesignBlockType. A scene created from a video contains a single graphic block, so the first result is the video block. From there, modify the block like any other element — for example, change its opacity with engine.block.setOpacity(_:value:).

guard let block = try engine.block.find(byType: .graphic).first else { return }
try engine.block.setOpacity(block, value: 0.5)

See Blocks for the full Block API.

API Reference#

Methods#

Method Description
engine.scene.create(fromVideo:) Create a scene from a video URL, matching the scene dimensions to the video
engine.block.find(byType:) Find all blocks of a DesignBlockType
engine.block.setOpacity(_:value:) Set a block’s opacity

Next Steps#