getMediaInformationFromCommandArgumentsAsync static method

Future<MediaInformationSession> getMediaInformationFromCommandArgumentsAsync(
  1. List<String> commandArguments, [
  2. MediaInformationSessionCompleteCallback? completeCallback = null,
  3. LogCallback? logCallback = null,
  4. int? waitTimeout = null,
])

Starts an asynchronous FFprobe execution to extract media information using command arguments. The command passed to this method must generate the output in JSON format in order to successfully extract media information from it.

Note that this method returns immediately and does not wait the execution to complete. You must use an MediaInformationSessionCompleteCallback if you want to be notified about the result.

Implementation

static Future<MediaInformationSession>
    getMediaInformationFromCommandArgumentsAsync(
        List<String> commandArguments,
        [MediaInformationSessionCompleteCallback? completeCallback = null,
        LogCallback? logCallback = null,
        int? waitTimeout = null]) async {
  final session = await MediaInformationSession.create(
      commandArguments, completeCallback, logCallback);

  await FFmpegKitConfig.asyncGetMediaInformationExecute(session, waitTimeout);

  final mediaInformation = await _platform
      .mediaInformationSessionGetMediaInformation(session.getSessionId())
      .then(FFmpegKitFactory.mapToNullableMediaInformation);
  if (mediaInformation != null) {
    session.setMediaInformation(mediaInformation);
  }

  return session;
}