MediaAsset
One image or video the user picked or captured, as a file in the app's cache with what it is.
Verwendung
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]);
}Typdeklaration
export type MediaAsset = PickedAsset;Mitglieder 8
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
uri | string | Ja | A file:// URI in the app's cache directory, for <Image source> and fileSystem. |
width | number | Ja | In pixels, as displayed: orientation is already applied. |
height | number | Ja | — |
type | MediaAssetType | Ja | — |
mimeType | string | Ja | — |
fileName | string | Ja | The name the user's library knows it by, when it has one. |
fileSize | number | Ja | In bytes, of the file at uri. |
duration | number | Nein | Videos only: the length in milliseconds. |
Generiert aus den öffentlichen TypeScript-Deklarationen: Signaturen, Props und Standardwerte stammen aus der geprüften Quelle, Beschreibungen aus deren JSDoc. Kein Standardwert ist erfunden.