Take Photo Action
The action module for this action is vb/action/builtin/takePhotoAction
. Use this action in a mobile application to take photos or choose images from the system's image library. The takePhotoAction is deprecated for web applications. Use the JET file upload component, or the camera component in the Components palette which uses the JET file upload component.
- iOS application: Prompts user with multiple options, such as Camera, Browse, or Like
- Android application: Prompts user with options, such as Camera, Browse, or Cancel
- Progressive web apps on Android and iOS: Prompts user with multiple options, such as Camera, Browse, or Like
Parameter Name | Description |
---|---|
mediaType |
Set to Clear the |
video
:
- For iOS Native apps, options to record video using the Camera or to select video files will be provided.
- For Android Native apps, only file selection is allowed. Recording using the Camera is not supported.
- For PWA apps on iOS and Android, options to record video using the Camera or to select video files will be provided.
Example 1-57 Example
file
.
// To use the outcome file in images, use the URL.createObjectURL and URL.revokeObjectURL
// methods, as in the following example
const blobURL = URL.createObjectURL(fileBlob);
// Release the BLOB after it loads.
document.getElementById("img-712450837-1").onload = function () {
URL.revokeObjectURL(blobURL);
};
// Set the image source to the BLOB URL
document.getElementById("img-712450837-1").src = blobURL;
// To upload the selected/captured image or video, use restAction and set the body of
// restAction to the outcome file of takePhotoAction.
"takePhoto1": {
"module": "vb/action/builtin/takePhotoAction",
"parameters": {
"mediaType": "image"
},
"outcomes": {
"success": "callTakePhotoSuccess",
"failure": "callTakePhotoFailed"
}
},
"callRestEndpoint1": {
"module": "vb/action/builtin/restAction",
"parameters": {
"endpoint": "OracleCom/postUpload",
"body": "{{ $chain.results.takePhoto1.file }}", // <- File is set as body of restAction
"contentType": "image/jpeg"
},
"outcomes": {
"success": "callUploadSuccess",
"failure": "callUploadFailed"
}
},
"callUploadFailed": {
"module": "vb/action/builtin/callModuleFunctionAction",
"parameters": {
"module": "{{$page.functions}}",
"functionName": "uploadFailed",
"params": [
"{{ $chain.results.callRestEndpoint1.body }}"
]
}
},
"callUploadSuccess": {
"module": "vb/action/builtin/callModuleFunctionAction",
"parameters": {
"module": "{{$page.functions}}",
"functionName": "uploadSuccess",
"params": [
"{{ $chain.results.callRestEndpoint1.body }}"
]
}
},