Player Class
Class for working with player.
Item Index
Methods
- addTracksAsync
- analyzeWaveform
- clearPlaylistAsync
- getClassName
- getCountOfPlayedEntries
- getCurrentTrack
- getFastCurrentTrack
- getInputPlugins
- getNextTrack
- getOutputPlugins
- getRedoList
- getSongList
- getTracklist
- getUndoList
- getWaveform
- inputPluginConfig
- isPlayingTrack
- locked
- nextAsync
- outputPluginConfig
- pauseAsync
- playAsync
- playPauseAsync
- prevAsync
- randomizePlaylistAsync
- redoAsync
- removeDuplicatesAsync
- removeNotAccessibleAsync
- removeSelectedTracksAsync
- reversePlaylistAsync
- seekMSAsync
- setOutputPlugin
- setPlaylistPosAsync
- setPlaylistPosByEntryAsync
- stopAsync
- undoAsync
Properties
Methods
addTracksAsync
-
tracks
-
[options]
Asynchronously adds given tracks to nowplaying list.
Parameters:
-
tracks
SongList | SharedStringList | SongListDataPassed tracks, specified by SongList or list of paths, or one track as SongListData.
-
[options]
Object optionalObject containing options. Possible options are:
- withClear {Boolean} - if true, it clears nowplaying list before adding tracks, default = false
- forcePreview {Boolean} - if true, it plays only preview of added tracks, default = false
- saveHistory {Boolean} - if true, it adds this action to nowplaying history, default = true
- afterCurrent {Boolean} - if true, it places new tracks just after the currently playing track, default = false
- position {integer} - position in nowplaying list, where to place new tracks (0 = begin of the list, -1 = end of the list). Valid only if afterCurrent=false and withClear=false, default = -1
- startPlayback {Boolean} - if true, it starts playback just after the tracks are added, default = false
- shuffle {Boolean} - if true, it shuffles given tracklist before it is added, default = false
- mix {Boolean} - if true, it merges randomly given tracks with tracks in playlist, default = false
- byAlbum {Boolean} - if true, it uses shuffle by album, relevant only if shuffle=true, default = false
Returns:
Promise is fulfilled when action is completed.
analyzeWaveform
-
tracks
Runs analyze waveform on specified tracks.
Parameters:
-
tracks
TracklistTracks to be analyzed
clearPlaylistAsync
-
[saveHistory]
Removes all tracks from nowplaying list
Parameters:
-
[saveHistory]
Boolean optionalTrue, if this action should be saved to nowplaying history
Returns:
Promise is fulfilled when action is completed.
getClassName
()
String
Gets class name of the object.
Returns:
getCountOfPlayedEntries
()
Integer
Gets number of nowplaying entries, which where already played.
Returns:
getFastCurrentTrack
-
val
Gets current track - fast version
Parameters:
-
val
ObjectJS object, to be filled by current track
Returns:
getInputPlugins
()
PluginList
Returns PluginList, with currently selected plugin checked.
Returns:
List of input or decode BasePlugin
getNextTrack
()
Track
Gets track which would currently play next or nil, e.g. if shuffled playback
Returns:
getOutputPlugins
()
PluginList
Returns PluginList, with currently active plugin checked.
Returns:
List of output BasePlugin
getRedoList
-
onlyFirst
Returns stringlist with short descriptions of possible redo actions.
Parameters:
-
onlyFirst
BooleanForce to return only first redo action, if exists.
Returns:
List of strings - short descriptions of currently possible redo actions.
getSongList
()
PlaylistEntries
Gets current nowplaying list. Note that it returns PlaylistEntries class, to get Tracklist use getTracklist method instead
Returns:
getUndoList
-
onlyFirst
Returns stringlist with short descriptions of possible undo actions.
Parameters:
-
onlyFirst
BooleanForce to return only first undo action, if exists.
Returns:
List of strings - short descriptions of currently possible undo actions.
getWaveform
-
track
-
forceUpdate
Returns Waveform data for given SD
Parameters:
-
track
Track -
forceUpdate
BooleanIf true, recomputes waveform
Returns:
Promise is fulfilled with computed waveform data
inputPluginConfig
()
Asynchronously opens config dialog of active input plugin.
isPlayingTrack
-
track
Returns true, if song SD is currently playing.
Parameters:
-
track
Track
Returns:
locked
-
func
Call defined method with locked data so user can access them.
Parameters:
-
func
MethodMethod to call
nextAsync
()
Promise
Play next file in nowplaying list.
Returns:
Promise is fulfilled when playback of the next track started
outputPluginConfig
()
Asynchronously opens config dialog of active output plugin.
pauseAsync
()
Promise
Pauses playback, asynchronously.
Returns:
Promise is fulfilled when playback is paused
playAsync
()
Promise
Starts playback, asynchronously.
Returns:
Promise is fulfilled when playback started
playPauseAsync
()
Promise
Starts to play paused playback, or pause, if already playing, asynchronously.
Returns:
Promise is fulfilled when playback state is changed
prevAsync
()
Promise
Play previous file in nowplaying list.
Returns:
Promise is fulfilled when playback of the previous track started
randomizePlaylistAsync
()
Promise
Randomize nowplaying list, asynchronously.
Returns:
Promise is fulfilled when action is completed
redoAsync
-
count
Redo last count actions with nowplaying list, asynchronously.
Parameters:
-
count
IntegerNumber of actions
Returns:
Promise is fulfilled when undo is completed
removeDuplicatesAsync
()
Promise
Removes duplicate items from nowplaying list, asynchronously.
Returns:
Promise is fulfilled when action is completed
removeNotAccessibleAsync
()
Promise
Removes not accessible items from nowplaying list, asynchronously.
Returns:
Promise is fulfilled when action is completed
removeSelectedTracksAsync
()
Promise
Removes all selected tracks from nowplaying list, asynchronously.
Returns:
Promise is fulfilled when operation is completed
reversePlaylistAsync
()
Promise
Reverses nowplaying list, asynchronously.
Returns:
Promise is fulfilled when action is completed
seekMSAsync
-
Value
Seek to the given time, asynchronously.
Parameters:
-
Value
IntegerRequested track time, in ms.
Returns:
Promise is fulfilled when seek is completed
setOutputPlugin
-
New
Sets given output plugin as active.
Parameters:
-
New
WAOutputPluginoutput plugin
setPlaylistPosAsync
-
idx
Changes playlistPos in nowplaying list by index, asynchronously.
Parameters:
-
idx
IntegerIndex from 0.
Returns:
Promise is fulfilled when operation is completed
setPlaylistPosByEntryAsync
-
pe
Changes playlistPos in nowplaying list to entry pe, asynchronously.
Parameters:
-
pe
PlaylistEntry
Returns:
Promise is fulfilled when operation is completed
Properties
asJSON
String
Gets the object as serialized JSON string. Or sets serialized JSON (to fill this object's metadata by the metadata included within the JSON)
autoResetStopAfterCurrent
Boolean
If disabled, stop after current track flag persists for next tracks.
bitrate
Integer
Returns bitrate of current track, in kbps.
entriesCount
Integer
Returns number of entries in nowplaying list.
id
Integer
Gets integer id of the object
isPlaying
Boolean
Returns true, if player is currently playing.
mute
Boolean
Mutes/unmutes volume, gets if volume is muted
normalize
Boolean
Gets/Sets leveling of playback volume (normalization)
objectType
String
Gets the object type as string
panning
Double
Gets/Sets sound panning(balance), -1 = left, 0 - middle, 1 = right
paused
Boolean
Returns true, if player is currently paused
persistentID
String
Gets persistent id of the object
playlistPos
Double
Gets nowplaying list position, -1 = undefined, 0...n current track order. For setting use setPlaylistPosAsync or setPlaylistPosByEntryAsync.
repeatOne
Boolean
Gets/Sets repeating current file in nowplaying list.
repeatPlaylist
Boolean
Gets/Sets repeating nowplaying list.
sampleRate
Integer
Returns sample rate of current track, in Hz.
sampleRate
Integer
Returns number of channels of current track
shufflePlaylist
Boolean
Gets/Sets shuffling nowplaying list.
stopAfterCurrentTrack
Boolean
Gets/Sets stop after current track flag.
title
String
Gets the object title
trackLengthMS
Integer
Gets current track length, in ms.
trackPositionMS
Integer
Gets current track playback position, in ms. For setting position use seekMSAsync.
volume
Double
Gets/Sets volume, 0 = silent, 1 = maximum volume.
Events
htmlPlaybackState
Event is called when state of the HTML player is changed ... like playback is started etc. Possible states are 'unpause', 'play', 'stop', 'pause', 'trackChanged'.
Event Payload:
-
newState
Stringnew playback state
-
positionMS
Integerposition in miliseconds
layoutModified
Event is called when player layout is somehow modified.
nowPlayingModified
Event is called when now playing list is somehow modified.
playbackEnd
Event is called when playback ends.
playbackState
Event is called when state of the player is changed ... like playback is started etc. Possible states are 'unpause', 'play', 'stop', 'pause', 'trackChanged'.
Event Payload:
-
newState
Stringnew playback state
repeatChange
Event is called when repeat is enabled/disabled.
Event Payload:
-
value
Booleannew value for repeat
seekChange
Event is called when playback position changed by user interaction.
Event Payload:
-
value
Integernew position
shuffleChange
Event is called when shuffle is enabled/disabled.
Event Payload:
-
value
Booleannew value for shuffle
stopAfterCurrentChange
Event is called when stopAfterCurrentTrack is enabled/disabled.
Event Payload:
-
value
Booleannew value for stopAfterCurrentTrack
trackSkipped
Event is called when now user is manually skipped track.