Documentation ¶
Index ¶
Constants ¶
View Source
const ( // SegmentTypeMPEGTS identifies segment contents as MPEG-2 Transport Stream SegmentTypeMPEGTS = iota // SegmentTypeFMP4 identifies segment contents as Fragmented MPEG-4 SegmentTypeFMP4 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Playlist ¶
type Playlist struct { Version int // Protocol version. We need at least 4 for EXT-X-BYTERANGE. FileName string // Stream source: either MPEG-TS or FMP4. URI string // URI at which media file is served. Segments []Segment // Acts as a ring of segments with wrap over. SegSize float64 // Desired segment size. First int // First segment in the ring. Last int // Last segment in the ring. }
Playlist encapsulates HLS playlist.
The underlying media source is created by other code. It is just a file for the playlist. A configurable number of segments is organized into a ring and constitutes a series of byte ranges in the file.
func NewPlaylist ¶
NewPlaylist verifies that file exists and accessible for reading then instantiates Playlist.
func (*Playlist) AddSegment ¶
AddSegment advances to next position in the ring and populates segment structure. Position is calculates from previous segment or is 0 at the start.
Click to show internal directories.
Click to hide internal directories.