Captures screenshots in an HTML5 app or miniapp built on Windvane using the WVScreenCapture JS API.
WVScreenCapture.capture
This API requires Windvane for Android 1.0.3.4 or later.
For Windvane for Android 1.0.3.3 and earlier, use
WVScreen.capture. It accepts the same input and callback parameters asWVScreenCapture.capture.
Captures the current WebView content as an image.
iOS 11 and later: Your app must have permission to access the photo album. Add the NSPhotoLibraryAddUsageDescription key to your Info.plist file and provide a usage description string.
Input parameters
[
String]inAlbum: Specifies whether to save the screenshot to the photo album. Set to'true'to save, or'false'to skip. Default:'false'.[
String]type: The capture scope. Set to'view'to capture only the WebView content, or'app'to capture the entire app window. Default:'view'. When set to'app', the screenshot includes the status bar background but not its text. Android: on some devices with a soft keyboard such as a SmartBar, the keyboard area appears as a black rectangle.
Callback parameters
On success, the success callback fires with the result below. On failure, the failure callback fires with an error object.
-
[
string]url: An internal URL for the captured image. Assign it to thesrcattribute of animgelement to preview the screenshot in-app.NoteThis URL is not publicly accessible and cannot be opened in a browser.
[
string]localPath: The local file path of the screenshot. Pass this path to other APIs, such asWVCamera.confirmUploadPhoto, to upload the file to a CDN.
var params = {
// Save the screenshot to the photo album.
inAlbum: 'true'
};
window.WindVane.call('WVScreenCapture', 'capture', params, function(e) {
alert('success: ' + JSON.stringify(e));
}, function(e) {
alert('failure: ' + JSON.stringify(e));
});