diff options
author | Chocobozzz <me@florianbigard.com> | 2021-10-14 16:20:36 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-10-14 17:06:41 +0200 |
commit | 0067a77d23c8d4afa2649b62b5251665e35b8b3d (patch) | |
tree | 1f7b6565e5b932b013814c68976d75093ed20277 /client/src/assets | |
parent | f0ab2aed3d98240c53e952ada2d2a1d18a5ba23f (diff) | |
download | PeerTube-0067a77d23c8d4afa2649b62b5251665e35b8b3d.tar.gz PeerTube-0067a77d23c8d4afa2649b62b5251665e35b8b3d.tar.zst PeerTube-0067a77d23c8d4afa2649b62b5251665e35b8b3d.zip |
Improve playback with bad redundancies
Diffstat (limited to 'client/src/assets')
-rw-r--r-- | client/src/assets/player/p2p-media-loader/segment-url-builder.ts | 5 | ||||
-rw-r--r-- | client/src/assets/player/peertube-player-manager.ts | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/client/src/assets/player/p2p-media-loader/segment-url-builder.ts b/client/src/assets/player/p2p-media-loader/segment-url-builder.ts index ad0e460ae..5ddc81ff6 100644 --- a/client/src/assets/player/p2p-media-loader/segment-url-builder.ts +++ b/client/src/assets/player/p2p-media-loader/segment-url-builder.ts | |||
@@ -1,8 +1,11 @@ | |||
1 | import { Segment } from '@peertube/p2p-media-loader-core' | 1 | import { Segment } from '@peertube/p2p-media-loader-core' |
2 | import { RedundancyUrlManager } from './redundancy-url-manager' | 2 | import { RedundancyUrlManager } from './redundancy-url-manager' |
3 | 3 | ||
4 | function segmentUrlBuilderFactory (redundancyUrlManager: RedundancyUrlManager) { | 4 | function segmentUrlBuilderFactory (redundancyUrlManager: RedundancyUrlManager, requiredSegmentsPriority: number) { |
5 | return function segmentBuilder (segment: Segment) { | 5 | return function segmentBuilder (segment: Segment) { |
6 | // Don't use redundancy for high priority segments | ||
7 | if (segment.priority <= requiredSegmentsPriority) return segment.url | ||
8 | |||
6 | return redundancyUrlManager.buildUrl(segment.url) | 9 | return redundancyUrlManager.buildUrl(segment.url) |
7 | } | 10 | } |
8 | } | 11 | } |
diff --git a/client/src/assets/player/peertube-player-manager.ts b/client/src/assets/player/peertube-player-manager.ts index 230d6298b..73b5bc01c 100644 --- a/client/src/assets/player/peertube-player-manager.ts +++ b/client/src/assets/player/peertube-player-manager.ts | |||
@@ -374,7 +374,7 @@ export class PeertubePlayerManager { | |||
374 | rtcConfig: getRtcConfig(), | 374 | rtcConfig: getRtcConfig(), |
375 | requiredSegmentsPriority: 1, | 375 | requiredSegmentsPriority: 1, |
376 | simultaneousHttpDownloads: 1, | 376 | simultaneousHttpDownloads: 1, |
377 | segmentUrlBuilder: segmentUrlBuilderFactory(redundancyUrlManager), | 377 | segmentUrlBuilder: segmentUrlBuilderFactory(redundancyUrlManager, 1), |
378 | useP2P: getStoredP2PEnabled(), | 378 | useP2P: getStoredP2PEnabled(), |
379 | consumeOnly | 379 | consumeOnly |
380 | }, | 380 | }, |