Camera & media
Take photos, capture a screenshot, record audio, and scan barcodes from the device.
Take a photo
Open the camera to take a photo. The image arrives on the photoCaptured event, so subscribe before you call, and ask for camera permission first.
capturePhoto emits photoCaptured; pickPhoto emits photoSelected. They are not interchangeable.
Use the photo result
The photoCaptured listener receives a MediaResult. Use dataUri to preview inline and fileUrl to upload. bdk.on(...) returns an unsubscribe function.
| Property | Type | Description |
|---|---|---|
fileUrl | string | null | Hosted URL of the file — use this to upload. |
dataUri | string | null | Data URI — use this to preview inline. |
contentType | string | null | The file's MIME type. |
data | — | The raw file data from the device. |
Pick from the photo library
Open the photo library instead of the camera. Results arrive on the photoSelected event, not photoCaptured.
Take a screenshot
Capture a screenshot of the current screen. The image arrives on the screenshot event.
Record audio
Open the native audio recorder. The recording arrives on the audioRecorded event as a MediaResult — use fileUrl to upload it.
Scan a barcode
Open the scanner for QR codes and barcodes. The decoded value arrives on the barcodeScanned event.
Fall back on the web
Outside the app the call resolves skipped or pending and photoCaptured never fires. Detect this and show a standard <input type="file" capture> instead.