INNER CODE UNIT · TypeScript
layers
vargHQ/sdk · src/ai-sdk/providers/editly/index.ts:100
const layers = clip.layers.map((layer) =>
applyLayerDefaults(layer, defaults),
);
let duration = clip.duration ?? defaultDuration;
for (const layer of layers) {
if (layer.type === "video") {
const videoLayer = layer as VideoLayer;
// Use pre-propagated duration when available (avoids ffprobe HTTP
// round-trip for remote URLs). Fall back to ffprobe otherwise.
const videoDuration =
videoLayer.sourceDuration ??
(await getVideoDuration(videoLayer.path, backend));
const cutFrom = videoLayer.cutFrom ?? 0;
const cutTo = Math.min(
videoLayer.cutTo ?? videoDuration,