Capturing Webcam Video
September 26, 2006 | 0 comments
Capturing Webcam Video
Since the release of Flash Player, you can capture the video stream from a webcam and display it inside a Flash Movie. All you need to do to accomplish this feat is place a Video symbol on the Stage and write a little ActionScript. It sounds complicated, but it is actually quite simple, follow these steps to try it for yourself:
- Open the Library (press Control + L).
- Create a new Video symbol from the Library menu in the top right-hand corner.
- In the Video Properties dialog box, verify that the Video (ActionScript-Controlled) option is selected and click the OK button.
- Go to the main Timeline and select the first frame.
- Drag the Video symbol from the Library onto the Stage.
- Select the Video symbol on the Stage then open the Property inspector (Control + F3).
- Enter a unique name in the Instance Name field so you can talk to the video object with ActionScript. For now, enter output_vid for the instance name.
- Open the Actions panel on the first frame of the main Timeline (F9) and add the following code:
/*
capture the video stream from the active webcam
and display it inside the video object
*/
output_vid.attachVideo(Camera.get()); - That’s it! Test your movie (press Control + Enter).
- Flash Player asks the viewer for permission to access the webcam.
- If permission is granted, the Video object you put on the Stage will display the video stream from the webcam.
Comments