I want to write an application like a Flashlight (with the help of the camera LED).
Player player = javax.microedition.media.Manager.createPlayer("capture://video?encoding=video/3gpp");
player.realize();
VideoControl videoControl = (VideoControl) player.getControl("VideoControl");
if(videoControl != null)
{
videoField = (Field)videoControl.initDisplayMode( VideoControl.USE_GUI_PRIMITIVE, "net.rim.device.api.ui.Field" );
try
{
videoControl.setDisplaySize(1, 1);
}
catch(Exception e)
{
PGLogUtil.logString(e.toString());
}
videoControl.setVisible(true);
add(videoField);
FlashControl flashControl = (FlashControl)
player.getControl("javax.microedition.amms.control.camera.FlashControl");
setFlashlight(true);
}
player.start();
The code above works perfectly, but I want to hide the videoField
. When I removed add(videoField)
or use videoControl.setVisible(false)
, the flashlight does not work. Can someone explain why?
How I can turn lights on with a hidden videoField
?