Hello all. This is my first post to this forum, so if I’ve posted in the wrong section, I apologize.
I’ve set up Red5 on one of my servers. I’ve created a “caster” flash app and a “viewer” flash app. Basically this is a “one-to-many” webcam streaming application.
Everything is working fine. Users can fire up their webcam and connect to the server and broadcast. Viewers can connect to the streams with the “viewer” app just fine.
What I’m trying to implement now, are snapshot and record buttons on the viewer side. Right now I am just focusing on snapshots.
I’ve found lots of examples/tutorials on how to take a snapshot using your own webcam. However, when I try to implement these on the “viewer” side, it doesn’t work. When I try to search for code examples on how to capture streaming data, everything that comes up is software for sale.
For example, this code just doesn’t work:
var bitmapData:BitmapData = new BitmapData(320,240);
bitmapData.draw(video); // video is defined earlier, and is the video stream.
var file:FileReference = new FileReference();
var jpg:JPGEncoder = new JPGEncoder();
var ba:ByteArray = jpg.encode(bitmapData);
file.save(ba, 'test_file.jpg');
If I use this code in the “caster” app, it works just fine. But on the viewer side it fails. Through trial and error I’ve determined that the line that is failing is:
bitmapData.draw(video);
So I think it must have something to do with this being a streamed video.
Any help is greatly appreciated. I have been struggling with this for 2 days now.