Fix "undefined" in stats card

pull/5898/head
Chocobozzz 2023-07-20 11:18:47 +02:00
parent 4ddf488ab5
commit 8a9d247105
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 10 additions and 4 deletions

View File

@ -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