@relu-interactives/spatial-ecs
@relu-interactives/spatial-ecs / components / VideoComponent
Class: VideoComponent
Defined in: components/Video.ts:37
Plays a video file as a texture on a quad. Supports green-screen keying (isGreenScreen, backgroundColor, similarity, smoothness, spill). The video element, texture, and material are runtime-only and re-created when the project loads.
Extends
Constructors
Constructor
new VideoComponent(path, options?): VideoComponent;Defined in: components/Video.ts:90
Parameters
| Parameter | Type |
|---|---|
path | string |
options | Partial<typeof DEFAULT_VIDEO_OPTIONS> |
Returns
VideoComponent
Overrides
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
path | string | Source URL or localasset:// path of the video file. | components/Video.ts:39 |
options | { autoplay: boolean; loop: boolean; volume: number; width: number; height: number; isGreenScreen: boolean; backgroundColor: string; similarity: number; smoothness: number; spill: number; positional: boolean; refDistance: number; distanceModel: string; rolloffFactor: number; } | Playback + green-screen options. | Field |
options.autoplay | boolean | - | components/Video.ts:9 |
options.loop | boolean | - | components/Video.ts:10 |
options.volume | number | - | components/Video.ts:11 |
options.width | number | - | components/Video.ts:12 |
options.height | number | - | components/Video.ts:13 |
options.isGreenScreen | boolean | - | components/Video.ts:14 |
options.backgroundColor | string | - | components/Video.ts:15 |
options.similarity | number | - | components/Video.ts:16 |
options.smoothness | number | - | components/Video.ts:17 |
options.spill | number | - | components/Video.ts:18 |
options.positional | boolean | When true, the video's audio stream is spatialized using the entity's transform. | components/Video.ts:20 |
options.refDistance | number | Distance at which volume is unattenuated (positional only). | components/Video.ts:22 |
options.distanceModel | string | WebAudio distance model (linear, inverse, exponential). Positional only. | components/Video.ts:24 |
options.rolloffFactor | number | How quickly volume falls off past refDistance. Positional only. | components/Video.ts:26 |
object | Object3D<Object3DEventMap> | null | Live three.js object hosting the video quad. null until built. | components/Video.ts:62 |
videoElement | HTMLVideoElement | null | Underlying HTML video element. null until built. | components/Video.ts:64 |
texture | VideoTexture | null | Three.js texture sampling the video element. null until built. | components/Video.ts:66 |
material | Material | null | Material rendering the video texture (with green-screen shader when enabled). null until built. | components/Video.ts:68 |
audioNode | Audio<GainNode> | PositionalAudio | null | THREE.js audio node connected to this video's audio stream via setMediaElementSource. Present only in preview when the camera listener is available. null in editor mode. | components/Video.ts:74 |
isPlaying | boolean | Whether the video should be playing. Managed by VideoSystem in preview. Non-enumerable — not persisted to snapshots or save data. Set via play / stop. | components/Video.ts:81 |
isPaused | boolean | Whether the video is paused mid-playback (position is preserved). Non-enumerable — not persisted to snapshots or save data. Set via pause / play / stop. | components/Video.ts:88 |
Methods
play()
play(): void;Defined in: components/Video.ts:127
Signals VideoSystem to start (or resume) playback. Has no direct effect in the editor — VideoSystem drives the actual HTML video element call in preview.
Returns
void
pause()
pause(): void;Defined in: components/Video.ts:137
Signals VideoSystem to pause playback, preserving the current position. Calling play afterwards resumes from where it paused. No-op if not currently playing.
Returns
void
stop()
stop(): void;Defined in: components/Video.ts:146
Signals VideoSystem to stop playback and reset the playback position.
Returns
void

