Skip to main content

splitSequences()v4.0.528

Splits supported timing elements into two adjacent JSX elements.

warning

Draft API: This API is experimental and may change.

split-sequences.ts
import {splitSequences, type CodemodProject, type JsxNodeReference} from '@remotion/codemods'; declare const project: CodemodProject; declare const node: JsxNodeReference; const result = await splitSequences({ project, splits: [{node, frame: 45}], }); console.log(result);

Adjusts from, durationInFrames, and trimBefore. Timing must be static; dynamic timing and spreads that may override it are rejected. The media file itself is unchanged.

Options

project

An in-memory CodemodProject. The input project is not mutated.

splits

An array of split requests. A node may appear once per call; requests may span files.

node

The node reference of a Remotion sequence, interactive element, or supported timeline media element.

frame

The integer frame at which to split, in the same parent timeline coordinate system as the node's from prop. It must be strictly inside the sequence.

Return value

A promise resolving to an object with the following properties.

project

The updated project. Unchanged files and extra project fields are preserved.

changes

An array of {filePath, previousContents, nextContents} file changes. A null content value indicates a created or deleted file.

nodePathRemappings

An array of {filePath, oldNodePath, newNodePath} mappings. A null old path indicates an insertion; a null new path indicates removal. Apply these mappings to references from the input project. See node references.

insertedNodes

References to the new second halves. Each first half keeps its original identity, with any path change listed in nodePathRemappings.

Errors

Throws or rejects when the target cannot be resolved, the requested edit is unsupported, or an option is invalid. Failed edits leave the input project unchanged.

Compatibility

BrowsersServersEnvironments
Chrome
Firefox
Safari
Node.js
Bun
Serverless Functions

See also