Closed illlama closed 4 months ago
const session = await FFmpegKit.executeAsync(ffmpegCommand);
const monitorSession = async (session: FFmpegSession) => {
while (true) {
const state = await session.getState();
const returnCode = await session.getReturnCode();
console.log(`FFmpegKit session state: ${state}, returnCode: ${returnCode}`);
if (state !== 1) {
return { returnCode, state };
}
await new Promise((resolve) => setTimeout(resolve, 1000));
}
};
const { returnCode, state } = await monitorSession(session);
I waited session to finish it's work.
session.getReturnCode() returns values, but session.getFailStackTrace() returns undefined.
As far as I see, everything is working as expected and as documented.
FFmpegKit.executeAsync()
returns immediately without waiting for the execution to complete. state 1
means your session is still running, which is why returnCode
, logs
and output
are all empty or undefined at that stage.
If you want to be notified about the result, then pass an FFmpegSessionCompleteCallback
callback to the executeAsync
method.
FFmpegKit.executeAsync(ffmpegCommand, async (session) => {
const sessionId = await session.getSessionId();
const state = FFmpegKitConfig.sessionStateToString(await session.getState());
const returnCode = await session.getReturnCode();
const failStackTrace = await session.getFailStackTrace();
}
)
Description I'm trying to use simple method that copy video that I recorded in another library. But the session.getReturnCode() and session.getFailStackTrace() returns undefined always. I know there's a closed same issue but there isn't answer I wanted.
Expected behavior return some returnCode and I hope to get a output too.
Current behavior
To Reproduce simplify a ffmpegCommand (I wanted to make a watermark on video)
Screenshots If applicable, add screenshots to help explain your problem.
Logs
Environment
ReactNative
arm64-6.0.2
v6.0.2
main
,development
15.3
1.15.2