Sample Code – Simple Recorder

Here are some simple code samples that initialize the recorder then record the screen to an MP4 file with no audio or error checking.

For more detailed code, look in the /Samples folder in the SDK install folder. Download the SDK here.

You can also see the source code on Github.

C#


using FBRecorder;

TFBRecorder fbRecorder;

fbRecorder = new TFBRecorder();

fbRecorder.ActivateProfile((TFBRecorder.TFBRecorderProfiles.SAFE_SCREEN);

fbRecorder.InitRecorder(output_file_path);

fbRecorder.StartRecording();

// go and do things...

fbRecorder.StopRecording();

 

C++


#include "/pathto/FBRecorder.h"
#include "/pathto/json.hpp"

std::unique_ptr pFBRecorder(new FBRecorder::TFBRecorder(L"/pathto/FBRecorder.dll"));

pFBRecorder->ActivateProfile(FBRecorder::TFBRecorderProfile::SAFE_SCREEN);

pFBRecorder->InitRecorder(wsMP4Filename);

pFBRecorder->StartRecording();

// go and do things...

pFBRecorder->StopRecording();


 

Python


from FBRecorder import FBRecorder, LogKind, FBRecorderProfile, FBGlobalError, FBRecorderImageFormat

fbRecorder = FBRecorder('C:\\pathto\\FBRecorder.dll')

fbRecorder.CreateRecorder()

fbRecorder.ActivateProfile(FBRecorderProfile.SAFE_SCREEN)

fbRecorder.InitRecorder('d:\\test.mp4')

fbRecorder.StartRecording()

print("recording for 10 secs...")
time.sleep(10)

fbRecorder.StopRecording()

fbRecorder.DestroyRecorder()