PhoneGap/Cordova: Live Audio Input (getUserMedia)

1,004 views
Skip to first unread message

Philipp Jäcks

unread,
Feb 9, 2015, 6:59:11 AM2/9/15
to phon...@googlegroups.com
Hi,

currently I'm working on my bachelor thesis that is based on another student's work. He has implemented an acoustic communication between 2 PCs on browser level using the Web Audio API. I have to port his code on mobile devices using PhoneGap. The transmitting code works fine, so here is nothing to do. But the receiver doesn't even start. I think this is because PhoneGap doesn't allow/support live audio input (based on my latest google research).

I've just found out that the application fails at


navigator.getUserMedia( {audio:true},
    function(stream) {
        boom('Live stream is being recieved!!!');
        //Wrap the stream and send it to analyser for fft analysis 
        window.input = audio_context.createMediaStreamSource(stream);
    }, function(err) {boom('No live audio input ' + err);});


The question: is there any solution (plugin) to get the live audio input? I'm just looking for the right hint ;-)

Philipp Jäcks

unread,
Feb 10, 2015, 5:17:41 AM2/10/15
to phon...@googlegroups.com

So I have found out that there's a plugin called audioCapture (http://plugins.cordova.io/#/package/org.chromium.audiocapture) provided by Chrome Apps on Mobile Using Apache Cordova. This plugin allows the user to use the getUserMedia API. I've followed the steps on https://developer.chrome.com/apps/chrome_apps_on_mobile to create my application with the receiver's logic. Also I've added the permission to the manifest.json file. The code above runs fine but it doesn't recognize any audio input.

Does someone have an idea what the problem could be?


PS: Can't I edit my post?

Kerri Shotts

unread,
Feb 10, 2015, 3:32:09 PM2/10/15
to phon...@googlegroups.com
I'd suggest asking the plugin devs. Have you looked at adb logcat?

No, I don't think you can edit posts. That's both good and bad! ;-)

Philipp Jäcks

unread,
Feb 11, 2015, 11:51:28 AM2/11/15
to phon...@googlegroups.com
Yeah, I've already sent a mail to them. I hope they answer fast.

However, I've found out the plugin works, but frequencies above 4 kHz are cut. Below 4 kHz my communication works. The same problem appears if I run the code in Chrome on my Android.
I've read and heard by other students that Chrome for PC also cuts frequencies over 15 kHz (which is also approved by some tests I made). The reason for this seems to be some applied filters to get a better quality.

So, I think there are some filters applied on my phone too. The WebView is based of Chromium ('cause of using Crosswalk), like Chrome's engine. So the filter applied in the app and the script while using Chrome, should have the same cause.
Any idea if this whole 'filter-thing' could be the right way? :-)
Reply all
Reply to author
Forward
0 new messages