Update server.js
Browse files
server.js
CHANGED
|
@@ -19,23 +19,31 @@ app.post('/render', async (req, res) => {
|
|
| 19 |
|
| 20 |
const composition = await selectComposition({
|
| 21 |
serveUrl: bundled,
|
| 22 |
-
id: 'VideoComposition', //
|
| 23 |
inputProps,
|
|
|
|
|
|
|
|
|
|
| 24 |
});
|
| 25 |
|
|
|
|
|
|
|
| 26 |
const outputPath = path.join(OUTPUT_DIR, `${composition.id}.mp4`);
|
| 27 |
|
| 28 |
await renderMedia({
|
| 29 |
serveUrl: bundled,
|
| 30 |
composition,
|
| 31 |
outputLocation: outputPath,
|
| 32 |
-
chromiumOptions: {
|
|
|
|
|
|
|
|
|
|
| 33 |
inputProps,
|
| 34 |
});
|
| 35 |
|
| 36 |
res.download(outputPath);
|
| 37 |
} catch (err) {
|
| 38 |
-
console.error(err);
|
| 39 |
res.status(500).json({ error: err.message });
|
| 40 |
}
|
| 41 |
});
|
|
|
|
| 19 |
|
| 20 |
const composition = await selectComposition({
|
| 21 |
serveUrl: bundled,
|
| 22 |
+
id: 'VideoComposition', // MUST MATCH your index.tsx Composition id
|
| 23 |
inputProps,
|
| 24 |
+
onBrowserDownload: (progress) => {
|
| 25 |
+
console.log(`Chrome download progress: ${progress.percent.toFixed(2)}%`);
|
| 26 |
+
},
|
| 27 |
});
|
| 28 |
|
| 29 |
+
console.log('=== SCENES TO RENDER ===', inputProps.script?.scenes || []);
|
| 30 |
+
|
| 31 |
const outputPath = path.join(OUTPUT_DIR, `${composition.id}.mp4`);
|
| 32 |
|
| 33 |
await renderMedia({
|
| 34 |
serveUrl: bundled,
|
| 35 |
composition,
|
| 36 |
outputLocation: outputPath,
|
| 37 |
+
chromiumOptions: {
|
| 38 |
+
enableMultiProcessOnLinux: true,
|
| 39 |
+
args: ['--no-sandbox', '--disable-setuid-sandbox'],
|
| 40 |
+
},
|
| 41 |
inputProps,
|
| 42 |
});
|
| 43 |
|
| 44 |
res.download(outputPath);
|
| 45 |
} catch (err) {
|
| 46 |
+
console.error('Render error:', err);
|
| 47 |
res.status(500).json({ error: err.message });
|
| 48 |
}
|
| 49 |
});
|