<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
width="955" height="600"
addedToStage="onInit();"
frameRate="24" >
<fx:Script>
<![CDATA[
import com.dd.screencapture.ScreenCapture;
import com.dd.screencapture.SimpleFlvWriter;
private var screenCapture:ScreenCapture;
private function onInit():void
{
screenCapture = ScreenCapture.getInstance();
screenCapture.source = stage;
screenCapture.fps = 12;
screenCapture.size( 400, 300 );
screenCapture.x = 400;
screenCapture.y = 250;
stage.addChild( screenCapture );
}
private function startRecord( event:MouseEvent ):void
{
screenCapture.record();
}
private function stopRecord( event:MouseEvent ):void
{
screenCapture.stop();
}
private function playVideo( event:MouseEvent ):void
{
screenCapture.play();
}
]]>
</fx:Script>
<s:VideoDisplay width="400" height="300" source="assets/myVideo.flv" />
<mx:HBox >
<s:Button label="Record" click="startRecord( event );" />
<s:Button label="Stop" click="stopRecord( event );" />
<s:Button label="Play" click="playVideo( event );" />
</mx:HBox>
</s:Application>
var saveFile:FileReference = new FileReference();
saveFile.save( screenCapture.data, "video.flv" );//screenCapture is the ScreenCapture instance created in the above code block.
Have a question about something in this article? You can receive help directly from the article author. Sign up for a free trial to get started.
Comments (1)
Commented:
however how can we manage the memory? as long as it's recording
all the bytes goes into the RAM, so it will be very useful to make some chunks
and send it in realtime on a server or local file to free the memory usage