Search Docs
Loading...
Skip to content

Force Trim

Force trim lets you enforce minimum and maximum video durations in the timeline UI. The editor clamps export to the maximum duration and shows labels to communicate the limits.

Configure duration constraints#

Apply constraints in imgly.onLoaded after the scene has loaded. Use seconds for the values and ensure the max is not smaller than the min.

context.setVideoDurationConstraints(
minimumVideoDuration: 5,
maximumVideoDuration: 15,
)

Launch the video editor#

Present the VideoEditor as usual. You can call setVideoDurationConstraints again later to adjust limits at runtime.

.imgly.onLoaded { context in
context.setVideoDurationConstraints(
minimumVideoDuration: 5,
maximumVideoDuration: 15,
)
}

Timeline and export behavior#

When the scene duration is below the minimum, the min label stays visible and the editor blocks export with a dialog. When the duration exceeds the maximum, the playhead sticks to the max position and export is clamped to that duration.