1
mirror of https://github.com/home-assistant/core synced 2024-09-12 15:16:21 +02:00

Add seek support to plex media players (#43420)

Turns out plexapi lib already supports this, so we just need to
pass through the command.
This commit is contained in:
Lasath Fernando 2020-11-22 05:05:15 -08:00 committed by GitHub
parent 62da64867c
commit 86cf184903
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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: