getAllStatistics method

Future<List<Statistics>> getAllStatistics([
  1. int? waitTimeout
])

Returns all statistics entries generated for this session. If there are asynchronous statistics that are not delivered yet, this method waits for them until waitTimeout.

Implementation

Future<List<Statistics>> getAllStatistics([int? waitTimeout]) async {
  try {
    await FFmpegKitConfig.init();
    return FFmpegKitPlatform.instance
        .ffmpegSessionGetAllStatistics(this.getSessionId(), waitTimeout)
        .then((allStatistics) {
      if (allStatistics == null) {
        return List.empty();
      } else {
        return allStatistics
            .map((dynamic statisticsObject) =>
                FFmpegKitFactory.mapToStatistics(
                    statisticsObject as Map<dynamic, dynamic>))
            .toList();
      }
    });
  } on PlatformException catch (e, stack) {
    print("Plugin getAllStatistics error: ${e.message}");
    return Future.error("getAllStatistics failed.", stack);
  }
}