diff --git a/src/createFFmpeg.js b/src/createFFmpeg.js index f5e22a6..c5425ce 100644 --- a/src/createFFmpeg.js +++ b/src/createFFmpeg.js @@ -95,7 +95,6 @@ module.exports = (_options = {}) => { } }; - /* * Determine whether the Core is loaded. */ @@ -171,6 +170,21 @@ module.exports = (_options = {}) => { } }; + /** + * forcibly terminate the ffmpeg program. + */ + const exit = () => { + if (Core === null) { + throw NO_LOAD; + } else { + running = false; + Core.exit(1); + Core = null; + ffmpeg = null; + runResolve = null; + } + }; + const setProgress = (_progress) => { progress = _progress; }; @@ -191,6 +205,7 @@ module.exports = (_options = {}) => { load, isLoaded, run, + exit, FS, }; }; diff --git a/src/index.d.ts b/src/index.d.ts index 859ff15..5d0b749 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -77,6 +77,7 @@ export interface FFmpeg { setProgress(progress: ProgressCallback): void; setLogger(log: LogCallback): void; setLogging(logging: boolean): void; + exit(): void; } /*