Displaying a webcam’s video in a Flex VideoDisplay control
The following example shows you how you can display a user’s webcam feed in a VideoDisplay control using the static Camera.getCamera()
method and VideoDisplay class’s attachCamera()
method.
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white"> <mx:Script> <![CDATA[ import mx.controls.Alert; private function videoDisplay_creationComplete():void { var camera:Camera = Camera.getCamera(); if (camera) { videoDisplay.attachCamera(camera); } else { Alert.show("You don't seem to have a camera."); } } ]]> </mx:Script> <mx:VideoDisplay id="videoDisplay" creationComplete="videoDisplay_creationComplete();" width="160" height="120" /> <mx:Button id="button" label="Reload Camera" click="videoDisplay_creationComplete();" /> </mx:Application> |
9:34 AM
|
Labels:
Flex Samples,
Flex with Video
|
This entry was posted on 9:34 AM
and is filed under
Flex Samples
,
Flex with Video
.
You can follow any responses to this entry through
the RSS 2.0 feed.
You can leave a response,
or trackback from your own site.
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment