listMediaInformationSessions static method

Future<List<MediaInformationSession>> listMediaInformationSessions()

Lists all MediaInformation sessions in the session history.

Implementation

static Future<List<MediaInformationSession>>
    listMediaInformationSessions() async {
  try {
    await FFmpegKitConfig.init();
    return _platform
        .ffprobeKitListMediaInformationSessions()
        .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 MediaInformationSession)
            .toList();
      }
    });
  } on PlatformException catch (e, stack) {
    print("Plugin listMediaInformationSessions error: ${e.message}");
    return Future.error("listMediaInformationSessions failed.", stack);
  }
}