-function getRangesFromPlaylist (playlistContent: string) {
- const ranges: { offset: number, length: number }[] = []
- const lines = playlistContent.split('\n')
- const regex = /^#EXT-X-BYTERANGE:(\d+)@(\d+)$/
-
- for (const line of lines) {
- const captured = regex.exec(line)
-
- if (captured) {
- ranges.push({ length: parseInt(captured[1], 10), offset: parseInt(captured[2], 10) })
- }
- }
-
- return ranges