mirror of https://github.com/Chocobozzz/PeerTube
Fix "undefined" in stats card
parent
4ddf488ab5
commit
8a9d247105
|
@ -273,6 +273,8 @@ class StatsCard extends Component {
|
||||||
colorSpace?: string
|
colorSpace?: string
|
||||||
}) {
|
}) {
|
||||||
const { playerNetworkInfo, progress, colorSpace, codecs, resolution, buffer, latency } = options
|
const { playerNetworkInfo, progress, colorSpace, codecs, resolution, buffer, latency } = options
|
||||||
|
const { downloadedFromServer, downloadedFromPeers } = playerNetworkInfo
|
||||||
|
|
||||||
const player = this.player()
|
const player = this.player()
|
||||||
|
|
||||||
const videoQuality: VideoPlaybackQuality = player.getVideoPlaybackQuality()
|
const videoQuality: VideoPlaybackQuality = player.getVideoPlaybackQuality()
|
||||||
|
@ -291,10 +293,14 @@ class StatsCard extends Component {
|
||||||
? `${playerNetworkInfo.downloadSpeed} ⇓ / ${playerNetworkInfo.uploadSpeed} ⇑`
|
? `${playerNetworkInfo.downloadSpeed} ⇓ / ${playerNetworkInfo.uploadSpeed} ⇑`
|
||||||
: undefined
|
: undefined
|
||||||
|
|
||||||
const totalTransferred = playerNetworkInfo.totalDownloaded
|
let totalTransferred = playerNetworkInfo.totalDownloaded
|
||||||
? `${playerNetworkInfo.totalDownloaded} ⇓ / ${playerNetworkInfo.totalUploaded} ⇑`
|
? `${playerNetworkInfo.totalDownloaded} ⇓`
|
||||||
: undefined
|
: ''
|
||||||
const { downloadedFromServer, downloadedFromPeers } = playerNetworkInfo
|
|
||||||
|
if (playerNetworkInfo.totalUploaded) {
|
||||||
|
totalTransferred += `/ ${playerNetworkInfo.totalUploaded} ⇑`
|
||||||
|
}
|
||||||
|
|
||||||
const downloadBreakdown = playerNetworkInfo.downloadedFromServer
|
const downloadBreakdown = playerNetworkInfo.downloadedFromServer
|
||||||
? player.localize('{1} from servers · {2} from peers', [ downloadedFromServer, downloadedFromPeers ])
|
? player.localize('{1} from servers · {2} from peers', [ downloadedFromServer, downloadedFromPeers ])
|
||||||
: undefined
|
: undefined
|
||||||
|
|
Loading…
Reference in New Issue