getStatistics method

Future<List<Statistics>> getStatistics()

Returns all statistics entries delivered for this session. Note that if there are asynchronous statistics that are not delivered yet, this method will not wait for them and will return immediately.

Implementation

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