seek method
Moves the playhead.
The seek is accurate to the sample on WAV, and to approximately 26 ms on MP3. An MP3 seek goes to a frame boundary and then decodes forward.
The session erases the frames that the ring queued ahead of the playhead. Therefore, the device gets a few milliseconds of silence, and not a few milliseconds of audio from the old position.
Implementation
@override
Future<void> seek(Duration position) async {
if (_disposed) throw StateError('This playback session was disposed.');
seeks.add(position);
_position = position < Duration.zero
? Duration.zero
: (position > duration ? duration : position);
}