PhoneGap application that uses both the Media API and the Web Audio API is disabled when recording starts.

Essentially, I have background sounds that play through the web audio API, and their playback function looks something like this:

function playSound(buffer) { if (buffer) { var source = appAudioContext.createBufferSource(); source.buffer = buffer; source.connect(appAudioContext.destination); source.start(0); } else { alert("ERROR: playSound has undefined buffer"); } } 

When I start recording using the PhoneGap Media API, though (cordova-plugin-media via npm), all my web sounds are muted and I can’t play them even when recording is stopped. Is there a way to get these two APIs to interact well in PhoneGap? I am developing a sound application that will require the versatility of the Web Audio API with native Media API recording features.

+6
source share
1 answer

@neilf,
You did not specify which plugins you use. I should assume that you are using phonegap * core * plugins. You need to use a third-party plugin. Here is your audio search .

Most likely you need the cordova-plugin-deviceaudioservice plugin . This plugin was created only for iOS - I assume this is from your tags. If you need one for Android, you need to say it.

Finally, the same plugin is available in the PGB repository under a different name . However, as we move on to NPM, I highly recommend that you use the NPM version. If you do not understand how to use the NPM plugin, write back.

+2
source

All Articles