Documentation
¶
Index ¶
- func DataStorage(t MsgType) (interface{}, error)
- type InitPlayerF
- type MsgType
- type NewPlayerCB
- type NewStateCB
- type PauseCmd
- type PlayCmd
- type Playback
- type PlaybackOption
- type PlaybackStatus
- type Player
- func (p *Player) Pause() error
- func (p *Player) Play(url string) error
- func (p *Player) Resume() error
- func (p *Player) Run(ctx context.Context) error
- func (p *Player) Seek(pos time.Duration) error
- func (p *Player) SetVol(vol int) error
- func (p *Player) State() PlayerState
- func (p *Player) Stop() error
- type PlayerMsg
- type PlayerOption
- type PlayerState
- type ResumeCmd
- type SeekCmd
- type SetNameCmd
- type SetVolCmd
- type StopCmd
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DataStorage ¶
Types ¶
type InitPlayerF ¶ added in v0.2.0
type InitPlayerF func(newStateCB NewStateCB, opts ...PlayerOption) (*Player, error)
type NewPlayerCB ¶ added in v0.2.0
type NewPlayerCB func(ctx context.Context, initF InitPlayerF) error
type NewStateCB ¶ added in v0.2.0
type NewStateCB func(old, new PlayerState) error
type Playback ¶
type Playback struct {
// contains filtered or unexported fields
}
func Init ¶
func Init(listen string, port int, newPlayerCB NewPlayerCB, opts ...PlaybackOption) (*Playback, error)
type PlaybackOption ¶ added in v0.2.1
type PlaybackOption func(*Playback)
func PlaybackWithLogger ¶ added in v0.2.1
func PlaybackWithLogger(logger *slog.Logger) PlaybackOption
func PlaybackWithTcpOpts ¶ added in v0.2.1
func PlaybackWithTcpOpts(opts ...tcp.ServerOption) PlaybackOption
type PlaybackStatus ¶
type PlaybackStatus int
const ( Stopped PlaybackStatus = iota EndReached Paused Playing )
func (PlaybackStatus) String ¶
func (p PlaybackStatus) String() string
type Player ¶ added in v0.2.0
type Player struct {
// contains filtered or unexported fields
}
func (*Player) State ¶ added in v0.2.0
func (p *Player) State() PlayerState
type PlayerMsg ¶
type PlayerMsg struct { MsgType MsgType Data json.RawMessage }
type PlayerOption ¶ added in v0.2.1
type PlayerOption func(*Player)
func PlayerWithCommOpts ¶ added in v0.2.1
func PlayerWithCommOpts(opts ...tcp.CommOption) PlayerOption
func PlayerWithLogger ¶ added in v0.2.1
func PlayerWithLogger(logger *slog.Logger) PlayerOption
func PlayerWithLoggerWith ¶ added in v0.2.1
func PlayerWithLoggerWith(args ...any) PlayerOption
type PlayerState ¶ added in v0.2.0
type PlayerState struct { Name string Volume int Status PlaybackStatus Duration time.Duration Elapsed time.Duration Since time.Time }
func (*PlayerState) Equal ¶ added in v0.4.1
func (p *PlayerState) Equal(cmp PlayerState) bool
func (*PlayerState) PlaybackActive ¶ added in v0.4.1
func (p *PlayerState) PlaybackActive() bool
type SetNameCmd ¶ added in v0.2.0
type SetNameCmd struct {
Name string
}
Click to show internal directories.
Click to hide internal directories.