@runnerpro/backend 1.12.23 → 1.12.25

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.
@@ -326,7 +326,8 @@ const sendFile = (req, res, { sendNotification, firebaseMessaging, isClient, buc
326
326
  }
327
327
  });
328
328
  const getThumbnailFromVideo = (videoPath, duration) => __awaiter(void 0, void 0, void 0, function* () {
329
- const size = '640x480';
329
+ const targetWidth = 500;
330
+ const targetHeight = 400;
330
331
  const quality = 2;
331
332
  const tempDir = path_1.default.join('./uploads');
332
333
  const outputFilename = `thumbnail_${Date.now()}.png`;
@@ -335,13 +336,16 @@ const getThumbnailFromVideo = (videoPath, duration) => __awaiter(void 0, void 0,
335
336
  const timestamp = Math.min(Math.max(duration * 0.1, 1), 10);
336
337
  return new Promise((resolve, reject) => {
337
338
  (0, fluent_ffmpeg_1.default)(videoPath)
338
- .screenshots({
339
- timestamps: [timestamp],
340
- filename: outputFilename,
341
- folder: tempDir,
342
- size,
343
- quality,
344
- })
339
+ .seekInput(timestamp)
340
+ .outputOptions([
341
+ '-vf',
342
+ `scale=${targetWidth}:${targetHeight}:force_original_aspect_ratio=increase,crop=${targetWidth}:${targetHeight}`,
343
+ '-vframes',
344
+ '1',
345
+ '-f',
346
+ 'image2',
347
+ ])
348
+ .output(outputPath)
345
349
  .on('end', () => {
346
350
  try {
347
351
  // Leer el archivo como buffer
@@ -366,7 +370,8 @@ const getThumbnailFromVideo = (videoPath, duration) => __awaiter(void 0, void 0,
366
370
  console.error('Error limpiando archivo temporal:', cleanupError);
367
371
  }
368
372
  reject(error);
369
- });
373
+ })
374
+ .run();
370
375
  });
371
376
  });
372
377
  const getVideoDuration = (videoPath) => __awaiter(void 0, void 0, void 0, function* () {
@@ -1 +1 @@
1
- {"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../../../../src/chat/api/conversation.ts"],"names":[],"mappings":"AAkBA,QAAA,MAAM,iBAAiB,0BAA2B,GAAG,SAuBpD,CAAC;AA6aF,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
1
+ {"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../../../../src/chat/api/conversation.ts"],"names":[],"mappings":"AAkBA,QAAA,MAAM,iBAAiB,0BAA2B,GAAG,SAuBpD,CAAC;AAkbF,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runnerpro/backend",
3
- "version": "1.12.23",
3
+ "version": "1.12.25",
4
4
  "description": "A collection of common backend functions",
5
5
  "exports": {
6
6
  ".": "./lib/cjs/index.js"