Trick: Auto-select mac iSight in flash.

If you’ve been messing around with Augmented Reality (or any webcam stuff in flash for that matter), you may have come to the realization that many mac users may not have their proper webcams (i.e. iSights) set by default. In a commercial setting, you want to avoid a person having to select their webcam at almost all costs — it’s another barrier to entry, and can be confusing, too. Especially if you have video editing software installed, there can be a lot of options, as you can see below.

camerasettings

However, it’s easy to check and see if the person has an iSight installed and, if so, automatically choose that one.

var index : int = 0;

for ( var i : int = 0 ; i < Camera.names.length ; i++ ) {

if ( Camera.names[ i ] == "USB Video Class Video" ) {

index = i;

}

}

//Oddly, Camera.getCamera needs a string of the camera index, NOT the name of the camera.

_webcam = Camera.getCamera( String( index ) );

VoilĂ . You’re now covered for mac users and windows users won’t notice a thing.

Twitter