seek method

Future<void> seek(
  1. Duration position
)

Seek to position in current track

Implementation

Future<void> seek(Duration position) async {
  if (_sessionId == null) {
    throw Exception('No active session');
  }
  if (_currentTrack == null) {
    LavalinkLogger.warning('Cannot seek: no track playing', tag: 'Player');
    return;
  }

  LavalinkLogger.info('Seeking to ${position.inSeconds}s', tag: 'Player');

  final update = PlayerUpdate(position: position.inMilliseconds);
  await restClient.updatePlayer(_sessionId!, guildId, update);
  _position = position;
}