fix: ffmpeg import
This commit is contained in:
@@ -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 "{searchQuery}"
|
||||
</div>
|
||||
) : (
|
||||
<div className="p-2">
|
||||
|
||||
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user