@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 ​
new VideoSystem(__namedParameters?): VideoSystem;Defined in: systems/VideoSystem.ts:82
Parameters ​
| Parameter | Type |
|---|---|
__namedParameters | { isEditor?: boolean; } |
__namedParameters.isEditor? | boolean |
Returns ​
VideoSystem
Properties ​
| Property | Modifier | Type | Default value | Description | Defined in |
|---|---|---|---|---|---|
runsWhilePaused | readonly | true | true | Keep 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() ​
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 ​
| Parameter | Type |
|---|---|
world | World |
options | PauseOptions |
Returns ​
void
Implementation of ​
onWorldResume() ​
onWorldResume(world): void;Defined in: systems/VideoSystem.ts:103
Continue what the pause held, and only that.
Parameters ​
| Parameter | Type |
|---|---|
world | World |
Returns ​
void
Implementation of ​
update() ​
update(world, _deltaTime): void;Defined in: systems/VideoSystem.ts:120
Parameters ​
| Parameter | Type |
|---|---|
world | World |
_deltaTime | number |
Returns ​
void
Implementation of ​
dispose() ​
dispose(_world): void;Defined in: systems/VideoSystem.ts:294
Parameters ​
| Parameter | Type |
|---|---|
_world | World |
Returns ​
void

