J2ME video capture throws MediaException: Invalid locator: capture://video

780 views Asked by At

I was trying to capture a video in a J2ME application with the following snippet

private void createCamera() throws IOException, MediaException {
    videoComponent = VideoComponent.createVideoPeer("capture://video");
    videoComponent.setPreferredH(height);
    videoComponent.setPreferredW(cameraForm.getWidth());
    player = (Player) videoComponent.getNativePeer();
    player.realize();
    player.prefetch();
    videoControl = (VideoControl) player.getControl("VideoControl");
}

When I run the application on a real device, I get the error:

javax.microedition.media.MediaException: Invalid locator: capture://video

If I use the string capture://image it will only show the camera for images only. How do I go about solving this problem?

1

There are 1 answers

1
Aleksej Vasinov On

Maybe you are to try get by device name, like devcam0/devcam1? Do you use nokia phone?