createFFprobeSession static method

Future<FFprobeSession> createFFprobeSession(
  1. List<String> argumentsArray, [
  2. LogRedirectionStrategy? logRedirectionStrategy = null
])

Creates a new FFprobe session using argumentsArray and logRedirectionStrategy.

Returns FFprobe session created.

Implementation

static Future<FFprobeSession> createFFprobeSession(
    List<String> argumentsArray,
    [LogRedirectionStrategy? logRedirectionStrategy = null]) async {
  try {
    await FFmpegKitConfig.init();
    final Map<dynamic, dynamic>? nativeSession =
        await _platform.abstractSessionCreateFFprobeSession(argumentsArray);

    final session = new FFprobeSession();

    session._sessionId = nativeSession?["sessionId"];
    session._createTime =
        FFmpegKitFactory.validDate(nativeSession?["createTime"]);
    session._startTime =
        FFmpegKitFactory.validDate(nativeSession?["startTime"]);
    session._command = nativeSession?["command"];
    session._argumentsArray = argumentsArray;
    session._logRedirectionStrategy =
        logRedirectionStrategy ?? FFmpegKitConfig.getLogRedirectionStrategy();

    FFmpegKitFactory.setLogRedirectionStrategy(
        session._sessionId, logRedirectionStrategy);

    return session;
  } on PlatformException catch (e, stack) {
    print("Plugin createFFprobeSession error: ${e.message}");
    return Future.error("createFFprobeSession failed.", stack);
  }
}