polotno-node 2.9.25 → 2.9.26
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/package.json +1 -1
- package/video-parallel.js +2 -10
package/package.json
CHANGED
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
|
);
|