mediaPicker
La traduction de cette page manque ou n'est plus à jour : elle s'affiche en anglais. Lire en anglais
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.
Référence
Exports 7
Méthodes, constantes et types exposés par cet espace de noms natif.
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.Généré depuis les déclarations TypeScript publiques : signatures, props et valeurs par défaut viennent de la source vérifiée, les descriptions de sa JSDoc. Aucune valeur par défaut n'est inventée.