Files
story-studio/remotion/node_modules/@remotion/renderer/dist/assets/convert-assets-to-file-urls.js
2026-02-21 10:33:18 +01:00

37 lines
1.4 KiB
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.convertAssetsToFileUrls = void 0;
const download_and_map_assets_to_file_1 = require("./download-and-map-assets-to-file");
const chunk = (input, size) => {
return input.reduce((arr, item, idx) => {
return idx % size === 0
? [...arr, [item]]
: [...arr.slice(0, -1), [...arr.slice(-1)[0], item]];
}, []);
};
const convertAssetsToFileUrls = async ({ assets, onDownload, downloadMap, indent, logLevel, binariesDirectory, }) => {
const chunks = chunk(assets, 1000);
const results = [];
for (const ch of chunks) {
const assetPromises = ch.map((frame) => {
const frameAssetPromises = frame.audioAndVideoAssets.map((a) => {
return (0, download_and_map_assets_to_file_1.downloadAndMapAssetsToFileUrl)({
renderAsset: a,
onDownload,
downloadMap,
indent,
logLevel,
binariesDirectory,
cancelSignalForAudioAnalysis: undefined,
shouldAnalyzeAudioImmediately: true,
});
});
return Promise.all(frameAssetPromises);
});
const result = await Promise.all(assetPromises);
results.push(result);
}
return results.flat(1);
};
exports.convertAssetsToFileUrls = convertAssetsToFileUrls;