So essentially, I have background sounds that play via the Web Audio API and their play 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 with the PhoneGap Media API though (cordova-plugin-media via npm), all of my Web Audio sounds are muted and I can't play them even when recording is stopped. Is there a way to make these two APIs play well together in PhoneGap? I'm developing a sound-heavy application that will need the versatility of Web Audio API with the native recording features of the Media API.
答案 0 :(得分:2)
@neilf,
你还没有说明你使用的插件。我必须假设你正在使用phonegap * core *插件。您需要使用第三方插件。这是你的search for audio。
这可能是您想要的插件cordova-plugin-deviceaudioservice。这个插件仅适用于iOS - 我假设你的标签。如果您需要Android版,则需要这样说。
最后,在different name下的PGB存储库中提供了相同的插件。但是,由于我们正在转向NPM,我强烈建议您使用NPM版本。如果您不清楚 - 如何使用NPM插件,请回信。