Documentation
¶
Overview ¶
Package mpris exposes the player over the MPRIS D-Bus interface so Linux desktops (GNOME/KDE media overlays, media keys) show and control playback. On non-Linux it degrades to a no-op (see mpris_other.go).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Commands ¶
type Commands struct {
PlayPause func()
Next func()
Prev func()
Stop func()
Quit func() // exit the app; nil => CanQuit advertised false
Seek func(offsetUS int64) // relative
SetPosition func(trackID string, posUS int64) // absolute
}
Commands are invoked by the desktop (media keys / overlay) and must drive the app's existing playback actions. Any may be nil.
type Controller ¶
type Controller interface {
Update(State)
Close()
}
Controller publishes State to the desktop and is closed on shutdown.
func New ¶
func New(cmds Commands) Controller
New connects to the session bus and exports the MPRIS interfaces. On any failure (no session bus, name taken) it returns a no-op controller.
type State ¶
type State struct {
Status string // "Playing" | "Paused" | "Stopped"
TrackID string
Title string
Artist string
Album string
ArtURL string
LengthUS int64 // track length in microseconds
PositionUS int64 // playback position in microseconds
}
State is a snapshot of what is playing, pushed by the UI on every change.
Click to show internal directories.
Click to hide internal directories.