Skip to content

Video

A textured plane playing a video file, with optional chroma-keying (green-screen) so you can composite the video over the live scene.

ts
import { Behaviour } from "@relu-interactives/spatial-ecs";

export default class SpawnVideo extends Behaviour {
  init() {
    const objects = this.world.getObjectManagementSystem();
    objects?.requestCreate("video", {
      name: "Promo",
      path: "/assets/videos/promo.mp4",
      transform: { position: { x: 0, y: 1.5, z: -3 } },
      options: {
        autoplay: true,
        loop: true,
        volume: 0.8,
        width: 1.6,
        height: 0.9,
      },
    });
  }
}

Payload

FieldTypeDefaultDescription
namestring"Video"Display name.
pathstring""URL or local-asset path to the video file.
transformTransformDataidentityPosition / rotation / scale.
parentIdEntityId | nullnullOptional parent entity.

options

OptionTypeDefaultDescription
autoplaybooleanfalseStart playback as soon as the video is ready.
loopbooleantrueLoop playback.
volumenumber (0–1)1Playback volume.
widthnumber1Plane width in world units.
heightnumber1Plane height in world units.
isGreenScreenbooleanfalseEnable chroma-key shader.
backgroundColorstring"#00ff00"Color to key out (CSS hex).
similaritynumber (0.01–1)0.4Chroma similarity threshold.
smoothnessnumber (0.001–1)0.08Edge smoothing.
spillnumber (0–1)0.12Spill-suppression strength.

Components attached

Transform, Object3DRef, Name, EntityType, ParentId, Selectable, Video.