This repository has been archived by the owner on Dec 5, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 105
JavaScript API
Sergey Radionov edited this page Aug 18, 2016
·
31 revisions
var wc = require("webchimera.js");
var vlcPlayer = wc.createPlayer();
var wc = require("webchimera.js");
var vlcPlayer = wc.createPlayer(["-vvv"]);
var wc = require("webchimera.js");
var vlcPlayer = new wc.VlcPlayer();
var wc = require("webchimera.js");
var vlcPlayer = new wc.VlcPlayer(["-vvv"]);
Read only properties:
-
vlcVersion
: -
vlcChangeset
:
Read only properties:
-
width
: -
height
: -
pixelFormat
: = RV32
Read only properties:
-
width
: -
height
: -
pixelFormat
: = I420 -
uOffset
: -
vOffset
:
Pixel format possible values:
-
RV32
: -
I420
:
-
NothingSpecial
: -
Opening
: -
Buffering
: -
Playing
: -
Paused
: -
Stopped
: -
Ended
: -
Error
:
-
vlcVersion
: -
vlcChangeset
: -
playing
: -
length
: -
state
: returns current state; -
videoFrame
: -
events
: returns `EventEmitter` instance;
-
pixelFormat
: -
position
: -
time
: -
volume
: -
mute
:
-
play( mrl )
: -
play()
: -
pause()
: -
togglePause()
: -
stop()
: -
toggleMute()
: -
close()
:
-
onFrameSetup( width, height, pixelFormat, videoFrame )
: -
onFrameReady( videoFrame )
: -
onFrameCleanup
: -
onMediaChanged
: -
onNothingSpecial
: vlc is in idle state doing nothing but waiting for a command to be issued. -
onOpening
: vlc is opening an media resource locator (MRL). -
onBuffering( percents )
: vlc is buffering. -
onPlaying
: vlc is playing a media. -
onPaused
: vlc is in paused state. -
onForward
: vlc is fastforwarding through the media (works only when an input supports forward playback). -
onBackward
: vlc is going backwards through the media (works only when an input supports backwards playback). -
onEncounteredError
: vlc has encountered an error and is unable to continue. -
onEndReached
: vlc has reached the end of current playlist. -
onStopped
: -
onTimeChanged( time )
: time has changed.time
is in milliseconds. -
onPositionChanged( position )
: media position has changed. -
onSeekableChanged( seekable )
: media seekable flag has changed. -
onPausableChanged( pausable )
: media pausable flag has changed. -
onLengthChanged( length )
: -
onLogMessage( level, message, format )
:
-
input
: Access input properties. -
audio
: Access audio properties. -
video
: Access video properties. -
subtitles
: Access subtitles properties. -
playlist
: Access playlist properties.
Read only properties:
-
length
: length of the input file in number of milliseconds. 0 is returned for 'live' streams or clips whose length cannot be determined by VLC. It returns -1 if no input is playing. -
fps
: frames per second returned as a float (typically 60.0, 50.0, 23.976, etc...). -
state
: returns current state. -
hasVout
: returns true if video present, false otherwise.
-
position
: normalized position in multimedia stream item given as a float value between [0.0..1.0]. -
time
: the absolute position in time given in milliseconds, this property can be used to seek through the stream. -
rate
: input speed given as float (1.0 for normal speed, 0.5 for half speed, 2.0 for twice as fast, etc.).
Channel possible values:
Error
Stereo
ReverseStereo
Left
Right
Dolby
-
count
: returns the number of audio track available. -
[i]
: give the i-th audio track name. 0 corresponds to disable and 1 to the first audio track.
-
track
: a value between [1-65535] which indicates the audio track to play or that is playing. a value of 0 means the audio is/will be disabled. -
mute
: boolean value to mute and unmute the audio. -
volume
: a value between [0-200] which indicates a percentage of the volume. -
channel
: integer value between [1-5] that indicates which audio channel mode is used. -
delay
: integer value in milliseconds, can be positive or negative.
-
toggleMute()
: boolean toggle that mutes and unmutes the audio based upon the previous state.
Read only properties:
count
track
-
contrast
: [0.0..2.0] -
brightness
: [0.0..2.0] -
hue
: [0..360] -
saturation
: [0.0..3.0] -
gamma
: [0.01..10.0]
contrast
/brightness
/hue
/saturation
/gamma
will work only with --adjust-filter=true
startup option. If --adjust-filter=true
doesn't work for your version of VLC, use --video-filter=adjust
More info here: https://wiki.videolan.org/VLC_command-line_help
Subobjects:
-
deinterlace
:
Methods:
-
enable( 'mode' )
: enable deinterlacing with 'mode'. You can enable it with 'blend', 'bob', 'discard', 'linear', 'mean', 'x', 'yadif' or 'yadif2x' mode. Enabling too soon deinterlacing may cause some problems. You have to wait that all variable are available before enabling it. -
disable()
: disable deinterlacing.
Read only properties:
-
count
: returns the number of subtitle available. -
[i]
: give the i-th subtitle name. 0 correspond to disable and 1 to the first subtitle.
-
track
: get and set the subtitle track to show on the video screen. The property takes an integer as input value [1..65535]. If subtitle track is set to 0, the subtitles will be disabled. If set to a value outside the current subtitle tracks range, then it will return -1. -
delay
: integer value in milliseconds, can be positive or negative.
-
load( path )
:
Mode possible values:
-
Normal
: play till last item. -
Loop
: infinite repeat all items. -
Single
: play current playlist item and stop.
-
itemCount
: number that returns the amount of items currently in the playlist. -
isPlaying
: a boolean that returns true if the current playlist item is playing and false when it is not playing.
-
currentItem
: returns current item index. -
mode
: playlist mode.
-
add(mrl) -> int
: add a playlist item. -
addWithOptions(mrl, options) -> int
: add a playlist item with options. -
play()
: start playing the current playlist item. -
playItem(i) -> bool
: start playing the item whose identifier is i. -
pause()
: -
togglePause()
: toggle the pause state for the current playlist item. -
stop()
: stop playing the current playlist item. -
next()
: iterate to the next playlist item. -
prev()
: iterate to the previous playlist item. -
clear()
: empty the current playlist, all items will be deleted from the playlist. -
removeItem(i) -> bool
: remove the item from playlist whose identifier is i. -
advanceItem(i, count)
: change item position within playlist.
-
items
: return the playlist items collection.
Read only properties:
-
count
: number of items currently in the playlist. -
[i]
: return VlcMedia object for i-th item.
-
clear()
: empty the current playlist, all items will be deleted from the playlist. -
remove(i)
: remove the item whose identifier is i from playlist.
Read only properties:
-
artist
: returns artist meta information field. -
genre
: returns genre meta information field. -
copyright
: returns copyright meta information field. -
album
: returns album meta information field. -
trackNumber
: returns trackNumber meta information field. -
description
: returns description meta information field. -
rating
: returns rating meta information field. -
date
: returns date meta information field. -
URL
: returns URL meta information field. -
language
: returns language meta information field. -
nowPlaying
: returns nowPlaying meta information field. -
publisher
: returns publisher meta information field. -
encodedBy
: returns encodedBy meta information field. -
artworkURL
: returns artworkURL meta information field. -
trackID
: returns trackID meta information field. -
mrl
: -
parsed
: -
duration
: returns media duration. Media should be parsed.
-
title
: returns title meta information field. -
setting
: -
disabled
: allow skip playlist item onnext()
/prev()
.
-
parse
: -
parseAsync
: