Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
mohamedkhallouq
GitHub Repository: mohamedkhallouq/content
Path: blob/main/files/en-us/web/api/audioencoder/flush/index.md
6520 views
---
title: AudioEncoder.flush() slug: Web/API/AudioEncoder/flush page-type: web-api-instance-method status: - experimental browser-compat: api.AudioEncoder.flush
---

{{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

flush()

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.

AudioEncoder.flush();

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}