I am working on a flash video chat system. I need to get the video buffer bytes from the webcam to be able to transfer the video content over a socket server. I am not sure how to do this, does anyone have any ideas? Thanks.
I know how to use the webcam basics, the code:
var camera = Camera.getCamera();
var video = new Video(camera.width, camera.height);
video.attachCamrea(camera);
/*
I need something like
var byte_buffer = video.getBytes();
*/
I don’t know how to do this, any help would be much appreciated.
No problem. You’ll need to create a
BitmapDataobject and ‘draw’ your display object – the one referenced byvideovariable – ‘into’ this bitmap data. You can then access the pixels through, say, thegetPixelsmethod which returns aByteArraywhich is your de facto buffer class in Flash Player. The drawing is like taking a snapshot bitmap copy of your display object.Find out more at Adobe ActionScript 3 Reference which should be your best friend as long as you program the Flash Player: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/BitmapData.html
Here is some code for illustration: