Disable p2p seeding using local storage
Used by E2E testing
This commit is contained in:
parent
d8f846c69d
commit
33c707616c
|
@ -8,6 +8,7 @@ import { getRtcConfig, isSameOrigin } from '../common'
|
||||||
import { RedundancyUrlManager } from '../p2p-media-loader/redundancy-url-manager'
|
import { RedundancyUrlManager } from '../p2p-media-loader/redundancy-url-manager'
|
||||||
import { segmentUrlBuilderFactory } from '../p2p-media-loader/segment-url-builder'
|
import { segmentUrlBuilderFactory } from '../p2p-media-loader/segment-url-builder'
|
||||||
import { SegmentValidator } from '../p2p-media-loader/segment-validator'
|
import { SegmentValidator } from '../p2p-media-loader/segment-validator'
|
||||||
|
import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage'
|
||||||
|
|
||||||
type ConstructorOptions =
|
type ConstructorOptions =
|
||||||
Pick<PeerTubePlayerContructorOptions, 'pluginsManager' | 'serverUrl' | 'authorizationHeader'> &
|
Pick<PeerTubePlayerContructorOptions, 'pluginsManager' | 'serverUrl' | 'authorizationHeader'> &
|
||||||
|
@ -82,7 +83,10 @@ export class HLSOptionsBuilder {
|
||||||
const { redundancyUrlManager, segmentValidator } = options
|
const { redundancyUrlManager, segmentValidator } = options
|
||||||
|
|
||||||
let consumeOnly = false
|
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.')
|
logger.info('We are on a cellular connection: disabling seeding.')
|
||||||
consumeOnly = true
|
consumeOnly = true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue