我正在研究Virtual Classroom项目(在flex中开发),我们必须在其中添加录制功能,以便最终用户可以在最后获得会话的录制视频文件。我应该使用哪种技术?
答案 0 :(得分:0)
试试这个:
<?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();
}
private function saveVideo( event:MouseEvent ):void
{
var saveFile:FileReference = new FileReference();
saveFile.save( screenCapture.data, "record.flv" );
}
]]>
</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 );" />
<s:Button label="Save" click="saveVideo( event );" />
</mx:HBox>
</s:Application>
下载并将此swc库添加到项目构建路径中: