media module
Classes
File |
File object that can be used to represent image or video or audio |
Media |
Media object returned by the select Media API |
VideoController |
VideoController class is used to communicate between the app and the host client during the video capture flow |
Interfaces
AssembleAttachment |
Helper object to assembled media chunks |
AudioProps |
All properties in AudioProps are optional and have default values in the platform |
BarCodeConfig |
Barcode configuration supplied to scanBarCode API to customize barcode scanning experience in mobile All properties in BarCodeConfig are optional and have default values in the platform |
ImageProps |
All properties in ImageProps are optional and have default values in the platform |
ImageUri |
Input for view images API |
MediaChunk |
Media chunks an output of getMedia API from platform |
MediaInputs |
Input parameter supplied to the select Media API |
MediaResult |
Output of getMedia API from platform |
VideoAndImageProps |
All properties in VideoAndImageProps are optional and have default values in the platform |
VideoControllerCallback |
Callback which will register your app to listen to lifecycle events during the video capture flow |
VideoProps |
All properties in VideoProps are optional and have default values in the platform |
Type Aliases
captureImageCallbackFunctionType |
Function callback type used when calling captureImage. |
errorCallbackFunctionType |
Error callback function type. |
getMediaCallbackFunctionType |
Function callback type used when calling getMedia |
scanBarCodeCallbackFunctionType |
Function callback type used when calling scanBarCode. |
selectMediaCallbackFunctionType |
Function callback type used when calling selectMedia. |
Enums
CameraStartMode |
The modes in which camera can be launched in select Media API |
FileFormat |
Enum for file formats supported |
ImageOutputFormats |
Specifies the image output formats. |
ImageUriType |
ID contains a mapping for content uri on platform's side, URL is generic |
MediaControllerEvent |
Events which are used to communicate between the app and the host client during the media recording flow |
MediaType |
Specifies the type of Media |
Source |
Specifies the image source |
Functions
capture |
Launch camera, capture image or choose image from gallery and return the images as a File[] object to the callback. See SdkError if there are any. If error is null or undefined, the callback will be called with a collection of See File objects |
has |
Checks whether or not media has user permission |
request |
Requests user permission for media |
scan |
|
select |
Select an attachment using camera/gallery |
view |
View images using native image viewer |
Function Details
captureImage(captureImageCallbackFunctionType)
Launch camera, capture image or choose image from gallery and return the images as a File[] object to the callback.
See SdkError if there are any. If error is null or undefined, the callback will be called with a collection of See File objects
function captureImage(callback: captureImageCallbackFunctionType)
Parameters
- callback
- captureImageCallbackFunctionType
Remarks
Note: Currently we support getting one File through this API, i.e. the file arrays size will be one. Note: For desktop, this API is not supported. Callback will be resolved with ErrorCode.NotSupported.
hasPermission()
Note
This API is in Beta and provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Checks whether or not media has user permission
function hasPermission(): Promise<boolean>
Returns
Promise<boolean>
Promise that will resolve with true if the user had granted the app permission to media information, or with false otherwise, In case of an error, promise will reject with the error. Function can also throw a NOT_SUPPORTED_ON_PLATFORM error
requestPermission()
Note
This API is in Beta and provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Requests user permission for media
function requestPermission(): Promise<boolean>
Returns
Promise<boolean>
Promise that will resolve with true if the user consented permission for media, or with false otherwise, In case of an error, promise will reject with the error. Function can also throw a NOT_SUPPORTED_ON_PLATFORM error
scanBarCode(scanBarCodeCallbackFunctionType, BarCodeConfig)
Warning
This API is now deprecated.
As of 2.1.0, please use barCode.scanBarCode(config?: BarCodeConfig): Promise<string> instead.
Scan Barcode/QRcode using camera
function scanBarCode(callback: scanBarCodeCallbackFunctionType, config?: BarCodeConfig)
Parameters
- callback
- scanBarCodeCallbackFunctionType
callback to invoke after scanning the barcode
- config
- BarCodeConfig
optional input configuration to customize the barcode scanning experience
Remarks
Note: For desktop and web, this API is not supported. Callback will be resolved with ErrorCode.NotSupported.
selectMedia(MediaInputs, selectMediaCallbackFunctionType)
Select an attachment using camera/gallery
function selectMedia(mediaInputs: MediaInputs, callback: selectMediaCallbackFunctionType)
Parameters
- mediaInputs
- MediaInputs
The input params to customize the media to be selected
- callback
- selectMediaCallbackFunctionType
The callback to invoke after fetching the media
viewImages(ImageUri[], errorCallbackFunctionType)
View images using native image viewer
function viewImages(uriList: ImageUri[], callback: errorCallbackFunctionType)
Parameters
- uriList
-
ImageUri[]
list of URIs for images to be viewed - can be content URI or server URL. Supports up to 10 Images in a single call
- callback
- errorCallbackFunctionType
returns back error if encountered, returns null in case of success