From 6b909b2c47ea43d8d2611668f3075a4b8eb79468 Mon Sep 17 00:00:00 2001 From: Gabe Kangas Date: Thu, 7 Apr 2022 13:53:23 -0700 Subject: [PATCH] Do not report playback metrics if the network is not in use --- webroot/js/metrics/playback.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/webroot/js/metrics/playback.js b/webroot/js/metrics/playback.js index 150030145..c08ac0f3b 100644 --- a/webroot/js/metrics/playback.js +++ b/webroot/js/metrics/playback.js @@ -154,6 +154,14 @@ class PlaybackMetrics { return; } + // Network state 2 means we're actively using the network. + // We only care about reporting metrics with network activity stats + // if it's actively being used, so don't report otherwise. + const networkState = this.player.networkState(); + if (networkState !== 2) { + return; + } + const bandwidth = tech.vhs.systemBandwidth; this.trackBandwidth(bandwidth);