@microsoft/teams-js
Version:
Microsoft Client SDK for building app for Microsoft hosts
117 lines (116 loc) • 3.47 kB
TypeScript
/**
* @hidden
* Interact with images. Allows the app developer ask the user to get images from their camera / camera roll / file system.
*
* @beta
* @module
*/
import * as image from './image';
/**
* @hidden
* The required value of the visualMedia files from gallery
*
* @beta
*/
export interface GalleryProps {
/**
* The visualMedia source
*/
source: Source.Gallery;
}
/**
* @hidden
* The required value of the visualMedia files from camera
*
* @beta
*/
export interface CameraProps {
/**
* @hidden
* The visualMedia source
*/
source: Source.Camera;
/**
* @hidden
* Optional; Specify whether users have the option to switch between the front and rear cameras. The default setting is FrontOrRear.
* Default value is FrontOrRear
*/
cameraRestriction?: CameraRestriction;
}
/**
* @hidden
* Indicate if user is allowed to move between front and back camera or stay in front/back camera only
* If the camera option requested by the app isn't available, the SDK will silently default to the platform's standard camera.
*
* @beta
*/
export declare enum CameraRestriction {
/** User can move between front and back camera */
FrontOrRear = 1,
/** User can only use the front camera */
FrontOnly = 2,
/** User can only use the back camera */
RearOnly = 3
}
/**
* @hidden
* Specifies the image source
*
* @beta
*/
export declare enum Source {
/** The camera is the source of visual media. */
Camera = 1,
/** The source of visual media is the gallery. */
Gallery = 2
}
/**
* @hidden
* VisualMediaFile object that can be used to represent image or video from host apps.
*
* @beta
*/
export interface VisualMediaFile {
/**
* @hidden
* This is the base64 content of file.
* If app needs to use this directly in HTML tags, it should convert this to a data url.
*/
content: string;
/**
* @hidden
* The size of file represented in VisualMediaFile in KB
*/
sizeInKB: number;
/**
* @hidden
* Name of the file (does not include the extension)
*/
name: string;
/**
* @hidden
* File's MIME type. More information on supported `mimeTypes`(https://docs.lens.xyz/docs/metadata-standards#supported-mime-types-for-imagesaudiovideos).
*/
mimeType: string;
}
/**
* @hidden
* Checks whether or not visualMedia has user permission
* @returns Promise that will resolve with true if the user had granted the app permission to media information(including Camera and Gallery permission), or with false otherwise,
* In case of an error, promise will reject with the error.
* @throws NOT_SUPPORTED_ON_PLATFORM Error if the DevicePermission.Media permission has not successfully granted.
*
* @beta
*/
export declare function hasPermission(): Promise<boolean>;
/**
* @hidden
* Requests user permission for visualMedia
* @returns Promise that will resolve with true if the user consented permission for media(including Camera and Gallery permission), or with false otherwise,
* In case of an error, promise will reject with the error.
* @throws NOT_SUPPORTED_ON_PLATFORM Error if the DevicePermission.Media permission has not successfully granted.
*
* @beta
*/
export declare function requestPermission(): Promise<boolean>;
export { image };