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.

inside custom component

Native Development

Reply
New Contributor
Posts: 8
Registered: ‎12-10-2011
My Device: Playbook
My Carrier: 2042997911

Swapping camera views

[ Edited ]

Hi,

 

Lets say the front camera is open and currently in view. How would I stop the front camera and switch to the back?

 

Currently I'm using this(which crashes).

 

void App::startCamera(CameraUnit::Unit unit)
{
	qDebug() << "Starting camera";
	camera->open(unit);
	camera->startViewfinder();
}

void App::stopCamera()
{
	qDebug() << "Stopping camera";
	camera->stopViewfinder();
	camera->close();
}

void App::swapCamera()
{
	stopCamera();
	if(camera->cameraUnit() == CameraUnit::Rear)
		startCamera(CameraUnit::Front);
	else
		startCamera();
}

 Any tips appreciated.

 

Thanks!

Highlighted
Retired
Posts: 138
Registered: ‎05-11-2012
My Device: Developer
My Carrier: Developer

Re: Swapping camera views

Only thing we can suggest is that doing a stopCamera and startCamera in such close order is maybe causing problems - perhaps splitting the operations and maybe starting a delay timer might be worth a try.

 

Just a suggestion

Graham