🚧 Glyx is pre-release software. APIs may change before v1.0. Get started →
Documentation
APIs & Bindings
video

video

Video playback for local files and URLs, decoded by the glyx-media library (ffmpeg-backed) on a dedicated thread and composited like any other GPU image. Use the <Video> component for declarative playback, or the video API for manual control.

Requires the video capability:

glyx.config.json
{ "capabilities": { "video": true } }

Video decoding uses the glyx-media DLL, downloaded once via glyx runtime build. If it isn't present, calls reject with GlyxMediaNotAvailable instead of crashing.

Quick start

import { Video } from '@glyx-dev/react'
 
<Video
  src="./assets/intro.mp4"
  autoPlay
  loop
  muted
  style={{ width: 800, height: 450, borderRadius: 8 }}
/>

<Video> props

PropTypeDescription
srcstringFile path or URL
autoPlaybooleanStart playback on mount
loopbooleanRestart when playback ends
mutedbooleanOpen with volume 0
styleViewStyleLayout/style
refRefExposes the playback handle for the video API

API

video.open(url, callbacks?)

Opens a video and starts decoding. Returns Promise<number> — the handle for all other calls. Optional callbacks:

const handle = await video.open('./movie.mp4', {
  onMetadata:   ({ width, height, fps, durationSecs }) => {},
  onTimeUpdate: (seconds) => {},
  onEnded:      () => {},
  onError:      (message) => {},
})

video.play(handle) / video.pause(handle)

Resume/pause the decode and audio threads.

video.seek(handle, seconds)

Seek to an absolute position. Values below 0 are clamped.

video.setVolume(handle, volume)

0.0 = mute, 1.0 = normal, up to 2.0.

video.close(handle)

Stops playback and releases the decoder, audio sink, and GPU frames.

See also

  • camera — live camera capture
  • audio — audio-only playback