Skip to content

Conversation

@abernier
Copy link
Contributor

@abernierabernier commented Sep 5, 2023

const{ signal }=newAbortController()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
Copy link

netlifybot commented Sep 5, 2023

Deploy Preview for ffmpegwasm canceled.

NameLink
🔨 Latest commit7c6107a
🔍 Latest deploy loghttps://app.netlify.com/sites/ffmpegwasm/deploys/64f7a447fc736e0008311577

@abernierabernier mentioned this pull request Sep 5, 2023
Copy link
ContributorAuthor

@abernierabernier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

annotating

{ type, data }: Message,
trans: Transferable[]=[]
trans: Transferable[]=[],
signal?: AbortSignal
Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a 3rd (optional) param

publicload=(config: FFMessageLoadConfig={}): Promise<IsFirst>=>{
publicload=(
config: FFMessageLoadConfig={},
{ signal }: FFMessageOptions={}
Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for every methods using #send : add an options param to pass the optional signal

data: config,
},
undefined,
signal
Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pass the signal option to #send

@jeromewu
Copy link
Collaborator

LGTM, thanks!

@jeromewujeromewu merged commit efaae60 into ffmpegwasm:mainOct 9, 2023
@yuedud
Copy link

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

@marchaddad123
Copy link

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

@luyaocode
Copy link

It doesn't work on my react app.

@risalfajar
Copy link

risalfajar commented Jun 10, 2024

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

I think #719 should not be closed @ArsenicBismuth

star-whisper9 added a commit to star-whisper9/chishi-tech that referenced this pull request Oct 13, 2025
> 参见 ffmpegwasm/ffmpeg.wasm#573 ,ffmpeg的AbortController并不会结束进程,仅仅只是结束Promise,因此此取消并不是实际有效的。
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@abernier@jeromewu@yuedud@marchaddad123@luyaocode@risalfajar