From 33c707616ce34337690721ae0b3de8d1311ed7d5 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 15 Nov 2023 11:06:18 +0100 Subject: [PATCH] Disable p2p seeding using local storage Used by E2E testing --- .../shared/player-options-builder/hls-options-builder.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/client/src/assets/player/shared/player-options-builder/hls-options-builder.ts b/client/src/assets/player/shared/player-options-builder/hls-options-builder.ts index 41198afbe..d190d99c0 100644 --- a/client/src/assets/player/shared/player-options-builder/hls-options-builder.ts +++ b/client/src/assets/player/shared/player-options-builder/hls-options-builder.ts @@ -8,6 +8,7 @@ import { getRtcConfig, isSameOrigin } from '../common' import { RedundancyUrlManager } from '../p2p-media-loader/redundancy-url-manager' import { segmentUrlBuilderFactory } from '../p2p-media-loader/segment-url-builder' import { SegmentValidator } from '../p2p-media-loader/segment-validator' +import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage' type ConstructorOptions = Pick & @@ -82,7 +83,10 @@ export class HLSOptionsBuilder { const { redundancyUrlManager, segmentValidator } = options let consumeOnly = false - if ((navigator as any)?.connection?.type === 'cellular') { + if ( + (navigator as any)?.connection?.type === 'cellular' || + peertubeLocalStorage.getItem('peertube-videojs-p2p-consume-only') === 'true' // Use for E2E testing + ) { logger.info('We are on a cellular connection: disabling seeding.') consumeOnly = true }