polotno-node 2.6.7 → 2.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -10
- package/dist/assets/{index-1a4d47fd.js → index-13b6e0f3.js} +57 -57
- package/dist/index.html +1 -1
- package/index.js +11 -8
- package/package.json +7 -6
- package/video-parallel.js +254 -0
- package/video.js +22 -4
package/README.md
CHANGED
|
@@ -254,20 +254,27 @@ npm install fluent-ffmpeg axios
|
|
|
254
254
|
|
|
255
255
|
```js
|
|
256
256
|
import { createInstance } from 'polotno-node';
|
|
257
|
-
import { jsonToVideo } from 'polotno-node/video';
|
|
258
|
-
|
|
259
|
-
// create working instance
|
|
260
|
-
const instance = await createInstance({
|
|
261
|
-
key: '...key...',
|
|
262
|
-
});
|
|
257
|
+
import { jsonToVideo } from 'polotno-node/video-parallel';
|
|
263
258
|
|
|
264
259
|
// load sample json
|
|
265
260
|
const json = JSON.parse(fs.readFileSync('./test-data/video.json'));
|
|
266
|
-
const page = await instance.createPage();
|
|
267
|
-
|
|
268
|
-
await jsonToVideo(page, json, { out: 'out.mp4' });
|
|
269
261
|
|
|
270
|
-
await
|
|
262
|
+
await jsonToVideo(
|
|
263
|
+
// first argument is a function that returns an instance
|
|
264
|
+
// it can be a new instance on every call (useful for parallel rendering on local machine)
|
|
265
|
+
// or it can be a single instance (useful for cloud functions)
|
|
266
|
+
() =>
|
|
267
|
+
createInstance({
|
|
268
|
+
key: '...key...',
|
|
269
|
+
}),
|
|
270
|
+
json,
|
|
271
|
+
{
|
|
272
|
+
out: 'out.mp4', // output file name
|
|
273
|
+
parallel: 4, // number of parallel rendering processes
|
|
274
|
+
fps: 15, // frames per second
|
|
275
|
+
keepInstance: false, // keep instance open after rendering, make sure to use true if use just one instance
|
|
276
|
+
}
|
|
277
|
+
);
|
|
271
278
|
```
|
|
272
279
|
|
|
273
280
|
## Your own client
|