Class: Rocksky::Resources::Player
- Defined in:
- lib/rocksky/resources/player.rb
Overview
‘app.rocksky.player.*` endpoints — remote control of a Rocksky player.
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#add_items_to_queue(items:, player_id: nil, position: nil, shuffle: nil) ⇒ Object
Append items to the queue.
-
#get_currently_playing(player_id: nil, actor: nil) ⇒ Object
Currently playing track.
-
#get_playback_queue(player_id: nil) ⇒ Object
Playback queue.
-
#next(player_id: nil) ⇒ Object
Skip to next track.
-
#pause(player_id: nil) ⇒ Object
Pause playback.
-
#play(player_id: nil) ⇒ Object
Resume playback.
-
#play_directory(directory_id:, player_id: nil, shuffle: nil, recurse: nil, position: nil) ⇒ Object
Play a directory.
-
#play_file(file_id:, player_id: nil) ⇒ Object
Play a single file.
-
#previous(player_id: nil) ⇒ Object
Go to previous track.
-
#seek(position:, player_id: nil) ⇒ Object
Seek to position in milliseconds.
Methods inherited from Base
Constructor Details
This class inherits a constructor from Rocksky::Resources::Base
Instance Method Details
#add_items_to_queue(items:, player_id: nil, position: nil, shuffle: nil) ⇒ Object
Append items to the queue. ‘items` is an Array of file identifiers.
62 63 64 65 66 67 68 69 70 |
# File 'lib/rocksky/resources/player.rb', line 62 def add_items_to_queue(items:, player_id: nil, position: nil, shuffle: nil) procedure("app.rocksky.player.addItemsToQueue", params: { playerId: player_id, items: items, position: position, shuffle: shuffle }) end |
#get_currently_playing(player_id: nil, actor: nil) ⇒ Object
Currently playing track.
6 7 8 9 |
# File 'lib/rocksky/resources/player.rb', line 6 def (player_id: nil, actor: nil) query("app.rocksky.player.getCurrentlyPlaying", playerId: player_id, actor: actor) end |
#get_playback_queue(player_id: nil) ⇒ Object
Playback queue.
12 13 14 |
# File 'lib/rocksky/resources/player.rb', line 12 def get_playback_queue(player_id: nil) query("app.rocksky.player.getPlaybackQueue", playerId: player_id) end |
#next(player_id: nil) ⇒ Object
Skip to next track.
27 28 29 |
# File 'lib/rocksky/resources/player.rb', line 27 def next(player_id: nil) procedure("app.rocksky.player.next", params: { playerId: player_id }) end |
#pause(player_id: nil) ⇒ Object
Pause playback.
22 23 24 |
# File 'lib/rocksky/resources/player.rb', line 22 def pause(player_id: nil) procedure("app.rocksky.player.pause", params: { playerId: player_id }) end |
#play(player_id: nil) ⇒ Object
Resume playback.
17 18 19 |
# File 'lib/rocksky/resources/player.rb', line 17 def play(player_id: nil) procedure("app.rocksky.player.play", params: { playerId: player_id }) end |
#play_directory(directory_id:, player_id: nil, shuffle: nil, recurse: nil, position: nil) ⇒ Object
Play a directory.
49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/rocksky/resources/player.rb', line 49 def play_directory(directory_id:, player_id: nil, shuffle: nil, recurse: nil, position: nil) procedure("app.rocksky.player.playDirectory", params: { playerId: player_id, directoryId: directory_id, shuffle: shuffle, recurse: recurse, position: position }) end |
#play_file(file_id:, player_id: nil) ⇒ Object
Play a single file.
43 44 45 46 |
# File 'lib/rocksky/resources/player.rb', line 43 def play_file(file_id:, player_id: nil) procedure("app.rocksky.player.playFile", params: { playerId: player_id, fileId: file_id }) end |
#previous(player_id: nil) ⇒ Object
Go to previous track.
32 33 34 |
# File 'lib/rocksky/resources/player.rb', line 32 def previous(player_id: nil) procedure("app.rocksky.player.previous", params: { playerId: player_id }) end |
#seek(position:, player_id: nil) ⇒ Object
Seek to position in milliseconds.
37 38 39 40 |
# File 'lib/rocksky/resources/player.rb', line 37 def seek(position:, player_id: nil) procedure("app.rocksky.player.seek", params: { playerId: player_id, position: position }) end |