- return createThumbnailFromFunction({ thumbnailCreator, filename, height, width, type, automaticallyGenerated: true, existingThumbnail })
+function generateVideoMiniature (options: {
+ video: MVideoThumbnail
+ videoFile: MVideoFile
+ type: ThumbnailType
+}) {
+ const { video, videoFile, type } = options
+
+ return VideoPathManager.Instance.makeAvailableVideoFile(videoFile.withVideoOrPlaylist(video), input => {
+ const { filename, basePath, height, width, existingThumbnail, outputPath } = buildMetadataFromVideo(video, type)
+
+ const thumbnailCreator = videoFile.isAudio()
+ ? () => processImageFromWorker({
+ path: ASSETS_PATH.DEFAULT_AUDIO_BACKGROUND,
+ destination: outputPath,
+ newSize: { width, height },
+ keepOriginal: true
+ })
+ : () => generateImageFromVideoFile({
+ fromPath: input,
+ folder: basePath,
+ imageName: filename,
+ size: { height, width }
+ })
+
+ return updateThumbnailFromFunction({
+ thumbnailCreator,
+ filename,
+ height,
+ width,
+ type,
+ automaticallyGenerated: true,
+ existingThumbnail
+ })
+ })