Skip to content

Commit

Permalink
fixed SUPPORT_SEEK
Browse files Browse the repository at this point in the history
  • Loading branch information
KoljaWindeler committed Jan 11, 2024
1 parent ad12df0 commit 4ac3e23
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions custom_components/ytube_music_player/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -1003,7 +1003,7 @@ async def async_select_source(self, source=None):
# seek, if possible
new_player = self.hass.states.get(self._remote_player)
if (all(a in old_player.attributes for a in ('media_position', 'media_position_updated_at', 'media_duration')) and 'supported_features' in new_player.attributes):
if(new_player.attributes['supported_features'] | SUPPORT_SEEK):
if(new_player.attributes['supported_features'] | MediaPlayerEntityFeature.SEEK):
now = datetime.datetime.now(datetime.timezone.utc)
delay = now - old_player.attributes['media_position_updated_at']
pos = delay.total_seconds() + old_player.attributes['media_position']
Expand Down Expand Up @@ -1813,7 +1813,7 @@ async def async_call_method(self, command=None, parameters=None):
await self.async_get_track()
if('pos' in self._interrupt_data):
player = self.hass.states.get(self._remote_player)
if(player.attributes['supported_features'] | SUPPORT_SEEK):
if(player.attributes['supported_features'] | MediaPlayerEntityFeature.SEEK):
data = {'seek_position': self._interrupt_data['pos'], ATTR_ENTITY_ID: self._remote_player}
await self.hass.services.async_call(DOMAIN_MP, media_player.SERVICE_MEDIA_SEEK, data)
self._interrupt_data['pos'] = None
Expand Down

0 comments on commit 4ac3e23

Please sign in to comment.