I have a Video Control in my Midlet. I purpose is to simply allow the user to take snapshots (similar to the camera) and do other things..
The video works fine in the emulator, but when I downloaded the app to my Motorolo V220 phone, it says "createPlayer() failed."
What is going on here? Huh Huh Huh
Please Help..
Here's a snippet of the code:
Player capturePlayer = null;
...
capturePlayer = Manager.createPlayer("capture://video");
capturePlayer.realize();
canvas = new CaptureVideoCanvas(this);
canvas.setCommandListener(this);
...
class CaptureVideoCanvas extends Canvas {
// the base midlet
CaptureVideoAndImageMIDlet midlet = null;
// the video control
private static VideoControl videoControl = null;
public CaptureVideoCanvas(CaptureVideoAndImageMIDlet midlet)
throws Exception {
this.midlet = midlet;
// initialize the video control
videoControl = (VideoControl)
midlet.capturePlayer.getControl
("javax.microedition.media.control.VideoControl");
// if not present, throw error
if(videoControl == null)
throw new Exception("No Video Control for capturing!");
// init display mode to use direct video and this form
videoControl.initDisplayMode(VideoControl.USE_DIRECT_VIDEO, this);
try { // try and set the size
videoControl.setDisplayFullScreen(true);
// videoControl.setDisplaySize(getWidth() - 30, getHeight() - 30);
// videoControl.setDisplayLocation(15, 5);
}
catch(MediaException me) {
// but some devices may not support full screen mode
videoControl.setDisplayLocation(5, 5);
try {
videoControl.setDisplaySize(getWidth() - 10, getHeight() - 10);
} catch(Exception e) {}
repaint();
}
// and make the video control visible
videoControl.setVisible(true);
}
The video works fine in the emulator, but when I downloaded the app to my Motorolo V220 phone, it says "createPlayer() failed."
What is going on here? Huh Huh Huh
Please Help..
Here's a snippet of the code:
Player capturePlayer = null;
...
capturePlayer = Manager.createPlayer("capture://video");
capturePlayer.realize();
canvas = new CaptureVideoCanvas(this);
canvas.setCommandListener(this);
...
class CaptureVideoCanvas extends Canvas {
// the base midlet
CaptureVideoAndImageMIDlet midlet = null;
// the video control
private static VideoControl videoControl = null;
public CaptureVideoCanvas(CaptureVideoAndImageMIDlet midlet)
throws Exception {
this.midlet = midlet;
// initialize the video control
videoControl = (VideoControl)
midlet.capturePlayer.getControl
("javax.microedition.media.control.VideoControl");
// if not present, throw error
if(videoControl == null)
throw new Exception("No Video Control for capturing!");
// init display mode to use direct video and this form
videoControl.initDisplayMode(VideoControl.USE_DIRECT_VIDEO, this);
try { // try and set the size
videoControl.setDisplayFullScreen(true);
// videoControl.setDisplaySize(getWidth() - 30, getHeight() - 30);
// videoControl.setDisplayLocation(15, 5);
}
catch(MediaException me) {
// but some devices may not support full screen mode
videoControl.setDisplayLocation(5, 5);
try {
videoControl.setDisplaySize(getWidth() - 10, getHeight() - 10);
} catch(Exception e) {}
repaint();
}
// and make the video control visible
videoControl.setVisible(true);
}