video
The video namespace — 28 functions.
globals/video/create
video.create(url: string, options: VideoOptions?) -> string
Create a video player. Returns a texture handle (e.g.
"video_0") usable directly in material.setTexture() — its
frames sample like any other texture.
Parameters
urlstring— URL or asset path to an MP4 video file.optionsVideoOptions(optional) — Playback options:loop(default false),autoplay(default false),rate(default 1.0).
Returns string — Texture handle.
local tex = video.create("http://example.com/clip.mp4", { autoplay = true })
globals/video/destroy
video.destroy(handle: string) -> boolean
Destroy a video player and free the render target and all resources.
Parameters
handlestring— Video handle fromvideo.create.
Returns boolean — True if the player was found and destroyed.
video.destroy(rt)
globals/video/getInfo
video.getInfo(handle: string) -> VideoInfo?
Get video information and current playback state.
Parameters
handlestring— Video handle.
Returns VideoInfo? — { width, height, duration, currentTime, state, rate, loop } or nil if the handle is invalid.
local i = video.getInfo(rt); print(i.currentTime, "/", i.duration)
globals/video/pause
video.pause(handle: string) -> boolean
Pause video playback. Can be resumed with video.play.
Parameters
handlestring— Video handle.
Returns boolean — True if the video was playing and is now paused.
video.pause(rt)
globals/video/play
video.play(handle: string) -> boolean
Start or resume video playback.
Parameters
handlestring— Video handle fromvideo.create.
Returns boolean — True if the command was accepted.
video.play(rt)
globals/video/seek
video.seek(handle: string, time: number) -> boolean
Seek to a specific time (seconds) in the video.
Parameters
handlestring— Video handle.timenumber— Target time in seconds.
Returns boolean — True if the seek was performed.
video.seek(rt, 30.5)
globals/video/setLoop
video.setLoop(handle: string, loop: boolean) -> boolean
Enable or disable looping.
Parameters
handlestring— Video handle.loopboolean— Whether to loop playback.
Returns boolean — True if the setting was applied.
video.setLoop(rt, true)
globals/video/setRate
video.setRate(handle: string, rate: number) -> boolean
Set the playback speed multiplier. 1.0 = normal, 2.0 = double speed, 0.5 = half speed.
Parameters
handlestring— Video handle.ratenumber— Playback rate.
Returns boolean — True if the rate was set.
video.setRate(rt, 2.0)
globals/video/stop
video.stop(handle: string) -> boolean
Stop video playback and reset to the beginning.
Parameters
handlestring— Video handle.
Returns boolean — True if the command was accepted.
video.stop(rt)
modules/video/README
require("@builtin/modules/api/engine/video") -- video (also available as global 'video')
Video playback — create / play / pause / seek / setRate / setLoop / destroy on render-target-backed video players. Public Luau surface over the __video Internal FFI namespace.
Usage: local video = require("@builtin/modules/api/engine/video") Also available as global: video
modules/video/create
create(url: string, options: VideoOptions?): string
Create a video player. Returns a texture handle (e.g.
"video_0") usable directly in material.setTexture() — its
frames sample like any other texture.
Parameters
urlstring— URL or asset path to an MP4 video file.optionsVideoOptions?(optional) — Playback options:loop(default false),autoplay(default false),rate(default 1.0).
local tex = video.create("http://example.com/clip.mp4", { autoplay = true })
modules/video/destroy
destroy(handle: string): boolean
Destroy a video player and free the render target and all resources.
Parameters
handlestring— Video handle fromvideo.create.
video.destroy(rt)
modules/video/getInfo
getInfo(handle: string): VideoInfo?
Get video information and current playback state.
Parameters
handlestring— Video handle.
local i = video.getInfo(rt); print(i.currentTime, "/", i.duration)
modules/video/pause
pause(handle: string): boolean
Pause video playback. Can be resumed with video.play.
Parameters
handlestring— Video handle.
video.pause(rt)
modules/video/play
play(handle: string): boolean
Start or resume video playback.
Parameters
handlestring— Video handle fromvideo.create.
video.play(rt)
modules/video/seek
seek(handle: string, time: number): boolean
Seek to a specific time (seconds) in the video.
Parameters
handlestring— Video handle.timenumber— Target time in seconds.
video.seek(rt, 30.5)
modules/video/setLoop
setLoop(handle: string, loop: boolean): boolean
Enable or disable looping.
Parameters
handlestring— Video handle.loopboolean— Whether to loop playback.
video.setLoop(rt, true)
modules/video/setRate
setRate(handle: string, rate: number): boolean
Set the playback speed multiplier. 1.0 = normal, 2.0 = double speed, 0.5 = half speed.
Parameters
handlestring— Video handle.ratenumber— Playback rate.
video.setRate(rt, 2.0)
modules/video/stop
stop(handle: string): boolean
Stop video playback and reset to the beginning.
Parameters
handlestring— Video handle.
video.stop(rt)
typed/builtin//modules/api/engine/video/video/create
video.create(url: string, options: VideoOptions?) -> string
Create a video player. Returns a texture handle (e.g.
"video_0") usable directly in material.setTexture() — its
frames sample like any other texture.
typed/builtin//modules/api/engine/video/video/destroy
video.destroy(handle: string) -> boolean
Destroy a video player and free the render target and all resources.
Parameters
handlestring— Video handle fromvideo.create.
Returns boolean — True if the player was found and destroyed.
video.destroy(rt)
typed/builtin//modules/api/engine/video/video/getInfo
video.getInfo(handle: string) -> VideoInfo?
Get video information and current playback state.
Parameters
handlestring— Video handle.
Returns VideoInfo? — { width, height, duration, currentTime, state, rate, loop } or nil if the handle is invalid.
local i = video.getInfo(rt); print(i.currentTime, "/", i.duration)
typed/builtin//modules/api/engine/video/video/pause
video.pause(handle: string) -> boolean
Pause video playback. Can be resumed with video.play.
Parameters
handlestring— Video handle.
Returns boolean — True if the video was playing and is now paused.
video.pause(rt)
typed/builtin//modules/api/engine/video/video/play
video.play(handle: string) -> boolean
Start or resume video playback.
typed/builtin//modules/api/engine/video/video/seek
video.seek(handle: string, time: number) -> boolean
Seek to a specific time (seconds) in the video.
Parameters
handlestring— Video handle.timenumber— Target time in seconds.
Returns boolean — True if the seek was performed.
video.seek(rt, 30.5)
typed/builtin//modules/api/engine/video/video/setLoop
video.setLoop(handle: string, loop: boolean) -> boolean
Enable or disable looping.
Parameters
handlestring— Video handle.loopboolean— Whether to loop playback.
Returns boolean — True if the setting was applied.
video.setLoop(rt, true)
typed/builtin//modules/api/engine/video/video/setRate
video.setRate(handle: string, rate: number) -> boolean
Set the playback speed multiplier. 1.0 = normal, 2.0 = double speed, 0.5 = half speed.
Parameters
handlestring— Video handle.ratenumber— Playback rate.
Returns boolean — True if the rate was set.
video.setRate(rt, 2.0)
typed/builtin//modules/api/engine/video/video/stop
video.stop(handle: string) -> boolean
Stop video playback and reset to the beginning.
Parameters
handlestring— Video handle.
Returns boolean — True if the command was accepted.
video.stop(rt)