Skip to content

@relu-interactives/spatial-ecs


@relu-interactives/spatial-ecs / index / VideoSystem

Class: VideoSystem ​

Defined in: systems/VideoSystem.ts:70

Reconciles VideoComponent state with the underlying HTML video element and THREE.js mesh/material each frame.

Playback — drives play(), pause(), and stop (pause + seek to 0) on the HTML <video> element based on the isPlaying / isPaused flags set by VideoComponent.play(), .pause(), and .stop().

Option sync — detects changes to loop, volume, width, height, and green-screen keying (backgroundColor, similarity, smoothness, spill) and applies them live without a scene reload. The keying material belongs to the world's render backend (GLSL on WebGL, TSL with webgpuBackend), which updates it.

Pausing — world.pause() holds the videos that are playing and world.resume() continues those, leaving anything already stopped alone. A video started during the pause plays normally, so this system keeps ticking.

Only active in preview mode (isEditor: true makes every update a no-op so the editor is unaffected).

Implements ​

Constructors ​

Constructor ​

ts
new VideoSystem(__namedParameters?): VideoSystem;

Defined in: systems/VideoSystem.ts:82

Parameters ​

ParameterType
__namedParameters{ isEditor?: boolean; }
__namedParameters.isEditor?boolean

Returns ​

VideoSystem

Properties ​

PropertyModifierTypeDefault valueDescriptionDefined in
runsWhilePausedreadonlytruetrueKeep ticking while the world is paused. Leave it unset for anything that moves the game on: such a system stops at world.pause() and picks up where it was at world.resume().systems/VideoSystem.ts:71

Methods ​

onWorldPause() ​

ts
onWorldPause(world, options): void;

Defined in: systems/VideoSystem.ts:90

Hold what is playing. A video that is wanted but not rolling yet counts, or the retry below would start it behind the menu.

Parameters ​

ParameterType
worldWorld
optionsPauseOptions

Returns ​

void

Implementation of ​

EcsSystem.onWorldPause


onWorldResume() ​

ts
onWorldResume(world): void;

Defined in: systems/VideoSystem.ts:103

Continue what the pause held, and only that.

Parameters ​

ParameterType
worldWorld

Returns ​

void

Implementation of ​

EcsSystem.onWorldResume


update() ​

ts
update(world, _deltaTime): void;

Defined in: systems/VideoSystem.ts:120

Parameters ​

ParameterType
worldWorld
_deltaTimenumber

Returns ​

void

Implementation of ​

EcsSystem.update


dispose() ​

ts
dispose(_world): void;

Defined in: systems/VideoSystem.ts:294

Parameters ​

ParameterType
_worldWorld

Returns ​

void

Implementation of ​

EcsSystem.dispose