From 0067a77d23c8d4afa2649b62b5251665e35b8b3d Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 14 Oct 2021 16:20:36 +0200 Subject: Improve playback with bad redundancies --- client/src/assets/player/p2p-media-loader/segment-url-builder.ts | 5 ++++- client/src/assets/player/peertube-player-manager.ts | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'client/src/assets/player') 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 @@ import { Segment } from '@peertube/p2p-media-loader-core' import { RedundancyUrlManager } from './redundancy-url-manager' -function segmentUrlBuilderFactory (redundancyUrlManager: RedundancyUrlManager) { +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) } } 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 { rtcConfig: getRtcConfig(), requiredSegmentsPriority: 1, simultaneousHttpDownloads: 1, - segmentUrlBuilder: segmentUrlBuilderFactory(redundancyUrlManager), + segmentUrlBuilder: segmentUrlBuilderFactory(redundancyUrlManager, 1), useP2P: getStoredP2PEnabled(), consumeOnly }, -- cgit v1.2.3