player

package
v0.0.0-...-14a0406 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AdjustAudio

func AdjustAudio(raw []byte, vol float64) []byte

AdjustAudio takes a raw data frame of audio and a volume value between 0 and 1, 1 being full volume, 0 being mute

Types

type CodecHandler

type CodecHandler func(data []byte) ([]byte, error)

CodecHandler handler function for receiving raw bytes and decoding them using some codec

func GetCodec

func GetCodec(session *rtsp.Session) CodecHandler

GetCodec determins the appropriate codec from the rtsp session

type LocalPlayer

type LocalPlayer struct {
	// contains filtered or unexported fields
}

LocalPlayer is a player that will just play the audio locally

func NewLocalPlayer

func NewLocalPlayer() *LocalPlayer

NewLocalPlayer instantiates a new LocalPlayer

func (*LocalPlayer) GetIsMuted

func (lp *LocalPlayer) GetIsMuted() bool

GetIsMuted returns muted state

func (*LocalPlayer) GetTrack

func (lp *LocalPlayer) GetTrack() Track

GetTrack returns the track

func (*LocalPlayer) Play

func (lp *LocalPlayer) Play(session *rtsp.Session)

Play will play the packets received on the specified session

func (*LocalPlayer) SetAlbumArt

func (lp *LocalPlayer) SetAlbumArt(artwork []byte)

SetAlbumArt sets the album art for the player

func (*LocalPlayer) SetMute

func (lp *LocalPlayer) SetMute(isMuted bool)

SetMute will mute or unmute the player

func (*LocalPlayer) SetTrack

func (lp *LocalPlayer) SetTrack(album string, artist string, title string)

SetTrack sets the track for the player

func (*LocalPlayer) SetVolume

func (lp *LocalPlayer) SetVolume(volume float64)

SetVolume accepts a float between 0 (mute) and 1 (full volume)

type Player

type Player interface {
	Play(session *rtsp.Session)
	SetVolume(volume float64)
	SetMute(isMuted bool)
	GetIsMuted() bool
	SetTrack(album string, artist string, title string)
	SetAlbumArt(artwork []byte)
	GetTrack() Track
}

Player defines a player for outputting the data packets from the session

type Track

type Track struct {
	Artist  string
	Album   string
	Title   string
	Artwork []byte
}

Track represents a track playing by the player

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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