fix(video-edit): 修复ffmpeg构造器兼容导致的new报错
This commit is contained in:
1 parent
1f8b317e4e
commit
cd3f2cba7c
1 file changed
+8
-5
@@ -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();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user