Skip to content

Commit

Permalink
Disable p2p seeding using local storage
Browse files Browse the repository at this point in the history
Used by E2E testing
  • Loading branch information
Chocobozzz committed Nov 15, 2023
1 parent d8f846c commit 33c7076
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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<PeerTubePlayerContructorOptions, 'pluginsManager' | 'serverUrl' | 'authorizationHeader'> &
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 33c7076

Please sign in to comment.