Skip to content

@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

ts
new VideoComponent(path, options?): VideoComponent;

Defined in: components/Video.ts:90

Parameters

ParameterType
pathstring
optionsPartial<typeof DEFAULT_VIDEO_OPTIONS>

Returns

VideoComponent

Overrides

Component.constructor

Properties

PropertyTypeDescriptionDefined in
pathstringSource 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.autoplayboolean-components/Video.ts:9
options.loopboolean-components/Video.ts:10
options.volumenumber-components/Video.ts:11
options.widthnumber-components/Video.ts:12
options.heightnumber-components/Video.ts:13
options.isGreenScreenboolean-components/Video.ts:14
options.backgroundColorstring-components/Video.ts:15
options.similaritynumber-components/Video.ts:16
options.smoothnessnumber-components/Video.ts:17
options.spillnumber-components/Video.ts:18
options.positionalbooleanWhen true, the video's audio stream is spatialized using the entity's transform.components/Video.ts:20
options.refDistancenumberDistance at which volume is unattenuated (positional only).components/Video.ts:22
options.distanceModelstringWebAudio distance model (linear, inverse, exponential). Positional only.components/Video.ts:24
options.rolloffFactornumberHow quickly volume falls off past refDistance. Positional only.components/Video.ts:26
objectObject3D<Object3DEventMap> | nullLive three.js object hosting the video quad. null until built.components/Video.ts:62
videoElementHTMLVideoElement | nullUnderlying HTML video element. null until built.components/Video.ts:64
textureVideoTexture | nullThree.js texture sampling the video element. null until built.components/Video.ts:66
materialMaterial | nullMaterial rendering the video texture (with green-screen shader when enabled). null until built.components/Video.ts:68
audioNodeAudio<GainNode> | PositionalAudio | nullTHREE.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
isPlayingbooleanWhether 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
isPausedbooleanWhether 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()

ts
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()

ts
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()

ts
stop(): void;

Defined in: components/Video.ts:146

Signals VideoSystem to stop playback and reset the playback position.

Returns

void