Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Fix running metrics on video change

Chocobozzz4bfadcb87e86
diff --git a/client/src/standalone/player/src/shared/metrics/metrics-plugin.ts b/client/src/standalone/player/src/shared/metrics/metrics-plugin.ts
index 23e0b0ebcf..8cd3ca0c6e 100644
--- a/client/src/standalone/player/src/shared/metrics/metrics-plugin.ts
+++ b/client/src/standalone/player/src/shared/metrics/metrics-plugin.ts
@@ -48,7 +48,7 @@ class MetricsPlugin extends Plugin {
this.trackErrors()
this.trackBufferStalled()
- this.one('play', () => {
+ this.player.one('play', () => {
this.player.on('video-change', () => {
this.runMetricsIntervalOnPlay()
})
@@ -63,7 +63,7 @@ class MetricsPlugin extends Plugin {
super.dispose()
}
- private runMetricsIntervalOnPlay () {
+ private resetMetrics () {
this.downloadedBytesP2P = 0
this.downloadedBytesHTTP = 0
this.uploadedBytesP2P = 0
@@ -73,6 +73,10 @@ class MetricsPlugin extends Plugin {
this.bufferStalled = 0
this.lastPlayerNetworkInfo = undefined
+ }
+
+ private runMetricsIntervalOnPlay () {
+ this.resetMetrics()
debugLogger('Will track metrics on next play')