BlackBerry - is it possible to hide the video field?

I want to write an application, for example, a flashlight (using 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 fine, but I want to hide it videoField. When I removed add(videoField)or used videoControl.setVisible(false), the flashlight does not work. Can someone explain why?

How can I turn on the lights with hidden videoField?

+5
source share
1 answer

I just got a bb that had a flash, I wanted to try my hand at the same problem. In the end, I still had to work. On the subject that I observed during the entire testing period, it was that if the video coverage is hidden, as you said, the flash will not work ... So, the trick I did was

    <pre>
    _videoControl.setDisplaySize( 1 , 1 );
    </pre>

.

    <pre>
    _videoControl.setDisplaySize( 0 , 0 );
    </pre>

... ,

    <pre>
    _videoControl.setVisible(true);
   </pre>

-1

All Articles