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

BlackBerry® World™ Development

Reply
Contributor
sabulkalamazad
Posts: 35
Registered: ‎03-04-2010
My Device: 9381
My Carrier: Vodafone

getSnapshot() always returns null.

Hi,

 

I developing a Camera application for blackberry mobile. I am using the following code.

 

 

		public PlayCam() {
		
			try{		
				//Invoke.invokeApplication(Invoke.APP_TYPE_CAMERA, new CameraArguments()); //ARG_VIDEO_RECORDER
				Player	p = Manager.createPlayer("capture://video");
				p.realize();
				p.prefetch();
			
				VideoControl vc = (VideoControl) p.getControl("VideoControl");
				if(vc != null){
					Field viewFinder = (Field)vc.initDisplayMode(VideoControl.USE_GUI_PRIMITIVE, "net.rim.device.api.ui.Field");
					vc.setVisible(true);
					//vc.setDisplayFullScreen(true);				
					p.start();
					deleteAll();		
					add(viewFinder);	
					
					byte[] imageBytes = null;
					
					String encodingString = System.getProperty("video.snapshot.encodings");

					System.out.println(encodingString);

					String[] aa=new String[10];

					
					aa[0]="encoding=rgb565";
					aa[1]="encoding=jpeg&width=2048&height=1536&quality=superfine";
					aa[2]="encoding=jpeg&width=2048&height=1536&quality=normal";
					aa[3]="encoding=jpeg&width=1600&height=1200&quality=fine";
					aa[4]="encoding=jpeg&width=1024&height=768&quality=normal";
					aa[5]="encoding=jpeg&width=1024&height=768&quality=fine";
					aa[6]="encoding=jpeg&width=1024&height=768&quality=superfine";
					aa[7]="encoding=jpeg&width=640&height=480&quality=normal";
					aa[8]="encoding=jpeg&width=640&height=480&quality=fine";
					aa[9]="encoding=jpeg&width=640&height=480&quality=superfine";
					
					//imageBytes = vc.getSnapshot("encoding=jpeg&width=640&height=480&quality=fine");
					//imageBytes = vc.getSnapshot(null);
					for(int i=0;i<aa.length;i++){
						if(imageBytes!=null){
							imageBytes = vc.getSnapshot(aa[i]);
							System.out.println(""+imageBytes.length);
							return;
						}
						
					}
						
				} else {
					System.err.println("VideoControl is NULL");
					
				}							
			} catch (Exception me){
				System.err.println(me);
			
			}
			
		}

 

In the above code vc.getSnapshot() always returns null value. What is the problem let me know the issue. I am testing thie application on Blackberry 9530 Simulator.

 

Please use plain text.
Developer
02cp682
Posts: 80
Registered: ‎08-26-2008
My Device: 8800, 8100

Re: getSnapshot() always returns null.

I am facing the same problem... 

Anyone has any idea ???

Jeet Bhatt, India
Please use plain text.
New Contributor
pmcastillo
Posts: 4
Registered: ‎02-19-2013
My Device: None
My Carrier: None

Re: getSnapshot() always returns null.

Me too, it always return null.

Please use plain text.