Documentation
¶
Overview ¶
Package camera takes a photo, or picks one from the library, using the system's own screens. The photo comes back as JPEG bytes, so it works under `nimbus native dev` too, where your Go isn't on the phone.
nimbus native plugin add camera
p, err := camera.Take(ctx, camera.Options{MaxSize: 1600})
if plugin.IsCode(err, plugin.Cancelled) { return } // they backed out
filesystem.Write(ctx, filesystem.Data, "receipt.jpg", p.Data)
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct {
MaxSize int `json:"maxSize"` // its longer side, in pixels; 0 means 2000
Quality float32 `json:"quality"` // JPEG, 0..1; 0 means 0.85
}
Options sizes the photo.
type Photo ¶
type Photo struct {
Data []byte `json:"data"` // the image, as a JPEG
Width int `json:"width"` // in pixels
Height int `json:"height"` // in pixels
}
Photo is a JPEG, turned the right way up.
func Pick ¶
Pick opens the photo library. It asks for no permission: the system shows the photos and the app only gets the one chosen.
type Video ¶
type Video struct {
Data []byte `json:"data"` // the file
Type string `json:"type"` // its MIME type, such as "video/mp4"
Seconds float64 `json:"seconds"` // how long it runs
}
Video is a video from the library, as it was recorded.
type VideoOptions ¶
type VideoOptions struct {
MaxBytes int64 `json:"maxBytes"` // larger files fail; 0 means 50 MB
}
VideoOptions limits a video.
Click to show internal directories.
Click to hide internal directories.