polotno-node 2.9.25 → 2.9.27
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/dist/index.html
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
}
|
|
9
9
|
</style>
|
|
10
10
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
11
|
-
<script type="module" crossorigin src="./assets/index-
|
|
11
|
+
<script type="module" crossorigin src="./assets/index-e9srJuha.js"></script>
|
|
12
12
|
</head>
|
|
13
13
|
<body>
|
|
14
14
|
<div id="root"></div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "polotno-node",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.27",
|
|
4
4
|
"description": "Polotno workflow from NodeJS",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"gifencoder": "^2.0.1",
|
|
27
27
|
"pixelmatch": "^5.3.0",
|
|
28
28
|
"pngjs": "^7.0.0",
|
|
29
|
-
"polotno": "^2.
|
|
29
|
+
"polotno": "^2.9.2",
|
|
30
30
|
"react": "^18.3.1",
|
|
31
31
|
"react-dom": "^18.3.1",
|
|
32
32
|
"vite": "^5.2.11"
|
package/video-parallel.js
CHANGED
|
@@ -56,7 +56,7 @@ const fileToDataUrl = (filename) => {
|
|
|
56
56
|
});
|
|
57
57
|
};
|
|
58
58
|
|
|
59
|
-
const
|
|
59
|
+
const convertVideo = async (url, tempFolder) => {
|
|
60
60
|
const shortUrl = url.slice(0, 50) + '...';
|
|
61
61
|
console.log('Downloading video: ' + shortUrl);
|
|
62
62
|
const filename = Math.random().toString(36).substring(7);
|
|
@@ -75,14 +75,6 @@ const videoToDataURL = async (url, tempFolder) => {
|
|
|
75
75
|
};
|
|
76
76
|
};
|
|
77
77
|
|
|
78
|
-
const urlCache = {};
|
|
79
|
-
const cachedVideoToDataURL = async (url, tempFolder) => {
|
|
80
|
-
if (!urlCache[url]) {
|
|
81
|
-
urlCache[url] = videoToDataURL(url, tempFolder);
|
|
82
|
-
}
|
|
83
|
-
return urlCache[url];
|
|
84
|
-
};
|
|
85
|
-
|
|
86
78
|
module.exports.jsonToVideo = async function jsonToVideo(
|
|
87
79
|
inst,
|
|
88
80
|
json,
|
|
@@ -108,7 +100,7 @@ module.exports.jsonToVideo = async function jsonToVideo(
|
|
|
108
100
|
|
|
109
101
|
await Promise.all(
|
|
110
102
|
videoEls.map(async (el) => {
|
|
111
|
-
const { dataURL, file, mp4File } = await
|
|
103
|
+
const { dataURL, file, mp4File } = await convertVideo(
|
|
112
104
|
el.src,
|
|
113
105
|
tempFolder
|
|
114
106
|
);
|
|
@@ -299,6 +291,7 @@ module.exports.jsonToVideo = async function jsonToVideo(
|
|
|
299
291
|
|
|
300
292
|
ffmpegCmd
|
|
301
293
|
.format(format)
|
|
294
|
+
.audioCodec('aac')
|
|
302
295
|
.on('end', () => resolve())
|
|
303
296
|
.on('error', (err, stdout, stderr) => {
|
|
304
297
|
console.log(err.message);
|