Chapter 28. Accessing Microphones and Cameras
Introduction
In this chapter
Working with cameras
Working with microphones
Too often, Flash Player is viewed strictly as a way to show things to the user, instead of as a communicative tool. One of the most powerful ways to use Flash Player is as a tool that the user can communicate with to use microphones or cameras attached to the computer. Flash provides a Camera
and a Microphone
class to allow you to access these peripherals, as well as a safeguard mechanism to ensure that users share only what they want to share.
Introducing the Camera
To create a camera object, you call the getCamera()
method. This returns an array of all the cameras currently attached to the user's computer and, if you haven't specified a camera to use, selects the first camera that the Flash Player comes across.
When a SWF file tries to access the camera returned by getCamera()
, Flash Player displays a dialog box that lets the user choose whether to allow or deny access to the camera, as shown in Figure 28-1 . Make sure your application window size is at least 215×138 pixels; this is the minimum size Flash Player requires to display the dialog box. The user may also utilize the Flash Player Settings Manager to allow or deny access to his camera and microphone globally, in which case this dialog will not appear.
Figure 28.1. Figure 28-1: Allow Camera Access dialog
When ...
Get ActionScript™ 3.0 Bible now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.