Documentation ¶
Index ¶
Constants ¶
View Source
const ( FormatMp3 = 1 FormatFlac = 2 )
View Source
const ( // Player states // StopMedia -> Play -> Pause -> (Continue) -> StopMedia // Play new song Play State = iota // Continue paused song, only a transition mode, never state of the player Continue //SetVolume, only transition mode SetVolume // Pause song Pause // StopMedia playing Stop //SongComplete, only transition mode to notify song has changed SongComplete // Playing single song Song Playtype = 0 // Playing album Album Playtype = 1 // Playing artists discography Artist Playtype = 2 // Playing playlist Playlist Playtype = 3 // Last action was ok StatusOk Status = 0 // Last action resulted in error StatusError Status = 0 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action struct { // What to do State State Type Playtype Volume int // Provide either artist/album/song or audio id Artist string Album string Song string Year int AudioId string Duration int }
Action includes instruction for player to play
type PlaySong ¶
type PlaySong struct { Action Action Song io.ReadCloser }
type Player ¶
Player is the application structure
func NewPlayer ¶
NewPlayer constructs new player instance
func (*Player) ActionChannel ¶
ActionChannel returns input channel for user actions
func (*Player) RefreshState ¶
func (p *Player) RefreshState()
RefreshState pushes current state into state channel
func (*Player) StateChannel ¶
func (p *Player) StateChannel() chan PlayingState
StateChannel return output channel for player state
type PlayingState ¶
type PlayingState struct { State State PlayingType Playtype Song string Artist string Album string Year int // Content duration in sec CurrentSongDuration int CurrentSongPast int PlaylistDuration int PlaylistLeft int // Volume [0,100] Volume int }
PlayerState holds data about currently playing song if any
Click to show internal directories.
Click to hide internal directories.