From 86cf184903a48c6c7e5822223f5e3e8110481e6e Mon Sep 17 00:00:00 2001 From: Lasath Fernando Date: Sun, 22 Nov 2020 05:05:15 -0800 Subject: [PATCH] Add seek support to plex media players (#43420) Turns out plexapi lib already supports this, so we just need to pass through the command. --- homeassistant/components/plex/media_player.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/homeassistant/components/plex/media_player.py b/homeassistant/components/plex/media_player.py index 94bed1db7de..5f72b912a70 100644 --- a/homeassistant/components/plex/media_player.py +++ b/homeassistant/components/plex/media_player.py @@ -17,6 +17,7 @@ from homeassistant.components.media_player.const import ( SUPPORT_PLAY, SUPPORT_PLAY_MEDIA, SUPPORT_PREVIOUS_TRACK, + SUPPORT_SEEK, SUPPORT_STOP, SUPPORT_VOLUME_MUTE, SUPPORT_VOLUME_SET, @@ -494,6 +495,7 @@ class PlexMediaPlayer(MediaPlayerEntity): | SUPPORT_PREVIOUS_TRACK | SUPPORT_NEXT_TRACK | SUPPORT_STOP + | SUPPORT_SEEK | SUPPORT_VOLUME_SET | SUPPORT_PLAY | SUPPORT_PLAY_MEDIA @@ -557,6 +559,11 @@ class PlexMediaPlayer(MediaPlayerEntity): if self.device and "playback" in self._device_protocol_capabilities: self.device.stop(self._active_media_plexapi_type) + def media_seek(self, position): + """Send the seek command.""" + if self.device and "playback" in self._device_protocol_capabilities: + self.device.seekTo(position * 1000, self._active_media_plexapi_type) + def media_next_track(self): """Send next track command.""" if self.device and "playback" in self._device_protocol_capabilities: