@omnimedia/omnitool
Version:
open source video processing tools
33 lines • 1.03 kB
JavaScript
import { defer, once } from "@e280/stz";
import { Comrade } from "@e280/comrade";
import { loadPipe } from "./parts/load-pipe.js";
import { transcribe } from "./parts/transcribe.js";
const deferred = defer();
const makePrepare = (host) => once(async (spec) => {
deferred.resolve({
spec,
pipe: await loadPipe({
spec,
onLoading: loading => host.loading(loading),
}),
});
});
await Comrade.worker(shell => {
const prepare = makePrepare(shell.host);
return {
prepare,
async transcribe(request) {
const { pipe, spec } = await deferred.promise;
return transcribe({
pipe,
spec,
request,
callbacks: {
onReport: report => shell.host.deliverReport(report),
onTranscription: transcription => shell.host.deliverTranscription(transcription),
},
});
}
};
});
//# sourceMappingURL=worker.bundle.js.map