Skip to main content
pecacheu
Inspiring
September 21, 2013
Question

That Darn Camera API

  • September 21, 2013
  • 1 reply
  • 556 views

It's a nice API, but it's not working like I wan't it to in my Adobe AIR app (desktop AIR, and no it's not Flex.)

This is basicly the code that haldels the cameras:

...

cam1 = Camera.getCamera("0"); //Bult-in Front Camera

cam2 = Camera.getCamera("1"); //Bult-in Back Camera

cam3 = Camera.getCamera("2"); //USB Webcam

vid1.attachCamera(cam1);

vid2.attachCamera(cam2);

vid3.attachCamera(cam3);

...

It works like normal at first, but if I connect another camera, or disconnect a camera, that camera's view freezes, but flash still thinks it's connected, and "Camera.names" still lists it.

I also tried calling this code every 500ms with setInterval, but with the same result.

How can I get flash to update the Camera API when a camera is connected/disconnected?

This topic has been closed for replies.

1 reply

Inspiring
September 23, 2013

You can drop the connection to a camera by doing

vid1.attachCamera(null)

hope that helps

pecacheu
pecacheuAuthor
Inspiring
September 23, 2013

Well, that worked for droping the connections to the cameras, but the camera list still won't reload. If I connect anthother, it can't tell, same if I unplug one.

Maybe I can attach to as many cameras as I can, and then disconnect any that aren't sending new frames. Is there any way to do that?