Hello there!
From time to time I am getting such a exception while recording an audio/amr message:
java.io.IOException: NATIVE_ERROR: -2003
at com.nokia.microedition.media.protocol.OutputStreamWriter.commit(Unknown Source)
at com.nokia.microedition.media.control.RecordControl.commit(Unknown Source)
Here is my piece of code:
I have found that Native Error -2003 stands for KErrEtelNoCarrier "Problem communicating receiving device. Call was unexpectedly dropped".PHP Code:public void run() {
Player myPlayer = null;
RecordControl recorder = null;
try {
myPlayer = Manager.createPlayer("capture://audio?encoding=amr");
myPlayer.realize();
recorder = (RecordControl)myPlayer.getControl("RecordControl");
ByteArrayOutputStream output = new ByteArrayOutputStream();
recorder.setRecordStream(output);
recorder.startRecord();
myPlayer.start();
long recordingTime = System.currentTimeMillis();
long recordingEnd = System.currentTimeMillis() + this.messageLength;
while ((recordingTime < recordingEnd) && !this.terminatedFlag) {
int timeLeft = (int)(recordingEnd - recordingTime);
this.recordingProgress.setValue(messageLength - timeLeft);
try {
this.recordingThread.sleep(100);
} catch (InterruptedException e) {
System.out.println("*debug* interrupting recording thread");
e.printStackTrace();
break;
}
recordingTime = System.currentTimeMillis();
}
System.out.println("*debug* MessRecorder: finished recording.");
recorder.commit(); <---- Here the Exception occurs
this.recordedSoundArray = output.toByteArray();
} catch (MediaException me) {
me.printStackTrace();
} catch (IOException ioe) {
ioe.printStackTrace();
}
The question is: what the No Carrier Problem has to do with audio recording?
The code was tested on real devies (5800 XM and E52).
Got some idea how can I fix that?
Regards,
Peter

?
Reply With Quote

