Documentation ¶
Overview ¶
Package playlist contains the default playlist implementation.
FilePlaylistFactory ¶
FilePlaylistFactory is a PlaylistFactory which reads its definition from a file. The definition file is expected to be a JSON encoded datastructure of the form:
{ <web path> : [ { "artist" : <artist> "title" : <title> "path" : <file path / url> } ] }
The web path is the absolute path which may be requested by the streaming client (e.g. /foo/bar would be http://myserver:1234/foo/bar). The path is either a physical file or a web url reachable by the server process. The file ending determines the content type which is send to the client.
Index ¶
- Variables
- type FilePlaylist
- func (fp *FilePlaylist) Artist() string
- func (fp *FilePlaylist) Close() error
- func (fp *FilePlaylist) ContentType() string
- func (fp *FilePlaylist) Finished() bool
- func (fp *FilePlaylist) Frame() ([]byte, error)
- func (fp *FilePlaylist) Name() string
- func (fp *FilePlaylist) ReleaseFrame(frame []byte)
- func (fp *FilePlaylist) Title() string
- type FilePlaylistFactory
- type StreamBuffer
Constants ¶
This section is empty.
Variables ¶
var FileExtContentTypes = map[string]string{
".mp3": "audio/mpeg",
".flac": "audio/flac",
".aac": "audio/x-aac",
".mp4a": "audio/mp4",
".mp4": "video/mp4",
".nsv": "video/nsv",
".ogg": "audio/ogg",
".spx": "audio/ogg",
".opus": "audio/ogg",
".oga": "audio/ogg",
".ogv": "video/ogg",
".weba": "audio/webm",
".webm": "video/webm",
".axa": "audio/annodex",
".axv": "video/annodex",
}
FileExtContentTypes maps file extensions to content types
var FrameSize = dudeldu.FrameSize
FrameSize is the frame size which is used by the playlists
Functions ¶
This section is empty.
Types ¶
type FilePlaylist ¶
type FilePlaylist struct {
// contains filtered or unexported fields
}
FilePlaylist data structure
func (*FilePlaylist) Artist ¶
func (fp *FilePlaylist) Artist() string
Artist returns the artist which is currently playing.
func (*FilePlaylist) Close ¶
func (fp *FilePlaylist) Close() error
Close any open files by this playlist and reset the current pointer. After this call the playlist can be played again.
func (*FilePlaylist) ContentType ¶
func (fp *FilePlaylist) ContentType() string
ContentType returns the content type of this playlist e.g. audio/mpeg.
func (*FilePlaylist) Finished ¶
func (fp *FilePlaylist) Finished() bool
Finished returns if the playlist has finished playing.
func (*FilePlaylist) Frame ¶
func (fp *FilePlaylist) Frame() ([]byte, error)
Frame returns the current audio frame which is playing.
func (*FilePlaylist) ReleaseFrame ¶
func (fp *FilePlaylist) ReleaseFrame(frame []byte)
ReleaseFrame releases a frame which has been written to the client.
func (*FilePlaylist) Title ¶
func (fp *FilePlaylist) Title() string
Title returns the title which is currently playing.
type FilePlaylistFactory ¶
type FilePlaylistFactory struct {
// contains filtered or unexported fields
}
FilePlaylistFactory data structure
func NewFilePlaylistFactory ¶
func NewFilePlaylistFactory(path string, itemPathPrefix string) (*FilePlaylistFactory, error)
NewFilePlaylistFactory creates a new FilePlaylistFactory from a given definition file.
type StreamBuffer ¶ added in v1.2.0
type StreamBuffer struct { bytes.Buffer // Buffer which is used to hold the data // contains filtered or unexported fields }
StreamBuffer is a buffer which implements io.ReadCloser and can be used to stream one stream into another. The buffer detects a potential underflow and waits until enough bytes were read from the source stream.
func (*StreamBuffer) Close ¶ added in v1.2.0
func (b *StreamBuffer) Close() error
Close does nothing but must be there to implement io.ReadCloser.