NativeTimelinePlayer class

Controls a native timeline player that composes and plays a sequence of TimelineClips in a gapless, frame-accurate manner.

Call load to initialise the native composition and obtain a texture ID suitable for rendering in a Flutter Texture widget. Then use play, pause, seekTo, and seekToClip to control playback. Listen to stateStream for position and playback-state updates.

Editing

After load, the timeline can be mutated without a full dispose/reload: trimClip, splitClip, insertClip, removeClip, moveClip, and replaceClip all preserve the active texture ID and seek position. Use exportCurrentTimeline to export the edited result — this ensures the exported MP4 matches exactly what the preview shows.

Always call dispose when the player is no longer needed to release the underlying native texture and compositor resources.

Properties

exportProgress Stream<TimelineExportProgress>
A broadcast stream of TimelineExportProgress events emitted during an active exportTimeline or exportCurrentTimeline call.
no setter
hashCode int
The hash code for this object.
no setterinherited
isLoaded bool
Whether load has completed and native resources are ready.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stateStream Stream<TimelinePlayerState>
A broadcast stream of TimelinePlayerState updates emitted by the native layer, including position and playback-state changes.
no setter
textureId int?
The Flutter texture ID registered by the native compositor after load.
no setter

Methods

dispose() Future<void>
Releases the native compositor and Flutter texture resources.
exportCurrentTimeline({String? outputPath}) Future<String>
Exports the currently loaded, edited timeline and returns the output path.
exportTimeline(List<TimelineClip> clips, {String? outputPath, TimelineCompositionConfig? config}) Future<String>
Exports clips to a video file and returns the output file path.
generateThumbnails(String videoPath, List<Duration> timestamps, {int width = 120}) Future<List<String>>
Extracts thumbnail frames from videoPath at each timestamp in timestamps and returns the absolute file-system paths of the cached JPEG images.
insertClip(int atIndex, TimelineClip clip) Future<void>
Inserts clip at position atIndex in the timeline.
load(List<TimelineClip> clips, {TimelineCompositionConfig? config}) Future<int>
Loads clips into the native compositor and returns the Flutter texture ID.
moveClip(int fromIndex, int toIndex) Future<void>
Moves the clip at fromIndex to toIndex. No-op when they are equal.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pause() Future<void>
Pauses playback at the current position.
play() Future<void>
Starts or resumes playback of the loaded timeline.
redo() Future<void>
Reapplies the next edit snapshot after undo.
removeAudioTrack() Future<void>
Removes any external audio track previously set via setAudioTrack.
removeClip(int clipIndex) Future<void>
Removes the clip at clipIndex from the timeline.
replaceClip(int clipIndex, TimelineClip clip) Future<void>
Replaces the clip at clipIndex with clip.
seekTo(Duration position) Future<void>
Seeks to position relative to the start of the full timeline.
seekToClip(int clipIndex) Future<void>
Seeks to the beginning of the clip at clipIndex in the loaded timeline.
setAudioTrack(AudioTrack track) Future<void>
Overlays an external track on the loaded timeline.
setClipAlignment(int clipIndex, double x, double y) Future<void>
Adjusts the pan-and-crop alignment for the clip at clipIndex.
setClipSpeed(int clipIndex, double speed) Future<void>
Sets the playback speed of the clip at clipIndex to speed.
setVolume(double volume) Future<void>
Sets the playback volume in the range [0.0, 1.0].
splitClip(int clipIndex, Duration atLocalPosition) Future<void>
Splits the clip at clipIndex at atLocalPosition from its trim-start, replacing it with two clips.
toString() String
A string representation of this object.
inherited
trimClip(int clipIndex, {Duration? trimStart, Duration? trimEnd}) Future<void>
Adjusts the trim in/out of the clip at clipIndex.
undo() Future<void>
Restores the previous edit snapshot in the native compositor.

Operators

operator ==(Object other) bool
The equality operator.
inherited