Skip to main content
This example demonstrates how to build a Helios composition using Vue 3. It showcases Vue-specific patterns including composables for frame synchronization and reactive template bindings.

Setup

Install Helios core and Vue dependencies:

Implementation

Composable for frame synchronization

Create a composable to subscribe to Helios frame updates:
The composable uses Vue’s ref to create a reactive frame reference and onUnmounted to handle cleanup when the component is destroyed.

Main component

Build your composition using Vue’s template syntax and the useVideoFrame composable:

Key Vue patterns

Composable-based state management

The useVideoFrame composable encapsulates Helios subscription logic using Vue’s Composition API. It returns a reactive ref that automatically triggers re-renders when the frame changes.

Dynamic style bindings

Use Vue’s :style binding to apply dynamic animations. Calculations happen in the template, keeping the component concise and reactive.

Script setup syntax

The <script setup> syntax provides a clean, TypeScript-friendly way to define component logic without boilerplate. Variables and imports are automatically available in the template.

Scoped styles

Scoped styles ensure CSS only applies to this component, preventing style leakage while maintaining clean separation between logic and presentation.

Usage

Run the development server:
The composition will render with reactive frame updates. The Helios instance is exposed on window.helios for debugging and player control.