Create a video player UI object
pos Vector2size Vector2src stringVideo file path or URL
autoplay boolean optional, default falseStart playing immediately?
loop boolean optional, default falseLoop the video?
volume number optional, default 1Volume percent scaled by global volume (0-1)
// Create a video player UI object, in the middle of the canvas
const video = new UIVideo(vec2(), vec2(320, 240), 'video.mp4', true);
video.play();
Clean up video on destroy
Get current time in seconds
- Returns
Current playback time
Get the native video dimensions
- Returns
Video dimensions (may be 0,0 if metadata not loaded)
Check if video has ended playing
Check if video is currently loading
Check if video is currently paused
Check if video is currently playing
Pause the video, it stays paused when a hidden page shows again
Play or resume the video; on a page hidden now it waits, as one paused by the page does, and plays when the
page shows
- Returns
Resolves true once playback starts, false if the browser refused it or it waits
Render video to UI canvas
Stop and reset the video, it stays stopped when a hidden page shows again