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
mixed
Enables/Disables the consume mode
Player::consume(int $state) : bool
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 true
on success and false
on failure
Sets crossfade to $seconds
seconds.
Player::crossfade(int $seconds) : bool
Crossfade duration in seconds.
bool
bool true
on success or 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
bool
bool true
on success or false
on failure.
Additional time subtracted from the overlap calculated by mixrampdb.
A value of nan
disables MixRamp overlapping and falls back to crossfading. See MixRamp.
Player::mixramp_delay(float $seconds) : bool
bool
bool true
on success or false
on failure.
Specified if MPD should play the queue in random order
Player::random(int $state) : bool
Either MPD_STATE_OFF
or MPD_STATE_ON
bool
bool true
on success or false
on failure.
Specifies if MPD should start from the top again when reaching the end of the queue.
Player::repeat(int $state) : bool
Either MPD_STATE_OFF
or MPD_STATE_ON
bool
bool true
on success or false
on failure.
Sets volume to $volume
or returns the current volume if $volume
is omitted.
Player::volume(int $volume = -1) : mixed
If specified the current volume is set to $volume
.
If omitted the current volume is returned.
mixed
int|bool 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
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 true
on success or false
on failure.
Specifies whether MPD shall adjust the volume of songs played using ReplayGain tags.
Player::replay_gain_mode(string $mode) : bool
One of off
, track
, album
, auto
bool
bool true
on success or false
on failure.
Get the current replay gain. Currently only the variable replay_gain_mode
is returned by MPD.
Player::replay_gain_status() : mixed
mixed
array|false array
on success or false
on failure.
Returns an associative array
containing information about the currently playing song.
Player::current_song() : mixed
mixed
array|false array
containing song information on success or false
on failure.
Plays the next song in the Queue
Player::next() : bool
bool
bool true
on success and false
on failure.
Pause or resume playback.
Player::pause(?int $state = null) : bool
Optional. One of the following:
MPD_STATE_ON
- Pause
MPD_STATE_OFF
- Resume
If omitted or null
the pause state is toggled.
bool
bool true
on success and false
on failure.
Plays the song position $pos
in the Queue
Player::play(int $pos) : bool
Song position starting at 0.
bool
bool true
on success and false
on failure.
Begins playing the playlist at song $id
Player::play_id(int $id) : bool
ID of the song.
bool
bool true
on success and false
on failure.
Plays the previous song in the Queue
Player::previous() : bool
bool
bool true
on success and false
on failure.
Seeks to $seconds
of song $songpos
in the Queue.
Player::seek(int $songpos, float $time) : bool
Queue-position of the song.
Seconds to seek to.
bool
bool true
on success and false
on failure.
Seeks to $seconds
of song $songid
. Same as Player::seek()
but with a song ID instead of a position.
Player::seek_id(int $songid, float $time) : bool
ID of the song.
Seconds to seek to.
bool
bool true
on success and false
on failure.
Seeks to $seconds
of the current song.
Player::seek_cur( $time) : bool
If prefixed with +
or -
the time is relative to the current playing position.
bool
bool true
on success and false
on failure.
Stops playing.
Player::stop() : bool
bool
bool true
on success and false
on failure.