From 226162f91f9d701bb057fc918d50d95ea4c6ad75 Mon Sep 17 00:00:00 2001 From: dumbmoron Date: Fri, 16 Aug 2024 20:56:24 +0000 Subject: [PATCH] web/libav: add getter for libav instance --- web/src/lib/libav.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/web/src/lib/libav.ts b/web/src/lib/libav.ts index 69747464..7e50d911 100644 --- a/web/src/lib/libav.ts +++ b/web/src/lib/libav.ts @@ -31,9 +31,13 @@ export default class LibAVWrapper { } } - async probe(blob: Blob) { + async #get() { if (!this.libav) throw new Error("LibAV wasn't initialized"); - const libav = await this.libav; + return await this.libav; + } + + async probe(blob: Blob) { + const libav = await this.#get(); await libav.mkreadaheadfile('input', blob); @@ -72,8 +76,8 @@ export default class LibAVWrapper { } async remux({ blob, output, args }: RenderParams) { - if (!this.libav) throw new Error("LibAV wasn't initialized"); - const libav = await this.libav; + const libav = await this.#get(); + const inputKind = blob.type.split("/")[0]; const inputExtension = LibAVWrapper.getExtensionFromType(blob); @@ -230,4 +234,4 @@ export default class LibAVWrapper { this.onProgress(progress); } -} \ No newline at end of file +}