Is it possible to access Audio related stuffs with only JS? Or do i need to use the native code behind the scenes, using a UIWebView and the Objective-c lang to wrap the mic related methods? What i need is something simple, hear to sounds and do some algorithm to the signals received, but only inside a UIWebView, as a web app only. Is this a technical limitation, or is this possible?
Asked
Active
Viewed 1,984 times
2 Answers
0
I would assume you could use any of the HTML 5 WebAudio APIs from within the webview: https://stackoverflow.com/a/20759947/78496
0
With iOS 11 supporting getUserMedia()
you can now access the microphone using only JS in Safari. However, it will NOT not work in UIWebView, WKWebView or SFSafariViewController (see this answer and this question).
In Safari, once webcam/mic permission is given and the mic data kicks in you can encode the sound using JS libraries like Recorder.js (wav), WebAudioRecorder.js (wav,mp3,Vorbis) or vmsg (mp3).
You can also use the (native) Media Recorder API to capture (Opus) audio - together with this neat polyfill for Safari 11 and Edge - but its still reliant on getUserMedia()
.

octavn
- 3,154
- 32
- 49