1

I know that we can not record/Access anything out of flash player, because of it's security sandbox. Instead We can record the video while streaming it to server. like

   netStream.publish("YourFileName.flv","record");

But in recorde file, I will get only a video file Published by webcam to server and i want to record entire session.

Is there any way to record it locally, or Can i record the window ??

p.s. : I am not trying to access anything outside of flash player.

Thanks in advance...

UniCoder
  • 3,005
  • 27
  • 26
  • possible duplicate of [Can Flex/Flash Record the Screen?](http://stackoverflow.com/questions/613545/can-flex-flash-record-the-screen) – ketan Apr 08 '15 at 06:16
  • When you say "record the window", what exactly do you mean? The entire screen? Browser window? Air on desktop? Or entire contents of the swf itself? – Jason Reeves Apr 09 '15 at 17:30
  • @Jason Reeves : I want to record entire contents of the swf itself. – UniCoder Apr 10 '15 at 20:52

1 Answers1

2

ok, so you can record the entire contents of the swf like this:

first, create a container object (anything that extends DisplayObject which implements IBitmapDrawable) then place everything that you want to capture (video view and everything else in your "session") then using an ENTER_FRAME event or Timer (preferable to control capture fps), draw the container to a BitmapData using BitmapData.draw(container). Pass that BitmapData to the FLV encode library found here using it's addFrame() method (docs and examples come with that library... super easy) and that's it! When you are done, you will have an flv video containing a frame by frame "screen capture" of what was going on in your swf! Just make sure EVERYTHING is in the container! That lib also accepts captured audio too if you want.

private function startCapturing():void{
    flvEncoder.start(); // see the libs docs and examples

    var timer:Timer = new Timer(1000/15); //capture at 15 fps
    timer.addEventListener(TimerEvent.Timer, onTimer);
    timer.start();
}

private function onTimer(event:TimerEvent):void{
    var screenCap:BitmapData = new BitmapData(container.width, container.height);
    screenCap.draw(container);

    flvEncoder.addFrame(screenCap); // see the libs docs and examples
}
Jason Reeves
  • 1,716
  • 1
  • 10
  • 13