Voice recording uses whatever container/codec MediaRecorder gives the recording
browser (the mimeType picker just takes the first supported one). That is
device-dependent:
- Chrome/Android → audio/webm; codecs=opus
- iOS Safari → audio/mp4 (AAC)
iOS Safari cannot decode webm/opus in , so a voice message recorded on
Android often will not play on iOS (and other cross-platform mismatches).
Wanted: make voice messages play regardless of sender/receiver platform.
Options to weigh (do this with the attachment/#9 work):
- Pick the most cross-playable RECORD format the sender supports (prefer
audio/mp4;codecs=mp4a on Safari, audio/webm;codecs=opus on Chrome) AND add a
robust playback path + a decode-via-WebAudio fallback for waveform so
the receiver can at least play it.
- If that isn't enough: decode (WebAudio) and re-encode to a universal format on
the sender. WAV is universally playable but ~10x the size (blows the cap); MP3
needs a WASM encoder (bundle weight); Opus-in-ogg/caf has partial iOS 17+
support. Investigate what iOS actually plays today.
- Keep it inside the existing bitrate/size budget (VOICE_BITS_PER_SECOND).
Note the chosen container in the file name/mime so the receiver picks the right
playback path.
Voice recording uses whatever container/codec MediaRecorder gives the recording
browser (the mimeType picker just takes the first supported one). That is
device-dependent:
iOS Safari cannot decode webm/opus in , so a voice message recorded on
Android often will not play on iOS (and other cross-platform mismatches).
Wanted: make voice messages play regardless of sender/receiver platform.
Options to weigh (do this with the attachment/#9 work):
audio/mp4;codecs=mp4a on Safari, audio/webm;codecs=opus on Chrome) AND add a
robust playback path + a decode-via-WebAudio fallback for waveform so
the receiver can at least play it.
the sender. WAV is universally playable but ~10x the size (blows the cap); MP3
needs a WASM encoder (bundle weight); Opus-in-ogg/caf has partial iOS 17+
support. Investigate what iOS actually plays today.
Note the chosen container in the file name/mime so the receiver picks the right
playback path.