audio

package
v0.0.0-...-33edafc Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBeepFFmpegPipeline

func NewBeepFFmpegPipeline() (*beepFFmpegPlayer, error)

NewBeepFFmpegPipeline returns an audio.Player that transcodes tracks through FFmpeg via exec.Command to PCM and then plays audio via speaker.Play. Tracks must be fully transcoded first otherwise wav.Decode will refuse to play them. Because of this, UpdateStream will block until transcoding is complete.

Types

type PlaybackProgress

type PlaybackProgress struct {
	Progress time.Duration
	Duration time.Duration
}

func (PlaybackProgress) String

func (p PlaybackProgress) String() string

type Player

type Player interface {
	io.Closer

	// UpdateStream sets the target of the playback stream. If the stream
	// is playing, it is automatically restarted with the new media source
	UpdateStream(url string, volumeAdjustment float64)
	// Play starts the playback stream
	Play()
	// Pause pauses the playback stream
	Pause()

	// IsPlaying is true if the player is currently playing a track
	IsPlaying() bool

	// ProgressChan reports playback progress on at least a 1hz interval
	ProgressChan() <-chan PlaybackProgress

	// DoneChan reports when the player has finished playback of the current
	// stream target by returning a nil error. If the player encounters a
	// recoverable error, it will send a non-nil error on this channel. If it
	// encounters an unrecoverable error, it will send the error and then close
	// this channel
	DoneChan() <-chan error
}

Player represents an audio playback engine that can play arbitrary audio URLs

Jump to

Keyboard shortcuts

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