Media
Allow users to share device media with your custom JavaScript code.
Ask the user to open the camera to take a picture or select a picture from the gallery.
import { pickImage } from '@myjsblock/sdk'
const image = await pickImage();
console.log(image); // Prints base64 result of image
Name | Type | Required | Default | Notes |
---|---|---|---|---|
maxHeight | number | | - | |
maxWidth | number | | - | |
quality | number | | - | Value between 1 and 100, controls compression level |
showCameraOption | boolean | | - | |
showGalleryOption | boolean | | - | |
Here is a list of errors that can be thrown when calling this function in addition to generic errors:
Error Code | Description |
---|---|
OPERATION_CANCELLED | The user cancelled the operation. |
UNKNOWN_ERROR | An error occurred while opening the camera or gallery, for example, the user may have denied permission |
Last modified 1yr ago