seekTo method
Seek to a specific position.
position
is the position to seek to in milliseconds.
Implementation
bool seekTo(int position) {
if (!disposed && id.value != null) {
if (mediaInfo.value == null) {
if (loading.value) {
_position = position;
return true;
}
} else if (mediaInfo.value!.duration > 0) {
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;
_seeking = true;
return true;
}
}
return false;
}