feat(hls): add native HLS (m3u8) download protocol (#1515)

This commit is contained in:
sun authored and GitHub committed 2026-09-15 23:40:31 +08:00
1 parent e47a20a1bd
commit 46c34f2e92
56 files changed
+4536 -6

No files matched your search

+30
View File
@@ -0,0 +1,30 @@
package hls
const (
defaultSegmentConnections = 8
defaultMaxRetries = 5
defaultTimeoutSeconds = 30
// maxPrefetchSizeSegments caps the HEAD probing done at resolve time.
// Playlists larger than this skip size prefetch entirely.
maxPrefetchSizeSegments = 500
)
type config struct {
SegmentConnections int `json:"segmentConnections"`
MaxRetries int `json:"maxRetries"`
TimeoutSeconds int `json:"timeoutSeconds"`
PrefetchContentLength bool `json:"prefetchContentLength"`
}
func (c *config) normalize() {
if c.SegmentConnections <= 0 {
c.SegmentConnections = defaultSegmentConnections
}
if c.MaxRetries < 0 {
c.MaxRetries = defaultMaxRetries
}
if c.TimeoutSeconds <= 0 {
c.TimeoutSeconds = defaultTimeoutSeconds
}
}