The VideoRenderer component renders video content to the screen.
It supports features like video playback control, scaling, rotation, flipping, opacity, color masking and tinting.
Videos can be rendered with custom dimensions, positioned with offsets, and sliced to show specific regions.
The component provides control over looping, volume, time scaling, and can be assigned to specific render layers.
Videos can be paused, played, and stopped programmatically.

const videoRenderer = new VideoRenderer({
video: this.assetManager.getVideo("video.mp4"),
width: 1920,
height: 1080,
offset: new Vector2(0, 0),
flipHorizontally: false,
flipVertically: false,
rotation: 0,
opacity: 1,
maskColor: "#FF0000",
maskColorMix: 0,
tintColor: "#00FF00",
layer: "Default",
slice: {x: 0, y: 0, width: 1920, height: 1080},
volume: 1,
loop: false,
fixedToTimeScale: false
});
videoRenderer.play();

Constructors

Properties

_currentVideoSrc: string = undefined
_playPromisePendind: boolean = false
action: "pause" | "play" | "stop"

The action to perform with the video

fixedToTimeScale: boolean = false

TRUE If the playback rate is fixed to the TimeManager time scale, default FALSE

flipHorizontally: boolean

Flip the video horizontally

flipVertically: boolean

Flip the video vertically

height: number

Overwrite the original video height

layer: string = defaultRenderLayer

The render layer

loop: boolean = false

TRUE to play the video in loop

maskColor: string

Define a mask color for the video

maskColorMix: number

Define the opacity of the mask color between 1 and 0

offset: Vector2 = ...

X-axis and Y-axis offset

opacity: number

Change the opacity between 1 and 0

playing: boolean = false

READONLY, TRUE if the video is playing

rotation: number = 0

Video rotation (degrees or radians)

slice?: Slice

Cut the video based on straight coordinates starting from the top left downward

tintColor: string

Define a color for tinting the video

video: string | HTMLVideoElement

The video element to render

volume: number = 1

The volume of the video (between 1 and 0)

width: number

Overwrite the original video width

Methods