setPlaybackTimeUpdateInterval method

Future<void> setPlaybackTimeUpdateInterval(
  1. Duration interval
)

Configures how often onCurrentPlaybackTimeUpdate is emitted.

interval must be between 1 and 2147483647 milliseconds, inclusive. Throws ArgumentError when interval is outside that range. Throws StateError when the player has not been created.

Implementation

Future<void> setPlaybackTimeUpdateInterval(Duration interval) async {
  final intervalMilliseconds = interval.inMilliseconds;
  if (interval <= Duration.zero ||
      intervalMilliseconds <= 0 ||
      intervalMilliseconds > 0x7fffffff) {
    throw ArgumentError.value(
      interval,
      'interval',
      'Playback time update interval must be between '
          '1 and 2147483647 milliseconds',
    );
  }
  if (_playerIsCreated == false) {
    throw StateError(
      'setPlaybackTimeUpdateInterval: player not created, '
      'please await createPlayer first',
    );
  }
  await engineInstanceMethodChannel.invokeMethod<void>(
    'setPlaybackTimeUpdateInterval',
    intervalMilliseconds,
  );
}