Welcome!

Welcome to the Official BlackBerry Support Community Forums. This is your resource to discuss support topics with your peers, and learn from each other. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Native Development

Reply
Super Contributor
JeffLemon
Posts: 391
Registered: ‎01-13-2011
My Carrier: NA

Flash always on - CAMERA

I've looked at the camera native sample app and I am adjusting it, just having a newbie play really.

 

I'm trying to get the flash to always be on but am not having any luck, any ideas?

 

hasFlash is a bool.

 

 camera_error_t err;
    // open the specified camera
    err = camera_open(unit,
                      CAMERA_MODE_RW | CAMERA_MODE_ROLL,
                      &handle);
    if (err != CAMERA_EOK) {
        fprintf(stderr, "camera_open() failed: %d\n", err);
        return err;
    }

    hasFlash = camera_can_feature(handle, CAMERA_FEATURE_FLASH);

    if(hasFlash){

	   camera_config_flash(handle,CAMERA_FLASH_ON);
    }

 

--------------------------------------------------------------------------------------------------
BlackBerry Apps: Instruments | ARTPAD | Piano | Drums | Xylophone
Please use plain text.
BlackBerry Development Advisor
amarcon
Posts: 155
Registered: ‎07-16-2012
My Carrier: Bell

Re: Flash always on - CAMERA

 

Hi JeffLemon,

 

take a look at the HelloVideoCamera Sample App, available under https://github.com/blackberry/Cascades-Community-Samples/tree/master/HelloVideoCamera

 

Try to add

 

camera_config_videolight(mCameraHandle, CAMERA_VIDEOLIGHT_ON);

 

into void HelloVideoCameraApp::smileysurprised:nStartRear(), such as:

 

void HelloVideoCameraApp::onStartRear()
{
    qDebug() << "onStartRear";
    if (mViewfinderWindow) {
        if (createViewfinder(CAMERA_UNIT_REAR,
                             mViewfinderWindow->windowGroup().toStdString().c_str(),
                             mViewfinderWindow->windowId().toStdString().c_str()) == EOK) {
            qDebug() << "created viewfinder";
            camera_config_videolight(mCameraHandle, CAMERA_VIDEOLIGHT_ON);
        }
    }
}

 Hope this helps.

Please use plain text.
BlackBerry Development Advisor
smcveigh
Posts: 544
Registered: ‎11-29-2011
My Carrier: other

Re: Flash always on - CAMERA

Are you trying to turn the LED on?  Or do you want the flash to fire each time you take a picture?

 

If all you want is the LED with no camera, then you should be able to:

 

camera_open(....);
camera_config_videolight(handle, CAMERA_VIDEOLIGHT_ON);

 

If you are actully trying to force the flash to fire on each photo you take, then you would use camera_config_flash().  I have sample code coming for this....

 

Cheers,

Sean

 

Please use plain text.