<helios-player> element and the Helios composition. They handle communication, state synchronization, and frame capture.
Controller types
There are two controller implementations:- DirectController - Used when the composition is same-origin and accessible via direct JavaScript reference
- BridgeController - Used when the composition is cross-origin and requires message-based communication
HeliosController interface
Both controllers implement theHeliosController interface:
Playback control
play()
Starts or resumes playback.pause()
Pauses playback.seek(frame)
Seeks to a specific frame.frame(number) - Target frame number
Promise<void> - Resolves when seek completes
Audio control
setAudioVolume(volume)
Sets the master audio volume.volume(number) - Volume level from 0.0 to 1.0
setAudioMuted(muted)
Mutes or unmutes all audio.muted(boolean) - Whether audio should be muted
setAudioTrackVolume(trackId, volume)
Sets the volume for a specific audio track.trackId(string) - Audio track identifiervolume(number) - Volume level from 0.0 to 1.0
setAudioTrackMuted(trackId, muted)
Mutes or unmutes a specific audio track.trackId(string) - Audio track identifiermuted(boolean) - Whether track should be muted
Playback configuration
setLoop(loop)
Enables or disables looping playback.loop(boolean) - Whether playback should loop
setPlaybackRate(rate)
Sets the playback speed.rate(number) - Speed multiplier (1.0 = normal)
setPlaybackRange(startFrame, endFrame)
Sets a custom playback range.startFrame(number) - First frame of rangeendFrame(number) - Last frame of range (exclusive)
clearPlaybackRange()
Clears the playback range, restoring full duration playback.Captions
setCaptions(captions)
Sets captions from VTT string or cue array.captions(string | CaptionCue[]) - VTT string or caption cue array
Composition properties
setInputProps(props)
Sets input properties for the composition schema.props(Record) - Property key-value pairs
setDuration(seconds)
Overrides the composition duration.seconds(number) - Duration in seconds
setFps(fps)
Overrides the composition frame rate.fps(number) - Frames per second
setSize(width, height)
Sets the composition dimensions.width(number) - Width in pixelsheight(number) - Height in pixels
setMarkers(markers)
Sets timeline markers.markers(Marker[]) - Array of marker objects
State and events
subscribe(callback)
Subscribes to state changes.callback((state: any) => void) - Called on each state update
() => void - Unsubscribe function
State object properties:
currentFrame(number) - Current frameisPlaying(boolean) - Playing stateduration(number) - Duration in secondsfps(number) - Frame ratevolume(number) - Master volumemuted(boolean) - Muted stateplaybackRate(number) - Playback speedwidth(number) - Composition widthheight(number) - Composition heightavailableAudioTracks(array) - Available audio tracksaudioTracks(array) - Active audio tracksactiveCaptions(CaptionCue[]) - Currently visible captionsplaybackRange([number, number] | null) - Active playback range
onError(callback)
Subscribes to error events.callback((error: any) => void) - Called when errors occur
() => void - Unsubscribe function
getState()
Returns the current state synchronously.subscribe() for properties)
Frame capture
captureFrame(frame, options)
Captures a single frame as a VideoFrame.frame(number) - Frame number to captureoptions(object, optional)selector(string) - CSS selector for canvas (default:'canvas')mode(‘canvas’ | ‘dom’) - Capture modewidth(number) - Output width (scales if different)height(number) - Output height (scales if different)
Promise<{ frame: VideoFrame, captions: CaptionCue[] } | null>
Audio tracks
getAudioTracks()
Retrieves all audio assets from the composition.Promise<AudioAsset[]>
AudioAsset properties:
id(string) - Track identifierbuffer(AudioBuffer) - Decoded audio dataelement(HTMLAudioElement) - Source audio element
Schema and diagnostics
getSchema()
Retrieves the composition schema definition.Promise<HeliosSchema | undefined>
diagnose()
Generates a diagnostic report for debugging.Promise<DiagnosticReport>
Audio metering
startAudioMetering()
Begins real-time audio level monitoring.stopAudioMetering()
Stops audio level monitoring.onAudioMetering(callback)
Subscribes to audio level updates.callback((levels: AudioLevels) => void) - Called with audio levels
() => void - Unsubscribe function
AudioLevels properties:
peak(number) - Peak level (0.0 to 1.0)rms(number) - RMS level (0.0 to 1.0)
Cleanup
dispose()
Cleans up resources and removes listeners.DirectController
Used for same-origin compositions with direct access.Constructor
instance(Helios) - Helios instance from the compositioniframe(HTMLIFrameElement, optional) - Iframe element containing the composition
Features
- Direct method calls on Helios instance (no message passing overhead)
- Synchronous state access
- Built-in audio fading for smooth playback transitions
- Real-time audio metering support
BridgeController
Used for cross-origin compositions using postMessage.Constructor
iframeWindow(Window) - Window object of the composition iframeinitialState(object, optional) - Initial state object
Features
- Message-based communication for cross-origin safety
- Automatic message filtering by source
- Promise-based async operations with timeouts
- State caching to minimize message overhead
Bridge setup
The composition must callconnectToParent() to enable bridge communication: