inlife / nexrender

📹 Data-driven render automation for After Effects
https://www.nexrender.com
MIT License
1.62k stars 326 forks source link

in react Is there a way to check the rendering process in percentage? #945

Closed DongJu-Na closed 10 months ago

DongJu-Na commented 10 months ago

Thank you in advance.

in react Is there a way to check the rendering process in percentage?

My current environment is

react -> nexrender-server <-> nexrender-worker

const { createClient } = require('@nexrender/api')

const client = createClient({
    host: 'http://my.server.com:3050',
    secret: 'myapisecret',
})

const main = async () => {
    const result = await client.addJob({
        template: {
            src: 'http://my.server.com/assets/project.aep',
            composition: 'main',
        }
    })

    result.on('created', job => console.log('project has been created'))
    result.on('started', job => console.log('project rendering started'))
    result.on('progress', (job, percents) => console.log('project is at: ' + percents + '%'))
    result.on('finished', job => console.log('project rendering finished'))
    result.on('error', err => console.log('project rendering error', err))
}

main().catch(console.error);

Is there a way to run the code snippet above in React?

DongJu-Na commented 10 months ago

localhost:3000/api/v1/jobs/7pYqQK1P48WdbCFRJKpy7/status

Can you tell me why the percentage keeps being 0?

To inform clients of progress in real time What modules should I use? I'm trying to build a server using express.

Currently only workers and servers are used.

{
    "uid": "7pYqQK1P48WdbCFRJKpy7",
    "state": "finished",
    "type": "default",
    "tags": null,
    "renderProgress": 0,
    "error": null,
    "createdAt": "2023-12-05T03:31:00.119Z",
    "updatedAt": "2023-12-05T03:36:47.233Z",
    "startedAt": "2023-12-05T03:31:09.061Z",
    "finishedAt": "2023-12-05T03:36:47.215Z",
    "errorAt": null,
    "jobCreator": "::1",
    "jobExecutor": "::1"
}
inlife commented 10 months ago

Something went wrong, it seems like the worker is not updating the renderProgress Could you try using a different version of the worker to see if that helps?

inlife commented 10 months ago

Also, could you send the contents of AE your Render Log for this particular job file here?

DongJu-Na commented 10 months ago

@inlife

AE 2023-12-05 오전 11-46-36_temp.txt

I am attaching a file.

Is there a way to notify react of the progress using only nexrender-worker and nexrender-server?

If so, do you use express? Could you please organize the modules I need to use? ex) nexrender-api

inlife commented 10 months ago

I see the problem, it's related to regex that parses the timecodes, seems like it gets confused when sees that symbol at the end of the string. What does it mean?

image

DongJu-Na commented 10 months ago

@inlife

It means second in Korean.

I know you are busy, but could you please answer my question??

Is there a way to notify react of the progress using only nexrender-worker and nexrender-server?

If so, do you use express? Could you please organize the modules I need to use?
ex) nexrender-api

I want to make the most of this open source. It's so perfect thank you

inlife commented 10 months ago

So the reason why react frontend and nexrender server do not get a proper percentage value from the worker is the cause of that symbol.

We need to fix it on the worker side so that the number can be parsed appropriately and sent to the server -> react app.

inlife commented 10 months ago

Alternatively, if you want a quick solution, you could try switching your After Effects to english language.

DongJu-Na commented 10 months ago

@inlife

Okay, let me check it. If you want to know the progress in real-time from nexrender-server, you need to add websocket communication, right

We will address this issue as soon as it is confirmed.

thank you

inlife commented 10 months ago

The API client polls the nexrender server quite often, but you can change the polling time to 1 second and it should give you good enough results on the progress.

DongJu-Na commented 10 months ago

@inlife

in a reactive environment nexrender/api-client I understand that it is not possible to use it.