Class Signage#captureScreen
Signage
- Defined in: signage.js
| 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 valueoptional thumbnail Boolean true : reduced size version of picutre (128 X 72).
false : original size (1280 X 720). default valueoptional
- 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.
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.