From cd3f2cba7c8e2cf38fa223a8b8d1ec35a1e8087e Mon Sep 17 00:00:00 2001 From: root Date: Tue, 17 Feb 2026 17:24:48 +0800 Subject: [PATCH] =?UTF-8?q?fix(video-edit):=20=E4=BF=AE=E5=A4=8Dffmpeg?= =?UTF-8?q?=E6=9E=84=E9=80=A0=E5=99=A8=E5=85=BC=E5=AE=B9=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E7=9A=84new=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/static/public/js/video.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/app/static/public/js/video.js b/app/static/public/js/video.js index 9014870..620a7cd 100644 --- a/app/static/public/js/video.js +++ b/app/static/public/js/video.js @@ -596,11 +596,14 @@ } ffmpegLoading = true; try { - if (typeof FFmpegCtor === 'function' && FFmpegCtor.prototype && FFmpegCtor.prototype.load) { - ffmpegInstance = new FFmpegCtor(); - await ffmpegInstance.load(); - } else if (typeof FFmpegCtor === 'function') { - ffmpegInstance = FFmpegCtor({ log: false }); + if (typeof FFmpegCtor === 'function') { + try { + // 兼容 @ffmpeg/ffmpeg 0.12+ 的 class FFmpeg + ffmpegInstance = new FFmpegCtor(); + } catch (e) { + // 回退兼容 createFFmpeg 工厂模式 + ffmpegInstance = FFmpegCtor({ log: false }); + } if (ffmpegInstance && typeof ffmpegInstance.load === 'function') { await ffmpegInstance.load(); }