Class Signage#captureScreen

Signage

Class Summary
Constructor Attributes Constructor Name and Description
 
Signage#captureScreen(successCallback, errorCallback, options)

Gets screen capture image.

Class Detail

Signage#captureScreen(successCallback, errorCallback, options)

Gets screen capture image. Captured screen image will be returned as JPEG image encoded in base64 string.

function doCapture(){
  var signage = new Signage();
  
  var successCB = function(cbobj){
     var data = cbobj.data;
     var size = cbobj.size;
     var encoding = cbobj.encoding;		
     console.log("Got Data size:" + size);	
     console.log("Got Data encoding :" + encoding);				
     console.log("Got Data :" + data);		
	
     var capturedElement = document.getElementById('captured_img');
     capturedElement.src = 'data:image/jpeg;base64,' + data;
  };
		
  var failureCB = function(cbobj){
     console.log(JSON.stringify(cbobj, null, 3));
  }

  var options = { 
     save : true
  };   
   
  signage.captureScreen(successCB, failureCB, options);
}
Parameters:
{Function} successCallback
success callback function.
{Function} errorCallback
failure callback function.
{Object} options
PropertyTypeDescriptionRequired
saveBooleantrue : saves the captured image file(0_captured_by_scap.jpg) on local storage (content folder and media folder for fail-over mode)
and it will be displayed when the fail-over mode is activated, overwriting existing image file which is captured before. false : not save. default value
optional
thumbnailBooleantrue : reduced size version of picutre (128 X 72).
false : original size (1280 X 720). default value
optional
Since:
1.0, 1.1 options.save options.thumbnail added, 1.2 options.save, saves image also under application's content folder
Returns:

After the method is successfully executed, successCallback is called with the following data.

PropertyTypeDescription
cbObject.dataString

JPEG screen shot image which is encoded in base64 string.

cbObject.sizenumber

size of the data.

cbObject.encodingstring

encoding used for the data (base64)

If an error occurs, errorCallback is called with errorCode and errorText.