async def set_playstate(self, state, pos=0):
        """ Send media commands to server. """
        url = '{}/Sessions/{}/Playing/{}'.format(
            self.server.construct_url(API_URL), self.session_id, state)
        params = {'api_key': self.server.api_key}

        if state == 'seek':
            params['SeekPositionTicks'] = int(pos * 10000000)
            params['static'] = 'true'

        _LOGGER.debug('Playstate URL: %s', url)

        post = await self.server.api_post(url, params)
        if post is None:
            _LOGGER.debug('Error sending command.')
        else:
            _LOGGER.debug('Post response: %s', post)