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

Posts: 46
Registered: ‎05-21-2010
My Device: ...

VideoControl.getSnapshot with encoding=rgb565



I am trying to get a snapshot from the MMAPI interface using Player/VideoControl etc.


System.getProperty("video.snapshot.encodings") returns a long list of formats, and the first element is "encoding=rgb565."  But when I called VideoControl.getSnapshot("encoding=rgb565") it throws a MediaException: "Requested format not supported."


This is on the simulator and the devices.  I've tried quite a few devices, mostly 5.0.


What am I doing wrong here?



Posts: 13
Registered: ‎10-01-2010
My Device: Not Specified

Re: VideoControl.getSnapshot with encoding=rgb565

I'm having the same problem.

Is there a solution?

Posts: 135
Registered: ‎11-14-2010
My Device: BlackBerry Z10 (White)
My Carrier: Vodafone

Re: VideoControl.getSnapshot with encoding=rgb565

[ Edited ]

Same problem here, I get the list of snapshot encodings using: 




This returns "encoding=rgb565" in the list of possible encoding strings. But then calling:




throws a MediaException with the message "requested format not supported". 

Posts: 150
Registered: ‎10-19-2010
My Device: Not Specified
My Carrier: Rogers

Re: VideoControl.getSnapshot with encoding=rgb565

Hi myamada!


'encoding=rgb565' is only to be used for Players that play video, not Players that capture still images. 


'encoding=jpeg' is what you must pass to VideoControl.getSnapshot() to capture a still image.  Also be sure to pass a width and a height!


Unfortunately the JSR-235 spec that we must follow is not specific enough to allow us to make the distinction as to which values apply to which cases for 'video.snapshot.encodings'.  The writers of the spec assumed that the values for 'video.snapshot.encodings' would be valid for all types of Players, but that is not true in practice unfortunately.


Hope that helps!

Posts: 27
Registered: ‎02-12-2010
My Device: Torch 9800
My Carrier: Globe/Unlocked AT&T

Re: VideoControl.getSnapshot with encoding=rgb565

I'm trying a get a snapshot of the video I'm playing using "encoding=rgb565". I was successful in getting the byte[] but when I try to create a Bitmap from that byte[], it throws an IllegalArgumentException.
Posts: 150
Registered: ‎10-19-2010
My Device: Not Specified
My Carrier: Rogers

Re: VideoControl.getSnapshot with encoding=rgb565

[ Edited ]

Hi papdoligosa.

Your problem is with the Bitmap API not getSnapshot, but either way you didn't give us any information to help you.

Do you have details? What method are you using and what arguments are you passing into it?

Also, the byte array returned from the call to getSnapshot()contains data in Little-Endian byte-order. In order to use this with the Bitmap class this data must be converted to Big-Endian byte-order first...


[Edit: Here's some freebie code that will do that swapping for you


bitmap = new Bitmap(Bitmap.ROWWISE_16BIT_COLOR, width, height );

// Swap 16-bit short data to big endian byte ordering
for (int i=0; i<rgb565Data.length; i+=2) {
    byte temp = rgb565Data[i];
    rgb565Data[i] = rgb565Data[i+1];
    rgb565Data[i+1] = temp;

bitmap.setRGB565(rgb565Data, 0, width << 1, 0, 0, width, height );