Add ability to disable P2P in HLS player too

pull/2301/head
Chocobozzz 2019-11-29 14:10:24 +01:00
parent 20f1ec8d9d
commit 43c66a91df
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
4 changed files with 8 additions and 6 deletions

View File

@ -38,7 +38,7 @@
<div class="form-group">
<my-peertube-checkbox
inputName="webTorrentEnabled" formControlName="webTorrentEnabled"
i18n-labelText labelText="Use WebTorrent to exchange parts of the video with others"
i18n-labelText labelText="Use P2P to exchange parts of the video with others"
></my-peertube-checkbox>
</div>

View File

@ -10,7 +10,7 @@ function getStoredVolume () {
return undefined
}
function getStoredWebTorrentEnabled (): boolean {
function getStoredP2PEnabled (): boolean {
const value = getLocalStorage('webtorrent_enabled')
if (value !== null && value !== undefined) return value === 'true'
@ -72,7 +72,7 @@ function getStoredLastSubtitle () {
export {
getStoredVolume,
getStoredWebTorrentEnabled,
getStoredP2PEnabled,
getStoredMute,
getStoredTheater,
saveVolumeInStore,

View File

@ -18,6 +18,7 @@ import { getCompleteLocale, getShortLocale, is18nLocale, isDefaultLocale } from
import { segmentValidatorFactory } from './p2p-media-loader/segment-validator'
import { segmentUrlBuilderFactory } from './p2p-media-loader/segment-url-builder'
import { RedundancyUrlManager } from './p2p-media-loader/redundancy-url-manager'
import { getStoredP2PEnabled } from './peertube-player-local-storage'
// Change 'Playback Rate' to 'Speed' (smaller for our settings menu)
videojsUntyped.getComponent('PlaybackRateMenuButton').prototype.controlText_ = 'Speed'
@ -245,7 +246,8 @@ export class PeertubePlayerManager {
segmentValidator: segmentValidatorFactory(options.p2pMediaLoader.segmentsSha256Url),
rtcConfig: getRtcConfig(),
requiredSegmentsPriority: 5,
segmentUrlBuilder: segmentUrlBuilderFactory(redundancyUrlManager)
segmentUrlBuilder: segmentUrlBuilderFactory(redundancyUrlManager),
useP2P: getStoredP2PEnabled()
},
segments: {
swarmId: p2pMediaLoaderOptions.playlistUrl

View File

@ -11,7 +11,7 @@ import {
getAverageBandwidthInStore,
getStoredMute,
getStoredVolume,
getStoredWebTorrentEnabled,
getStoredP2PEnabled,
saveAverageBandwidth
} from '../peertube-player-local-storage'
import { VideoFile } from '@shared/models'
@ -77,7 +77,7 @@ class WebTorrentPlugin extends Plugin {
// Disable auto play on iOS
this.autoplay = options.autoplay && this.isIOS() === false
this.playerRefusedP2P = !getStoredWebTorrentEnabled()
this.playerRefusedP2P = !getStoredP2PEnabled()
this.videoFiles = options.videoFiles
this.videoDuration = options.videoDuration