]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Prevent error with metrics in HTTP player
authorChocobozzz <me@florianbigard.com>
Tue, 25 Oct 2022 13:07:58 +0000 (15:07 +0200)
committerChocobozzz <me@florianbigard.com>
Tue, 25 Oct 2022 13:08:12 +0000 (15:08 +0200)
client/src/assets/player/shared/metrics/metrics-plugin.ts

index 2844828daf71688f49dc8172b9cecc56f3c94005..0e296bef6f967da8d190665d06c3b4210e08c672 100644 (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)