# Class Signage#captureScreen

Signage

- Defined in: signage.js

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

  Property | Type | Description | Required
  --- | --- | --- | ---
  save | Boolean | true : 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
  thumbnail | Boolean | true : reduced size version of picutre (128 X 72). false : options.imgResolution size. default value | optional
  imgResolution | String | Signage.ImgResolution | optional

Since:
  1.0, 1.1 options.save options.thumbnail added, 1.2 options.save, saves image also under application's content folder, 1.4.1 options.imgResolution added
Returns:

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

  Property | Type | Description
  --- | --- | ---
  cbObject.data | String | JPEG screen shot image which is encoded in base64 string.
  cbObject.size | number | size of the data.
  cbObject.encoding | string | encoding used for the data (base64)

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