seekTo method
Seek to a specific position.
position: The position to seek to in milliseconds.
Implementation
bool seekTo(int position) {
if (id.value != null) {
if (mediaInfo.value != null) {
if (position < 0) {
position = 0;
} else if (position > mediaInfo.value!.duration) {
position = mediaInfo.value!.duration;
}
_methodChannel.invokeMethod('seekTo', {
'id': id.value,
'value': position,
});
loading.value = true;
_seeked = true;
return true;
} else if (loading.value) {
_position = position;
return true;
}
}
return false;
}