Lua Player Plus Vita
Documentation of lpp-vita
Video

Module that handles video files playback. More...

Enumerations

enum  PlayMode {
  NORMAL_MODE , FAST_FORWARD_2X_MODE , FAST_FORWARD_4X_MODE , FAST_FORWARD_8X_MODE ,
  FAST_FORWARD_16X_MODE , FAST_FORWARD_32X_MODE
}
 Play modes for video playback. More...
 

Functions

void Video::init (void)
 Init video sub-system. More...
 
void Video::term (void)
 Terminate video sub-system. More...
 
void Video::open (string filename, bool loop)
 Open an MP4 video file. More...
 
void Video::close (void)
 Close the current video playback. More...
 
int Video::getOutput (void)
 Get the current video frame as image. More...
 
void Video::pause (void)
 Pause current video playback. More...
 
void Video::resume (void)
 Resume current video playback. More...
 
bool Video::isPlaying (void)
 Get current playback state. More...
 
void Video::setVolume (int volume)
 Set internal volume for current video playback. More...
 
int Video::getVolume (void)
 Get internal volume for current video playback. More...
 
number Video::getTime (void)
 Get current time for current video playback. More...
 
void Video::jumpToTime (number time)
 Jump to a specific position for current video playback. More...
 
void Video::setPlayMode (PlayMode mode)
 Set play mode for current video playback. More...
 
void Video::openSubs (string fname)
 Open a subtitles file for current video playback. More...
 
void Video::closeSubs ()
 Close currently opened subtitles file. More...
 
string Video::getSubs (void)
 Get current available subtitles for the video playback. More...
 

Detailed Description

Module that handles video files playback.

Enumeration Type Documentation

◆ PlayMode

enum PlayMode

Play modes for video playback.

Enumerator
NORMAL_MODE 

Normal speed with audio.

FAST_FORWARD_2X_MODE 

Fast Forward at 2x speed without audio.

FAST_FORWARD_4X_MODE 

Fast Forward at 4x speed without audio.

FAST_FORWARD_8X_MODE 

Fast Forward at 8x speed without audio.

FAST_FORWARD_16X_MODE 

Fast Forward at 16x speed without audio.

FAST_FORWARD_32X_MODE 

Fast Forward at 32x speed without audio.

Function Documentation

◆ init()

void Video::init ( void  )

Init video sub-system.

Usage example:
Definition: luaVideo.cpp:19
void init(void)
Init video sub-system.

◆ term()

void Video::term ( void  )

Terminate video sub-system.

Usage example:
void term(void)
Terminate video sub-system.

◆ open()

void Video::open ( string  filename,
bool  loop 
)

Open an MP4 video file.

Usage example:
Video.open("app0:/video.mp4", false)
void open(string filename, bool loop)
Open an MP4 video file.
Parameters
filename- Filepath of the file to reproduce.
loop- If true, playback will loop (optional).

◆ close()

void Video::close ( void  )

Close the current video playback.

Usage example:
void close(void)
Close the current video playback.

◆ getOutput()

int Video::getOutput ( void  )

Get the current video frame as image.

Usage example:
frame = Video.getOutput()
if frame ~= 0 then
Graphics.drawImage(0, 0, frame)
end
Definition: luaGraphics.cpp:15
void drawImage(number x, number y, int img, int color)
Draw an image.
int getOutput(void)
Get the current video frame as image.
Returns
The current video frame, 0 if no frame is available.
Note
Returned image became invalid when Video.term is called.

◆ pause()

void Video::pause ( void  )

Pause current video playback.

Usage example:
void pause(void)
Pause current video playback.

◆ resume()

void Video::resume ( void  )

Resume current video playback.

Usage example:
void resume(void)
Resume current video playback.

◆ isPlaying()

bool Video::isPlaying ( void  )

Get current playback state.

Usage example:
if Video.isPlaying() then
end
bool isPlaying(void)
Get current playback state.
Returns
true if playing, false otherwise.

◆ setVolume()

void Video::setVolume ( int  volume)

Set internal volume for current video playback.

Usage example:
void setVolume(int volume)
Set internal volume for current video playback.
Parameters
volume- Volume value to set.
Note
volume must be in a range of 0 and 32767.

◆ getVolume()

int Video::getVolume ( void  )

Get internal volume for current video playback.

Usage example:
vol = Volume.getVolume()
Returns
Volume value of the current video playback.

◆ getTime()

number Video::getTime ( void  )

Get current time for current video playback.

Usage example:
t = Volume.getTime()
Returns
Current time position in the video playback in milliseconds.

◆ jumpToTime()

void Video::jumpToTime ( number  time)

Jump to a specific position for current video playback.

Usage example:
number getTime(void)
Get current time for current video playback.
void jumpToTime(number time)
Jump to a specific position for current video playback.
Parameters
time- The position in milliseconds where to jump in the video playback.

◆ setPlayMode()

void Video::setPlayMode ( PlayMode  mode)

Set play mode for current video playback.

Usage example:
void setPlayMode(PlayMode mode)
Set play mode for current video playback.
@ FAST_FORWARD_16X_MODE
Fast Forward at 16x speed without audio.
Definition: luaVideo.cpp:15
Parameters
mode- The mode to set.

◆ openSubs()

void Video::openSubs ( string  fname)

Open a subtitles file for current video playback.

Usage example:
Video.openSubs("ux0:data/subtitles.vtt")
void openSubs(string fname)
Open a subtitles file for current video playback.
Parameters
fname- The file to use as subtitles source.
Note
Supported subtitles formats: .srt, .vtt.

◆ closeSubs()

void Video::closeSubs ( )

Close currently opened subtitles file.

Usage example:
void closeSubs()
Close currently opened subtitles file.

◆ getSubs()

string Video::getSubs ( void  )

Get current available subtitles for the video playback.

Usage example:
Graphics.debugPrint(20, 20, Video.getSubs(), Color.new(255, 255, 255))
Definition: luaColor.cpp:6
int new(int r, int g, int b, int a)
Create a new color.
void debugPrint(number x, number y, string text, int color)
Print a text on screen using system font.
string getSubs(void)
Get current available subtitles for the video playback.
Returns
Subtitles matching current video playtime from the opened subtitles file.