createMediaInformationSession static method

Future<MediaInformationSession> createMediaInformationSession(
  1. List<String> argumentsArray
)

Creates a new MediaInformation session using argumentsArray.

Returns MediaInformation session created.

Implementation

static Future<MediaInformationSession> createMediaInformationSession(
  List<String> argumentsArray,
) async {
  try {
    await FFmpegKitConfig.init();
    final Map<dynamic, dynamic>? nativeSession = await _platform
        .abstractSessionCreateMediaInformationSession(argumentsArray);
    final session = new MediaInformationSession();

    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.neverPrintLogs;

    FFmpegKitFactory.setLogRedirectionStrategy(
      session._sessionId,
      LogRedirectionStrategy.neverPrintLogs,
    );

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