mirror of https://github.com/Chocobozzz/PeerTube
Add title in player peers info to show total downloaded/uploaded data
parent
ff644b3066
commit
1a49822c32
|
@ -466,7 +466,9 @@ class PeerTubePlugin extends Plugin {
|
||||||
return this.trigger('torrentInfo', {
|
return this.trigger('torrentInfo', {
|
||||||
downloadSpeed: this.torrent.downloadSpeed,
|
downloadSpeed: this.torrent.downloadSpeed,
|
||||||
numPeers: this.torrent.numPeers,
|
numPeers: this.torrent.numPeers,
|
||||||
uploadSpeed: this.torrent.uploadSpeed
|
uploadSpeed: this.torrent.uploadSpeed,
|
||||||
|
downloaded: this.torrent.downloaded,
|
||||||
|
uploaded: this.torrent.uploaded
|
||||||
})
|
})
|
||||||
}, this.CONSTANTS.INFO_SCHEDULER)
|
}, this.CONSTANTS.INFO_SCHEDULER)
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ import { bytes } from './utils'
|
||||||
|
|
||||||
const Button: VideoJSComponentInterface = videojsUntyped.getComponent('Button')
|
const Button: VideoJSComponentInterface = videojsUntyped.getComponent('Button')
|
||||||
class WebtorrentInfoButton extends Button {
|
class WebtorrentInfoButton extends Button {
|
||||||
|
|
||||||
createEl () {
|
createEl () {
|
||||||
const div = videojsUntyped.dom.createEl('div', {
|
const div = videojsUntyped.dom.createEl('div', {
|
||||||
className: 'vjs-peertube'
|
className: 'vjs-peertube'
|
||||||
|
@ -75,8 +76,13 @@ class WebtorrentInfoButton extends Button {
|
||||||
|
|
||||||
const downloadSpeed = bytes(data.downloadSpeed)
|
const downloadSpeed = bytes(data.downloadSpeed)
|
||||||
const uploadSpeed = bytes(data.uploadSpeed)
|
const uploadSpeed = bytes(data.uploadSpeed)
|
||||||
|
const totalDownloaded = bytes(data.downloaded)
|
||||||
|
const totalUploaded = bytes(data.uploaded)
|
||||||
const numPeers = data.numPeers
|
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 ]
|
downloadSpeedNumber.textContent = downloadSpeed[ 0 ]
|
||||||
downloadSpeedUnit.textContent = ' ' + downloadSpeed[ 1 ]
|
downloadSpeedUnit.textContent = ' ' + downloadSpeed[ 1 ]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue