Coming soon, Thinfinity VirtualUI web-enabled applications will allow you to save application sessions and replay them later.
There are many scenarios for session recording: reproduction of issues, application demos, and tutorials, technical support, audit monitoring, e-learning, etc. In this opportunity, we will review a similar Thinfinity VirtualUI feature that helps developers record sessions of their own VirtualUI web-enabled applications.
To enable this feature, VirtualUI includes a new Recorder component, available for all its supported programming languages. Using this component in your application, you can save each application session totally or partially. Afterward, you will be able to play this session in the browser within the VirtualUI web interface, or by implementing your own custom session player using the SDK.
Recording a Session
Set the Filename property of the VirtualUI.Recorder component and call its Rec() method to record an application session.
The Filename property value can include a full path, but must not include the file extension, as it will be stored automatically as .dat and .idx files.
Set the Filename property as follows:
Delphi code
VirtualUI.Recorder.Filename := 'C:\Sessions\VirtualUISession';
C++ code
VirtualUI m_VirtualUI = new VirtualUI();
...
...
m_VirtualUI->Recorder()->Filename(L"C:\\Sessions\\VirtualUISession");
C# code
private VirtualUI vui = new VirtualUI();
...
...
vui.Recorder.Filename = "C:\\Sessions\\VirtualUISession";
As with any recorder, you can start and stop recording any time you wish. You can specify more than one track for each session. These tracks are indicated in the session recording and allow you to, for example, store different application operations. Call the Rec() method and pass the track name as an argument:
Delphi code
VirtualUI.Recorder.Rec('Track 1');
C++ code
m_VirtualUI->Recorder()->Rec(L"Track 1");
C# code
vui.Recorder.Rec(“Track 1”);
In order to stop the recording, call the Stop method:
Delphi code
VirtualUI.Recorder.Stop();
C++ code
m_VirtualUI->Recorder()->Stop();
C# code
vui.Recorder.Stop();
Afterwards, you can start another recording with the Rec() method. If you keep the same track name, the recording will resume and the session will be stored after the previous session in the same file, in a new track. Change the track name to avoid ending up with two tracks that have the same name in the same session recording.
The OnRecorderChanged event
Use the VirtualUI.OnRecorderChanged event to listen for any change in the Recorder status.
These are the possible status values:
State | It reports the Recorder state: | ||
Inactive | 0 | No action is being made. | |
Recording | 1 | A session is being recorded. | |
Playing | 2 | A session is being played. |
The following examples show how to assign an event handler to this event in the most used languages:
Delphi code
procedure TMainForm.RecorderChanged(Sender: TObject);
var msg: string;
begin
msg := '';
case VirtualUI.Recorder.State of
Inactive: msg := 'Recorder is inactive';
Playing: msg := 'Recorder is Playing';
Recording: msg := 'Recording session';
end;
ShowMessage(msg);
end;
...
VirtualUI.OnRecorderChanged := Mainform.RecorderChanged;
C++ code
void RecorderChanged(void) {
CString stateStr;
switch (m_VirtualUI->Recorder()->State()) {
case Inactive: stateStr = _T("Recorder is inactive"); break;
case Playing: stateStr = _T("Recorder is Playing"); break;
case Recording: stateStr = _T("Recording session"); break;
}
MessageBox(0, stateStr, L"OnRecorderChanged called", 0);
}
...
m_VirtualUI->OnRecorderChanged = RecorderChanged;
C# code
private void RecorderChanged(object sender, RecorderChangedArgs e)
{
string message = "";
switch (vui.Recorder.State) {
case RecorderState.Inactive:
message = "Recorder is inactive";
break;
case RecorderState.Playing:
message = "Recorder is playing";
break;
case RecorderState.Recording:
message = "Recording session";
break;
}
MessageBox.Show(message, "OnRecorderChanged called");
}
...
vui.OnRecorderChanged += RecorderChanged;
As you can see, with a few lines of code, you will be able to save sessions of a Thinfinity VirtualUI web-enabled application. In an upcoming post we will explain how to play a Thinfinity VirtualUI session recording.
You may wish to review our article about remote desktop session recording to learn how to record and play Thinfinity Remote Desktop Server sessions.