Video/Screen Recorder for web application

2019-04-02 16:56发布

I am working on Virtual Classroom project (which is developed in flex) in which we have to add a recording function so that end user can get recorded video file of the session at the end. which technology should I use for the same?

1条回答
一夜七次
2楼-- · 2019-04-02 17:09

try this :

<?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>

download and add this swc liberary to your project build path :

ScreenRecorder.swc

查看更多
登录 后发表回答