fix: ffmpeg import

This commit is contained in:
2026-02-25 20:51:45 +01:00
parent 3a1e0153ac
commit 84bc70b442
2 changed files with 8 additions and 4 deletions

View File

@@ -81,7 +81,7 @@ export function FormatSelector({
<Card className="max-h-64 overflow-y-auto custom-scrollbar">
{Object.entries(groupedFormats).length === 0 ? (
<div className="p-4 text-center text-sm text-muted-foreground">
No formats found matching "{searchQuery}"
No formats found matching &quot;{searchQuery}&quot;
</div>
) : (
<div className="p-2">

View File

@@ -2,6 +2,7 @@ import type { ConverterEngine, WASMModuleState } from '@/types/media';
import type { FFmpeg as FFmpegType } from '@ffmpeg/ffmpeg';
import { FFmpeg } from '@ffmpeg/ffmpeg';
import { initializeImageMagick } from '@imagemagick/magick-wasm';
import { toBlobURL } from '@ffmpeg/util';
/**
* WASM module loading state
@@ -42,10 +43,13 @@ export async function loadFFmpeg(): Promise<FFmpegType> {
// Use CDN URLs for FFmpeg core - avoids "dynamic require" bundler issues
// with local file paths that FFmpeg's internal code cannot resolve at runtime
const coreURL = 'https://cdn.jsdelivr.net/npm/@ffmpeg/core@0.12.10/dist/esm/ffmpeg-core.js';
const wasmURL = 'https://cdn.jsdelivr.net/npm/@ffmpeg/core@0.12.10/dist/esm/ffmpeg-core.wasm';
const coreURL = '/wasm/ffmpeg-core.js';
const wasmURL = '/wasm/ffmpeg-core.wasm';
await ffmpegInstance.load({ coreURL, wasmURL });
await ffmpegInstance.load({
coreURL: await toBlobURL(coreURL, 'text/javascript'),
wasmURL: await toBlobURL(wasmURL, 'application/wasm')
});
moduleState.ffmpeg = true;
console.log('[FFmpeg] Loaded successfully from local assets');