mediaPicker
A tradução desta página não existe ou está desatualizada, por isso é mostrada em inglês. Ler em inglês
Use the system media picker when the user should select a photo or video. Use capture for the system camera UI; use Camera for an embedded preview you control.
Pick an image and preview it
import { Button, Image, VStack, mediaPicker, signal } from 'kuito';
export function Cover() {
const photo = signal('');
const choose = async () => {
const result = await mediaPicker.pick({ selectionLimit: 0, maxWidth: 1600 });
if (!result.canceled) photo.value = result.assets[0].uri;
};
return (
<VStack>
<Image src={{ uri: photo.value }} aspectRatio={1.5} />
<Button onPress={choose}>Choose a photo</Button>
</VStack>
);
}Behavior and limits
Treat cancellation as an expected result before accessing assets. Returned media files are in the app cache. Copy them before depending on long-term persistence, or upload them with fileSystem. Choose image/video types, selection count and output dimensions to fit your use case. Declare permissions needed by the capture or library operation in config.
Continue
Read File system for the related workflow. The API reference lists every method, option, event and return type.
Referência
Exportações 7
Métodos, constantes e tipos expostos por este namespace nativo.
type
MediaTypeWhat the picker offers, 'images' or 'videos', named by the mediaTypes option.typeCaptureOptionsTunes what the system camera captures for mediaPicker.capture(): images or videos, JPEG quality, a maximum size and the iOS editor.typePickOptionsTunes the system photo picker for mediaPicker.pick(): what it offers, how many assets the user may choose, and their size.typeMediaAssetOne image or video the user picked or captured, as a file in the app's cache with what it is.typeMediaPickerResultWhat the media picker ended with: the assets the user chose, or a cancel.functionpickLets the user pick photos or videos: PHPickerViewController on iOS, the
Photo Picker on Android.functioncaptureLets the user take a photo or a video with the system camera, asking for the camera permission first.Gerado a partir das declarações TypeScript públicas: assinaturas, props e predefinições vêm da fonte verificada, as descrições da sua JSDoc. Nenhuma predefinição é inventada.