Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Device ¶
type Device struct {
ID string `json:"id"`
Name string `json:"name"`
Type DeviceType `json:"type"`
Platform Platform `json:"platform"`
IsActive bool `json:"is_active"`
Account string `json:"account"`
}
Device represents a playback device.
type DeviceType ¶
type DeviceType string
DeviceType indicates the kind of playback device.
const ( DeviceTypeSpeaker DeviceType = "speaker" DeviceTypeComputer DeviceType = "computer" DeviceTypePhone DeviceType = "phone" DeviceTypeTV DeviceType = "tv" DeviceTypeSoundbar DeviceType = "soundbar" )
type PlaybackState ¶
type PlaybackState struct {
Track *Track `json:"track"`
Device *Device `json:"device"`
Account string `json:"account"`
IsPlaying bool `json:"is_playing"`
Progress time.Duration `json:"progress"`
Volume int `json:"volume"`
}
PlaybackState represents the current playback state.
func (*PlaybackState) HasTrack ¶
func (s *PlaybackState) HasTrack() bool
HasTrack returns true if there is an active track.
func (*PlaybackState) ProgressPercent ¶
func (s *PlaybackState) ProgressPercent() float64
ProgressPercent returns playback progress as a percentage (0-100).
type Player ¶
type Player interface {
// Playback control
Play(ctx context.Context) error
Pause(ctx context.Context) error
Next(ctx context.Context) error
Prev(ctx context.Context) error
Seek(ctx context.Context, positionMs int) error
// Volume control
Volume(ctx context.Context, percent int) error
// State queries
GetState(ctx context.Context) (*PlaybackState, error)
GetQueue(ctx context.Context) (*Queue, error)
// Queue manipulation
AddToQueue(ctx context.Context, trackURI string) error
}
Player defines the interface for music playback control.
type Queue ¶
Queue represents a playback queue.
type Track ¶
type Track struct {
ID string `json:"id"`
URI string `json:"uri"`
Title string `json:"title"`
Artist string `json:"artist"`
Artists []string `json:"artists"`
Album string `json:"album"`
Duration time.Duration `json:"duration"`
Source Source `json:"source"`
}
Track represents a playable audio track.
Click to show internal directories.
Click to hide internal directories.