Voice recording on iPhone by using Safari and HTML5

前端 未结 6 601
醉话见心
醉话见心 2020-12-24 08:08

I am developing a simple web application which only records a voice from microphone but I have some trouble.

HTML5 voice recording function works well on chrome and

相关标签:
6条回答
  • 2020-12-24 08:33

    Since iOS11, Safari now supports Media Capture API:

    New in Safari 11.0 – Camera and microphone access.

    Added support for the Media Capture API. Added ability for websites to access camera and microphone streams from a user's device (user permission is required.)

    Announcement by Apple - broken link as of Jul 2018

    A copy of the announcement on someone's blog

    Therefore recorder.js will work now.

    0 讨论(0)
  • 2020-12-24 08:36

    May 2018 Update (because figuring this out has been tough with all the outdated info).

    I found this demo that proves it is possible: https://kaliatech.github.io/web-audio-recording-tests/dist/#/test1

    0 讨论(0)
  • 2020-12-24 08:47

    As far as I knew, even on the latest iOS (iOS 10), recording voice on iOS using HTML5 is still impossible. Since all the browsers on iOS are limited to use UIWebView which Safari on iOS uses as well, Chrome on iOS is not able to support any API that can be used for media recording.
    For example, recorder.js which you used are built on Media Capture API. If you check caniuse.com, you will find this API is not supported on iOS. (Also check the issue here).
    MediaRecorder API is also a promising API but still not supported by Apple's browser.

    Check answers below for more information.
    1. Record voice from IPhone using HTML5
    2. Audio Recording html5 on iOS

    0 讨论(0)
  • 2020-12-24 08:47

    Safari on iOS 11 does NOT support the 2 standards which would make audio (only) recording possible (and easy to implement):

    • HTML Media Capture for audio (spec, correct syntax ) - audio recording should be passed to a native app which should pass the result back to the browser for upload (it works for video and picture)
    • MediaStream Recording API (spec, demo) - allows you to record to a blob directly in the browser. The recording can be downloaded or uploaded to a web server.
    0 讨论(0)
  • 2020-12-24 08:48

    It's now possible and "easy" to do on iOS11 for Safari! The mediaStream API is supported now. The mediaRecorder API however is not. This causes any existing examples out there to not work. So you'll have to implement your own mediaRecorder functionality by connecting the media stream to a webkitAudioContext ScriptProcessorNode and collect the stream buffer on the node's onaudioprocess event. You can then collect the iOS microphone's streaming audio data and do with it what you want, most likely merging it into a wav file for upload/download. This works for any browser that supports the Media Stream API.

    Two gotcha's:
    - iOS Safari likes to deallocate any AudioContext that wasn't created on the main thread (on a tap) so you can't initialize it on the device media access accepted callback.
    - The scriptProccessorNode wont fire any audioprocessed events unless the input AND output are connected for some reason.

    0 讨论(0)
  • 2020-12-24 08:49

    I'm using the new iPhone 11 ProMax, with iOS13.3, and have been trying to build out a web app with voice recognition services via HTML5 to work in safari or any browser on my iPhone. It seems iOS developers have blocked audio / video recording at the os level. There is a limited workaround however that might be useful for someone coming here as I did. https://blog.addpipe.com/safari-technology-preview-73-adds-limited-mediastream-recorder-api-support/

    Basically, if you go into advanced settings for safari you can enable the mediaRecorder. Their demo works with video capture, I have not seen it with pure audio yet.

    0 讨论(0)
提交回复
热议问题