]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Use round for views stats
authorChocobozzz <me@florianbigard.com>
Fri, 15 Apr 2022 08:47:48 +0000 (10:47 +0200)
committerChocobozzz <me@florianbigard.com>
Fri, 15 Apr 2022 08:47:48 +0000 (10:47 +0200)
client/src/assets/player/shared/peertube/peertube-plugin.ts

index 8b65903f906a957da0b1e3821e625dbc0af6c582..a29a0921f755923501608406335fe07486dc8b54 100644 (file)
@@ -159,7 +159,7 @@ class PeerTubePlugin extends Plugin {
     })
 
     this.player.one('ended', () => {
-      const currentTime = Math.floor(this.player.duration())
+      const currentTime = Math.round(this.player.duration())
       lastCurrentTime = currentTime
 
       this.notifyUserIsWatching(currentTime, lastViewEvent)
@@ -168,7 +168,7 @@ class PeerTubePlugin extends Plugin {
     })
 
     this.videoViewInterval = setInterval(() => {
-      const currentTime = Math.floor(this.player.currentTime())
+      const currentTime = Math.round(this.player.currentTime())
 
       // No need to update
       if (currentTime === lastCurrentTime) return