diff options
author | Chocobozzz <me@florianbigard.com> | 2019-11-29 14:10:24 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-11-29 14:14:47 +0100 |
commit | 43c66a91dfe5b8e101047b815ab2da8512a00904 (patch) | |
tree | 6a5d9e439e280d535baf48171c84f91be59909b9 /client | |
parent | 20f1ec8d9d356bf961d3672c3ec771745fd4ce36 (diff) | |
download | PeerTube-43c66a91dfe5b8e101047b815ab2da8512a00904.tar.gz PeerTube-43c66a91dfe5b8e101047b815ab2da8512a00904.tar.zst PeerTube-43c66a91dfe5b8e101047b815ab2da8512a00904.zip |
Add ability to disable P2P in HLS player too
Diffstat (limited to 'client')
4 files changed, 8 insertions, 6 deletions
diff --git a/client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.html b/client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.html index 6f9159ec8..17d8cde06 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.html +++ b/client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.html | |||
@@ -38,7 +38,7 @@ | |||
38 | <div class="form-group"> | 38 | <div class="form-group"> |
39 | <my-peertube-checkbox | 39 | <my-peertube-checkbox |
40 | inputName="webTorrentEnabled" formControlName="webTorrentEnabled" | 40 | inputName="webTorrentEnabled" formControlName="webTorrentEnabled" |
41 | i18n-labelText labelText="Use WebTorrent to exchange parts of the video with others" | 41 | i18n-labelText labelText="Use P2P to exchange parts of the video with others" |
42 | ></my-peertube-checkbox> | 42 | ></my-peertube-checkbox> |
43 | </div> | 43 | </div> |
44 | 44 | ||
diff --git a/client/src/assets/player/peertube-player-local-storage.ts b/client/src/assets/player/peertube-player-local-storage.ts index f6c5c5419..75ccfe618 100644 --- a/client/src/assets/player/peertube-player-local-storage.ts +++ b/client/src/assets/player/peertube-player-local-storage.ts | |||
@@ -10,7 +10,7 @@ function getStoredVolume () { | |||
10 | return undefined | 10 | return undefined |
11 | } | 11 | } |
12 | 12 | ||
13 | function getStoredWebTorrentEnabled (): boolean { | 13 | function getStoredP2PEnabled (): boolean { |
14 | const value = getLocalStorage('webtorrent_enabled') | 14 | const value = getLocalStorage('webtorrent_enabled') |
15 | if (value !== null && value !== undefined) return value === 'true' | 15 | if (value !== null && value !== undefined) return value === 'true' |
16 | 16 | ||
@@ -72,7 +72,7 @@ function getStoredLastSubtitle () { | |||
72 | 72 | ||
73 | export { | 73 | export { |
74 | getStoredVolume, | 74 | getStoredVolume, |
75 | getStoredWebTorrentEnabled, | 75 | getStoredP2PEnabled, |
76 | getStoredMute, | 76 | getStoredMute, |
77 | getStoredTheater, | 77 | getStoredTheater, |
78 | saveVolumeInStore, | 78 | saveVolumeInStore, |
diff --git a/client/src/assets/player/peertube-player-manager.ts b/client/src/assets/player/peertube-player-manager.ts index bda718cff..7c7c9ad2a 100644 --- a/client/src/assets/player/peertube-player-manager.ts +++ b/client/src/assets/player/peertube-player-manager.ts | |||
@@ -18,6 +18,7 @@ import { getCompleteLocale, getShortLocale, is18nLocale, isDefaultLocale } from | |||
18 | import { segmentValidatorFactory } from './p2p-media-loader/segment-validator' | 18 | import { segmentValidatorFactory } from './p2p-media-loader/segment-validator' |
19 | import { segmentUrlBuilderFactory } from './p2p-media-loader/segment-url-builder' | 19 | import { segmentUrlBuilderFactory } from './p2p-media-loader/segment-url-builder' |
20 | import { RedundancyUrlManager } from './p2p-media-loader/redundancy-url-manager' | 20 | import { RedundancyUrlManager } from './p2p-media-loader/redundancy-url-manager' |
21 | import { getStoredP2PEnabled } from './peertube-player-local-storage' | ||
21 | 22 | ||
22 | // Change 'Playback Rate' to 'Speed' (smaller for our settings menu) | 23 | // Change 'Playback Rate' to 'Speed' (smaller for our settings menu) |
23 | videojsUntyped.getComponent('PlaybackRateMenuButton').prototype.controlText_ = 'Speed' | 24 | videojsUntyped.getComponent('PlaybackRateMenuButton').prototype.controlText_ = 'Speed' |
@@ -245,7 +246,8 @@ export class PeertubePlayerManager { | |||
245 | segmentValidator: segmentValidatorFactory(options.p2pMediaLoader.segmentsSha256Url), | 246 | segmentValidator: segmentValidatorFactory(options.p2pMediaLoader.segmentsSha256Url), |
246 | rtcConfig: getRtcConfig(), | 247 | rtcConfig: getRtcConfig(), |
247 | requiredSegmentsPriority: 5, | 248 | requiredSegmentsPriority: 5, |
248 | segmentUrlBuilder: segmentUrlBuilderFactory(redundancyUrlManager) | 249 | segmentUrlBuilder: segmentUrlBuilderFactory(redundancyUrlManager), |
250 | useP2P: getStoredP2PEnabled() | ||
249 | }, | 251 | }, |
250 | segments: { | 252 | segments: { |
251 | swarmId: p2pMediaLoaderOptions.playlistUrl | 253 | swarmId: p2pMediaLoaderOptions.playlistUrl |
diff --git a/client/src/assets/player/webtorrent/webtorrent-plugin.ts b/client/src/assets/player/webtorrent/webtorrent-plugin.ts index 656a32f49..5101b5162 100644 --- a/client/src/assets/player/webtorrent/webtorrent-plugin.ts +++ b/client/src/assets/player/webtorrent/webtorrent-plugin.ts | |||
@@ -11,7 +11,7 @@ import { | |||
11 | getAverageBandwidthInStore, | 11 | getAverageBandwidthInStore, |
12 | getStoredMute, | 12 | getStoredMute, |
13 | getStoredVolume, | 13 | getStoredVolume, |
14 | getStoredWebTorrentEnabled, | 14 | getStoredP2PEnabled, |
15 | saveAverageBandwidth | 15 | saveAverageBandwidth |
16 | } from '../peertube-player-local-storage' | 16 | } from '../peertube-player-local-storage' |
17 | import { VideoFile } from '@shared/models' | 17 | import { VideoFile } from '@shared/models' |
@@ -77,7 +77,7 @@ class WebTorrentPlugin extends Plugin { | |||
77 | 77 | ||
78 | // Disable auto play on iOS | 78 | // Disable auto play on iOS |
79 | this.autoplay = options.autoplay && this.isIOS() === false | 79 | this.autoplay = options.autoplay && this.isIOS() === false |
80 | this.playerRefusedP2P = !getStoredWebTorrentEnabled() | 80 | this.playerRefusedP2P = !getStoredP2PEnabled() |
81 | 81 | ||
82 | this.videoFiles = options.videoFiles | 82 | this.videoFiles = options.videoFiles |
83 | this.videoDuration = options.videoDuration | 83 | this.videoDuration = options.videoDuration |