createFFmpegSession static method
Future<FFmpegSession>
createFFmpegSession(
- List<
String> argumentsArray, [ - LogRedirectionStrategy? logRedirectionStrategy = null
Creates a new FFmpeg session using argumentsArray
and
logRedirectionStrategy
.
Returns FFmpeg session created.
Implementation
static Future<FFmpegSession> createFFmpegSession(List<String> argumentsArray,
[LogRedirectionStrategy? logRedirectionStrategy = null]) async {
try {
await FFmpegKitConfig.init();
final Map<dynamic, dynamic>? nativeSession =
await _platform.abstractSessionCreateFFmpegSession(argumentsArray);
final session = new FFmpegSession();
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 createFFmpegSession error: ${e.message}");
return Future.error("createFFmpegSession failed.", stack);
}
}