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">
|
<Card className="max-h-64 overflow-y-auto custom-scrollbar">
|
||||||
{Object.entries(groupedFormats).length === 0 ? (
|
{Object.entries(groupedFormats).length === 0 ? (
|
||||||
<div className="p-4 text-center text-sm text-muted-foreground">
|
<div className="p-4 text-center text-sm text-muted-foreground">
|
||||||
No formats found matching "{searchQuery}"
|
No formats found matching "{searchQuery}"
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div className="p-2">
|
<div className="p-2">
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import type { ConverterEngine, WASMModuleState } from '@/types/media';
|
|||||||
import type { FFmpeg as FFmpegType } from '@ffmpeg/ffmpeg';
|
import type { FFmpeg as FFmpegType } from '@ffmpeg/ffmpeg';
|
||||||
import { FFmpeg } from '@ffmpeg/ffmpeg';
|
import { FFmpeg } from '@ffmpeg/ffmpeg';
|
||||||
import { initializeImageMagick } from '@imagemagick/magick-wasm';
|
import { initializeImageMagick } from '@imagemagick/magick-wasm';
|
||||||
|
import { toBlobURL } from '@ffmpeg/util';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* WASM module loading state
|
* 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
|
// Use CDN URLs for FFmpeg core - avoids "dynamic require" bundler issues
|
||||||
// with local file paths that FFmpeg's internal code cannot resolve at runtime
|
// 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 coreURL = '/wasm/ffmpeg-core.js';
|
||||||
const wasmURL = 'https://cdn.jsdelivr.net/npm/@ffmpeg/core@0.12.10/dist/esm/ffmpeg-core.wasm';
|
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;
|
moduleState.ffmpeg = true;
|
||||||
console.log('[FFmpeg] Loaded successfully from local assets');
|
console.log('[FFmpeg] Loaded successfully from local assets');
|
||||||
|
|||||||
Reference in New Issue
Block a user