I am making an cross platform app that uses the Camera. I develop mainly on macOS (Catalina 10.15.2). Connecting to the camera crashes the app. Is this a known issue? Is there a work around? Below is a simple code test I was using. It appears to crash on the line - video.attachCamera(cam);. I have tested with all Air versions 32.0.0.116 - 33.1.1.63.
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.PermissionEvent;
import flash.media.Camera;
import flash.media.Video;
import flash.permissions.PermissionStatus;
var video:Video;
var cam:Camera;
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
if (Camera.isSupported)
{
cam = Camera.getCamera();
if (Camera.permissionStatus != PermissionStatus.GRANTED)
{
cam.addEventListener(PermissionEvent.PERMISSION_STATUS, function(e:PermissionEvent):void {
if (e.status == PermissionStatus.GRANTED)
{
connectCamera();
}
else
{
trace('access denied');
}
});
try {
cam.requestPermission();
} catch(e:Error)
{
// another request is in progress
}
}
else
{
connectCamera();
}
}
function connectCamera():void
{
video = new Video(640, 480);
video.attachCamera(cam);
addChild(video);
}