How do I use ffmpegkit in my React Native project to get a video stream and give it to my control to output

93 Views Asked by At

The code about FFmpegKit

FFmpegKit.executeAsync(ffmpegCommand).then(async (session) => {
            const state = FFmpegKitConfig.sessionStateToString(await session.getState());
            const returnCode = await session.getReturnCode();
            const failStackTrace = await session.getFailStackTrace();
            const output = await session.getOutput();
            console.log(output);
            ffprint(`FFmpeg process exited with state ${state} and rc ${returnCode}.${notNull(failStackTrace, "\\n")}`);

            this.appendOutput(output);

            if (state === SessionState.FAILED || !returnCode.isValueSuccess()) {
                ffprint("Command failed. Please check output for the details.");
            }
        });FFmpegKit.executeAsync(ffmpegCommand).then(async (session) => {
            const state = FFmpegKitConfig.sessionStateToString(await session.getState());
            const returnCode = await session.getReturnCode();
            const failStackTrace = await session.getFailStackTrace();
            const output = await session.getOutput();
            console.log(output);
            ffprint(`FFmpeg process exited with state ${state} and rc ${returnCode}.${notNull(failStackTrace, "\\n")}`);

            this.appendOutput(output);

            if (state === SessionState.FAILED || !returnCode.isValueSuccess()) {
                ffprint("Command failed. Please check output for the details.");
            }
        });

the ffmpegCommand:

        -i "https://open.ys7.com/v3/openlive/BA.m3u8" -c:v copy -bsf:v h264_mp4toannexb -f mpegts -

my consoloe output: console output

i'm trying to change ffmpegkit.execute to ffmpegkit.executeasync, but the session don't have about stream

0

There are 0 best solutions below