Je rencontre des problèmes lors de la prise de vue en utilisant la méthode VideoControl.getSnapshot(). Il lance toujours l'exception: getSnapshot non pris en charge. J'utilise JRE 5.0.0 avec Eclipse et BlackBerry® Java® SDK 5.0 Plugin. Ce que je fais d'abord est de lister l'encodage supporté par Blackberry SmartPhone sélectionné (bold 9700) avec la commande System.getProperty ("video.snapshot.encodings") et de sélectionner un encodage dans la liste et de le passer comme getSnapshot argument.getSnapshot non pris en charge sur Blackberry
J'ai testé sur plusieurs Blackberry et la même exception est levée.
Une partie du code:
mPlayer = Manager.createPlayer("capture://video?encoding=video/3gpp");
mPlayer.realize();
mPlayer = Manager.createPlayer("capture://video?encoding=video/3gpp");
mPlayer.start();
videoControl = (VideoControl)mPlayer.getControl("VideoControl");
Field cameraView = (Field) videoControl.initDisplayMode(VideoControl.USE_GUI_PRIMITIVE, "net.rim.device.api.ui.Field");
Thread.sleep(1000);
UiApplication.getUiApplication().pushScreen(new TempScreen(cameraView));
byte[] snapShot = videoControl.getSnapshot("encoding=jpeg&width=480&height=360&quality=superfine");
Bitmap image = Bitmap.createBitmapFromBytes(snapShot, 0, snapShot.length, 1);
UiApplication.getUiApplication().pushScreen(new TempScreen(image));
}catch (MediaException e){
UiApplication.getUiApplication().pushScreen(new TempScreen("Exception: " + e.getMessage())); }
catch (IOException e){
UiApplication.getUiApplication().pushScreen(new TempScreen("IO Exception: " + e.getMessage()));
}
catch (InterruptedException e){UiApplication.getUiApplication().pushScreen(new TempScreen("Interrupted Exception: "+ e.getMessage()));}