Anyone here worked with KetaiCamera? I’m trying to turn the flash on and off with mousePressed() and mouseReleased() but it only works the first time unless I dispose of the camera each time I turn the flash off (see code below). Anyone know why?
import ketai.camera.*;
KetaiCamera cam;
boolean flashactive = false;
void setup()
{
cam = new KetaiCamera(this, 320, 240, 24);
cam.start();
background(255, 0, 0);
}
void draw()
{
}
void onCameraPreviewEvent()
{
cam.read();
}
void mousePressed()
{
if (flashactive == false)
{
cam.start();
cam.enableFlash();
fill(0, 255, 0);
rect(0, 0, width, height);
flashactive = true;
}
}
void mouseReleased()
{
if (flashactive == true)
{
cam.disableFlash();
cam.dispose(); //flash won't turn on again if I don't dispose of camera
fill(255, 0, 0);
rect(0, 0, width, height);
flashactive = false;
}
}