audiopanel

package
v0.0.0-...-96d54e8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 13, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AudioPanel

type AudioPanel struct {
	Format beep.Format
	// contains filtered or unexported fields
}

AudioPanel contains properties for manipulating an audio stream & drawing info to the terminal. eg. volume / seeking & position

func FetchAudioPanel

func FetchAudioPanel() *AudioPanel

FetchAudioPanel will return the already initialised panel pointer.

func (*AudioPanel) AttachLogger

func (ap *AudioPanel) AttachLogger(logger *log.Logger) *AudioPanel

AttachLogger implements setter injection of a log.Logger

func (*AudioPanel) AudioRequest

func (ap *AudioPanel) AudioRequest(url string) (io.ReadCloser, error)

AudioRequest is the bare minimum HTTP request function to get an audio stream. io.ReadCloser is the interface required by mp3.Decode in StreamAudio() resp.Body is of this type so can simply be returned following the request.

func (*AudioPanel) Duration

func (ap *AudioPanel) Duration(e clients.Enclosure) time.Duration

func (*AudioPanel) GetPlayerState

func (ap *AudioPanel) GetPlayerState() PlayerState

GetPlayerState returns a PlayerState value that represents a snapshot of the user relevant player state at the time this method was called

func (*AudioPanel) NoBufferPlayFromUrl

func (ap *AudioPanel) NoBufferPlayFromUrl(url string)

func (*AudioPanel) PlayFromUrl

func (ap *AudioPanel) PlayFromUrl(url string, logger *log.Logger, cachePath string)

func (*AudioPanel) PlayPause

func (ap *AudioPanel) PlayPause()

func (*AudioPanel) SetPublishCallback

func (ap *AudioPanel) SetPublishCallback(callback func(func()))

SetPublishCallback is where the function to update on publish should be supplied Probably don't pass anything other than QueueUpdateDraw

func (*AudioPanel) SetStreamer

func (ap *AudioPanel) SetStreamer(format beep.Format, streamer beep.StreamSeekCloser)

func (*AudioPanel) SpawnPublisher

func (ap *AudioPanel) SpawnPublisher()

func (*AudioPanel) SubscribeToState

func (ap *AudioPanel) SubscribeToState(subscriber PlayerStateSubscriber)

type PlayerState

type PlayerState struct {
	Position time.Duration
	Length   time.Duration
	Playing  bool
}

PlayerState is a snapshot of the current player state

type PlayerStateSubscriber

type PlayerStateSubscriber interface {
	OnUpdate()
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL