aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/assets/player/peertube-player-manager.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-12-15 15:58:10 +0100
committerChocobozzz <me@florianbigard.com>2021-12-16 10:08:55 +0100
commita9bfa85d2cdf13670aaced740da5b493fbeddfce (patch)
tree3781c9218d4cc7786b6589365c0efbed2151703d /client/src/assets/player/peertube-player-manager.ts
parentc77fdc605b3ccc1ab6890f889d8200fbe9372949 (diff)
downloadPeerTube-a9bfa85d2cdf13670aaced740da5b493fbeddfce.tar.gz
PeerTube-a9bfa85d2cdf13670aaced740da5b493fbeddfce.tar.zst
PeerTube-a9bfa85d2cdf13670aaced740da5b493fbeddfce.zip
Add ability for admins to set default p2p policy
Diffstat (limited to 'client/src/assets/player/peertube-player-manager.ts')
-rw-r--r--client/src/assets/player/peertube-player-manager.ts6
1 files changed, 4 insertions, 2 deletions
diff --git a/client/src/assets/player/peertube-player-manager.ts b/client/src/assets/player/peertube-player-manager.ts
index 3e6398f50..c27024beb 100644
--- a/client/src/assets/player/peertube-player-manager.ts
+++ b/client/src/assets/player/peertube-player-manager.ts
@@ -31,7 +31,7 @@ import { copyToClipboard } from '../../root-helpers/utils'
31import { RedundancyUrlManager } from './p2p-media-loader/redundancy-url-manager' 31import { RedundancyUrlManager } from './p2p-media-loader/redundancy-url-manager'
32import { segmentUrlBuilderFactory } from './p2p-media-loader/segment-url-builder' 32import { segmentUrlBuilderFactory } from './p2p-media-loader/segment-url-builder'
33import { segmentValidatorFactory } from './p2p-media-loader/segment-validator' 33import { segmentValidatorFactory } from './p2p-media-loader/segment-validator'
34import { getAverageBandwidthInStore, getStoredP2PEnabled, saveAverageBandwidth } from './peertube-player-local-storage' 34import { getAverageBandwidthInStore, saveAverageBandwidth } from './peertube-player-local-storage'
35import { 35import {
36 NextPreviousVideoButtonOptions, 36 NextPreviousVideoButtonOptions,
37 P2PMediaLoaderPluginOptions, 37 P2PMediaLoaderPluginOptions,
@@ -86,6 +86,7 @@ export interface CommonOptions extends CustomizationOptions {
86 onPlayerElementChange: (element: HTMLVideoElement) => void 86 onPlayerElementChange: (element: HTMLVideoElement) => void
87 87
88 autoplay: boolean 88 autoplay: boolean
89 p2pEnabled: boolean
89 90
90 nextVideo?: () => void 91 nextVideo?: () => void
91 hasNextVideo?: () => boolean 92 hasNextVideo?: () => boolean
@@ -374,7 +375,7 @@ export class PeertubePlayerManager {
374 requiredSegmentsPriority: 1, 375 requiredSegmentsPriority: 1,
375 simultaneousHttpDownloads: 1, 376 simultaneousHttpDownloads: 1,
376 segmentUrlBuilder: segmentUrlBuilderFactory(redundancyUrlManager, 1), 377 segmentUrlBuilder: segmentUrlBuilderFactory(redundancyUrlManager, 1),
377 useP2P: getStoredP2PEnabled(), 378 useP2P: commonOptions.p2pEnabled,
378 consumeOnly 379 consumeOnly
379 }, 380 },
380 segments: { 381 segments: {
@@ -437,6 +438,7 @@ export class PeertubePlayerManager {
437 438
438 const webtorrent = { 439 const webtorrent = {
439 autoplay, 440 autoplay,
441 playerRefusedP2P: commonOptions.p2pEnabled === false,
440 videoDuration: commonOptions.videoDuration, 442 videoDuration: commonOptions.videoDuration,
441 playerElement: commonOptions.playerElement, 443 playerElement: commonOptions.playerElement,
442 videoFiles: webtorrentOptions.videoFiles.length !== 0 444 videoFiles: webtorrentOptions.videoFiles.length !== 0