blob: 5ddc81ff6d55528987cc7ad7a086e2381dc5f5f4 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
import { Segment } from '@peertube/p2p-media-loader-core'
import { RedundancyUrlManager } from './redundancy-url-manager'
function segmentUrlBuilderFactory (redundancyUrlManager: RedundancyUrlManager, requiredSegmentsPriority: number) {
return function segmentBuilder (segment: Segment) {
// Don't use redundancy for high priority segments
if (segment.priority <= requiredSegmentsPriority) return segment.url
return redundancyUrlManager.buildUrl(segment.url)
}
}
// ---------------------------------------------------------------------------
export {
segmentUrlBuilderFactory
}
|