Skip to main content
The Helios class is the core engine that manages animation state, timeline synchronization, and media playback.

Constructor

HeliosOptions<TInputProps>
required
Configuration options for the Helios instance

Signals

Helios exposes reactive signals that can be subscribed to for updates.

currentFrame

Signal for the current frame number.

currentTime

Signal for the current time in seconds.

isPlaying

Signal for the playback state.

loop

Signal for the loop state.

inputProps

Signal for the input properties.

playbackRate

Signal for the playback rate.

volume

Signal for the audio volume.

muted

Signal for the audio muted state.

audioTracks

Signal for per-track audio state.

availableAudioTracks

Signal for discovered audio tracks.

captions

Signal for all caption cues.

activeCaptions

Signal for currently active caption cues.

activeClips

Signal for currently active timeline clips.

markers

Signal for timeline markers.

playbackRange

Signal for the playback range.

width

Signal for the canvas width.

height

Signal for the canvas height.

duration

Signal for the composition duration in seconds.

fps

Signal for the frame rate.

Properties

isVirtualTimeBound

Returns true if the instance has successfully established a reactive, synchronous binding to the environment’s virtual time source.

Methods

play()

Starts playback.

pause()

Pauses playback.

seek()

Seeks to a specific frame.
number
required
Frame number to seek to (will be clamped to valid range)

seekToTime()

Seeks to a specific time in seconds.
number
required
Time in seconds to seek to

seekToMarker()

Seeks to a marker by ID.
string
required
Marker ID to seek to

setDuration()

Updates the composition duration.
number
required
New duration in seconds (must be non-negative)

setFps()

Updates the frame rate.
number
required
New frame rate (must be greater than 0)

setSize()

Updates the canvas dimensions.
number
required
New width in pixels
number
required
New height in pixels

setLoop()

Updates the loop state.
boolean
required
Whether to loop playback

setInputProps()

Updates the input properties.
TInputProps
required
New input properties (will be validated against schema)

setPlaybackRate()

Updates the playback rate.
number
required
Playback speed multiplier

setAudioVolume()

Updates the master audio volume.
number
required
Volume level (0.0 to 1.0, will be clamped)

setAudioMuted()

Updates the master audio mute state.
boolean
required
Whether audio should be muted

setAudioTrackVolume()

Updates the volume for a specific audio track.
string
required
ID of the audio track
number
required
Volume level (0.0 to 1.0, will be clamped)

setAudioTrackMuted()

Updates the mute state for a specific audio track.
string
required
ID of the audio track
boolean
required
Whether the track should be muted

setAvailableAudioTracks()

Manually sets available audio tracks (useful for headless environments).
AudioTrackMetadata[]
required
Array of audio track metadata

setCaptions()

Updates the captions.
string | CaptionCue[]
required
SRT/WebVTT string or array of caption cues

setTimeline()

Updates the timeline.
HeliosTimeline
required
Timeline structure with tracks and clips

setMarkers()

Replaces all markers.
Marker[]
required
Array of markers (will be validated and sorted)

addMarker()

Adds a single marker.
Marker
required
Marker to add (must have unique ID)

removeMarker()

Removes a marker by ID.
string
required
ID of the marker to remove

setPlaybackRange()

Sets a playback range.
number
required
Starting frame (must be >= 0)
number
required
Ending frame (must be > startFrame)

clearPlaybackRange()

Clears the playback range.

getState()

Gets the current state snapshot.
HeliosState<TInputProps>
Current state object containing all signal values

subscribe()

Subscribes to state changes.
(state: HeliosState<TInputProps>) => void
required
Function called on each state change
() => void
Function to unsubscribe from state changes

unsubscribe()

Unsubscribes a specific callback.
HeliosSubscriber<TInputProps>
required
The callback function to unsubscribe

waitUntilStable()

Waits for all asynchronous operations to complete.
Promise<void>
Resolves when the composition is stable (images loaded, media seeked, etc.)

registerStabilityCheck()

Registers a custom stability check.
() => Promise<void>
required
Async function that resolves when stable
() => void
Function to unregister the stability check

getAudioContext()

Gets the shared AudioContext.
Promise<unknown>
The AudioContext instance or null if not available

getAudioSourceNode()

Gets the MediaElementAudioSourceNode for a track.
string
required
ID of the audio track
Promise<unknown>
The audio source node or null if not available

bindTo()

Binds this instance to another Helios instance.
Helios<any>
required
The master Helios instance to sync with

unbind()

Unbinds from any master instance or document timeline.

bindToDocumentTimeline()

Binds to the document.timeline for external synchronization.

unbindFromDocumentTimeline()

Unbinds from the document.timeline.

dispose()

Cleans up resources.

Static methods

Helios.diagnose()

Runs diagnostics on browser capabilities.
DiagnosticReport
Diagnostic report containing:
  • waapi: Web Animations API support
  • webCodecs: WebCodecs API support
  • offscreenCanvas: OffscreenCanvas support
  • webgl: WebGL support
  • webgl2: WebGL2 support
  • webAudio: Web Audio API support
  • colorGamut: Color gamut support
  • videoCodecs: Supported video codecs
  • audioCodecs: Supported audio codecs
  • videoDecoders: Supported video decoders
  • audioDecoders: Supported audio decoders
  • userAgent: User agent string

Example