Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 709
Registered: ‎09-10-2009
My Device: 8520, 8900, 9000, 9300, 9650, 9700, 9780, 9800, 9810, 9900, 9930

unsupported record encoding exception

I got a "java.media.mediaexception: unsupported record encoding" exception when I ran my own voice note recording app on the Curve II 8530  when creating the player for recording.

 

_player = Manager.createPlayer("capture://audio?encoding=audio/basic");

 

The device is running OS v 5.0.xxx don't remember the last 3 digits (as my co-worker just went out with the phone). I don't have the same problem on the 9000 running OS v 4.6.  Am I missing some parameter in the capture string or is this specifi to OS v5?

 

 

Developer
Posts: 74
Registered: ‎01-03-2010
My Device: Not Specified

Re: unsupported record encoding exception

same for me in simulator of 4.2.1 and 4.5 both

_player = Manager.createPlayer("capture://audio?encoding=audio/basic");

and _player = Manager.createPlayer("capture://audio?encoding=audio/amr");

 

 

if managed than a 0 byte file recorded!!

Developer
Posts: 1,805
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.3253, Z10 (STL100-3)-10.3.1.997 Dev OS, Z30 (STA100-5)-10.3.1.997 Dev OS, Passport (SQW100-1)-10.3.0.1418, PlayBook (16GB)-2.1.0.1917

Re: unsupported record encoding exception

You should check "Manager.getSupportedContentTypes("capture")" to make sure that audio/basic is supported.

 

@jack: Recordings do not automatically get saved to a stream. You need to call RecordControl.commit() for it to start saving to the stream and when it is done it will call PlayerListener (if you have one) and pass "net.rim.device.internal.media.recordCommitted" to the "event" argument. If you just stop recording and then check the OutputStream length it will show 0 because the above events have not occured (or have not occured yet).

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
New Developer
Posts: 14
Registered: ‎08-11-2009
My Device: Not Specified

Re: unsupported record encoding exception

Aviator,

The 8530 is a CDMA device.

Only a couple of older CDMA devices supported PCM as a recording format.

All the new devices (GSM and CDMA) support AMR (decoder time????)

 

 

Developer
Posts: 709
Registered: ‎09-10-2009
My Device: 8520, 8900, 9000, 9300, 9650, 9700, 9780, 9800, 9810, 9900, 9930

Re: unsupported record encoding exception

[ Edited ]

What are the new devices? I have Bold 9000 and it supports PCM. I have a GSM decoder in Java, but the GSM output from the BB is not standard.

Developer
Posts: 1,805
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.3253, Z10 (STL100-3)-10.3.1.997 Dev OS, Z30 (STA100-5)-10.3.1.997 Dev OS, Passport (SQW100-1)-10.3.0.1418, PlayBook (16GB)-2.1.0.1917

Re: unsupported record encoding exception

[ Edited ]

There are a couple threads that have people who ask why their (BLACKBERRY NAME HERE) doesn't support PCM and the phones are always CDMA phones. GSM phones, such as the Bold 9000, support it fine.

 

I wish there'd be a list that states the exact formats that a specific BlackBerry supports. They have a general site but for us programmers we try one format and can't get it to work on all devices.

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Developer
Posts: 709
Registered: ‎09-10-2009
My Device: 8520, 8900, 9000, 9300, 9650, 9700, 9780, 9800, 9810, 9900, 9930

Re: unsupported record encoding exception

The real answer is not if the device is new or not, it is if the device is a CDMA device. That's fairly easy to pin down.

Developer
Posts: 229
Registered: ‎11-21-2009
My Device: Not Specified

Re: unsupported record encoding exception

 

Well - I have a 8530 and non of the recording code works...and when I event try to play a ringtone, I get "An error has occurred attempting to play media" - the Notes Recorder records/plays fine though...

 

So what is this:

 

@jack: Recordings do not automatically get saved to a stream. You need to call RecordControl.commit() for it to start saving to the stream and when it is done it will call PlayerListener (if you have one) and pass "net.rim.device.internal.media.recordCommitted" to the "event" argument. If you just stop recording and then check the OutputStream length it will show 0 because the above events have not occured (or have not occured yet).

 

This sounds very familiar as to my problem with this code (straight from the doc):

 

 

        // Create a Player that captures live audio.
        Player p = Manager.createPlayer("capture://audio");
        p.realize();
       // Get the RecordControl, set the record stream,
       // start the Player and record for 5 seconds.
       RecordControl rc = (RecordControl)p.getControl("RecordControl");
       ByteArrayOutputStream output = new ByteArrayOutputStream();
       rc.setRecordStream(output);
       rc.startRecord();
       p.start();
       Thread.currentThread().sleep(5000);
       rc.commit();
       p.close();