getMediaInformationFromCommandArguments static method

Future<MediaInformationSession> getMediaInformationFromCommandArguments(
  1. List<String> commandArguments, [
  2. int? waitTimeout = null
])

Extracts media information using the command arguments provided. The command passed to this method must generate the output in JSON format in order to successfully extract media information from it.

Implementation

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

  await FFmpegKitConfig.getMediaInformationExecute(session, waitTimeout);

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

  return session;
}