aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/assets
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2018-10-12 18:12:39 +0200
committerRigel Kent <sendmemail@rigelk.eu>2018-10-13 11:53:48 +0200
commited638e5325096ef580da20f370ac61c59cd48cf7 (patch)
tree8ad4c1001efb3adc3946a6b6c9a3c1ed1f557995 /client/src/assets
parent64cc5e8575fda47b281ae20abf0020e27fc8ce7c (diff)
downloadPeerTube-ed638e5325096ef580da20f370ac61c59cd48cf7.tar.gz
PeerTube-ed638e5325096ef580da20f370ac61c59cd48cf7.tar.zst
PeerTube-ed638e5325096ef580da20f370ac61c59cd48cf7.zip
move to boolean switch
Diffstat (limited to 'client/src/assets')
-rw-r--r--client/src/assets/player/peertube-player-local-storage.ts12
-rw-r--r--client/src/assets/player/peertube-videojs-plugin.ts5
2 files changed, 7 insertions, 10 deletions
diff --git a/client/src/assets/player/peertube-player-local-storage.ts b/client/src/assets/player/peertube-player-local-storage.ts
index c3d8b71bc..3ac5fe58a 100644
--- a/client/src/assets/player/peertube-player-local-storage.ts
+++ b/client/src/assets/player/peertube-player-local-storage.ts
@@ -10,13 +10,11 @@ function getStoredVolume () {
10 return undefined 10 return undefined
11} 11}
12 12
13function getStoredWebTorrentPolicy () { 13function getStoredWebTorrentEnabled (): boolean {
14 const value = getLocalStorage('webtorrent_policy') 14 const value = getLocalStorage('webtorrent_enabled')
15 if (value !== null && value !== undefined) { 15 if (value !== null && value !== undefined) return value === 'true'
16 if (value.toString() === 'disable') return true
17 }
18 16
19 return undefined 17 return false
20} 18}
21 19
22function getStoredMute () { 20function getStoredMute () {
@@ -65,7 +63,7 @@ function getAverageBandwidthInStore () {
65 63
66export { 64export {
67 getStoredVolume, 65 getStoredVolume,
68 getStoredWebTorrentPolicy, 66 getStoredWebTorrentEnabled,
69 getStoredMute, 67 getStoredMute,
70 getStoredTheater, 68 getStoredTheater,
71 saveVolumeInStore, 69 saveVolumeInStore,
diff --git a/client/src/assets/player/peertube-videojs-plugin.ts b/client/src/assets/player/peertube-videojs-plugin.ts
index 90ca8f9fa..a53a2cc69 100644
--- a/client/src/assets/player/peertube-videojs-plugin.ts
+++ b/client/src/assets/player/peertube-videojs-plugin.ts
@@ -8,7 +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 getStoredWebTorrentEnabled,
12 getAverageBandwidthInStore, 12 getAverageBandwidthInStore,
13 getStoredMute, 13 getStoredMute,
14 getStoredVolume, 14 getStoredVolume,
@@ -82,6 +82,7 @@ class PeerTubePlugin extends Plugin {
82 82
83 // Disable auto play on iOS 83 // Disable auto play on iOS
84 this.autoplay = options.autoplay && this.isIOS() === false 84 this.autoplay = options.autoplay && this.isIOS() === false
85 this.playerRefusedP2P = !getStoredWebTorrentEnabled()
85 86
86 this.startTime = timeToInt(options.startTime) 87 this.startTime = timeToInt(options.startTime)
87 this.videoFiles = options.videoFiles 88 this.videoFiles = options.videoFiles
@@ -99,7 +100,6 @@ class PeerTubePlugin extends Plugin {
99 if (volume !== undefined) this.player.volume(volume) 100 if (volume !== undefined) this.player.volume(volume)
100 const muted = getStoredMute() 101 const muted = getStoredMute()
101 if (muted !== undefined) this.player.muted(muted) 102 if (muted !== undefined) this.player.muted(muted)
102 this.playerRefusedP2P = getStoredWebTorrentPolicy() || false
103 103
104 this.initializePlayer() 104 this.initializePlayer()
105 this.runTorrentInfoScheduler() 105 this.runTorrentInfoScheduler()
@@ -291,7 +291,6 @@ class PeerTubePlugin extends Plugin {
291 renderVideo(torrent.files[ 0 ], this.playerElement, renderVideoOptions, (err, renderer) => { 291 renderVideo(torrent.files[ 0 ], this.playerElement, renderVideoOptions, (err, renderer) => {
292 this.renderer = renderer 292 this.renderer = renderer
293 293
294 console.log('value this.playerRefusedP2P', this.playerRefusedP2P)
295 if (err || this.playerRefusedP2P) return this.fallbackToHttp(done) 294 if (err || this.playerRefusedP2P) return this.fallbackToHttp(done)
296 295
297 return this.tryToPlay(err => { 296 return this.tryToPlay(err => {