mediaPicker.MediaAsset
One image or video the user picked or captured, as a file in the app's cache with what it is.
Usage
Pick a photo and hand its local file to an upload function.
// Pick a photo and hand its local file to an upload function.
import { mediaPicker, type MediaAsset, type MediaType } from 'kuito';
export async function choosePhoto(upload: (asset: MediaAsset) => Promise<void>) {
const mediaTypes: MediaType[] = ['images'];
const result = await mediaPicker.pick({ mediaTypes });
if (!result.canceled && result.assets[0]) await upload(result.assets[0]);
}Type declaration
export type MediaAsset = PickedAsset;Members 8
| Name | Type | Required | Description |
|---|---|---|---|
uri | string | Yes | A file:// URI in the app's cache directory, for <Image source> and fileSystem. |
width | number | Yes | In pixels, as displayed: orientation is already applied. |
height | number | Yes | — |
type | MediaAssetType | Yes | — |
mimeType | string | Yes | — |
fileName | string | Yes | The name the user's library knows it by, when it has one. |
fileSize | number | Yes | In bytes, of the file at uri. |
duration | number | No | Videos only: the length in milliseconds. |
Generated from the public TypeScript declarations: signatures, props and defaults come from the checked source, descriptions from its JSDoc. No defaults are invented.