aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/assets/player/peertube-videojs-plugin.ts
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2018-10-05 15:17:34 +0200
committerRigel Kent <sendmemail@rigelk.eu>2018-10-13 11:53:42 +0200
commit64cc5e8575fda47b281ae20abf0020e27fc8ce7c (patch)
treec3ec40b03d3fdc5d3beee9ff089384c894d9efe9 /client/src/assets/player/peertube-videojs-plugin.ts
parent0e5ff97f6fdf9a4cebe5a15f5a390380465803ad (diff)
downloadPeerTube-64cc5e8575fda47b281ae20abf0020e27fc8ce7c.tar.gz
PeerTube-64cc5e8575fda47b281ae20abf0020e27fc8ce7c.tar.zst
PeerTube-64cc5e8575fda47b281ae20abf0020e27fc8ce7c.zip
add webtorrent opt-out settings
- add a key in localstorage to remember the opt-out - add a user setting
Diffstat (limited to 'client/src/assets/player/peertube-videojs-plugin.ts')
-rw-r--r--client/src/assets/player/peertube-videojs-plugin.ts6
1 files changed, 5 insertions, 1 deletions
diff --git a/client/src/assets/player/peertube-videojs-plugin.ts b/client/src/assets/player/peertube-videojs-plugin.ts
index 2330f476f..90ca8f9fa 100644
--- a/client/src/assets/player/peertube-videojs-plugin.ts
+++ b/client/src/assets/player/peertube-videojs-plugin.ts
@@ -8,6 +8,7 @@ import { isMobile, timeToInt, videoFileMaxByResolution, videoFileMinByResolution
8import * as CacheChunkStore from 'cache-chunk-store' 8import * as CacheChunkStore from 'cache-chunk-store'
9import { PeertubeChunkStore } from './peertube-chunk-store' 9import { PeertubeChunkStore } from './peertube-chunk-store'
10import { 10import {
11 getStoredWebTorrentPolicy,
11 getAverageBandwidthInStore, 12 getAverageBandwidthInStore,
12 getStoredMute, 13 getStoredMute,
13 getStoredVolume, 14 getStoredVolume,
@@ -64,6 +65,7 @@ class PeerTubePlugin extends Plugin {
64 private autoResolution = true 65 private autoResolution = true
65 private forbidAutoResolution = false 66 private forbidAutoResolution = false
66 private isAutoResolutionObservation = false 67 private isAutoResolutionObservation = false
68 private playerRefusedP2P = false
67 69
68 private videoViewInterval 70 private videoViewInterval
69 private torrentInfoInterval 71 private torrentInfoInterval
@@ -97,6 +99,7 @@ class PeerTubePlugin extends Plugin {
97 if (volume !== undefined) this.player.volume(volume) 99 if (volume !== undefined) this.player.volume(volume)
98 const muted = getStoredMute() 100 const muted = getStoredMute()
99 if (muted !== undefined) this.player.muted(muted) 101 if (muted !== undefined) this.player.muted(muted)
102 this.playerRefusedP2P = getStoredWebTorrentPolicy() || false
100 103
101 this.initializePlayer() 104 this.initializePlayer()
102 this.runTorrentInfoScheduler() 105 this.runTorrentInfoScheduler()
@@ -288,7 +291,8 @@ class PeerTubePlugin extends Plugin {
288 renderVideo(torrent.files[ 0 ], this.playerElement, renderVideoOptions, (err, renderer) => { 291 renderVideo(torrent.files[ 0 ], this.playerElement, renderVideoOptions, (err, renderer) => {
289 this.renderer = renderer 292 this.renderer = renderer
290 293
291 if (err) return this.fallbackToHttp(done) 294 console.log('value this.playerRefusedP2P', this.playerRefusedP2P)
295 if (err || this.playerRefusedP2P) return this.fallbackToHttp(done)
292 296
293 return this.tryToPlay(err => { 297 return this.tryToPlay(err => {
294 if (err) return done(err) 298 if (err) return done(err)