polotno-node 2.9.20 → 2.9.21

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "polotno-node",
3
- "version": "2.9.20",
3
+ "version": "2.9.21",
4
4
  "description": "Polotno workflow from NodeJS",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/video-parallel.js CHANGED
@@ -65,13 +65,13 @@ const videoToDataURL = async (url, tempFolder) => {
65
65
  console.log('Converting video to webm: ' + mp4Destination);
66
66
  const webmDestination = mp4Destination.replace('.mp4', '.webm');
67
67
  await convertToWebM(mp4Destination, webmDestination);
68
- fs.unlinkSync(mp4Destination);
69
68
  const dataURL = await fileToDataUrl(webmDestination);
70
69
 
71
70
  console.log('Converting video finished: ' + webmDestination);
72
71
  return {
73
72
  dataURL,
74
73
  file: webmDestination,
74
+ mp4File: mp4Destination,
75
75
  };
76
76
  };
77
77
 
@@ -102,12 +102,13 @@ module.exports.jsonToVideo = async function jsonToVideo(inst, json, attrs) {
102
102
 
103
103
  await Promise.all(
104
104
  videoEls.map(async (el) => {
105
- const { dataURL, file } = await cachedVideoToDataURL(
105
+ const { dataURL, file, mp4File } = await cachedVideoToDataURL(
106
106
  el.src,
107
107
  tempFolder
108
108
  );
109
109
  el.src = dataURL;
110
110
  el.file = file;
111
+ el.mp4File = mp4File;
111
112
  })
112
113
  );
113
114
 
@@ -240,6 +241,7 @@ module.exports.jsonToVideo = async function jsonToVideo(inst, json, attrs) {
240
241
  const elEndTime = elStartTime + elDuration;
241
242
  inputs.push({
242
243
  file: el.file,
244
+ mp4File: el.mp4File,
243
245
  inputStartTime: elStartTime,
244
246
  inputEndTime: elEndTime,
245
247
  outputStartTime: pageStartTime,
@@ -277,7 +279,7 @@ module.exports.jsonToVideo = async function jsonToVideo(inst, json, attrs) {
277
279
  // Apply `-itsoffset` before each input file to shift its audio stream
278
280
  ffmpegCmd
279
281
  .inputOptions([`-itsoffset ${outputOffsetSec}`]) // Shift the input time
280
- .input(input.file) // Add the actual input file
282
+ .input(input.mp4File) // Add the actual input file
281
283
  .inputOptions([`-ss ${inputStartSec}`, `-t ${inputDurationSec}`]); // Specify the timing to cut the audio
282
284
  });
283
285