The raw M3U8 playlist content as a string
Optionaloptions: ParserOptionsOptional parsing options
Options for the parser function.
Optionaluri?: stringBase URI for resolving relative URLs in the playlist.
A structured MasterPlaylist or MediaPlaylist object
import { parser } from '@skax/hls-parse';
// Parse a simple media playlist
const media = parser(`#EXTM3U
#EXT-X-TARGETDURATION:10
#EXTINF:9.009,
segment1.ts
#EXTINF:9.009,
segment2.ts
#EXT-X-ENDLIST`);
// Parse with relative URL resolution
const master = parser(m3u8Content, {
uri: 'https://example.com/path/to/playlist.m3u8'
});
Parses an M3U8 playlist string into a structured object.
Automatically detects whether the playlist is a Master Playlist or Media Playlist and parses accordingly.