diff options
author | Chocobozzz <me@florianbigard.com> | 2023-07-20 11:18:47 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2023-07-20 11:18:47 +0200 |
commit | 8a9d247105ffd8761652f20cd431e890268fd11a (patch) | |
tree | 7aacbe69d69741ebb680bd20e3eb8e54060a4eda /client/src | |
parent | 4ddf488ab5c3f58ae6be811737db7598d05ed13c (diff) | |
download | PeerTube-8a9d247105ffd8761652f20cd431e890268fd11a.tar.gz PeerTube-8a9d247105ffd8761652f20cd431e890268fd11a.tar.zst PeerTube-8a9d247105ffd8761652f20cd431e890268fd11a.zip |
Fix "undefined" in stats card
Diffstat (limited to 'client/src')
-rw-r--r-- | client/src/assets/player/shared/stats/stats-card.ts | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/client/src/assets/player/shared/stats/stats-card.ts b/client/src/assets/player/shared/stats/stats-card.ts index fad68cec9..077c900e5 100644 --- a/client/src/assets/player/shared/stats/stats-card.ts +++ b/client/src/assets/player/shared/stats/stats-card.ts | |||
@@ -273,6 +273,8 @@ class StatsCard extends Component { | |||
273 | colorSpace?: string | 273 | colorSpace?: string |
274 | }) { | 274 | }) { |
275 | const { playerNetworkInfo, progress, colorSpace, codecs, resolution, buffer, latency } = options | 275 | const { playerNetworkInfo, progress, colorSpace, codecs, resolution, buffer, latency } = options |
276 | const { downloadedFromServer, downloadedFromPeers } = playerNetworkInfo | ||
277 | |||
276 | const player = this.player() | 278 | const player = this.player() |
277 | 279 | ||
278 | const videoQuality: VideoPlaybackQuality = player.getVideoPlaybackQuality() | 280 | const videoQuality: VideoPlaybackQuality = player.getVideoPlaybackQuality() |
@@ -291,10 +293,14 @@ class StatsCard extends Component { | |||
291 | ? `${playerNetworkInfo.downloadSpeed} ⇓ / ${playerNetworkInfo.uploadSpeed} ⇑` | 293 | ? `${playerNetworkInfo.downloadSpeed} ⇓ / ${playerNetworkInfo.uploadSpeed} ⇑` |
292 | : undefined | 294 | : undefined |
293 | 295 | ||
294 | const totalTransferred = playerNetworkInfo.totalDownloaded | 296 | let totalTransferred = playerNetworkInfo.totalDownloaded |
295 | ? `${playerNetworkInfo.totalDownloaded} ⇓ / ${playerNetworkInfo.totalUploaded} ⇑` | 297 | ? `${playerNetworkInfo.totalDownloaded} ⇓` |
296 | : undefined | 298 | : '' |
297 | const { downloadedFromServer, downloadedFromPeers } = playerNetworkInfo | 299 | |
300 | if (playerNetworkInfo.totalUploaded) { | ||
301 | totalTransferred += `/ ${playerNetworkInfo.totalUploaded} ⇑` | ||
302 | } | ||
303 | |||
298 | const downloadBreakdown = playerNetworkInfo.downloadedFromServer | 304 | const downloadBreakdown = playerNetworkInfo.downloadedFromServer |
299 | ? player.localize('{1} from servers · {2} from peers', [ downloadedFromServer, downloadedFromPeers ]) | 305 | ? player.localize('{1} from servers · {2} from peers', [ downloadedFromServer, downloadedFromPeers ]) |
300 | : undefined | 306 | : undefined |