Copy link to clipboard
Copied
For a certain demonstration of a video recording application at my workplace, we were using a panaromic camera, which required an external power source to remain turned on.
The video was recording fine, but suddenly, owing to a power fault, the camera turned off.
Now, my AS3 code wasn't prepared to handle a camera getting disconnected during recording - so I would like to know what happens when such a thing does happen. Does the Camera object become null? Does it trigger a particular event that I need to add an eventlistener for, on the Camera object?
I checkedthe documentation, and such a scenario hasn't been dealt with there.
Can anyone help?
Copy link to clipboard
Copied
you should be able to catch camera-discomnnetion wth sth like:
var cam:Camera = Camera.getCamera();
stage.addEventListener(Event.ENTER_FRAME, checkCam);
function checkCam(e:Event):void{
if (cam== null)
{
//do something
}
}