correctedElapsedTime property

double? get correctedElapsedTime

Return the corrected/realtime elapsed time.

Implementation

double? get correctedElapsedTime {
  if (elapsedTime == null || elapsedTimeLastUpdated == null) return null;
  if (playbackState == PlaybackState.playing) {
    final now = DateTime.now().millisecondsSinceEpoch / 1000.0;
    return elapsedTime! + (now - elapsedTimeLastUpdated!);
  }
  return elapsedTime;
}