LifeLua 21-08-2025
Documentation for LifeLua, a Lua interpreter for the PS Vita
Loading...
Searching...
No Matches
video

Playing videos (uses the system's AvPlayer) More...

Detailed Description

Plays .MP4 videos (H.264 video with AAC audio). Only one video can be loaded at a time, so these functions don't take a video object; they all control the currently loaded video. All the functions except video.load() raise an error if no video is loaded.

video.load("ux0:data/myapp/intro.mp4", true) -- load and start playing
while video.active() do
controls.update()
video.output() -- draw the current frame
if controls.pressed(SCE_CTRL_CROSS) then video.stop() end
draw.swapbuffers()
end
video.close()
SceCtrlButtons SCE_CTRL_CROSS
Cross (✕) button.
Definition lj_controls.h:33
Note
Loading a video stops any audio playing with the audio library.

Functions

nil video.load (string path, boolean autostart, boolean loop)
 
nil video.output ()
 
boolean video.active ()
 
nil video.pause ()
 
nil video.resume ()
 
number video.elapsed ()
 
nil video.seek (number seconds)
 
nil video.stop ()
 
nil video.close ()
 

Function Documentation

◆ video.active()

boolean video.active ( )

Checks if the video is playing

Returns
true while the video is playing, false once it has ended or was stopped

◆ video.close()

nil video.close ( )

Closes the video and frees its memory, so another one can be loaded

◆ video.elapsed()

number video.elapsed ( )

Gets how far the video has played

Returns
The current position in milliseconds

◆ video.load()

nil video.load ( string path,
boolean autostart,
boolean loop )

Loads a video. Does nothing if a video is already loaded (close it first with video.close()).

Parameters
pathPath to the video file
autostarttrue to start playing right away (optional, default: false)
looptrue to start over every time it ends (optional, default: false)

◆ video.output()

nil video.output ( )

Draws the current video frame, scaled to fill the screen's height and centered. Call it every frame, before draw.swapbuffers().

◆ video.pause()

nil video.pause ( )

Pauses the video

◆ video.resume()

nil video.resume ( )

Resumes a paused video

◆ video.seek()

nil video.seek ( number seconds)

Jumps to a position in the video

Parameters
secondsPosition to jump to, in seconds from the start

◆ video.stop()

nil video.stop ( )

Stops the video. Call video.close() afterwards to free it.