setMaxDuration method

Future setMaxDuration(
  1. String path
)

Sets the maximum duration of the voice.

Implementation

Future setMaxDuration(String path) async {
  try {
    /// get the max duration from the path or cloud
    final maxDuration =
        isFile ? await _player.setFilePath(path) : await _player.setUrl(path);
    if (maxDuration != null) {
      this.maxDuration = maxDuration;
      animController.duration = maxDuration;
    }
  } catch (err) {
    if (kDebugMode) {
      ///
      debugPrint("cant get the max duration from the path $path");
    }
    if (onError != null) {
      onError!(err);
    }
  }
}