Quantcast
Channel: Adobe Community : Popular Discussions - Archived Discussions
Viewing all articles
Browse latest Browse all 21156

webcam not working with adobe air

$
0
0

hey frnds,

i'm trying to capture webcam snaps and storing it on local desktop.

Below code of capuring snap is working with flex but same code not working in adobe air.

I'm using Adobe Flash builder beta 2

is any setting is required to use webcam with adobe air?

 

i'm using following code

<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
                       xmlns:s="library://ns.adobe.com/flex/spark"
                       xmlns:mx="library://ns.adobe.com/flex/halo" creationComplete="init();">
    <fx:Declarations>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>
    <fx:Script>
        <![CDATA[
            import mx.controls.Alert;
            import mx.core.UIComponent;
            import flash.media.Camera;
            import flash.media.Video;
           
            private function videoDisplay_creationComplete() : void
            {
                var camera:Camera = Camera.getCamera();
               
                if (camera)
                {
                    videoDisplay.attachCamera(camera);                   
                }
                else
                {
                    Alert.show("Oops, we can't find your camera.");
                }
            }
           
            private function capture_click() : void
            {
                var snap:BitmapData = new BitmapData(320, 240, true);
                var snapBmp:Bitmap = new Bitmap(snap);
               
                snapBmp.width = 320;
                snapBmp.height = 240;
               
                if(snapshotHolder.numChildren > 0)
                    snapshotHolder.removeChildAt(0);
               
                snapshotHolder.addChild(snapBmp);               
                snap.draw(videoDisplay);               
            }          
    ]]>
    </fx:Script>
    <mx:HBox>
        <s:Panel title="Video">
            <mx:VideoDisplay id="videoDisplay" creationComplete="videoDisplay_creationComplete();" width="320" height="240" />       
        </s:Panel>
        <s:Panel title="Snapshot">
            <mx:UIComponent id="snapshotHolder" width="320" height="240" />
        </s:Panel>       
    </mx:HBox>
    <mx:HBox>
        <mx:Button label="reload camera" click="videoDisplay_creationComplete();"/>
        <mx:Button label="capture" click="capture_click();"/>  
    </mx:HBox>

</s:WindowedApplication>

 

Camera is connected but cannot see anything inair,

plz guide me in this.

thx in advanced,

 


Viewing all articles
Browse latest Browse all 21156

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>