Path: blob/main/files/en-us/web/api/audioencoder/flush/index.md
6520 views
------{{securecontext_header}}{{APIRef("WebCodecs API")}}{{SeeCompatTable}}
The flush() method of the {{domxref("AudioEncoder")}} interface returns a Promise that resolves once all pending messages in the queue have been completed.
Syntax
Parameters
None.
Return value
A {{jsxref("Promise")}} that resolves with undefined.
Exceptions
InvalidStateError{{domxref("DOMException")}}: Thrown if the Promise is rejected because the {{domxref("AudioEncoder.state","state")}} is not
"configured".
Examples
The following example flushes the AudioEncoder.
Specifications
{{Specifications}}
Browser compatibility
{{Compat}}