Method: RSpotify::Player#repeat

Defined in:
lib/rspotify/player.rb

#repeat(device_id: nil, state: "context") ⇒ Object

Toggle the current user’s player repeat status. If device_id is not passed, the currently active spotify app will be triggered. If state is not passed, the currently active context will be set to repeat.

Examples:

player = user.player
player.repeat(state: 'track')

Parameters:

  • device_id (String) (defaults to: nil)

    the ID of the device to set the repeat state on.

  • state (String) (defaults to: "context")

    the repeat state. Defaults to the current play context.

See Also:



119
120
121
122
123
124
125
# File 'lib/rspotify/player.rb', line 119

def repeat(device_id: nil, state: "context")
  url = "me/player/repeat"
  url += "?state=#{state}"
  url += "&device_id=#{device_id}" if device_id

  User.oauth_put(@user.id, url, {})
end