getDuration method

Future<int> getDuration([
  1. DurationType? durationType
])

Return maximum duration for DurationType.max and current duration for DurationType.current for playing content. The duration is in milliseconds, if no duration is available -1 is returned.

Default is Duration.max

Implementation

Future<int> getDuration([DurationType? durationType]) async {
  final duration = await AudioWaveformsInterface.instance
      .getDuration(_playerKey.toString(), durationType?.index ?? 1);
  return duration ?? -1;
}