Skip to content

Commit

Permalink
Add set_playback_rate method
Browse files Browse the repository at this point in the history
  • Loading branch information
n18abdel committed Oct 3, 2022
1 parent 7e215c2 commit 22f47c4
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pychromecast/controllers/media.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
TYPE_QUEUE_PREV = "QUEUE_PREV"
TYPE_QUEUE_UPDATE = "QUEUE_UPDATE"
TYPE_SEEK = "SEEK"
TYPE_SET_PLAYBACK_RATE = "SET_PLAYBACK_RATE"
TYPE_STOP = "STOP"

METADATA_TYPE_GENERIC = 0
Expand Down Expand Up @@ -670,6 +671,15 @@ def seek(self, position):
}
)

def set_playback_rate(self, playback_rate):
"""Set the playback rate. 1.0 is regular time, 0.5 is slow motion."""
self._send_command(
{
MESSAGE_TYPE: TYPE_SET_PLAYBACK_RATE,
"playbackRate": playback_rate,
}
)

def queue_next(self):
"""Send the QUEUE_NEXT command."""
self._send_command({MESSAGE_TYPE: TYPE_QUEUE_UPDATE, "jump": 1})
Expand Down

0 comments on commit 22f47c4

Please sign in to comment.