From 8a9d247105ffd8761652f20cd431e890268fd11a Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 20 Jul 2023 11:18:47 +0200 Subject: Fix "undefined" in stats card --- client/src/assets/player/shared/stats/stats-card.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'client/src') 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 { colorSpace?: string }) { const { playerNetworkInfo, progress, colorSpace, codecs, resolution, buffer, latency } = options + const { downloadedFromServer, downloadedFromPeers } = playerNetworkInfo + const player = this.player() const videoQuality: VideoPlaybackQuality = player.getVideoPlaybackQuality() @@ -291,10 +293,14 @@ class StatsCard extends Component { ? `${playerNetworkInfo.downloadSpeed} ⇓ / ${playerNetworkInfo.uploadSpeed} ⇑` : undefined - const totalTransferred = playerNetworkInfo.totalDownloaded - ? `${playerNetworkInfo.totalDownloaded} ⇓ / ${playerNetworkInfo.totalUploaded} ⇑` - : undefined - const { downloadedFromServer, downloadedFromPeers } = playerNetworkInfo + let totalTransferred = playerNetworkInfo.totalDownloaded + ? `${playerNetworkInfo.totalDownloaded} ⇓` + : '' + + if (playerNetworkInfo.totalUploaded) { + totalTransferred += `/ ${playerNetworkInfo.totalUploaded} ⇑` + } + const downloadBreakdown = playerNetworkInfo.downloadedFromServer ? player.localize('{1} from servers ยท {2} from peers', [ downloadedFromServer, downloadedFromPeers ]) : undefined -- cgit v1.2.3