Search
Link Search Menu Expand Document
Kony Quantum is now HCL Volt MX. See Revised Terminology. Current Quantum users, see the important note about API naming.

voltmx.screenrecorder Namespace

The voltmx.screenrecorder namespace, helps you to implement the screen record feature of WebRTC in your web apps.

You can use the functions available in the voltmx.screenrecorder namespace to start, pause, resume, and stop the screen recording. To know the current state of the recording, use the getrecordedstate API. After the screen recording has been completed, use the getrecordeddata API to fetch the video as a Blob URL.

The APIs in voltmx.screenrecorder namespace are applicable only for the Desktop Web platform.

Note: This feature is currently supported only in Google Chrome ( v72 and later) , Mozilla Firefox( v66 ) and Opera(v60).

Functions

The voltmx.screenrecorder namespace contains the following functions.

voltmx.screenrecorder.start

You can use the start API to initiate the recording of the screen. When this method is invoked, the web browser asks for permission to select the window, tab, or screen.

Syntax

voltmx.screenrecorder.start(config);

Parameters

config

The config parameter consists of a JavaScript object. It contains the following attributes.

Attributes Description
framerate Framerate is the number of consecutive images/ frames that appears on a screen per second. The default value is 30fps. This is an optional parameter.
onFailure onFailure contains the callback that is invoked when an error occurs while recording, For example, this callback is invoked when the web browser does not support the screen recording feature. This is an optional parameter.

The callback for the onFailure key must have the following signature.

onFailureCallback(err);

here, the err parameter is a string that contains the reason for the failure.

Example

config = {
 framerate: 24,
 onFailure: function(err) {  
//Sample code for onFailure callback, where err contains the error message.
  voltmx.print("Error :" + err);
 } 
};
voltmx.screenrecorder.start(config);

Return Values

None


voltmx.screenrecorder.pause

You can use the pause API to temporarily stop the recording of the screen. You can restart the recording process by using the resume API.

Syntax

voltmx.screenrecorder.pause();

Parameters

None

Example

 voltmx.screenrecorder.pause();	

Return Values

None


voltmx.screenrecorder.resume

You can use the resume API to restart the screen recording after the pause API has been invoked.

Syntax

voltmx.screenrecorder.resume();

Parameters

None

Example

 voltmx.screenrecorder.resume();	

Return Values

None


voltmx.screenrecorder.stop

You can use the stop API to end the screen recording. After the recording process is stopped, you can use the getrecordeddata API to retrieve the Blob URL of the video.

Syntax

voltmx.screenrecorder.stop();

Parameters

None

Example

 voltmx.screenrecorder.stop();	

Return Values

None

Remarks

  • After you have invoked the stop API, invoke the getrecordeddata API to retrieve the screen recording. If you invoke the start API before invoking the getrecordeddata API, the new recording overrides the previous recording. The previous recording is not retained and you will lose the data.

voltmx.screenrecorder.getrecordeddata

You can use the getrecordeddata API to retrieve the screen recording in the form of a Blob URL.

Syntax

voltmx.screenrecorder.getrecordeddata();

Parameters

None

Example

var blob = voltmx.screenrecorder.getrecordeddata();

Return Values

Returns a Blob URL of the screen recording as a String.

Note: In the Opera(v60) web browser, if you assign the Blob URL of the screen recording to the source property of the Video widget, the recording may not start. This is because the Opera(v60) web browser has a technical limitation while playing an HTML5 video.


voltmx.screenrecorder.getrecordedstate

You can use the getrecordedstate API to retrieve the current state of the screen recording.

Syntax

voltmx.screenrecorder.getrecordedstate();

Parameters

None

Example

var state = voltmx.screenrecorder.getrecordingstate();

Return Values

This API can return any one of the following values.

State Description
inactive The screen recording has not started or it has been stopped.
paused The screen recording has been paused.
recording The screen is being recorded.