-
-
Notifications
You must be signed in to change notification settings - Fork 321
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
help-wanted
2 or more projects
#41
Comments
Hello, What do you mean by "one-run" ? |
I mean like "node start.js" and it results 2+ projects by one run. For example, i have one template and i want to make 3 videos for 3 countries. The things are the same, just images are different. So I have this: let project = new Project(
{
"template": "projektaz.aepx",
"composition": "comp1",
"type": "default",
"settings": {
"outputModule": "Lossless"
},
"assets": [
{ "type": "project", "name": "projektass.aepx", "src": `http://localhost:${port}/assets/${aepxfile}`}, //1024x683 / 1280 720
{ "type": "image", "name": "Fotolia_45139233_Subscription_Monthly_M.jpg", "src": `http://localhost:${port}/assets/${background1}`, "filters": [ {"name":"cover", "params": [1688, 1126] }] },
{ "type": "image", "name": "Fotolia_82766733_Subscription_Monthly_M.jpg", "src": `http://localhost:${port}/assets/${background2}`, "filters": [ {"name":"cover", "params": [1688, 1126] }] },
{ "type": "image", "name": "Fotolia_85037185_Subscription_Monthly_M.jpg", "src": `http://localhost:${port}/assets/${background3}`, "filters": [ {"name":"cover", "params": [1688, 1126] }] },
]
}
); and this is the data for one video, but i want 3 videos f.ex. I tried to create 3 new let's for project class, but it renders just first one and he skips other two. I'm still a Junior dev so sorry in advance.. 🥇 |
oh i see // start rendering
renderer.render(aebinary, project1).then(() => console.log('project1 finished')).catch(err => console.error(err));
renderer.render(aebinary, project2).then(() => console.log('project2 finished')).catch(err => console.error(err));
renderer.render(aebinary, project3).then(() => console.log('project3 finished')).catch(err => console.error(err)); also, if you i suggest you to read more about js |
I've came across it before, but I'm trying to figure out f.ex. if i have 200+ videos or unknown ammount and use some alternative like |
oh in case if you need variable amount of videos to render i can suggest you something like this: let projects = []; // lets say this is array with Project objects
function render() {
if (!projects.length) {
return console.log('no more projects');
}
// otherwise take project and start rendering
let project = projects.pop();
// after finish or error, it will pick up next item recursively and start rendering
renderer.render(aebinary, project).then(() => {
console.log('one of the projects finished'); render()
}).catch(err => {
console.error('error happened in one of the projects', err); render()
})
}
// start 3 rendering queues
for (var i = 0; i < 3; i++) {
render();
} |
Just a small fix for your code: instead of only using array.pop: You have to initiate a new class since your project.js requires it: IT works perfectly. now I'm going to try solve the project naming challenge and saving the templates instead of unlinking them after render. Thanks! |
Hey there, maybe you have some sort of example/code snippet how to make 2 or more projects by one run? Thanks!
The text was updated successfully, but these errors were encountered: