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.
Constructors
- NativeTimelinePlayer({VideoUltraPlayerPlatform? platform})
- Creates a NativeTimelinePlayer.
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
clipsto 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
videoPathat each timestamp intimestampsand returns the absolute file-system paths of the cached JPEG images. -
insertClip(
int atIndex, TimelineClip clip) → Future< void> -
Inserts
clipat positionatIndexin the timeline. -
load(
List< TimelineClip> clips, {TimelineCompositionConfig? config}) → Future<int> -
Loads
clipsinto the native compositor and returns the Flutter texture ID. -
moveClip(
int fromIndex, int toIndex) → Future< void> -
Moves the clip at
fromIndextotoIndex. 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
clipIndexfrom the timeline. -
replaceClip(
int clipIndex, TimelineClip clip) → Future< void> -
Replaces the clip at
clipIndexwithclip. -
seekTo(
Duration position) → Future< void> -
Seeks to
positionrelative to the start of the full timeline. -
seekToClip(
int clipIndex) → Future< void> -
Seeks to the beginning of the clip at
clipIndexin the loaded timeline. -
setAudioTrack(
AudioTrack track) → Future< void> -
Overlays an external
trackon 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
clipIndextospeed. -
setVolume(
double volume) → Future< void> -
Sets the playback
volumein the range[0.0, 1.0]. -
splitClip(
int clipIndex, Duration atLocalPosition) → Future< void> -
Splits the clip at
clipIndexatatLocalPositionfrom 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