Key represents encryption info from a #EXT-X-KEY tag.
type Key struct { Method string URI *url.URL KeyFormat string KeyFormatVersions string IV string Characteristics string }
func (k *Key) DecodeData() ([]byte, error)
DecodeData extracts and decodes the Base64 data directly from the URL Opaque field.
type MasterPlaylist struct { StreamInfs []*StreamInf Medias []*Media }
func DecodeMaster(content string) (*MasterPlaylist, error)
DecodeMaster parses a Master Playlist.
func (mp *MasterPlaylist) ResolveURIs(base *url.URL)
ResolveURIs converts relative URLs to absolute URLs using the base URL.
func (mp *MasterPlaylist) Sort()
Sort sorts the StreamInfs and Medias slices in place. StreamInfs are sorted by their minimum average bandwidth (if available), otherwise falling back to minimum bandwidth. Medias are sorted by GroupID.
Media represents an #EXT-X-MEDIA tag.
type Media struct { Type string GroupID string Name string Language string URI *url.URL AutoSelect bool Default bool Forced bool Channels string Characteristics string ID int }
func (r *Media) String() string
String returns a multi-line summary of the Media.
type MediaPlaylist struct { TargetDuration int MediaSequence int Version int PlaylistType string Segments []*Segment Keys []*Key // A slice of all keys found in the playlist Map *url.URL // The playlist's initialization map EndList bool }
func DecodeMedia(content string) (*MediaPlaylist, error)
DecodeMedia parses a Media Playlist.
func (mp *MediaPlaylist) ResolveURIs(base *url.URL)
ResolveURIs converts relative URLs to absolute URLs using the base URL.
type Segment struct { URI *url.URL Duration float64 Title string }
StreamInf represents a single media playlist (URI) from a #EXT-X-STREAM-INF tag. It aggregates information from all tags that point to the same URI. The primary attributes are taken from the variant with the lowest bandwidth.
type StreamInf struct { URI *url.URL ID int Bandwidth int AverageBandwidth int Codecs string Resolution string FrameRate string Subtitles string // Refers to a Media GROUP-ID for subtitles Audio []string // A list of associated audio Media GROUP-IDs }
func (s *StreamInf) SortBandwidth() int
SortBandwidth determines the value to use for sorting, prioritizing average bandwidth.
func (s *StreamInf) String() string
String returns a multi-line summary of the StreamInf.