libgpac
Documentation of the core library of GPAC
JSGPAC Interface Reference

import"scenejs.idl";

Public Member Functions

DOMString get_option (DOMString section, DOMString key)
 
*DOMString get_option (DOMString section, unsigned key_idx)
 
void set_option (DOMString section, DOMString key, optional DOMString value=null)
 
DOMString get_arg (unsigned long idx)
 
Array enum_directory (DOMString dir, optional DOMString filter=null, optional DOMString filter=null, optional bool go_up=false)
 
void set_size (unsigned long width, unsigned long height)
 
void exit ()
 
void set_3d (Boolean use_3d)
 
void move_window (unsigned long x, unsigned long y, optional boolean relative=false)
 
void set_event_filter (GPACEventFilter filter_event_func)
 
void set_focus (DOMString focus)
 
void set_focus (Node elt)
 
DOMString error_string (GF_Err e)
 
void show_keyboard (boolean do_show)
 
void trigger_gc ()
 
MediaObject get_object_manager (DOMString url)
 
void switch_quality (boolean up)
 
boolean navigation_supported (unsigned long nav_type)
 
void set_back_color (double r, double g, double b, double a)
 
Storage new_storage (DOMString storage_name)
 

Data Fields

attribute DOMString last_working_directory
 
readonly attribute boolean batteryOn
 
readonly attribute boolean batteryCharging
 
readonly attribute unsigned long batteryPercent
 
readonly attribute unsigned long batteryLifeTime
 
readonly attribute unsigned long batteryFullLifeTime
 
readonly DOMString hostname
 
attribute boolean fullscreen
 
readonly DOMString current_path
 
attribute unsigned long volume
 
attribute unsigned long navigation
 
attribute unsigned long navigation_type
 
readonly attribute boolean hardware_yuv
 
readonly attribute boolean hardware_rgb
 
readonly attribute boolean hardware_rgba
 
readonly attribute boolean hardware_stretch
 
readonly attribute unsigned long screen_width
 
readonly attribute unsigned long screen_height
 
attribute unsigned long http_max_bitrate
 
readonly attribute unsigned long http_bitrate
 
readonly attribute double fps
 
readonly attribute double sim_fps
 
readonly attribute boolean has_opengl
 
readonly attribute double cpu
 
readonly attribute unsigned long nb_cores
 
readonly attribute unsigned long system_memory
 
readonly attribute unsigned long memory
 
readonly attribute unsigned long argc
 
attribute DOMString caption
 
attribute boolean focus_highlight
 
readonly attribute unsigned long dpi_x
 
readonly attribute unsigned long dpi_y
 
attribute boolean sensors_active
 
readonly attribute double zoom
 
readonly attribute DOMString text_selection
 

Detailed Description

JSGPAC is the interface to compositor

Member Function Documentation

◆ get_option() [1/2]

DOMString JSGPAC::get_option ( DOMString  section,
DOMString  key 
)

see gf_opts_get_key

Parameters
sectionthe section name
keythe key name
Returns
the key value

◆ get_option() [2/2]

* DOMString JSGPAC::get_option ( DOMString  section,
unsigned  key_idx 
)

see gf_opts_get_key_name

Parameters
sectionthe section name
key_idxthe key index in the section
Returns
the key name

◆ set_option()

void JSGPAC::set_option ( DOMString  section,
DOMString  key,
optional DOMString  value = null 
)

see gf_opts_set_key

Parameters
sectionthe section name
keythe key name
valuethe key value, null to remove the key

◆ get_arg()

DOMString JSGPAC::get_arg ( unsigned long  idx)

get program argument by index

Parameters
idxthe argument index
Returns
the argument

◆ enum_directory()

Array JSGPAC::enum_directory ( DOMString  dir,
optional DOMString  filter = null,
optional DOMString  filter = null,
optional bool  go_up = false 
)

enumerate directories

Parameters
dirthe directory to enumerate
filterthe filter for file extensions. If "dir", only enumerate directories
go_upif true, enumerate parent directory or root (/).
Returns
array of FileInformation interface

◆ set_size()

void JSGPAC::set_size ( unsigned long  width,
unsigned long  height 
)

set output window size

Parameters
widthdesired width
heightdesired height

◆ exit()

void JSGPAC::exit ( )

post quit message

◆ set_3d()

void JSGPAC::set_3d ( Boolean  use_3d)

turns 3D rendering on/off

Parameters
use_3dif true, uses 3D for all content, otherwise use 3D based on content type

◆ move_window()

void JSGPAC::move_window ( unsigned long  x,
unsigned long  y,
optional boolean  relative = false 
)

moves output window

Parameters
xthe horizontal position or delta
ythe vertical position or delta
relativeif true, use relative (delta) positioning; otherwise use absolute

◆ set_event_filter()

void JSGPAC::set_event_filter ( GPACEventFilter  filter_event_func)

assigns event filter

Parameters
filter_event_functhe filter event function to use, or null to deactivate event filtering

◆ set_focus() [1/2]

void JSGPAC::set_focus ( DOMString  focus)

moves focus

Parameters
focus"next" for next element in focus ring, "prev" for previous

◆ set_focus() [2/2]

void JSGPAC::set_focus ( Node  elt)

sets focus on element

Parameters
eltthe node on which focus should be set

◆ error_string()

DOMString JSGPAC::error_string ( GF_Err  e)

gets string for error

Parameters
ethe error code
Returns
the corresponding string

◆ show_keyboard()

void JSGPAC::show_keyboard ( boolean  do_show)

show or hide virtual keyboard

Parameters
do_showif true, show keyboard, otherwise hide it

◆ trigger_gc()

void JSGPAC::trigger_gc ( )

triggers JS garbage collection pass

◆ get_object_manager()

MediaObject JSGPAC::get_object_manager ( DOMString  url)

gets object manager for the given service URL loaded in the root scene of the compositor

Parameters
urlurl of service for which the object manager is queried
Returns
the object manager, or null if not found

◆ switch_quality()

void JSGPAC::switch_quality ( boolean  up)

switches quality

Parameters
upswitches quality up (true) or down (false)

◆ navigation_supported()

boolean JSGPAC::navigation_supported ( unsigned long  nav_type)

checks if navigation type is supported for the current content

Parameters
nav_typethe navigation type to check
Returns
true if supported, false otherwise

◆ set_back_color()

void JSGPAC::set_back_color ( double  r,
double  g,
double  b,
double  a 
)

sets default back color of player

Parameters
rred component between 0.0 and 1.0
ggreen component between 0.0 and 1.0
bblue component between 0.0 and 1.0
aalpha component between 0.0 and 1.0

◆ new_storage()

Storage JSGPAC::new_storage ( DOMString  storage_name)

allocates a new storage

Parameters
storage_namethe storage name
Returns
the storage object

Field Documentation

◆ last_working_directory

attribute DOMString JSGPAC::last_working_directory

last working directory

◆ batteryOn

readonly attribute boolean JSGPAC::batteryOn

indicates if running on battery or with power charge

◆ batteryCharging

readonly attribute boolean JSGPAC::batteryCharging

indicates if battery is charging

◆ batteryPercent

readonly attribute unsigned long JSGPAC::batteryPercent

battery percent (0 to 100)

◆ batteryLifeTime

readonly attribute unsigned long JSGPAC::batteryLifeTime

estimated battery lifetime - see gf_sys_get_battery_state

◆ batteryFullLifeTime

readonly attribute unsigned long JSGPAC::batteryFullLifeTime

estimated battery lifetime in full charge - see gf_sys_get_battery_state

◆ hostname

readonly DOMString JSGPAC::hostname

host name

◆ fullscreen

attribute boolean JSGPAC::fullscreen

fullscreen status

◆ current_path

readonly DOMString JSGPAC::current_path

current working directory

◆ volume

attribute unsigned long JSGPAC::volume

audio output volume

◆ navigation

attribute unsigned long JSGPAC::navigation

navigation mode

◆ navigation_type

attribute unsigned long JSGPAC::navigation_type

checks if navigation is off, 2D or 3D mode

◆ hardware_yuv

readonly attribute boolean JSGPAC::hardware_yuv

true if display has hardware yuv 2D blit

◆ hardware_rgb

readonly attribute boolean JSGPAC::hardware_rgb

true if display has hardware rgb 2D blit

◆ hardware_rgba

readonly attribute boolean JSGPAC::hardware_rgba

true if display has hardware rgba 2D blit

◆ hardware_stretch

readonly attribute boolean JSGPAC::hardware_stretch

true if display has hardware stretch blit

◆ screen_width

readonly attribute unsigned long JSGPAC::screen_width

display width

◆ screen_height

readonly attribute unsigned long JSGPAC::screen_height

display height

◆ http_max_bitrate

attribute unsigned long JSGPAC::http_max_bitrate

max capped HTTP download rate - used for DASH simulations mostly

◆ http_bitrate

readonly attribute unsigned long JSGPAC::http_bitrate

current http download rate averaged on all active resources

◆ fps

readonly attribute double JSGPAC::fps

current output fps

◆ sim_fps

readonly attribute double JSGPAC::sim_fps

desired output fps for animations

◆ has_opengl

readonly attribute boolean JSGPAC::has_opengl

true if display has opengl support

◆ cpu

readonly attribute double JSGPAC::cpu

cpu usage

◆ nb_cores

readonly attribute unsigned long JSGPAC::nb_cores

number of cores

◆ system_memory

readonly attribute unsigned long JSGPAC::system_memory

system memory

◆ memory

readonly attribute unsigned long JSGPAC::memory

memory usage

◆ argc

readonly attribute unsigned long JSGPAC::argc

number of arguments of launch command

◆ caption

attribute DOMString JSGPAC::caption

window title

◆ focus_highlight

attribute boolean JSGPAC::focus_highlight

enables or disable focus highlighting

◆ dpi_x

readonly attribute unsigned long JSGPAC::dpi_x

sceen horizontal dpi

◆ dpi_y

readonly attribute unsigned long JSGPAC::dpi_y

sceen vertical dpi

◆ sensors_active

attribute boolean JSGPAC::sensors_active

sensor active state (gyroscope)

◆ zoom

readonly attribute double JSGPAC::zoom

compositor zoom factor

◆ text_selection

readonly attribute DOMString JSGPAC::text_selection

current text selection