seek method
Seeks to a playback position.
May be used while either playing or paused. Returns when the seek is complete.
Implementation
Future<void> seek(double positionSeconds) async {
if (!_undisposedAudios.containsKey(_audioId)) {
_logger.severe('Called seek() on a disposed Audio');
return;
}
try {
await _sendMethodCall(_audioId, seekMethod, <String, dynamic>{
audioIdKey: _audioId,
positionSecondsKey: positionSeconds
});
} on PlatformException catch (e) {
if (_usingOnErrorAudios.containsKey(_audioId)) {
// Audio has an onError callback.
_usingOnErrorAudios[_audioId]!._onError!(e.message);
} else {
// Audio does not use an onError callback: rethrow the exception.
rethrow;
}
}
}