Skip to main content
pecacheu
Inspiring
Sep 21, 2013 5:14 PM UTC
Question

That Darn Camera API

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 is closed to new replies. Start a new post to keep the conversation going.

2 replies

Inspiring
Sep 23, 2013 4:47 PM UTC

You can drop the connection to a camera by doing

vid1.attachCamera(null)

hope that helps

Translate
pecacheu
pecacheuAuthor
Inspiring
Sep 23, 2013 6:44 PM UTC

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?

Translate