seekToTimeMs method

Future<void> seekToTimeMs({
  1. required double time,
  2. void seekCompleted(
    1. bool
    )?,
  3. void seekRenderCompleted()?,
})

seek to time.

  • time Unit: milliseconds.
  • seekCompleted
  • seekRenderCompleted

Implementation

Future<void> seekToTimeMs(
    {required double time, void Function(bool)? seekCompleted, void Function()? seekRenderCompleted}) async {
  _seekSerialNo += 1;
  final callbackId = '${hashCode}_$_seekSerialNo';
  if (seekCompleted != null) {
    if (_seekCompletedCallbacks[hashCode] == null) {
      _seekCompletedCallbacks[hashCode] = {};
    }
    _seekCompletedCallbacks[hashCode]![callbackId] = seekCompleted;
  }
  if (seekRenderCompleted != null) {
    if (_seekRenderCompletedCallbacks[hashCode] == null) {
      _seekRenderCompletedCallbacks[hashCode] = {};
    }
    _seekRenderCompletedCallbacks[hashCode]![callbackId] = seekRenderCompleted;
  }
  await engineInstanceMethodChannel.invokeMethod('setCurrentPlaybackTime', {
    'time': time,
    'seekSerialNo': _seekSerialNo,
  });
}