Documentation
¶
Overview ¶
Package livephoto picks Live Photos and plays them inside your screen, on iOS. Android has no Live Photos: there Pick fails with plugin.Unavailable and View shows its Fallback.
nimbus native plugin add live-photo
p, err := livephoto.Pick(ctx)
if plugin.IsCode(err, plugin.Cancelled) { return }
livephoto.View{ID: p.ID, Style: ui.Style{Width: ui.Pt(320), Height: ui.Pt(320 / p.Aspect())}}
The picker hands the photo over itself, so it needs no photo library permission. A picked photo lasts until the app closes; Files gives its still and its video, to keep or upload.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Media ¶
type Media struct {
Photo []byte `json:"photo"` // the still, usually HEIC
PhotoType string `json:"photoType"` // its media type
Video []byte `json:"video"` // the moment around it, a QuickTime movie
VideoType string `json:"videoType"` // its media type
}
Media is a Live Photo's two halves.
type Photo ¶
type Photo struct {
ID string `json:"id"` // for View and Files
Width int `json:"width"` // in pixels
Height int `json:"height"` // in pixels
}
Photo is a Live Photo the app holds.
type View ¶
type View struct {
ID string // from Pick
Play int // raise it to play the photo once more, sound and all
Muted bool // plays without sound
// Fill crops it to fill the frame; otherwise it fits inside.
Fill bool
Style ui.Style // its size and place on the screen
// Fallback is shown instead on Android. Nil leaves an empty space.
Fallback ui.Component
}
View shows a picked Live Photo. Touching and holding it plays it, as in Photos.
Click to show internal directories.
Click to hide internal directories.