Skip to content

useVideoConfig

Returns the configuration of the current composition.

Usage

jsx
import { useVideoConfig } from 'framely';

function MyComponent() {
  const { fps, width, height, durationInFrames } = useVideoConfig();

  return (
    <div>
      {width}x{height} @ {fps}fps — {durationInFrames} frames
    </div>
  );
}

Return Value

PropertyTypeDescription
fpsnumberFrames per second
widthnumberVideo width in pixels
heightnumberVideo height in pixels
durationInFramesnumberTotal number of frames

Example: Responsive Sizing

jsx
function ResponsiveText() {
  const { width } = useVideoConfig();
  const fontSize = width / 20;

  return (
    <h1 style={{ fontSize }}>
      Scales with video size
    </h1>
  );
}

Released under the MIT License.