ffmpegwasm / ffmpeg.wasm

FFmpeg for browser, powered by WebAssembly
https://ffmpegwasm.netlify.app
MIT License
13.63k stars 787 forks source link

feat(ffmpeg): abort signal #573

Closed abernier closed 9 months ago

abernier commented 10 months ago
const { signal } = new AbortController()

ffmpeg.exec(cmd, undefined, { signal }).catch(err => {
  if (err.name === "AbortError") {
    console.log(err.message) // "`Message # ID was aborted`"
  }
})

// later, change your mind...
signal.abort()

NB: err is a DOMException when aborting

netlify[bot] commented 10 months ago

Deploy Preview for ffmpegwasm canceled.

Name Link
Latest commit 7c6107a44d74a2abd8f76fdb5c751e8b2c4a6b1e
Latest deploy log https://app.netlify.com/sites/ffmpegwasm/deploys/64f7a447fc736e0008311577
jeromewu commented 9 months ago

LGTM, thanks!

struggleRoue commented 4 months ago

hello, when i exec after use abort() it cant end.

image
marchaddad123 commented 4 months ago

I can confirm having the same issue, after using controller.abort(), the previous executed command still on going.

luyaocode commented 3 months ago

It doesn't work on my react app.

risalfajar commented 1 month ago

This doesn't end the exec command, but just ending the Promise.

I think #719 should not be closed @ArsenicBismuth