Player

This subclass is used to control MPDs playback. You may also want to have a look at the MPD documentation.

MphpD::player() : Player

Methods

__construct

This class is not intended for direct usage. Use MphpD::player() instead to retrieve an instance of this class.

Player::__construct(FloFaber\MphpD\MphpD $mphpd) : mixed

Parameters

@param \MphpD $mphpd

Returns mixed

consume

Enables/Disables the consume mode

Player::consume(int $state) : bool

Parameters

@param int $state One of the following:

Returns bool

bool Returns true on success and false on failure

crossfade

Sets crossfade to $seconds seconds.

Player::crossfade(int $seconds) : bool

Parameters

@param int $seconds

Returns bool

bool Returns true on success and false on failure

mixramp_db

Sets the threshold at which songs will be overlapped. See https://mpd.readthedocs.io/en/latest/user.html#mixramp for more information

Player::mixramp_db(int $dB) : bool

Parameters

@param int $dB

Returns bool

bool Returns true on success and false on failure.

mixramp_delay

Player::mixramp_delay(float $seconds) : bool

Parameters

@param float $seconds

Returns bool

bool Returns true on success and false on failure

random

Specified if MPD should play the queue in random order

Player::random(int $state) : bool

Parameters

@param int $state Either MPD_STATE_OFF or MPD_STATE_ON

Returns bool

bool Returns true on success and false on failure.

repeat

Specifies if MPD should start from the top again when reaching the end of the queue.

Player::repeat(int $state) : bool

Parameters

@param int $state Either MPD_STATE_OFF or MPD_STATE_ON

Returns bool

bool Returns true on success and false on failure.

volume

Sets volume to $volume or returns the current volume if $volume is omitted.

Player::volume(int $volume = -1) : mixed

Parameters

@param int $volume If specified the current volume is set to $volume.

If omitted the current volume is returned.

Returns mixed

int|bool Returns true on success, false on failure and int if $volume was omitted.

single

Enables/Disables the single-mode. If enabled MPD will play the same song over and over.

Player::single(int $state) : bool

Parameters

@param int $state One of the following:

Returns bool

bool

replay_gain_mode

Specifies whether MPD shall adjust the volume of songs played using ReplayGain tags.

Player::replay_gain_mode(string $mode) : bool

Parameters

@param string $mode One of off, track, album, auto

Returns bool

bool Returns true on success and false on failure.

replay_gain_status

Get the current replay gain

Player::replay_gain_status() : mixed

Parameters

None.

Returns mixed

array|false

current_song

Returns an associative array containing information about the currently playing song.

Player::current_song() : mixed

Parameters

None.

Returns mixed

array|false

next

Plays the next song in the Queue

Player::next() : bool

Parameters

None.

Returns bool

bool Returns true on success and false on failure

pause

Pause or resume playback.

Player::pause(?int $state = null) : bool

Parameters

@param int|null $state Optional. One of the following:

If omitted or null the pause state is toggled.

Returns bool

bool Returns true on success and false on failure

play

Plays the song position $pos in the Queue

Player::play(int $pos) : bool

Parameters

@param int $pos Song position. Starting at 0

Returns bool

bool Returns true on success and false on failure

play_id

Begins playing the playlist at song $id

Player::play_id(int $id) : bool

Parameters

@param int $id

Returns bool

bool Returns true on success and false on failure

previous

Plays the previous song in the Queue

Player::previous() : bool

Parameters

None.

Returns bool

seek

Seeks to $seconds of song $songpos in the Queue.

Player::seek(int $songpos, float $time) : bool

Parameters

@param int $songpos

@param float $time

Returns bool

bool Returns true on success and false on failure

seek_id

Seeks to $seconds of song $songid

Player::seek_id(int $songid, float $time) : bool

Parameters

@param int $songid

@param float $time

Returns bool

bool Returns true on success and false on failure

seek_cur

Seeks to $seconds of the current song.

Player::seek_cur( $time) : bool

Parameters

@param string|int|float $time If prefixed with + or - the time is relative to the current playing position.

Returns bool

bool Returns true on success and false on failure

stop

Stops playing.

Player::stop() : bool

Parameters

None.

Returns bool

bool Returns true on success and false on failure

© 2023 Florian Faber