Documentation ¶
Overview ¶
Package player provides audio playback management.
Index ¶
- type IPlayer
- type PlaybackStatus
- type Player
- func (p *Player) ClearQueue() error
- func (p *Player) Dequeue() (*Song, error)
- func (p *Player) Enqueue(song *Song)
- func (p *Player) GetChannelID() string
- func (p *Player) GetCurrentSong() *Song
- func (p *Player) GetCurrentStatus() PlaybackStatus
- func (p *Player) GetDiscordSession() *discordgo.Session
- func (p *Player) GetEncodingSession() *dca.EncodeSession
- func (p *Player) GetGuildID() string
- func (p *Player) GetHistory() history.IHistory
- func (p *Player) GetSongQueue() []*Song
- func (p *Player) GetStreamingSession() *dca.StreamingSession
- func (p *Player) GetVoiceConnection() *discordgo.VoiceConnection
- func (p *Player) Lock()
- func (p *Player) Pause() error
- func (p *Player) Play(startAt int, song *Song) error
- func (p *Player) SetChannelID(channelID string)
- func (p *Player) SetCurrentSong(song *Song)
- func (p *Player) SetCurrentStatus(status PlaybackStatus)
- func (p *Player) SetDiscordSession(session *discordgo.Session)
- func (p *Player) SetEncodingSession(encoding *dca.EncodeSession)
- func (p *Player) SetGuildID(guildID string)
- func (p *Player) SetSongQueue(queue []*Song)
- func (p *Player) SetStreamingSession(stream *dca.StreamingSession)
- func (p *Player) SetVoiceConnection(vc *discordgo.VoiceConnection)
- func (p *Player) Skip() error
- func (p *Player) Stop() error
- func (p *Player) Unlock()
- func (p *Player) Unpause(channelID string) error
- type Song
- type SongSource
- type Thumbnail
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IPlayer ¶
type IPlayer interface { Play(startAt int, song *Song) error Skip() error Enqueue(song *Song) Dequeue() (*Song, error) ClearQueue() error Stop() error Pause() error Unpause(channelID string) error Lock() Unlock() GetCurrentStatus() PlaybackStatus SetCurrentStatus(status PlaybackStatus) GetSongQueue() []*Song SetSongQueue(queue []*Song) GetVoiceConnection() *discordgo.VoiceConnection SetVoiceConnection(voiceConnection *discordgo.VoiceConnection) GetEncodingSession() *dca.EncodeSession GetStreamingSession() *dca.StreamingSession GetCurrentSong() *Song SetCurrentSong(song *Song) GetChannelID() string SetChannelID(channelID string) GetDiscordSession() *discordgo.Session SetDiscordSession(session *discordgo.Session) GetGuildID() string SetGuildID(guildID string) }
type PlaybackStatus ¶
type PlaybackStatus int32
const ( StatusResting PlaybackStatus = iota StatusPlaying StatusPaused StatusError )
func (PlaybackStatus) String ¶
func (status PlaybackStatus) String() string
func (PlaybackStatus) StringEmoji ¶
func (status PlaybackStatus) StringEmoji() string
type Player ¶
type Player struct { sync.Mutex SkipInterrupt chan bool StopInterrupt chan bool SwitchChannelInterrupt chan bool // contains filtered or unexported fields }
func (*Player) ClearQueue ¶
func (*Player) GetChannelID ¶
func (*Player) GetCurrentSong ¶
func (*Player) GetCurrentStatus ¶
func (p *Player) GetCurrentStatus() PlaybackStatus
func (*Player) GetDiscordSession ¶
func (*Player) GetEncodingSession ¶
func (p *Player) GetEncodingSession() *dca.EncodeSession
func (*Player) GetGuildID ¶
func (*Player) GetHistory ¶
func (*Player) GetSongQueue ¶
func (*Player) GetStreamingSession ¶
func (p *Player) GetStreamingSession() *dca.StreamingSession
func (*Player) GetVoiceConnection ¶
func (p *Player) GetVoiceConnection() *discordgo.VoiceConnection
func (*Player) SetChannelID ¶
func (*Player) SetCurrentSong ¶
func (*Player) SetCurrentStatus ¶
func (p *Player) SetCurrentStatus(status PlaybackStatus)
func (*Player) SetDiscordSession ¶
func (*Player) SetEncodingSession ¶
func (p *Player) SetEncodingSession(encoding *dca.EncodeSession)
func (*Player) SetGuildID ¶
func (*Player) SetSongQueue ¶
func (*Player) SetStreamingSession ¶
func (p *Player) SetStreamingSession(stream *dca.StreamingSession)
func (*Player) SetVoiceConnection ¶
func (p *Player) SetVoiceConnection(vc *discordgo.VoiceConnection)
type Song ¶
type Song struct { Title string // Title of the song URL string // URL provided by the user Filepath string // Path/URL for downloading the song Thumbnail Thumbnail // Thumbnail image for the song Duration time.Duration // Duration of the song SongID string // Unique ID for the song Source SongSource // Source type of the song }
type SongSource ¶
type SongSource int32
const ( SourceYouTube SongSource = iota SourceStream SourceLocalFile )
func (SongSource) String ¶
func (source SongSource) String() string
Click to show internal directories.
Click to hide internal directories.