aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/assets
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-06-22 11:37:33 +0200
committerChocobozzz <me@florianbigard.com>2018-06-22 15:11:04 +0200
commit1a49822c321c34c39faf0411189a7073effa7eb7 (patch)
tree56017e100e38dded703feb7af495a5f94bc4335b /client/src/assets
parentff644b3066e18f232ce0b9de9129f34d42d3f35d (diff)
downloadPeerTube-1a49822c321c34c39faf0411189a7073effa7eb7.tar.gz
PeerTube-1a49822c321c34c39faf0411189a7073effa7eb7.tar.zst
PeerTube-1a49822c321c34c39faf0411189a7073effa7eb7.zip
Add title in player peers info to show total downloaded/uploaded data
Diffstat (limited to 'client/src/assets')
-rw-r--r--client/src/assets/player/peertube-videojs-plugin.ts4
-rw-r--r--client/src/assets/player/webtorrent-info-button.ts6
2 files changed, 9 insertions, 1 deletions
diff --git a/client/src/assets/player/peertube-videojs-plugin.ts b/client/src/assets/player/peertube-videojs-plugin.ts
index 35a347e99..fc07c35d6 100644
--- a/client/src/assets/player/peertube-videojs-plugin.ts
+++ b/client/src/assets/player/peertube-videojs-plugin.ts
@@ -466,7 +466,9 @@ class PeerTubePlugin extends Plugin {
466 return this.trigger('torrentInfo', { 466 return this.trigger('torrentInfo', {
467 downloadSpeed: this.torrent.downloadSpeed, 467 downloadSpeed: this.torrent.downloadSpeed,
468 numPeers: this.torrent.numPeers, 468 numPeers: this.torrent.numPeers,
469 uploadSpeed: this.torrent.uploadSpeed 469 uploadSpeed: this.torrent.uploadSpeed,
470 downloaded: this.torrent.downloaded,
471 uploaded: this.torrent.uploaded
470 }) 472 })
471 }, this.CONSTANTS.INFO_SCHEDULER) 473 }, this.CONSTANTS.INFO_SCHEDULER)
472 } 474 }
diff --git a/client/src/assets/player/webtorrent-info-button.ts b/client/src/assets/player/webtorrent-info-button.ts
index 1296aca3b..5f3e80c79 100644
--- a/client/src/assets/player/webtorrent-info-button.ts
+++ b/client/src/assets/player/webtorrent-info-button.ts
@@ -3,6 +3,7 @@ import { bytes } from './utils'
3 3
4const Button: VideoJSComponentInterface = videojsUntyped.getComponent('Button') 4const Button: VideoJSComponentInterface = videojsUntyped.getComponent('Button')
5class WebtorrentInfoButton extends Button { 5class WebtorrentInfoButton extends Button {
6
6 createEl () { 7 createEl () {
7 const div = videojsUntyped.dom.createEl('div', { 8 const div = videojsUntyped.dom.createEl('div', {
8 className: 'vjs-peertube' 9 className: 'vjs-peertube'
@@ -75,8 +76,13 @@ class WebtorrentInfoButton extends Button {
75 76
76 const downloadSpeed = bytes(data.downloadSpeed) 77 const downloadSpeed = bytes(data.downloadSpeed)
77 const uploadSpeed = bytes(data.uploadSpeed) 78 const uploadSpeed = bytes(data.uploadSpeed)
79 const totalDownloaded = bytes(data.downloaded)
80 const totalUploaded = bytes(data.uploaded)
78 const numPeers = data.numPeers 81 const numPeers = data.numPeers
79 82
83 subDivWebtorrent.title = this.player_.localize('Total Downloaded: ') + totalDownloaded.join(' ') + '\n' +
84 this.player_.localize('Total uploaded: ' + totalUploaded.join(' '))
85
80 downloadSpeedNumber.textContent = downloadSpeed[ 0 ] 86 downloadSpeedNumber.textContent = downloadSpeed[ 0 ]
81 downloadSpeedUnit.textContent = ' ' + downloadSpeed[ 1 ] 87 downloadSpeedUnit.textContent = ' ' + downloadSpeed[ 1 ]
82 88