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

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

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

MediaType

Specifies the type of Media

Source

Specifies the image source

Functions

captureImage((error: SdkError, files: File[]) => void)

Launch camera, capture image or choose image from gallery and return the images as a File[] object to the callback. Callback will be called with an error, if there are any. App should first check the error. If it is present the user can be updated with appropriate error message. If error is null or undefined, then files will have the required result. 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.

See File

See SdkError

scanBarCode((error: SdkError, decodedText: string) => void, BarCodeConfig)

Scan Barcode/QRcode using camera Note: For desktop and web, this API is not supported. Callback will be resolved with ErrorCode.NotSupported.

selectMedia(MediaInputs, (error: SdkError, attachments: Media[]) => void)

Select an attachment using camera/gallery

viewImages(ImageUri[], (error?: SdkError) => void)

View images using native image viewer

Function Details

captureImage((error: SdkError, files: File[]) => void)

Launch camera, capture image or choose image from gallery and return the images as a File[] object to the callback. Callback will be called with an error, if there are any. App should first check the error. If it is present the user can be updated with appropriate error message. If error is null or undefined, then files will have the required result. 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.

See File

See SdkError

function captureImage(callback: (error: SdkError, files: File[]) => void)

Parameters

callback

(error: SdkError, files: File[]) => void

scanBarCode((error: SdkError, decodedText: string) => void, BarCodeConfig)

Scan Barcode/QRcode using camera Note: For desktop and web, this API is not supported. Callback will be resolved with ErrorCode.NotSupported.

function scanBarCode(callback: (error: SdkError, decodedText: string) => void, config?: BarCodeConfig)

Parameters

callback

(error: SdkError, decodedText: string) => void

callback to invoke after scanning the barcode

config
BarCodeConfig

optional input configuration to customize the barcode scanning experience

selectMedia(MediaInputs, (error: SdkError, attachments: Media[]) => void)

Select an attachment using camera/gallery

function selectMedia(mediaInputs: MediaInputs, callback: (error: SdkError, attachments: Media[]) => void)

Parameters

mediaInputs
MediaInputs

The input params to customize the media to be selected

callback

(error: SdkError, attachments: Media[]) => void

The callback to invoke after fetching the media

viewImages(ImageUri[], (error?: SdkError) => void)

View images using native image viewer

function viewImages(uriList: ImageUri[], callback: (error?: SdkError) => void)

Parameters

uriList

ImageUri[]

urilist of images to be viewed - can be content uri or server url. supports upto 10 Images in one go

callback

(error?: SdkError) => void

returns back error if encountered, returns null in case of success