This subclass is used to control MPDs playback. You may also want to have a look at the MPD documentation.
MphpD::player() : Player
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
@param \MphpD $mphpd
mixed
Enables/Disables the consume mode
Player::consume(int $state) : bool
@param int $state One of the following:
MPD_STATE_ON - Enables consume mode
MPD_STATE_OFF - Disables consume mode
MPD_STATE_ONESHOT - Enables consume mode for a single song.
This is only supported on MPD version 0.24 and newer.
bool
bool Returns true on success and false on failure
Sets crossfade to $seconds seconds.
Player::crossfade(int $seconds) : bool
@param int $seconds
bool
bool Returns true on success and false on failure
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
@param int $dB
bool
bool Returns true on success and false on failure.
Player::mixramp_delay(float $seconds) : bool
@param float $seconds
bool
bool Returns true on success and false on failure
Specified if MPD should play the queue in random order
Player::random(int $state) : bool
@param int $state Either MPD_STATE_OFF or MPD_STATE_ON
bool
bool Returns true on success and false on failure.
Specifies if MPD should start from the top again when reaching the end of the queue.
Player::repeat(int $state) : bool
@param int $state Either MPD_STATE_OFF or MPD_STATE_ON
bool
bool Returns true on success and false on failure.
Sets volume to $volume or returns the current volume if $volume is omitted.
Player::volume(int $volume = -1) : mixed
@param int $volume If specified the current volume is set to $volume.
If omitted the current volume is returned.
mixed
int|bool Returns true on success, false on failure and int if $volume was omitted.
Enables/Disables the single-mode. If enabled MPD will play the same song over and over.
Player::single(int $state) : bool
@param int $state One of the following:
MPD_STATE_ON - Enables single mode
MPD_STATE_OFF - Disables single mode
MPD_STATE_ONESHOT - Enables single mode for only a single time.
This is only supported on MPD version 0.21 and newer.
bool
bool
Specifies whether MPD shall adjust the volume of songs played using ReplayGain tags.
Player::replay_gain_mode(string $mode) : bool
@param string $mode One of off, track, album, auto
bool
bool Returns true on success and false on failure.
Get the current replay gain
Player::replay_gain_status() : mixed
mixed
array|false
Returns an associative array containing information about the currently playing song.
Player::current_song() : mixed
mixed
array|false
Plays the next song in the Queue
Player::next() : bool
bool
bool Returns true on success and false on failure
Pause or resume playback.
Player::pause(?int $state = null) : bool
@param int|null $state Optional. One of the following:
MPD_STATE_ON - Pause
MPD_STATE_OFF - Resume
If omitted or null the pause state is toggled.
bool
bool Returns true on success and false on failure
Plays the song position $pos in the Queue
Player::play(int $pos) : bool
@param int $pos Song position. Starting at 0
bool
bool Returns true on success and false on failure
Begins playing the playlist at song $id
Player::play_id(int $id) : bool
@param int $id
bool
bool Returns true on success and false on failure
Plays the previous song in the Queue
Player::previous() : bool
bool
Seeks to $seconds of song $songpos in the Queue.
Player::seek(int $songpos, float $time) : bool
@param int $songpos
@param float $time
bool
bool Returns true on success and false on failure
Seeks to $seconds of song $songid
Player::seek_id(int $songid, float $time) : bool
@param int $songid
@param float $time
bool
bool Returns true on success and false on failure
Seeks to $seconds of the current song.
Player::seek_cur( $time) : bool
@param string|int|float $time If prefixed with + or - the time is relative to the current playing position.
bool
bool Returns true on success and false on failure
Stops playing.
Player::stop() : bool
bool
bool Returns true on success and false on failure