getSessionsByState static method

Future<List<Session>> getSessionsByState(
  1. SessionState sessionState
)

Returns sessions that have sessionState.

Implementation

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