raea/video

Footage and time-shifted sequences: Video, Sequence, Series, Loop and Freeze.

View as Markdown

<Video> shows a clip in step with the frame: the renderer decodes it natively and draws the frame the composition asks for, so scrubbing and rendering agree. Trim it with trimBefore and trimAfter, set its level with volume or gainDb, and frame a talking take on its face with framing="face". <Sequence> shifts time for what it holds, <Series> plays its children one after another, <Loop> repeats, and <Freeze> holds a frame.

TSX
import { staticFile } from "raea";
import { Series, Video } from "raea/video";

function Cut() {
  return (
    <Series>
      <Series.Sequence durationInFrames={90}>
        <Video src={staticFile("media/interview.mp4")} trimBefore={120} framing="face" />
      </Series.Sequence>
      <Series.Sequence durationInFrames={60}>
        <Video src={staticFile("media/broll.mp4")} muted />
      </Series.Sequence>
    </Series>
  );
}
TS
import { Freeze, Loop, Sequence, Series } from "raea/video"

raea/video exports 5 components, 7 types. Bevy's counterpart: raea's own; Bevy has no video crate. Source: sdk/raea/src/video.ts.

Components

Freeze

Shows its children as they are at frame, whatever the parent's frame.

PropTypeWhat it does
frame (required)numberthe frame its children see, whatever the parent's frame
childrenReactNodewhat's held

Loop

Repeats its children every durationInFrames frames, times times (forever by default).

PropTypeWhat it does
durationInFrames (required)numberthe length of one loop, in frames
timesnumberhow many times it plays (forever by default)
namestringits label in the timeline and the render manifest
layoutSequenceLayout"absolute-fill" (default) or "none", as a Sequence's
styleCSSPropertiesthe wrapping box's style
classNamestringthe wrapping box's classes
childrenReactNodewhat loops

Sequence

Shifts time by from and shows its children only for durationInFrames frames.

PropTypeWhat it does
fromnumberthe parent frame its frame 0 falls on (0)
durationInFramesnumberhow many frames it shows its children (forever by default)
namestringits label in the timeline and the render manifest (data-sequence)
layoutSequenceLayout"absolute-fill" (default) wraps the children in a full-size box; "none" adds no box
widthnumberthe width its children see, px (the parent's by default)
heightnumberthe height its children see, px (the parent's by default)
styleCSSPropertiesthe wrapping box's style
classNamestringthe wrapping box's classes
childrenReactNodewhat plays in it, at its own local time

Series

Plays its Series.Sequence children back to back, each shifted by its own offset.

PropTypeWhat it does
childrenReactNodethe Series.Sequence slots, played back to back

Video

A video clip in step with the frame; data-source-time is the source time (seconds) to show.

PropTypeWhat it does
framing"face"ours: frame the take on the largest face
punchInnumberours: multiplies the framing's scale (1.15 is the usual)

Also takes the props of MediaProps.

Types

FreezeProps

The props of Freeze, tabled there.

LoopProps

The props of Loop, tabled there.

MediaProps

FieldTypeWhat it is
src (required)stringthe file: staticFile("clip.mp4"), or a generated asset
startFromnumberthe media's own frame it starts playing from (0); the same as trimBefore
endAtnumberthe media's frame it stops before (exclusive): it holds the last frame, or loops; the same as trimAfter
trimBeforenumberframes of the media cut off its start (the newer name for startFrom)
trimAfternumberthe media's frame it's cut at (the newer name for endAt)
volumeVolumeProplinear gain, 1 being unity (0.5 is about -6 dB, 1.78 about +5 dB), or a function of the media's own frame
gainDbVolumePropours: the gain in decibels (or a function of the media's own frame returning it); wins over volume
fadeInnumberours: seconds to ramp the sound in from silence at its start (applied by the renderer at the audio's rate)
fadeOutnumberours: seconds to ramp the sound out to silence at its end
playbackRatenumberhow fast it plays (1): 2 is double speed
mutedbooleanplay no sound
loopbooleanstart again from startFrom when it reaches endAt
busstringthe bus it plays into: a named channel of the edit's Tone graph (music, sfx, voice, ambience, ui), so it takes that bus's volume, effects and ducking (raea/tone buses)
namestringthe entity's name, for picking, the inspector and world.*
classNamestringTailwind or CSS classes
styleCSSPropertiesinline style

SequenceLayout

TS
type SequenceLayout = "absolute-fill" | "none"

SequenceProps

The props of Sequence, tabled there.

SeriesSequenceProps

FieldTypeWhat it is
offsetnumberframes from the previous slot's end to this one's start (0); negative overlaps
heightnumberthe height its children see, px (the parent's by default)
styleCSSPropertiesthe wrapping box's style
childrenReactNodewhat plays in it, at its own local time
classNamestringthe wrapping box's classes
namestringits label in the timeline and the render manifest (data-sequence)
widthnumberthe width its children see, px (the parent's by default)
durationInFramesnumberhow many frames it shows its children (forever by default)

VideoProps

The props of Video, tabled there.