Methods to control and manage the VLC playlist.
Availability
| Script Types |
|---|
| Extension, Interface |
prev()
Play previous track.
Usage
if should_go_back then
vlc.playlist.prev()
end
next()
Play next track.
Usage
if should_goto_next then
vlc.playlist.next()
end
skip()
Skip one or more tracks.
Parameters
num_skipsInteger value: how many tracks to skip
play()
Start playback.
pause()
Pause playback.
stop()
Stop playback.
clear()
Clear the playlist.
repeat()
Toggle item repeat or set it to a specified value.
Parameters
- Optional
enableString value indicating an explicit value to set; ‘on’ or ‘off’ (repeat is toggled if no value is passed)
Return value
Boolean value: true if repeat is enabled, false otherwise
repeat_()
Alias of repeat(), provided since repeat is a reserved Lua keyword.
loop()
Toggle playlist loop or set it to a specified value.
Parameters
- Optional
enableString value indicating an explicit value to set; ‘on’ or ‘off’ (loop is toggled if no value is passed)
Return value
Boolean value: true if loop is enabled, false otherwise
random()
Toggle randomized payback or set it to specified value.
Parameters
- Optional
enableString value indicating an explicit value to set; ‘on’ or ‘off’ (random playback is toggled if no value is passed)
Return value
Boolean value: true if random playback is enabled, false otherwise
get_repeat()
Get current repeat mode.
Return value
Boolean value: true if repeat is enabled, false otherwise
get_loop()
Get current loop mode.
Return value
Boolean value: true if loop is enabled, false otherwise
get_random()
Get current random mode.
Return value
Boolean value: true if random playback is enabled, false otherwise
goto()
Go to a specified track in the playlist.
Provided for Lua <5.0.2
Parameters
idInteger identifier corresponding to a track in the playlist
Return value
Two values:
codeInteger value 0 on success, VLC error code on failuremessage“no error” on success, otherwise an error string specifying the type of error
gotoitem()
Alias of goto() provided for all Lua versions.
add()
Add one or more items to the playlist, tracks are played when added.
Parameters
...One or more playlist items to add to the playlist
Return value
Integer value indicating how many items were added to the playlist
enqueue()
Same as add(), but tracks are not played when added.
get()
Get an item from the current playlist.
Parameters
idInteger value; item identifier
Return value
The specified playlist item
list()
Get list of all playlist items in current playlist.
Return value
List of all the playlist items in the current playlist
current()
Get the ID of the current playlist item.
Return value
Integer value: identifier of the current playlist item
current_item()
Get the current playlist item.
Return value
The current playlist item
sort()
Sort the current playlist according to a given key.
Parameters
keyString containing the sorting key; must be one of:idtitletitle nodes firstartistgenrerandomdurationtitle numericalbum
Return value
Two values that indicate how the sort operation went:
codeInteger value 0 on success, VLC error code on failuremessage“no error” on success, otherwise an error string specifying the type of error
status()
Get the status of the current playlist.
Return value
String literal value, one of: "stopped", "started", "playing", "paused", "stopping", "unknown"
delete()
Check if an item is in the current playlist and delete it.
Parameters
idInteger value; item identifier
Return value
Two values that indicate how the delete operation went:
codeInteger value 0 on success, VLC error code on failuremessage“no error” on success, otherwise an error string specifying the type of error
move()
Move a playlist item. This operation shifts the target item by one if the current item is before the target.
Parameters
idInteger value; item identifiertargetInteger value; identifier of the item in the target position
Return value
Two values that indicate how the move operation went:
codeInteger value 0 on success, VLC error code on failuremessage“no error” on success, otherwise an error string specifying the type of error
Playlist Items
A playlist item can contain the following fields:
.paththe item’s full path / URL.namethe item’s name in playlist (OPTIONAL).titlethe item’s Title (OPTIONAL, meta data).artistthe item’s Artist (OPTIONAL, meta data).genrethe item’s Genre (OPTIONAL, meta data).copyrightthe item’s Copyright (OPTIONAL, meta data).albumthe item’s Album (OPTIONAL, meta data).tracknumthe item’s Tracknum (OPTIONAL, meta data).descriptionthe item’s Description (OPTIONAL, meta data).ratingthe item’s Rating (OPTIONAL, meta data).datethe item’s Date (OPTIONAL, meta data).settingthe item’s Setting (OPTIONAL, meta data).urlthe item’s URL (OPTIONAL, meta data).languagethe item’s Language (OPTIONAL, meta data).nowplayingthe item’s NowPlaying (OPTIONAL, meta data).publisherthe item’s Publisher (OPTIONAL, meta data).encodedbythe item’s EncodedBy (OPTIONAL, meta data).arturlthe item’s ArtURL (OPTIONAL, meta data).trackidthe item’s TrackID (OPTIONAL, meta data).optionsa list of VLC options (OPTIONAL) (e.g..options = { "run-time=60" }).durationstream duration in seconds (OPTIONAL).metacustom meta data (OPTIONAL) (e.g..meta = { ["GVP docid"] = "-5784010886294950089", ["GVP version] = "1.1", Hello = "World!" })