audio/webm audio/webm means: audio/webm is the media type for audio in a WebM container, typically using the Opus or Vorbis codec. WebM is an open, web-optimized format designed for efficient delivery in browsers, especially alongside its video counterpart. Audio media types describe sound containers and codecs. The subtype tells the player which demuxer and decoder to load, and browsers use it in Accept headers and canPlayType() checks to negotiate a format they actually support. Choosing a widely supported audio type avoids silent playback failures on devices that lack a proprietary codec. You will encounter audio/webm in contexts such as web audio delivery in open formats; opus-encoded audio for browsers; mediarecorder api audio capture output. It is commonly associated with the file extension(s) .weba, .webm. The MediaRecorder API often produces audio/webm with Opus in Chrome. Safari support for WebM audio has been limited, so provide an MP3/AAC fallback. A .webm file with video is video/webm, not audio/webm.
When you'll see audio/webm
- Web audio delivery in open formats
- Opus-encoded audio for browsers
- MediaRecorder API audio capture output
How to handle it
When delivering audio, declare the precise container type, support byte-range requests so players can seek, and offer at least one broadly supported fallback. Test playback with canPlayType() across target browsers rather than assuming a codec is present. For streaming, set the correct type on each segment and keep timestamps consistent so the player can buffer and seek without glitches. As a final checklist for audio types: support byte-range requests for seeking, offer a universally supported fallback, normalize loudness for consistent playback, test canPlayType across target browsers, and keep segment timestamps aligned when streaming so buffers do not stall.
Notes & gotchas
The MediaRecorder API often produces audio/webm with Opus in Chrome. Safari support for WebM audio has been limited, so provide an MP3/AAC fallback. A .webm file with video is video/webm, not audio/webm.
Examples
HTTP/1.1 200 OK
Content-Type: audio/webm
Accept-Ranges: bytes
Content-Disposition: inline; filename="sample.weba"
[binary audio payload: the encoded bytes of a sample .weba] curl -i -H "Accept: audio/webm" https://api.example.com/v1/resource # inspect the returned Content-Type const res = await fetch("/media/sample.weba", { headers: { Accept: "audio/webm" } });
const blob = await res.blob(); // blob.type should be "audio/webm"
const url = URL.createObjectURL(blob); // assign to img.src / audio.src / video.src
// revoke with URL.revokeObjectURL(url) when done to free memory import requests
res = requests.get("https://api.example.com/v1/resource",
headers={"Accept": "audio/webm"}, timeout=30)
res.raise_for_status()
assert res.headers["Content-Type"].startswith("audio/webm")
with open("sample.weba", "wb") as fh:
fh.write(res.content) # raw bytes; use stream=True for large files Frequently asked questions
What does MediaRecorder output for audio?
Frequently audio/webm; codecs=opus in Chromium browsers. Check isTypeSupported() and offer a fallback container if you need cross-browser playback of recordings.
Is audio/webm widely supported?
Chromium and Firefox support it well; Safari historically less so. Pair it with an MP3 or AAC source for universal playback.
Why does my audio file fail to play in some browsers?
Codec support varies. Check HTMLMediaElement.canPlayType() with the exact MIME type, and provide a fallback source. A container the browser recognizes but a codec it lacks will still fail silently.
Are audio MIME types the same as file extensions?
They map closely but are not identical: .mp3 maps to audio/mpeg, .m4a to audio/mp4, .ogg to audio/ogg. The container and codec both matter, so trust the declared type over the extension when they conflict.
How do I let users seek within an audio file?
Serve it with Accept-Ranges: bytes and support HTTP range requests so the player can fetch arbitrary offsets. Without range support the player must download the whole file before seeking works.
Try the Base64 Encoder
Encode and decode Base64 with UTF-8 and URL-safe options.