fix(video-edit): 修复ffmpeg构造器兼容导致的new报错

This commit is contained in:
root committed 2026-02-17 17:24:48 +08:00
1 parent 1f8b317e4e
commit cd3f2cba7c
1 file changed
+8 -5
+8 -5
View File
@@ -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();
}