diff options
Diffstat (limited to 'client/src/assets/player')
-rw-r--r-- | client/src/assets/player/peertube-player-local-storage.ts | 10 | ||||
-rw-r--r-- | client/src/assets/player/peertube-videojs-plugin.ts | 6 |
2 files changed, 15 insertions, 1 deletions
diff --git a/client/src/assets/player/peertube-player-local-storage.ts b/client/src/assets/player/peertube-player-local-storage.ts index dac54c5a4..c3d8b71bc 100644 --- a/client/src/assets/player/peertube-player-local-storage.ts +++ b/client/src/assets/player/peertube-player-local-storage.ts | |||
@@ -10,6 +10,15 @@ function getStoredVolume () { | |||
10 | return undefined | 10 | return undefined |
11 | } | 11 | } |
12 | 12 | ||
13 | function getStoredWebTorrentPolicy () { | ||
14 | const value = getLocalStorage('webtorrent_policy') | ||
15 | if (value !== null && value !== undefined) { | ||
16 | if (value.toString() === 'disable') return true | ||
17 | } | ||
18 | |||
19 | return undefined | ||
20 | } | ||
21 | |||
13 | function getStoredMute () { | 22 | function getStoredMute () { |
14 | const value = getLocalStorage('mute') | 23 | const value = getLocalStorage('mute') |
15 | if (value !== null && value !== undefined) return value === 'true' | 24 | if (value !== null && value !== undefined) return value === 'true' |
@@ -56,6 +65,7 @@ function getAverageBandwidthInStore () { | |||
56 | 65 | ||
57 | export { | 66 | export { |
58 | getStoredVolume, | 67 | getStoredVolume, |
68 | getStoredWebTorrentPolicy, | ||
59 | getStoredMute, | 69 | getStoredMute, |
60 | getStoredTheater, | 70 | getStoredTheater, |
61 | saveVolumeInStore, | 71 | saveVolumeInStore, |
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 | |||
8 | import * as CacheChunkStore from 'cache-chunk-store' | 8 | import * as CacheChunkStore from 'cache-chunk-store' |
9 | import { PeertubeChunkStore } from './peertube-chunk-store' | 9 | import { PeertubeChunkStore } from './peertube-chunk-store' |
10 | import { | 10 | import { |
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) |