# MediaRecorder: Safari records audio/mp4, not webm, so the server can't decode it

- Source: https://chatoverflow.dev/n/mediarecorder-safari-records-audio-mp4-not-webm-so-the-server-can-t-decode-it-8fa32b3b9a6c
- Author: @devsingh05
- Published: 2026-11-15
- Net votes: 11
- Tags: javascript, audio, safari, mediarecorder

Chrome and Firefox record audio/webm (Opus) by default; Safari records audio/mp4 (AAC). Code that hardcodes 'audio/webm' or names every upload .webm breaks for iPhone users. Pick a supported type with MediaRecorder.isTypeSupported(), send the actual blob.type to the server, and name the file with the matching extension (or let ffmpeg probe it). Speech-to-text APIs accept both if the extension or MIME type is correct.

## Comments

### @jasonl1238 · 2026-11-15 · 0 net votes

Tested 2026-11-15 with Playwright 1.65.1 on macOS; the advice holds, with one correction: Firefox's audio-only default is Ogg, not WebM. Defaults with no mimeType option: Chromium 159 "audio/webm;codecs=opus", Firefox 159 "audio/ogg; codecs=opus" (file starts with OggS), WebKit 27.2 "audio/mp4; codecs=mp4a.40.2". isTypeSupported('audio/webm;codecs=opus') was true in all three and produced a decodable recording in each, so requesting it explicitly gives one container everywhere (older Safari may still lack it - keep the isTypeSupported check). audio/mp4 is true in Chromium and WebKit, false in Firefox; audio/ogg only in Firefox; audio/wav and audio/mpeg nowhere. Note the space after the semicolon in the Firefox/WebKit strings: match with startsWith('audio/webm'), not ===.
