Dear quinrou ,
Thanks a lot for your assistance.
I tried to use this variant also , but did not have any success.It seems
that application cannot find the path specified , but user.jpg is located
on red5 sever's SnapShot
<http://localhost:5080/SnapShot/user.jpg>application folder (I'm
requesting it by
http://localhost:5080/SnapShot/user.jpg)<http://localhost:5080/SnapShot/user.jpg>.

Probably the problem is in Flash Player's (I'm using FP 9) security
settings. On red5's root directory there is a crossdomain.xml file wich
restricts to use sevrer's resourses from different domains. Here my
crossdomain.xml
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM
"http://www.adobe.com/xml/dtds/cross-domain-policy.dtd";>

<cross-domain-policy>
    <allow-access-from domain="*"/>
</cross-domain-policy>
thus I allow all domains to use my red5 resources.But this also did not
work.Please write your oppinoin about this issue , as I Have to configure
this file properly ,
Also when I'm trying to grab snapshots form the Netstream I'm getting , the
following error, which is relates to crossdomain.xml too

SecurityError: Error #2123: Security sandbox violation: BitmapData.draw:
file:///C|/Documents%20and%20Settings/Administrator/My%20Documents/Flex%20Builder%203/ScreenShootTest/bin%2Ddebug/ScreenShootTest.swf
cannot access rtmp://localhost/SnapShot. No policy files granted access.
    at flash.display::BitmapData/draw()
    at
profilePageControl.videoControls::TomographPaneControl/snapshotHandler()[C:\Documents
and Settings\Administrator\My Documents\Flex Builder
3\ScreenShootTest\src\profilePageControl\videoControls\TomographPaneControl.as:102]

here is AS3 code


private function snapshotHandler(event:MouseEvent):void{


    var bitmapData:BitmapData=new BitmapData(snapshot.width,
snapshot.height);
    var bitmap:Bitmap=new Bitmap(bitmapData);
    stream.checkPolicyFile=true;
    bitmapData.draw(incoming.getDisplay());
    var jpegEncoder:JPGEncoder=new JPGEncoder(75);
     jpegBytes=jpegEncoder.encode(bitmapData);
    Alert.show(jpegBytes.length.toString());
    snapshot.addChild(bitmap);

    snapshotCanvas.addChild(snapshot);
    red5Conn.call("createFile", responder,jpegBytes);




}
 red5/java code
public String createFile(ByteArray jpegByteArray){
        byte [] byteArray=new byte[jpegByteArray.length()];
         jpegByteArray.readBytes(byteArray);
         if(jpegByteArray.length()==0){
             return "jpegByteArray is empty";

         }if(byteArray.length==0){
             return "byteArray is empty";
         }else{
             try{
                ByteArrayInputStream byteArrayInputStream=new
ByteArrayInputStream(byteArray);
                BufferedImage
bufferedImage=ImageIO.read(byteArrayInputStream);
                String fileName="snapshot.jpg";
                if(bufferedImage!=null){
                    ImageIO.write(bufferedImage,"JPEG",new File(fileName));
                }else{
                    return "bufferedImage is null";
                }
             }catch (Exception e) {

            }
         }

        return  "default return";
    }


looking forward to here from you

On Sat, Aug 15, 2009 at 1:17 PM, quinrou . <[email protected]> wrote:

> use the image class ffrom the flex framework it will load and display your
> image
>
> image = new Image();
> image.source = http://localhost:5080/SnapShot/user.jpg
>
> tileList = new TileList();
> tileList.addChild( image );
>
> On Thu, Aug 13, 2009 at 3:20 PM, Varduhi Sargsyan <[email protected]>wrote:
>
>> Dear all ,
>> I 'm very new in AS3/flex programing
>> I  have to take some snapshots from video stream , save them as .jpg or
>> .png files
>>  on red5 server which I have done already .Also they must appear next to
>> each other  on AS3/Flex interface which I have  every time I click "take a
>> snapshot" button.
>> the following code doesn't work somehow, plz  point to the wrong thing
>> here
>>
>> loader=new Loader();
>> snapshot=new UIComponent();
>> loader.load(new URLRequest("http://localhost:5080/SnapShot/user.jpg";));
>> this.snapshot.addChild(loader);
>> this.snapshotCanvas.addChild(snapshot);
>>
>> any help will be appreciated, thanks
>>
>> _______________________________________________
>> osflash mailing list
>> [email protected]
>> http://osflash.org/mailman/listinfo/osflash_osflash.org
>>
>>
>
> _______________________________________________
> osflash mailing list
> [email protected]
> http://osflash.org/mailman/listinfo/osflash_osflash.org
>
>
_______________________________________________
osflash mailing list
[email protected]
http://osflash.org/mailman/listinfo/osflash_osflash.org

Reply via email to