Skip to content

Commit

Permalink
Merge pull request #28 from mamantoha/pause-with-state
Browse files Browse the repository at this point in the history
pause with state
  • Loading branch information
mamantoha authored Oct 1, 2024
2 parents 9777b8f + e85f8db commit 4d1f15c
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/crystal_mpd/client.cr
Original file line number Diff line number Diff line change
Expand Up @@ -655,10 +655,17 @@ module MPD
end
end

# Toggles pause/resumes playing.
def pause
# Pause or resume playback.
# Pass `state` `true` to pause playback or `false` to resume playback.
# Without the parameter, the pause state is toggled.
def pause(state : Bool? = nil)
synchronize do
write_command("pause")
if state
write_command("pause", boolean(state))
else
write_command("pause")
end

execute("fetch_nothing")
end
end
Expand Down

0 comments on commit 4d1f15c

Please sign in to comment.