Welcome, Guest. Please login or register.
Did you miss your activation email?
31 Jul 2010, 11:39:53 UTC
Forum home
+  flexdeveloper.eu Forum
|-+  Flex and ActionScript 3.0
| |-+  Streaming, Video & OSMF (Moderators: flexy, Jan K, James)
| | |-+  Can't grab snapshot from netstream .. why?
« previous next »
Pages: [1] Print
Author Topic: Can't grab snapshot from netstream .. why? (Read 1353 times)
postvard
Newbie FD
*
Posts: 2


« on: 20 Aug 2009, 14:57:11 UTC »

Hello all,
here is a problem that does not let me sleep at nights...!!!!!!!!!
I have video object to which I attached netstraem object .. I have to click a button and gram a snapshot .. with web cam all work fine , but no luck with netstream.. what to do , please suggest something ... I've got anxious to surf the web  here is my code
as3
Code:
private function snapshotHandler(event:MouseEvent):void{
    var bitmapData:BitmapData=new BitmapData(SNAPSHOT_WIDTH, SNAPSHOT_HEIGHT);
var bitmap:Bitmap=new Bitmap(bitmapData);
bitmapData.draw(incoming.getDisplay());
var jpegEncoder:JPGEncoder=new JPGEncoder(75);
jpegBytes=jpegEncoder.encode(bitmapData);
//this is excact byte amount of empty video display
if(jpegBytes.length==11951){
Alert.show("You have no access to take a snapshot");
return;
}
Alert.show("Shnapshot has been grabbed");
red5Conn.call("createFile", responder,jpegBytes);



}
   
and here is my red5/java code
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="popoloz.jpg";
    if(bufferedImage!=null){
    ImageIO.write(bufferedImage,"JPEG",new File(fileName));
    }else{
    return "bufferedImage is null";
    }
    }catch (Exception e) {
return "ecxeption occured";
}
    }
   
return  "default return";
}
« Last Edit: 20 Aug 2009, 16:25:06 UTC by flexy » Logged
flexy
flexdeveloper.eu
Guru/Addict FD
*****
Posts: 3,155


Recovering Coffee Addict & Adobe Expert


WWW
« Reply #1 on: 20 Aug 2009, 16:32:09 UTC »

Hi, welcome to Flexdeveloper.eu

1) I'm moving the post over to our video and streaming board, as it's more at home there.

2) I can see that you're streaming video into your app using Red5 server right? You're trying to capture a JPEG from a frame of the video right?

I suspect the problem here is between the protocol that video from a web cam uses vs the RTMP protocol used by Red5/FMS. Adobe intentionally put some additional security around RTMP:

Quote
Restricted access to media data originating from RTMP servers: Flash
Player 9 cannot access video data or sound spectrum data for media loaded
from RTMP (Flash Media Server) sources, although it can display and play
video and sounds loaded from these servers.
(Source: http://www.adobe.com/devnet/flashplayer/articles/flash_player_9_security.pdf)

The reason? Delivery of video content on the Internet is big business for Flash Player at the moment, but for content owners to be happy, there has to be some content protection. Stopping access to RTMP stream data is one of the restrictions that has been imposed.

3) What error are you receiving, you didn't mention this in your post?
Logged

Pages: [1] Print
« previous next »
Share this on: Twitter Twitter Del.icio.us del.icio.us Digg Digg
Jump to:

©2006-2010 Flexdeveloper.eu/Jodie O'Rourke. All rights reserved.
Adobe®, Adobe® Flash™, Adobe® AIR™ and Adobe® Flex™ are registered trademarks of Adobe Systems Incorporated in the United States and other countries. All rights reserved.

Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC