gumbleffmpeg

package
v0.0.0-...-4d3bd5a Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2020 License: GPL-2.0, MPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Source

type Source interface {
	// contains filtered or unexported methods
}

Source is a Stream source.

func SourceExec

func SourceExec(name string, arg ...string) Source

SourceExec uses the output of the given command and arguments as source data.

func SourceFile

func SourceFile(filename string) Source

SourceFile is standard file source.

func SourceReader

func SourceReader(r io.ReadCloser) Source

SourceReader is a ReadCloser source.

type State

type State int32

State represents the state of a Stream.

const (
	StateInitial State = iota + 1
	StatePlaying
	StatePaused
	StateStopped
)

Valid states of Stream.

type Stream

type Stream struct {
	// Command to execute to play the file. Defaults to "ffmpeg".
	Command string
	// Playback volume (can be changed while the source is playing).
	Volume float32
	// Audio source (cannot be changed after stream starts).
	Source Source
	// Starting offset.
	Offset time.Duration
	// contains filtered or unexported fields
}

Stream is an audio stream that encodes media through ffmpeg and sends it to the server.

A stream can only be used once; it cannot be started after it is stopped.

func New

func New(client *gumble.Client, source Source) *Stream

New returns a new Stream for the given gumble Client and Source.

func (*Stream) Elapsed

func (s *Stream) Elapsed() time.Duration

Elapsed returns the amount of audio that has been played by the stream.

func (*Stream) Pause

func (s *Stream) Pause() error

Pause pauses a playing stream.

func (*Stream) Play

func (s *Stream) Play() error

Play begins playing

func (*Stream) State

func (s *Stream) State() State

State returns the state of the stream.

func (*Stream) Stop

func (s *Stream) Stop() error

Stop stops the stream.

func (*Stream) Wait

func (s *Stream) Wait()

Wait returns once the stream has stopped playing.

Jump to

Keyboard shortcuts

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