From a Flash object, I would like to be able to detect the presence of a webcam that the user might grant access to, without actually asking the user whether they want to grant access. This is to streamline a large application that has extra features if a webcam exists — if there is a webcam, the application will present several dialogs that lead up to the normal cam-security prompt, but if the user doesn't have the hardware, I want to skip over them altogether. Requesting access to the cam before those dialogs won't make sense to the user.
It appears not to be possible to call Camera.getCamera()
without the security prompt happening. Is there a workaround? (For instance, could I, perhaps, call getCamera
in a hidden Flash object and inspect its return value, or does it block until the user acknowledges the security prompt?)
This works with Haxe but should be possible with ActionScript 3 too.
if (Camera.names.length != 0) {
// user has camera
// this triggers the access dialog
var camera:Camera = Camera.getCamera();
}
else {
// user has no camera
}