Skip to main content

VideoElement

VideoElement extends ScriptableObject and represents a video playback element within the scene. It supports common video playback controls, spatial activation, projection types, and network synchronization.

Playback Methods

play(): void

Starts or resumes video playback. If the video is already playing, this call has no effect.

Example:

videoElement.play();

pause(): void

Pauses video playback while preserving the current playback position.

Example:

videoElement.pause();

stop(): void

Stops video playback and resets the playback state.

Example:

videoElement.stop();

Properties

src: string

The source URL or file path of the video to be played.

Example:

videoElement.src = 'videos/sample.mp4';
console.log(videoElement.src);

controls: boolean

Enables playback controls UI (play, pause, seek) for user interaction.

Example:

videoElement.controls = true;

autoPlay: boolean

Automatically starts video playback when loaded.

Example:

videoElement.autoPlay = true;

loop: boolean

Enables continuous looping of the video.

Example:

videoElement.loop = true;

projection: string

Specifies the projection method for rendering the video (e.g., "equirectangular", "flat", or "360").

Example:

videoElement.projection = '360';

enableOnProximity: boolean

Enables video playback only when the viewer is within a specified proximity radius.

Example:

videoElement.enableOnProximity = true;

proximityRadius: number

The radius (in scene units) around the video element within which playback is enabled if proximity is enabled.

Example:

videoElement.proximityRadius = 5;

isInvisibleBackground: boolean

If true, renders the video with an invisible background, useful for overlay or chroma key effects.

Example:

videoElement.isInvisibleBackground = true;

billboard: boolean

When true, the video element will always face the camera, useful for UI or billboard effects.

Example:

videoElement.billboard = true;

href: string

Optional hyperlink URL that can be associated with the video element, typically for navigation or information.

Example:

videoElement.href = 'https://example.com';

networkable: boolean

Indicates if the video element’s state and playback should be synchronized over the network.

Example:

videoElement.networkable = true;