onCurrentPlaybackTimeUpdate property

void Function(Duration position)? get onCurrentPlaybackTimeUpdate

Called with the current, non-negative playback position.

Assigning a non-null callback enables native playback-time events after the player is created. Assigning null disables them. closeAsync stops native delivery but preserves this callback for a later createPlayer.

Implementation

void Function(Duration position)? get onCurrentPlaybackTimeUpdate =>
    _onCurrentPlaybackTimeUpdate;
set onCurrentPlaybackTimeUpdate (void callback(Duration position)?)

Implementation

set onCurrentPlaybackTimeUpdate(void Function(Duration position)? callback) {
  final wasEnabled = _onCurrentPlaybackTimeUpdate != null;
  final isEnabled = callback != null;
  _onCurrentPlaybackTimeUpdate = callback;
  if (_playerIsCreated && wasEnabled != isEnabled) {
    unawaited(_setPlaybackTimeUpdateEnabled(isEnabled));
  }
}