]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/assets/player/videojs-components/p2p-info-button.ts
Use source sans 3 font
[github/Chocobozzz/PeerTube.git] / client / src / assets / player / videojs-components / p2p-info-button.ts
index e340337ede03681bf4fd6c1bf58a6bbfd189d63a..81f9544f4476c22c4b7055b3170000e635d97447 100644 (file)
@@ -1,5 +1,5 @@
 import { PlayerNetworkInfo } from '../peertube-videojs-typings'
-import videojs from 'video.js/dist/alt/video.core.js'
+import videojs from 'video.js'
 import { bytes } from '../utils'
 
 const Button = videojs.getComponent('Button')
@@ -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 servers: ') + 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 ]