07-18-2011 05:15 PM - last edited on 07-18-2011 05:16 PM
Hi plevintampabay!
The parameter is case-sensitive, as all parameters in the locator string are. Note that the value is not in this case, so any of "true", "TRUE", or "TrUe" are all valid.
However that isn't the problem here, obviously
I assume you've read Everything You Need To Know About Simultaneous Record and Playback on CDMA Devices, since it's also posted almost verbatim earlier in this thread...
Here is code I've used to test this *successfully* just now on my Style using the same build 6.0.0.524:
FileConnection file = null;
InputStream fileInputStream = null;
try {
// Recorder
recorder = javax.microedition.media.Manager.createPlayer("capture://audio?encoding=audio/amr&bitrate=12200&voip Mode=true");
recorder.addPlayerListener( ... );
recorder.realize();
recordControl = (RecordControl) recorder.getControl( "RecordControl" );
recordControl.setRecordLocation( "file:///SDCard/path/to/filename.amr");
// Player
file = (FileConnection) Connector.open(playbackFilename);
fileInputStream = file.openInputStream();
player = javax.microedition.media.Manager.createPlayer( fileInputStream, "audio/amr" );
player.addPlayerListener( ... );
// Start order matters here -> start recorder first
recordControl.startRecord();
recorder.start();
player.start();
} catch (Exception e) {
// Error handling here
}
It's simplified a bit so it's easier to understand. Note that the source of the player media must be a stream (it cannot be a file URL) so I cheated a bit and used an InputStream to a file. Where the data is recorded to doesn't matter, I used a file here but it could easily have been a stream as well.
The logs you provided shows that the recorder is stopped before the player even starts due to preemption, presumably from the playback player as you suspect.
I've done all I can with what you've given me here, if this doesn't help please post some code!
EDIT: Fixed some typos.
07-18-2011 08:30 PM
BVP,
Thank you ! Let me work with what you've given, and I'll get back to you. If I don't get it to work, I will certainly post my code.
Thanks again,
Paul
07-18-2011 11:59 PM
OMG ! Its working!
Thanks BVP.
The only thing I changed in my code after comparing with your sample, was the encoding value on the recorder connection string. I had 'amr' and you had 'audio/amr'. I can see how the encoding value needed to be the same for the recorder and playback players (the playback player was audio/amr). Interesting how a GSM phone didn't care about that difference.
Anyway, its working now.
Thank you !
08-17-2011 12:09 AM
read the link from blackberry os 6.0 documentation. it is defined in os 6.0 documentation ![]()
08-17-2011 12:10 AM
When creating a Player for audio recording ("capture://audio") it is possible to set the Player to a 'VOIP mode' to maximize compatibility with various device hardware. When used with CDMA-based devices this will allow Players to be able to simultaneously record and playback voice data. This property is not specifically required when using a GSM-based device (and is in fact ignored) but it is recommended that applications always specify it regardless since it allows these VOIP applications be hardware-agnostic and work on both platforms seamlessly.
To signal that a recording Player be created in 'VOIP mode' add this parameter:
voipMode = "true" / "false"
The default value if unspecified is false, when the parameter is present with any value other than true or false the parameter is ignored. When this parameter is set to true then the rate audio parameter must also be specified as described above, and it must correspond to a valid bitrate for the content-type specified in the Locator string. Note that not all content-types that are supported for audio recording can be used for this mode. See the chart below for a list of valid content-type and bitrate combinations for this mode.
A new Player for audio playback can then be created, and if it is created by the same application using the same content-type, then it will be able to function correctly while the first Player is recording thus enabling VOIP capability while maximizing compatibility across differing devices.
Content-Type Bitrates Available (bits/s)
audio/amr 4750 / 5150 / 5900 / 6700 / 7400 / 7950 / 10200 / 12200
These values correspond to AMR-NB Modes 0-7 respectively
audio/qcelp 1000 / 2700 / 6200 / 13300
These values correspond to 1/8 Rate, 1/4 Rate, 1/2 Rate, and
Full-Rate respectively
02-23-2012 11:06 AM
Hi,
I'm having problems using this voipMode=true on cdma devices. I must note that I'm only able to test on simulators for now because I don't have cdma devices.
In the beginning I've tested with my own code and player/recorder combination. Because I also had the problem that the mic stops when I started the player, I've implemented the example as described in the example posted by BVP, so with a simplified recorder/player. I thought that should work then...
The only thing I changed is the capture string, I've put the voipMode=true parameter as the first parameter. So I'm using the following capture string:
createPlayer("capture://audio?voipMode=true&encodi
I've tested with encoding set to amr and also like above audio/amr as suggested by someone else.
I've tested by starting first the mic and perform a recording like in the example and start after 5 seconds the player. I can see that the mic works (console and file gets written to), after I start the player I also hear output on my speaker, so player is working. But the problem is that the mic stops recording with an error. Don't receive an event in the playerUpdate listener.
Console tells:
[0.0] [streamNewData] elapsedTime: 8 ms.
[0.0] MSM[0]: Stream 2313 source done.
[0.0] MSM[0]: read remaining 0 bytes
[0.0] MSM[0]: Stream 2313 sink done
[0.0] MSM[0]: Stream Streaming session: 2313 sendSourceEnded called
[0.0] VM:NCICv=57
[0.0] VM:NMACv=11
[0.0] [streamSinkDone]: net.rim.device.internal.streamingnatives.Streaming
[0.0] MSM[0]: RT Interrupted
[0.0] MSM[0]: RT exit
[0.0] [STREAM] releasing big buffer [index: 0] [handle: 2313]
[0.0] MSM[0]: release
[0.0] MSM[1]: created session
[0.0] MSM[1]: ----- initializeStream
[0.0] [STREAM] allocating big buffer [index: 0] [numStreams: 0]
[0.0] [STREAM] allocating stream [index: 0] [size: 327680]
[0.0] [STREAM] allocated stream [index: 0] [handle: 2569] [size: 327680]
[0.0] null:_ss=2569 PID=275
[0.0] MN: load 0
[0.0] MN: init0(0, 0, 5, 65535)=0
[0.0] MSM[0]: already released
[0.0] AR: remove source 12
[0.0] AR: setAudioMode 32
[0.0] [STREAM] write [handle: 2569] 21894 bytes written
I've tested on:
9300 6.0.0.706 simulator and also 9670 6.0.0.706 simulator. I'm aware it's not working on versions lower than OS 6.0.0 build 524 as stated in another post from BVP.
So what I would like to know if this is a simulator issue or if I'm doing something wrong here. Could someone verify who has a cdma only device if this example is working on his/her device and also test it on the same simulator and see if it's a simulator issue or not.
02-23-2012 11:20 AM
I have used GSM audio on the simulator, I've never used a CDMA simulator. In fact, I didn't even know they had CDMA simulators. You really should develop and debug audio using a physical phone. Be sure you are using the correct OS version, since support for voip on CDMA is very recent.
02-23-2012 01:12 PM
physical phone is better, however cdma devices are hard to get here (gsm only here) so I tried the cdma simulator. Performance is also not ideal on simulator, but just to hear if it does something with audio, should be enough for me.
I noticed you used a 9650 cdma device. Could you post your capture string? Tomorrow will try with the 9650 simulator to see if that's working.
02-23-2012 01:32 PM
capture://audio?encoding=audio/amr&rate=12200&voip
02-23-2012 03:07 PM
unfortunately not working on 9650 simulator running os 6.0.0.706(Sprint cdma), will try to get real cdma device.
would you be willing to test your software (or this piece of test code in the post earlier) on the cdma simulator (9650 6.0.0.706 sprint) and check if it works or if we can confirm it's a simulator issue?
http://www.blackberry.com/developers/downloads/sim
thanks