Using Microphone API inside a UIWebView in pure JS - javascript

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?

I would assume you could use any of the HTML 5 WebAudio APIs from within the webview: https://stackoverflow.com/a/20759947/78496

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().

Related

send live video using javascript

i need to send a live streaming from pc to pc , both of them using just the web browser (IE, firefox o chrome), exist a library (javascript) that could help me to push the stream from the sender to the media server (ffmpeg-ffserver, wowza, etc).
I guess you want to stream a video signal from the webcam. Then the way to go is to use webRTC, but it is still very new (wowza server just started to support it) and it is only supported in some modern browsers. So you will encounter many issues.
Most of the existing solution still use flash to capture from the webcam and encode in rtmp.

Real-time streaming from Android camera to browser

We are working on an IP camera Android app that should stream the video took in real-time by the Android camera to a Web page served by the same app and accessed through WiFi only.
The app currently use a pseudo-streaming method (an image sent using HTTP with no-store), but it is not robust enough, so we need to change it for a better streaming method. We also need to support multicast (or at least an optimized "multi-unicast"), and if possible use an UDP protocol (or at least a low-latency TCP protocol).
We cannot use any intermediary server (so no Wowza or the like, unless it is also served by the app) or any browser plugin (so no VLC or the like, unless it is served by the app too). The main browser it is used on is Chromium.
We searched for and tried a lot of methods but none worked for us :
WebRTC sounds cool, but it uses an intermediary signaling server, it doesn't support multicast, and it is kind of heavy for what we want
RTSP with libstreaming sounds cool too, but no browser seems to implement it, and we couldn't find a Javascript library to do it.
RTMP works on most browsers, but we could'nt find a working Android library
Which streaming method would be best for our needs, and do you know Javascript and Android libraries implementing them ?
There is no way to stream multicast to a browser.

Voice recording on iPhone by using Safari and HTML5

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 firefox desktop or android. But while using mobile browsers on iPhone even chrome and firefox it doesn't work.
I tried recorder.js and result did not change.
Is it possible to recording voice on safari or it is a missing function of safari or iOS?
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
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
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.
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.
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.
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.

Record audio in a safari browser using HTML5?

I was searching for some solution to record audio inside of the browser and send for a webservice. I have found some solutions, but they only work for Chrome or Firefox. So, I wanna know:
Is there someway to record audio in SAFARI?
PS: I don't wanna use the tag video
What you are looking for is the getUserMedia API from WebRTC to access the user's microphone without any plugins. You can check out what browsers currently support the webrtc functionalities here: http://iswebrtcreadyyet.com/
At the moment it is not ready for safari.
The best support for webrtc is given by google because they are pushing this standard a lot.

HTML5 and javascript in xcode

I'm quite new to xcode, because I mostly work with JS and HTML5. I've decided to create a simple webview app that enables me to work with JS and HTML5 (going to put it on Github asap)
Now my question is about accessing certian iPhone features that I cannot use in Safari or Chrome (the reason why I'm creating this).
So the question is: is this possible? for example, I can't access the camera (as a fullscreen background I mean) in an iOS browser, but can I use it in webview?
You need any method of communicating between UIWebView and the containing app. There are libraries out there that do just that, some better some less. In case you do not want them... So to outline the techniques to do that:
App talking to the webView - using [webView stringByEvaluatingJavaScript:...]
Webview talking to the app - using url directives. Which is essentialy window.location = ... with custom fake urls, and then parsing the NSURLs in the delegate method webView:shouldStartLoadWithRequest:navigationType: and of course returning NO to prevent actually navigating to your fake urls.
If you find that you are missing consecutive URL requests, you could write a JS function that takes the URLs, puts them all in an array, pops one by one and sending them to the browser in a setTimeout(..., 0).
You need to use something like this - Cordova or PhoneGap ( Both are the same thing )
"Apache Cordova is a set of device APIs that allow a mobile app developer to access native device function such as the camera or accelerometer from JavaScript. Combined with a UI framework such as jQuery Mobile or Dojo Mobile or Sencha Touch, this allows a smartphone app to be developed with just HTML, CSS, and JavaScript."
Here is a description of all the device features cordova or phonegap allow you to use - Plugin API's
Yes, is it possible, but using a web app container like Phonegap.
If you need more info how install it visit this web.

Categories

Resources