getFFmpegSessions static method

Future<List<FFmpegSession>> getFFmpegSessions()

Returns all FFmpeg sessions in the session history.

Implementation

static Future<List<FFmpegSession>> getFFmpegSessions() async {
  try {
    await FFmpegKitConfig.init();
    return _platform.ffmpegKitListSessions().then((sessions) {
      if (sessions == null) {
        return List.empty();
      } else {
        return sessions
            .map((dynamic sessionObject) => FFmpegKitFactory.mapToSession(
                sessionObject as Map<dynamic, dynamic>))
            .map((session) => session as FFmpegSession)
            .toList();
      }
    });
  } on PlatformException catch (e, stack) {
    print("Plugin getFFmpegSessions error: ${e.message}");
    return Future.error("getFFmpegSessions failed.", stack);
  }
}