Update
Upon even further investigation, I may have been wrong. According to the Cordova Media API documentation, when recording audio in iOS, the file that you are recording to must already exist and be a .wav file. Maybe you've already tried this (in which case, my previous answer is probably correct) but here's a simple script to create the file and then begin recording once the file handle is ready:
var audioRecSrc = "myrecording.wav";
var audioPlaySrc = "audiotoplay.mp3"
// Wait for PhoneGap to load
document.addEventListener("deviceready", onDeviceReady, false);
// PhoneGap is ready
function onDeviceReady() {
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, fail);
}
function gotFS(fileSystem) {
fileSystem.root.getFile(audioRecSrc, {create: true, exclusive: false}, gotFileEntry, fail);
}
function gotFileEntry(fileEntry) {
var audioRec = new Media(audioRecSrc, onSuccess, onError);
audioRec.startRecord();
var audioPlay = new Media(audioPlaySrc, onSuccess, onError);
audioPlay.play();
}
function fail(error) {
console.log("error : " + error.code);
}
Here's a link to the Cordova File API documentation in case you need to reference it. You'll also need to make sure that you have the appropriate permissions in your app configuration to use the File and Media APIs (everything you'll need is on the pages I linked)
Previous
That is a limitation of iOS. Here's a quote from Mobile Safari documentation (PhoneGap uses the native UIWebView when it's compiled with the iPhone SDK):
Multiple Simultaneous Audio or Video Streams
Currently, all devices running iOS are limited to playback of a single
audio or video stream at any time. Playing more than one video—side by
side, partly overlapping, or completely overlaid—is not currently
supported on iOS devices. Playing multiple simultaneous audio streams
is also not supported. You can change the audio or video source
dynamically, however. See “Replacing a Media Source Sequentially”
(page 41) for details
It would make sense to infer that if playing two streams at the same time isn't possible, neither would be playing and recording at the same time. As for the above comment about the StarComposer app, there's a very big difference between native iPhone apps and those using PhoneGap. PhoneGap uses Cordova to allow developers to access a subset of native device functions using JavaScript, while native apps have the full range of capabilities. The limited streaming capability you're experiencing is due to the HTML5 implementation on the iOS platform. Here's the document that I sourced the above quote from, it's on page 23:
https://developer.apple.com/library/safari/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/Using_HTML5_Audio_Video.pdf