From: Chocobozzz Date: Fri, 22 Jun 2018 09:37:33 +0000 (+0200) Subject: Add title in player peers info to show total downloaded/uploaded data X-Git-Tag: v1.0.0-beta.9~9 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=1a49822c321c34c39faf0411189a7073effa7eb7;p=oweals%2Fpeertube.git Add title in player peers info to show total downloaded/uploaded data --- 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 { return this.trigger('torrentInfo', { downloadSpeed: this.torrent.downloadSpeed, numPeers: this.torrent.numPeers, - uploadSpeed: this.torrent.uploadSpeed + uploadSpeed: this.torrent.uploadSpeed, + downloaded: this.torrent.downloaded, + uploaded: this.torrent.uploaded }) }, this.CONSTANTS.INFO_SCHEDULER) } 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' const Button: VideoJSComponentInterface = videojsUntyped.getComponent('Button') class WebtorrentInfoButton extends Button { + createEl () { const div = videojsUntyped.dom.createEl('div', { className: 'vjs-peertube' @@ -75,8 +76,13 @@ class WebtorrentInfoButton extends Button { const downloadSpeed = bytes(data.downloadSpeed) const uploadSpeed = bytes(data.uploadSpeed) + const totalDownloaded = bytes(data.downloaded) + const totalUploaded = bytes(data.uploaded) const numPeers = data.numPeers + subDivWebtorrent.title = this.player_.localize('Total Downloaded: ') + totalDownloaded.join(' ') + '\n' + + this.player_.localize('Total uploaded: ' + totalUploaded.join(' ')) + downloadSpeedNumber.textContent = downloadSpeed[ 0 ] downloadSpeedUnit.textContent = ' ' + downloadSpeed[ 1 ]