API Docs for: 5.0.3
Show:

Player Class

Extends SharedObject
Module: Native

Class for working with player.

Methods

addTracksAsync

(
  • tracks
  • [options]
)
Promise

Asynchronously adds given tracks to nowplaying list.

Parameters:

  • tracks SongList | SharedStringList | SongListData

    Passed tracks, specified by SongList or list of paths, or one track as SongListData.

  • [options] Object optional

    Object 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:

Promise is fulfilled when action is completed.

analyzeWaveform

(
  • tracks
)

Runs analyze waveform on specified tracks.

Parameters:

clearPlaylistAsync

(
  • [saveHistory]
)
Promise

Removes all tracks from nowplaying list

Parameters:

  • [saveHistory] Boolean optional

    True, if this action should be saved to nowplaying history

Returns:

Promise:

Promise is fulfilled when action is completed.

getClassName

() String

Gets class name of the object.

Returns:

String:

getCountOfPlayedEntries

() Integer

Gets number of nowplaying entries, which where already played.

Returns:

Integer:

getCurrentTrack

() Track

Gets current track

Returns:

getFastCurrentTrack

(
  • val
)
Object

Gets current track - fast version

Parameters:

  • val Object

    JS object, to be filled by current track

Returns:

Object:

getInputPlugins

() PluginList

Returns PluginList, with currently selected plugin checked.

Returns:

PluginList:

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:

PluginList:

List of output BasePlugin

getRedoList

(
  • onlyFirst
)
StringList

Returns stringlist with short descriptions of possible redo actions.

Parameters:

  • onlyFirst Boolean

    Force to return only first redo action, if exists.

Returns:

StringList:

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:

getTracklist

() Tracklist

Gets current playing list as Tracklist
Introduced in 5.0.4

Returns:

getUndoList

(
  • onlyFirst
)
StringList

Returns stringlist with short descriptions of possible undo actions.

Parameters:

  • onlyFirst Boolean

    Force to return only first undo action, if exists.

Returns:

StringList:

List of strings - short descriptions of currently possible undo actions.

getWaveform

(
  • track
  • forceUpdate
)
Promise

Returns Waveform data for given SD

Parameters:

  • track Track
  • forceUpdate Boolean

    If true, recomputes waveform

Returns:

Promise:

Promise is fulfilled with computed waveform data

inputPluginConfig

()

Asynchronously opens config dialog of active input plugin.

isPlayingTrack

(
  • track
)
Boolean

Returns true, if song SD is currently playing.

Parameters:

Returns:

Boolean:

locked

(
  • func
)

Call defined method with locked data so user can access them.

Parameters:

  • func Method

    Method to call

nextAsync

() Promise

Play next file in nowplaying list.

Returns:

Promise:

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:

Promise is fulfilled when playback is paused

playAsync

() Promise

Starts playback, asynchronously.

Returns:

Promise:

Promise is fulfilled when playback started

playPauseAsync

() Promise

Starts to play paused playback, or pause, if already playing, asynchronously.

Returns:

Promise:

Promise is fulfilled when playback state is changed

prevAsync

() Promise

Play previous file in nowplaying list.

Returns:

Promise:

Promise is fulfilled when playback of the previous track started

randomizePlaylistAsync

() Promise

Randomize nowplaying list, asynchronously.

Returns:

Promise:

Promise is fulfilled when action is completed

redoAsync

(
  • count
)
Promise

Redo last count actions with nowplaying list, asynchronously.

Parameters:

  • count Integer

    Number of actions

Returns:

Promise:

Promise is fulfilled when undo is completed

removeDuplicatesAsync

() Promise

Removes duplicate items from nowplaying list, asynchronously.

Returns:

Promise:

Promise is fulfilled when action is completed

removeNotAccessibleAsync

() Promise

Removes not accessible items from nowplaying list, asynchronously.

Returns:

Promise:

Promise is fulfilled when action is completed

removeSelectedTracksAsync

() Promise

Removes all selected tracks from nowplaying list, asynchronously.

Returns:

Promise:

Promise is fulfilled when operation is completed

reversePlaylistAsync

() Promise

Reverses nowplaying list, asynchronously.

Returns:

Promise:

Promise is fulfilled when action is completed

seekMSAsync

(
  • Value
)
Promise

Seek to the given time, asynchronously.

Parameters:

  • Value Integer

    Requested track time, in ms.

Returns:

Promise:

Promise is fulfilled when seek is completed

setOutputPlugin

(
  • New
)

Sets given output plugin as active.

Parameters:

  • New WAOutputPlugin

    output plugin

setPlaylistPosAsync

(
  • idx
)
Promise

Changes playlistPos in nowplaying list by index, asynchronously.

Parameters:

  • idx Integer

    Index from 0.

Returns:

Promise:

Promise is fulfilled when operation is completed

setPlaylistPosByEntryAsync

(
  • pe
)
Promise

Changes playlistPos in nowplaying list to entry pe, asynchronously.

Parameters:

  • pe PlaylistEntry

Returns:

Promise:

Promise is fulfilled when operation is completed

stopAsync

() Promise

Stops playback, asynchronously.

Returns:

Promise:

Promise is fulfilled when playback is stopped

undoAsync

(
  • count
)
Promise

Undo last count actions with nowplaying list, asynchronously.

Parameters:

  • count Integer

    Number of actions

Returns:

Promise:

Promise is fulfilled when undo 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.

visualization

Visualization

Gets object for managing visualization.

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 String

    new playback state

  • positionMS Integer

    position 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 String

    new playback state

repeatChange

Event is called when repeat is enabled/disabled.

Event Payload:

  • value Boolean

    new value for repeat

seekChange

Event is called when playback position changed by user interaction.

Event Payload:

  • value Integer

    new position

shuffleChange

Event is called when shuffle is enabled/disabled.

Event Payload:

  • value Boolean

    new value for shuffle

stopAfterCurrentChange

Event is called when stopAfterCurrentTrack is enabled/disabled.

Event Payload:

  • value Boolean

    new value for stopAfterCurrentTrack

trackSkipped

Event is called when now user is manually skipped track.