aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/assets/player
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-12-15 16:25:33 +0100
committerChocobozzz <me@florianbigard.com>2021-12-16 10:08:55 +0100
commit9576506763c20c7efbdb229483440a1fc984cf4d (patch)
tree58b3b52b85693c00a9dac2e73fed220ac65cc243 /client/src/assets/player
parentbf1c3c78b0e2b70bb46168a9dec0d3fa0997ab14 (diff)
downloadPeerTube-9576506763c20c7efbdb229483440a1fc984cf4d.tar.gz
PeerTube-9576506763c20c7efbdb229483440a1fc984cf4d.tar.zst
PeerTube-9576506763c20c7efbdb229483440a1fc984cf4d.zip
Add P2P enabled/disabled in player card
Diffstat (limited to 'client/src/assets/player')
-rw-r--r--client/src/assets/player/peertube-player-manager.ts3
-rw-r--r--client/src/assets/player/stats/stats-card.ts5
2 files changed, 6 insertions, 2 deletions
diff --git a/client/src/assets/player/peertube-player-manager.ts b/client/src/assets/player/peertube-player-manager.ts
index 57cdfca28..ac8134fa8 100644
--- a/client/src/assets/player/peertube-player-manager.ts
+++ b/client/src/assets/player/peertube-player-manager.ts
@@ -193,7 +193,8 @@ export class PeertubePlayerManager {
193 player.stats({ 193 player.stats({
194 videoUUID: options.common.videoUUID, 194 videoUUID: options.common.videoUUID,
195 videoIsLive: options.common.isLive, 195 videoIsLive: options.common.isLive,
196 mode 196 mode,
197 p2pEnabled: options.common.p2pEnabled
197 }) 198 })
198 199
199 player.on('p2pInfo', (_, data: PlayerNetworkInfo) => { 200 player.on('p2pInfo', (_, data: PlayerNetworkInfo) => {
diff --git a/client/src/assets/player/stats/stats-card.ts b/client/src/assets/player/stats/stats-card.ts
index 45fd30d55..55d850eda 100644
--- a/client/src/assets/player/stats/stats-card.ts
+++ b/client/src/assets/player/stats/stats-card.ts
@@ -7,6 +7,7 @@ interface StatsCardOptions extends videojs.ComponentOptions {
7 videoUUID: string 7 videoUUID: string
8 videoIsLive: boolean 8 videoIsLive: boolean
9 mode: 'webtorrent' | 'p2p-media-loader' 9 mode: 'webtorrent' | 'p2p-media-loader'
10 p2pEnabled: boolean
10} 11}
11 12
12interface PlayerNetworkInfo { 13interface PlayerNetworkInfo {
@@ -33,6 +34,7 @@ class StatsCard extends Component {
33 updateInterval: any 34 updateInterval: any
34 35
35 mode: 'webtorrent' | 'p2p-media-loader' 36 mode: 'webtorrent' | 'p2p-media-loader'
37 p2pEnabled: boolean
36 38
37 metadataStore: any = {} 39 metadataStore: any = {}
38 40
@@ -200,7 +202,7 @@ class StatsCard extends Component {
200 ? `${playerNetworkInfo.totalDownloaded} &dArr; / ${playerNetworkInfo.totalUploaded} &uArr;` 202 ? `${playerNetworkInfo.totalDownloaded} &dArr; / ${playerNetworkInfo.totalUploaded} &uArr;`
201 : undefined 203 : undefined
202 const downloadBreakdown = playerNetworkInfo.downloadedFromServer 204 const downloadBreakdown = playerNetworkInfo.downloadedFromServer
203 ? `${playerNetworkInfo.downloadedFromServer} from server · ${playerNetworkInfo.downloadedFromPeers} from peers` 205 ? `${playerNetworkInfo.downloadedFromServer} from servers · ${playerNetworkInfo.downloadedFromPeers} from peers`
204 : undefined 206 : undefined
205 207
206 const bufferProgress = progress !== undefined 208 const bufferProgress = progress !== undefined
@@ -209,6 +211,7 @@ class StatsCard extends Component {
209 211
210 return ` 212 return `
211 ${this.buildElement(player.localize('Player mode'), this.mode || 'HTTP')} 213 ${this.buildElement(player.localize('Player mode'), this.mode || 'HTTP')}
214 ${this.buildElement(player.localize('P2P'), player.localize(this.p2pEnabled ? 'enabled' : 'disabled'))}
212 215
213 ${this.buildElement(player.localize('Video UUID'), this.options_.videoUUID)} 216 ${this.buildElement(player.localize('Video UUID'), this.options_.videoUUID)}
214 217