Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Render projects headlessly #415

Open
spaghetus opened this issue Feb 25, 2023 · 7 comments · May be fixed by #595
Open

Render projects headlessly #415

spaghetus opened this issue Feb 25, 2023 · 7 comments · May be fixed by #595
Labels
a-core Relates to the core package b-enhancement New feature or request c-accepted The issue is ready to be worked on

Comments

@spaghetus
Copy link

Description
It would be useful to be able to render a project from a shell script or in CI, without a human to operate a web browser. I'm not sure if this feature is already present; if it is, I can't find it in the documentation.

Proposed solution
A render script in package.json would be ideal, with a configuration file to set the parameters for the render. I don't know anything about the project's inner workings, so I don't think I can be more detailed than that.

Considered alternatives
Making a program that launches a headless browser to start the render is possible, but probably not ideal.

@aarthificial
Copy link
Contributor

Headless rendering will be made possible after #402
It will be implemented as a separate package, though. With the ability to opt-in when running npm init @motion-canvas
This way normal users who don't need cli rendering won't be forced to install headless chrome, which is a quite heavy dependency.

@aarthificial aarthificial added b-enhancement New feature or request a-core Relates to the core package labels Feb 25, 2023
@therealtimhawkins
Copy link
Contributor

Hey @aarthificial, do you know if anyone is currently working on this? Would it be useful for me to pick it up? Really happy to if needed 💪

@aarthificial
Copy link
Contributor

aarthificial commented Mar 27, 2023

@therealtimhawkins If you feel up to it please go ahead.
The Renderer class takes care of all the logic related to rendering. You can also take a look at the e2e package for an example of using Puppeteer with Motion Canvas.

I propose we name the new package @motion-canvas/renderer
Ideally, it should be able to render both compiled projects (the result of running npm run build) and raw projects directly.

@therealtimhawkins
Copy link
Contributor

Haha you've made me nervous! I'll take a look and get back to you with any issues 😅

@aarthificial aarthificial removed their assignment Mar 27, 2023
@aarthificial aarthificial added the c-accepted The issue is ready to be worked on label Mar 27, 2023
@therealtimhawkins
Copy link
Contributor

Any chance you could give me an idea of how you see it being implemented Jacob?

Are you thinking a new vite-plugin specifically for the renderer?

I saw there is a PR open for a motion canvas CLI, were you thinking of this as using this as the interface?

@aarthificial
Copy link
Contributor

CLI is a package for code generation, this should be a separate thing.

I think the current Vite plugin should be extended to account for headless rendering.
For example, right now visiting localhost:9000/projectName opens the editor for a given project, perhaps localhost:9000/projectName/render could open the project in a headless rendering mode.
The renderer package could then run Vite together with our plugin and use Puppeteer to visit projectName/render.

@therealtimhawkins
Copy link
Contributor

Makes sense, thanks mate 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a-core Relates to the core package b-enhancement New feature or request c-accepted The issue is ready to be worked on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants