Prevent error with metrics in HTTP player

pull/5378/head
Chocobozzz 2022-10-25 15:07:58 +02:00
parent 4eb1259e6b
commit ae7b0cbbcf
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 2 additions and 0 deletions

View File

@ -104,6 +104,8 @@ class MetricsPlugin extends Plugin {
private trackBytes () {
this.player.on('p2pInfo', (_event, data: PlayerNetworkInfo) => {
if (!data) return
this.downloadedBytesHTTP += data.http.downloaded - (this.lastPlayerNetworkInfo?.http.downloaded || 0)
this.downloadedBytesP2P += data.p2p.downloaded - (this.lastPlayerNetworkInfo?.p2p.downloaded || 0)