I have tried using MediaComponent
, but since it is now deprecated it wont be good moving forward. Also i was not able to get it to re-size to full screen on the form. I am trying to use VideoComponent
to capture a screen shot in an S40 device. I cant find how to instantiate the VideoComponent
properly for capturing an image and not playing a video.
Asked
Active
Viewed 1,474 times
4
-
I ended up using MediaComponent but the javadocs say that it will not be supported in the next build. – Ajibola Oct 15 '11 at 00:10
-
has you tried with my answer? – frayab Oct 19 '11 at 09:11
-
@frayab i didnt try your answer yet, i already went with media component since it resolved my issue and you had not answered by then. I ended up shelving the feature, will try it later when adding the feature. – Ajibola Jan 11 '12 at 01:13
2 Answers
3
You can use VideoComponent for capturing an image.
First, to instantiate the VideoComponent, you need to create a native peer:
VideoComponent videoComponent = VideoComponent.createVideoPeer("capture://video");
Player player = (Player) videoComponent.getNativePeer();
player.realize();
VideoControl videoControl = (VideoControl) player.getControl("VideoControl");
To capture the image, you have to start video component and use getSnapshot of Video Control:
videoComponent.start();
videoControl.getSnapshot(null);
If you want to resize the video component to full screen you can use:
videoComponent.setFullScreen(false);
Other posibility is:
videoComponent.setPreferredH(Display.getInstance().getDisplayHeight());
videoComponent.setPreferredW(Display.getInstance().getDisplayWidth());

frayab
- 2,512
- 20
- 25
-
I ended up using this as well, but the quality of the image is poor, compared to the native camera. I tried adding size while calling getSnapshot but was getting all kinds of errors. Any help with this? – Ajibola Mar 30 '13 at 11:25
1
Right now the VideoComponent
is mostly designed for playback and doesn't really work well for capture. We will try to improve it in the near future to make it more flexible. Its relatively easy to migrate from MediaComponent
to VideoComponent
so it shouldn't be a problem.

Shai Almog
- 51,749
- 5
- 35
- 65