From 171528373e89560b3c396bc0d510d013e1f9c28e Mon Sep 17 00:00:00 2001 From: Florian CUNY Date: Fri, 4 Dec 2020 16:30:01 +0100 Subject: add 'total downloaded' stats from server and peers in player (#3394) Implements https://github.com/Chocobozzz/PeerTube/issues/3384 This will only work with HLS. The display for Webtorrent is left untouched. Co-authored-by: Rigel Kent --- .../src/assets/player/videojs-components/p2p-info-button.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'client/src/assets/player/videojs-components') diff --git a/client/src/assets/player/videojs-components/p2p-info-button.ts b/client/src/assets/player/videojs-components/p2p-info-button.ts index db6806fed..b1f7cd751 100644 --- a/client/src/assets/player/videojs-components/p2p-info-button.ts +++ b/client/src/assets/player/videojs-components/p2p-info-button.ts @@ -84,8 +84,17 @@ class P2pInfoButton extends Button { const totalUploaded = bytes(p2pStats.uploaded + httpStats.uploaded) const numPeers = p2pStats.numPeers - subDivWebtorrent.title = this.player().localize('Total downloaded: ') + totalDownloaded.join(' ') + '\n' + - this.player().localize('Total uploaded: ' + totalUploaded.join(' ')) + subDivWebtorrent.title = this.player().localize('Total downloaded: ') + totalDownloaded.join(' ') + '\n' + + if (data.source === 'p2p-media-loader') { + const downloadedFromServer = bytes(httpStats.downloaded).join(' ') + const downloadedFromPeers = bytes(p2pStats.downloaded).join(' ') + + subDivWebtorrent.title += + '* ' + this.player().localize('From the server: ') + downloadedFromServer + '\n' + + '* ' + this.player().localize('From peers: ') + downloadedFromPeers + '\n' + } + subDivWebtorrent.title += this.player().localize('Total uploaded: ') + totalUploaded.join(' ') downloadSpeedNumber.textContent = downloadSpeed[ 0 ] downloadSpeedUnit.textContent = ' ' + downloadSpeed[ 1 ] -- cgit v1.2.3