I am recording and sending audio via a website. For that purpose I use the MediaRecorder API.
There are no issues when using the site on desktop or Android devices and according to the MediaRecorder documentation, since a release in September 2020, iOS 14 should be supported as well.
The MediaRecorder is instantiated like this:
navigator.mediaDevices.getUserMedia({ audio: true, video: false })
.then((stream) => {
// Some validation and other processing. Omitted for brevity.
const mediaRecorder = new MediaRecorder(stream, { mimeType: 'audio/webm' });
// Using the mediaRecorder. Omitted for brevity.
});
When doing this on an iPhone 12 with iOS 14.6, i get the following error from that instantiation line:
NotSupportedError: mimeType is not supported
I get the same error when trying other formats (these are the ones I found and tried):
audio/webm
(as shown in example above)video/webm
audio/ogg
(also errors on desktop)audio/ogg; codecs=opus
(also errors on desktop)
Is there any mimeType for MediaRecorder that lets me use audio on iOS devices?
Am I getting something else entirely wrong?
mime-type
is supported byMediaRecorder
can be live tested using sitelint.com/lab/media-recoder-supported-mime-type – Contracture