javascripthtmliossafariaudio-recording

Safari and Recording Audio — HTML Media Capture / getUserMedia()


It looks like getUserMedia() is now the way to go for capturing audio recordings from a user.

But that leaves out Safari and iOS Safari.

Originally I had at least planned to included iOS Safari by taking advantage of the HTML Media Capture spec. From everything I've read, this is suppose to work. But from my tests, iOS will only offer the photo/video options. I've tried the following syntaxes with no luck:

<input type="file" accept="audio/*;capture=microphone" />
<input type="file" accept="audio/*" capture="microphone">
<input type="file" accept="audio/*" />

Capturing an image works as expected, though, allowing the user to use the camera:

<input type="file" accept="image/*" />

What do I need to change in order to get iOS Safari to work with HTML Media Capture when needing access to the microphone?

And are there any other options available for both Safari and iOS Safari other than what I'm already attempting to do?


Solution

  • Safari on iOS 6+ supports the HTML Media Capture spec but only for videos and photos:

    It does not support audio only capture so the following will not produce the expected outcome:

    Android supports all 3 (video, audio, image).

    Thus support across Android and iOS is as follows:

    enter image description here

    With Safari on iOS 10.3 the capture boolean attribute is also supported. It indicates capture directly from the webcam is preferred. When used, the option to choose an existing video or image will not be offered on Safari on iOS 10.3+:

    I've written more on the HTML Media Capture topic at https://blog.addpipe.com/correct-syntax-html-media-capture/